mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 20:15:06 +08:00
汇付支付 执行退款
This commit is contained in:
@@ -5,6 +5,8 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.huifu.adapay.model.Refund;
|
||||
import com.jsowell.JsowellApplication;
|
||||
import com.jsowell.common.constant.CacheConstants;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
@@ -143,6 +145,27 @@ public class SpringBootTestController {
|
||||
@Autowired
|
||||
private AdapayCallbackRecordService adapayCallbackRecordService;
|
||||
|
||||
@Test
|
||||
public void testAdapayRefund() {
|
||||
// 创建汇付退款对象 在完成初始化设置情况下,调用方法,获取 Refund对象
|
||||
try {
|
||||
String id = "002212023052711245310508373206577954816";
|
||||
String refundAmount = "0.01";
|
||||
Map<String, Object> refundParams = Maps.newHashMap();
|
||||
refundParams.put("refund_amt", AdapayUtil.formatAmount(refundAmount));
|
||||
refundParams.put("refund_order_no", SnowflakeIdWorker.getSnowflakeId());
|
||||
Map<String, Object> response = Refund.create(id, refundParams);
|
||||
System.out.println(JSON.toJSONString(response));
|
||||
// if (response != null && !response.isEmpty()) {
|
||||
// JSONObject jsonObject = JSONObject.parseObject(response.get("expend").toString());
|
||||
// JSONObject pay_info = jsonObject.getJSONObject("pay_info");
|
||||
// Map<String, Object> resultMap = JSONObject.parseObject(pay_info.toJSONString(), new TypeReference<Map<String, Object>>() {});
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSaveCallback() throws JsonProcessingException {
|
||||
String data = "{\"app_id\":\"app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa\",\"created_time\":\"20230527100758\",\"description\":\"{\\\"type\\\":\\\"balance\\\",\\\"memberId\\\":\\\"29336349\\\"}\",\"end_time\":\"20230527100810\",\"expend\":{\"bank_type\":\"OTHERS\",\"open_id\":\"o8jhot6PJF93EPhNISsXi28dKdS8\",\"sub_open_id\":\"o4REX5MprZfTaLnVNxfdOY-wnwGI\"},\"fee_amt\":\"0.00\",\"id\":\"002212023052710075810508353847861903360\",\"order_no\":\"4c457bd474334d5eaf82f4795265b6ad\",\"out_trans_id\":\"4200001864202305270647556621\",\"party_order_id\":\"02212305273647819807712\",\"pay_amt\":\"0.01\",\"pay_channel\":\"wx_lite\",\"real_amt\":\"0.01\",\"share_eq\":\"Y\",\"status\":\"succeeded\",\"wx_user_id\":\"\"}";
|
||||
|
||||
Reference in New Issue
Block a user