查询退款对象

This commit is contained in:
2023-12-27 16:27:14 +08:00
parent 26be291014
commit dff6ddffae
7 changed files with 195 additions and 0 deletions

View File

@@ -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;
}
/**
* 查询支付确认对象列表
*/