报错:
以下代码说明:
传的openid为当前支付人的openid,是可以添加成功的。
传的mchId为分账的出资商户号或一个陌生的商户号,都报请求参数错误!
private static ProfitsharingService profitsharingService;
public static Result addReceiver(String openId,String mchId){
try {
AddReceiverRequest request = new AddReceiverRequest();
request.setSubMchid(sub_mchid);
request.setAppid(appId);
if (!StringUtils.isBlank(openId)){
request.setType(ReceiverType.PERSONAL_OPENID);
request.setAccount(openId);
request.setRelationType(ReceiverRelationType.USER);
}else if(!StringUtils.isBlank(mchId)){
request.setType(ReceiverType.MERCHANT_ID);
request.setAccount(mchId);
request.setRelationType(ReceiverRelationType.PARTNER);
}
AddReceiverResponse addReceiverResponse = profitsharingService.addReceiver(request);
return Result.success(addReceiverResponse);
} catch (ServiceException e) {
log.error("ServiceException添加分账接收方异常",e);
return Result.fail(e.getErrorMessage());
} catch (Exception e){
log.error("Exception添加分账接收方异常",e);
return Result.fail("添加分账接收方异常");
}
}
添加分账接收方为商户号的时候,NAME参数要传递商户全称