mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 04:25:21 +08:00
查询退款对象
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package com.jsowell.adapay.common;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 退款对象
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class RefundInfo {
|
||||
/**
|
||||
* Adapay生成的退款对象id
|
||||
*/
|
||||
private String refund_id;
|
||||
|
||||
/**
|
||||
* 退款状态:I-初始,P-处理中,F-失败,S-成功
|
||||
*/
|
||||
private String trans_status;
|
||||
|
||||
/**
|
||||
* Adapay生成的支付对象id
|
||||
*/
|
||||
private String payment_id;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private String refund_amt;
|
||||
|
||||
/**
|
||||
* 退款手续费,退款成功时有值
|
||||
*/
|
||||
private String fee_amt;
|
||||
|
||||
/**
|
||||
* 退款订单号
|
||||
*/
|
||||
private String refund_order_no;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.jsowell.adapay.response;
|
||||
|
||||
import com.jsowell.adapay.common.RefundInfo;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询退款对象response
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class PaymentRefundResponse extends AdapayBaseResponse{
|
||||
/**
|
||||
* 是否 prod模式,true 是 prod模式,false 是 mock模式
|
||||
*/
|
||||
private String prod_mode;
|
||||
|
||||
/**
|
||||
* 退款对象列表,若未查询到结果时,字段为空
|
||||
*/
|
||||
private List<RefundInfo> refunds;
|
||||
|
||||
/**
|
||||
* 当发生参数错误时返回具体的参数名,便于定位错误原因,详见 错误
|
||||
*/
|
||||
private String invalid_param;
|
||||
}
|
||||
@@ -12,6 +12,7 @@ import com.huifu.adapay.model.*;
|
||||
import com.jsowell.adapay.common.AdaPayment;
|
||||
import com.jsowell.adapay.common.CreateAdaPaymentParam;
|
||||
import com.jsowell.adapay.common.DivMember;
|
||||
import com.jsowell.adapay.common.RefundInfo;
|
||||
import com.jsowell.adapay.config.AbstractAdapayConfig;
|
||||
import com.jsowell.adapay.dto.*;
|
||||
import com.jsowell.adapay.factory.AdapayConfigFactory;
|
||||
@@ -1030,6 +1031,23 @@ public class AdapayService {
|
||||
return payment_reverses;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支付退款对象
|
||||
*/
|
||||
public List<RefundInfo> queryPaymentRefund(String paymentId, String wechatAppId) throws BaseAdaPayException {
|
||||
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(wechatAppId);
|
||||
if (config == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CONFIG_IS_NULL_ERROR);
|
||||
}
|
||||
Map<String, Object> refundParams = Maps.newHashMap();
|
||||
refundParams.put("payment_id", paymentId);
|
||||
refundParams.put("app_id", config.getAdapayAppId());
|
||||
Map<String, Object> response = Refund.query(refundParams, config.getWechatAppId());
|
||||
PaymentRefundResponse paymentRefundResponse = JSON.parseObject(JSON.toJSONString(response), PaymentRefundResponse.class);
|
||||
List<RefundInfo> refunds = paymentRefundResponse.getRefunds();
|
||||
return refunds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支付确认对象列表
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user