mirror of
https://github.com/overte-org/overte.git
synced 2025-06-22 21:19:59 +02:00
Merge pull request #14476 from zfox23/payIn1
Pay-In API Frontend, Part One
This commit is contained in:
commit
022fea107f
6 changed files with 190 additions and 113 deletions
|
@ -19,6 +19,7 @@ import controlsUit 1.0 as HifiControlsUit
|
||||||
import "../../../controls" as HifiControls
|
import "../../../controls" as HifiControls
|
||||||
import "../wallet" as HifiWallet
|
import "../wallet" as HifiWallet
|
||||||
import "../common" as HifiCommerceCommon
|
import "../common" as HifiCommerceCommon
|
||||||
|
import "../.." as HifiCommon
|
||||||
|
|
||||||
// references XXX from root context
|
// references XXX from root context
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ Rectangle {
|
||||||
property bool ownershipStatusReceived: false;
|
property bool ownershipStatusReceived: false;
|
||||||
property bool balanceReceived: false;
|
property bool balanceReceived: false;
|
||||||
property bool availableUpdatesReceived: false;
|
property bool availableUpdatesReceived: false;
|
||||||
|
property bool itemInfoReceived: false;
|
||||||
property string baseItemName: "";
|
property string baseItemName: "";
|
||||||
property string itemName;
|
property string itemName;
|
||||||
property string itemId;
|
property string itemId;
|
||||||
|
@ -181,11 +183,14 @@ Rectangle {
|
||||||
|
|
||||||
onItemIdChanged: {
|
onItemIdChanged: {
|
||||||
root.ownershipStatusReceived = false;
|
root.ownershipStatusReceived = false;
|
||||||
|
root.itemInfoReceived = false;
|
||||||
Commerce.alreadyOwned(root.itemId);
|
Commerce.alreadyOwned(root.itemId);
|
||||||
root.availableUpdatesReceived = false;
|
root.availableUpdatesReceived = false;
|
||||||
root.currentUpdatesPage = 1;
|
root.currentUpdatesPage = 1;
|
||||||
Commerce.getAvailableUpdates(root.itemId);
|
Commerce.getAvailableUpdates(root.itemId);
|
||||||
itemPreviewImage.source = "https://hifi-metaverse.s3-us-west-1.amazonaws.com/marketplace/previews/" + itemId + "/thumbnail/hifi-mp-" + itemId + ".jpg";
|
|
||||||
|
var MARKETPLACE_API_URL = Account.metaverseServerURL + "/api/v1/marketplace/items/";
|
||||||
|
http.request({uri: MARKETPLACE_API_URL + root.itemId}, updateCheckoutQMLFromHTTP);
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemTypeChanged: {
|
onItemTypeChanged: {
|
||||||
|
@ -279,6 +284,7 @@ Rectangle {
|
||||||
ownershipStatusReceived = false;
|
ownershipStatusReceived = false;
|
||||||
balanceReceived = false;
|
balanceReceived = false;
|
||||||
availableUpdatesReceived = false;
|
availableUpdatesReceived = false;
|
||||||
|
itemInfoReceived = false;
|
||||||
Commerce.getWalletStatus();
|
Commerce.getWalletStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -355,7 +361,7 @@ Rectangle {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: loading;
|
id: loading;
|
||||||
z: 997;
|
z: 997;
|
||||||
visible: !root.ownershipStatusReceived || !root.balanceReceived || !root.availableUpdatesReceived;
|
visible: !root.ownershipStatusReceived || !root.balanceReceived || !root.availableUpdatesReceived || !root.itemInfoReceived;
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
color: hifi.colors.white;
|
color: hifi.colors.white;
|
||||||
|
|
||||||
|
@ -1064,9 +1070,32 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HifiCommon.RootHttpRequest {
|
||||||
|
id: http;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// FUNCTION DEFINITIONS START
|
// FUNCTION DEFINITIONS START
|
||||||
//
|
//
|
||||||
|
|
||||||
|
function updateCheckoutQMLFromHTTP(error, result) {
|
||||||
|
if (error || (result.status !== 'success')) {
|
||||||
|
// The QML will display a loading spinner forever if the user is stuck here.
|
||||||
|
console.log("Error in Checkout.qml when getting marketplace item info!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
root.itemInfoReceived = true;
|
||||||
|
root.itemName = result.data.title;
|
||||||
|
root.itemPrice = result.data.cost;
|
||||||
|
root.itemHref = Account.metaverseServerURL + result.data.path;
|
||||||
|
root.itemAuthor = result.data.creator;
|
||||||
|
root.itemType = result.data.item_type || "unknown";
|
||||||
|
itemPreviewImage.source = result.data.thumbnail_url;
|
||||||
|
refreshBuyUI();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Function Name: fromScript()
|
// Function Name: fromScript()
|
||||||
//
|
//
|
||||||
|
@ -1080,18 +1109,24 @@ Rectangle {
|
||||||
// Description:
|
// Description:
|
||||||
// Called when a message is received from a script.
|
// Called when a message is received from a script.
|
||||||
//
|
//
|
||||||
|
|
||||||
function fromScript(message) {
|
function fromScript(message) {
|
||||||
switch (message.method) {
|
switch (message.method) {
|
||||||
case 'updateCheckoutQML':
|
case 'updateCheckoutQMLItemID':
|
||||||
root.itemId = message.params.itemId;
|
if (!message.params.itemId) {
|
||||||
root.itemName = message.params.itemName.trim();
|
console.log("A message with method 'updateCheckoutQMLItemID' was sent without an itemId!");
|
||||||
root.itemPrice = message.params.itemPrice;
|
return;
|
||||||
root.itemHref = message.params.itemHref;
|
}
|
||||||
root.referrer = message.params.referrer;
|
|
||||||
root.itemAuthor = message.params.itemAuthor;
|
// If we end up following the referrer (i.e. in case the wallet "isn't set up" or the user cancels),
|
||||||
|
// we want the user to be placed back on the individual item's page - thus we set the
|
||||||
|
// default of the referrer in this case to "itemPage".
|
||||||
|
root.referrer = message.params.referrer || "itemPage";
|
||||||
root.itemEdition = message.params.itemEdition || -1;
|
root.itemEdition = message.params.itemEdition || -1;
|
||||||
root.itemType = message.params.itemType || "unknown";
|
root.itemId = message.params.itemId;
|
||||||
refreshBuyUI();
|
break;
|
||||||
|
case 'http.response':
|
||||||
|
http.handleHttpResponse(message);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log('Checkout.qml: Unrecognized message from marketplaces.js');
|
console.log('Checkout.qml: Unrecognized message from marketplaces.js');
|
||||||
|
|
|
@ -25,14 +25,15 @@ Item {
|
||||||
|
|
||||||
id: root;
|
id: root;
|
||||||
|
|
||||||
property bool isDisplayingNearby; // as opposed to 'connections'
|
// true when sending to 'nearby' or when a script raises the send asset dialog
|
||||||
|
property bool multiLineDisplay;
|
||||||
property string displayName;
|
property string displayName;
|
||||||
property string userName;
|
property string userName;
|
||||||
property string profilePic;
|
property string profilePic;
|
||||||
property string textColor: hifi.colors.white;
|
property string textColor: hifi.colors.white;
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
visible: root.isDisplayingNearby;
|
visible: root.multiLineDisplay;
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
|
@ -71,7 +72,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
visible: !root.isDisplayingNearby;
|
visible: !root.multiLineDisplay;
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
|
|
@ -39,7 +39,7 @@ Item {
|
||||||
property string sendingPubliclyEffectImage;
|
property string sendingPubliclyEffectImage;
|
||||||
property var http;
|
property var http;
|
||||||
property var listModelName;
|
property var listModelName;
|
||||||
property var keyboardContainer: nil;
|
property var keyboardContainer;
|
||||||
|
|
||||||
// This object is always used in a popup or full-screen Wallet section.
|
// This object is always used in a popup or full-screen Wallet section.
|
||||||
// This MouseArea is used to prevent a user from being
|
// This MouseArea is used to prevent a user from being
|
||||||
|
@ -56,7 +56,7 @@ Item {
|
||||||
// Background
|
// Background
|
||||||
Rectangle {
|
Rectangle {
|
||||||
z: 1;
|
z: 1;
|
||||||
visible: root.assetName !== "" && sendAssetStep.visible;
|
visible: root.assetCertID !== "" && sendAssetStep.referrer !== "payIn" && sendAssetStep.visible;
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: root.parentAppTitleBarHeight;
|
anchors.topMargin: root.parentAppTitleBarHeight;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -84,7 +84,6 @@ Item {
|
||||||
if (sendPubliclyCheckbox.checked && sendAssetStep.referrer === "nearby") {
|
if (sendPubliclyCheckbox.checked && sendAssetStep.referrer === "nearby") {
|
||||||
sendSignalToParent({
|
sendSignalToParent({
|
||||||
method: 'sendAsset_sendPublicly',
|
method: 'sendAsset_sendPublicly',
|
||||||
assetName: root.assetName,
|
|
||||||
recipient: sendAssetStep.selectedRecipientNodeID,
|
recipient: sendAssetStep.selectedRecipientNodeID,
|
||||||
amount: parseInt(amountTextField.text),
|
amount: parseInt(amountTextField.text),
|
||||||
effectImage: root.sendingPubliclyEffectImage
|
effectImage: root.sendingPubliclyEffectImage
|
||||||
|
@ -108,6 +107,14 @@ Item {
|
||||||
root.nextActiveView = 'paymentFailure';
|
root.nextActiveView = 'paymentFailure';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onCertificateInfoResult: {
|
||||||
|
if (result.status !== 'success') {
|
||||||
|
console.log("Failed to get certificate info", result.data.message);
|
||||||
|
} else {
|
||||||
|
root.assetName = result.data.marketplace_item_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -155,7 +162,7 @@ Item {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: userInfoContainer;
|
id: userInfoContainer;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "";
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
|
@ -251,7 +258,7 @@ Item {
|
||||||
|
|
||||||
LinearGradient {
|
LinearGradient {
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "";
|
||||||
start: Qt.point(0, 0);
|
start: Qt.point(0, 0);
|
||||||
end: Qt.point(0, height);
|
end: Qt.point(0, height);
|
||||||
gradient: Gradient {
|
gradient: Gradient {
|
||||||
|
@ -262,7 +269,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: sendAssetText;
|
id: sendAssetText;
|
||||||
text: root.assetName === "" ? "Send Money To:" : "Gift \"" + root.assetName + "\" To:";
|
text: root.assetCertID === "" ? "Send Money To:" : "Gift \"" + root.assetName + "\" To:";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
|
@ -405,7 +412,7 @@ Item {
|
||||||
HifiModels.PSFListModel {
|
HifiModels.PSFListModel {
|
||||||
id: connectionsModel;
|
id: connectionsModel;
|
||||||
http: root.http;
|
http: root.http;
|
||||||
listModelName: root.listModelName;
|
listModelName: root.listModelName || "";
|
||||||
endpoint: "/api/v1/users?filter=connections";
|
endpoint: "/api/v1/users?filter=connections";
|
||||||
itemsPerPage: 9;
|
itemsPerPage: 9;
|
||||||
listView: connectionsList;
|
listView: connectionsList;
|
||||||
|
@ -441,7 +448,7 @@ Item {
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: closeGlyphButton_connections;
|
id: closeGlyphButton_connections;
|
||||||
text: hifi.glyphs.close;
|
text: hifi.glyphs.close;
|
||||||
color: root.assetName === "" ? hifi.colors.lightGrayText : hifi.colors.baseGray;
|
color: root.assetCertID === "" ? hifi.colors.lightGrayText : hifi.colors.baseGray;
|
||||||
size: 26;
|
size: 26;
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 10;
|
anchors.topMargin: 10;
|
||||||
|
@ -684,7 +691,7 @@ Item {
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: closeGlyphButton_nearby;
|
id: closeGlyphButton_nearby;
|
||||||
text: hifi.glyphs.close;
|
text: hifi.glyphs.close;
|
||||||
color: root.assetName === "" ? hifi.colors.lightGrayText : hifi.colors.baseGray;
|
color: root.assetCertID === "" ? hifi.colors.lightGrayText : hifi.colors.baseGray;
|
||||||
size: 26;
|
size: 26;
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 10;
|
anchors.topMargin: 10;
|
||||||
|
@ -760,7 +767,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: sendToText;
|
id: sendToText;
|
||||||
text: root.assetName === "" ? "Send to:" : "Gift to:";
|
text: root.assetCertID === "" ? "Send to:" : "Gift to:";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 36;
|
anchors.topMargin: 36;
|
||||||
|
@ -853,7 +860,7 @@ Item {
|
||||||
id: sendAssetStep;
|
id: sendAssetStep;
|
||||||
z: 996;
|
z: 996;
|
||||||
|
|
||||||
property string referrer; // either "connections" or "nearby"
|
property string referrer; // either "connections", "nearby", or "payIn"
|
||||||
property string selectedRecipientNodeID;
|
property string selectedRecipientNodeID;
|
||||||
property string selectedRecipientDisplayName;
|
property string selectedRecipientDisplayName;
|
||||||
property string selectedRecipientUserName;
|
property string selectedRecipientUserName;
|
||||||
|
@ -865,7 +872,8 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: sendAssetText_sendAssetStep;
|
id: sendAssetText_sendAssetStep;
|
||||||
text: root.assetName === "" ? "Send Money" : "Gift \"" + root.assetName + "\"";
|
text: sendAssetStep.referrer === "payIn" && root.assetCertID !== "" ? "Send \"" + root.assetName + "\":" :
|
||||||
|
(root.assetCertID === "" ? "Send Money To:" : "Gift \"" + root.assetName + "\" To:");
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
|
@ -878,7 +886,7 @@ Item {
|
||||||
// Text size
|
// Text size
|
||||||
size: 22;
|
size: 22;
|
||||||
// Style
|
// Style
|
||||||
color: root.assetName === "" ? hifi.colors.white : hifi.colors.black;
|
color: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.white : hifi.colors.black;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -893,7 +901,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: sendToText_sendAssetStep;
|
id: sendToText_sendAssetStep;
|
||||||
text: root.assetName === "" ? "Send to:" : "Gift to:";
|
text: (root.assetCertID === "" || sendAssetStep.referrer === "payIn") ? "Send to:" : "Gift to:";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -902,7 +910,7 @@ Item {
|
||||||
// Text size
|
// Text size
|
||||||
size: 18;
|
size: 18;
|
||||||
// Style
|
// Style
|
||||||
color: root.assetName === "" ? hifi.colors.white : hifi.colors.black;
|
color: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.white : hifi.colors.black;
|
||||||
verticalAlignment: Text.AlignVCenter;
|
verticalAlignment: Text.AlignVCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,25 +920,26 @@ Item {
|
||||||
anchors.right: changeButton.left;
|
anchors.right: changeButton.left;
|
||||||
anchors.rightMargin: 12;
|
anchors.rightMargin: 12;
|
||||||
height: parent.height;
|
height: parent.height;
|
||||||
textColor: root.assetName === "" ? hifi.colors.white : hifi.colors.black;
|
textColor: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.white : hifi.colors.black;
|
||||||
|
|
||||||
displayName: sendAssetStep.selectedRecipientDisplayName;
|
displayName: sendAssetStep.selectedRecipientDisplayName;
|
||||||
userName: sendAssetStep.selectedRecipientUserName;
|
userName: sendAssetStep.selectedRecipientUserName;
|
||||||
profilePic: sendAssetStep.selectedRecipientProfilePic !== "" ? ((0 === sendAssetStep.selectedRecipientProfilePic.indexOf("http")) ?
|
profilePic: sendAssetStep.selectedRecipientProfilePic !== "" ? ((0 === sendAssetStep.selectedRecipientProfilePic.indexOf("http")) ?
|
||||||
sendAssetStep.selectedRecipientProfilePic : (Account.metaverseServerURL + sendAssetStep.selectedRecipientProfilePic)) : "";
|
sendAssetStep.selectedRecipientProfilePic : (Account.metaverseServerURL + sendAssetStep.selectedRecipientProfilePic)) : "";
|
||||||
isDisplayingNearby: sendAssetStep.referrer === "nearby";
|
multiLineDisplay: sendAssetStep.referrer === "nearby" || sendAssetStep.referrer === "payIn";
|
||||||
}
|
}
|
||||||
|
|
||||||
// "CHANGE" button
|
// "CHANGE" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: changeButton;
|
id: changeButton;
|
||||||
color: root.assetName === "" ? hifi.buttons.none : hifi.buttons.white;
|
color: root.assetCertID === "" ? hifi.buttons.none : hifi.buttons.white;
|
||||||
colorScheme: hifi.colorSchemes.dark;
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
height: 35;
|
height: 35;
|
||||||
width: 100;
|
width: 100;
|
||||||
text: "CHANGE";
|
text: "CHANGE";
|
||||||
|
visible: sendAssetStep.referrer !== "payIn";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (sendAssetStep.referrer === "connections") {
|
if (sendAssetStep.referrer === "connections") {
|
||||||
root.nextActiveView = "chooseRecipientConnection";
|
root.nextActiveView = "chooseRecipientConnection";
|
||||||
|
@ -944,7 +953,7 @@ Item {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: amountContainer;
|
id: amountContainer;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "";
|
||||||
anchors.top: sendToContainer.bottom;
|
anchors.top: sendToContainer.bottom;
|
||||||
anchors.topMargin: 2;
|
anchors.topMargin: 2;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -970,8 +979,9 @@ Item {
|
||||||
|
|
||||||
HifiControlsUit.TextField {
|
HifiControlsUit.TextField {
|
||||||
id: amountTextField;
|
id: amountTextField;
|
||||||
text: root.assetName === "" ? "" : "1";
|
readOnly: sendAssetStep.referrer === "payIn";
|
||||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
text: root.assetCertID === "" ? "" : "1";
|
||||||
|
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||||
inputMethodHints: Qt.ImhDigitsOnly;
|
inputMethodHints: Qt.ImhDigitsOnly;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
@ -980,8 +990,8 @@ Item {
|
||||||
height: 50;
|
height: 50;
|
||||||
// Style
|
// Style
|
||||||
leftPermanentGlyph: hifi.glyphs.hfc;
|
leftPermanentGlyph: hifi.glyphs.hfc;
|
||||||
activeFocusOnPress: true;
|
activeFocusOnPress: !amountTextField.readOnly;
|
||||||
activeFocusOnTab: true;
|
activeFocusOnTab: !amountTextField.readOnly;
|
||||||
|
|
||||||
validator: IntValidator { bottom: 0; }
|
validator: IntValidator { bottom: 0; }
|
||||||
|
|
||||||
|
@ -1071,6 +1081,7 @@ Item {
|
||||||
|
|
||||||
TextArea {
|
TextArea {
|
||||||
id: optionalMessage;
|
id: optionalMessage;
|
||||||
|
readOnly: sendAssetStep.referrer === "payIn";
|
||||||
property int maximumLength: 72;
|
property int maximumLength: 72;
|
||||||
property string previousText: text;
|
property string previousText: text;
|
||||||
placeholderText: "<i>Optional Public Message (" + maximumLength + " character limit)</i>";
|
placeholderText: "<i>Optional Public Message (" + maximumLength + " character limit)</i>";
|
||||||
|
@ -1081,12 +1092,13 @@ Item {
|
||||||
// Style
|
// Style
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
color: root.assetName === "" ? (optionalMessage.activeFocus ? hifi.colors.black : hifi.colors.baseGrayShadow) :
|
color: (root.assetCertID === "" || sendAssetStep.referrer === "payIn") ?
|
||||||
|
(optionalMessage.activeFocus && !optionalMessage.readOnly ? hifi.colors.black : hifi.colors.baseGrayShadow) :
|
||||||
(optionalMessage.activeFocus ? "#EFEFEF" : "#EEEEEE");
|
(optionalMessage.activeFocus ? "#EFEFEF" : "#EEEEEE");
|
||||||
border.width: optionalMessage.activeFocus ? 1 : 0;
|
border.width: optionalMessage.activeFocus && !optionalMessage.readOnly ? 1 : 0;
|
||||||
border.color: optionalMessage.activeFocus ? hifi.colors.primaryHighlight : hifi.colors.textFieldLightBackground;
|
border.color: optionalMessage.activeFocus && !optionalMessage.readOnly ? hifi.colors.primaryHighlight : hifi.colors.textFieldLightBackground;
|
||||||
}
|
}
|
||||||
color: root.assetName === "" ? hifi.colors.white : hifi.colors.black;
|
color: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.white : hifi.colors.black;
|
||||||
textFormat: TextEdit.PlainText;
|
textFormat: TextEdit.PlainText;
|
||||||
wrapMode: TextEdit.Wrap;
|
wrapMode: TextEdit.Wrap;
|
||||||
activeFocusOnPress: true;
|
activeFocusOnPress: true;
|
||||||
|
@ -1122,7 +1134,8 @@ Item {
|
||||||
// Text size
|
// Text size
|
||||||
size: 16;
|
size: 16;
|
||||||
// Style
|
// Style
|
||||||
color: optionalMessage.text.length === optionalMessage.maximumLength ? "#ea89a5" : (root.assetName === "" ? hifi.colors.lightGrayText : hifi.colors.baseGrayHighlight);
|
color: optionalMessage.text.length === optionalMessage.maximumLength ? "#ea89a5" :
|
||||||
|
(root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colors.lightGrayText : hifi.colors.baseGrayHighlight);
|
||||||
verticalAlignment: Text.AlignTop;
|
verticalAlignment: Text.AlignTop;
|
||||||
horizontalAlignment: Text.AlignRight;
|
horizontalAlignment: Text.AlignRight;
|
||||||
}
|
}
|
||||||
|
@ -1167,7 +1180,7 @@ Item {
|
||||||
parent.color = hifi.colors.blueAccent;
|
parent.color = hifi.colors.blueAccent;
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
lightboxPopup.titleText = (root.assetName === "" ? "Send Effect" : "Gift Effect");
|
lightboxPopup.titleText = (root.assetCertID === "" ? "Send Effect" : "Gift Effect");
|
||||||
lightboxPopup.bodyImageSource = "sendAsset/images/send-money-effect-sm.jpg"; // Path relative to CommerceLightbox.qml
|
lightboxPopup.bodyImageSource = "sendAsset/images/send-money-effect-sm.jpg"; // Path relative to CommerceLightbox.qml
|
||||||
lightboxPopup.bodyText = "Enabling this option will create a particle effect between you and " +
|
lightboxPopup.bodyText = "Enabling this option will create a particle effect between you and " +
|
||||||
"your recipient that is visible to everyone nearby.";
|
"your recipient that is visible to everyone nearby.";
|
||||||
|
@ -1196,7 +1209,7 @@ Item {
|
||||||
// "CANCEL" button
|
// "CANCEL" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: cancelButton_sendAssetStep;
|
id: cancelButton_sendAssetStep;
|
||||||
color: root.assetName === "" ? hifi.buttons.noneBorderlessWhite : hifi.buttons.noneBorderlessGray;
|
color: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.buttons.noneBorderlessWhite : hifi.buttons.noneBorderlessGray;
|
||||||
colorScheme: hifi.colorSchemes.dark;
|
colorScheme: hifi.colorSchemes.dark;
|
||||||
anchors.right: sendButton.left;
|
anchors.right: sendButton.left;
|
||||||
anchors.rightMargin: 24;
|
anchors.rightMargin: 24;
|
||||||
|
@ -1205,16 +1218,20 @@ Item {
|
||||||
width: 100;
|
width: 100;
|
||||||
text: "CANCEL";
|
text: "CANCEL";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (sendAssetStep.referrer === "payIn") {
|
||||||
|
sendToScript({method: "closeSendAsset"});
|
||||||
|
} else {
|
||||||
resetSendAssetData();
|
resetSendAssetData();
|
||||||
root.nextActiveView = "sendAssetHome";
|
root.nextActiveView = "sendAssetHome";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// "SEND" button
|
// "SEND" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: sendButton;
|
id: sendButton;
|
||||||
color: hifi.buttons.blue;
|
color: hifi.buttons.blue;
|
||||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 0;
|
anchors.rightMargin: 0;
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
anchors.verticalCenter: parent.verticalCenter;
|
||||||
|
@ -1222,11 +1239,11 @@ Item {
|
||||||
width: 100;
|
width: 100;
|
||||||
text: "SUBMIT";
|
text: "SUBMIT";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.assetName === "" && parseInt(amountTextField.text) > parseInt(balanceText.text)) {
|
if (root.assetCertID === "" && parseInt(amountTextField.text) > parseInt(balanceText.text)) {
|
||||||
amountTextField.focus = true;
|
amountTextField.focus = true;
|
||||||
amountTextField.error = true;
|
amountTextField.error = true;
|
||||||
amountTextFieldError.text = "<i>amount exceeds available funds</i>";
|
amountTextFieldError.text = "<i>amount exceeds available funds</i>";
|
||||||
} else if (root.assetName === "" && (amountTextField.text === "" || parseInt(amountTextField.text) < 1)) {
|
} else if (root.assetCertID === "" && (amountTextField.text === "" || parseInt(amountTextField.text) < 1)) {
|
||||||
amountTextField.focus = true;
|
amountTextField.focus = true;
|
||||||
amountTextField.error = true;
|
amountTextField.error = true;
|
||||||
amountTextFieldError.text = "<i>invalid amount</i>";
|
amountTextFieldError.text = "<i>invalid amount</i>";
|
||||||
|
@ -1236,7 +1253,7 @@ Item {
|
||||||
root.isCurrentlySendingAsset = true;
|
root.isCurrentlySendingAsset = true;
|
||||||
amountTextField.focus = false;
|
amountTextField.focus = false;
|
||||||
optionalMessage.focus = false;
|
optionalMessage.focus = false;
|
||||||
if (sendAssetStep.referrer === "connections") {
|
if (sendAssetStep.referrer === "connections" || sendAssetStep.referrer === "payIn") {
|
||||||
Commerce.transferAssetToUsername(sendAssetStep.selectedRecipientUserName,
|
Commerce.transferAssetToUsername(sendAssetStep.selectedRecipientUserName,
|
||||||
root.assetCertID,
|
root.assetCertID,
|
||||||
parseInt(amountTextField.text),
|
parseInt(amountTextField.text),
|
||||||
|
@ -1317,18 +1334,18 @@ Item {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: root.assetName === "" ? 15 : 125;
|
anchors.topMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 125;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.leftMargin: root.assetName === "" ? 15 : 50;
|
anchors.leftMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 50;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: root.assetName === "" ? 15 : 50;
|
anchors.rightMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 50;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: root.assetName === "" ? 15 : 125;
|
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 125;
|
||||||
color: "#FFFFFF";
|
color: "#FFFFFF";
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: paymentSentText;
|
id: paymentSentText;
|
||||||
text: root.assetName === "" ? "Payment Sent" : "Gift Sent";
|
text: root.assetCertID === "" ? "Payment Sent" : (sendAssetStep.referrer === "payIn" ? "Item Sent" : "Gift Sent");
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
|
@ -1346,7 +1363,7 @@ Item {
|
||||||
|
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: closeGlyphButton_paymentSuccess;
|
id: closeGlyphButton_paymentSuccess;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "" && sendAssetStep.referrer !== "payIn";
|
||||||
text: hifi.glyphs.close;
|
text: hifi.glyphs.close;
|
||||||
color: hifi.colors.lightGrayText;
|
color: hifi.colors.lightGrayText;
|
||||||
size: 26;
|
size: 26;
|
||||||
|
@ -1364,6 +1381,9 @@ Item {
|
||||||
parent.text = hifi.glyphs.close;
|
parent.text = hifi.glyphs.close;
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (sendAssetStep.referrer === "payIn") {
|
||||||
|
sendToScript({method: "closeSendAsset"});
|
||||||
|
} else {
|
||||||
root.nextActiveView = "sendAssetHome";
|
root.nextActiveView = "sendAssetHome";
|
||||||
resetSendAssetData();
|
resetSendAssetData();
|
||||||
if (root.assetName !== "") {
|
if (root.assetName !== "") {
|
||||||
|
@ -1372,6 +1392,7 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: sendToContainer_paymentSuccess;
|
id: sendToContainer_paymentSuccess;
|
||||||
|
@ -1409,14 +1430,14 @@ Item {
|
||||||
userName: sendAssetStep.selectedRecipientUserName;
|
userName: sendAssetStep.selectedRecipientUserName;
|
||||||
profilePic: sendAssetStep.selectedRecipientProfilePic !== "" ? ((0 === sendAssetStep.selectedRecipientProfilePic.indexOf("http")) ?
|
profilePic: sendAssetStep.selectedRecipientProfilePic !== "" ? ((0 === sendAssetStep.selectedRecipientProfilePic.indexOf("http")) ?
|
||||||
sendAssetStep.selectedRecipientProfilePic : (Account.metaverseServerURL + sendAssetStep.selectedRecipientProfilePic)) : "";
|
sendAssetStep.selectedRecipientProfilePic : (Account.metaverseServerURL + sendAssetStep.selectedRecipientProfilePic)) : "";
|
||||||
isDisplayingNearby: sendAssetStep.referrer === "nearby";
|
multiLineDisplay: sendAssetStep.referrer === "nearby" || sendAssetStep.referrer === "payIn";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: giftContainer_paymentSuccess;
|
id: giftContainer_paymentSuccess;
|
||||||
visible: root.assetName !== "";
|
visible: root.assetCertID !== "";
|
||||||
anchors.top: sendToContainer_paymentSuccess.bottom;
|
anchors.top: sendToContainer_paymentSuccess.bottom;
|
||||||
anchors.topMargin: 8;
|
anchors.topMargin: 8;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -1427,7 +1448,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: gift_paymentSuccess;
|
id: gift_paymentSuccess;
|
||||||
text: "Gift:";
|
text: sendAssetStep.referrer === "payIn" ? "Item:" : "Gift:";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -1458,7 +1479,7 @@ Item {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: amountContainer_paymentSuccess;
|
id: amountContainer_paymentSuccess;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "";
|
||||||
anchors.top: sendToContainer_paymentSuccess.bottom;
|
anchors.top: sendToContainer_paymentSuccess.bottom;
|
||||||
anchors.topMargin: 16;
|
anchors.topMargin: 16;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -1513,7 +1534,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: optionalMessage_paymentSuccess;
|
id: optionalMessage_paymentSuccess;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "";
|
||||||
text: optionalMessage.text;
|
text: optionalMessage.text;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: amountContainer_paymentSuccess.visible ? amountContainer_paymentSuccess.bottom : sendToContainer_paymentSuccess.bottom;
|
anchors.top: amountContainer_paymentSuccess.visible ? amountContainer_paymentSuccess.bottom : sendToContainer_paymentSuccess.bottom;
|
||||||
|
@ -1535,14 +1556,17 @@ Item {
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: closeButton;
|
id: closeButton;
|
||||||
color: hifi.buttons.blue;
|
color: hifi.buttons.blue;
|
||||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||||
anchors.horizontalCenter: parent.horizontalCenter;
|
anchors.horizontalCenter: parent.horizontalCenter;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: root.assetName === "" ? 80 : 30;
|
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 80 : 30;
|
||||||
height: 50;
|
height: 50;
|
||||||
width: 120;
|
width: 120;
|
||||||
text: "Close";
|
text: "Close";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (sendAssetStep.referrer === "payIn") {
|
||||||
|
sendToScript({method: "closeSendAsset"});
|
||||||
|
} else {
|
||||||
root.nextActiveView = "sendAssetHome";
|
root.nextActiveView = "sendAssetHome";
|
||||||
resetSendAssetData();
|
resetSendAssetData();
|
||||||
if (root.assetName !== "") {
|
if (root.assetName !== "") {
|
||||||
|
@ -1552,6 +1576,7 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Payment Success END
|
// Payment Success END
|
||||||
|
|
||||||
// Payment Failure BEGIN
|
// Payment Failure BEGIN
|
||||||
|
@ -1574,18 +1599,18 @@ Item {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: root.assetName === "" ? 15 : 150;
|
anchors.topMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 150;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.leftMargin: root.assetName === "" ? 15 : 50;
|
anchors.leftMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 50;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: root.assetName === "" ? 15 : 50;
|
anchors.rightMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 50;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: root.assetName === "" ? 15 : 300;
|
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 15 : 300;
|
||||||
color: "#FFFFFF";
|
color: "#FFFFFF";
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: paymentFailureText;
|
id: paymentFailureText;
|
||||||
text: root.assetName === "" ? "Payment Failed" : "Failed";
|
text: root.assetCertID === "" && sendAssetStep.referrer !== "payIn" ? "Payment Failed" : "Failed";
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: parent.top;
|
anchors.top: parent.top;
|
||||||
anchors.topMargin: 26;
|
anchors.topMargin: 26;
|
||||||
|
@ -1603,7 +1628,7 @@ Item {
|
||||||
|
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: closeGlyphButton_paymentFailure;
|
id: closeGlyphButton_paymentFailure;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "" && sendAssetStep.referrer !== "payIn";
|
||||||
text: hifi.glyphs.close;
|
text: hifi.glyphs.close;
|
||||||
color: hifi.colors.lightGrayText;
|
color: hifi.colors.lightGrayText;
|
||||||
size: 26;
|
size: 26;
|
||||||
|
@ -1632,7 +1657,8 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: paymentFailureDetailText;
|
id: paymentFailureDetailText;
|
||||||
text: "The recipient you specified was unable to receive your " + (root.assetName === "" ? "payment." : "gift.");
|
text: "The recipient you specified was unable to receive your " +
|
||||||
|
(root.assetCertID === "" ? "payment." : (sendAssetStep.referrer === "payIn" ? "item." : "gift."));
|
||||||
anchors.top: paymentFailureText.bottom;
|
anchors.top: paymentFailureText.bottom;
|
||||||
anchors.topMargin: 20;
|
anchors.topMargin: 20;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -1650,7 +1676,7 @@ Item {
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: sendToContainer_paymentFailure;
|
id: sendToContainer_paymentFailure;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "" || sendAssetStep.referrer === "payIn";
|
||||||
anchors.top: paymentFailureDetailText.bottom;
|
anchors.top: paymentFailureDetailText.bottom;
|
||||||
anchors.topMargin: 8;
|
anchors.topMargin: 8;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -1685,13 +1711,13 @@ Item {
|
||||||
userName: sendAssetStep.selectedRecipientUserName;
|
userName: sendAssetStep.selectedRecipientUserName;
|
||||||
profilePic: sendAssetStep.selectedRecipientProfilePic !== "" ? ((0 === sendAssetStep.selectedRecipientProfilePic.indexOf("http")) ?
|
profilePic: sendAssetStep.selectedRecipientProfilePic !== "" ? ((0 === sendAssetStep.selectedRecipientProfilePic.indexOf("http")) ?
|
||||||
sendAssetStep.selectedRecipientProfilePic : (Account.metaverseServerURL + sendAssetStep.selectedRecipientProfilePic)) : "";
|
sendAssetStep.selectedRecipientProfilePic : (Account.metaverseServerURL + sendAssetStep.selectedRecipientProfilePic)) : "";
|
||||||
isDisplayingNearby: sendAssetStep.referrer === "nearby";
|
multiLineDisplay: sendAssetStep.referrer === "nearby" || sendAssetStep.referrer === "payIn";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: amountContainer_paymentFailure;
|
id: amountContainer_paymentFailure;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "";
|
||||||
anchors.top: sendToContainer_paymentFailure.bottom;
|
anchors.top: sendToContainer_paymentFailure.bottom;
|
||||||
anchors.topMargin: 16;
|
anchors.topMargin: 16;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
|
@ -1746,7 +1772,7 @@ Item {
|
||||||
|
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
id: optionalMessage_paymentFailure;
|
id: optionalMessage_paymentFailure;
|
||||||
visible: root.assetName === "";
|
visible: root.assetCertID === "" || sendAssetStep.referrer === "payIn";
|
||||||
text: optionalMessage.text;
|
text: optionalMessage.text;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: amountContainer_paymentFailure.visible ? amountContainer_paymentFailure.bottom : sendToContainer_paymentFailure.bottom;
|
anchors.top: amountContainer_paymentFailure.visible ? amountContainer_paymentFailure.bottom : sendToContainer_paymentFailure.bottom;
|
||||||
|
@ -1768,15 +1794,18 @@ Item {
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: closeButton_paymentFailure;
|
id: closeButton_paymentFailure;
|
||||||
color: hifi.buttons.noneBorderless;
|
color: hifi.buttons.noneBorderless;
|
||||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||||
anchors.right: retryButton_paymentFailure.left;
|
anchors.right: retryButton_paymentFailure.left;
|
||||||
anchors.rightMargin: 12;
|
anchors.rightMargin: 12;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: root.assetName === "" ? 80 : 30;
|
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 80 : 30;
|
||||||
height: 50;
|
height: 50;
|
||||||
width: 120;
|
width: 120;
|
||||||
text: "Cancel";
|
text: "Cancel";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
if (sendAssetStep.referrer === "payIn") {
|
||||||
|
sendToScript({method: "closeSendAsset"});
|
||||||
|
} else {
|
||||||
root.nextActiveView = "sendAssetHome";
|
root.nextActiveView = "sendAssetHome";
|
||||||
resetSendAssetData();
|
resetSendAssetData();
|
||||||
if (root.assetName !== "") {
|
if (root.assetName !== "") {
|
||||||
|
@ -1784,22 +1813,23 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// "Retry" button
|
// "Retry" button
|
||||||
HifiControlsUit.Button {
|
HifiControlsUit.Button {
|
||||||
id: retryButton_paymentFailure;
|
id: retryButton_paymentFailure;
|
||||||
color: hifi.buttons.blue;
|
color: hifi.buttons.blue;
|
||||||
colorScheme: root.assetName === "" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
colorScheme: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? hifi.colorSchemes.dark : hifi.colorSchemes.light;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 12;
|
anchors.rightMargin: 12;
|
||||||
anchors.bottom: parent.bottom;
|
anchors.bottom: parent.bottom;
|
||||||
anchors.bottomMargin: root.assetName === "" ? 80 : 30;
|
anchors.bottomMargin: root.assetCertID === "" || sendAssetStep.referrer === "payIn" ? 80 : 30;
|
||||||
height: 50;
|
height: 50;
|
||||||
width: 120;
|
width: 120;
|
||||||
text: "Retry";
|
text: "Retry";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
root.isCurrentlySendingAsset = true;
|
root.isCurrentlySendingAsset = true;
|
||||||
if (sendAssetStep.referrer === "connections") {
|
if (sendAssetStep.referrer === "connections" || sendAssetStep.referrer === "payIn") {
|
||||||
Commerce.transferAssetToUsername(sendAssetStep.selectedRecipientUserName,
|
Commerce.transferAssetToUsername(sendAssetStep.selectedRecipientUserName,
|
||||||
root.assetCertID,
|
root.assetCertID,
|
||||||
parseInt(amountTextField.text),
|
parseInt(amountTextField.text),
|
||||||
|
@ -1866,11 +1896,32 @@ Item {
|
||||||
case 'updateSelectedRecipientUsername':
|
case 'updateSelectedRecipientUsername':
|
||||||
sendAssetStep.selectedRecipientUserName = message.userName;
|
sendAssetStep.selectedRecipientUserName = message.userName;
|
||||||
break;
|
break;
|
||||||
|
case 'updateSendAssetQML':
|
||||||
|
root.assetName = "";
|
||||||
|
root.assetCertID = message.assetCertID || "";
|
||||||
|
if (root.assetCertID === "") {
|
||||||
|
amountTextField.text = message.amount || 1;
|
||||||
|
} else {
|
||||||
|
amountTextField.text = "";
|
||||||
|
Commerce.certificateInfo(root.assetCertID);
|
||||||
|
}
|
||||||
|
sendAssetStep.referrer = "payIn";
|
||||||
|
sendAssetStep.selectedRecipientNodeID = "";
|
||||||
|
sendAssetStep.selectedRecipientDisplayName = "Determined by script:";
|
||||||
|
sendAssetStep.selectedRecipientUserName = message.username;
|
||||||
|
optionalMessage.text = message.message || "No Message Provided";
|
||||||
|
|
||||||
|
root.nextActiveView = "sendAssetStep";
|
||||||
|
break;
|
||||||
|
case 'inspectionCertificate_resetCert':
|
||||||
|
// NOP
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.log('SendAsset: Unrecognized message from wallet.js');
|
console.log('SendAsset: Unrecognized message from wallet.js');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
signal sendSignalToParent(var msg);
|
signal sendSignalToParent(var msg);
|
||||||
|
signal sendToScript(var message);
|
||||||
//
|
//
|
||||||
// FUNCTION DEFINITIONS END
|
// FUNCTION DEFINITIONS END
|
||||||
//
|
//
|
||||||
|
|
|
@ -539,6 +539,9 @@ function fromQml(message) {
|
||||||
case 'http.request':
|
case 'http.request':
|
||||||
// Handled elsewhere, don't log.
|
// Handled elsewhere, don't log.
|
||||||
break;
|
break;
|
||||||
|
case 'closeSendAsset':
|
||||||
|
ui.close();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
print('wallet.js: Unrecognized message from QML');
|
print('wallet.js: Unrecognized message from QML');
|
||||||
}
|
}
|
||||||
|
@ -663,6 +666,7 @@ function uninstallMarketplaceItemTester() {
|
||||||
|
|
||||||
var BUTTON_NAME = "INVENTORY";
|
var BUTTON_NAME = "INVENTORY";
|
||||||
var WALLET_QML_SOURCE = "hifi/commerce/wallet/Wallet.qml";
|
var WALLET_QML_SOURCE = "hifi/commerce/wallet/Wallet.qml";
|
||||||
|
var SENDASSET_QML_SOURCE = "hifi/commerce/common/sendAsset/SendAsset.qml";
|
||||||
var NOTIFICATION_POLL_TIMEOUT = 300000;
|
var NOTIFICATION_POLL_TIMEOUT = 300000;
|
||||||
var ui;
|
var ui;
|
||||||
function startup() {
|
function startup() {
|
||||||
|
@ -686,6 +690,7 @@ function startup() {
|
||||||
buttonName: BUTTON_NAME,
|
buttonName: BUTTON_NAME,
|
||||||
sortOrder: 10,
|
sortOrder: 10,
|
||||||
home: WALLET_QML_SOURCE,
|
home: WALLET_QML_SOURCE,
|
||||||
|
additionalAppScreens: SENDASSET_QML_SOURCE,
|
||||||
onOpened: walletOpened,
|
onOpened: walletOpened,
|
||||||
onClosed: walletClosed,
|
onClosed: walletClosed,
|
||||||
onMessage: fromQml,
|
onMessage: fromQml,
|
||||||
|
|
|
@ -219,17 +219,12 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function buyButtonClicked(id, name, author, price, href, referrer, edition, type) {
|
function buyButtonClicked(id, referrer, edition) {
|
||||||
EventBridge.emitWebEvent(JSON.stringify({
|
EventBridge.emitWebEvent(JSON.stringify({
|
||||||
type: "CHECKOUT",
|
type: "CHECKOUT",
|
||||||
itemId: id,
|
itemId: id,
|
||||||
itemName: name,
|
|
||||||
itemPrice: price ? parseInt(price, 10) : 0,
|
|
||||||
itemHref: href,
|
|
||||||
referrer: referrer,
|
referrer: referrer,
|
||||||
itemAuthor: author,
|
itemEdition: edition
|
||||||
itemEdition: edition,
|
|
||||||
itemType: type.trim()
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,13 +308,8 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
buyButtonClicked($(this).closest('.grid-item').attr('data-item-id'),
|
buyButtonClicked($(this).closest('.grid-item').attr('data-item-id'),
|
||||||
$(this).closest('.grid-item').find('.item-title').text(),
|
|
||||||
$(this).closest('.grid-item').find('.creator').find('.value').text(),
|
|
||||||
$(this).closest('.grid-item').find('.item-cost').text(),
|
|
||||||
$(this).attr('data-href'),
|
|
||||||
"mainPage",
|
"mainPage",
|
||||||
-1,
|
-1);
|
||||||
$(this).closest('.grid-item').find('.item-type').text());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -427,13 +417,8 @@
|
||||||
purchaseButton.on('click', function () {
|
purchaseButton.on('click', function () {
|
||||||
if ('available' === availability || isUpdating) {
|
if ('available' === availability || isUpdating) {
|
||||||
buyButtonClicked(window.location.pathname.split("/")[3],
|
buyButtonClicked(window.location.pathname.split("/")[3],
|
||||||
$('#top-center').find('h1').text(),
|
|
||||||
$('#creator').find('.value').text(),
|
|
||||||
cost,
|
|
||||||
href,
|
|
||||||
"itemPage",
|
"itemPage",
|
||||||
urlParams.get('edition'),
|
urlParams.get('edition'));
|
||||||
type);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -471,7 +471,7 @@ function onWebEventReceived(message) {
|
||||||
wireQmlEventBridge(true);
|
wireQmlEventBridge(true);
|
||||||
ui.open(MARKETPLACE_CHECKOUT_QML_PATH);
|
ui.open(MARKETPLACE_CHECKOUT_QML_PATH);
|
||||||
ui.tablet.sendToQml({
|
ui.tablet.sendToQml({
|
||||||
method: 'updateCheckoutQML',
|
method: 'updateCheckoutQMLItemID',
|
||||||
params: message
|
params: message
|
||||||
});
|
});
|
||||||
} else if (message.type === "REQUEST_SETTING") {
|
} else if (message.type === "REQUEST_SETTING") {
|
||||||
|
|
Loading…
Reference in a new issue