@paydock/client-sdk 1.10.89-beta → 1.11.3-beta
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/README.md +478 -2
- package/bundles/widget.umd.js +449 -3
- package/bundles/widget.umd.min.js +1 -1
- package/inicialization-guide.md +7 -0
- package/lib/api/api-internal.d.ts +2 -0
- package/lib/api/api-internal.js +4 -0
- package/lib/api/api-internal.js.map +1 -1
- package/lib/api/api-service-internal.d.ts +17 -0
- package/lib/api/api-service-internal.js +18 -0
- package/lib/api/api-service-internal.js.map +1 -0
- package/lib/checkout-button/zipmoney.runner.d.ts +1 -0
- package/lib/checkout-button/zipmoney.runner.js +8 -0
- package/lib/checkout-button/zipmoney.runner.js.map +1 -1
- package/lib/components/iframe-event.d.ts +3 -0
- package/lib/components/iframe-event.js +2 -0
- package/lib/components/iframe-event.js.map +1 -1
- package/lib/components/link.d.ts +4 -2
- package/lib/components/link.js +4 -0
- package/lib/components/link.js.map +1 -1
- package/lib/components/param.d.ts +6 -0
- package/lib/components/param.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/secure-remote-commerce/index.d.ts +1 -0
- package/lib/secure-remote-commerce/index.js +2 -0
- package/lib/secure-remote-commerce/index.js.map +1 -0
- package/lib/secure-remote-commerce/interfaces.d.ts +58 -0
- package/lib/secure-remote-commerce/interfaces.js +22 -0
- package/lib/secure-remote-commerce/interfaces.js.map +1 -0
- package/lib/secure-remote-commerce/providers/src-provider.d.ts +10 -0
- package/lib/secure-remote-commerce/providers/src-provider.js +1 -0
- package/lib/secure-remote-commerce/providers/src-provider.js.map +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/index.d.ts +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/index.js +2 -0
- package/lib/secure-remote-commerce/providers/visa-src/index.js.map +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.d.ts +27 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.js +100 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.js.map +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts +8 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js +10 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js.map +1 -0
- package/lib/secure-remote-commerce/secure-remote-commerce.d.ts +148 -0
- package/lib/secure-remote-commerce/secure-remote-commerce.js +210 -0
- package/lib/secure-remote-commerce/secure-remote-commerce.js.map +1 -0
- package/lib/wallet-buttons/google.wallet-service.js +2 -3
- package/lib/wallet-buttons/google.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/mastercard.wallet-service.d.ts +1 -0
- package/lib/wallet-buttons/mastercard.wallet-service.js +4 -0
- package/lib/wallet-buttons/mastercard.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/wallet-buttons.js +1 -1
- package/lib/wallet-buttons/wallet-buttons.js.map +1 -1
- package/package.json +1 -1
- package/slate.md +233 -3
package/bundles/widget.umd.js
CHANGED
|
@@ -343,6 +343,7 @@
|
|
|
343
343
|
var SECURE_3D = '/3ds/webhook';
|
|
344
344
|
var FLYPAY_LINK = '/wallet/flypay';
|
|
345
345
|
var FLYPAY_LOGO_LINK = '/images/logo.png';
|
|
346
|
+
var VISA_SRC = '/secure-remote-commerce/visa';
|
|
346
347
|
var Link = function () {
|
|
347
348
|
function Link(linkResource) {
|
|
348
349
|
classCallCheck(this, Link);
|
|
@@ -398,6 +399,11 @@
|
|
|
398
399
|
value: function getEnv() {
|
|
399
400
|
return this.env.getEnv();
|
|
400
401
|
}
|
|
402
|
+
}, {
|
|
403
|
+
key: "getBaseUrl",
|
|
404
|
+
value: function getBaseUrl() {
|
|
405
|
+
return this.env.getConf().url;
|
|
406
|
+
}
|
|
401
407
|
}]);
|
|
402
408
|
return Link;
|
|
403
409
|
}();
|
|
@@ -1585,7 +1591,9 @@
|
|
|
1585
1591
|
VALIDATION_ERROR: 'validationError',
|
|
1586
1592
|
SYSTEM_ERROR: 'systemError',
|
|
1587
1593
|
CHECKOUT_SUCCESS: 'checkoutSuccess',
|
|
1594
|
+
CHECKOUT_READY: 'checkoutReady',
|
|
1588
1595
|
CHECKOUT_ERROR: 'checkoutError',
|
|
1596
|
+
CHECKOUT_COMPLETED: 'checkoutCompleted',
|
|
1589
1597
|
VALIDATION: 'validation',
|
|
1590
1598
|
SELECT: 'select',
|
|
1591
1599
|
UNSELECT: 'unselect',
|
|
@@ -3998,6 +4006,15 @@
|
|
|
3998
4006
|
}
|
|
3999
4007
|
});
|
|
4000
4008
|
}
|
|
4009
|
+
}, {
|
|
4010
|
+
key: "stop",
|
|
4011
|
+
value: function stop() {
|
|
4012
|
+
get(ZipmoneyRunner.prototype.__proto__ || Object.getPrototypeOf(ZipmoneyRunner.prototype), "stop", this).call(this);
|
|
4013
|
+
this.runs = false;
|
|
4014
|
+
var element = document.querySelector('.zipmoney-overlay');
|
|
4015
|
+
if (element) element.remove();
|
|
4016
|
+
this.eventEmitter.emit(EVENT$1.CLOSE, {});
|
|
4017
|
+
}
|
|
4001
4018
|
}, {
|
|
4002
4019
|
key: "onStop",
|
|
4003
4020
|
value: function onStop(cb) {
|
|
@@ -5991,7 +6008,7 @@
|
|
|
5991
6008
|
googlePayJs.src = "https://pay.google.com/gp/p/js/pay.js";
|
|
5992
6009
|
googlePayJs.async = true;
|
|
5993
6010
|
googlePayJs.onload = function () {
|
|
5994
|
-
var _a, _b, _c;
|
|
6011
|
+
var _a, _b, _c, _d;
|
|
5995
6012
|
if (!window.google) {
|
|
5996
6013
|
_this2.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, { wallet: WALLET_TYPE.GOOGLE });
|
|
5997
6014
|
reject();
|
|
@@ -6007,7 +6024,7 @@
|
|
|
6007
6024
|
onPaymentDataChanged: function onPaymentDataChanged(intermediatePaymentData) {
|
|
6008
6025
|
return _this2.onPaymentDataChanged(intermediatePaymentData);
|
|
6009
6026
|
}
|
|
6010
|
-
}) }, _this2.
|
|
6027
|
+
}) }, ((_d = _this2.meta) === null || _d === void 0 ? void 0 : _d.gateway_mode) === 'live' ? { environment: "PRODUCTION" } : { environment: "TEST" }));
|
|
6011
6028
|
_this2.checkAvailability().then(function (available) {
|
|
6012
6029
|
if (!available) {
|
|
6013
6030
|
_this2.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, { wallet: WALLET_TYPE.GOOGLE });
|
|
@@ -6217,6 +6234,14 @@
|
|
|
6217
6234
|
value: function getGatewayName() {
|
|
6218
6235
|
return WALLET_GATEWAY.MASTERCARD;
|
|
6219
6236
|
}
|
|
6237
|
+
}, {
|
|
6238
|
+
key: "setEnv",
|
|
6239
|
+
value: function setEnv(env) {
|
|
6240
|
+
this.childWallets.forEach(function (child) {
|
|
6241
|
+
return child.setEnv(env);
|
|
6242
|
+
});
|
|
6243
|
+
return this;
|
|
6244
|
+
}
|
|
6220
6245
|
}, {
|
|
6221
6246
|
key: "update",
|
|
6222
6247
|
value: function update(data) {
|
|
@@ -6384,6 +6409,28 @@
|
|
|
6384
6409
|
return ApiChargeInternal;
|
|
6385
6410
|
}();
|
|
6386
6411
|
|
|
6412
|
+
var GET_CONFIG = '/v1/services/:service_id/config';
|
|
6413
|
+
var ApiServiceInternal = function () {
|
|
6414
|
+
function ApiServiceInternal(api) {
|
|
6415
|
+
classCallCheck(this, ApiServiceInternal);
|
|
6416
|
+
|
|
6417
|
+
this.api = api;
|
|
6418
|
+
}
|
|
6419
|
+
|
|
6420
|
+
createClass(ApiServiceInternal, [{
|
|
6421
|
+
key: 'getConfig',
|
|
6422
|
+
value: function getConfig(service_id) {
|
|
6423
|
+
var url = GET_CONFIG.replace(':service_id', service_id);
|
|
6424
|
+
return this.api.getClientPromise('GET', url).send(undefined);
|
|
6425
|
+
}
|
|
6426
|
+
}]);
|
|
6427
|
+
return ApiServiceInternal;
|
|
6428
|
+
}();
|
|
6429
|
+
var CARD_SCHEME_SERVICE;
|
|
6430
|
+
(function (CARD_SCHEME_SERVICE) {
|
|
6431
|
+
CARD_SCHEME_SERVICE["VISA_SRC"] = "VisaSRC";
|
|
6432
|
+
})(CARD_SCHEME_SERVICE || (CARD_SCHEME_SERVICE = {}));
|
|
6433
|
+
|
|
6387
6434
|
var ApiInternal = function (_ApiBase) {
|
|
6388
6435
|
inherits(ApiInternal, _ApiBase);
|
|
6389
6436
|
|
|
@@ -6397,6 +6444,11 @@
|
|
|
6397
6444
|
value: function charge() {
|
|
6398
6445
|
return new ApiChargeInternal(this);
|
|
6399
6446
|
}
|
|
6447
|
+
}, {
|
|
6448
|
+
key: 'service',
|
|
6449
|
+
value: function service() {
|
|
6450
|
+
return new ApiServiceInternal(this);
|
|
6451
|
+
}
|
|
6400
6452
|
}]);
|
|
6401
6453
|
return ApiInternal;
|
|
6402
6454
|
}(ApiBase);
|
|
@@ -6503,7 +6555,7 @@
|
|
|
6503
6555
|
this.service = new PaypalWalletService(tokenMeta.credentials.client_auth, _extends(_extends({}, meta), { id: tokenMeta.charge.id, gateway_mode: tokenMeta.gateway.mode, amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency, capture: tokenMeta.charge.capture }));
|
|
6504
6556
|
break;
|
|
6505
6557
|
case WALLET_GATEWAY.MASTERCARD:
|
|
6506
|
-
this.service = new MastercardWalletService('', _extends(_extends({}, meta), { credentials: tokenMeta.gateway.credentials, amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency }));
|
|
6558
|
+
this.service = new MastercardWalletService('', _extends(_extends({}, meta), { credentials: tokenMeta.gateway.credentials, amount: tokenMeta.charge.amount, currency: tokenMeta.charge.currency, gateway_mode: tokenMeta.gateway.mode }));
|
|
6507
6559
|
break;
|
|
6508
6560
|
}
|
|
6509
6561
|
}
|
|
@@ -7934,6 +7986,399 @@
|
|
|
7934
7986
|
return VaultDisplayWidget;
|
|
7935
7987
|
}();
|
|
7936
7988
|
|
|
7989
|
+
var VisaSRCStyles = function VisaSRCStyles() {
|
|
7990
|
+
classCallCheck(this, VisaSRCStyles);
|
|
7991
|
+
};
|
|
7992
|
+
VisaSRCStyles.buttonContainerStyles = "display: flex; flex-direction: column; justify-content: center; align-items: center;";
|
|
7993
|
+
VisaSRCStyles.buttonStyles = "color: #ffff; background-color: #ffbe24; border: none; width: 100%; min-height: 40px; font-size: 16px; font-weight: bold; line-height: 19px; letter-spacing: 0.7px; text-transform: uppercase; border-radius: 4px; margin-bottom: 30px; cursor: pointer;";
|
|
7994
|
+
VisaSRCStyles.footerContainerStyles = "display: flex; flex: 1; flex-wrap: wrap; justify-content: center;";
|
|
7995
|
+
VisaSRCStyles.footerTextStyles = "text-align: center; color: #666666; margin: 0;";
|
|
7996
|
+
VisaSRCStyles.verticalLineStyle = "display: inline-block; padding: 0.5px; background-color: #E5E5E5; height: 15px;";
|
|
7997
|
+
VisaSRCStyles.clickToPayAllCardsStyle = "height: 21px; margin-left: 8px; vertical-align: middle;";
|
|
7998
|
+
|
|
7999
|
+
/**
|
|
8000
|
+
* List of available event's name in the SRC checkout lifecycle
|
|
8001
|
+
* @enum EVENT
|
|
8002
|
+
*
|
|
8003
|
+
* @type {object}
|
|
8004
|
+
* @param {string} CHECKOUT_BUTTON_LOADED=checkoutButtonLoaded
|
|
8005
|
+
* @param {string} CHECKOUT_BUTTON_CLICKED=checkoutButtonClicked
|
|
8006
|
+
* @param {string} IFRAME_LOADED=iframeLoaded
|
|
8007
|
+
* @param {string} CHECKOUT_READY=checkoutReady
|
|
8008
|
+
* @param {string} CHECKOUT_COMPLETED=checkoutCompleted
|
|
8009
|
+
* @param {string} CHECKOUT_ERROR=checkoutError
|
|
8010
|
+
*/
|
|
8011
|
+
var EVENT$3;
|
|
8012
|
+
(function (EVENT) {
|
|
8013
|
+
EVENT["CHECKOUT_BUTTON_LOADED"] = "checkoutButtonLoaded";
|
|
8014
|
+
EVENT["CHECKOUT_BUTTON_CLICKED"] = "checkoutButtonClicked";
|
|
8015
|
+
EVENT["IFRAME_LOADED"] = "iframeLoaded";
|
|
8016
|
+
EVENT["CHECKOUT_READY"] = "checkoutReady";
|
|
8017
|
+
EVENT["CHECKOUT_COMPLETED"] = "checkoutCompleted";
|
|
8018
|
+
EVENT["CHECKOUT_ERROR"] = "checkoutError";
|
|
8019
|
+
})(EVENT$3 || (EVENT$3 = {}));
|
|
8020
|
+
|
|
8021
|
+
var VisaSRC = function () {
|
|
8022
|
+
function VisaSRC(button_selector, iframe_selector, service_id, public_key, meta, eventEmitter, autoResize, env, alias) {
|
|
8023
|
+
classCallCheck(this, VisaSRC);
|
|
8024
|
+
|
|
8025
|
+
this.meta = meta;
|
|
8026
|
+
this.eventEmitter = eventEmitter;
|
|
8027
|
+
this.autoResize = autoResize;
|
|
8028
|
+
this.link = new Link(VISA_SRC);
|
|
8029
|
+
this.link.setParams(_extends({ service_id: service_id, public_key: public_key }, meta && { meta: JSON.stringify(meta) }));
|
|
8030
|
+
if (env) this.link.setEnv(env, alias);
|
|
8031
|
+
this.iFrameContainer = new Container(iframe_selector);
|
|
8032
|
+
this.iFrame = new IFrame(this.iFrameContainer);
|
|
8033
|
+
this.buttonContainer = new Container(button_selector);
|
|
8034
|
+
this.iFrameEvent = new IFrameEvent(window);
|
|
8035
|
+
this.setupIFrameEvents();
|
|
8036
|
+
}
|
|
8037
|
+
|
|
8038
|
+
createClass(VisaSRC, [{
|
|
8039
|
+
key: 'setupIFrameEvents',
|
|
8040
|
+
value: function setupIFrameEvents() {
|
|
8041
|
+
var _this = this;
|
|
8042
|
+
|
|
8043
|
+
var widgetId = this.link.getParams().widget_id;
|
|
8044
|
+
this.iFrameEvent.on(EVENT$3.CHECKOUT_READY, widgetId, function (_ref) {
|
|
8045
|
+
var data = _ref.data;
|
|
8046
|
+
|
|
8047
|
+
_this.eventEmitter.emit(EVENT$3.CHECKOUT_READY, data);
|
|
8048
|
+
});
|
|
8049
|
+
this.iFrameEvent.on(EVENT$3.CHECKOUT_COMPLETED, widgetId, function (_ref2) {
|
|
8050
|
+
var data = _ref2.data;
|
|
8051
|
+
|
|
8052
|
+
_this.eventEmitter.emit(EVENT$3.CHECKOUT_COMPLETED, data);
|
|
8053
|
+
});
|
|
8054
|
+
this.iFrameEvent.on(EVENT$3.CHECKOUT_ERROR, widgetId, function (_ref3) {
|
|
8055
|
+
var data = _ref3.data;
|
|
8056
|
+
|
|
8057
|
+
_this.eventEmitter.emit(EVENT$3.CHECKOUT_ERROR, data);
|
|
8058
|
+
});
|
|
8059
|
+
if (this.autoResize) this.useAutoResize(true);
|
|
8060
|
+
}
|
|
8061
|
+
}, {
|
|
8062
|
+
key: 'load',
|
|
8063
|
+
value: function load() {
|
|
8064
|
+
var _this2 = this;
|
|
8065
|
+
|
|
8066
|
+
var container = document.createElement('div');
|
|
8067
|
+
container.setAttribute('style', VisaSRCStyles.buttonContainerStyles);
|
|
8068
|
+
var checkoutButton = document.createElement('button');
|
|
8069
|
+
checkoutButton.setAttribute('style', VisaSRCStyles.buttonStyles);
|
|
8070
|
+
checkoutButton.innerHTML = 'Checkout';
|
|
8071
|
+
var footerContainer = document.createElement('div');
|
|
8072
|
+
footerContainer.setAttribute('style', VisaSRCStyles.footerContainerStyles);
|
|
8073
|
+
var verticalLine = document.createElement('div');
|
|
8074
|
+
verticalLine.setAttribute('style', VisaSRCStyles.verticalLineStyle);
|
|
8075
|
+
var footerText = document.createElement('p');
|
|
8076
|
+
footerText.setAttribute('style', VisaSRCStyles.footerTextStyles);
|
|
8077
|
+
footerText.innerHTML = 'WE ACCEPT';
|
|
8078
|
+
var clickToPayAllCards = document.createElement('img');
|
|
8079
|
+
clickToPayAllCards.setAttribute('style', VisaSRCStyles.clickToPayAllCardsStyle);
|
|
8080
|
+
clickToPayAllCards.src = this.link.getBaseUrl() + '/images/visa-src/src-vmad.svg';
|
|
8081
|
+
checkoutButton.onclick = function () {
|
|
8082
|
+
_this2.eventEmitter.emit(EVENT$3.CHECKOUT_BUTTON_CLICKED, {});
|
|
8083
|
+
_this2.iFrame.load(_this2.link.getUrl(), { title: 'Visa SRC checkout' });
|
|
8084
|
+
_this2.iFrame.getElement().onload = function () {
|
|
8085
|
+
return _this2.eventEmitter.emit(EVENT$3.IFRAME_LOADED, {});
|
|
8086
|
+
};
|
|
8087
|
+
};
|
|
8088
|
+
container.appendChild(checkoutButton);
|
|
8089
|
+
container.appendChild(footerContainer);
|
|
8090
|
+
footerContainer.appendChild(footerText);
|
|
8091
|
+
footerContainer.appendChild(clickToPayAllCards);
|
|
8092
|
+
this.buttonContainer.getElement().appendChild(container);
|
|
8093
|
+
this.eventEmitter.emit(EVENT$3.CHECKOUT_BUTTON_LOADED, {});
|
|
8094
|
+
}
|
|
8095
|
+
}, {
|
|
8096
|
+
key: 'getEnv',
|
|
8097
|
+
value: function getEnv() {
|
|
8098
|
+
return this.link.getEnv();
|
|
8099
|
+
}
|
|
8100
|
+
}, {
|
|
8101
|
+
key: 'hideButton',
|
|
8102
|
+
value: function hideButton(_saveSize) {
|
|
8103
|
+
if (this.buttonContainer.getElement()) this.buttonContainer.getElement().style['display'] = 'none';
|
|
8104
|
+
}
|
|
8105
|
+
}, {
|
|
8106
|
+
key: 'showButton',
|
|
8107
|
+
value: function showButton() {
|
|
8108
|
+
if (this.buttonContainer.getElement()) this.buttonContainer.getElement().style['display'] = 'block';
|
|
8109
|
+
}
|
|
8110
|
+
}, {
|
|
8111
|
+
key: 'hideCheckout',
|
|
8112
|
+
value: function hideCheckout(saveSize) {
|
|
8113
|
+
if (this.iFrame) this.iFrame.hide();
|
|
8114
|
+
}
|
|
8115
|
+
}, {
|
|
8116
|
+
key: 'showCheckout',
|
|
8117
|
+
value: function showCheckout() {
|
|
8118
|
+
if (this.iFrame) this.iFrame.show();
|
|
8119
|
+
}
|
|
8120
|
+
}, {
|
|
8121
|
+
key: 'reload',
|
|
8122
|
+
value: function reload() {
|
|
8123
|
+
this.iFrame.remove();
|
|
8124
|
+
this.load();
|
|
8125
|
+
}
|
|
8126
|
+
}, {
|
|
8127
|
+
key: 'useAutoResize',
|
|
8128
|
+
value: function useAutoResize(force) {
|
|
8129
|
+
var _this3 = this;
|
|
8130
|
+
|
|
8131
|
+
if (this.autoResize && !force) return;
|
|
8132
|
+
this.autoResize = true;
|
|
8133
|
+
this.iFrameEvent.on('resize', this.link.getParams().widget_id, function (_ref4) {
|
|
8134
|
+
var data = _ref4.data;
|
|
8135
|
+
|
|
8136
|
+
if (_this3.iFrame.getElement()) {
|
|
8137
|
+
_this3.iFrame.getElement().scrolling = 'no';
|
|
8138
|
+
if (data.height) _this3.iFrame.setStyle('height', data.height + 'px');
|
|
8139
|
+
}
|
|
8140
|
+
});
|
|
8141
|
+
}
|
|
8142
|
+
}]);
|
|
8143
|
+
return VisaSRC;
|
|
8144
|
+
}();
|
|
8145
|
+
|
|
8146
|
+
/**
|
|
8147
|
+
* Interface of data used for the Visa Checkout.
|
|
8148
|
+
* @interface IVisaSRCMeta
|
|
8149
|
+
*
|
|
8150
|
+
* @type {object}
|
|
8151
|
+
* @param {string} [srci_transaction_id] Used to identify the SRC Id.
|
|
8152
|
+
* @param {object} [dpa_data] Object where the DPA creation data is stored.
|
|
8153
|
+
* @param {string} [dpa_data.dpa_presentation_name] Name in which the DPA is presented in.
|
|
8154
|
+
* @param {string} [dpa_data.dpa_uri] Used for indicating the DPA URI.
|
|
8155
|
+
* @param {object} [dpa_transaction_options] Object that stores options for creating a trasaction with DPA.
|
|
8156
|
+
* @param {string} [dpa_transaction_options.dpa_locale] DPA’s preferred locale, example en_US.
|
|
8157
|
+
* @param {Array} [dpa_transaction_options.dpa_accepted_billing_countries] Used to indicate list of accepted billing countries for DPA.
|
|
8158
|
+
* @param {Array} [dpa_transaction_options.dpa_accepted_shipping_countries] Used to indicate list of accepted shipping countries for DPA.
|
|
8159
|
+
* @param {string} [dpa_transaction_options.dpa_billing_preference] Used for listing the enumeration for billing preferences for DPA. Options are 'ALL', 'POSTAL_COUNTRY' and 'NONE'.
|
|
8160
|
+
* @param {string} [dpa_transaction_options.dpa_shipping_preference] Used for listing the enumeration for shipping preferences for DPA. Options are 'ALL', 'POSTAL_COUNTRY' and 'NONE'.
|
|
8161
|
+
* @param {boolean} [dpa_transaction_options.consumer_name_requested] Used to check if the name of the consumer is needed.
|
|
8162
|
+
* @param {boolean} [dpa_transaction_options.consumer_email_address_requested] Used to check if the email of the consumer is needed.
|
|
8163
|
+
* @param {boolean} [dpa_transaction_options.consumer_phone_number_requested] Used to check if the phone number of the consumer is needed.
|
|
8164
|
+
* @param {object} [dpa_transaction_options.payment_options] Object used to check the payment options that are included.
|
|
8165
|
+
* @param {number} [dpa_transaction_options.payment_options.dpa_dynamic_data_ttl_minutes] The minimum requested validity period for the transaction credentials.
|
|
8166
|
+
* @param {string} [dpa_transaction_options.payment_options.dynamic_data_type] Used for listing the enumeration for dynamic data types. Options are 'TAVV' and 'DTVV'.
|
|
8167
|
+
* @param {boolean} [dpa_transaction_options.payment_options.dpa_pan_requested] Used to check if PAN number was requested.
|
|
8168
|
+
* @param {string} [dpa_transaction_options.review_action] Used for listing the enumeration of review actions. Options are 'pay' and 'continue'.
|
|
8169
|
+
* @param {string} [dpa_transaction_options.checkout_description] Used for indicating the description of the checkout.
|
|
8170
|
+
* @param {string} [dpa_transaction_options.transaction_type] Used for listing the enumeration of the type of the transaction. 'PURCHASE', 'BILL_PAYMENT' and 'MONEY_TRANSFER'
|
|
8171
|
+
* @param {string} [dpa_transaction_options.order_type] Used for listing the enumeration of the type of the order. Options are 'REAUTHORIZATION', 'RECURRING' and 'INSTALLMENT'.
|
|
8172
|
+
* @param {object} [dpa_transaction_options.transaction_amount] Object used to describe the details of the transaction.
|
|
8173
|
+
* @param {number} [dpa_transaction_options.transaction_amount.transaction_amount] Used to indicate the amount of the transaction.
|
|
8174
|
+
* @param {string} [dpa_transaction_options.transaction_amount.transaction_currency_code] Used to indicate the currency code of the transaction. 3 letter ISO code format.
|
|
8175
|
+
* @param {string} [dpa_transaction_options.merchant_order_id] Used to indicate the merchants order Id.
|
|
8176
|
+
* @param {string} [dpa_transaction_options.merchant_category_code] Used to indicate the merchants category code.
|
|
8177
|
+
* @param {string} [dpa_transaction_options.merchant_country_code] Used to indicate the merchants country code. 2 letter ISO code format.
|
|
8178
|
+
* @param {object} [customer] Object where the customer data is stored to prefill in the checkout.
|
|
8179
|
+
* @param {string} [customer.email] Customer email.
|
|
8180
|
+
* @param {string} [customer.first_name] Customer first name.
|
|
8181
|
+
* @param {string} [customer.last_name] Customer last name.
|
|
8182
|
+
* @param {object} [customer.phone] Object where the customer phone is stored.
|
|
8183
|
+
* @param {string} [customer.phone.country_code] Customer phone country code (example "1" for US).
|
|
8184
|
+
* @param {string} [customer.phone.phone] Customer phone number.
|
|
8185
|
+
* @param {object} [customer.payment_source] Object where the customer billing address data is stored.
|
|
8186
|
+
* @param {string} [customer.payment_source.address_line1] Customer billing address line 1.
|
|
8187
|
+
* @param {string} [customer.payment_source.address_line2] Customer billing address line 2.
|
|
8188
|
+
* @param {string} [customer.payment_source.address_city] Customer billing address city.
|
|
8189
|
+
* @param {string} [customer.payment_source.address_postcode] Customer billing address postcode.
|
|
8190
|
+
* @param {string} [customer.payment_source.address_state] Customer billing address state code (if applicable for the country, example "FL" for Florida).
|
|
8191
|
+
* @param {string} [customer.payment_source.address_country] Customer billing address country code (example "US").
|
|
8192
|
+
*
|
|
8193
|
+
*/
|
|
8194
|
+
/**
|
|
8195
|
+
* Class SRC include methods for interacting with different secure remote commerce options such as Visa SRC
|
|
8196
|
+
* @constructor
|
|
8197
|
+
*
|
|
8198
|
+
* @param {string} button_selector - Selector of html element. Container for SRC checkout button.
|
|
8199
|
+
* @param {string} iframe_selector - Selector of html element. Container for SRC checkout iFrame.
|
|
8200
|
+
* @param {string} service_id - Card Scheme Service ID
|
|
8201
|
+
* @param {string} public_key - Paydock public key
|
|
8202
|
+
* @param {IVisaSRCMeta} meta - Data that configures the SRC checkout
|
|
8203
|
+
* @example
|
|
8204
|
+
* var SRC = new SRC('#checkoutButton', '#checkoutIframe', 'service_id', 'public_key', {});
|
|
8205
|
+
*
|
|
8206
|
+
**/
|
|
8207
|
+
var SRC = function () {
|
|
8208
|
+
function SRC(button_selector, iframe_selector, service_id, public_key, meta) {
|
|
8209
|
+
classCallCheck(this, SRC);
|
|
8210
|
+
|
|
8211
|
+
this.button_selector = button_selector;
|
|
8212
|
+
this.iframe_selector = iframe_selector;
|
|
8213
|
+
this.service_id = service_id;
|
|
8214
|
+
this.public_key = public_key;
|
|
8215
|
+
this.meta = meta;
|
|
8216
|
+
this.autoResize = false;
|
|
8217
|
+
this.api = new ApiInternal(public_key, API_AUTH_TYPE.PUBLIC_KEY);
|
|
8218
|
+
this.eventEmitter = new EventEmitter();
|
|
8219
|
+
}
|
|
8220
|
+
/**
|
|
8221
|
+
* The final method after configuring the SRC to start the load process of SRC checkout
|
|
8222
|
+
*
|
|
8223
|
+
*/
|
|
8224
|
+
|
|
8225
|
+
|
|
8226
|
+
createClass(SRC, [{
|
|
8227
|
+
key: 'load',
|
|
8228
|
+
value: function load() {
|
|
8229
|
+
var _this = this;
|
|
8230
|
+
|
|
8231
|
+
if (this.provider) return;
|
|
8232
|
+
this.api.service().getConfig(this.service_id).then(function (_ref) {
|
|
8233
|
+
var type = _ref.type;
|
|
8234
|
+
|
|
8235
|
+
switch (type) {
|
|
8236
|
+
case CARD_SCHEME_SERVICE.VISA_SRC:
|
|
8237
|
+
_this.provider = new VisaSRC(_this.button_selector, _this.iframe_selector, _this.service_id, _this.public_key, _this.meta, _this.eventEmitter, _this.autoResize, _this.env, _this.alias);
|
|
8238
|
+
break;
|
|
8239
|
+
}
|
|
8240
|
+
if (_this.provider) _this.provider.load();
|
|
8241
|
+
});
|
|
8242
|
+
}
|
|
8243
|
+
/**
|
|
8244
|
+
* Current method can change environment. By default environment = sandbox.
|
|
8245
|
+
* Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
8246
|
+
*
|
|
8247
|
+
* @example
|
|
8248
|
+
* SRC.setEnv('production');
|
|
8249
|
+
* @param {string} env - sandbox, production
|
|
8250
|
+
* @param {string} [alias] - Own domain alias
|
|
8251
|
+
*/
|
|
8252
|
+
|
|
8253
|
+
}, {
|
|
8254
|
+
key: 'setEnv',
|
|
8255
|
+
value: function setEnv(env, alias) {
|
|
8256
|
+
if (this.provider) return;
|
|
8257
|
+
this.env = env;
|
|
8258
|
+
this.alias = alias;
|
|
8259
|
+
this.api.setEnv(env, alias);
|
|
8260
|
+
}
|
|
8261
|
+
/**
|
|
8262
|
+
* Method to read the current environment
|
|
8263
|
+
*
|
|
8264
|
+
* @example
|
|
8265
|
+
* SRC.getEnv();
|
|
8266
|
+
*/
|
|
8267
|
+
|
|
8268
|
+
}, {
|
|
8269
|
+
key: 'getEnv',
|
|
8270
|
+
value: function getEnv() {
|
|
8271
|
+
if (this.provider) return this.provider.getEnv();else return this.env;
|
|
8272
|
+
}
|
|
8273
|
+
/**
|
|
8274
|
+
* Listen to events of SRC
|
|
8275
|
+
*
|
|
8276
|
+
* @example
|
|
8277
|
+
*
|
|
8278
|
+
* SRC.on('checkoutCompleted', function (token) {
|
|
8279
|
+
* console.log(token);
|
|
8280
|
+
* });
|
|
8281
|
+
* // or
|
|
8282
|
+
* SRC.on('checkoutCompleted').then(function (token) {
|
|
8283
|
+
* console.log(token);
|
|
8284
|
+
* });
|
|
8285
|
+
* @param {string} eventName - Available event names [EVENT]{@link EVENT}
|
|
8286
|
+
* @param {listener} [cb]
|
|
8287
|
+
* @return {Promise<any> | void}
|
|
8288
|
+
*/
|
|
8289
|
+
|
|
8290
|
+
}, {
|
|
8291
|
+
key: 'on',
|
|
8292
|
+
value: function on(eventName, cb) {
|
|
8293
|
+
var _this2 = this;
|
|
8294
|
+
|
|
8295
|
+
if (typeof cb === "function") return this.eventEmitter.subscribe(eventName, cb);
|
|
8296
|
+
return new Promise(function (resolve) {
|
|
8297
|
+
return _this2.eventEmitter.subscribe(eventName, function (res) {
|
|
8298
|
+
return resolve(res);
|
|
8299
|
+
});
|
|
8300
|
+
});
|
|
8301
|
+
}
|
|
8302
|
+
/**
|
|
8303
|
+
* Using this method you can hide button
|
|
8304
|
+
* @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
|
|
8305
|
+
*
|
|
8306
|
+
* @example
|
|
8307
|
+
* SRC.hideButton();
|
|
8308
|
+
*/
|
|
8309
|
+
|
|
8310
|
+
}, {
|
|
8311
|
+
key: 'hideButton',
|
|
8312
|
+
value: function hideButton(saveSize) {
|
|
8313
|
+
if (this.provider && typeof this.provider.hideButton === 'function') this.provider.hideButton(saveSize);
|
|
8314
|
+
}
|
|
8315
|
+
/**
|
|
8316
|
+
* Using this method you can show the SRC button after using hideButton method
|
|
8317
|
+
*
|
|
8318
|
+
* @example
|
|
8319
|
+
* SRC.showButton();
|
|
8320
|
+
*/
|
|
8321
|
+
|
|
8322
|
+
}, {
|
|
8323
|
+
key: 'showButton',
|
|
8324
|
+
value: function showButton() {
|
|
8325
|
+
if (this.provider && typeof this.provider.showButton === 'function') this.provider.showButton();
|
|
8326
|
+
}
|
|
8327
|
+
/**
|
|
8328
|
+
* Using this method you can hide checkout after load and button click
|
|
8329
|
+
* @param {boolean} [saveSize=false] - using this param you can save iframe's size (if applicable)
|
|
8330
|
+
*
|
|
8331
|
+
* @example
|
|
8332
|
+
* SRC.hideCheckout();
|
|
8333
|
+
*/
|
|
8334
|
+
|
|
8335
|
+
}, {
|
|
8336
|
+
key: 'hideCheckout',
|
|
8337
|
+
value: function hideCheckout(saveSize) {
|
|
8338
|
+
if (this.provider && typeof this.provider.hideCheckout === 'function') this.provider.hideCheckout(saveSize);
|
|
8339
|
+
}
|
|
8340
|
+
/**
|
|
8341
|
+
* Using this method you can show checkout after using hideCheckout method
|
|
8342
|
+
*
|
|
8343
|
+
* @example
|
|
8344
|
+
* SRC.showCheckout()
|
|
8345
|
+
*/
|
|
8346
|
+
|
|
8347
|
+
}, {
|
|
8348
|
+
key: 'showCheckout',
|
|
8349
|
+
value: function showCheckout() {
|
|
8350
|
+
if (this.provider && typeof this.provider.showCheckout === 'function') this.provider.showCheckout();
|
|
8351
|
+
}
|
|
8352
|
+
/**
|
|
8353
|
+
* Using this method you can reload the whole checkout
|
|
8354
|
+
*
|
|
8355
|
+
* @example
|
|
8356
|
+
* SRC.reload()
|
|
8357
|
+
*/
|
|
8358
|
+
|
|
8359
|
+
}, {
|
|
8360
|
+
key: 'reload',
|
|
8361
|
+
value: function reload() {
|
|
8362
|
+
if (this.provider) this.provider.reload();
|
|
8363
|
+
}
|
|
8364
|
+
/**
|
|
8365
|
+
* Use this method for resize checkout iFrame according to content height, if applicable
|
|
8366
|
+
*
|
|
8367
|
+
* @example
|
|
8368
|
+
* SRC.useAutoResize();
|
|
8369
|
+
*
|
|
8370
|
+
*/
|
|
8371
|
+
|
|
8372
|
+
}, {
|
|
8373
|
+
key: 'useAutoResize',
|
|
8374
|
+
value: function useAutoResize() {
|
|
8375
|
+
this.autoResize = true;
|
|
8376
|
+
if (this.provider && typeof this.provider.useAutoResize === 'function') this.provider.useAutoResize();
|
|
8377
|
+
}
|
|
8378
|
+
}]);
|
|
8379
|
+
return SRC;
|
|
8380
|
+
}();
|
|
8381
|
+
|
|
7937
8382
|
exports.AfterpayCheckoutButton = AfterpayCheckoutButton;
|
|
7938
8383
|
exports.Api = Api;
|
|
7939
8384
|
exports.CHECKOUT_BUTTON_EVENT = CHECKOUT_BUTTON_EVENT;
|
|
@@ -7954,6 +8399,7 @@
|
|
|
7954
8399
|
exports.PaymentSourceBuilder = Builder$1;
|
|
7955
8400
|
exports.PaymentSourceWidget = PaymentSourceWidget;
|
|
7956
8401
|
exports.PaypalCheckoutButton = PaypalCheckoutButton;
|
|
8402
|
+
exports.SRC = SRC;
|
|
7957
8403
|
exports.STYLABLE_ELEMENT = STYLABLE_ELEMENT;
|
|
7958
8404
|
exports.STYLABLE_ELEMENT_STATE = STYLABLE_ELEMENT_STATE;
|
|
7959
8405
|
exports.STYLE = STYLE;
|