diff --git a/interface/resources/qml/hifi/commerce/Checkout.qml b/interface/resources/qml/hifi/commerce/Checkout.qml index 458e417654..cfa8f82fd9 100644 --- a/interface/resources/qml/hifi/commerce/Checkout.qml +++ b/interface/resources/qml/hifi/commerce/Checkout.qml @@ -35,11 +35,13 @@ Rectangle { id: commerce; onBuyResult: { if (failureMessage.length) { - sendToScript({method: 'checkout_cancelClicked', params: itemId}); + buyButton.text = "Buy Failed"; + buyButton.enabled = false; } else { if (urlHandler.canHandleUrl(itemHref)) { urlHandler.handleUrl(itemHref); } + sendToScript({method: 'checkout_buySuccess', params: itemId}); } } onBalanceResult: { @@ -369,13 +371,12 @@ Rectangle { width: parent.width/2 - anchors.leftMargin*2; text: "Cancel" onClicked: { - sendToScript({method: 'checkout_cancelClicked', params: itemId}); //fixme + sendToScript({method: 'checkout_cancelClicked', params: itemId}); } } // "Buy" button HifiControlsUit.Button { - property bool buyFailed: false; // fixme id: buyButton; enabled: balanceAfterPurchase >= 0 && !alreadyOwned; color: hifi.buttons.black; @@ -421,14 +422,9 @@ Rectangle { itemAuthorText.text = message.params.itemAuthor; itemPriceText.text = message.params.itemPrice; itemHref = message.params.itemHref; - buyButton.buyFailed = false; commerce.balance(); commerce.inventory(); break; - case 'buyFailed': - buyButton.text = "Buy Failed"; - buyButton.buyFailed = true; - break; default: console.log('Unrecognized message from marketplaces.js:', JSON.stringify(message)); } diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js index e44e9fda94..9378a1d95b 100644 --- a/scripts/system/marketplaces/marketplaces.js +++ b/scripts/system/marketplaces/marketplaces.js @@ -204,12 +204,8 @@ // I don't think this is trivial to do since we also want to inject some JS into the DOM. //tablet.popFromStack(); break; - case 'checkout_buyClicked': - if (message.success === true) { - tablet.gotoWebScreen(MARKETPLACE_URL + '/items/' + message.itemId, MARKETPLACES_INJECT_SCRIPT_URL); - } else { - tablet.sendToQml({ method: 'buyFailed' }); - } + case 'checkout_buySuccess': + tablet.gotoWebScreen(MARKETPLACE_URL + '/items/' + message.itemId, MARKETPLACES_INJECT_SCRIPT_URL); //tablet.popFromStack(); break; case 'inventory_itemClicked':