consistent/usefull checkout flow when you don't have enough money.

This commit is contained in:
Howard Stearns 2018-09-19 16:00:40 -07:00
parent 3b1e0dc7d9
commit d644a63990
2 changed files with 36 additions and 17 deletions

View file

@ -552,6 +552,10 @@ Rectangle {
// Alignment // Alignment
horizontalAlignment: Text.AlignLeft; horizontalAlignment: Text.AlignLeft;
verticalAlignment: Text.AlignVCenter; verticalAlignment: Text.AlignVCenter;
onLinkActivated: {
// Only case is to go to the bank.
sendToScript({method: 'gotoBank'});
}
} }
} }
@ -1107,25 +1111,32 @@ Rectangle {
} }
function handleBuyAgainLogic() { function handleBuyAgainLogic() {
// If you can buy this item again... // General rules, implemented in various scattered places in this file:
if (canBuyAgain()) { // 1. If you already own the item, a viewInMyPurchasesButton is visible,
// If you can't afford another copy of the item... // and the buyButton is visible (and says "Buy it again") ONLY if it is a type you canBuyAgain.
if (root.balanceAfterPurchase < 0) { // 2. Separately,
// If you already own the item... // a. If you don't have enough money to buy, the buyText becomes visible and tells you, and the buyButton is disabled.
if (root.alreadyOwned) { // b. Otherwise, if the item is a content set and you don't have rez permission, the buyText becomes visible and tells you so.
buyText.text = "<b>Your Wallet does not have sufficient funds to purchase this item again.</b>";
// Else if you don't already own the item... // If you can't afford another copy of the item...
} else { if (root.balanceAfterPurchase < 0) {
buyText.text = "<b>Your Wallet does not have sufficient funds to purchase this item.</b>"; // If you already own the item...
} if (!root.alreadyOwned) {
buyTextContainer.color = "#FFC3CD"; buyText.text = "<b>Your Wallet does not have sufficient funds to purchase this item.</b>";
buyTextContainer.border.color = "#F3808F"; // Else if you don't already own the item...
buyGlyph.text = hifi.glyphs.alert; } else if (canBuyAgain()) {
buyGlyph.size = 54; buyText.text = "<b>Your Wallet does not have sufficient funds to purchase this item again.</b>";
// If you CAN afford another copy of the item...
} else { } else {
handleContentSets(); buyText.text = "<b>While you do not have sufficient funds to buy this, you already have this item.</b>"
} }
buyText.text += " Visit <a href='#'>Bank of High Fidelity</a> to get more HFC."
buyTextContainer.color = "#FFC3CD";
buyTextContainer.border.color = "#F3808F";
buyGlyph.text = hifi.glyphs.alert;
buyGlyph.size = 54;
// If you CAN afford another copy of the item...
} else {
handleContentSets();
} }
} }

View file

@ -773,6 +773,14 @@ var onQmlMessageReceived = function onQmlMessageReceived(message) {
return; return;
} }
switch (message.method) { switch (message.method) {
case 'gotoBank':
ui.close();
if (Account.metaverseServerURL.indexOf("staging") >= 0) {
Window.location = "hifi://hifiqa-master-metaverse-staging"; // So that we can test in staging.
} else {
Window.location = "hifi://BankOfHighFidelity";
}
break;
case 'purchases_openWallet': case 'purchases_openWallet':
case 'checkout_openWallet': case 'checkout_openWallet':
case 'checkout_setUpClicked': case 'checkout_setUpClicked':