From 638d426359bd46b84a857e2e7418204a49043f58 Mon Sep 17 00:00:00 2001 From: Shahzaib Date: Fri, 16 Dec 2022 10:52:04 +0500 Subject: [PATCH 1/2] chore: build --- dist/utils/constants.js | 4 ++-- dist/utils/constants.js.map | 2 +- dist/utils/helpers.js | 15 ++++++++++++--- dist/utils/helpers.js.map | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/dist/utils/constants.js b/dist/utils/constants.js index a7c05cb..520f304 100644 --- a/dist/utils/constants.js +++ b/dist/utils/constants.js @@ -1,5 +1,5 @@ export var HANDSHAKE_URL = 'https://payments.bankalfalah.com/HS/HS/HS'; -export var SANDBOX_HANDSHAKE_URL = 'https://payments.bankalfalah.com/HS/HS/HS'; +export var SANDBOX_HANDSHAKE_URL = 'https://sandbox.bankalfalah.com/HS/HS/HS'; export var POST_URL = 'https://payments.bankalfalah.com/SSO/SSO/SSO'; -export var SANDBOX_POST_URL = 'https://payments.bankalfalah.com/SSO/SSO/SSO'; +export var SANDBOX_POST_URL = 'https://sandbox.bankalfalah.com/SSO/SSO/SSO'; //# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/dist/utils/constants.js.map b/dist/utils/constants.js.map index cd4fe45..9a839ec 100644 --- a/dist/utils/constants.js.map +++ b/dist/utils/constants.js.map @@ -1 +1 @@ -{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,aAAa,GACxB,2CAA2C,CAAC;AAC9C,MAAM,CAAC,IAAM,qBAAqB,GAChC,2CAA2C,CAAC;AAC9C,MAAM,CAAC,IAAM,QAAQ,GAAW,8CAA8C,CAAC;AAC/E,MAAM,CAAC,IAAM,gBAAgB,GAC3B,8CAA8C,CAAC"} \ No newline at end of file +{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,aAAa,GACxB,2CAA2C,CAAC;AAC9C,MAAM,CAAC,IAAM,qBAAqB,GAChC,0CAA0C,CAAC;AAC7C,MAAM,CAAC,IAAM,QAAQ,GAAW,8CAA8C,CAAC;AAC/E,MAAM,CAAC,IAAM,gBAAgB,GAC3B,6CAA6C,CAAC"} \ No newline at end of file diff --git a/dist/utils/helpers.js b/dist/utils/helpers.js index 1c9ac27..43d2a2d 100644 --- a/dist/utils/helpers.js +++ b/dist/utils/helpers.js @@ -101,7 +101,7 @@ export var generateRequestHash = function (values, secretKey1, secretKey2) { return hash.toString(); }; export var getHSAuthToken = function (data, HS_RequestHash, isSandbox) { return __awaiter(void 0, void 0, void 0, function () { - var _data, myHeaders, urlencoded, requestOptions, response; + var _data, myHeaders, urlencoded, requestOptions, response, error_1; return __generator(this, function (_a) { switch (_a.label) { case 0: @@ -118,11 +118,20 @@ export var getHSAuthToken = function (data, HS_RequestHash, isSandbox) { return headers: myHeaders, body: urlencoded, }; + _a.label = 1; + case 1: + _a.trys.push([1, 4, , 5]); return [4 /*yield*/, fetch(isSandbox ? SANDBOX_HANDSHAKE_URL : HANDSHAKE_URL, requestOptions)]; - case 1: return [4 /*yield*/, (_a.sent()).json()]; - case 2: + case 2: return [4 /*yield*/, (_a.sent()).json()]; + case 3: response = _a.sent(); + if (!response.AuthToken) + throw new Error('Invalid Request'); return [2 /*return*/, response]; + case 4: + error_1 = _a.sent(); + throw new Error(error_1); + case 5: return [2 /*return*/]; } }); }); }; diff --git a/dist/utils/helpers.js.map b/dist/utils/helpers.js.map index 146b5cb..e6905df 100644 --- a/dist/utils/helpers.js.map +++ b/dist/utils/helpers.js.map @@ -1 +1 @@ -{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,QAAQ,MAAM,WAAW,CAAC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,qBAAqB,CAAC,CAAC,CAAC,aAAa,EACjD,cAAc,CACf,EAAA;oBAJc,qBAAM,CACrB,SAGC,CACF,CAAC,IAAI,EAAE,EAAA;;gBALF,QAAQ,GAAG,SAKT;gBACR,IAAI,CAAC,QAAQ,CAAC,SAAS;oBAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;gBAC5D,sBAAO,QAAQ,EAAC;;;gBAEhB,MAAM,IAAI,KAAK,CAAC,OAAK,CAAC,CAAC;;;;KAE1B,CAAC"} \ No newline at end of file From a78b62bc439db1c35ebae432d4827f0aea9e0c2b Mon Sep 17 00:00:00 2001 From: Shahzaib Date: Fri, 16 Dec 2022 10:53:48 +0500 Subject: [PATCH 2/2] chore: bump release number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7a1a7f7..11d71a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-alfa-payment", - "version": "1.0.0", + "version": "1.1.0", "keywords": [], "description": "Alfalah Credit Card Payment Gateway for React", "main": "dist/index.min.js",