Merge pull request #5797 from BlueWallet/fix-azteco

FIX: azteco voucher updated uri format
This commit is contained in:
GLaDOS 2023-10-29 19:57:14 +00:00 committed by GitHub
commit 27ee1739c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View File

@ -30,6 +30,18 @@ export default class Azteco {
static getParamsFromUrl(u) { static getParamsFromUrl(u) {
const urlObject = URL.parse(u, true); // eslint-disable-line n/no-deprecated-api const urlObject = URL.parse(u, true); // eslint-disable-line n/no-deprecated-api
if (urlObject.query.code) {
// newer format of the url
return {
uri: u,
c1: urlObject.query.code.substring(0, 4),
c2: urlObject.query.code.substring(4, 8),
c3: urlObject.query.code.substring(8, 12),
c4: urlObject.query.code.substring(12, 16),
};
}
return { return {
uri: u, uri: u,
c1: urlObject.query.c1, c1: urlObject.query.c1,

View File

@ -172,6 +172,18 @@ describe.each(['', '//'])('unit - DeepLinkSchemaMatch', function (suffix) {
}, },
], ],
}, },
{
argument: {
url: 'https://azte.co/redeem?code=1111222233334444',
},
expected: [
'AztecoRedeemRoot',
{
screen: 'AztecoRedeem',
params: { c1: '1111', c2: '2222', c3: '3333', c4: '4444', uri: 'https://azte.co/redeem?code=1111222233334444' },
},
],
},
{ {
argument: { argument: {
url: 'https://azte.co/?c1=3062&c2=2586&c3=5053&c4=5261', url: 'https://azte.co/?c1=3062&c2=2586&c3=5053&c4=5261',