Merge pull request #11534 from zfox23/commerce_daveIntegration1

Commerce backend changes sync, October 5 2017
This commit is contained in:
Zach Fox 2017-10-06 09:45:45 -07:00 committed by GitHub
commit 051b63503c
6 changed files with 33 additions and 6 deletions

View file

@ -892,6 +892,10 @@ Rectangle {
} else {
root.activeView = "checkoutSuccess";
}
root.balanceReceived = false;
root.purchasesReceived = false;
commerce.inventory();
commerce.balance();
}
//

View file

@ -39,7 +39,7 @@ Item {
sendToParent({method: "needsLogIn"});
} else if (walletStatus === 3) {
commerce.getSecurityImage();
} else {
} else if (walletStatus > 3) {
console.log("ERROR in EmulatedMarketplaceHeader.qml: Unknown wallet status: " + walletStatus);
}
}

View file

@ -36,6 +36,8 @@ Item {
property string itemHref;
property int displayedItemCount;
property int itemEdition;
property int numberSold;
property int limitedRun;
property string originalStatusText;
property string originalStatusColor;
@ -50,7 +52,6 @@ Item {
statusText.text = "CONFIRMED!";
statusText.color = hifi.colors.blueAccent;
confirmedTimer.start();
root.purchaseStatusChanged = false;
}
}
@ -60,6 +61,7 @@ Item {
onTriggered: {
statusText.text = root.originalStatusText;
statusText.color = root.originalStatusColor;
root.purchaseStatusChanged = false;
}
}
@ -203,7 +205,7 @@ Item {
Item {
id: statusContainer;
visible: root.purchaseStatus === "pending" || root.purchaseStatus === "invalidated";
visible: root.purchaseStatus === "pending" || root.purchaseStatus === "invalidated" || root.purchaseStatusChanged;
anchors.left: itemName.left;
anchors.top: certificateContainer.bottom;
anchors.topMargin: 8;
@ -222,6 +224,8 @@ Item {
"PENDING..."
} else if (root.purchaseStatus === "invalidated") {
"INVALIDATED"
} else if (root.numberSold !== -1) {
("Sales: " + root.numberSold + "/" + (root.limitedRun === -1 ? "INFTY" : root.limitedRun))
} else {
""
}

View file

@ -81,8 +81,10 @@ Rectangle {
if (result.status !== 'success') {
console.log("Failed to get purchases", result.message);
} else {
var inventoryResult = processInventoryResult(result.data.assets);
purchasesModel.clear();
purchasesModel.append(result.data.assets);
purchasesModel.append(inventoryResult);
if (previousPurchasesModel.count !== 0) {
checkIfAnyItemStatusChanged();
@ -93,7 +95,7 @@ Rectangle {
purchasesModel.setProperty(i, "statusChanged", false);
}
}
previousPurchasesModel.append(result.data.assets);
previousPurchasesModel.append(inventoryResult);
buildFilteredPurchasesModel();
@ -428,6 +430,8 @@ Rectangle {
purchaseStatus: status;
purchaseStatusChanged: statusChanged;
itemEdition: model.edition_number;
numberSold: model.number_sold;
limitedRun: model.limited_run;
displayedItemCount: model.displayedItemCount;
anchors.topMargin: 12;
anchors.bottomMargin: 12;
@ -590,6 +594,17 @@ Rectangle {
// FUNCTION DEFINITIONS START
//
function processInventoryResult(inventory) {
for (var i = 0; i < inventory.length; i++) {
if (inventory[i].status.length > 1) {
console.log("WARNING: Inventory result index " + i + " has a status of length >1!")
}
inventory[i].status = inventory[i].status[0];
inventory[i].categories = inventory[i].categories.join(';');
}
return inventory;
}
function populateDisplayedItemCounts() {
var itemCountDictionary = {};
var currentItemId;

View file

@ -197,6 +197,8 @@ Item {
height: 50;
echoMode: TextInput.Password;
placeholderText: "passphrase";
activeFocusOnPress: true;
activeFocusOnTab: true;
onFocusChanged: {
root.keyboardRaised = focus;
@ -206,8 +208,8 @@ Item {
anchors.fill: parent;
onClicked: {
parent.focus = true;
root.keyboardRaised = true;
mouse.accepted = false;
}
}

View file

@ -40,6 +40,7 @@
#include "scripting/HMDScriptingInterface.h"
#include "scripting/AssetMappingsScriptingInterface.h"
#include "scripting/MenuScriptingInterface.h"
#include "scripting/SettingsScriptingInterface.h"
#include <Preferences.h>
#include <ScriptEngines.h>
#include "FileDialogHelper.h"
@ -243,6 +244,7 @@ void Web3DOverlay::setupQmlSurface() {
_webSurface->getSurfaceContext()->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data());
_webSurface->getSurfaceContext()->setContextProperty("SoundCache", DependencyManager::get<SoundCache>().data());
_webSurface->getSurfaceContext()->setContextProperty("MenuInterface", MenuScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("Settings", SettingsScriptingInterface::getInstance());
_webSurface->getSurfaceContext()->setContextProperty("pathToFonts", "../../");