@fat-zebra/sdk 1.5.0 → 1.5.2
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/.jest/setup-env-vars.js +1 -0
- package/README.dev.md +33 -0
- package/README.md +4 -1
- package/dist/click_to_pay/index.d.ts +4 -1
- package/dist/click_to_pay/index.js +13 -12
- package/dist/hpp/hpp.js +2 -0
- package/dist/local/fatzebra.css +91 -0
- package/dist/local/fatzebra.js +10771 -10047
- package/dist/local/fatzebra.js.map +1 -1
- 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/useFatZebra.js +1 -1
- package/dist/shared/util.d.ts +1 -1
- package/dist/shared/util.js +2 -2
- package/dist/staging/fatzebra.js +67 -615
- package/dist/staging/fatzebra.js.map +1 -1
- package/dist/validation/schemas/click-to-pay/payment-intent.json +1 -1
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -0
- package/package.json +7 -6
- package/scripts/release-package.js +113 -0
- package/CHANGELOG.md +0 -13
package/dist/staging/fatzebra.js
CHANGED
|
@@ -14145,23 +14145,35 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
14145
14145
|
return result;
|
|
14146
14146
|
};
|
|
14147
14147
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14148
|
+
exports.CLICK_TO_PAY_DEFAULT_OPTIONS = void 0;
|
|
14149
|
+
var post_message_client_1 = __webpack_require__("./src/shared/post-message-client.ts");
|
|
14148
14150
|
var types_1 = __webpack_require__("./src/shared/types.ts");
|
|
14149
14151
|
var util = __importStar(__webpack_require__("./src/shared/util.ts"));
|
|
14150
|
-
var
|
|
14152
|
+
var event_manager_1 = __webpack_require__("./src/shared/event-manager.ts");
|
|
14153
|
+
exports.CLICK_TO_PAY_DEFAULT_OPTIONS = {
|
|
14151
14154
|
iframe: true,
|
|
14155
|
+
postmessage: true,
|
|
14152
14156
|
};
|
|
14153
14157
|
var ClickToPay = /** @class */ (function () {
|
|
14154
14158
|
function ClickToPay(config) {
|
|
14155
14159
|
this.paymentIntent = config.paymentIntent;
|
|
14156
14160
|
this.username = config.username;
|
|
14157
14161
|
this.test = config.test;
|
|
14162
|
+
this.postMessageClient = new post_message_client_1.PostMessageClient({
|
|
14163
|
+
channel: 'click_to_pay',
|
|
14164
|
+
target: this.iframe
|
|
14165
|
+
});
|
|
14158
14166
|
}
|
|
14159
14167
|
ClickToPay.prototype.load = function (config) {
|
|
14168
|
+
var _this = this;
|
|
14160
14169
|
this.options = config.options;
|
|
14161
14170
|
this.iframe = document.createElement('iframe');
|
|
14162
14171
|
document.getElementById(config.containerId).appendChild(this.iframe);
|
|
14163
14172
|
var payNowUrl = this.getPayNowUrl(config.options);
|
|
14164
14173
|
this.iframe.setAttribute("src", payNowUrl);
|
|
14174
|
+
this.iframe.onload = function () {
|
|
14175
|
+
_this.setCrossFramesEventListeners();
|
|
14176
|
+
};
|
|
14165
14177
|
};
|
|
14166
14178
|
ClickToPay.prototype.getPayNowUrl = function (options) {
|
|
14167
14179
|
var payment = this.paymentIntent.payment;
|
|
@@ -14172,18 +14184,53 @@ var ClickToPay = /** @class */ (function () {
|
|
|
14172
14184
|
this.username,
|
|
14173
14185
|
payment.reference,
|
|
14174
14186
|
payment.currency,
|
|
14175
|
-
|
|
14187
|
+
// If amount is left as 0 (type: Number), it will be filtered out later
|
|
14188
|
+
// So we convert to string as "0" will be allowed through the filter
|
|
14189
|
+
// Yes, we do want $0 purchases (especially for tokenizeOnly / auth flows)
|
|
14190
|
+
payment.amount.toString(),
|
|
14176
14191
|
this.paymentIntent.verification
|
|
14177
14192
|
].filter(function (part) { return part; }).join('/');
|
|
14178
|
-
var
|
|
14179
|
-
|
|
14180
|
-
|
|
14181
|
-
|
|
14182
|
-
|
|
14183
|
-
}
|
|
14184
|
-
}
|
|
14185
|
-
|
|
14186
|
-
|
|
14193
|
+
var searchParams = new URLSearchParams();
|
|
14194
|
+
var combinedOptions = __assign(__assign({}, exports.CLICK_TO_PAY_DEFAULT_OPTIONS), options);
|
|
14195
|
+
Object.keys(combinedOptions).map(function (key) {
|
|
14196
|
+
if (combinedOptions[key] !== null && combinedOptions[key] !== undefined) {
|
|
14197
|
+
searchParams.append(util.toSnakeCase(key), combinedOptions[key]);
|
|
14198
|
+
}
|
|
14199
|
+
});
|
|
14200
|
+
return searchParams.toString().length > 0 ? "".concat(base, "?").concat(searchParams.toString()) : "".concat(base);
|
|
14201
|
+
};
|
|
14202
|
+
ClickToPay.prototype.setCrossFramesEventListeners = function () {
|
|
14203
|
+
var handlers = {};
|
|
14204
|
+
handlers[types_1.BridgeEvent.TOKENIZE_CARD_RESPONSE] = function (data) {
|
|
14205
|
+
if (data.errors) {
|
|
14206
|
+
(0, event_manager_1.emit)(types_1.PublicEvent.TOKENIZATION_ERROR, {
|
|
14207
|
+
message: 'Card tokenization failed.',
|
|
14208
|
+
errors: data.errors,
|
|
14209
|
+
data: null,
|
|
14210
|
+
});
|
|
14211
|
+
return;
|
|
14212
|
+
}
|
|
14213
|
+
else {
|
|
14214
|
+
(0, event_manager_1.emit)(types_1.PublicEvent.TOKENIZATION_SUCCESS, {
|
|
14215
|
+
message: 'Card tokenization success.',
|
|
14216
|
+
data: data
|
|
14217
|
+
});
|
|
14218
|
+
}
|
|
14219
|
+
};
|
|
14220
|
+
handlers[types_1.PublicEvent.CLICK_TO_PAY_TOKENIZATION_ERROR] = function (data) {
|
|
14221
|
+
(0, event_manager_1.emit)(types_1.PublicEvent.CLICK_TO_PAY_TOKENIZATION_ERROR, {
|
|
14222
|
+
message: 'Card tokenization failed.',
|
|
14223
|
+
errors: data.errors,
|
|
14224
|
+
data: null,
|
|
14225
|
+
});
|
|
14226
|
+
};
|
|
14227
|
+
handlers[types_1.PublicEvent.CLICK_TO_PAY_TOKENIZATION_SUCCESS] = function (data) {
|
|
14228
|
+
(0, event_manager_1.emit)(types_1.PublicEvent.CLICK_TO_PAY_TOKENIZATION_SUCCESS, {
|
|
14229
|
+
message: 'Card tokenization success.',
|
|
14230
|
+
data: data
|
|
14231
|
+
});
|
|
14232
|
+
};
|
|
14233
|
+
this.postMessageClient.setEventListeners(handlers);
|
|
14187
14234
|
};
|
|
14188
14235
|
ClickToPay.prototype.purchase = function () {
|
|
14189
14236
|
var message = {
|
|
@@ -14401,6 +14448,8 @@ var Hpp = /** @class */ (function () {
|
|
|
14401
14448
|
Hpp.prototype.setPublicEventListeners = function () {
|
|
14402
14449
|
var _this = this;
|
|
14403
14450
|
var handler = function (event) {
|
|
14451
|
+
if (_this.hppOptions.tokenizeOnly)
|
|
14452
|
+
return;
|
|
14404
14453
|
var threedsData = event.detail.data;
|
|
14405
14454
|
var extra = util.toObjectWithSnakeCaseKeys(threedsData);
|
|
14406
14455
|
_this.createPurchase(extra);
|
|
@@ -14547,7 +14596,6 @@ var bridge = __importStar(__webpack_require__("./src/shared/bridge-client.ts"));
|
|
|
14547
14596
|
var validation_1 = __webpack_require__("./src/validation/index.ts");
|
|
14548
14597
|
var api_gateway_client_1 = __importDefault(__webpack_require__("./src/shared/api-gateway-client.ts"));
|
|
14549
14598
|
var hpp_1 = __webpack_require__("./src/hpp/index.ts");
|
|
14550
|
-
var paypal_checkout_1 = __webpack_require__("./src/paypal/paypal-checkout.ts");
|
|
14551
14599
|
var click_to_pay_1 = __importDefault(__webpack_require__("./src/click_to_pay/index.ts"));
|
|
14552
14600
|
var FatZebra = /** @class */ (function () {
|
|
14553
14601
|
function FatZebra(config) {
|
|
@@ -14689,24 +14737,6 @@ var FatZebra = /** @class */ (function () {
|
|
|
14689
14737
|
FatZebra.prototype.checkout = function () {
|
|
14690
14738
|
window.HPP.purchase();
|
|
14691
14739
|
};
|
|
14692
|
-
FatZebra.prototype.setupPayPal = function (config) {
|
|
14693
|
-
var paypalCheckout = new paypal_checkout_1.PayPalCheckout({
|
|
14694
|
-
currency: config.currency,
|
|
14695
|
-
payment: config.payment,
|
|
14696
|
-
containerId: config.containerId,
|
|
14697
|
-
style: config.style
|
|
14698
|
-
});
|
|
14699
|
-
paypalCheckout.load()
|
|
14700
|
-
.then(function () {
|
|
14701
|
-
paypalCheckout.render();
|
|
14702
|
-
})
|
|
14703
|
-
.catch(function (error) {
|
|
14704
|
-
(0, event_manager_1.emit)(types_1.PublicEvent.PAYPAL_ERROR, {
|
|
14705
|
-
errors: [error].flat(),
|
|
14706
|
-
data: null
|
|
14707
|
-
});
|
|
14708
|
-
});
|
|
14709
|
-
};
|
|
14710
14740
|
FatZebra.prototype.on = function (event, callback) {
|
|
14711
14741
|
(0, event_manager_1.on)(event, callback);
|
|
14712
14742
|
};
|
|
@@ -14722,538 +14752,6 @@ exports.FatZebra = FatZebra;
|
|
|
14722
14752
|
exports["default"] = FatZebra;
|
|
14723
14753
|
|
|
14724
14754
|
|
|
14725
|
-
/***/ }),
|
|
14726
|
-
|
|
14727
|
-
/***/ "./src/paypal/paypal-button.ts":
|
|
14728
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
14729
|
-
|
|
14730
|
-
"use strict";
|
|
14731
|
-
|
|
14732
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14733
|
-
if (k2 === undefined) k2 = k;
|
|
14734
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14735
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14736
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14737
|
-
}
|
|
14738
|
-
Object.defineProperty(o, k2, desc);
|
|
14739
|
-
}) : (function(o, m, k, k2) {
|
|
14740
|
-
if (k2 === undefined) k2 = k;
|
|
14741
|
-
o[k2] = m[k];
|
|
14742
|
-
}));
|
|
14743
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14744
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14745
|
-
}) : function(o, v) {
|
|
14746
|
-
o["default"] = v;
|
|
14747
|
-
});
|
|
14748
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
14749
|
-
if (mod && mod.__esModule) return mod;
|
|
14750
|
-
var result = {};
|
|
14751
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
14752
|
-
__setModuleDefault(result, mod);
|
|
14753
|
-
return result;
|
|
14754
|
-
};
|
|
14755
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14756
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14757
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14758
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
14759
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
14760
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14761
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14762
|
-
});
|
|
14763
|
-
};
|
|
14764
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
14765
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
14766
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14767
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14768
|
-
function step(op) {
|
|
14769
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
14770
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
14771
|
-
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;
|
|
14772
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
14773
|
-
switch (op[0]) {
|
|
14774
|
-
case 0: case 1: t = op; break;
|
|
14775
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
14776
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
14777
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
14778
|
-
default:
|
|
14779
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
14780
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
14781
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
14782
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
14783
|
-
if (t[2]) _.ops.pop();
|
|
14784
|
-
_.trys.pop(); continue;
|
|
14785
|
-
}
|
|
14786
|
-
op = body.call(thisArg, _);
|
|
14787
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
14788
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
14789
|
-
}
|
|
14790
|
-
};
|
|
14791
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14792
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14793
|
-
};
|
|
14794
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14795
|
-
exports.PayPalButton = void 0;
|
|
14796
|
-
var event_manager_1 = __webpack_require__("./src/shared/event-manager.ts");
|
|
14797
|
-
var types_1 = __webpack_require__("./src/paypal/types.ts");
|
|
14798
|
-
var api_gateway_client_1 = __importDefault(__webpack_require__("./src/shared/api-gateway-client.ts"));
|
|
14799
|
-
var types_2 = __webpack_require__("./src/shared/types.ts");
|
|
14800
|
-
var util = __importStar(__webpack_require__("./src/shared/util.ts"));
|
|
14801
|
-
var constants_1 = __webpack_require__("./src/shared/constants.ts");
|
|
14802
|
-
var defaultStyle = {
|
|
14803
|
-
layout: 'horizontal',
|
|
14804
|
-
color: 'gold',
|
|
14805
|
-
shape: 'pill',
|
|
14806
|
-
label: 'paypal',
|
|
14807
|
-
};
|
|
14808
|
-
var PayPalButton = /** @class */ (function () {
|
|
14809
|
-
function PayPalButton(paymentMethod, paymentIntent, billingAgreement, buttonStyle) {
|
|
14810
|
-
this.paymentMethod = paymentMethod;
|
|
14811
|
-
this.paymentIntent = paymentIntent;
|
|
14812
|
-
this.billingAgreement = billingAgreement;
|
|
14813
|
-
this.buttonStyle = buttonStyle;
|
|
14814
|
-
this.client = new api_gateway_client_1.default({ accessToken: window.localStorage.getItem(constants_1.LocalStorageAccessTokenKey),
|
|
14815
|
-
username: window.MerchantUsername,
|
|
14816
|
-
});
|
|
14817
|
-
this.createButton();
|
|
14818
|
-
}
|
|
14819
|
-
Object.defineProperty(PayPalButton.prototype, "paypalButtons", {
|
|
14820
|
-
get: function () {
|
|
14821
|
-
return this._paypalButtons;
|
|
14822
|
-
},
|
|
14823
|
-
enumerable: false,
|
|
14824
|
-
configurable: true
|
|
14825
|
-
});
|
|
14826
|
-
Object.defineProperty(PayPalButton.prototype, "paypalActions", {
|
|
14827
|
-
get: function () {
|
|
14828
|
-
return this.actions;
|
|
14829
|
-
},
|
|
14830
|
-
enumerable: false,
|
|
14831
|
-
configurable: true
|
|
14832
|
-
});
|
|
14833
|
-
PayPalButton.prototype.render = function (containerId) {
|
|
14834
|
-
var container = this.getContainer(containerId);
|
|
14835
|
-
if (typeof (container) != 'undefined' && container != null) {
|
|
14836
|
-
this._paypalButtons.render('#' + container.id);
|
|
14837
|
-
}
|
|
14838
|
-
else {
|
|
14839
|
-
(0, event_manager_1.emit)(types_2.PublicEvent.PAYPAL_ERROR, {
|
|
14840
|
-
errors: ["Container with id #".concat(containerId, " does not exist.")],
|
|
14841
|
-
data: null
|
|
14842
|
-
});
|
|
14843
|
-
}
|
|
14844
|
-
};
|
|
14845
|
-
PayPalButton.prototype.getContainer = function (containerId) {
|
|
14846
|
-
return document.getElementById(containerId);
|
|
14847
|
-
};
|
|
14848
|
-
PayPalButton.prototype.createButton = function () {
|
|
14849
|
-
var _this = this;
|
|
14850
|
-
var button = ({});
|
|
14851
|
-
button.style = (this.buttonStyle ? this.buttonStyle : defaultStyle);
|
|
14852
|
-
if (this.billingAgreement === true) {
|
|
14853
|
-
button.createBillingAgreement = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
14854
|
-
return __generator(this, function (_a) {
|
|
14855
|
-
return [2 /*return*/, this.createBillingAgreement()];
|
|
14856
|
-
});
|
|
14857
|
-
}); };
|
|
14858
|
-
button.onApprove = function (data, actions) { return __awaiter(_this, void 0, void 0, function () {
|
|
14859
|
-
return __generator(this, function (_a) {
|
|
14860
|
-
(0, event_manager_1.emit)(types_2.PublicEvent.PAYPAL_PROCESSESING, { data: {}, message: 'The request is being processed.' });
|
|
14861
|
-
return [2 /*return*/, this.approveBillingAgreement(data)];
|
|
14862
|
-
});
|
|
14863
|
-
}); };
|
|
14864
|
-
button.onCancel = function (data, actions) {
|
|
14865
|
-
(0, event_manager_1.emit)(types_2.PublicEvent.PAYPAL_CANCEL, { data: { id: data.orderID }, message: 'PayPal Billing Agreement cancelled.' });
|
|
14866
|
-
};
|
|
14867
|
-
}
|
|
14868
|
-
else {
|
|
14869
|
-
button.createOrder = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
14870
|
-
return __generator(this, function (_a) {
|
|
14871
|
-
return [2 /*return*/, this.createOrder()];
|
|
14872
|
-
});
|
|
14873
|
-
}); };
|
|
14874
|
-
button.onApprove = function (data, actions) { return __awaiter(_this, void 0, void 0, function () {
|
|
14875
|
-
return __generator(this, function (_a) {
|
|
14876
|
-
(0, event_manager_1.emit)(types_2.PublicEvent.PAYPAL_PROCESSESING, { data: {}, message: 'The request is being processed.' });
|
|
14877
|
-
return [2 /*return*/, this.approveOrder(data)];
|
|
14878
|
-
});
|
|
14879
|
-
}); };
|
|
14880
|
-
button.onCancel = function (data, actions) {
|
|
14881
|
-
(0, event_manager_1.emit)(types_2.PublicEvent.PAYPAL_CANCEL, { data: { id: data.orderID }, message: 'PayPal Order cancelled.' });
|
|
14882
|
-
};
|
|
14883
|
-
}
|
|
14884
|
-
button.onError = function (error) {
|
|
14885
|
-
// This flag is used to prevent emitting general error from PayPal
|
|
14886
|
-
// if an error has already been raised and emitted.
|
|
14887
|
-
if (_this.validationErrorRaised === false) {
|
|
14888
|
-
(0, event_manager_1.emit)(types_2.PublicEvent.PAYPAL_ERROR, {
|
|
14889
|
-
errors: ['PayPal Checkout failed.'],
|
|
14890
|
-
data: null
|
|
14891
|
-
});
|
|
14892
|
-
}
|
|
14893
|
-
};
|
|
14894
|
-
this._paypalButtons = window.paypal.Buttons(button);
|
|
14895
|
-
};
|
|
14896
|
-
PayPalButton.prototype.createOrder = function () {
|
|
14897
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14898
|
-
var payload, response, error_1;
|
|
14899
|
-
return __generator(this, function (_a) {
|
|
14900
|
-
switch (_a.label) {
|
|
14901
|
-
case 0:
|
|
14902
|
-
_a.trys.push([0, 2, , 3]);
|
|
14903
|
-
this.validationErrorRaised = false;
|
|
14904
|
-
payload = util.toObjectWithSnakeCaseKeys(this.paymentMethod);
|
|
14905
|
-
payload.payment_intent = this.paymentIntent;
|
|
14906
|
-
return [4 /*yield*/, this.client.createPayPalOrder({
|
|
14907
|
-
order: payload
|
|
14908
|
-
})];
|
|
14909
|
-
case 1:
|
|
14910
|
-
response = (_a.sent()).data;
|
|
14911
|
-
return [2 /*return*/, response.id];
|
|
14912
|
-
case 2:
|
|
14913
|
-
error_1 = _a.sent();
|
|
14914
|
-
this.validationErrorRaised = true;
|
|
14915
|
-
(0, event_manager_1.emit)(types_2.PublicEvent.PAYPAL_ERROR, {
|
|
14916
|
-
errors: this.formatError(error_1),
|
|
14917
|
-
data: null
|
|
14918
|
-
});
|
|
14919
|
-
return [2 /*return*/, null];
|
|
14920
|
-
case 3: return [2 /*return*/];
|
|
14921
|
-
}
|
|
14922
|
-
});
|
|
14923
|
-
});
|
|
14924
|
-
};
|
|
14925
|
-
PayPalButton.prototype.approveOrder = function (data) {
|
|
14926
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14927
|
-
var response, error_2;
|
|
14928
|
-
return __generator(this, function (_a) {
|
|
14929
|
-
switch (_a.label) {
|
|
14930
|
-
case 0:
|
|
14931
|
-
_a.trys.push([0, 5, , 6]);
|
|
14932
|
-
this.validationErrorRaised = false;
|
|
14933
|
-
response = undefined;
|
|
14934
|
-
if (!(this.paymentMethod.intent.toUpperCase() === types_1.PayPalIntent.CAPTURE)) return [3 /*break*/, 2];
|
|
14935
|
-
return [4 /*yield*/, this.client.capturePayPalOrder({
|
|
14936
|
-
id: data.orderID
|
|
14937
|
-
})];
|
|
14938
|
-
case 1:
|
|
14939
|
-
response = (_a.sent()).data;
|
|
14940
|
-
return [3 /*break*/, 4];
|
|
14941
|
-
case 2:
|
|
14942
|
-
if (!(this.paymentMethod.intent.toUpperCase() === types_1.PayPalIntent.AUTHORIZE)) return [3 /*break*/, 4];
|
|
14943
|
-
return [4 /*yield*/, this.client.authorizePayPalOrder({
|
|
14944
|
-
id: data.orderID
|
|
14945
|
-
})];
|
|
14946
|
-
case 3:
|
|
14947
|
-
response = (_a.sent()).data;
|
|
14948
|
-
_a.label = 4;
|
|
14949
|
-
case 4:
|
|
14950
|
-
(0, event_manager_1.emit)(types_2.PublicEvent.PAYPAL_SUCCESS, {
|
|
14951
|
-
data: util.toObjectWithCamelCaseKeys(response),
|
|
14952
|
-
message: 'PayPal order approved.'
|
|
14953
|
-
});
|
|
14954
|
-
return [2 /*return*/];
|
|
14955
|
-
case 5:
|
|
14956
|
-
error_2 = _a.sent();
|
|
14957
|
-
this.validationErrorRaised = true;
|
|
14958
|
-
(0, event_manager_1.emit)(types_2.PublicEvent.PAYPAL_ERROR, {
|
|
14959
|
-
errors: this.formatError(error_2),
|
|
14960
|
-
data: null
|
|
14961
|
-
});
|
|
14962
|
-
return [2 /*return*/];
|
|
14963
|
-
case 6: return [2 /*return*/];
|
|
14964
|
-
}
|
|
14965
|
-
});
|
|
14966
|
-
});
|
|
14967
|
-
};
|
|
14968
|
-
PayPalButton.prototype.createBillingAgreement = function () {
|
|
14969
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14970
|
-
var payload, response, error_3;
|
|
14971
|
-
return __generator(this, function (_a) {
|
|
14972
|
-
switch (_a.label) {
|
|
14973
|
-
case 0:
|
|
14974
|
-
_a.trys.push([0, 2, , 3]);
|
|
14975
|
-
this.validationErrorRaised = false;
|
|
14976
|
-
payload = util.toObjectWithSnakeCaseKeys(this.paymentMethod);
|
|
14977
|
-
delete payload.billing_agreement;
|
|
14978
|
-
return [4 /*yield*/, this.client.createPayPalBillingAgreement({
|
|
14979
|
-
billing: payload
|
|
14980
|
-
})];
|
|
14981
|
-
case 1:
|
|
14982
|
-
response = (_a.sent()).data;
|
|
14983
|
-
return [2 /*return*/, response.token_id];
|
|
14984
|
-
case 2:
|
|
14985
|
-
error_3 = _a.sent();
|
|
14986
|
-
this.validationErrorRaised = true;
|
|
14987
|
-
(0, event_manager_1.emit)(types_2.PublicEvent.PAYPAL_ERROR, {
|
|
14988
|
-
errors: this.formatError(error_3),
|
|
14989
|
-
data: null
|
|
14990
|
-
});
|
|
14991
|
-
return [2 /*return*/];
|
|
14992
|
-
case 3: return [2 /*return*/];
|
|
14993
|
-
}
|
|
14994
|
-
});
|
|
14995
|
-
});
|
|
14996
|
-
};
|
|
14997
|
-
PayPalButton.prototype.approveBillingAgreement = function (data) {
|
|
14998
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
14999
|
-
var response, error_4;
|
|
15000
|
-
return __generator(this, function (_a) {
|
|
15001
|
-
switch (_a.label) {
|
|
15002
|
-
case 0:
|
|
15003
|
-
_a.trys.push([0, 2, , 3]);
|
|
15004
|
-
this.validationErrorRaised = false;
|
|
15005
|
-
return [4 /*yield*/, this.client.approvePayPalBillingAgreement({
|
|
15006
|
-
id: data.billingToken
|
|
15007
|
-
})];
|
|
15008
|
-
case 1:
|
|
15009
|
-
response = (_a.sent()).data;
|
|
15010
|
-
(0, event_manager_1.emit)(types_2.PublicEvent.PAYPAL_SUCCESS, {
|
|
15011
|
-
data: util.toObjectWithCamelCaseKeys(response),
|
|
15012
|
-
message: 'PayPal Billing Agreement created.'
|
|
15013
|
-
});
|
|
15014
|
-
return [2 /*return*/];
|
|
15015
|
-
case 2:
|
|
15016
|
-
error_4 = _a.sent();
|
|
15017
|
-
this.validationErrorRaised = true;
|
|
15018
|
-
(0, event_manager_1.emit)(types_2.PublicEvent.PAYPAL_ERROR, {
|
|
15019
|
-
errors: this.formatError(error_4),
|
|
15020
|
-
data: null
|
|
15021
|
-
});
|
|
15022
|
-
return [2 /*return*/];
|
|
15023
|
-
case 3: return [2 /*return*/];
|
|
15024
|
-
}
|
|
15025
|
-
});
|
|
15026
|
-
});
|
|
15027
|
-
};
|
|
15028
|
-
PayPalButton.prototype.formatError = function (error) {
|
|
15029
|
-
var _a, _b;
|
|
15030
|
-
var message = [(_b = (_a = error === null || error === void 0 ? void 0 : error.request) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.errors].flat();
|
|
15031
|
-
if (typeof message[0] === 'undefined')
|
|
15032
|
-
message = [error === null || error === void 0 ? void 0 : error.message].flat();
|
|
15033
|
-
if (typeof message[0] === 'undefined')
|
|
15034
|
-
message = ['Unknown error'];
|
|
15035
|
-
return message;
|
|
15036
|
-
};
|
|
15037
|
-
return PayPalButton;
|
|
15038
|
-
}());
|
|
15039
|
-
exports.PayPalButton = PayPalButton;
|
|
15040
|
-
exports["default"] = PayPalButton;
|
|
15041
|
-
|
|
15042
|
-
|
|
15043
|
-
/***/ }),
|
|
15044
|
-
|
|
15045
|
-
/***/ "./src/paypal/paypal-checkout.ts":
|
|
15046
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
15047
|
-
|
|
15048
|
-
"use strict";
|
|
15049
|
-
|
|
15050
|
-
// This is the implementation of PayPal Checkout
|
|
15051
|
-
//
|
|
15052
|
-
// https://developer.paypal.com/docs/checkout/
|
|
15053
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
15054
|
-
exports.PayPalCheckout = void 0;
|
|
15055
|
-
var event_manager_1 = __webpack_require__("./src/shared/event-manager.ts");
|
|
15056
|
-
var types_1 = __webpack_require__("./src/shared/types.ts");
|
|
15057
|
-
var paypal_button_1 = __webpack_require__("./src/paypal/paypal-button.ts");
|
|
15058
|
-
var validation_1 = __webpack_require__("./src/paypal/validation.ts");
|
|
15059
|
-
var PayPalCheckout = /** @class */ (function () {
|
|
15060
|
-
function PayPalCheckout(config) {
|
|
15061
|
-
var _a, _b, _c, _d, _e;
|
|
15062
|
-
if (!this.validatePayPalSetup(config)) {
|
|
15063
|
-
(0, event_manager_1.emit)(types_1.PublicEvent.PAYPAL_ERROR, {
|
|
15064
|
-
errors: this.errors(),
|
|
15065
|
-
data: null
|
|
15066
|
-
});
|
|
15067
|
-
return;
|
|
15068
|
-
}
|
|
15069
|
-
this.billingAgreement = (((_b = (_a = config === null || config === void 0 ? void 0 : config.payment) === null || _a === void 0 ? void 0 : _a.paymentMethod) === null || _b === void 0 ? void 0 : _b.type) === types_1.PaymentMethodType.PAYPAL_BILLING);
|
|
15070
|
-
this.payment = config === null || config === void 0 ? void 0 : config.payment;
|
|
15071
|
-
this.intent = (_e = (_d = (_c = config === null || config === void 0 ? void 0 : config.payment) === null || _c === void 0 ? void 0 : _c.paymentMethod) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.intent;
|
|
15072
|
-
this.currency = config === null || config === void 0 ? void 0 : config.currency;
|
|
15073
|
-
this.containerId = config === null || config === void 0 ? void 0 : config.containerId;
|
|
15074
|
-
this.buttonStyle = config === null || config === void 0 ? void 0 : config.style;
|
|
15075
|
-
if (!this.validatePayPalRequest()) {
|
|
15076
|
-
(0, event_manager_1.emit)(types_1.PublicEvent.PAYPAL_ERROR, {
|
|
15077
|
-
errors: this.errors(),
|
|
15078
|
-
data: null
|
|
15079
|
-
});
|
|
15080
|
-
return;
|
|
15081
|
-
}
|
|
15082
|
-
}
|
|
15083
|
-
Object.defineProperty(PayPalCheckout.prototype, "paypal", {
|
|
15084
|
-
get: function () {
|
|
15085
|
-
return this.paypalButton;
|
|
15086
|
-
},
|
|
15087
|
-
set: function (paypal) {
|
|
15088
|
-
this.paypalButton = paypal;
|
|
15089
|
-
},
|
|
15090
|
-
enumerable: false,
|
|
15091
|
-
configurable: true
|
|
15092
|
-
});
|
|
15093
|
-
PayPalCheckout.prototype.load = function () {
|
|
15094
|
-
var _this = this;
|
|
15095
|
-
if (this.errors()) {
|
|
15096
|
-
return;
|
|
15097
|
-
}
|
|
15098
|
-
if (this.intent && !this.billingAgreement) {
|
|
15099
|
-
var data = this.payment.paymentMethod.data;
|
|
15100
|
-
data.intent = this.intent.toUpperCase();
|
|
15101
|
-
}
|
|
15102
|
-
var self = this;
|
|
15103
|
-
return new Promise(function (resolve, reject) {
|
|
15104
|
-
var script = document.createElement('script');
|
|
15105
|
-
script.type = 'text/javascript';
|
|
15106
|
-
var source = "https://www.paypal.com/sdk/js?commit=true&disable-funding=card&integration-date=2019-06-01" + '&client-id=' + "AWsk87oTy_rKljt2tK_pr0t7nKiytr3VKD4ouI6HFXh149iowjuQidXsJSf-udidfPBUEBtJyC0lxxBf" + '&debug=' + "true";
|
|
15107
|
-
if (_this.currency)
|
|
15108
|
-
source += '¤cy=' + _this.currency;
|
|
15109
|
-
if (_this.intent && !_this.billingAgreement)
|
|
15110
|
-
source += '&intent=' + _this.intent;
|
|
15111
|
-
if (_this.billingAgreement === true)
|
|
15112
|
-
source += '&vault=true';
|
|
15113
|
-
script.setAttribute('data-partner-attribution-id', "FatZebra_PSP");
|
|
15114
|
-
script.src = source;
|
|
15115
|
-
script.async = true;
|
|
15116
|
-
document.body.appendChild(script);
|
|
15117
|
-
script.onload = function () {
|
|
15118
|
-
self.paypalButton = new paypal_button_1.PayPalButton(self.payment.paymentMethod.data, self.payment.paymentIntent, self.billingAgreement, self.buttonStyle);
|
|
15119
|
-
resolve(null);
|
|
15120
|
-
};
|
|
15121
|
-
script.onerror = function () {
|
|
15122
|
-
reject(['Loading PayPal failed']);
|
|
15123
|
-
};
|
|
15124
|
-
});
|
|
15125
|
-
};
|
|
15126
|
-
PayPalCheckout.prototype.render = function () {
|
|
15127
|
-
if (this.errors()) {
|
|
15128
|
-
return;
|
|
15129
|
-
}
|
|
15130
|
-
this.paypalButton.render(this.containerId);
|
|
15131
|
-
};
|
|
15132
|
-
PayPalCheckout.prototype.validatePayPalSetup = function (config) {
|
|
15133
|
-
var validations = (0, validation_1.validatePayPalSetup)(config);
|
|
15134
|
-
this.validationErrors = null;
|
|
15135
|
-
if (!validations.valid) {
|
|
15136
|
-
this.validationErrors = validations.errors;
|
|
15137
|
-
return false;
|
|
15138
|
-
}
|
|
15139
|
-
return true;
|
|
15140
|
-
};
|
|
15141
|
-
PayPalCheckout.prototype.validatePayPalRequest = function () {
|
|
15142
|
-
var validations = (0, validation_1.validatePayPalRequest)(this.payment, this.billingAgreement);
|
|
15143
|
-
this.validationErrors = null;
|
|
15144
|
-
if (!validations.valid) {
|
|
15145
|
-
this.validationErrors = validations.errors;
|
|
15146
|
-
return false;
|
|
15147
|
-
}
|
|
15148
|
-
return true;
|
|
15149
|
-
};
|
|
15150
|
-
PayPalCheckout.prototype.errors = function () {
|
|
15151
|
-
if (this.validationErrors !== null)
|
|
15152
|
-
return this.validationErrors;
|
|
15153
|
-
return null;
|
|
15154
|
-
};
|
|
15155
|
-
return PayPalCheckout;
|
|
15156
|
-
}());
|
|
15157
|
-
exports.PayPalCheckout = PayPalCheckout;
|
|
15158
|
-
exports["default"] = PayPalCheckout;
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
/***/ }),
|
|
15162
|
-
|
|
15163
|
-
/***/ "./src/paypal/types.ts":
|
|
15164
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
15165
|
-
|
|
15166
|
-
"use strict";
|
|
15167
|
-
|
|
15168
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
15169
|
-
exports.PayPalIntent = void 0;
|
|
15170
|
-
var PayPalIntent;
|
|
15171
|
-
(function (PayPalIntent) {
|
|
15172
|
-
PayPalIntent["CAPTURE"] = "CAPTURE";
|
|
15173
|
-
PayPalIntent["AUTHORIZE"] = "AUTHORIZE";
|
|
15174
|
-
})(PayPalIntent || (exports.PayPalIntent = PayPalIntent = {}));
|
|
15175
|
-
|
|
15176
|
-
|
|
15177
|
-
/***/ }),
|
|
15178
|
-
|
|
15179
|
-
/***/ "./src/paypal/validation.ts":
|
|
15180
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
15181
|
-
|
|
15182
|
-
"use strict";
|
|
15183
|
-
|
|
15184
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
15185
|
-
exports.validatePayPalRequest = exports.validatePayPalSetup = void 0;
|
|
15186
|
-
var types_1 = __webpack_require__("./src/paypal/types.ts");
|
|
15187
|
-
var PaypalConfigRequiredProps = ['currency', 'containerId', 'payment'];
|
|
15188
|
-
var PaypalOrderRequiredProps = ['intent', 'purchases'];
|
|
15189
|
-
var PaypalBillingRequiredProps = ['shippingAddress'];
|
|
15190
|
-
var validatePayPalSetup = function (props) {
|
|
15191
|
-
var errors = [];
|
|
15192
|
-
var keys = Object.keys(props);
|
|
15193
|
-
for (var _i = 0, PaypalConfigRequiredProps_1 = PaypalConfigRequiredProps; _i < PaypalConfigRequiredProps_1.length; _i++) {
|
|
15194
|
-
var requiredProp = PaypalConfigRequiredProps_1[_i];
|
|
15195
|
-
// @ts-ignore
|
|
15196
|
-
if (!keys.includes(requiredProp) || props[requiredProp] === undefined) {
|
|
15197
|
-
errors.push("".concat(requiredProp, " is missing."));
|
|
15198
|
-
}
|
|
15199
|
-
}
|
|
15200
|
-
return {
|
|
15201
|
-
valid: errors.length == 0,
|
|
15202
|
-
errors: errors
|
|
15203
|
-
};
|
|
15204
|
-
};
|
|
15205
|
-
exports.validatePayPalSetup = validatePayPalSetup;
|
|
15206
|
-
var validatePayPalRequest = function (props, billing) {
|
|
15207
|
-
var errors = [];
|
|
15208
|
-
var keys = Object.keys(props);
|
|
15209
|
-
if (!keys.includes('paymentMethod')) {
|
|
15210
|
-
errors.push("paymentMethod is missing.");
|
|
15211
|
-
}
|
|
15212
|
-
if (!keys.includes('paymentIntent') && !billing) {
|
|
15213
|
-
errors.push("paymentIntent is missing.");
|
|
15214
|
-
}
|
|
15215
|
-
if (props.paymentMethod) {
|
|
15216
|
-
var orderKeys = Object.keys(props.paymentMethod.data);
|
|
15217
|
-
if (orderKeys.includes('intent')) {
|
|
15218
|
-
var intent = props.paymentMethod.data.intent.toLowerCase();
|
|
15219
|
-
var intents = Object.values(types_1.PayPalIntent).map(function (v) { return v.toLowerCase(); });
|
|
15220
|
-
if (!intents.includes(intent)) {
|
|
15221
|
-
errors.push("intent is invalid, must be one of [".concat(intents.join(', '), "]."));
|
|
15222
|
-
}
|
|
15223
|
-
}
|
|
15224
|
-
if (!props.paymentMethod.type) {
|
|
15225
|
-
errors.push("paymentMethod.type is missing.");
|
|
15226
|
-
}
|
|
15227
|
-
}
|
|
15228
|
-
if (errors.length > 0) {
|
|
15229
|
-
return {
|
|
15230
|
-
valid: errors.length == 0,
|
|
15231
|
-
errors: errors
|
|
15232
|
-
};
|
|
15233
|
-
}
|
|
15234
|
-
var paymentMethod = props.paymentMethod.data;
|
|
15235
|
-
var providedKeys = Object.keys(paymentMethod);
|
|
15236
|
-
var requiredProps;
|
|
15237
|
-
if (billing === true) {
|
|
15238
|
-
requiredProps = PaypalBillingRequiredProps;
|
|
15239
|
-
}
|
|
15240
|
-
else {
|
|
15241
|
-
requiredProps = PaypalOrderRequiredProps;
|
|
15242
|
-
}
|
|
15243
|
-
for (var _i = 0, requiredProps_1 = requiredProps; _i < requiredProps_1.length; _i++) {
|
|
15244
|
-
var requiredProp = requiredProps_1[_i];
|
|
15245
|
-
if (!providedKeys.includes(requiredProp)) {
|
|
15246
|
-
errors.push("".concat(requiredProp, " is missing."));
|
|
15247
|
-
}
|
|
15248
|
-
}
|
|
15249
|
-
return {
|
|
15250
|
-
valid: errors.length == 0,
|
|
15251
|
-
errors: errors
|
|
15252
|
-
};
|
|
15253
|
-
};
|
|
15254
|
-
exports.validatePayPalRequest = validatePayPalRequest;
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
14755
|
/***/ }),
|
|
15258
14756
|
|
|
15259
14757
|
/***/ "./src/sca/cardinal.ts":
|
|
@@ -15360,6 +14858,7 @@ var CardinalManager = /** @class */ (function () {
|
|
|
15360
14858
|
};
|
|
15361
14859
|
CardinalManager.prototype.onPaymentValidated = function (handler) {
|
|
15362
14860
|
window.Cardinal.on('payments.validated', function (data, jwt) {
|
|
14861
|
+
window.Cardinal.off('payments.validated');
|
|
15363
14862
|
if (data.ErrorDescription.toLowerCase() === 'success') {
|
|
15364
14863
|
handler({
|
|
15365
14864
|
processorTransactionId: data.Payment.ProcessorTransactionId,
|
|
@@ -16407,50 +15906,6 @@ var GatewayClient = /** @class */ (function () {
|
|
|
16407
15906
|
});
|
|
16408
15907
|
});
|
|
16409
15908
|
};
|
|
16410
|
-
/**************** PayPal /****************/
|
|
16411
|
-
GatewayClient.prototype.createPayPalOrder = function (data) {
|
|
16412
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
16413
|
-
return __generator(this, function (_a) {
|
|
16414
|
-
return [2 /*return*/, this.client.post("/paypal/orders", data, {
|
|
16415
|
-
timeout: constants_1.LongRequestTimeout,
|
|
16416
|
-
})];
|
|
16417
|
-
});
|
|
16418
|
-
});
|
|
16419
|
-
};
|
|
16420
|
-
GatewayClient.prototype.capturePayPalOrder = function (data) {
|
|
16421
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
16422
|
-
return __generator(this, function (_a) {
|
|
16423
|
-
return [2 /*return*/, this.client.post("/paypal/orders/".concat(data.id, "/capture"), null, {
|
|
16424
|
-
timeout: constants_1.LongRequestTimeout,
|
|
16425
|
-
})];
|
|
16426
|
-
});
|
|
16427
|
-
});
|
|
16428
|
-
};
|
|
16429
|
-
GatewayClient.prototype.authorizePayPalOrder = function (data) {
|
|
16430
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
16431
|
-
return __generator(this, function (_a) {
|
|
16432
|
-
return [2 /*return*/, this.client.post("/paypal/orders/".concat(data.id, "/authorize"), null, {
|
|
16433
|
-
timeout: constants_1.LongRequestTimeout,
|
|
16434
|
-
})];
|
|
16435
|
-
});
|
|
16436
|
-
});
|
|
16437
|
-
};
|
|
16438
|
-
GatewayClient.prototype.createPayPalBillingAgreement = function (data) {
|
|
16439
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
16440
|
-
return __generator(this, function (_a) {
|
|
16441
|
-
return [2 /*return*/, this.client.post("/paypal/billing_agreements", data, {
|
|
16442
|
-
timeout: constants_1.LongRequestTimeout,
|
|
16443
|
-
})];
|
|
16444
|
-
});
|
|
16445
|
-
});
|
|
16446
|
-
};
|
|
16447
|
-
GatewayClient.prototype.approvePayPalBillingAgreement = function (data) {
|
|
16448
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
16449
|
-
return __generator(this, function (_a) {
|
|
16450
|
-
return [2 /*return*/, this.client.post("/paypal/billing_agreements/".concat(data.id, "/approve"), null, { timeout: constants_1.LongRequestTimeout })];
|
|
16451
|
-
});
|
|
16452
|
-
});
|
|
16453
|
-
};
|
|
16454
15909
|
return GatewayClient;
|
|
16455
15910
|
}());
|
|
16456
15911
|
exports["default"] = GatewayClient;
|
|
@@ -16831,11 +16286,9 @@ var PublicEvent;
|
|
|
16831
16286
|
PublicEvent["TOKENIZATION_ERROR"] = "fz.tokenization.error";
|
|
16832
16287
|
PublicEvent["PAYMENT_SUCCESS"] = "fz.payment.success";
|
|
16833
16288
|
PublicEvent["PAYMENT_ERROR"] = "fz.payment.error";
|
|
16834
|
-
PublicEvent["PAYPAL_CANCEL"] = "fz.paypal.cancel";
|
|
16835
|
-
PublicEvent["PAYPAL_SUCCESS"] = "fz.paypal.success";
|
|
16836
|
-
PublicEvent["PAYPAL_ERROR"] = "fz.paypal.error";
|
|
16837
|
-
PublicEvent["PAYPAL_PROCESSESING"] = "fz.paypal.processing";
|
|
16838
16289
|
PublicEvent["BIN_LOOKUP"] = "fz.bin.lookup";
|
|
16290
|
+
PublicEvent["CLICK_TO_PAY_TOKENIZATION_SUCCESS"] = "fz.click_to_pay.tokenization.success";
|
|
16291
|
+
PublicEvent["CLICK_TO_PAY_TOKENIZATION_ERROR"] = "fz.click_to_pay.tokenization.error";
|
|
16839
16292
|
})(PublicEvent || (exports.PublicEvent = PublicEvent = {}));
|
|
16840
16293
|
var BridgeEvent;
|
|
16841
16294
|
(function (BridgeEvent) {
|
|
@@ -16847,13 +16300,12 @@ var BridgeEvent;
|
|
|
16847
16300
|
BridgeEvent["FORM_VALIDATION_ERROR"] = "fzi.form_validation_error";
|
|
16848
16301
|
BridgeEvent["FORM_VALIDATION_SUCCESS"] = "fzi.form_validation_success";
|
|
16849
16302
|
BridgeEvent["BIN_LOOKUP"] = "fzi.bin_lookup";
|
|
16303
|
+
BridgeEvent["CLICK_TO_PAY_TOKENIZATION"] = "fzi.c2p.tc_res";
|
|
16850
16304
|
})(BridgeEvent || (exports.BridgeEvent = BridgeEvent = {}));
|
|
16851
16305
|
var PaymentMethodType;
|
|
16852
16306
|
(function (PaymentMethodType) {
|
|
16853
16307
|
PaymentMethodType["CARD"] = "card";
|
|
16854
16308
|
PaymentMethodType["CARD_ON_FILE"] = "card_on_file";
|
|
16855
|
-
PaymentMethodType["PAYPAL_ORDER"] = "paypal_order";
|
|
16856
|
-
PaymentMethodType["PAYPAL_BILLING"] = "paypal_billing";
|
|
16857
16309
|
})(PaymentMethodType || (exports.PaymentMethodType = PaymentMethodType = {}));
|
|
16858
16310
|
|
|
16859
16311
|
|
|
@@ -17110,7 +16562,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
|
|
|
17110
16562
|
/***/ ((module) => {
|
|
17111
16563
|
|
|
17112
16564
|
"use strict";
|
|
17113
|
-
module.exports = JSON.parse('{"name":"@fat-zebra/sdk","version":"1.
|
|
16565
|
+
module.exports = JSON.parse('{"name":"@fat-zebra/sdk","version":"1.6.0","description":"","main":"index.js","scripts":{"test":"jest --clearCache && jest --passWithNoTests --verbose","build:local":"cp .env.local .env && export ENVIRONMENT=local && npx webpack --config webpack.config.dev.js && node build-styles.js","build:staging":"cp .env.staging .env && export ENVIRONMENT=staging && npx webpack --config webpack.config.dev.js && node build-styles.js","build:sandbox":"cp .env.sandbox .env && export ENVIRONMENT=sandbox && npx webpack --config webpack.config.prod.js && node build-styles.js","build:production":"cp .env.production .env && export ENVIRONMENT=production && npx webpack --config webpack.config.prod.js && node build-styles.js","build:package":"yarn tsc -p tsconfig.package.json && node build-styles.js","start:local:api":"export MERCHANT_MODE=api && npm run build:local --watch && webpack serve --config webpack.config.dev.js --open \'Google Chrome\'","start:local:hpp":"export MERCHANT_MODE=hpp && npm run build:local --watch && webpack serve --config webpack.config.dev.js --open \'Google Chrome\'","start:staging:api":"export MERCHANT_MODE=api && npm run build:staging --watch && webpack serve --config webpack.config.dev.js --open \'Google Chrome\'","start:staging:hpp":"export MERCHANT_MODE=hpp && npm run build:staging --watch && webpack serve --config webpack.config.dev.js --open \'Google Chrome\'","start:staging:es5":"export MERCHANT_MODE=es5 && npm run build:staging --watch && webpack serve --config webpack.config.dev.js --open \'Google Chrome\'","start:docker":"npm run build:dev --watch && webpack serve --config webpack.config.dev.js --host 0.0.0.0","generate:jwt":"node scripts/generate-access-token.js"},"keywords":[],"author":"","license":"ISC","devDependencies":{"@types/ajv":"^1.0.0","@types/axios":"^0.14.0","@types/dotenv":"^8.2.0","@types/jest":"^24.0.23","@types/jsdom":"^21.1.1","@types/nock":"^11.1.0","@types/react":"^18.2.15","@types/react-dom":"^18.2.7","audit-ci":"^3.0.0","dotenv":"^16.0.1","dotenv-webpack":"^8.0.0","ejs":"^3.0.1","html-webpack-plugin":"^5.3.1","jest":"^29.6.1","jest-environment-jsdom":"^29.6.1","jest-localstorage-mock":"^2.4.22","jsdom":"^16.2.1","jsonwebtoken":"^9.0.0","nock":"^12.0.1","source-map-loader":"^0.2.4","terser-webpack-plugin":"^4.1.0","ts-jest":"^29.1.1","ts-loader":"^9.4.4","typescript":"^5.1.6","webpack":"^5.76.0","webpack-cli":"^4.10.0","webpack-dev-server":"^4.7.4"},"dependencies":{"ajv":"^6.12.3","axios":"^0.21.1","custom-event-polyfill":"^1.0.7","ts-polyfill":"^3.8.2","url-template":"^3.1.0"},"peerDependencies":{"react":">= 16","react-dom":">= 16"}}');
|
|
17114
16566
|
|
|
17115
16567
|
/***/ }),
|
|
17116
16568
|
|
|
@@ -17134,7 +16586,7 @@ module.exports = JSON.parse('{"$id":"https://www.fatzebra.com/schemas/click-to-p
|
|
|
17134
16586
|
/***/ ((module) => {
|
|
17135
16587
|
|
|
17136
16588
|
"use strict";
|
|
17137
|
-
module.exports = JSON.parse('{"$id":"https://www.fatzebra.com/schemas/click-to-pay/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
|
|
16589
|
+
module.exports = JSON.parse('{"$id":"https://www.fatzebra.com/schemas/click-to-pay/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"]}}}');
|
|
17138
16590
|
|
|
17139
16591
|
/***/ }),
|
|
17140
16592
|
|
|
@@ -17255,7 +16707,7 @@ module.exports = JSON.parse('{"$id":"https://www.fatzebra.com/schemas/hpp-load-p
|
|
|
17255
16707
|
/******/
|
|
17256
16708
|
/******/ /* webpack/runtime/getFullHash */
|
|
17257
16709
|
/******/ (() => {
|
|
17258
|
-
/******/ __webpack_require__.h = () => ("
|
|
16710
|
+
/******/ __webpack_require__.h = () => ("02801acfe7d1ac0ae815")
|
|
17259
16711
|
/******/ })();
|
|
17260
16712
|
/******/
|
|
17261
16713
|
/******/ /* webpack/runtime/global */
|