From 0f789fe669d5f65accec188d6ff44b54b03b5460 Mon Sep 17 00:00:00 2001 From: overtorment Date: Sun, 29 Oct 2023 18:46:52 +0000 Subject: [PATCH] FIX: azteco voucher updated uri format --- class/azteco.js | 12 ++++++++++++ tests/unit/deeplink-schema-match.test.js | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/class/azteco.js b/class/azteco.js index 78cc4d9e0..292b536f4 100644 --- a/class/azteco.js +++ b/class/azteco.js @@ -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, diff --git a/tests/unit/deeplink-schema-match.test.js b/tests/unit/deeplink-schema-match.test.js index f3345539f..6242d4810 100644 --- a/tests/unit/deeplink-schema-match.test.js +++ b/tests/unit/deeplink-schema-match.test.js @@ -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',