-
Notifications
You must be signed in to change notification settings - Fork 262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversion tracking for Banxa and Simplex #5368
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Other languages? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to replace this string in other languages that are untranslated There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean by "replace the string"? |
||
"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.", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you decided to correct the "canceled" string spelling, change it here too for searchability. |
||
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) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Common misspelling. In American English, it's actually "canceled."
Recommend changing all these here and in the respective jsons. See
transaction_details_swap_order_cancel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.merriam-webster.com/grammar/canceled-or-cancelled#:~:text=While%20both%20canceled%20and%20cancelled,more%20common%20in%20British%20English
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, change
transaction_details_swap_order_cancel
to use two L's, since Americans don't really follow American spelling for this, anyway.Either way, just make sure we're consistent.