payermax-下单-新版本
This commit is contained in:
@@ -17,6 +17,8 @@ import java.math.BigDecimal;
|
||||
@Slf4j
|
||||
public class PayermaxService {
|
||||
|
||||
private final String SPILT_PREFIX = "-";
|
||||
|
||||
public TradePayOrderResponse createOrder(CreateOrderParams params) {
|
||||
checkCreateOrderParams(params);
|
||||
|
||||
@@ -28,18 +30,24 @@ public class PayermaxService {
|
||||
request.setCountry(params.getCountryCode());
|
||||
request.setCurrency(params.getCurrency());
|
||||
request.setUserId(params.getUserId());
|
||||
|
||||
String[] paymentMethodType = params.getPaymentMethodType().split(SPILT_PREFIX);
|
||||
TradeOrderRequest.PaymentDetail paymentDetail = new TradeOrderRequest.PaymentDetail();
|
||||
paymentDetail.setPaymentMethodType(params.getPaymentMethodType());
|
||||
paymentDetail.setPaymentMethodType(paymentMethodType[0]);
|
||||
paymentDetail.setTargetOrg(paymentMethodType[1]);
|
||||
|
||||
request.setPaymentDetail(paymentDetail);
|
||||
request.setFrontCallbackUrl(params.getFrontCallBackUrl());
|
||||
|
||||
log.info("[payermax] 请求参数: {}", JSON.toJSONString(request));
|
||||
|
||||
GatewayResult<TradePayOrderResponse> resp = request.send();
|
||||
if (!resp.isSuccess()){
|
||||
//todo log
|
||||
log.error("aaa {}", JSON.toJSONString(resp));
|
||||
log.error("[payermax] 请求失败 {}", JSON.toJSONString(resp));
|
||||
throw new ServiceException(BusiStatus.SERVERERROR);
|
||||
}
|
||||
|
||||
log.info("[payermax] 请求成功返回 {}", JSON.toJSONString(resp));
|
||||
return resp.getData();
|
||||
}
|
||||
|
||||
@@ -59,6 +67,9 @@ public class PayermaxService {
|
||||
if (StringUtils.isBlank(params.getCountryCode())) {
|
||||
throw new ServiceException(BusiStatus.PARAMERROR, "国家代码不能为空");
|
||||
}
|
||||
if (StringUtils.isBlank(params.getPaymentMethodType())) {
|
||||
throw new ServiceException(BusiStatus.PARAMERROR, "支付方式不能为空");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user