mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
汇付基础响应
This commit is contained in:
@@ -18,6 +18,7 @@ import com.jsowell.adapay.config.AbstractAdapayConfig;
|
||||
import com.jsowell.adapay.dto.QueryAcctFlowDTO;
|
||||
import com.jsowell.adapay.factory.AdapayConfigFactory;
|
||||
import com.jsowell.adapay.service.AdapayService;
|
||||
import com.jsowell.adapay.vo.DrawCashDetailVO;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.entity.SysDictData;
|
||||
@@ -197,6 +198,14 @@ public class SpringBootTestController {
|
||||
@Autowired
|
||||
private OrderPileOccupyService orderPileOccupyService;
|
||||
|
||||
@Test
|
||||
public void queryDrawcashDetailTest() throws BaseAdaPayException {
|
||||
String orderNo = "drawcash_1692339516947";
|
||||
String wechatAppId = "wxbb3e0d474569481d";
|
||||
DrawCashDetailVO drawCashDetailVO = adapayService.queryDrawCashDetail(orderNo, wechatAppId);
|
||||
System.out.println(drawCashDetailVO);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void queryPaymentConfirmListTest() {
|
||||
// QueryPaymentConfirmDTO dto = new QueryPaymentConfirmDTO();
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.jsowell.adapay.response;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 汇付基础响应
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class AdapayBaseResponse {
|
||||
/**
|
||||
* 当前交易结果状态,参见 状态 说明
|
||||
* @see com.jsowell.common.enums.adapay.AdapayStatusEnum
|
||||
*/
|
||||
private String status;
|
||||
|
||||
private String error_code;
|
||||
private String error_msg;
|
||||
private String error_type;
|
||||
}
|
||||
@@ -7,15 +7,7 @@ import lombok.*;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class BalancePaymentResponse {
|
||||
/**
|
||||
* 当前交易结果状态,参见 状态 说明
|
||||
*/
|
||||
private String status;
|
||||
|
||||
private String error_code;
|
||||
private String error_msg;
|
||||
private String error_type;
|
||||
public class BalancePaymentResponse extends AdapayBaseResponse{
|
||||
|
||||
/**
|
||||
* 商户客户号
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class PaymentConfirmResponse {
|
||||
public class PaymentConfirmResponse extends AdapayBaseResponse{
|
||||
|
||||
/**
|
||||
* 请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
|
||||
@@ -80,8 +80,4 @@ public class PaymentConfirmResponse {
|
||||
*/
|
||||
private String object;
|
||||
|
||||
/**
|
||||
* 当前交易状态,参见 状态 说明
|
||||
*/
|
||||
private String status;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import lombok.*;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class PaymentReverseResponse {
|
||||
public class PaymentReverseResponse extends AdapayBaseResponse{
|
||||
/**
|
||||
* Adapay生成的支付撤销对象id
|
||||
*/
|
||||
@@ -21,11 +21,6 @@ public class PaymentReverseResponse {
|
||||
*/
|
||||
private String object;
|
||||
|
||||
/**
|
||||
* 当前支付撤销状态,参见 状态 说明
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* true是prod模式,false是mock模式
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.*;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class QueryCorpMemberResponse {
|
||||
public class QueryCorpMemberResponse extends AdapayBaseResponse{
|
||||
// 商户下的用户id,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
|
||||
private String memberId;
|
||||
|
||||
@@ -65,9 +65,6 @@ public class QueryCorpMemberResponse {
|
||||
// 企业邮箱
|
||||
private String email;
|
||||
|
||||
// 当前交易状态,参见 状态 说明
|
||||
private String status;
|
||||
|
||||
// 银行代码
|
||||
private String bank_code;
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.jsowell.adapay.response;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询取现对象response
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class QueryDrawCashResponse extends AdapayBaseResponse{
|
||||
@JSONField(name = "cash_list")
|
||||
private List<Cash> cashList;
|
||||
|
||||
@JSONField(name = "prod_mode")
|
||||
private String prodMode;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Cash{
|
||||
@JSONField(name = "cash_id")
|
||||
private String cashId;
|
||||
|
||||
@JSONField(name = "trans_stat")
|
||||
private String transStat;
|
||||
|
||||
@JSONField(name = "cash_amt")
|
||||
private String cashAmt;
|
||||
|
||||
public String getTransStatusDesc() {
|
||||
String transStatusDesc;
|
||||
if (StringUtils.equals("F", transStat)) {
|
||||
transStatusDesc = "失败";
|
||||
} else if (StringUtils.equals("P", transStat)) {
|
||||
transStatusDesc = "处理中";
|
||||
} else {
|
||||
transStatusDesc = "成功";
|
||||
}
|
||||
return transStatusDesc;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class QueryMemberResponse {
|
||||
public class QueryMemberResponse extends AdapayBaseResponse{
|
||||
private String member_id;
|
||||
private String created_time;
|
||||
private String cert_type;
|
||||
@@ -26,7 +26,6 @@ public class QueryMemberResponse {
|
||||
private List<SettleAccount> settle_accounts;
|
||||
private String email;
|
||||
private String object;
|
||||
private String status;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
|
||||
@@ -7,7 +7,7 @@ import lombok.Data;
|
||||
* 查询支付确认对象详情反参
|
||||
*/
|
||||
@Data
|
||||
public class QueryPaymentConfirmDetailResponse {
|
||||
public class QueryPaymentConfirmDetailResponse extends AdapayBaseResponse{
|
||||
@JSONField(name = "payment_id")
|
||||
private String paymentId;
|
||||
|
||||
@@ -26,9 +26,6 @@ public class QueryPaymentConfirmDetailResponse {
|
||||
@JSONField(name = "object")
|
||||
private String object;
|
||||
|
||||
@JSONField(name = "status")
|
||||
private String status;
|
||||
|
||||
static class PaymentConfirm {
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import lombok.*;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class RefundResponse {
|
||||
public class RefundResponse extends AdapayBaseResponse{
|
||||
/**
|
||||
* 由 Adapay 生成的退款对象 id
|
||||
*/
|
||||
@@ -41,8 +41,4 @@ public class RefundResponse {
|
||||
*/
|
||||
private String fee_amt;
|
||||
|
||||
/**
|
||||
* 当前交易状态,参见 状态 说明
|
||||
*/
|
||||
private String status;
|
||||
}
|
||||
|
||||
@@ -14,10 +14,7 @@ import com.jsowell.adapay.config.AbstractAdapayConfig;
|
||||
import com.jsowell.adapay.dto.*;
|
||||
import com.jsowell.adapay.factory.AdapayConfigFactory;
|
||||
import com.jsowell.adapay.response.*;
|
||||
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
|
||||
import com.jsowell.adapay.vo.AdapayCorpMemberVO;
|
||||
import com.jsowell.adapay.vo.AdapayMemberInfoVO;
|
||||
import com.jsowell.adapay.vo.AdapaySettleAccountVO;
|
||||
import com.jsowell.adapay.vo.*;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.redis.RedisCache;
|
||||
@@ -583,7 +580,7 @@ public class AdapayService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现逻辑
|
||||
* 提现逻辑/创建取现对象
|
||||
*
|
||||
* @param dto
|
||||
* @throws BaseAdaPayException
|
||||
@@ -653,6 +650,34 @@ public class AdapayService {
|
||||
clearingBillInfoService.updateStatus(clearingBillIds, billStatus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询取现对象
|
||||
* @param orderNo 请求订单号
|
||||
*/
|
||||
public DrawCashDetailVO queryDrawCashDetail(String orderNo, String wechatAppId) throws BaseAdaPayException {
|
||||
Map<String, Object> queryCashParam = Maps.newHashMap();
|
||||
queryCashParam.put("order_no", orderNo);
|
||||
|
||||
Map<String, Object> response = Drawcash.query(queryCashParam, wechatAppId);
|
||||
log.info("查询取现对象param:{}, result:{}", JSON.toJSONString(queryCashParam), JSON.toJSONString(response));
|
||||
|
||||
if (response != null) {
|
||||
QueryDrawCashResponse queryDrawCashResponse = JSON.parseObject(JSON.toJSONString(response), QueryDrawCashResponse.class);
|
||||
if (queryDrawCashResponse == null || !StringUtils.equals(queryDrawCashResponse.getStatus(), "succeeded")) {
|
||||
return null;
|
||||
}
|
||||
QueryDrawCashResponse.Cash cash = queryDrawCashResponse.getCashList().get(0);
|
||||
|
||||
DrawCashDetailVO vo = new DrawCashDetailVO();
|
||||
vo.setCashId(cash.getCashId());
|
||||
vo.setCashAmt(cash.getCashAmt());
|
||||
vo.setTransStat(cash.getTransStat());
|
||||
vo.setStatusDesc(cash.getTransStatusDesc());
|
||||
return vo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新汇付会员信息
|
||||
*
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.jsowell.adapay.vo;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* 查询取现信息VO
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class DrawCashDetailVO {
|
||||
// Adapay生成的取现对象 id
|
||||
private String cashId;
|
||||
|
||||
// 取现金额
|
||||
private String cashAmt;
|
||||
|
||||
// 取现状态:S-成功,F-失败,P-处理中
|
||||
private String transStat;
|
||||
|
||||
// 状态描述
|
||||
private String statusDesc;
|
||||
}
|
||||
Reference in New Issue
Block a user