@fat-zebra/sdk 1.5.4 → 1.5.5-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/applepay/applepay.d.ts +22 -7
- package/dist/applepay/applepay.js +89 -21
- package/dist/applepay/clients/apple-pay-client.d.ts +9 -5
- package/dist/applepay/clients/apple-pay-client.js +9 -3
- package/dist/applepay/clients/paynow-client.d.ts +4 -2
- package/dist/applepay/clients/paynow-client.js +2 -7
- package/dist/applepay/types.d.ts +15 -0
- package/dist/applepay/types.js +1 -0
- package/dist/click_to_pay/index.js +12 -0
- package/dist/click_to_pay/types.d.ts +11 -2
- package/dist/local/fatzebra.js +585 -11
- package/dist/local/fatzebra.js.map +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.js +24 -2
- package/dist/production/fatzebra.css +91 -0
- package/dist/production/fatzebra.js +2 -0
- package/dist/production/fatzebra.js.LICENSE.txt +1 -0
- package/dist/react/ApplePayButton.d.ts +1 -3
- package/dist/react/ApplePayButton.js +12 -27
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +2 -1
- package/dist/react/useFatZebra.js +8 -57
- package/dist/react/useMessage.d.ts +10 -0
- package/dist/react/useMessage.js +70 -0
- package/dist/sandbox/fatzebra.css +91 -0
- package/dist/sandbox/fatzebra.js +2 -0
- package/dist/sandbox/fatzebra.js.LICENSE.txt +1 -0
- package/dist/scripts/release-package.js +324 -0
- package/dist/scripts/release-package.js.map +1 -0
- package/dist/shared/env.development.d.ts +3 -3
- package/dist/shared/env.development.js +3 -3
- package/dist/shared/envs/local.d.ts +3 -3
- package/dist/shared/envs/local.js +3 -3
- package/dist/shared/post-message-client.d.ts +2 -0
- package/dist/shared/post-message-client.js +1 -1
- package/dist/shared/types.d.ts +14 -2
- package/dist/shared/types.js +2 -0
- package/dist/src/applepay/applepay.js +198 -0
- package/dist/src/applepay/applepay.js.map +1 -0
- package/dist/src/applepay/applepaymanager.js +279 -0
- package/dist/src/applepay/applepaymanager.js.map +1 -0
- package/dist/src/applepay/clients/apple-pay-client.js +66 -0
- package/dist/src/applepay/clients/apple-pay-client.js.map +1 -0
- package/dist/src/applepay/clients/paynow-client.js +96 -0
- package/dist/src/applepay/clients/paynow-client.js.map +1 -0
- package/dist/src/applepay/index.js +6 -0
- package/dist/src/applepay/index.js.map +1 -0
- package/dist/src/click_to_pay/clicktopay.test.js +131 -0
- package/dist/src/click_to_pay/clicktopay.test.js.map +1 -0
- package/dist/src/click_to_pay/index.js +135 -0
- package/dist/src/click_to_pay/index.js.map +1 -0
- package/dist/src/click_to_pay/types.js +3 -0
- package/dist/src/click_to_pay/types.js.map +1 -0
- package/dist/src/hpp/hpp.js +230 -0
- package/dist/src/hpp/hpp.js.map +1 -0
- package/dist/src/hpp/hpp.test.js +137 -0
- package/dist/src/hpp/hpp.test.js.map +1 -0
- package/dist/src/hpp/index.js +6 -0
- package/dist/src/hpp/index.js.map +1 -0
- package/dist/src/index.js +15 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/main.js +229 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/main.test.js +236 -0
- package/dist/src/main.test.js.map +1 -0
- package/dist/src/react/ApplePayButton.js +56 -0
- package/dist/src/react/ApplePayButton.js.map +1 -0
- package/dist/src/react/VerifyCard.js +29 -0
- package/dist/src/react/VerifyCard.js.map +1 -0
- package/dist/src/react/VerifyExistingCard.js +30 -0
- package/dist/src/react/VerifyExistingCard.js.map +1 -0
- package/dist/src/react/applePayUrl.js +46 -0
- package/dist/src/react/applePayUrl.js.map +1 -0
- package/dist/src/react/applePayUrl.test.js +57 -0
- package/dist/src/react/applePayUrl.test.js.map +1 -0
- package/dist/src/react/index.js +13 -0
- package/dist/src/react/index.js.map +1 -0
- package/dist/src/react/paymentUrl.js +60 -0
- package/dist/src/react/paymentUrl.js.map +1 -0
- package/dist/src/react/paymentUrl.test.js +88 -0
- package/dist/src/react/paymentUrl.test.js.map +1 -0
- package/dist/src/react/submitForm.js +13 -0
- package/dist/src/react/submitForm.js.map +1 -0
- package/dist/src/react/useFatZebra.js +70 -0
- package/dist/src/react/useFatZebra.js.map +1 -0
- package/dist/src/react/useMessage.js +140 -0
- package/dist/src/react/useMessage.js.map +1 -0
- package/dist/src/react/useMessage.test.js +222 -0
- package/dist/src/react/useMessage.test.js.map +1 -0
- package/dist/src/react/verifyUrl.js +49 -0
- package/dist/src/react/verifyUrl.js.map +1 -0
- package/dist/src/sca/cardinal.js +145 -0
- package/dist/src/sca/cardinal.js.map +1 -0
- package/dist/src/sca/cardinal.test.js +77 -0
- package/dist/src/sca/cardinal.test.js.map +1 -0
- package/dist/src/sca/eci-mappings.js +63 -0
- package/dist/src/sca/eci-mappings.js.map +1 -0
- package/dist/src/sca/eci-mappings.test.js +31 -0
- package/dist/src/sca/eci-mappings.test.js.map +1 -0
- package/dist/src/sca/index.js +382 -0
- package/dist/src/sca/index.js.map +1 -0
- package/dist/src/sca/index.test.js +624 -0
- package/dist/src/sca/index.test.js.map +1 -0
- package/dist/src/sca/scenarios/enrollment.js +161 -0
- package/dist/src/sca/scenarios/enrollment.js.map +1 -0
- package/dist/src/sca/scenarios/index.js +8 -0
- package/dist/src/sca/scenarios/index.js.map +1 -0
- package/dist/src/sca/scenarios/validation.js +139 -0
- package/dist/src/sca/scenarios/validation.js.map +1 -0
- package/dist/src/sca/types.js +57 -0
- package/dist/src/sca/types.js.map +1 -0
- package/dist/src/shared/api-gateway-client.js +148 -0
- package/dist/src/shared/api-gateway-client.js.map +1 -0
- package/dist/src/shared/bridge-client.js +24 -0
- package/dist/src/shared/bridge-client.js.map +1 -0
- package/dist/src/shared/constants.js +19 -0
- package/dist/src/shared/constants.js.map +1 -0
- package/dist/src/shared/env.development.js +12 -0
- package/dist/src/shared/env.development.js.map +1 -0
- package/dist/src/shared/env.js +50 -0
- package/dist/src/shared/env.js.map +1 -0
- package/dist/src/shared/envs/local.js +12 -0
- package/dist/src/shared/envs/local.js.map +1 -0
- package/dist/src/shared/envs/production.js +12 -0
- package/dist/src/shared/envs/production.js.map +1 -0
- package/dist/src/shared/envs/sandbox.js +12 -0
- package/dist/src/shared/envs/sandbox.js.map +1 -0
- package/dist/src/shared/envs/staging.js +12 -0
- package/dist/src/shared/envs/staging.js.map +1 -0
- package/dist/src/shared/event-manager.js +24 -0
- package/dist/src/shared/event-manager.js.map +1 -0
- package/dist/src/shared/post-message-client.js +127 -0
- package/dist/src/shared/post-message-client.js.map +1 -0
- package/dist/src/shared/post-message-client.test.js +58 -0
- package/dist/src/shared/post-message-client.test.js.map +1 -0
- package/dist/src/shared/types.js +36 -0
- package/dist/src/shared/types.js.map +1 -0
- package/dist/src/shared/types.test.js +55 -0
- package/dist/src/shared/types.test.js.map +1 -0
- package/dist/src/shared/util.js +96 -0
- package/dist/src/shared/util.js.map +1 -0
- package/dist/src/shared/util.test.js +148 -0
- package/dist/src/shared/util.test.js.map +1 -0
- package/dist/src/validation/index.js +12 -0
- package/dist/src/validation/index.js.map +1 -0
- package/dist/src/validation/schemas/click-to-pay/load-params.json +34 -0
- package/dist/src/validation/schemas/click-to-pay/options.json +23 -0
- package/dist/src/validation/schemas/click-to-pay/payment-intent.json +42 -0
- package/dist/src/validation/schemas/customer.json +38 -0
- package/dist/src/validation/schemas/hpp-load-params.json +40 -0
- package/dist/src/validation/schemas/hpp-options.json +48 -0
- package/dist/src/validation/schemas/payment-intent.json +48 -0
- package/dist/src/validation/schemas/payment-method.json +83 -0
- package/dist/src/validation/schemas/verify-card-options.json +15 -0
- package/dist/src/validation/schemas/verify-card-params.json +24 -0
- package/dist/src/validation/validation-helper.js +10 -0
- package/dist/src/validation/validation-helper.js.map +1 -0
- package/dist/src/validation/validation-helper.test.js +34 -0
- package/dist/src/validation/validation-helper.test.js.map +1 -0
- package/dist/src/validation/validators/apple-pay-load-params-button-validator.js +19 -0
- package/dist/src/validation/validators/apple-pay-load-params-button-validator.js.map +1 -0
- package/dist/src/validation/validators/click-to-pay-load-params-validator.js +19 -0
- package/dist/src/validation/validators/click-to-pay-load-params-validator.js.map +1 -0
- package/dist/src/validation/validators/hpp-load-params-validator.js +21 -0
- package/dist/src/validation/validators/hpp-load-params-validator.js.map +1 -0
- package/dist/src/validation/validators/hpp-load-params-validator.test.js +56 -0
- package/dist/src/validation/validators/hpp-load-params-validator.test.js.map +1 -0
- package/dist/src/validation/validators/verify-card-params-validator.js +23 -0
- package/dist/src/validation/validators/verify-card-params-validator.js.map +1 -0
- package/dist/src/version.js +5 -0
- package/dist/src/version.js.map +1 -0
- package/dist/staging/fatzebra.css +91 -0
- package/dist/staging/fatzebra.js +19565 -0
- package/dist/staging/fatzebra.js.map +1 -0
- package/dist/staging/index.html +247 -0
- package/dist/tests/helpers/api-gateway-mock.js +37 -0
- package/dist/tests/helpers/api-gateway-mock.js.map +1 -0
- package/dist/validation/schemas/applepay/load-params.json +31 -0
- package/dist/validation/schemas/applepay/options.json +42 -0
- package/dist/validation/schemas/applepay/payment-intent.json +42 -0
- package/dist/validation/schemas/click-to-pay/options.json +30 -3
- package/dist/validation/validators/apple-pay-load-params-button-validator.d.ts +3 -0
- package/dist/validation/validators/apple-pay-load-params-button-validator.js +12 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +10 -4
- package/tsconfig.json +1 -0
package/dist/local/fatzebra.js
CHANGED
|
@@ -12135,6 +12135,490 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
12135
12135
|
})));
|
|
12136
12136
|
|
|
12137
12137
|
|
|
12138
|
+
/***/ }),
|
|
12139
|
+
|
|
12140
|
+
/***/ "./src/applepay/applepay.ts":
|
|
12141
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
12142
|
+
|
|
12143
|
+
"use strict";
|
|
12144
|
+
|
|
12145
|
+
var __assign = (this && this.__assign) || function () {
|
|
12146
|
+
__assign = Object.assign || function(t) {
|
|
12147
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
12148
|
+
s = arguments[i];
|
|
12149
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
12150
|
+
t[p] = s[p];
|
|
12151
|
+
}
|
|
12152
|
+
return t;
|
|
12153
|
+
};
|
|
12154
|
+
return __assign.apply(this, arguments);
|
|
12155
|
+
};
|
|
12156
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12157
|
+
if (k2 === undefined) k2 = k;
|
|
12158
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12159
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12160
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12161
|
+
}
|
|
12162
|
+
Object.defineProperty(o, k2, desc);
|
|
12163
|
+
}) : (function(o, m, k, k2) {
|
|
12164
|
+
if (k2 === undefined) k2 = k;
|
|
12165
|
+
o[k2] = m[k];
|
|
12166
|
+
}));
|
|
12167
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
12168
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
12169
|
+
}) : function(o, v) {
|
|
12170
|
+
o["default"] = v;
|
|
12171
|
+
});
|
|
12172
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
12173
|
+
if (mod && mod.__esModule) return mod;
|
|
12174
|
+
var result = {};
|
|
12175
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
12176
|
+
__setModuleDefault(result, mod);
|
|
12177
|
+
return result;
|
|
12178
|
+
};
|
|
12179
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12180
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12181
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
12182
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12183
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12184
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12185
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12186
|
+
});
|
|
12187
|
+
};
|
|
12188
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12189
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12190
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
12191
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
12192
|
+
function step(op) {
|
|
12193
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
12194
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
12195
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
12196
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
12197
|
+
switch (op[0]) {
|
|
12198
|
+
case 0: case 1: t = op; break;
|
|
12199
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
12200
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
12201
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
12202
|
+
default:
|
|
12203
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
12204
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
12205
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
12206
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
12207
|
+
if (t[2]) _.ops.pop();
|
|
12208
|
+
_.trys.pop(); continue;
|
|
12209
|
+
}
|
|
12210
|
+
op = body.call(thisArg, _);
|
|
12211
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
12212
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
12213
|
+
}
|
|
12214
|
+
};
|
|
12215
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12216
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12217
|
+
};
|
|
12218
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12219
|
+
exports.ApplePay = void 0;
|
|
12220
|
+
var apple_pay_client_1 = __webpack_require__("./src/applepay/clients/apple-pay-client.ts");
|
|
12221
|
+
var payNow = __importStar(__webpack_require__("./src/applepay/clients/paynow-client.ts"));
|
|
12222
|
+
var post_message_client_1 = __webpack_require__("./src/shared/post-message-client.ts");
|
|
12223
|
+
var FatZebra = __importStar(__webpack_require__("./src/shared/types.ts"));
|
|
12224
|
+
var env_1 = __importDefault(__webpack_require__("./src/shared/env.ts"));
|
|
12225
|
+
var event_manager_1 = __webpack_require__("./src/shared/event-manager.ts");
|
|
12226
|
+
var channel = 'applepay';
|
|
12227
|
+
var merchantSessionPath = '/v2/apple_pay/auth';
|
|
12228
|
+
var purchaseTokenPath = '/v2/apple_pay/token';
|
|
12229
|
+
var ApplePay = /** @class */ (function () {
|
|
12230
|
+
function ApplePay(config) {
|
|
12231
|
+
this.paymentIntent = config.paymentIntent;
|
|
12232
|
+
this.environment = config.environment;
|
|
12233
|
+
this.fzPayNowDomain = env_1.default[this.environment].payNowUrl;
|
|
12234
|
+
this.username = config.username;
|
|
12235
|
+
}
|
|
12236
|
+
ApplePay.prototype.load = function (config) {
|
|
12237
|
+
var _this = this;
|
|
12238
|
+
var _a;
|
|
12239
|
+
this.iframe = document.createElement('iframe');
|
|
12240
|
+
this.requestReactSDK = (_a = config === null || config === void 0 ? void 0 : config.options) === null || _a === void 0 ? void 0 : _a.react_sdk;
|
|
12241
|
+
document.getElementById(config.containerId).appendChild(this.iframe);
|
|
12242
|
+
var applePayUrl = this.getPayNowUrl(config.options);
|
|
12243
|
+
this.iframe.setAttribute("src", applePayUrl);
|
|
12244
|
+
this.iframe.setAttribute("height", '100%');
|
|
12245
|
+
this.iframe.setAttribute("width", '100%');
|
|
12246
|
+
this.postMessageClient = new post_message_client_1.PostMessageClient({
|
|
12247
|
+
channel: channel,
|
|
12248
|
+
target: this.iframe,
|
|
12249
|
+
environment: this.environment,
|
|
12250
|
+
});
|
|
12251
|
+
this.iframe.onload = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
12252
|
+
return __generator(this, function (_a) {
|
|
12253
|
+
switch (_a.label) {
|
|
12254
|
+
case 0: return [4 /*yield*/, this.initialize()];
|
|
12255
|
+
case 1:
|
|
12256
|
+
_a.sent();
|
|
12257
|
+
return [2 /*return*/];
|
|
12258
|
+
}
|
|
12259
|
+
});
|
|
12260
|
+
}); };
|
|
12261
|
+
};
|
|
12262
|
+
ApplePay.prototype.getPayNowUrl = function (options) {
|
|
12263
|
+
var _a = this.paymentIntent, payment = _a.payment, verification = _a.verification;
|
|
12264
|
+
var base = [
|
|
12265
|
+
this.fzPayNowDomain,
|
|
12266
|
+
'sdk',
|
|
12267
|
+
'apple_pay',
|
|
12268
|
+
this.username,
|
|
12269
|
+
payment.reference,
|
|
12270
|
+
payment.currency,
|
|
12271
|
+
payment.amount,
|
|
12272
|
+
verification
|
|
12273
|
+
].join('/');
|
|
12274
|
+
var query = new URLSearchParams();
|
|
12275
|
+
if (options === null || options === void 0 ? void 0 : options.allowed_card_networks) {
|
|
12276
|
+
query.append('allowed_card_networks', options.allowed_card_networks.toString());
|
|
12277
|
+
}
|
|
12278
|
+
if (options === null || options === void 0 ? void 0 : options.allowed_card_types) {
|
|
12279
|
+
query.append('allowed_card_types', options.allowed_card_types.toString());
|
|
12280
|
+
}
|
|
12281
|
+
query.append('domain_name', window.location.hostname);
|
|
12282
|
+
return "".concat(base, "?").concat(query.toString());
|
|
12283
|
+
};
|
|
12284
|
+
ApplePay.prototype.initialize = function () {
|
|
12285
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12286
|
+
return __generator(this, function (_a) {
|
|
12287
|
+
switch (_a.label) {
|
|
12288
|
+
case 0: return [4 /*yield*/, this.registerEventListener()];
|
|
12289
|
+
case 1:
|
|
12290
|
+
_a.sent();
|
|
12291
|
+
this.checkApplePayEligibility();
|
|
12292
|
+
this.notifyApplePayEligibility();
|
|
12293
|
+
return [2 /*return*/];
|
|
12294
|
+
}
|
|
12295
|
+
});
|
|
12296
|
+
});
|
|
12297
|
+
};
|
|
12298
|
+
ApplePay.prototype.checkApplePayEligibility = function () {
|
|
12299
|
+
if ((0, apple_pay_client_1.getEligibilty)()) {
|
|
12300
|
+
this.canMakePayments = true;
|
|
12301
|
+
}
|
|
12302
|
+
};
|
|
12303
|
+
ApplePay.prototype.notifyApplePayEligibility = function () {
|
|
12304
|
+
var message = {
|
|
12305
|
+
channel: channel,
|
|
12306
|
+
subject: 'eligibility',
|
|
12307
|
+
data: {
|
|
12308
|
+
canMakePayments: this.canMakePayments
|
|
12309
|
+
}
|
|
12310
|
+
};
|
|
12311
|
+
this.postMessageClient.send(message);
|
|
12312
|
+
};
|
|
12313
|
+
ApplePay.prototype.registerEventListener = function () {
|
|
12314
|
+
var _this = this;
|
|
12315
|
+
return new Promise(function (resolve, _) {
|
|
12316
|
+
_this.postMessageClient.setEventListeners({
|
|
12317
|
+
'paymentrequest': function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
12318
|
+
return __generator(this, function (_a) {
|
|
12319
|
+
switch (_a.label) {
|
|
12320
|
+
case 0: return [4 /*yield*/, this.purchase(data)];
|
|
12321
|
+
case 1:
|
|
12322
|
+
_a.sent();
|
|
12323
|
+
return [2 /*return*/];
|
|
12324
|
+
}
|
|
12325
|
+
});
|
|
12326
|
+
}); }
|
|
12327
|
+
});
|
|
12328
|
+
resolve();
|
|
12329
|
+
});
|
|
12330
|
+
};
|
|
12331
|
+
ApplePay.prototype.purchase = function (request) {
|
|
12332
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
12333
|
+
var applePayPaymentRequest, payNowPaymentAttributes, _a;
|
|
12334
|
+
var _this = this;
|
|
12335
|
+
return __generator(this, function (_b) {
|
|
12336
|
+
switch (_b.label) {
|
|
12337
|
+
case 0:
|
|
12338
|
+
applePayPaymentRequest = this.extractApplePaymentRequestParams(request);
|
|
12339
|
+
payNowPaymentAttributes = this.extractPayNowPaymentAttributes(request);
|
|
12340
|
+
_a = this;
|
|
12341
|
+
return [4 /*yield*/, (0, apple_pay_client_1.createSession)(applePayPaymentRequest)];
|
|
12342
|
+
case 1:
|
|
12343
|
+
_a.applePaySession = _b.sent();
|
|
12344
|
+
this.applePaySession.onvalidatemerchant = function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
12345
|
+
var merchantSession, e_1, payload;
|
|
12346
|
+
return __generator(this, function (_a) {
|
|
12347
|
+
switch (_a.label) {
|
|
12348
|
+
case 0:
|
|
12349
|
+
_a.trys.push([0, 2, , 3]);
|
|
12350
|
+
return [4 /*yield*/, payNow.getMerchantSession(event.validationURL, __assign(__assign({}, payNowPaymentAttributes), { merchant: this.username, domain_name: window.location.hostname, display_name: this.username }), "".concat(this.fzPayNowDomain).concat(merchantSessionPath))];
|
|
12351
|
+
case 1:
|
|
12352
|
+
merchantSession = _a.sent();
|
|
12353
|
+
return [3 /*break*/, 3];
|
|
12354
|
+
case 2:
|
|
12355
|
+
e_1 = _a.sent();
|
|
12356
|
+
payload = {
|
|
12357
|
+
data: 'Payment failed. Unable to establish session',
|
|
12358
|
+
errors: e_1,
|
|
12359
|
+
};
|
|
12360
|
+
(0, event_manager_1.emit)(FatZebra.PublicEvent.PAYMENT_ERROR, payload);
|
|
12361
|
+
return [2 /*return*/];
|
|
12362
|
+
case 3:
|
|
12363
|
+
this.applePaySession.completeMerchantValidation(merchantSession);
|
|
12364
|
+
return [2 /*return*/];
|
|
12365
|
+
}
|
|
12366
|
+
});
|
|
12367
|
+
}); };
|
|
12368
|
+
this.applePaySession.onpaymentauthorized = function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
12369
|
+
var result, payload, e_2, payload;
|
|
12370
|
+
return __generator(this, function (_a) {
|
|
12371
|
+
switch (_a.label) {
|
|
12372
|
+
case 0:
|
|
12373
|
+
_a.trys.push([0, 2, , 3]);
|
|
12374
|
+
return [4 /*yield*/, payNow.authorizePayment(__assign(__assign({}, payNowPaymentAttributes), { merchant: this.username, token: event.payment.token, domain_name: window.location.hostname, react_sdk: this.requestReactSDK }), "".concat(this.fzPayNowDomain).concat(purchaseTokenPath))];
|
|
12375
|
+
case 1:
|
|
12376
|
+
result = _a.sent();
|
|
12377
|
+
this.applePaySession.completePayment(window.ApplePaySession.STATUS_SUCCESS);
|
|
12378
|
+
payload = {
|
|
12379
|
+
message: 'Payment successful.',
|
|
12380
|
+
data: result,
|
|
12381
|
+
};
|
|
12382
|
+
(0, event_manager_1.emit)(FatZebra.PublicEvent.PAYMENT_SUCCESS, payload);
|
|
12383
|
+
return [3 /*break*/, 3];
|
|
12384
|
+
case 2:
|
|
12385
|
+
e_2 = _a.sent();
|
|
12386
|
+
this.applePaySession.completePayment(window.ApplePaySession.STATUS_FAILURE);
|
|
12387
|
+
payload = {
|
|
12388
|
+
data: 'Payment failed.',
|
|
12389
|
+
errors: ['Payment declined']
|
|
12390
|
+
};
|
|
12391
|
+
(0, event_manager_1.emit)(FatZebra.PublicEvent.PAYMENT_ERROR, payload);
|
|
12392
|
+
return [3 /*break*/, 3];
|
|
12393
|
+
case 3: return [2 /*return*/];
|
|
12394
|
+
}
|
|
12395
|
+
});
|
|
12396
|
+
}); };
|
|
12397
|
+
this.applePaySession.oncancel = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
12398
|
+
var payload;
|
|
12399
|
+
return __generator(this, function (_a) {
|
|
12400
|
+
payload = {
|
|
12401
|
+
data: 'Payment failed.',
|
|
12402
|
+
errors: ['User cancelled payment.'],
|
|
12403
|
+
};
|
|
12404
|
+
(0, event_manager_1.emit)(FatZebra.PublicEvent.PAYMENT_ERROR, payload);
|
|
12405
|
+
return [2 /*return*/];
|
|
12406
|
+
});
|
|
12407
|
+
}); };
|
|
12408
|
+
this.applePaySession.begin();
|
|
12409
|
+
return [2 /*return*/];
|
|
12410
|
+
}
|
|
12411
|
+
});
|
|
12412
|
+
});
|
|
12413
|
+
};
|
|
12414
|
+
ApplePay.prototype.extractApplePaymentRequestParams = function (payload) {
|
|
12415
|
+
var countryCode = payload.countryCode, currencyCode = payload.currencyCode, merchantCapabilities = payload.merchantCapabilities, supportedNetworks = payload.supportedNetworks, total = payload.total;
|
|
12416
|
+
return {
|
|
12417
|
+
countryCode: countryCode,
|
|
12418
|
+
currencyCode: currencyCode,
|
|
12419
|
+
merchantCapabilities: merchantCapabilities,
|
|
12420
|
+
supportedNetworks: supportedNetworks,
|
|
12421
|
+
total: total,
|
|
12422
|
+
};
|
|
12423
|
+
};
|
|
12424
|
+
ApplePay.prototype.extractPayNowPaymentAttributes = function (payload) {
|
|
12425
|
+
var paymentAttributes = payload.paymentAttributes;
|
|
12426
|
+
return paymentAttributes;
|
|
12427
|
+
};
|
|
12428
|
+
return ApplePay;
|
|
12429
|
+
}());
|
|
12430
|
+
exports.ApplePay = ApplePay;
|
|
12431
|
+
|
|
12432
|
+
|
|
12433
|
+
/***/ }),
|
|
12434
|
+
|
|
12435
|
+
/***/ "./src/applepay/clients/apple-pay-client.ts":
|
|
12436
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
12437
|
+
|
|
12438
|
+
"use strict";
|
|
12439
|
+
|
|
12440
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12441
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12442
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
12443
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12444
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12445
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12446
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12447
|
+
});
|
|
12448
|
+
};
|
|
12449
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12450
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12451
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
12452
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
12453
|
+
function step(op) {
|
|
12454
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
12455
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
12456
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
12457
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
12458
|
+
switch (op[0]) {
|
|
12459
|
+
case 0: case 1: t = op; break;
|
|
12460
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
12461
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
12462
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
12463
|
+
default:
|
|
12464
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
12465
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
12466
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
12467
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
12468
|
+
if (t[2]) _.ops.pop();
|
|
12469
|
+
_.trys.pop(); continue;
|
|
12470
|
+
}
|
|
12471
|
+
op = body.call(thisArg, _);
|
|
12472
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
12473
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
12474
|
+
}
|
|
12475
|
+
};
|
|
12476
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12477
|
+
exports.SupportedNetwork = exports.MerchantCapability = exports.getEligibilty = exports.createSession = void 0;
|
|
12478
|
+
// valid schemes
|
|
12479
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest/1916122-supportednetworks
|
|
12480
|
+
var SupportedNetwork;
|
|
12481
|
+
(function (SupportedNetwork) {
|
|
12482
|
+
SupportedNetwork["Amex"] = "amex";
|
|
12483
|
+
SupportedNetwork["ChinaUnionPay"] = "chinaUnionPay";
|
|
12484
|
+
SupportedNetwork["Discover"] = "discover";
|
|
12485
|
+
SupportedNetwork["JCB"] = "jcb";
|
|
12486
|
+
SupportedNetwork["Maestro"] = "maestro";
|
|
12487
|
+
SupportedNetwork["MasterCard"] = "masterCard";
|
|
12488
|
+
SupportedNetwork["Visa"] = "visa";
|
|
12489
|
+
})(SupportedNetwork || (exports.SupportedNetwork = SupportedNetwork = {}));
|
|
12490
|
+
var MerchantCapability;
|
|
12491
|
+
(function (MerchantCapability) {
|
|
12492
|
+
MerchantCapability["Supports3DS"] = "supports3DS";
|
|
12493
|
+
MerchantCapability["SupportsCredit"] = "supportsCredit";
|
|
12494
|
+
MerchantCapability["SupportsDebit"] = "supportsDebit";
|
|
12495
|
+
MerchantCapability["SupportsEMV"] = "supportsEMV";
|
|
12496
|
+
})(MerchantCapability || (exports.MerchantCapability = MerchantCapability = {}));
|
|
12497
|
+
var getEligibilty = function () {
|
|
12498
|
+
return window.ApplePaySession && window.ApplePaySession.canMakePayments();
|
|
12499
|
+
};
|
|
12500
|
+
exports.getEligibilty = getEligibilty;
|
|
12501
|
+
var createSession = function (payload) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12502
|
+
return __generator(this, function (_a) {
|
|
12503
|
+
switch (_a.label) {
|
|
12504
|
+
case 0: return [4 /*yield*/, new window.ApplePaySession(2, payload)];
|
|
12505
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
12506
|
+
}
|
|
12507
|
+
});
|
|
12508
|
+
}); };
|
|
12509
|
+
exports.createSession = createSession;
|
|
12510
|
+
|
|
12511
|
+
|
|
12512
|
+
/***/ }),
|
|
12513
|
+
|
|
12514
|
+
/***/ "./src/applepay/clients/paynow-client.ts":
|
|
12515
|
+
/***/ (function(__unused_webpack_module, exports) {
|
|
12516
|
+
|
|
12517
|
+
"use strict";
|
|
12518
|
+
|
|
12519
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12520
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12521
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
12522
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
12523
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12524
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12525
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12526
|
+
});
|
|
12527
|
+
};
|
|
12528
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12529
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12530
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
12531
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
12532
|
+
function step(op) {
|
|
12533
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
12534
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
12535
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
12536
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
12537
|
+
switch (op[0]) {
|
|
12538
|
+
case 0: case 1: t = op; break;
|
|
12539
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
12540
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
12541
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
12542
|
+
default:
|
|
12543
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
12544
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
12545
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
12546
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
12547
|
+
if (t[2]) _.ops.pop();
|
|
12548
|
+
_.trys.pop(); continue;
|
|
12549
|
+
}
|
|
12550
|
+
op = body.call(thisArg, _);
|
|
12551
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
12552
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
12553
|
+
}
|
|
12554
|
+
};
|
|
12555
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12556
|
+
exports.authorizePayment = exports.getMerchantSession = exports.objectToQueryString = void 0;
|
|
12557
|
+
var objectToQueryString = function (obj) {
|
|
12558
|
+
var queryString = [];
|
|
12559
|
+
for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) {
|
|
12560
|
+
var key = _a[_i];
|
|
12561
|
+
queryString.push("".concat(key, "=").concat(obj[key]));
|
|
12562
|
+
}
|
|
12563
|
+
return queryString.join("&");
|
|
12564
|
+
};
|
|
12565
|
+
exports.objectToQueryString = objectToQueryString;
|
|
12566
|
+
var getMerchantSession = function (validationUrl, paymentAttributes, baseUrl) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12567
|
+
var queryString;
|
|
12568
|
+
return __generator(this, function (_a) {
|
|
12569
|
+
queryString = "url=".concat(validationUrl, "&").concat((0, exports.objectToQueryString)(paymentAttributes));
|
|
12570
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
12571
|
+
var request = new XMLHttpRequest();
|
|
12572
|
+
request.onload = function () {
|
|
12573
|
+
if (request.status >= 200 && request.status < 300) {
|
|
12574
|
+
return resolve(JSON.parse(request.responseText));
|
|
12575
|
+
}
|
|
12576
|
+
else {
|
|
12577
|
+
return reject(new Error());
|
|
12578
|
+
}
|
|
12579
|
+
};
|
|
12580
|
+
request.onerror = reject;
|
|
12581
|
+
request.open('GET', "".concat(baseUrl, "?").concat(queryString));
|
|
12582
|
+
request.send();
|
|
12583
|
+
})];
|
|
12584
|
+
});
|
|
12585
|
+
}); };
|
|
12586
|
+
exports.getMerchantSession = getMerchantSession;
|
|
12587
|
+
var authorizePayment = function (payload, url) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12588
|
+
return __generator(this, function (_a) {
|
|
12589
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
12590
|
+
var request = new XMLHttpRequest();
|
|
12591
|
+
request.onload = function () {
|
|
12592
|
+
if (request.status >= 200 && request.status < 300) {
|
|
12593
|
+
return resolve(true);
|
|
12594
|
+
}
|
|
12595
|
+
else {
|
|
12596
|
+
return reject(new Error());
|
|
12597
|
+
}
|
|
12598
|
+
};
|
|
12599
|
+
request.onerror = reject;
|
|
12600
|
+
request.open('POST', url);
|
|
12601
|
+
request.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
|
|
12602
|
+
request.send(JSON.stringify(payload));
|
|
12603
|
+
})];
|
|
12604
|
+
});
|
|
12605
|
+
}); };
|
|
12606
|
+
exports.authorizePayment = authorizePayment;
|
|
12607
|
+
|
|
12608
|
+
|
|
12609
|
+
/***/ }),
|
|
12610
|
+
|
|
12611
|
+
/***/ "./src/applepay/index.ts":
|
|
12612
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12613
|
+
|
|
12614
|
+
"use strict";
|
|
12615
|
+
|
|
12616
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12617
|
+
exports.ApplePay = void 0;
|
|
12618
|
+
var applepay_1 = __webpack_require__("./src/applepay/applepay.ts");
|
|
12619
|
+
Object.defineProperty(exports, "ApplePay", ({ enumerable: true, get: function () { return applepay_1.ApplePay; } }));
|
|
12620
|
+
|
|
12621
|
+
|
|
12138
12622
|
/***/ }),
|
|
12139
12623
|
|
|
12140
12624
|
/***/ "./src/click_to_pay/index.ts":
|
|
@@ -12210,7 +12694,7 @@ var ClickToPay = /** @class */ (function () {
|
|
|
12210
12694
|
ClickToPay.prototype.getPayNowUrl = function (options) {
|
|
12211
12695
|
var payment = this.paymentIntent.payment;
|
|
12212
12696
|
var base = [
|
|
12213
|
-
"
|
|
12697
|
+
"https://paynow.test",
|
|
12214
12698
|
'v3',
|
|
12215
12699
|
'clicktopay',
|
|
12216
12700
|
this.username,
|
|
@@ -12262,6 +12746,12 @@ var ClickToPay = /** @class */ (function () {
|
|
|
12262
12746
|
data: data
|
|
12263
12747
|
});
|
|
12264
12748
|
};
|
|
12749
|
+
handlers[types_1.PublicEvent.CLICK_TO_PAY_RESIZE] = function (data) {
|
|
12750
|
+
(0, event_manager_1.emit)(types_1.PublicEvent.CLICK_TO_PAY_RESIZE, {
|
|
12751
|
+
message: 'Container resized.',
|
|
12752
|
+
data: data
|
|
12753
|
+
});
|
|
12754
|
+
};
|
|
12265
12755
|
this.postMessageClient.setEventListeners(handlers);
|
|
12266
12756
|
};
|
|
12267
12757
|
ClickToPay.prototype.purchase = function () {
|
|
@@ -12348,7 +12838,7 @@ var Hpp = /** @class */ (function () {
|
|
|
12348
12838
|
Hpp.prototype.load = function (config) {
|
|
12349
12839
|
var _this = this;
|
|
12350
12840
|
this.hppOptions = config.options;
|
|
12351
|
-
this.headless = bridge.load("
|
|
12841
|
+
this.headless = bridge.load("https://paynow.test/sdk/bridge");
|
|
12352
12842
|
this.iframe = document.createElement('iframe');
|
|
12353
12843
|
document.getElementById(config.containerId).appendChild(this.iframe);
|
|
12354
12844
|
this.headless.onload = function () {
|
|
@@ -12371,7 +12861,7 @@ var Hpp = /** @class */ (function () {
|
|
|
12371
12861
|
Hpp.prototype.getPayNowUrl = function (options) {
|
|
12372
12862
|
var payment = this.paymentIntent.payment;
|
|
12373
12863
|
var base = [
|
|
12374
|
-
"
|
|
12864
|
+
"https://paynow.test",
|
|
12375
12865
|
'sdk',
|
|
12376
12866
|
this.version == 3 ? 'v3' : null,
|
|
12377
12867
|
this.username,
|
|
@@ -12556,6 +13046,17 @@ if (typeof window !== "undefined" && FatZebra) {
|
|
|
12556
13046
|
|
|
12557
13047
|
"use strict";
|
|
12558
13048
|
|
|
13049
|
+
var __assign = (this && this.__assign) || function () {
|
|
13050
|
+
__assign = Object.assign || function(t) {
|
|
13051
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
13052
|
+
s = arguments[i];
|
|
13053
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
13054
|
+
t[p] = s[p];
|
|
13055
|
+
}
|
|
13056
|
+
return t;
|
|
13057
|
+
};
|
|
13058
|
+
return __assign.apply(this, arguments);
|
|
13059
|
+
};
|
|
12559
13060
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12560
13061
|
if (k2 === undefined) k2 = k;
|
|
12561
13062
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -12630,6 +13131,8 @@ var validation_1 = __webpack_require__("./src/validation/index.ts");
|
|
|
12630
13131
|
var api_gateway_client_1 = __importDefault(__webpack_require__("./src/shared/api-gateway-client.ts"));
|
|
12631
13132
|
var hpp_1 = __webpack_require__("./src/hpp/index.ts");
|
|
12632
13133
|
var click_to_pay_1 = __importDefault(__webpack_require__("./src/click_to_pay/index.ts"));
|
|
13134
|
+
var apple_pay_load_params_button_validator_1 = __webpack_require__("./src/validation/validators/apple-pay-load-params-button-validator.ts");
|
|
13135
|
+
var applepay_1 = __webpack_require__("./src/applepay/index.ts");
|
|
12633
13136
|
var FatZebra = /** @class */ (function () {
|
|
12634
13137
|
function FatZebra(config) {
|
|
12635
13138
|
this.fzConfig = config;
|
|
@@ -12695,7 +13198,7 @@ var FatZebra = /** @class */ (function () {
|
|
|
12695
13198
|
}
|
|
12696
13199
|
return [3 /*break*/, 4];
|
|
12697
13200
|
case 1:
|
|
12698
|
-
headless = bridge.load("
|
|
13201
|
+
headless = bridge.load("https://paynow.test/sdk/bridge");
|
|
12699
13202
|
card_1 = params.paymentMethod.data;
|
|
12700
13203
|
this.cardDidTokenize(headless, function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
12701
13204
|
var bin;
|
|
@@ -12751,6 +13254,26 @@ var FatZebra = /** @class */ (function () {
|
|
|
12751
13254
|
});
|
|
12752
13255
|
window.HPP.load(params);
|
|
12753
13256
|
};
|
|
13257
|
+
FatZebra.prototype.renderApplePayButton = function (params) {
|
|
13258
|
+
var valid = (0, apple_pay_load_params_button_validator_1.validateApplePayLoadParams)(params);
|
|
13259
|
+
if (!valid) {
|
|
13260
|
+
(0, event_manager_1.emit)(types_1.PublicEvent.VALIDATION_ERROR, {
|
|
13261
|
+
errors: (0, validation_1.toHumanizedErrors)(apple_pay_load_params_button_validator_1.validateApplePayLoadParams.errors),
|
|
13262
|
+
data: null
|
|
13263
|
+
});
|
|
13264
|
+
return;
|
|
13265
|
+
}
|
|
13266
|
+
window.ApplePayButton = new applepay_1.ApplePay({
|
|
13267
|
+
environment: params.environment,
|
|
13268
|
+
paymentIntent: params.paymentIntent,
|
|
13269
|
+
username: this.fzConfig.username
|
|
13270
|
+
});
|
|
13271
|
+
window.ApplePayButton.load({
|
|
13272
|
+
containerId: params.containerId,
|
|
13273
|
+
paymentIntent: params.paymentIntent,
|
|
13274
|
+
options: __assign(__assign({}, params.options), { react_sdk: false })
|
|
13275
|
+
});
|
|
13276
|
+
};
|
|
12754
13277
|
FatZebra.prototype.renderClickToPay = function (params) {
|
|
12755
13278
|
var valid = (0, validation_1.validateClickToPayLoadParams)(params);
|
|
12756
13279
|
if (!valid) {
|
|
@@ -14067,11 +14590,11 @@ exports["default"] = env;
|
|
|
14067
14590
|
|
|
14068
14591
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14069
14592
|
exports.songbirdUrl = exports.payNowUrl = exports.apiUrl = exports.bridgeUrl = void 0;
|
|
14070
|
-
var bridgeUrl = "
|
|
14593
|
+
var bridgeUrl = "https://paynow.test";
|
|
14071
14594
|
exports.bridgeUrl = bridgeUrl;
|
|
14072
|
-
var apiUrl = "
|
|
14595
|
+
var apiUrl = "https://api.test:3002/sdk";
|
|
14073
14596
|
exports.apiUrl = apiUrl;
|
|
14074
|
-
var payNowUrl = "
|
|
14597
|
+
var payNowUrl = "https://paynow.test";
|
|
14075
14598
|
exports.payNowUrl = payNowUrl;
|
|
14076
14599
|
var songbirdUrl = "https://songbirdstag.cardinalcommerce.com/edge/v1/songbird.js";
|
|
14077
14600
|
exports.songbirdUrl = songbirdUrl;
|
|
@@ -14237,7 +14760,7 @@ var env_1 = __importStar(__webpack_require__("./src/shared/env.ts"));
|
|
|
14237
14760
|
var PostMessageClient = /** @class */ (function () {
|
|
14238
14761
|
function PostMessageClient(config) {
|
|
14239
14762
|
this.channel = config.channel;
|
|
14240
|
-
this.fzEnv = "local";
|
|
14763
|
+
this.fzEnv = config.environment || "local";
|
|
14241
14764
|
this.domain = env_1.default[this.fzEnv].payNowUrl;
|
|
14242
14765
|
this.target = config.target;
|
|
14243
14766
|
}
|
|
@@ -14322,6 +14845,7 @@ var PublicEvent;
|
|
|
14322
14845
|
PublicEvent["BIN_LOOKUP"] = "fz.bin.lookup";
|
|
14323
14846
|
PublicEvent["CLICK_TO_PAY_TOKENIZATION_SUCCESS"] = "fz.click_to_pay.tokenization.success";
|
|
14324
14847
|
PublicEvent["CLICK_TO_PAY_TOKENIZATION_ERROR"] = "fz.click_to_pay.tokenization.error";
|
|
14848
|
+
PublicEvent["CLICK_TO_PAY_RESIZE"] = "fz.click_to_pay.resize";
|
|
14325
14849
|
})(PublicEvent || (exports.PublicEvent = PublicEvent = {}));
|
|
14326
14850
|
var BridgeEvent;
|
|
14327
14851
|
(function (BridgeEvent) {
|
|
@@ -14481,6 +15005,32 @@ var toHumanizedErrors = function (errors) {
|
|
|
14481
15005
|
exports.toHumanizedErrors = toHumanizedErrors;
|
|
14482
15006
|
|
|
14483
15007
|
|
|
15008
|
+
/***/ }),
|
|
15009
|
+
|
|
15010
|
+
/***/ "./src/validation/validators/apple-pay-load-params-button-validator.ts":
|
|
15011
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
15012
|
+
|
|
15013
|
+
"use strict";
|
|
15014
|
+
|
|
15015
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15016
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15017
|
+
};
|
|
15018
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
15019
|
+
exports.validateApplePayLoadParams = void 0;
|
|
15020
|
+
var ajv_1 = __importDefault(__webpack_require__("./node_modules/ajv/lib/ajv.js"));
|
|
15021
|
+
var payment_intent_json_1 = __importDefault(__webpack_require__("./src/validation/schemas/applepay/payment-intent.json"));
|
|
15022
|
+
var options_json_1 = __importDefault(__webpack_require__("./src/validation/schemas/applepay/options.json"));
|
|
15023
|
+
var load_params_json_1 = __importDefault(__webpack_require__("./src/validation/schemas/applepay/load-params.json"));
|
|
15024
|
+
var validator = new ajv_1.default({
|
|
15025
|
+
allErrors: true,
|
|
15026
|
+
jsonPointers: true,
|
|
15027
|
+
})
|
|
15028
|
+
.addSchema(payment_intent_json_1.default)
|
|
15029
|
+
.addSchema(options_json_1.default)
|
|
15030
|
+
.compile(load_params_json_1.default);
|
|
15031
|
+
exports.validateApplePayLoadParams = validator;
|
|
15032
|
+
|
|
15033
|
+
|
|
14484
15034
|
/***/ }),
|
|
14485
15035
|
|
|
14486
15036
|
/***/ "./src/validation/validators/click-to-pay-load-params-validator.ts":
|
|
@@ -14574,7 +15124,7 @@ exports.validateVerifyCardParams = validator;
|
|
|
14574
15124
|
|
|
14575
15125
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14576
15126
|
exports.version = void 0;
|
|
14577
|
-
exports.version = '1.5.
|
|
15127
|
+
exports.version = '1.5.4';
|
|
14578
15128
|
|
|
14579
15129
|
|
|
14580
15130
|
/***/ }),
|
|
@@ -17840,6 +18390,30 @@ module.exports = JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#
|
|
|
17840
18390
|
|
|
17841
18391
|
/***/ }),
|
|
17842
18392
|
|
|
18393
|
+
/***/ "./src/validation/schemas/applepay/load-params.json":
|
|
18394
|
+
/***/ ((module) => {
|
|
18395
|
+
|
|
18396
|
+
"use strict";
|
|
18397
|
+
module.exports = JSON.parse('{"$id":"https://www.fatzebra.com/schemas/applepay/load-params.json","type":"object","additionalProperties":false,"required":["containerId","paymentIntent"],"properties":{"containerId":{"type":"string"},"environment":{"type":"string","enum":["local","test","development","staging","sandbox","production"]},"paymentIntent":{"$ref":"payment-intent.json#/definitions/PaymentIntent"},"options":{"$ref":"options.json#/definitions/Options"}}}');
|
|
18398
|
+
|
|
18399
|
+
/***/ }),
|
|
18400
|
+
|
|
18401
|
+
/***/ "./src/validation/schemas/applepay/options.json":
|
|
18402
|
+
/***/ ((module) => {
|
|
18403
|
+
|
|
18404
|
+
"use strict";
|
|
18405
|
+
module.exports = JSON.parse('{"$id":"https://www.fatzebra.com/schemas/applepay/options.json","type":"object","definitions":{"Options":{"type":"object","properties":{"allowed_card_networks":{"type":"array","items":{"type":"string","enum":["amex","chinaUnionPay","discover","jcb","maestro","masterCard","visa"]}},"allowed_card_types":{"type":"array","items":{"type":"string","enum":["supports3DS","supportsCredit","supportsDebit","supportsEMV"]}},"react_sdk":{"type":"boolean"}},"additionalProperties":false}}}');
|
|
18406
|
+
|
|
18407
|
+
/***/ }),
|
|
18408
|
+
|
|
18409
|
+
/***/ "./src/validation/schemas/applepay/payment-intent.json":
|
|
18410
|
+
/***/ ((module) => {
|
|
18411
|
+
|
|
18412
|
+
"use strict";
|
|
18413
|
+
module.exports = JSON.parse('{"$id":"https://www.fatzebra.com/schemas/applepay/payment-intent.json","type":"object","additionalProperties":false,"definitions":{"PaymentIntent":{"type":"object","additionalProperties":false,"properties":{"payment":{"type":"object","additionalProperties":false,"required":["amount","currency","reference"],"properties":{"amount":{"type":"number","minimum":0},"currency":{"type":"string"},"reference":{"type":"string"}}},"verification":{"type":"string","minLength":5}},"required":["payment","verification"]}}}');
|
|
18414
|
+
|
|
18415
|
+
/***/ }),
|
|
18416
|
+
|
|
17843
18417
|
/***/ "./src/validation/schemas/click-to-pay/load-params.json":
|
|
17844
18418
|
/***/ ((module) => {
|
|
17845
18419
|
|
|
@@ -17852,7 +18426,7 @@ module.exports = JSON.parse('{"$id":"https://www.fatzebra.com/schemas/click-to-p
|
|
|
17852
18426
|
/***/ ((module) => {
|
|
17853
18427
|
|
|
17854
18428
|
"use strict";
|
|
17855
|
-
module.exports = JSON.parse('{"$id":"https://www.fatzebra.com/schemas/click-to-pay/options.json","type":"object","definitions":{"Options":{"type":"object","properties":{"
|
|
18429
|
+
module.exports = JSON.parse('{"$id":"https://www.fatzebra.com/schemas/click-to-pay/options.json","type":"object","definitions":{"Options":{"type":"object","properties":{"auth":{"type":"boolean"},"cardListButtonText":{"type":"string"},"css":{"type":"string"},"cssSignature":{"type":"string"},"hideConfirmButton":{"type":"boolean"},"hideManualEntryLink":{"type":"boolean"},"returnPath":{"type":"string"},"returnTarget":{"type":"string"},"saveCard":{"type":"boolean"},"submitPaymentButtonText":{"type":"string"},"tokenizeOnly":{"type":"boolean"}}}}}');
|
|
17856
18430
|
|
|
17857
18431
|
/***/ }),
|
|
17858
18432
|
|
|
@@ -17981,7 +18555,7 @@ module.exports = JSON.parse('{"$id":"https://www.fatzebra.com/schemas/hpp-load-p
|
|
|
17981
18555
|
/******/
|
|
17982
18556
|
/******/ /* webpack/runtime/getFullHash */
|
|
17983
18557
|
/******/ (() => {
|
|
17984
|
-
/******/ __webpack_require__.h = () => ("
|
|
18558
|
+
/******/ __webpack_require__.h = () => ("eb7ad4c4b31b4cbb2abd")
|
|
17985
18559
|
/******/ })();
|
|
17986
18560
|
/******/
|
|
17987
18561
|
/******/ /* webpack/runtime/global */
|