google支付问题

This commit is contained in:
xiekaidong 2023-07-03 14:24:57 +08:00
parent 1cd1d31d98
commit ecddb99390

View File

@ -66,6 +66,7 @@ function SDKPayGoogleManager:queryProducts(callback)
if #subsList > 0 then if #subsList > 0 then
self:queryProductInfo(PAY_TYPE_SUBS, json.encode(subsList), function(code, msg) self:queryProductInfo(PAY_TYPE_SUBS, json.encode(subsList), function(code, msg)
if code == 0 then if code == 0 then
self.queryProductsOver = true
if msg and msg ~= "" then -- 更新products if msg and msg ~= "" then -- 更新products
local jData = json.decode(msg) local jData = json.decode(msg)
if jData and #jData > 0 then if jData and #jData > 0 then
@ -80,6 +81,7 @@ function SDKPayGoogleManager:queryProducts(callback)
end end
end) end)
else else
self.queryProductsOver = true
if callback then if callback then
callback() callback()
end end
@ -262,51 +264,55 @@ end
-- 检查是否可以支付 -- 检查是否可以支付
function SDKPayGoogleManager:checkPay(productId, callback) function SDKPayGoogleManager:checkPay(productId, callback)
if self:_getIsGoogleStoreConnected() then -- google商店是否初始化 if self:_getIsGoogleStoreConnected() then -- google商店是否初始化
self:doUncompleteOrder(function(code) -- 先处理未完成的订单 self:queryProducts(function()
if code == 0 then self:doUncompleteOrder(function(code) -- 先处理未完成的订单
callback(0) if code == 0 then
elseif code == 1 then -- 指定的productId存在支付状态中的订单 callback(0)
local params = { elseif code == 1 then -- 指定的productId存在支付状态中的订单
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23), local params = {
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK, content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23),
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK), boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
} okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
GFunc.showMessageBox(params) }
elseif code == 2 then -- 指定的productId存在未完成的订单消耗失败的情况 GFunc.showMessageBox(params)
local params = { elseif code == 2 then -- 指定的productId存在未完成的订单消耗失败的情况
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23), local params = {
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK, content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23),
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK), boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
} okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
GFunc.showMessageBox(params) }
else -- 存在未完成的订单消耗失败的情况但是因为不是当前productId所以允许继续支付 GFunc.showMessageBox(params)
callback(0) else -- 存在未完成的订单消耗失败的情况但是因为不是当前productId所以允许继续支付
end callback(0)
end, productId) end
end, productId)
end)
else else
self:connectGoogleStore(function(code) self:connectGoogleStore(function(code)
if code == 0 then if code == 0 then
self:doUncompleteOrder(function(consumeSucc) self:queryProducts(function()
if code == 0 then self:doUncompleteOrder(function(consumeSucc)
callback(0) if code == 0 then
elseif code == 1 then -- 指定的productId存在支付状态中的订单 callback(0)
local params = { elseif code == 1 then -- 指定的productId存在支付状态中的订单
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23), local params = {
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK, content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23),
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK), boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
} okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
GFunc.showMessageBox(params) }
elseif code == 2 then -- 指定的productId存在未完成的订单消耗失败的情况 GFunc.showMessageBox(params)
local params = { elseif code == 2 then -- 指定的productId存在未完成的订单消耗失败的情况
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23), local params = {
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK, content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_23),
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK), boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
} okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
GFunc.showMessageBox(params) }
else -- 存在未完成的订单消耗失败的情况但是因为不是当前productId所以允许继续支付 GFunc.showMessageBox(params)
callback(0) else -- 存在未完成的订单消耗失败的情况但是因为不是当前productId所以允许继续支付
end callback(0)
end, productId) end
end, productId)
end)
else else
local params = { local params = {
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_22), content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_22),