优化PayPay支付通道
This commit is contained in:
parent
564613d50e
commit
445b55449c
|
|
@ -707,6 +707,7 @@ INSERT INTO t_pay_way (way_code, way_name) VALUES ('ALI_APP', '支付宝APP');
|
|||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('ALI_WAP', '支付宝WAP');
|
||||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('ALI_PC', '支付宝PC网站');
|
||||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('ALI_QR', '支付宝二维码');
|
||||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('ALI_LITE', '支付小程序');
|
||||
|
||||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('WX_BAR', '微信条码');
|
||||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('WX_JSAPI', '微信公众号');
|
||||
|
|
@ -718,7 +719,7 @@ INSERT INTO t_pay_way (way_code, way_name) VALUES ('WX_LITE', '微信小程序')
|
|||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('YSF_BAR', '云闪付条码');
|
||||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('YSF_JSAPI', '云闪付jsapi');
|
||||
|
||||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('PP_PC', 'Paypal PC 支付');
|
||||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('PP_PC', 'PayPal支付');
|
||||
|
||||
-- 初始化支付接口定义
|
||||
INSERT INTO t_pay_interface_define (if_code, if_name, is_mch_mode, is_isv_mode, config_page_type, isv_params, isvsub_mch_params, normal_mch_params, way_codes, icon, bg_color, state, remark)
|
||||
|
|
@ -746,9 +747,9 @@ VALUES ('ysfpay', '云闪付官方', 0, 1, 1,
|
|||
'http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/ysfpay.png', 'red', 1, '云闪付官方通道');
|
||||
|
||||
INSERT INTO t_pay_interface_define (if_code, if_name, is_mch_mode, is_isv_mode, config_page_type, isv_params, isvsub_mch_params, normal_mch_params, way_codes, icon, bg_color, state, remark)
|
||||
VALUES ('pppay', 'Paypal 支付', 1, 0, 1,
|
||||
VALUES ('pppay', 'PayPal支付', 1, 0, 1,
|
||||
NULL,
|
||||
NULL,
|
||||
'[{"name":"sandbox","desc":"环境配置","type":"radio","verify":"required","values":"1,0","titles":"沙箱环境, 生产环境"},{"name":"clientId","desc":"Client ID","type":"text","verify":"required"},{"name":"secret","desc":"Secret","type":"text","verify":"required"},{"name":"refundWebhook","desc":"退款 Webhook id","type":"text","verify":"required"},{"name":"notifyWebhook","desc":"通知 Webhook id","type":"text","verify":"required"}]',
|
||||
'[{"name":"sandbox","desc":"环境配置","type":"radio","verify":"required","values":"1,0","titles":"沙箱环境, 生产环境"},{"name":"clientId","desc":"Client ID(客户端ID)","type":"text","verify":"required"},{"name":"secret","desc":"Secret(密钥)","type":"text","verify":"required","star":"1"},{"name":"refundWebhook","desc":"退款 Webhook id","type":"text","verify":"required"},{"name":"notifyWebhook","desc":"通知 Webhook id","type":"text","verify":"required"}]',
|
||||
'[{"wayCode": "PP_PC"}]',
|
||||
'https://payment-public.oss-cn-shenzhen.aliyuncs.com/ifBG/0b6c2cc3-d31b-4f5c-b076-f13c74d80b85.png', '#005ea6', 1, 'Paypal官方通道');
|
||||
'http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/paypal.png', '#005ea6', 1, 'PayPal官方通道');
|
||||
|
|
|
|||
|
|
@ -227,3 +227,14 @@ alter table t_refund_order modify err_msg varchar(2048) null comment '渠道错
|
|||
|
||||
-- 增加角色权限字段长度
|
||||
alter table `t_sys_role_ent_rela` MODIFY `ent_id` VARCHAR(64) NOT NULL COMMENT '权限ID' after `role_id`;
|
||||
|
||||
## -- ++++ [v1.10.0] ===> [v1.xx.0] 待发布 ++++
|
||||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('ALI_LITE', '支付小程序');
|
||||
INSERT INTO t_pay_way (way_code, way_name) VALUES ('PP_PC', 'PayPal支付');
|
||||
INSERT INTO t_pay_interface_define (if_code, if_name, is_mch_mode, is_isv_mode, config_page_type, isv_params, isvsub_mch_params, normal_mch_params, way_codes, icon, bg_color, state, remark)
|
||||
VALUES ('pppay', 'PayPal支付', 1, 0, 1,
|
||||
NULL,
|
||||
NULL,
|
||||
'[{"name":"sandbox","desc":"环境配置","type":"radio","verify":"required","values":"1,0","titles":"沙箱环境, 生产环境"},{"name":"clientId","desc":"Client ID(客户端ID)","type":"text","verify":"required"},{"name":"secret","desc":"Secret(密钥)","type":"text","verify":"required","star":"1"},{"name":"refundWebhook","desc":"退款 Webhook id","type":"text","verify":"required"},{"name":"notifyWebhook","desc":"通知 Webhook id","type":"text","verify":"required"}]',
|
||||
'[{"wayCode": "PP_PC"}]',
|
||||
'http://jeequan.oss-cn-beijing.aliyuncs.com/jeepay/img/paypal.png', '#005ea6', 1, 'PayPal官方通道');
|
||||
|
|
@ -108,7 +108,12 @@ public class PaytestController extends CommonCtrl {
|
|||
model.setMchOrderNo(mchOrderNo);
|
||||
model.setWayCode(wayCode);
|
||||
model.setAmount(amount);
|
||||
model.setCurrency("CNY");
|
||||
// paypal通道使用USD类型货币
|
||||
if(wayCode.equalsIgnoreCase("pp_pc")) {
|
||||
model.setCurrency("USD");
|
||||
}else {
|
||||
model.setCurrency("CNY");
|
||||
}
|
||||
model.setClientIp(getClientIp());
|
||||
model.setSubject(orderTitle + "[" + getCurrentMchNo() + "商户联调]");
|
||||
model.setBody(orderTitle + "[" + getCurrentMchNo() + "商户联调]");
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class PppayChannelNoticeService extends AbstractChannelNoticeService {
|
|||
public MutablePair<String, Object> parseParams(HttpServletRequest request, String urlOrderId,
|
||||
NoticeTypeEnum noticeTypeEnum) {
|
||||
// 同步和异步需要不同的解析方案
|
||||
// 异步需要从 webhook 中读取,所有这里读取方式不太一样
|
||||
// 异步需要从 webhook 中读取,所以这里读取方式不太一样
|
||||
if (noticeTypeEnum == NoticeTypeEnum.DO_NOTIFY) {
|
||||
JSONObject params = JSONUtil.parseObj(getReqParamJSON().toJSONString());
|
||||
String orderId = params.getByPath("resource.purchase_units[0].invoice_id", String.class);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,9 @@ import com.jeequan.jeepay.pay.channel.AbstractPaymentService;
|
|||
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
|
||||
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
|
||||
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
|
||||
import com.jeequan.jeepay.pay.service.ConfigContextQueryService;
|
||||
import com.jeequan.jeepay.pay.util.PaywayUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
|
@ -18,6 +20,10 @@ import org.springframework.stereotype.Service;
|
|||
*/
|
||||
@Service
|
||||
public class PppayPaymentService extends AbstractPaymentService {
|
||||
|
||||
@Autowired
|
||||
public ConfigContextQueryService configContextQueryService;
|
||||
|
||||
@Override
|
||||
public String getIfCode() {
|
||||
return CS.IF_CODE.PPPAY;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
package com.jeequan.jeepay.pay.channel.pppay;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeequan.jeepay.core.constants.CS;
|
||||
import com.jeequan.jeepay.core.entity.PayOrder;
|
||||
import com.jeequan.jeepay.core.entity.RefundOrder;
|
||||
import com.jeequan.jeepay.core.utils.AmountUtil;
|
||||
import com.jeequan.jeepay.pay.channel.AbstractRefundService;
|
||||
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
|
||||
import com.jeequan.jeepay.pay.model.PaypalWrapper;
|
||||
|
|
@ -10,6 +13,7 @@ import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
|
|||
import com.jeequan.jeepay.pay.rqrs.refund.RefundOrderRQ;
|
||||
import com.paypal.core.PayPalHttpClient;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.exceptions.HttpException;
|
||||
import com.paypal.http.serializer.Json;
|
||||
import com.paypal.payments.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -53,9 +57,8 @@ public class PppayRefundService extends AbstractRefundService {
|
|||
PayPalHttpClient client = paypalWrapper.getClient();
|
||||
|
||||
// 处理金额
|
||||
long amount = (bizRQ.getRefundAmount() / 100);
|
||||
String amountStr = Long.toString(amount, 10);
|
||||
String currency = bizRQ.getCurrency().toUpperCase();
|
||||
String amountStr = AmountUtil.convertCent2Dollar(refundOrder.getRefundAmount().toString());
|
||||
String currency = payOrder.getCurrency().toUpperCase();
|
||||
|
||||
RefundRequest refundRequest = new RefundRequest();
|
||||
Money money = new Money();
|
||||
|
|
@ -69,10 +72,19 @@ public class PppayRefundService extends AbstractRefundService {
|
|||
CapturesRefundRequest request = new CapturesRefundRequest(ppCatptId);
|
||||
request.prefer("return=representation");
|
||||
request.requestBody(refundRequest);
|
||||
HttpResponse<Refund> response = client.execute(request);
|
||||
|
||||
ChannelRetMsg channelRetMsg = ChannelRetMsg.waiting();
|
||||
channelRetMsg.setResponseEntity(paypalWrapper.textResp("ERROR"));
|
||||
HttpResponse<Refund> response;
|
||||
try{
|
||||
response = client.execute(request);
|
||||
}catch (HttpException e) {
|
||||
String message = e.getMessage();
|
||||
cn.hutool.json.JSONObject messageObj = JSONUtil.parseObj(message);
|
||||
String issue = messageObj.getByPath("details[0].issue", String.class);
|
||||
String description = messageObj.getByPath("details[0].description", String.class);
|
||||
return ChannelRetMsg.confirmFail(issue, description);
|
||||
}
|
||||
|
||||
if (response.statusCode() == 201) {
|
||||
String responseJson = new Json().serialize(response.result());
|
||||
|
|
@ -81,9 +93,7 @@ public class PppayRefundService extends AbstractRefundService {
|
|||
channelRetMsg.setChannelOrderId(response.result().id());
|
||||
channelRetMsg.setResponseEntity(paypalWrapper.textResp("SUCCESS"));
|
||||
} else {
|
||||
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.CONFIRM_FAIL);
|
||||
channelRetMsg.setChannelErrCode("201");
|
||||
channelRetMsg.setChannelErrMsg("请求退款失败,Paypal 响应非 201");
|
||||
return ChannelRetMsg.confirmFail("201", "请求退款失败,Paypal 响应非 201");
|
||||
}
|
||||
|
||||
return channelRetMsg;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package com.jeequan.jeepay.pay.channel.pppay.payway;
|
|||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.jeequan.jeepay.core.entity.PayOrder;
|
||||
import com.jeequan.jeepay.core.exception.BizException;
|
||||
import com.jeequan.jeepay.core.utils.AmountUtil;
|
||||
import com.jeequan.jeepay.pay.channel.pppay.PppayPaymentService;
|
||||
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
|
||||
import com.jeequan.jeepay.pay.model.PaypalWrapper;
|
||||
|
|
@ -11,7 +11,9 @@ import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
|
|||
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
|
||||
import com.jeequan.jeepay.pay.rqrs.payorder.payway.PPPcOrderRQ;
|
||||
import com.jeequan.jeepay.pay.rqrs.payorder.payway.PPPcOrderRS;
|
||||
import com.jeequan.jeepay.pay.util.ApiResBuilder;
|
||||
import com.paypal.http.HttpResponse;
|
||||
import com.paypal.http.exceptions.HttpException;
|
||||
import com.paypal.http.serializer.Json;
|
||||
import com.paypal.orders.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -33,10 +35,6 @@ import java.util.List;
|
|||
public class PpPc extends PppayPaymentService {
|
||||
@Override
|
||||
public String preCheck(UnifiedOrderRQ bizRQ, PayOrder payOrder) {
|
||||
PPPcOrderRQ rq = (PPPcOrderRQ) bizRQ;
|
||||
if (StringUtils.isEmpty(rq.getCancelUrl())) {
|
||||
throw new BizException("用户取消支付回调[cancelUrl]不可为空");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -51,19 +49,21 @@ public class PpPc extends PppayPaymentService {
|
|||
ApplicationContext applicationContext = new ApplicationContext()
|
||||
.brandName(mchAppConfigContext.getMchApp().getAppName())
|
||||
.landingPage("NO_PREFERENCE")
|
||||
.cancelUrl(bizRQ.getCancelUrl())
|
||||
.returnUrl(getReturnUrl(payOrder.getPayOrderId()))
|
||||
.userAction("PAY_NOW")
|
||||
.shippingPreference("NO_SHIPPING");
|
||||
|
||||
if(StringUtils.isNotBlank(bizRQ.getCancelUrl())) {
|
||||
applicationContext.cancelUrl(bizRQ.getCancelUrl());
|
||||
}
|
||||
|
||||
orderRequest.applicationContext(applicationContext);
|
||||
orderRequest.checkoutPaymentIntent("CAPTURE");
|
||||
|
||||
List<PurchaseUnitRequest> purchaseUnitRequests = new ArrayList<>();
|
||||
|
||||
// 金额换算
|
||||
long amount = (payOrder.getAmount() / 100);
|
||||
String amountStr = Long.toString(amount, 10);
|
||||
String amountStr = AmountUtil.convertCent2Dollar(payOrder.getAmount().toString());
|
||||
String currency = payOrder.getCurrency().toUpperCase();
|
||||
|
||||
// 由于 Paypal 是支持订单多商品的,这里值添加一个
|
||||
|
|
@ -95,16 +95,31 @@ public class PpPc extends PppayPaymentService {
|
|||
orderRequest.purchaseUnits(purchaseUnitRequests);
|
||||
|
||||
// 从缓存获取 Paypal 操作工具
|
||||
PaypalWrapper palApiConfig = mchAppConfigContext.getPaypalWrapper();
|
||||
PaypalWrapper paypalWrapper = configContextQueryService.getPaypalWrapper(mchAppConfigContext);
|
||||
|
||||
OrdersCreateRequest request = new OrdersCreateRequest();
|
||||
request.header("prefer", "return=representation");
|
||||
request.requestBody(orderRequest);
|
||||
HttpResponse<Order> response = palApiConfig.getClient().execute(request);
|
||||
|
||||
PPPcOrderRS res = new PPPcOrderRS();
|
||||
// 构造函数响应数据
|
||||
PPPcOrderRS res = ApiResBuilder.buildSuccess(PPPcOrderRS.class);
|
||||
ChannelRetMsg channelRetMsg = new ChannelRetMsg();
|
||||
|
||||
HttpResponse<Order> response;
|
||||
try{
|
||||
response = paypalWrapper.getClient().execute(request);
|
||||
}catch (HttpException e) {
|
||||
String message = e.getMessage();
|
||||
cn.hutool.json.JSONObject messageObj = JSONUtil.parseObj(message);
|
||||
String issue = messageObj.getByPath("details[0].issue", String.class);
|
||||
String description = messageObj.getByPath("details[0].description", String.class);
|
||||
channelRetMsg.setChannelState(ChannelRetMsg.ChannelState.CONFIRM_FAIL);
|
||||
channelRetMsg.setChannelErrCode(issue);
|
||||
channelRetMsg.setChannelErrMsg(description);
|
||||
res.setChannelRetMsg(channelRetMsg);
|
||||
return res;
|
||||
}
|
||||
|
||||
// 标准返回 HttpPost 需要为 201
|
||||
if (response.statusCode() == 201) {
|
||||
Order order = response.result();
|
||||
|
|
@ -122,7 +137,7 @@ public class PpPc extends PppayPaymentService {
|
|||
// 设置返回实体
|
||||
channelRetMsg.setChannelAttach(JSONUtil.toJsonStr(new Json().serialize(order)));
|
||||
channelRetMsg.setChannelOrderId(tradeNo + "," + "null"); // 拼接订单ID
|
||||
channelRetMsg = palApiConfig.dispatchCode(status, channelRetMsg); // 处理状态码
|
||||
channelRetMsg = paypalWrapper.dispatchCode(status, channelRetMsg); // 处理状态码
|
||||
|
||||
// 设置支付链接
|
||||
res.setPayUrl(paypalLink.href());
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.jeequan.jeepay.pay.model;
|
|||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.jeequan.jeepay.core.entity.PayOrder;
|
||||
import com.jeequan.jeepay.core.model.params.pppay.PpPayNormalMchParams;
|
||||
import com.jeequan.jeepay.core.model.params.wxpay.WxpayNormalMchParams;
|
||||
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
|
||||
import com.paypal.core.PayPalEnvironment;
|
||||
import com.paypal.core.PayPalHttpClient;
|
||||
|
|
@ -190,4 +192,19 @@ public class PaypalWrapper {
|
|||
httpHeaders.setContentType(MediaType.TEXT_HTML);
|
||||
return new ResponseEntity(text, httpHeaders, HttpStatus.OK);
|
||||
}
|
||||
|
||||
public static PaypalWrapper buildPaypalWrapper(PpPayNormalMchParams ppPayNormalMchParams){
|
||||
PaypalWrapper paypalWrapper = new PaypalWrapper();
|
||||
PayPalEnvironment environment = new PayPalEnvironment.Live(ppPayNormalMchParams.getClientId(), ppPayNormalMchParams.getSecret());
|
||||
if (ppPayNormalMchParams.getSandbox() == 1) {
|
||||
environment = new PayPalEnvironment.Sandbox(ppPayNormalMchParams.getClientId(), ppPayNormalMchParams.getSecret());
|
||||
}
|
||||
paypalWrapper.setEnvironment(environment);
|
||||
paypalWrapper.setClient(new PayPalHttpClient(environment));
|
||||
paypalWrapper.setNotifyWebhook(ppPayNormalMchParams.getNotifyWebhook());
|
||||
paypalWrapper.setRefundWebhook(ppPayNormalMchParams.getRefundWebhook());
|
||||
return paypalWrapper;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,11 @@ public class ChannelRetMsg implements Serializable {
|
|||
return new ChannelRetMsg(ChannelState.CONFIRM_SUCCESS, channelOrderId, null, null);
|
||||
}
|
||||
|
||||
/** 明确失败 **/
|
||||
public static ChannelRetMsg confirmFail(String channelErrCode, String channelErrMsg){
|
||||
return new ChannelRetMsg(ChannelState.CONFIRM_FAIL, null, channelErrCode, channelErrMsg);
|
||||
}
|
||||
|
||||
/** 明确失败 **/
|
||||
public static ChannelRetMsg confirmFail(String channelOrderId, String channelErrCode, String channelErrMsg){
|
||||
return new ChannelRetMsg(ChannelState.CONFIRM_FAIL, channelOrderId, channelErrCode, channelErrMsg);
|
||||
|
|
|
|||
|
|
@ -24,12 +24,10 @@ import com.jeequan.jeepay.core.model.params.IsvsubMchParams;
|
|||
import com.jeequan.jeepay.core.model.params.NormalMchParams;
|
||||
import com.jeequan.jeepay.core.model.params.alipay.AlipayIsvParams;
|
||||
import com.jeequan.jeepay.core.model.params.alipay.AlipayNormalMchParams;
|
||||
import com.jeequan.jeepay.core.model.params.pppay.PpPayNormalMchParams;
|
||||
import com.jeequan.jeepay.core.model.params.wxpay.WxpayIsvParams;
|
||||
import com.jeequan.jeepay.core.model.params.wxpay.WxpayNormalMchParams;
|
||||
import com.jeequan.jeepay.pay.model.AlipayClientWrapper;
|
||||
import com.jeequan.jeepay.pay.model.IsvConfigContext;
|
||||
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
|
||||
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
|
||||
import com.jeequan.jeepay.pay.model.*;
|
||||
import com.jeequan.jeepay.service.impl.MchAppService;
|
||||
import com.jeequan.jeepay.service.impl.MchInfoService;
|
||||
import com.jeequan.jeepay.service.impl.PayInterfaceConfigService;
|
||||
|
|
@ -201,4 +199,14 @@ public class ConfigContextQueryService {
|
|||
|
||||
}
|
||||
|
||||
public PaypalWrapper getPaypalWrapper(MchAppConfigContext mchAppConfigContext){
|
||||
if(isCache()){
|
||||
return
|
||||
configContextService.getMchAppConfigContext(mchAppConfigContext.getMchNo(), mchAppConfigContext.getAppId()).getPaypalWrapper();
|
||||
}
|
||||
PpPayNormalMchParams ppPayNormalMchParams = (PpPayNormalMchParams) queryNormalMchParams(mchAppConfigContext.getMchNo(), mchAppConfigContext.getAppId(), CS.IF_CODE.PPPAY);;
|
||||
return PaypalWrapper.buildPaypalWrapper(ppPayNormalMchParams);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ public class ConfigContextService {
|
|||
//放置 paypal client
|
||||
PpPayNormalMchParams ppPayMchParams = mchAppConfigContext.getNormalMchParamsByIfCode(CS.IF_CODE.PPPAY, PpPayNormalMchParams.class);
|
||||
if (ppPayMchParams != null) {
|
||||
mchAppConfigContext.setPaypalWrapper(buildPaypalWrapper(ppPayMchParams.getSandbox(), ppPayMchParams.getSecret(), ppPayMchParams.getClientId(), ppPayMchParams.getNotifyWebhook(), ppPayMchParams.getRefundWebhook()));
|
||||
mchAppConfigContext.setPaypalWrapper(PaypalWrapper.buildPaypalWrapper(ppPayMchParams));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -326,29 +326,6 @@ public class ConfigContextService {
|
|||
}
|
||||
}
|
||||
|
||||
private PaypalWrapper buildPaypalWrapper(
|
||||
Byte sandbox,
|
||||
String secret,
|
||||
String clientId,
|
||||
String notifyHook,
|
||||
String refundHook
|
||||
) {
|
||||
PaypalWrapper paypalWrapper = new PaypalWrapper();
|
||||
|
||||
PayPalEnvironment environment = new PayPalEnvironment.Live(clientId, secret);
|
||||
|
||||
if (sandbox == 1) {
|
||||
environment = new PayPalEnvironment.Sandbox(clientId, secret);
|
||||
}
|
||||
|
||||
paypalWrapper.setEnvironment(environment);
|
||||
paypalWrapper.setClient(new PayPalHttpClient(environment));
|
||||
paypalWrapper.setNotifyWebhook(notifyHook);
|
||||
paypalWrapper.setRefundWebhook(refundHook);
|
||||
|
||||
return paypalWrapper;
|
||||
}
|
||||
|
||||
private boolean isCache(){
|
||||
return SysConfigService.IS_USE_CACHE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,44 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>支付完成 - 聚合支付</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>支付完成</title>
|
||||
<link rel="stylesheet" href="https://cdn.staticfile.org/layui/2.4.3/css/layui.css">
|
||||
<style>
|
||||
.mainDiv1 {color:lightseagreen; text-align:center; margin-top: 50px;}
|
||||
.mainDiv2 {text-align:center; margin-top: 10px;}
|
||||
.mainDiv3 {text-align:center; margin-top: 200px;}
|
||||
.mainDivTitle {text-align:center; margin-top: 20px; color:orangered }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>支付成功</h1>
|
||||
<div class="mainDiv1 layui-fluid">
|
||||
<i class="layui-icon" style="font-size:100px;">စ</i>
|
||||
</div>
|
||||
<div class="mainDiv2 layui-fluid">
|
||||
<span style="font-size:16px">支付成功</span>
|
||||
</div>
|
||||
|
||||
<div class="mainDiv3 layui-fluid">
|
||||
<a class="layui-btn layui-btn-primary closeBtn">关闭页面</a>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.staticfile.org/layui/2.4.3/layui.min.js"></script>
|
||||
<script>
|
||||
layui.use(['jquery'], function(){
|
||||
layui.$(".closeBtn").click(function(){
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if(ua.match(/MicroMessenger/i)=="micromessenger") {
|
||||
WeixinJSBridge.call('closeWindow');
|
||||
}else if(ua.indexOf("alipay")!=-1){
|
||||
AlipayJSBridge.call('closeWebview');
|
||||
}else{
|
||||
window.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue