diff --git a/pages.json b/pages.json index e4d0b22dc4105a5d9c9b364f6c51307c07b18c2c..d92977411a930f9dada6da38777714f363ae5d95 100644 --- a/pages.json +++ b/pages.json @@ -1018,6 +1018,13 @@ "enablePullDownRefresh": false } }, + { + "path": "pages/API/virtual-payment/virtual-payment-uni-pay", + "style": { + "navigationBarTitleText": "苹果虚拟支付(uni-pay)", + "enablePullDownRefresh": false + } + }, // #endif { "path": "pages/API/request-payment/request-payment/order-detail", @@ -1744,14 +1751,14 @@ { "path": "uni_modules/uni-pay-x/pages/ad-interactive-webview/ad-interactive-webview", "style": { - "navigationBarTitleText": "收银台", + "navigationBarTitleText": "ad", "backgroundColor": "#F8F8F8" } }, { "path": "uni_modules/uni-pay-x/pages/pay-desk/pay-desk", "style": { - "navigationBarTitleText": "ad", + "navigationBarTitleText": "收银台", "backgroundColor": "#F8F8F8" } }, diff --git a/pages/API/request-payment/request-payment/request-payment-uni-pay.uvue b/pages/API/request-payment/request-payment/request-payment-uni-pay.uvue index ec469a0f69a77bbda02f1545d7b883faa217e88d..467f57c7edc7f81bbc4c0b5f7c09d4ac189a21f9 100644 --- a/pages/API/request-payment/request-payment/request-payment-uni-pay.uvue +++ b/pages/API/request-payment/request-payment/request-payment-uni-pay.uvue @@ -27,9 +27,12 @@ - + + + + - + 插件支付单号: @@ -90,7 +93,7 @@ - @@ -251,7 +254,7 @@ getOrderData['out_trade_no'] = this.out_trade_no; } let res = await payInstance.getOrder(getOrderData); - if (res != null && res['errCode'] == 0) { + if (res['errCode'] == 0) { this.getOrderRes = res.getJSON('pay_order') as UTSJSONObject; let obj = { "-1": "已关闭", @@ -275,7 +278,7 @@ let res = await payInstance.refund({ out_trade_no: this.out_trade_no, // 插件支付单号 }); - if (res != null && res['errCode'] == 0) { + if (res['errCode'] == 0) { uni.showToast({ title: res['errMsg'] as string, icon: "none" @@ -288,7 +291,7 @@ let res = await payInstance.getRefund({ out_trade_no: this.out_trade_no, // 插件支付单号 }); - if (res != null && res['errCode'] == 0) { + if (res['errCode'] == 0) { uni.showModal({ content: res['errMsg'] as string, showCancel: false @@ -301,7 +304,7 @@ let res = await payInstance.closeOrder({ out_trade_no: this.out_trade_no, // 插件支付单号 }); - if (res != null && res['errCode'] == 0) { + if (res['errCode'] == 0) { uni.showModal({ content: res['errMsg'] as string, showCancel: false @@ -316,7 +319,7 @@ provider: "wxpay", provider_pay_type: "jsapi" }); - if (res != null && res['appid'] != null && res['appid'] != "") { + if (res['appid'] != null && res['appid'] != "") { let appid = res['appid'] as string; let redirect_uri = window.location.href.split("?")[0]; let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=${scope}&state=STATE#wechat_redirect`; @@ -327,7 +330,7 @@ async getOpenid(data:UTSJSONObject) : Promise { const payInstance = this.$refs["payRef"] as UniPayComponentPublicInstance; let res = await payInstance.getOpenid(data); - if (res != null && res['openid'] != null && res['openid'] != "") { + if (res['openid'] != null && res['openid'] != "") { let openid = res['openid'] as string; let code = data['code'] as string; this.openid = openid; diff --git a/pages/API/virtual-payment/virtual-payment-uni-pay.uvue b/pages/API/virtual-payment/virtual-payment-uni-pay.uvue new file mode 100644 index 0000000000000000000000000000000000000000..6361ce1cb58278f2dd501b7417cd4852d12dfe02 --- /dev/null +++ b/pages/API/virtual-payment/virtual-payment-uni-pay.uvue @@ -0,0 +1,191 @@ + + + + + diff --git a/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-pay/appleiap/apiclient_cert.p8 b/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-pay/appleiap/apiclient_cert.p8 new file mode 100644 index 0000000000000000000000000000000000000000..1ded009112af6d60f59b99cb377ecf203a42009e --- /dev/null +++ b/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-pay/appleiap/apiclient_cert.p8 @@ -0,0 +1,3 @@ +-----BEGIN PRIVATE KEY----- + +-----END PRIVATE KEY----- diff --git a/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-pay/config.js b/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-pay/config.js index e573971fc5b4744935ef6cce3606274124ff774a..78635714b0980a828cc3951a2d9d992278c3b77d 100644 --- a/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-pay/config.js +++ b/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-pay/config.js @@ -109,12 +109,15 @@ module.exports = { "alipayRootCertPath": path.join(__dirname, 'alipay/alipayRootCert.crt'), // 支付宝根证书路径 } }, - // ios内购相关(uniapp-x暂不支持) + // 苹果虚拟支付相关 "appleiap": { - // ios内购支付 + // 苹果虚拟支付支付,参数获取地址:https://appstoreconnect.apple.com/access/integrations/api/subs "app": { - "password": "", // App 专用共享密钥,App 专用共享密钥是用于接收此 App 自动续期订阅收据的唯一代码。如果您要将此 App 转让给其他开发者或不想公开主共享密钥,建议使用 App 专用共享密钥。非自动续订场景不需要此参数 - "timeout": 10000, // 请求超时时间,单位:毫秒 + "appId": "", // 密钥ID + "issuerId": "", // Issuer ID + "bundleId": "", // 正式包名(如果dev包名和正式包名一致,则只填bundleId即可) + "devBundleId": "", // dev包名(如果dev包名和正式包名一致,则devBundleId可不填) + "appCertPath": path.join(__dirname, 'appleiap/apiclient_cert.p8'), // 证书路径 "sandbox": true, // 是否是沙箱环境 }, } diff --git a/uni_modules/uni-pay-x/components/uni-pay-popup/uni-pay-popup.uvue b/uni_modules/uni-pay-x/components/uni-pay-popup/uni-pay-popup.uvue index ebb74bc08e50f63db6294474d88f1b1541c99ba1..15459c2c5a1e6459b36aad92e43e9baef4c222a2 100644 --- a/uni_modules/uni-pay-x/components/uni-pay-popup/uni-pay-popup.uvue +++ b/uni_modules/uni-pay-x/components/uni-pay-popup/uni-pay-popup.uvue @@ -1,5 +1,5 @@