提交 0ec8bbec 编写于 作者: zhaofengliang920817's avatar zhaofengliang920817

调整virtual-payment 示例。#3843

上级 01f32162
...@@ -135,6 +135,11 @@ ...@@ -135,6 +135,11 @@
//TODO: 开发者server验证逻辑 //TODO: 开发者server验证逻辑
//经过开发者server验证成功后请结束该交易 //经过开发者server验证成功后请结束该交易
uni.showToast({
title: "购买成功:" + res.apple?.payment.productId,
icon: 'success'
})
this.virtualPaymentContext.finishTransaction({ this.virtualPaymentContext.finishTransaction({
transaction: res.apple, transaction: res.apple,
success: (r) => { success: (r) => {
...@@ -144,10 +149,6 @@ ...@@ -144,10 +149,6 @@
console.log("关单失败, 该productId= " + res.apple?.payment.productId) console.log("关单失败, 该productId= " + res.apple?.payment.productId)
} }
}) })
uni.showToast({
title: "购买成功:" + res.apple?.payment.productId,
icon: 'error'
})
}, },
fail: (e) => { fail: (e) => {
uni.hideLoading() uni.hideLoading()
...@@ -177,7 +178,7 @@ ...@@ -177,7 +178,7 @@
}) })
uni.showToast({ uni.showToast({
title: "restore成功的交易个数:" + res.transactions.length, title: "restore成功的交易个数:" + res.transactions.length,
icon: 'error' icon: 'success'
}) })
}, },
fail: (e) => { fail: (e) => {
...@@ -205,6 +206,10 @@ ...@@ -205,6 +206,10 @@
console.log("getUnfinishedTransactions成功的交易productId= " + transaction.payment.productId) console.log("getUnfinishedTransactions成功的交易productId= " + transaction.payment.productId)
//TODO: 开发者server验证逻辑 //TODO: 开发者server验证逻辑
uni.showToast({
title: "获取未结束的订单列表个数:" + res.transactions.length,
icon: 'success'
})
//经过开发者server验证成功后请结束该交易 //经过开发者server验证成功后请结束该交易
this.virtualPaymentContext.finishTransaction({ this.virtualPaymentContext.finishTransaction({
transaction: transaction, transaction: transaction,
...@@ -216,11 +221,6 @@ ...@@ -216,11 +221,6 @@
} }
}) })
}) })
uni.showToast({
title: "获取未结束的订单列表个数:" + res.transactions.length,
icon: 'error'
})
}, },
fail: (e) => { fail: (e) => {
uni.hideLoading() uni.hideLoading()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册