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 { } else {
root.activeView = "checkoutSuccess"; root.activeView = "checkoutSuccess";
} }
root.balanceReceived = false;
root.purchasesReceived = false;
commerce.inventory();
commerce.balance();
} }
// //

View file

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

View file

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

View file

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

View file

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

View file

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