You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					77 lines
				
				3.1 KiB
			
		
		
			
		
	
	
					77 lines
				
				3.1 KiB
			| 
								 
											3 years ago
										 
									 | 
							
								package com.bocom.api.example.pmssMpng;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import com.alibaba.fastjson.JSON;
							 | 
						||
| 
								 | 
							
								import com.bocom.api.DefaultBocomClient;
							 | 
						||
| 
								 | 
							
								import com.bocom.api.helper.DateHelper;
							 | 
						||
| 
								 | 
							
								import com.bocom.api.helper.MyConfig;
							 | 
						||
| 
								 | 
							
								import com.bocom.api.request.pmssMpng.MPNG020701RequestV1;
							 | 
						||
| 
								 | 
							
								import com.bocom.api.response.pmssMpng.MPNG020701ResponseV1;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import java.util.Date;
							 | 
						||
| 
								 | 
							
								import java.util.UUID;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * <pre>
							 | 
						||
| 
								 | 
							
								 * 逿款接口@MPNG-MAPI
							 | 
						||
| 
								 | 
							
								 * </pre>
							 | 
						||
| 
								 | 
							
								 * <p>
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * </p>
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								public class RefundMoney_MPNG020701V1Test {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    public static void main(String[] args) {
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        try {
							 | 
						||
| 
								 | 
							
								            DefaultBocomClient client = new DefaultBocomClient(MyConfig.APP_ID, MyConfig.MY_PRIVATE_KEY, MyConfig.APIGW_PUBLIC_KEY);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            client.ignoreSSLHostnameVerifier();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            MPNG020701RequestV1 request = new MPNG020701RequestV1();
							 | 
						||
| 
								 | 
							
								            request.setServiceUrl(MyConfig.APIGW_URL_ADDRESS + "/api/pmssMpng/MPNG020701/v1");
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            MPNG020701RequestV1.MPNG020701RequestV1Biz bizContent = new MPNG020701RequestV1.MPNG020701RequestV1Biz();
							 | 
						||
| 
								 | 
							
								            MPNG020701RequestV1.MPNG020701RequestV1Biz.ReqHead reqHead = new MPNG020701RequestV1.MPNG020701RequestV1Biz.ReqHead();
							 | 
						||
| 
								 | 
							
								            reqHead.setTransTime(DateHelper.dateToStr(new Date(), DateHelper.DateEnum.yyyyMMddHHmmss)); // 交易时间 yyyyMMddHHmmss
							 | 
						||
| 
								 | 
							
								            reqHead.setVersion("V-1.0");    // 版本信息
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            // ======================================================
							 | 
						||
| 
								 | 
							
								            MPNG020701RequestV1.MPNG020701RequestV1Biz.ReqBody reqBody = new MPNG020701RequestV1.MPNG020701RequestV1Biz.ReqBody();
							 | 
						||
| 
								 | 
							
								//            reqBody.setTranScene(MyConfig.B2C_JSAPI_WECHAT);
							 | 
						||
| 
								 | 
							
								             reqBody.setTranScene("B2C-API-DISPLAYCODE");
							 | 
						||
| 
								 | 
							
								            reqBody.setMerPtcId(MyConfig.MER_PTC_ID);
							 | 
						||
| 
								 | 
							
								            reqBody.setPartnerId(MyConfig.PARTNER_ID);
							 | 
						||
| 
								 | 
							
								//            reqBody.setNotifyUrl(MyConfig.NOTIFY_URL);
							 | 
						||
| 
								 | 
							
								            // 商户交易日期 yyyyMMdd
							 | 
						||
| 
								 | 
							
								            reqBody.setMerTradeDate("20220308");
							 | 
						||
| 
								 | 
							
								            reqBody.setMerRefundDate(DateHelper.dateToStr(new Date(), DateHelper.DateEnum.yyyyMMdd));
							 | 
						||
| 
								 | 
							
								            reqBody.setMerRefundTime(DateHelper.dateToStr(new Date(), DateHelper.DateEnum.HHmmss));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//            reqBody.setShopId("15762125456741");
							 | 
						||
| 
								 | 
							
								            reqBody.setAmount("0.01");
							 | 
						||
| 
								 | 
							
								            reqBody.setPayMerTranNo("Test_xbd_3032"); // 订单号
							 | 
						||
| 
								 | 
							
								            reqBody.setRefundMerTranNo("Refund_xbd_3032"); // 退费订单号
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            reqBody.setCurrency("CNY");
							 | 
						||
| 
								 | 
							
								            reqBody.setTranContent("交易内容c");
							 | 
						||
| 
								 | 
							
								            reqBody.setMerMemo("退款Memo");
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            bizContent.setReqHead(reqHead);
							 | 
						||
| 
								 | 
							
								            bizContent.setReqBody(reqBody);
							 | 
						||
| 
								 | 
							
								            request.setBizContent(bizContent);
							 | 
						||
| 
								 | 
							
								            MPNG020701ResponseV1 response = client.execute(request, UUID.randomUUID().toString().replace("-", ""));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								            System.out.println("[交行]退款 resp={}" + JSON.toJSONString(response));
							 | 
						||
| 
								 | 
							
								            if (response.isSuccess()) {
							 | 
						||
| 
								 | 
							
								                System.out.println("success");
							 | 
						||
| 
								 | 
							
								            } else {
							 | 
						||
| 
								 | 
							
								                System.out.println(response.getRspCode());
							 | 
						||
| 
								 | 
							
								                System.out.println(response.getRspMsg());
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								        } catch (Exception xcp) {
							 | 
						||
| 
								 | 
							
								            xcp.printStackTrace();
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |