diff --git a/src/locales/en_US.ts b/src/locales/en_US.ts index 55653cf1ea5..d09954e4a3b 100644 --- a/src/locales/en_US.ts +++ b/src/locales/en_US.ts @@ -735,7 +735,7 @@ const strings = { transaction_details_fee_warning: 'High Network Fees', transaction_details_swap: 'Swap Funds', transaction_details_swap_network_fee: 'Swap Network Fee', - transaction_details_swap_order_cancel: 'Swap Order Canceled', + transaction_details_swap_order_cancel: 'Swap Order Cancelled', transaction_details_swap_order_post: 'Swap Order Opened', transaction_details_swap_order_fill: 'Swap Order Filled', transaction_details_claim: 'Claim Staked Funds', @@ -1464,11 +1464,13 @@ const strings = { fiat_plugin_fetching_assets: 'Fetching supported assets', fiat_plugin_sell_cancelled: 'Sell order cancelled', fiat_plugin_finalizing_quote: 'Finalizing your exchange quote. Please wait as this may take up to a minute', + fiat_plugin_buy_cancelled: 'Buy order cancelled', fiat_plugin_buy_complete_title: 'Buy Order Complete', fiat_plugin_buy_complete_message_s: 'Your buy order of %1$s %2$s with %3$s %4$s has been completed.', fiat_plugin_buy_complete_message_2_hour_s: 'Please allow up to %1$s hour for the funds to appear in your wallet.', fiat_plugin_buy_complete_message_2_hours_s: 'Please allow up to %1$s hours for the funds to appear in your wallet.', fiat_plugin_buy_failed_try_again: 'Buy order failed. Please try again', + fiat_plugin_buy_unknown_status: 'Unknown order status upon completion. Please contact support for assistence.', fiat_plugin_sell_complete_title: 'Sell Order Complete', fiat_plugin_sell_complete_message_s: 'Your sell order of %1$s %2$s for %3$s %4$s has been completed.', fiat_plugin_sell_complete_message_2_hour_s: 'Please allow up to %1$s hour for the funds to appear in your account.', diff --git a/src/locales/strings/de.json b/src/locales/strings/de.json index 9aea04273fd..19444fb4635 100644 --- a/src/locales/strings/de.json +++ b/src/locales/strings/de.json @@ -668,7 +668,7 @@ "transaction_details_fee_warning": "Hohe Netzwerkgebühren", "transaction_details_swap": "Swap Funds", "transaction_details_swap_network_fee": "Swap Network Fee", - "transaction_details_swap_order_cancel": "Swap Order Canceled", + "transaction_details_swap_order_cancel": "Swap Order Cancelled", "transaction_details_swap_order_post": "Swap Order Opened", "transaction_details_swap_order_fill": "Swap Order Filled", "transaction_details_claim": "Claim Staked Funds", diff --git a/src/locales/strings/enUS.json b/src/locales/strings/enUS.json index 28f5c7f5600..068ee02352f 100644 --- a/src/locales/strings/enUS.json +++ b/src/locales/strings/enUS.json @@ -668,7 +668,7 @@ "transaction_details_fee_warning": "High Network Fees", "transaction_details_swap": "Swap Funds", "transaction_details_swap_network_fee": "Swap Network Fee", - "transaction_details_swap_order_cancel": "Swap Order Canceled", + "transaction_details_swap_order_cancel": "Swap Order Cancelled", "transaction_details_swap_order_post": "Swap Order Opened", "transaction_details_swap_order_fill": "Swap Order Filled", "transaction_details_claim": "Claim Staked Funds", @@ -1295,11 +1295,13 @@ "fiat_plugin_fetching_assets": "Fetching supported assets", "fiat_plugin_sell_cancelled": "Sell order cancelled", "fiat_plugin_finalizing_quote": "Finalizing your exchange quote. Please wait as this may take up to a minute", + "fiat_plugin_buy_cancelled": "Buy order cancelled", "fiat_plugin_buy_complete_title": "Buy Order Complete", "fiat_plugin_buy_complete_message_s": "Your buy order of %1$s %2$s with %3$s %4$s has been completed.", "fiat_plugin_buy_complete_message_2_hour_s": "Please allow up to %1$s hour for the funds to appear in your wallet.", "fiat_plugin_buy_complete_message_2_hours_s": "Please allow up to %1$s hours for the funds to appear in your wallet.", "fiat_plugin_buy_failed_try_again": "Buy order failed. Please try again", + "fiat_plugin_buy_unknown_status": "Unknown order status upon completion. Please contact support for assistence.", "fiat_plugin_sell_complete_title": "Sell Order Complete", "fiat_plugin_sell_complete_message_s": "Your sell order of %1$s %2$s for %3$s %4$s has been completed.", "fiat_plugin_sell_complete_message_2_hour_s": "Please allow up to %1$s hour for the funds to appear in your account.", diff --git a/src/locales/strings/es.json b/src/locales/strings/es.json index ac4d9914f69..5b56716183b 100644 --- a/src/locales/strings/es.json +++ b/src/locales/strings/es.json @@ -668,7 +668,7 @@ "transaction_details_fee_warning": "Tarifas de red altas", "transaction_details_swap": "Swap Funds", "transaction_details_swap_network_fee": "Swap Network Fee", - "transaction_details_swap_order_cancel": "Swap Order Canceled", + "transaction_details_swap_order_cancel": "Swap Order Cancelled", "transaction_details_swap_order_post": "Swap Order Opened", "transaction_details_swap_order_fill": "Swap Order Filled", "transaction_details_claim": "Claim Staked Funds", diff --git a/src/locales/strings/fr.json b/src/locales/strings/fr.json index 44cede5668a..4d300de877a 100644 --- a/src/locales/strings/fr.json +++ b/src/locales/strings/fr.json @@ -668,7 +668,7 @@ "transaction_details_fee_warning": "High Network Fees", "transaction_details_swap": "Swap Funds", "transaction_details_swap_network_fee": "Swap Network Fee", - "transaction_details_swap_order_cancel": "Swap Order Canceled", + "transaction_details_swap_order_cancel": "Swap Order Cancelled", "transaction_details_swap_order_post": "Swap Order Opened", "transaction_details_swap_order_fill": "Swap Order Filled", "transaction_details_claim": "Claim Staked Funds", diff --git a/src/locales/strings/ja.json b/src/locales/strings/ja.json index 8f822ba51f0..b97d733515f 100644 --- a/src/locales/strings/ja.json +++ b/src/locales/strings/ja.json @@ -668,7 +668,7 @@ "transaction_details_fee_warning": "高いネットワーク手数料", "transaction_details_swap": "Swap Funds", "transaction_details_swap_network_fee": "Swap Network Fee", - "transaction_details_swap_order_cancel": "Swap Order Canceled", + "transaction_details_swap_order_cancel": "Swap Order Cancelled", "transaction_details_swap_order_post": "Swap Order Opened", "transaction_details_swap_order_fill": "Swap Order Filled", "transaction_details_claim": "Claim Staked Funds", diff --git a/src/locales/strings/kaa.json b/src/locales/strings/kaa.json index a5f5ad49ca8..5f25909f58d 100644 --- a/src/locales/strings/kaa.json +++ b/src/locales/strings/kaa.json @@ -668,7 +668,7 @@ "transaction_details_fee_warning": "High Network Fees", "transaction_details_swap": "Swap Funds", "transaction_details_swap_network_fee": "Swap Network Fee", - "transaction_details_swap_order_cancel": "Swap Order Canceled", + "transaction_details_swap_order_cancel": "Swap Order Cancelled", "transaction_details_swap_order_post": "Swap Order Opened", "transaction_details_swap_order_fill": "Swap Order Filled", "transaction_details_claim": "Claim Staked Funds", diff --git a/src/locales/strings/ko.json b/src/locales/strings/ko.json index a3c64058c7a..89881ddaad0 100644 --- a/src/locales/strings/ko.json +++ b/src/locales/strings/ko.json @@ -668,7 +668,7 @@ "transaction_details_fee_warning": "High Network Fees", "transaction_details_swap": "Swap Funds", "transaction_details_swap_network_fee": "Swap Network Fee", - "transaction_details_swap_order_cancel": "Swap Order Canceled", + "transaction_details_swap_order_cancel": "Swap Order Cancelled", "transaction_details_swap_order_post": "Swap Order Opened", "transaction_details_swap_order_fill": "Swap Order Filled", "transaction_details_claim": "Claim Staked Funds", diff --git a/src/locales/strings/pt.json b/src/locales/strings/pt.json index 9f251311bc5..f4ab0e9723b 100644 --- a/src/locales/strings/pt.json +++ b/src/locales/strings/pt.json @@ -668,7 +668,7 @@ "transaction_details_fee_warning": "Altas taxas de rede", "transaction_details_swap": "Swap Funds", "transaction_details_swap_network_fee": "Swap Network Fee", - "transaction_details_swap_order_cancel": "Swap Order Canceled", + "transaction_details_swap_order_cancel": "Swap Order Cancelled", "transaction_details_swap_order_post": "Swap Order Opened", "transaction_details_swap_order_fill": "Swap Order Filled", "transaction_details_claim": "Claim Staked Funds", diff --git a/src/locales/strings/ru.json b/src/locales/strings/ru.json index aea18aa58d1..08949126ccf 100644 --- a/src/locales/strings/ru.json +++ b/src/locales/strings/ru.json @@ -668,7 +668,7 @@ "transaction_details_fee_warning": "High Network Fees", "transaction_details_swap": "Swap Funds", "transaction_details_swap_network_fee": "Swap Network Fee", - "transaction_details_swap_order_cancel": "Swap Order Canceled", + "transaction_details_swap_order_cancel": "Swap Order Cancelled", "transaction_details_swap_order_post": "Swap Order Opened", "transaction_details_swap_order_fill": "Swap Order Filled", "transaction_details_claim": "Claim Staked Funds", diff --git a/src/locales/strings/vi.json b/src/locales/strings/vi.json index cca64c00791..a466601426d 100644 --- a/src/locales/strings/vi.json +++ b/src/locales/strings/vi.json @@ -668,7 +668,7 @@ "transaction_details_fee_warning": "High Network Fees", "transaction_details_swap": "Swap Funds", "transaction_details_swap_network_fee": "Swap Network Fee", - "transaction_details_swap_order_cancel": "Swap Order Canceled", + "transaction_details_swap_order_cancel": "Swap Order Cancelled", "transaction_details_swap_order_post": "Swap Order Opened", "transaction_details_swap_order_fill": "Swap Order Filled", "transaction_details_claim": "Claim Staked Funds", diff --git a/src/locales/strings/zh.json b/src/locales/strings/zh.json index 752bdddb479..4a29a0861dc 100644 --- a/src/locales/strings/zh.json +++ b/src/locales/strings/zh.json @@ -668,7 +668,7 @@ "transaction_details_fee_warning": "High Network Fees", "transaction_details_swap": "Swap Funds", "transaction_details_swap_network_fee": "Swap Network Fee", - "transaction_details_swap_order_cancel": "Swap Order Canceled", + "transaction_details_swap_order_cancel": "Swap Order Cancelled", "transaction_details_swap_order_post": "Swap Order Opened", "transaction_details_swap_order_fill": "Swap Order Filled", "transaction_details_claim": "Claim Staked Funds", diff --git a/src/plugins/gui/providers/banxaProvider.ts b/src/plugins/gui/providers/banxaProvider.ts index f7443fbf965..a7153cf3c50 100644 --- a/src/plugins/gui/providers/banxaProvider.ts +++ b/src/plugins/gui/providers/banxaProvider.ts @@ -560,9 +560,9 @@ export const banxaProvider: FiatProviderFactory = { source: queryParams.source, target: queryParams.target, blockchain: banxaChain, - return_url_on_success: RETURN_URL_SUCCESS, - return_url_on_cancelled: RETURN_URL_CANCEL, - return_url_on_failure: RETURN_URL_FAIL + return_url_on_success: direction === 'buy' ? `https://deep.edge.app/fiatprovider/buy/banxa?status=success` : RETURN_URL_SUCCESS, + return_url_on_cancelled: direction === 'buy' ? `https://deep.edge.app/fiatprovider/buy/banxa?status=cancelled` : RETURN_URL_CANCEL, + return_url_on_failure: direction === 'buy' ? `https://deep.edge.app/fiatprovider/buy/banxa?status=failure` : RETURN_URL_FAIL } if (direction === 'buy') { if (testnet && banxaChain === 'BTC') { @@ -594,7 +594,53 @@ export const banxaProvider: FiatProviderFactory = { let insideInterval = false if (direction === 'buy') { - await showUi.openExternalWebView({ url: banxaQuote.data.order.checkout_url }) + await showUi.openExternalWebView({ + providerId, + url: banxaQuote.data.order.checkout_url, + deeplinkHandler: async link => { + if (link.direction !== 'buy') return + + const orderResponse = await banxaFetch({ method: 'GET', url, hmacUser, path: `api/orders/${banxaQuote.data.order.id}`, apiKey }) + const order = asBanxaOrderResponse(orderResponse) + + switch (link.query.status) { + case 'success': { + await showUi.trackConversion('Buy_Success', { + conversionValues: { + conversionType: 'buy', + sourceFiatCurrencyCode: fiatCurrencyCode, + sourceFiatAmount: priceQuote.fiat_amount, + destAmount: new CryptoAmount({ + currencyConfig: coreWallet.currencyConfig, + currencyCode: displayCurrencyCode, + exchangeAmount: order.data.order.coin_amount + }), + fiatProviderId: providerId, + orderId: banxaQuote.data.order.id + } + }) + await showUi.exitScene() + break + } + case 'cancelled': { + console.log('Banxa WebView launch buy cancelled: ' + link.uri) + await showUi.showToast(lstrings.fiat_plugin_buy_cancelled, NOT_SUCCESS_TOAST_HIDE_MS) + await showUi.exitScene() + break + } + case 'failure': { + console.log('Banxa WebView launch buy failure: ' + link.uri) + await showUi.showToast(lstrings.fiat_plugin_buy_failed_try_again, NOT_SUCCESS_TOAST_HIDE_MS) + await showUi.exitScene() + break + } + default: { + await showUi.showToast(lstrings.fiat_plugin_buy_unknown_status, NOT_SUCCESS_TOAST_HIDE_MS) + await showUi.exitScene() + } + } + } + }) } else { const { checkout_url: checkoutUrl, id } = banxaQuote.data.order const banxaUrl = new URL(checkoutUrl)