|
@@ -6,6 +6,7 @@ import java.util.*;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
|
|
+import com.huifu.adapay.model.PaymentReverse;
|
|
|
import com.huifu.adapay.model.Refund;
|
|
|
import com.ym.mec.thirdparty.adapay.entity.BaseResult;
|
|
|
import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
|
|
@@ -166,4 +167,33 @@ public class Payment {
|
|
|
}
|
|
|
return BaseResult.succeed(res);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ // 撤销支付
|
|
|
+ public static BaseResult<Map<String ,Object>> reversePayment(String paymentId,String appId,String reverseOrderNo,String reverseAmt,String notifyUrl) {
|
|
|
+
|
|
|
+ LOGGER.info("撤销对象信息:paymentId:{},appId:{},reverseOrderNo:{},reverseAmt:{}",paymentId,appId,reverseOrderNo,reverseAmt);
|
|
|
+ Map<String, Object> res;
|
|
|
+ Map<String,Object> param = new HashMap<>();
|
|
|
+ param.put("app_id",appId);
|
|
|
+ param.put("payment_id",paymentId);
|
|
|
+ param.put("reverse_amt",reverseAmt);
|
|
|
+ param.put("order_no",reverseOrderNo);
|
|
|
+ param.put("notify_url",notifyUrl);
|
|
|
+ try {
|
|
|
+ res = PaymentReverse.create(param);
|
|
|
+ } catch (BaseAdaPayException e) {
|
|
|
+ return BaseResult.failed(e.getMessage());
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isEmpty(res)) {
|
|
|
+ return BaseResult.failed("请求失败");
|
|
|
+ }
|
|
|
+ LOGGER.info("汇付[支付退款] Resp:{}", res);
|
|
|
+ String errorCode = (String) res.get("error_code");
|
|
|
+ if (null != errorCode) {
|
|
|
+ String errorMsg = (String) res.get("error_msg");
|
|
|
+ return BaseResult.failed(errorMsg);
|
|
|
+ }
|
|
|
+ return BaseResult.succeed(res);
|
|
|
+ }
|
|
|
}
|