mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
校验支付确认是否撤销
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.jsowell.adapay.dto;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class QueryConfirmReverseDTO {
|
||||
/**
|
||||
* 控制台 主页面应用的app_id
|
||||
*/
|
||||
private String wechatAppId;
|
||||
|
||||
/**
|
||||
* Adapay生成的支付确认对象id
|
||||
*/
|
||||
private String paymentConfirmId;
|
||||
}
|
||||
@@ -10,6 +10,9 @@ import lombok.*;
|
||||
@Getter
|
||||
@Setter
|
||||
public class AdapayBaseResponse {
|
||||
// 是否 prod模式,true 是 prod模式,false 是 mock模式
|
||||
private String prod_mode;
|
||||
|
||||
/**
|
||||
* 当前交易结果状态,参见 状态 说明
|
||||
* @see com.jsowell.common.enums.adapay.AdapayStatusEnum
|
||||
@@ -20,6 +23,9 @@ public class AdapayBaseResponse {
|
||||
private String error_msg;
|
||||
private String error_type;
|
||||
|
||||
// 当发生参数错误时返回具体的参数名,便于定位错误原因,详见 错误
|
||||
private String invalid_param;
|
||||
|
||||
public boolean isSuccess() {
|
||||
return StringUtils.equals(status, AdapayStatusEnum.SUCCEEDED.getValue());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jsowell.adapay.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class ConfirmReverseResponse extends AdapayBaseResponse {
|
||||
//支付确认撤销对象 列表,若未查询到结果时,字段为空
|
||||
private String confirm_reverses;
|
||||
}
|
||||
@@ -52,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -1206,4 +1207,21 @@ public class AdapayService {
|
||||
} while (hasMore);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支付确认撤销对象
|
||||
*/
|
||||
public ConfirmReverseResponse queryConfirmReverse(QueryConfirmReverseDTO dto) throws BaseAdaPayException {
|
||||
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(dto.getWechatAppId());
|
||||
if (config == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CONFIG_IS_NULL_ERROR);
|
||||
}
|
||||
Map<String, Object> confirmReverseQueryParams = new HashMap<>();
|
||||
confirmReverseQueryParams.put("adapay_func_code", "payments.confirm.reverse.details");
|
||||
confirmReverseQueryParams.put("payment_confirm_id", dto.getPaymentConfirmId());
|
||||
Map<String, Object> confirmReverseQueryResult = AdapayCommon.queryAdapay(confirmReverseQueryParams, config.getWechatAppId());
|
||||
ConfirmReverseResponse confirmReverseResponse = JSON.parseObject(JSON.toJSONString(confirmReverseQueryResult), ConfirmReverseResponse.class);
|
||||
log.info("confirmReverseQueryResult:{}", JSON.toJSONString(confirmReverseResponse));
|
||||
return confirmReverseResponse;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user