feat(payment): 集成 FIUU 支付方式并优化退款流程
- 新增 FIUU支付工具类 FiuuUtil,实现退款接口 comRefund
- 在 ApiMallTeamLeaderServiceImpl 中集成 FiuuUtil,替换原有的微信支付退款逻辑
- 更新 ApplyRefundOrderDto 中退款方式描述,增加 FIUU 支付选项
- 在 FIUUController 中添加支付成功后的订单状态更新逻辑
| | |
| | | Boolean flag = false; |
| | | Boolean debug = xcxProperties.getDebug(); |
| | | if (debug) { |
| | | boolean b = fiuuUtil.comRefund(orderNo, refundNo, "1"); |
| | | boolean b = fiuuUtil.comRefund(mallOrderInfo.getPayOrderNo(), refundNo, "1"); |
| | | flag = b; |
| | | } else { |
| | | log.info("开始调用退款接口。。。退款编号为{}", refundNo); |
| | | boolean b = fiuuUtil.comRefund(orderNo, refundNo, orderAmount.toString()); |
| | | boolean b = fiuuUtil.comRefund(mallOrderInfo.getPayOrderNo(), refundNo, orderAmount.toString()); |
| | | flag = b; |
| | | } |
| | | |
| | |
| | | private static final String API_URL = "https://api.fiuu.com/RMS/API/refundAPI/index.php"; |
| | | private static final String MERCHANT_ID = "e2umart01"; |
| | | private static final String SECRET_KEY = "59c709fc18978a6a83b87f05d37cecbf"; |
| | | |
| | | @Transactional |
| | | public boolean comRefund(String outTradeNo, String outRefundNo,String amount){ |
| | | // 退款请求参数 |
| | |
| | | Map<String, String> params = new LinkedHashMap<>(); |
| | | params.put("RefundType", "P"); // P: Partial Refund, F: Full Refund |
| | | params.put("MerchantID", MERCHANT_ID); |
| | | params.put("RefID", "REF123456"); // 商户唯一退款ID |
| | | params.put("TxnID", "123456789"); // Fiuu原始交易ID |
| | | params.put("Amount", "100.00"); // 退款金额 |
| | | params.put("BankCode", "MBBEMYKL"); // 银行代码(可选) |
| | | params.put("BankCountry", "MY"); // 国家代码(可选) |
| | | params.put("BeneficiaryName", "John Doe"); // 收款人姓名(可选) |
| | | params.put("BeneficiaryAccNo", "1234567890"); // 收款账号(可选) |
| | | params.put("RefID", "2025020614313541756_RITEM426"); // 商户唯一退款ID |
| | | params.put("TxnID", "2685173864"); // Fiuu原始交易ID |
| | | params.put("Amount", "1.00"); // 退款金额 |
| | | |
| | | // 生成签名 |
| | | String signature = generateSignature(params); |