FIX: azteco voucher updated uri format

This commit is contained in:
overtorment 2023-10-29 18:46:52 +00:00
parent e5c73f51d2
commit 0f789fe669
2 changed files with 24 additions and 0 deletions

View file

@ -30,6 +30,18 @@ export default class Azteco {
static getParamsFromUrl(u) {
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 {
uri: u,
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: {
url: 'https://azte.co/?c1=3062&c2=2586&c3=5053&c4=5261',