普通商户调添加分账接收方接口报参数错误,后台手动添加后,调用请求分账,报服务商和分账方无受理关系?
//添加分账接收方
Config config =
new RSAPublicKeyConfig.Builder()
.merchantId(merchantId)
.privateKeyFromPath(privateKeyPath)
.publicKeyFromPath(publicKeyPath)
.publicKeyId(publicKeyId)
.merchantSerialNumber(merchantSerialNumber)
.apiV3Key(apiV3Key)
.build();
ProfitsharingService profitsharingService = new ProfitsharingService.Builder()
.config(config)
.build();
AddReceiverRequest addReceiverRequest = new AddReceiverRequest();
addReceiverRequest.setSubMchid("*********");//这放的是调用下单接口的商户号
addReceiverRequest.setAppid("**********");
addReceiverRequest.setType(ReceiverType.MERCHANT_ID);
addReceiverRequest.setAccount("******");//这放的是分账接收方的商户号
addReceiverRequest.setRelationType(ReceiverRelationType.PARTNER);
try {
AddReceiverResponse addReceiverResponse = profitsharingService.addReceiver(addReceiverRequest);
System.out.println("addReceiverResponse: " + addReceiverResponse);
} catch (HttpException e) { // 发送HTTP请求失败
// 调用e.getHttpRequest()获取请求打印日志或上报监控,更多方法见HttpException定义
System.out.println("HttpException: " + e.getHttpRequest());
} catch (ServiceException e) { // 服务返回状态小于200或大于等于300,例如500
// 调用e.getResponseBody()获取返回体打印日志或上报监控,更多方法见ServiceException定义
System.out.println("ServiceException: " + e.getResponseBody());
} catch (MalformedMessageException e) { // 服务返回成功,返回体类型不合法,或者解析返回体失败
// 调用e.getMessage()获取信息打印日志或上报监控,更多方法见MalformedMessageException定义
System.out.println("MalformedMessageException: " + e.getMessage());
}
[图片] //分账
Config config =
new RSAPublicKeyConfig.Builder()
.merchantId(merchantId)
.privateKeyFromPath(privateKeyPath)
.publicKeyFromPath(publicKeyPath)
.publicKeyId(publicKeyId)
.merchantSerialNumber(merchantSerialNumber)
.apiV3Key(apiV3Key)
.build();
ProfitsharingService profitsharingService = new ProfitsharingService.Builder()
.config(config)
.build();
CreateOrderRequest createOrderRequest = new CreateOrderRequest();
createOrderRequest.setSubMchid("*******");//这放的是调用下单接口的商户号
createOrderRequest.setAppid("********");
createOrderRequest.setTransactionId(transactionId);
createOrderRequest.setOutOrderNo("CS" + System.currentTimeMillis());
CreateOrderReceiver createOrderReceiver = new CreateOrderReceiver();
createOrderReceiver.setType(ReceiverType.MERCHANT_ID.toString());
createOrderReceiver.setAccount("********");//这放的是分账接收方的商户号
createOrderReceiver.setDescription("测试分账");
createOrderReceiver.setAmount(1L);
List<CreateOrderReceiver> createOrderReceivers = new ArrayList<>();
createOrderReceivers.add(createOrderReceiver);
createOrderRequest.setReceivers(createOrderReceivers);
createOrderRequest.setUnfreezeUnsplit(true);
OrdersEntity order = profitsharingService.createOrder(createOrderRequest);