@paystack/inline-js 2.26.0-dev.6 → 2.26.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/inline.js +1 -2498
- package/es/inline.js +1 -2493
- package/lib/inline.js +1 -2495
- package/package.json +1 -1
package/lib/inline.js
CHANGED
|
@@ -1,2495 +1 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _arrayLikeToArray(r, a) {
|
|
4
|
-
(null == a || a > r.length) && (a = r.length);
|
|
5
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
6
|
-
return n;
|
|
7
|
-
}
|
|
8
|
-
function _arrayWithHoles(r) {
|
|
9
|
-
if (Array.isArray(r)) return r;
|
|
10
|
-
}
|
|
11
|
-
function _arrayWithoutHoles(r) {
|
|
12
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
13
|
-
}
|
|
14
|
-
function _classCallCheck(a, n) {
|
|
15
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
16
|
-
}
|
|
17
|
-
function _defineProperties(e, r) {
|
|
18
|
-
for (var t = 0; t < r.length; t++) {
|
|
19
|
-
var o = r[t];
|
|
20
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function _createClass(e, r, t) {
|
|
24
|
-
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
25
|
-
writable: !1
|
|
26
|
-
}), e;
|
|
27
|
-
}
|
|
28
|
-
function _defineProperty(e, r, t) {
|
|
29
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
30
|
-
value: t,
|
|
31
|
-
enumerable: !0,
|
|
32
|
-
configurable: !0,
|
|
33
|
-
writable: !0
|
|
34
|
-
}) : e[r] = t, e;
|
|
35
|
-
}
|
|
36
|
-
function _iterableToArray(r) {
|
|
37
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
38
|
-
}
|
|
39
|
-
function _iterableToArrayLimit(r, l) {
|
|
40
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
41
|
-
if (null != t) {
|
|
42
|
-
var e,
|
|
43
|
-
n,
|
|
44
|
-
i,
|
|
45
|
-
u,
|
|
46
|
-
a = [],
|
|
47
|
-
f = !0,
|
|
48
|
-
o = !1;
|
|
49
|
-
try {
|
|
50
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
51
|
-
if (Object(t) !== t) return;
|
|
52
|
-
f = !1;
|
|
53
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
54
|
-
} catch (r) {
|
|
55
|
-
o = !0, n = r;
|
|
56
|
-
} finally {
|
|
57
|
-
try {
|
|
58
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
59
|
-
} finally {
|
|
60
|
-
if (o) throw n;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return a;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function _nonIterableRest() {
|
|
67
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
68
|
-
}
|
|
69
|
-
function _nonIterableSpread() {
|
|
70
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
71
|
-
}
|
|
72
|
-
function ownKeys(e, r) {
|
|
73
|
-
var t = Object.keys(e);
|
|
74
|
-
if (Object.getOwnPropertySymbols) {
|
|
75
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
76
|
-
r && (o = o.filter(function (r) {
|
|
77
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
78
|
-
})), t.push.apply(t, o);
|
|
79
|
-
}
|
|
80
|
-
return t;
|
|
81
|
-
}
|
|
82
|
-
function _objectSpread2(e) {
|
|
83
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
84
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
85
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
86
|
-
_defineProperty(e, r, t[r]);
|
|
87
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
88
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return e;
|
|
92
|
-
}
|
|
93
|
-
function _objectWithoutProperties(e, t) {
|
|
94
|
-
if (null == e) return {};
|
|
95
|
-
var o,
|
|
96
|
-
r,
|
|
97
|
-
i = _objectWithoutPropertiesLoose(e, t);
|
|
98
|
-
if (Object.getOwnPropertySymbols) {
|
|
99
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
100
|
-
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
101
|
-
}
|
|
102
|
-
return i;
|
|
103
|
-
}
|
|
104
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
105
|
-
if (null == r) return {};
|
|
106
|
-
var t = {};
|
|
107
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
108
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
109
|
-
t[n] = r[n];
|
|
110
|
-
}
|
|
111
|
-
return t;
|
|
112
|
-
}
|
|
113
|
-
function _slicedToArray(r, e) {
|
|
114
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
115
|
-
}
|
|
116
|
-
function _toConsumableArray(r) {
|
|
117
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
118
|
-
}
|
|
119
|
-
function _toPrimitive(t, r) {
|
|
120
|
-
if ("object" != typeof t || !t) return t;
|
|
121
|
-
var e = t[Symbol.toPrimitive];
|
|
122
|
-
if (void 0 !== e) {
|
|
123
|
-
var i = e.call(t, r || "default");
|
|
124
|
-
if ("object" != typeof i) return i;
|
|
125
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
126
|
-
}
|
|
127
|
-
return ("string" === r ? String : Number)(t);
|
|
128
|
-
}
|
|
129
|
-
function _toPropertyKey(t) {
|
|
130
|
-
var i = _toPrimitive(t, "string");
|
|
131
|
-
return "symbol" == typeof i ? i : i + "";
|
|
132
|
-
}
|
|
133
|
-
function _typeof(o) {
|
|
134
|
-
"@babel/helpers - typeof";
|
|
135
|
-
|
|
136
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
137
|
-
return typeof o;
|
|
138
|
-
} : function (o) {
|
|
139
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
140
|
-
}, _typeof(o);
|
|
141
|
-
}
|
|
142
|
-
function _unsupportedIterableToArray(r, a) {
|
|
143
|
-
if (r) {
|
|
144
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
145
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
146
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
var baseConfig = {
|
|
151
|
-
cookieTestUrl: 'https://legacy-staging.paystack.co/test-iframe/start.html',
|
|
152
|
-
publishableKey: 'uFmz/uE/SDT6GupOrSEXIZXGByjQ0zFkPyc9LqKHFqnTI0WPN3JS5kQPo/j9or0TOXlqMQj2lzHn/UGsQT4XeQ==',
|
|
153
|
-
publicKey: '-----BEGIN PUBLIC KEY-----' + '\r\n' + 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALhZs/7hP0g0+hrqTq0hFyGVxgco0NMx' + '\r\n' + 'ZD8nPS6ihxap0yNFjzdyUuZED6P4/aK9Ezl5ajEI9pcx5/1BrEE+F3kCAwEAAQ==' + '\r\n' + '-----END PUBLIC KEY-----',
|
|
154
|
-
applePayVersion: 6,
|
|
155
|
-
applePayValidateSessionPath: 'applepay/validate-session/',
|
|
156
|
-
applePayChargePath: 'applepay/charge',
|
|
157
|
-
googlePayChargePath: 'googlepay/charge'
|
|
158
|
-
};
|
|
159
|
-
var devConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
160
|
-
environment: 'dev',
|
|
161
|
-
checkoutUrl: 'http://localhost:8081/',
|
|
162
|
-
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
163
|
-
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
164
|
-
siteUrl: 'https://paystack.com',
|
|
165
|
-
pusherKey: '1c7b262ee18455815893',
|
|
166
|
-
pusherUrl: 'http://localhost:8081/static/vendor/pusher.min.js'
|
|
167
|
-
});
|
|
168
|
-
var stagingConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
169
|
-
environment: 'staging',
|
|
170
|
-
checkoutUrl: 'https://checkout-studio.paystack.com/',
|
|
171
|
-
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
172
|
-
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
173
|
-
siteUrl: 'https://beta.paystack.com',
|
|
174
|
-
pusherKey: '1c7b262ee18455815893',
|
|
175
|
-
pusherUrl: 'https://checkout-studio.paystack.com/static/vendor/pusher.min.js'
|
|
176
|
-
});
|
|
177
|
-
var productionConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
178
|
-
environment: 'production',
|
|
179
|
-
checkoutUrl: 'https://checkout.paystack.com/',
|
|
180
|
-
paymentBaseUrl: 'https://standard.paystack.co/',
|
|
181
|
-
paystackApiUrl: 'https://api.paystack.co/',
|
|
182
|
-
siteUrl: 'https://paystack.com',
|
|
183
|
-
pusherKey: '8e4b9b7ca3418bd5cdc8',
|
|
184
|
-
pusherUrl: 'https://checkout.paystack.com/static/vendor/pusher.min.js'
|
|
185
|
-
});
|
|
186
|
-
var configurations = {
|
|
187
|
-
dev: devConfig,
|
|
188
|
-
staging: stagingConfig,
|
|
189
|
-
production: productionConfig
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
/* eslint-disable */
|
|
193
|
-
var config = configurations['staging'] || stagingConfig;
|
|
194
|
-
|
|
195
|
-
function randomId() {
|
|
196
|
-
var text = '';
|
|
197
|
-
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
198
|
-
for (var i = 0; i < 5; i += 1) {
|
|
199
|
-
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
|
200
|
-
}
|
|
201
|
-
return text;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function serialize(obj, prefix) {
|
|
205
|
-
var queryString = [];
|
|
206
|
-
Object.keys(obj).forEach(function (key) {
|
|
207
|
-
var updatedKey = prefix ? "".concat(prefix, "[").concat(key, "]") : key;
|
|
208
|
-
var value = obj[updatedKey];
|
|
209
|
-
queryString.push(value !== null && (typeof v === "undefined" ? "undefined" : _typeof(v)) === 'object' ? serialize(value, updatedKey) : "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value)));
|
|
210
|
-
});
|
|
211
|
-
return queryString.join('&');
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function parseResponse(message) {
|
|
215
|
-
var action = message && typeof message === 'string' ? message.split(' ')[0] : null;
|
|
216
|
-
var data = action ? message.split(' ').slice(2).join(' ') : null;
|
|
217
|
-
return {
|
|
218
|
-
action: action,
|
|
219
|
-
data: data
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function similarObjects(o1, o2) {
|
|
224
|
-
var equalKeys = Object.keys(o1).sort().join('') === Object.keys(o2).sort().join('');
|
|
225
|
-
var equalValues = Object.values(o1).sort().join('') === Object.values(o2).sort().join('');
|
|
226
|
-
return equalKeys && equalValues;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/* eslint-env browser */
|
|
230
|
-
function getLastScript() {
|
|
231
|
-
var scripts = document.getElementsByTagName('script');
|
|
232
|
-
return scripts[scripts.length - 1];
|
|
233
|
-
}
|
|
234
|
-
function getSourceScript() {
|
|
235
|
-
return document.currentScript || getLastScript();
|
|
236
|
-
}
|
|
237
|
-
function getDataAttributes() {
|
|
238
|
-
var dataAttributes = [];
|
|
239
|
-
var sourceScript = getSourceScript();
|
|
240
|
-
if (sourceScript) {
|
|
241
|
-
var attributes = Array.prototype.slice.call(sourceScript.attributes);
|
|
242
|
-
dataAttributes = Object.keys(attributes).filter(function (key) {
|
|
243
|
-
var element = attributes[key].nodeName;
|
|
244
|
-
return element && element.indexOf('data') > -1;
|
|
245
|
-
}).map(function (index) {
|
|
246
|
-
return attributes[index].nodeName;
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
return dataAttributes;
|
|
250
|
-
}
|
|
251
|
-
function scriptCanUseDataAttributes() {
|
|
252
|
-
var hasDataAttributes = getDataAttributes().length > 0;
|
|
253
|
-
var hasParentForm = getSourceScript() && getSourceScript().parentElement.tagName === 'FORM';
|
|
254
|
-
return hasDataAttributes && hasParentForm;
|
|
255
|
-
}
|
|
256
|
-
function getDataAttributesAsParameters() {
|
|
257
|
-
function convertToCamelCase(value) {
|
|
258
|
-
return value.replace(/-([a-z])/g, function (g) {
|
|
259
|
-
return g[1].toUpperCase();
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
function validateLazyParameters(parameters) {
|
|
263
|
-
if (parameters.buttonId && !document.getElementById(parameters.buttonId)) {
|
|
264
|
-
throw new Error('Please make sure the buttonId is an element available in the DOM');
|
|
265
|
-
}
|
|
266
|
-
var updatedParameters = _objectSpread2({}, parameters);
|
|
267
|
-
updatedParameters.buttonText = parameters.buttonText || 'Pay';
|
|
268
|
-
updatedParameters.buttonVariant = 'normal';
|
|
269
|
-
updatedParameters.buttonWordmarkVariant = 'normal';
|
|
270
|
-
var allowedVariants = ['normal', 'light'];
|
|
271
|
-
if (parameters.buttonVariant && allowedVariants.indexOf(parameters.buttonVariant) > -1) {
|
|
272
|
-
updatedParameters.buttonVariant = parameters.buttonVariant;
|
|
273
|
-
}
|
|
274
|
-
if (parameters.buttonWordmarkVariant && allowedVariants.indexOf(parameters.buttonWordmarkVariant) > -1) {
|
|
275
|
-
updatedParameters.buttonWordmarkVariant = parameters.buttonWordmarkVariant;
|
|
276
|
-
}
|
|
277
|
-
return updatedParameters;
|
|
278
|
-
}
|
|
279
|
-
var parameters = {};
|
|
280
|
-
var sourceScript = getSourceScript();
|
|
281
|
-
var dataAttributes = getDataAttributes();
|
|
282
|
-
dataAttributes.forEach(function (attribute) {
|
|
283
|
-
var attributeValue = sourceScript.getAttribute(attribute);
|
|
284
|
-
var attributeSplit = attribute.split('data-');
|
|
285
|
-
var attributeName = convertToCamelCase(attributeSplit[1]);
|
|
286
|
-
parameters[attributeName] = attributeValue;
|
|
287
|
-
});
|
|
288
|
-
return validateLazyParameters(parameters);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
var secureByPaystack = "\n <svg id=\"inline-button-wordmark\" width=\"137\" height=\"13\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M.037 5.095l1.075-.135c-.011-.774-.025-1.944-.013-2.149C1.19 1.364 2.38.134 3.81.013 3.9.006 3.99.002 4.077 0a2.947 2.947 0 0 1 2.046.76c.574.509.95 1.26 1.008 2.007.015.192.01 1.491.01 2.257l1.096.163L8.2 11.44 4.093 12 0 11.346l.037-6.251zm4.106-.514l1.724.256c-.007-.933-.05-2.295-.26-2.654-.319-.545-.846-.867-1.443-.88h-.063c-.607.008-1.138.322-1.458.864-.222.378-.266 1.66-.265 2.637l1.765-.223zM18.228 10.108c-.576 0-1.064-.072-1.464-.216a2.864 2.864 0 0 1-.972-.6 2.552 2.552 0 0 1-.588-.864 4.067 4.067 0 0 1-.252-1.044h1.008c.032.256.088.5.168.732.08.224.204.424.372.6.168.168.388.304.66.408.28.096.636.144 1.068.144.28 0 .536-.036.768-.108.24-.08.448-.192.624-.336.176-.144.312-.316.408-.516.104-.2.156-.42.156-.66 0-.24-.032-.448-.096-.624a1.02 1.02 0 0 0-.336-.468 1.885 1.885 0 0 0-.636-.324 6.4 6.4 0 0 0-1.008-.228 8.79 8.79 0 0 1-1.212-.276 3.246 3.246 0 0 1-.9-.432 1.982 1.982 0 0 1-.564-.672c-.128-.272-.192-.6-.192-.984 0-.328.068-.632.204-.912.136-.288.324-.536.564-.744.248-.208.54-.372.876-.492.336-.12.708-.18 1.116-.18.864 0 1.548.204 2.052.612.512.4.812.984.9 1.752h-.936c-.104-.544-.316-.932-.636-1.164-.32-.24-.78-.36-1.38-.36-.592 0-1.04.132-1.344.396a1.255 1.255 0 0 0-.444.996c0 .208.024.396.072.564.056.16.156.3.3.42.152.12.36.228.624.324a6.72 6.72 0 0 0 1.068.228c.48.072.9.168 1.26.288.36.12.664.276.912.468s.432.428.552.708c.128.28.192.624.192 1.032 0 .36-.076.696-.228 1.008a2.472 2.472 0 0 1-.612.804c-.264.224-.58.4-.948.528-.36.128-.752.192-1.176.192zM25.355 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM32.091 10.108c-.44 0-.848-.072-1.224-.216a3.054 3.054 0 0 1-.972-.636 3.12 3.12 0 0 1-.648-1.008 3.626 3.626 0 0 1-.228-1.32v-.096c0-.48.08-.916.24-1.308.16-.4.376-.74.648-1.02.28-.28.604-.496.972-.648.376-.16.772-.24 1.188-.24.328 0 .644.04.948.12.312.08.588.208.828.384.248.168.456.392.624.672.168.28.276.62.324 1.02h-.984c-.08-.496-.284-.848-.612-1.056-.32-.208-.696-.312-1.128-.312a1.93 1.93 0 0 0-.804.168c-.24.112-.452.272-.636.48a2.23 2.23 0 0 0-.42.744 2.991 2.991 0 0 0-.156.996v.096c0 .776.188 1.364.564 1.764.384.392.88.588 1.488.588.224 0 .436-.032.636-.096a1.651 1.651 0 0 0 .96-.768c.112-.192.18-.416.204-.672h.924a2.595 2.595 0 0 1-.276.948 2.386 2.386 0 0 1-.576.744c-.24.208-.52.372-.84.492-.32.12-.668.18-1.044.18zM38.335 10.108a2.83 2.83 0 0 1-.876-.132 1.724 1.724 0 0 1-.684-.42 2.145 2.145 0 0 1-.456-.756c-.112-.304-.168-.672-.168-1.104V3.724h.996v3.924c0 .552.116.956.348 1.212.24.256.608.384 1.104.384.224 0 .44-.036.648-.108.208-.072.392-.18.552-.324.16-.144.288-.324.384-.54.096-.216.144-.464.144-.744V3.724h.996V10h-.996v-.996c-.144.296-.388.556-.732.78-.336.216-.756.324-1.26.324zM43.216 3.724h.996v1.128c.2-.352.452-.64.756-.864.312-.232.748-.356 1.308-.372v.936a4.461 4.461 0 0 0-.852.12 1.647 1.647 0 0 0-.66.324 1.472 1.472 0 0 0-.408.612c-.096.248-.144.564-.144.948V10h-.996V3.724zM50 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM56.496 10.108c-.408 0-.788-.068-1.14-.204a2.683 2.683 0 0 1-.9-.612 3.01 3.01 0 0 1-.588-.984 4.01 4.01 0 0 1-.204-1.32v-.096c0-.48.072-.92.216-1.32.144-.4.344-.744.6-1.032.256-.296.564-.524.924-.684.36-.16.756-.24 1.188-.24.528 0 .956.112 1.284.336.328.216.584.476.768.78V.724h.996V10h-.996V8.92c-.088.152-.208.3-.36.444a2.792 2.792 0 0 1-.516.384 2.874 2.874 0 0 1-.6.252c-.216.072-.44.108-.672.108zm.108-.828c.288 0 .56-.048.816-.144.256-.096.476-.24.66-.432.184-.2.328-.448.432-.744.112-.304.168-.656.168-1.056v-.096c0-.808-.18-1.404-.54-1.788-.352-.384-.836-.576-1.452-.576-.624 0-1.112.208-1.464.624-.352.416-.528 1.008-.528 1.776v.096c0 .392.048.736.144 1.032.104.296.24.54.408.732.176.192.38.336.612.432.232.096.48.144.744.144zM67.712 10.108c-.512 0-.948-.112-1.308-.336a2.38 2.38 0 0 1-.816-.804V10h-.996V.724h.996V4.78a1.92 1.92 0 0 1 .348-.432c.152-.144.32-.268.504-.372.192-.112.396-.2.612-.264.216-.064.436-.096.66-.096.408 0 .788.072 1.14.216.352.144.652.352.9.624.256.272.456.604.6.996.144.392.216.832.216 1.32v.096c0 .48-.068.92-.204 1.32a3.103 3.103 0 0 1-.576 1.02 2.583 2.583 0 0 1-.9.672 2.937 2.937 0 0 1-1.176.228zm-.096-.828c.624 0 1.1-.2 1.428-.6.328-.408.492-.996.492-1.764V6.82c0-.4-.052-.748-.156-1.044a2.095 2.095 0 0 0-.42-.732 1.53 1.53 0 0 0-.612-.444 1.798 1.798 0 0 0-.744-.156c-.288 0-.56.048-.816.144a1.71 1.71 0 0 0-.648.444c-.184.192-.328.44-.432.744a3.152 3.152 0 0 0-.156 1.044v.096c0 .8.192 1.396.576 1.788.384.384.88.576 1.488.576zM73.63 9.352l-2.46-5.628h1.068l1.92 4.5 1.74-4.5h1.02l-3.468 8.46h-1.008l1.188-2.832zM87.127 3.669A3.138 3.138 0 0 0 86.1 2.95a3.09 3.09 0 0 0-1.228-.25c-.448 0-.848.086-1.187.26a2.199 2.199 0 0 0-.662.497v-.191a.387.387 0 0 0-.214-.348.323.323 0 0 0-.14-.03h-1.315a.314.314 0 0 0-.254.116.377.377 0 0 0-.1.262v8.97c0 .1.034.188.1.258a.34.34 0 0 0 .254.103h1.341a.342.342 0 0 0 .244-.103.336.336 0 0 0 .11-.259v-3.06c.178.202.417.357.702.464.35.134.72.203 1.093.203.43 0 .848-.082 1.242-.248a3.124 3.124 0 0 0 1.04-.724c.305-.326.545-.709.707-1.128a3.93 3.93 0 0 0 .263-1.477c0-.54-.086-1.037-.263-1.477a3.387 3.387 0 0 0-.706-1.12zm-1.204 3.24c-.073.19-.18.362-.315.51a1.415 1.415 0 0 1-1.065.466c-.2.001-.4-.04-.584-.12a1.484 1.484 0 0 1-.49-.346 1.593 1.593 0 0 1-.32-.51 1.738 1.738 0 0 1-.115-.63c0-.224.04-.435.115-.631a1.532 1.532 0 0 1 .804-.846c.185-.086.386-.13.59-.129.215 0 .414.044.593.13.177.083.338.199.474.341a1.622 1.622 0 0 1 .425 1.135c0 .225-.037.436-.112.63zM95.298 2.89h-1.33a.339.339 0 0 0-.246.11.384.384 0 0 0-.108.266v.166a1.856 1.856 0 0 0-.602-.472 2.525 2.525 0 0 0-1.166-.258 3.227 3.227 0 0 0-2.284.964 3.554 3.554 0 0 0-.734 1.123 3.827 3.827 0 0 0-.275 1.477c0 .54.092 1.037.275 1.477.184.434.427.817.728 1.128a3.146 3.146 0 0 0 2.277.973c.437 0 .834-.088 1.173-.259.25-.13.456-.287.608-.471v.177a.34.34 0 0 0 .11.259.341.341 0 0 0 .244.104h1.33a.324.324 0 0 0 .25-.105.349.349 0 0 0 .102-.258V3.267a.377.377 0 0 0-.1-.262.325.325 0 0 0-.252-.115zM93.502 6.9a1.55 1.55 0 0 1-.312.511c-.136.143-.296.26-.473.344-.178.085-.38.129-.596.129-.207 0-.407-.044-.59-.13a1.501 1.501 0 0 1-.791-.855 1.766 1.766 0 0 1-.112-.62c0-.225.038-.436.112-.632.075-.193.181-.364.314-.504.137-.143.3-.26.478-.342.182-.085.382-.129.59-.129.215 0 .417.044.595.13.178.085.338.2.473.341a1.623 1.623 0 0 1 .424 1.135c0 .215-.037.424-.112.622zM108.567 6.094a2.265 2.265 0 0 0-.654-.402c-.247-.101-.509-.181-.785-.235l-1.014-.204c-.26-.05-.441-.117-.543-.203a.328.328 0 0 1-.136-.264c0-.11.063-.2.189-.282.137-.086.329-.13.566-.13.26 0 .518.053.757.157.243.106.471.226.67.36.295.187.546.162.727-.053l.487-.57a.543.543 0 0 0 .152-.357c0-.128-.064-.245-.185-.351-.207-.184-.533-.378-.971-.568-.437-.192-.987-.29-1.637-.29-.427 0-.82.058-1.168.172-.35.116-.65.276-.893.474-.245.204-.438.44-.57.713a2 2 0 0 0-.198.875c0 .56.167 1.017.496 1.358.328.333.766.56 1.304.67l1.054.232c.3.062.528.132.675.21.129.067.19.163.19.297 0 .12-.061.227-.188.324-.133.104-.342.155-.622.155a1.83 1.83 0 0 1-.831-.19 3.056 3.056 0 0 1-.678-.458.995.995 0 0 0-.307-.17c-.126-.037-.268.003-.431.13l-.583.461c-.169.145-.24.32-.209.522.029.194.19.394.491.62.269.193.614.368 1.029.518.415.151.901.229 1.453.229.444 0 .854-.058 1.215-.172.362-.119.681-.278.941-.48a2.056 2.056 0 0 0 .819-1.663c0-.319-.053-.6-.165-.836a1.843 1.843 0 0 0-.447-.6zM114.383 7.73a.363.363 0 0 0-.295-.192.55.55 0 0 0-.343.113c-.095.062-.198.11-.306.141a.75.75 0 0 1-.426.013.43.43 0 0 1-.181-.093.554.554 0 0 1-.143-.204.92.92 0 0 1-.059-.362v-2.46h1.731c.099 0 .188-.04.266-.117a.368.368 0 0 0 .112-.26V3.268a.369.369 0 0 0-.115-.268.38.38 0 0 0-.263-.109h-1.732V1.216a.354.354 0 0 0-.108-.27.347.347 0 0 0-.243-.104h-1.344a.36.36 0 0 0-.34.226.371.371 0 0 0-.027.148V2.89h-.767a.324.324 0 0 0-.255.115.385.385 0 0 0-.098.262V4.31a.4.4 0 0 0 .212.346c.044.021.092.032.14.03h.768v2.925c0 .39.069.726.2 1.003.132.274.305.504.514.676.217.178.465.31.731.388.27.084.551.126.833.126.385 0 .75-.061 1.094-.18a2.13 2.13 0 0 0 .861-.552c.152-.181.17-.381.046-.581l-.463-.76zM121.672 2.89h-1.329a.339.339 0 0 0-.244.11.39.39 0 0 0-.08.122.394.394 0 0 0-.027.144v.166a1.906 1.906 0 0 0-.605-.472c-.335-.173-.726-.258-1.168-.258-.42 0-.834.083-1.226.249a3.24 3.24 0 0 0-1.055.715 3.528 3.528 0 0 0-.734 1.123 3.79 3.79 0 0 0-.276 1.477c0 .54.092 1.037.275 1.477.184.434.428.817.729 1.128a3.138 3.138 0 0 0 2.273.973 2.59 2.59 0 0 0 1.175-.259c.255-.13.457-.287.612-.471v.177a.34.34 0 0 0 .108.259.343.343 0 0 0 .243.104h1.329a.335.335 0 0 0 .252-.105.364.364 0 0 0 .102-.258V3.267a.38.38 0 0 0-.1-.262.332.332 0 0 0-.115-.087.311.311 0 0 0-.139-.028zM119.876 6.9a1.534 1.534 0 0 1-.786.855 1.362 1.362 0 0 1-.594.129c-.207 0-.405-.044-.588-.13a1.516 1.516 0 0 1-.792-.855 1.757 1.757 0 0 1-.113-.62c0-.225.037-.436.112-.632.073-.187.179-.358.314-.504.138-.143.3-.26.479-.342.184-.086.385-.13.588-.129.217 0 .415.044.594.13.181.085.34.2.472.341.134.143.24.313.314.504a1.73 1.73 0 0 1 0 1.253zM128.978 7.64l-.763-.593c-.146-.118-.284-.15-.404-.1a.742.742 0 0 0-.279.205 2.527 2.527 0 0 1-.583.535c-.192.122-.444.183-.742.183-.219 0-.42-.04-.6-.122a1.423 1.423 0 0 1-.469-.342 1.575 1.575 0 0 1-.308-.51 1.751 1.751 0 0 1-.106-.617c0-.228.034-.438.106-.632.07-.192.173-.363.308-.503.135-.144.295-.26.472-.342.187-.088.391-.132.597-.13.298 0 .547.064.742.187.198.126.396.306.584.534.078.092.17.16.278.206.122.048.259.016.401-.101l.762-.594a.53.53 0 0 0 .201-.269.437.437 0 0 0-.034-.365 3.329 3.329 0 0 0-1.18-1.127c-.504-.291-1.108-.441-1.784-.441a3.519 3.519 0 0 0-2.51 1.033c-.322.322-.576.71-.747 1.137a3.68 3.68 0 0 0-.273 1.407c0 .495.093.968.273 1.402.173.424.427.808.747 1.128a3.527 3.527 0 0 0 2.51 1.034c.676 0 1.28-.149 1.784-.444a3.286 3.286 0 0 0 1.182-1.13.411.411 0 0 0 .055-.173.415.415 0 0 0-.023-.182.624.624 0 0 0-.197-.273zM136.06 9.045l-2.104-3.143 1.801-2.415c.094-.139.119-.272.075-.397-.031-.09-.116-.2-.334-.2h-1.425a.52.52 0 0 0-.234.058.482.482 0 0 0-.209.205L132.191 5.2h-.349V.363a.37.37 0 0 0-.099-.26.352.352 0 0 0-.253-.103h-1.332a.37.37 0 0 0-.337.22.346.346 0 0 0-.027.143V9.29c0 .103.038.193.11.259a.353.353 0 0 0 .254.104h1.333a.328.328 0 0 0 .251-.105.346.346 0 0 0 .075-.119.333.333 0 0 0 .024-.14V6.927h.386l1.571 2.446c.112.187.267.281.46.281h1.491c.226 0 .32-.11.358-.202.054-.13.038-.262-.047-.406zM102.863 2.89h-1.489a.389.389 0 0 0-.298.122.544.544 0 0 0-.13.249l-1.099 4.167h-.268l-1.182-4.167a.66.66 0 0 0-.113-.247.329.329 0 0 0-.264-.124h-1.544c-.199 0-.325.066-.372.193a.588.588 0 0 0-.002.37l1.887 5.865c.03.093.08.17.145.232a.388.388 0 0 0 .281.104h.798l-.066.19-.19.547a.872.872 0 0 1-.29.426.7.7 0 0 1-.442.148.956.956 0 0 1-.4-.09 1.842 1.842 0 0 1-.35-.209.62.62 0 0 0-.335-.115h-.016c-.13 0-.243.074-.334.216l-.474.708c-.193.304-.086.504.039.615.234.224.528.399.875.524.344.125.723.186 1.126.186.682 0 1.252-.187 1.689-.565.435-.376.756-.887.952-1.524l2.188-7.258c.05-.155.05-.284.005-.389-.037-.08-.125-.174-.327-.174z\" fill=\"#011B33\"/>\n </svg>";
|
|
292
|
-
var secureByPaystackWhite = "\n <svg id=\"inline-button-wordmark--white\" width=\"137\" height=\"13\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M.037 5.095l1.075-.135c-.011-.774-.025-1.944-.013-2.149C1.19 1.364 2.38.134 3.81.013 3.9.006 3.99.002 4.077 0a2.947 2.947 0 0 1 2.046.76c.574.509.95 1.26 1.008 2.007.015.192.01 1.491.01 2.257l1.096.163L8.2 11.44 4.093 12 0 11.346l.037-6.251zm4.106-.514l1.724.256c-.007-.933-.05-2.295-.26-2.654-.319-.545-.846-.867-1.443-.88h-.063c-.607.008-1.138.322-1.458.864-.222.378-.266 1.66-.265 2.637l1.765-.223zM18.228 10.108c-.576 0-1.064-.072-1.464-.216a2.864 2.864 0 0 1-.972-.6 2.552 2.552 0 0 1-.588-.864 4.067 4.067 0 0 1-.252-1.044h1.008c.032.256.088.5.168.732.08.224.204.424.372.6.168.168.388.304.66.408.28.096.636.144 1.068.144.28 0 .536-.036.768-.108.24-.08.448-.192.624-.336.176-.144.312-.316.408-.516.104-.2.156-.42.156-.66 0-.24-.032-.448-.096-.624a1.02 1.02 0 0 0-.336-.468 1.885 1.885 0 0 0-.636-.324 6.4 6.4 0 0 0-1.008-.228 8.79 8.79 0 0 1-1.212-.276 3.246 3.246 0 0 1-.9-.432 1.982 1.982 0 0 1-.564-.672c-.128-.272-.192-.6-.192-.984 0-.328.068-.632.204-.912.136-.288.324-.536.564-.744.248-.208.54-.372.876-.492.336-.12.708-.18 1.116-.18.864 0 1.548.204 2.052.612.512.4.812.984.9 1.752h-.936c-.104-.544-.316-.932-.636-1.164-.32-.24-.78-.36-1.38-.36-.592 0-1.04.132-1.344.396a1.255 1.255 0 0 0-.444.996c0 .208.024.396.072.564.056.16.156.3.3.42.152.12.36.228.624.324a6.72 6.72 0 0 0 1.068.228c.48.072.9.168 1.26.288.36.12.664.276.912.468s.432.428.552.708c.128.28.192.624.192 1.032 0 .36-.076.696-.228 1.008a2.472 2.472 0 0 1-.612.804c-.264.224-.58.4-.948.528-.36.128-.752.192-1.176.192zM25.355 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM32.091 10.108c-.44 0-.848-.072-1.224-.216a3.054 3.054 0 0 1-.972-.636 3.12 3.12 0 0 1-.648-1.008 3.626 3.626 0 0 1-.228-1.32v-.096c0-.48.08-.916.24-1.308.16-.4.376-.74.648-1.02.28-.28.604-.496.972-.648.376-.16.772-.24 1.188-.24.328 0 .644.04.948.12.312.08.588.208.828.384.248.168.456.392.624.672.168.28.276.62.324 1.02h-.984c-.08-.496-.284-.848-.612-1.056-.32-.208-.696-.312-1.128-.312a1.93 1.93 0 0 0-.804.168c-.24.112-.452.272-.636.48a2.23 2.23 0 0 0-.42.744 2.991 2.991 0 0 0-.156.996v.096c0 .776.188 1.364.564 1.764.384.392.88.588 1.488.588.224 0 .436-.032.636-.096a1.651 1.651 0 0 0 .96-.768c.112-.192.18-.416.204-.672h.924a2.595 2.595 0 0 1-.276.948 2.386 2.386 0 0 1-.576.744c-.24.208-.52.372-.84.492-.32.12-.668.18-1.044.18zM38.335 10.108a2.83 2.83 0 0 1-.876-.132 1.724 1.724 0 0 1-.684-.42 2.145 2.145 0 0 1-.456-.756c-.112-.304-.168-.672-.168-1.104V3.724h.996v3.924c0 .552.116.956.348 1.212.24.256.608.384 1.104.384.224 0 .44-.036.648-.108.208-.072.392-.18.552-.324.16-.144.288-.324.384-.54.096-.216.144-.464.144-.744V3.724h.996V10h-.996v-.996c-.144.296-.388.556-.732.78-.336.216-.756.324-1.26.324zM43.216 3.724h.996v1.128c.2-.352.452-.64.756-.864.312-.232.748-.356 1.308-.372v.936a4.461 4.461 0 0 0-.852.12 1.647 1.647 0 0 0-.66.324 1.472 1.472 0 0 0-.408.612c-.096.248-.144.564-.144.948V10h-.996V3.724zM50 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM56.496 10.108c-.408 0-.788-.068-1.14-.204a2.683 2.683 0 0 1-.9-.612 3.01 3.01 0 0 1-.588-.984 4.01 4.01 0 0 1-.204-1.32v-.096c0-.48.072-.92.216-1.32.144-.4.344-.744.6-1.032.256-.296.564-.524.924-.684.36-.16.756-.24 1.188-.24.528 0 .956.112 1.284.336.328.216.584.476.768.78V.724h.996V10h-.996V8.92c-.088.152-.208.3-.36.444a2.792 2.792 0 0 1-.516.384 2.874 2.874 0 0 1-.6.252c-.216.072-.44.108-.672.108zm.108-.828c.288 0 .56-.048.816-.144.256-.096.476-.24.66-.432.184-.2.328-.448.432-.744.112-.304.168-.656.168-1.056v-.096c0-.808-.18-1.404-.54-1.788-.352-.384-.836-.576-1.452-.576-.624 0-1.112.208-1.464.624-.352.416-.528 1.008-.528 1.776v.096c0 .392.048.736.144 1.032.104.296.24.54.408.732.176.192.38.336.612.432.232.096.48.144.744.144zM67.712 10.108c-.512 0-.948-.112-1.308-.336a2.38 2.38 0 0 1-.816-.804V10h-.996V.724h.996V4.78a1.92 1.92 0 0 1 .348-.432c.152-.144.32-.268.504-.372.192-.112.396-.2.612-.264.216-.064.436-.096.66-.096.408 0 .788.072 1.14.216.352.144.652.352.9.624.256.272.456.604.6.996.144.392.216.832.216 1.32v.096c0 .48-.068.92-.204 1.32a3.103 3.103 0 0 1-.576 1.02 2.583 2.583 0 0 1-.9.672 2.937 2.937 0 0 1-1.176.228zm-.096-.828c.624 0 1.1-.2 1.428-.6.328-.408.492-.996.492-1.764V6.82c0-.4-.052-.748-.156-1.044a2.095 2.095 0 0 0-.42-.732 1.53 1.53 0 0 0-.612-.444 1.798 1.798 0 0 0-.744-.156c-.288 0-.56.048-.816.144a1.71 1.71 0 0 0-.648.444c-.184.192-.328.44-.432.744a3.152 3.152 0 0 0-.156 1.044v.096c0 .8.192 1.396.576 1.788.384.384.88.576 1.488.576zM73.63 9.352l-2.46-5.628h1.068l1.92 4.5 1.74-4.5h1.02l-3.468 8.46h-1.008l1.188-2.832zM87.127 3.669A3.138 3.138 0 0 0 86.1 2.95a3.09 3.09 0 0 0-1.228-.25c-.448 0-.848.086-1.187.26a2.199 2.199 0 0 0-.662.497v-.191a.387.387 0 0 0-.214-.348.323.323 0 0 0-.14-.03h-1.315a.314.314 0 0 0-.254.116.377.377 0 0 0-.1.262v8.97c0 .1.034.188.1.258a.34.34 0 0 0 .254.103h1.341a.342.342 0 0 0 .244-.103.336.336 0 0 0 .11-.259v-3.06c.178.202.417.357.702.464.35.134.72.203 1.093.203.43 0 .848-.082 1.242-.248a3.124 3.124 0 0 0 1.04-.724c.305-.326.545-.709.707-1.128a3.93 3.93 0 0 0 .263-1.477c0-.54-.086-1.037-.263-1.477a3.387 3.387 0 0 0-.706-1.12zm-1.204 3.24c-.073.19-.18.362-.315.51a1.415 1.415 0 0 1-1.065.466c-.2.001-.4-.04-.584-.12a1.484 1.484 0 0 1-.49-.346 1.593 1.593 0 0 1-.32-.51 1.738 1.738 0 0 1-.115-.63c0-.224.04-.435.115-.631a1.532 1.532 0 0 1 .804-.846c.185-.086.386-.13.59-.129.215 0 .414.044.593.13.177.083.338.199.474.341a1.622 1.622 0 0 1 .425 1.135c0 .225-.037.436-.112.63zM95.298 2.89h-1.33a.339.339 0 0 0-.246.11.384.384 0 0 0-.108.266v.166a1.856 1.856 0 0 0-.602-.472 2.525 2.525 0 0 0-1.166-.258 3.227 3.227 0 0 0-2.284.964 3.554 3.554 0 0 0-.734 1.123 3.827 3.827 0 0 0-.275 1.477c0 .54.092 1.037.275 1.477.184.434.427.817.728 1.128a3.146 3.146 0 0 0 2.277.973c.437 0 .834-.088 1.173-.259.25-.13.456-.287.608-.471v.177a.34.34 0 0 0 .11.259.341.341 0 0 0 .244.104h1.33a.324.324 0 0 0 .25-.105.349.349 0 0 0 .102-.258V3.267a.377.377 0 0 0-.1-.262.325.325 0 0 0-.252-.115zM93.502 6.9a1.55 1.55 0 0 1-.312.511c-.136.143-.296.26-.473.344-.178.085-.38.129-.596.129-.207 0-.407-.044-.59-.13a1.501 1.501 0 0 1-.791-.855 1.766 1.766 0 0 1-.112-.62c0-.225.038-.436.112-.632.075-.193.181-.364.314-.504.137-.143.3-.26.478-.342.182-.085.382-.129.59-.129.215 0 .417.044.595.13.178.085.338.2.473.341a1.623 1.623 0 0 1 .424 1.135c0 .215-.037.424-.112.622zM108.567 6.094a2.265 2.265 0 0 0-.654-.402c-.247-.101-.509-.181-.785-.235l-1.014-.204c-.26-.05-.441-.117-.543-.203a.328.328 0 0 1-.136-.264c0-.11.063-.2.189-.282.137-.086.329-.13.566-.13.26 0 .518.053.757.157.243.106.471.226.67.36.295.187.546.162.727-.053l.487-.57a.543.543 0 0 0 .152-.357c0-.128-.064-.245-.185-.351-.207-.184-.533-.378-.971-.568-.437-.192-.987-.29-1.637-.29-.427 0-.82.058-1.168.172-.35.116-.65.276-.893.474-.245.204-.438.44-.57.713a2 2 0 0 0-.198.875c0 .56.167 1.017.496 1.358.328.333.766.56 1.304.67l1.054.232c.3.062.528.132.675.21.129.067.19.163.19.297 0 .12-.061.227-.188.324-.133.104-.342.155-.622.155a1.83 1.83 0 0 1-.831-.19 3.056 3.056 0 0 1-.678-.458.995.995 0 0 0-.307-.17c-.126-.037-.268.003-.431.13l-.583.461c-.169.145-.24.32-.209.522.029.194.19.394.491.62.269.193.614.368 1.029.518.415.151.901.229 1.453.229.444 0 .854-.058 1.215-.172.362-.119.681-.278.941-.48a2.056 2.056 0 0 0 .819-1.663c0-.319-.053-.6-.165-.836a1.843 1.843 0 0 0-.447-.6zM114.383 7.73a.363.363 0 0 0-.295-.192.55.55 0 0 0-.343.113c-.095.062-.198.11-.306.141a.75.75 0 0 1-.426.013.43.43 0 0 1-.181-.093.554.554 0 0 1-.143-.204.92.92 0 0 1-.059-.362v-2.46h1.731c.099 0 .188-.04.266-.117a.368.368 0 0 0 .112-.26V3.268a.369.369 0 0 0-.115-.268.38.38 0 0 0-.263-.109h-1.732V1.216a.354.354 0 0 0-.108-.27.347.347 0 0 0-.243-.104h-1.344a.36.36 0 0 0-.34.226.371.371 0 0 0-.027.148V2.89h-.767a.324.324 0 0 0-.255.115.385.385 0 0 0-.098.262V4.31a.4.4 0 0 0 .212.346c.044.021.092.032.14.03h.768v2.925c0 .39.069.726.2 1.003.132.274.305.504.514.676.217.178.465.31.731.388.27.084.551.126.833.126.385 0 .75-.061 1.094-.18a2.13 2.13 0 0 0 .861-.552c.152-.181.17-.381.046-.581l-.463-.76zM121.672 2.89h-1.329a.339.339 0 0 0-.244.11.39.39 0 0 0-.08.122.394.394 0 0 0-.027.144v.166a1.906 1.906 0 0 0-.605-.472c-.335-.173-.726-.258-1.168-.258-.42 0-.834.083-1.226.249a3.24 3.24 0 0 0-1.055.715 3.528 3.528 0 0 0-.734 1.123 3.79 3.79 0 0 0-.276 1.477c0 .54.092 1.037.275 1.477.184.434.428.817.729 1.128a3.138 3.138 0 0 0 2.273.973 2.59 2.59 0 0 0 1.175-.259c.255-.13.457-.287.612-.471v.177a.34.34 0 0 0 .108.259.343.343 0 0 0 .243.104h1.329a.335.335 0 0 0 .252-.105.364.364 0 0 0 .102-.258V3.267a.38.38 0 0 0-.1-.262.332.332 0 0 0-.115-.087.311.311 0 0 0-.139-.028zM119.876 6.9a1.534 1.534 0 0 1-.786.855 1.362 1.362 0 0 1-.594.129c-.207 0-.405-.044-.588-.13a1.516 1.516 0 0 1-.792-.855 1.757 1.757 0 0 1-.113-.62c0-.225.037-.436.112-.632.073-.187.179-.358.314-.504.138-.143.3-.26.479-.342.184-.086.385-.13.588-.129.217 0 .415.044.594.13.181.085.34.2.472.341.134.143.24.313.314.504a1.73 1.73 0 0 1 0 1.253zM128.978 7.64l-.763-.593c-.146-.118-.284-.15-.404-.1a.742.742 0 0 0-.279.205 2.527 2.527 0 0 1-.583.535c-.192.122-.444.183-.742.183-.219 0-.42-.04-.6-.122a1.423 1.423 0 0 1-.469-.342 1.575 1.575 0 0 1-.308-.51 1.751 1.751 0 0 1-.106-.617c0-.228.034-.438.106-.632.07-.192.173-.363.308-.503.135-.144.295-.26.472-.342.187-.088.391-.132.597-.13.298 0 .547.064.742.187.198.126.396.306.584.534.078.092.17.16.278.206.122.048.259.016.401-.101l.762-.594a.53.53 0 0 0 .201-.269.437.437 0 0 0-.034-.365 3.329 3.329 0 0 0-1.18-1.127c-.504-.291-1.108-.441-1.784-.441a3.519 3.519 0 0 0-2.51 1.033c-.322.322-.576.71-.747 1.137a3.68 3.68 0 0 0-.273 1.407c0 .495.093.968.273 1.402.173.424.427.808.747 1.128a3.527 3.527 0 0 0 2.51 1.034c.676 0 1.28-.149 1.784-.444a3.286 3.286 0 0 0 1.182-1.13.411.411 0 0 0 .055-.173.415.415 0 0 0-.023-.182.624.624 0 0 0-.197-.273zM136.06 9.045l-2.104-3.143 1.801-2.415c.094-.139.119-.272.075-.397-.031-.09-.116-.2-.334-.2h-1.425a.52.52 0 0 0-.234.058.482.482 0 0 0-.209.205L132.191 5.2h-.349V.363a.37.37 0 0 0-.099-.26.352.352 0 0 0-.253-.103h-1.332a.37.37 0 0 0-.337.22.346.346 0 0 0-.027.143V9.29c0 .103.038.193.11.259a.353.353 0 0 0 .254.104h1.333a.328.328 0 0 0 .251-.105.346.346 0 0 0 .075-.119.333.333 0 0 0 .024-.14V6.927h.386l1.571 2.446c.112.187.267.281.46.281h1.491c.226 0 .32-.11.358-.202.054-.13.038-.262-.047-.406zM102.863 2.89h-1.489a.389.389 0 0 0-.298.122.544.544 0 0 0-.13.249l-1.099 4.167h-.268l-1.182-4.167a.66.66 0 0 0-.113-.247.329.329 0 0 0-.264-.124h-1.544c-.199 0-.325.066-.372.193a.588.588 0 0 0-.002.37l1.887 5.865c.03.093.08.17.145.232a.388.388 0 0 0 .281.104h.798l-.066.19-.19.547a.872.872 0 0 1-.29.426.7.7 0 0 1-.442.148.956.956 0 0 1-.4-.09 1.842 1.842 0 0 1-.35-.209.62.62 0 0 0-.335-.115h-.016c-.13 0-.243.074-.334.216l-.474.708c-.193.304-.086.504.039.615.234.224.528.399.875.524.344.125.723.186 1.126.186.682 0 1.252-.187 1.689-.565.435-.376.756-.887.952-1.524l2.188-7.258c.05-.155.05-.284.005-.389-.037-.08-.125-.174-.327-.174z\" fill=\"#ffffff\"/>\n </svg>\n";
|
|
293
|
-
|
|
294
|
-
var APPLE_PAY_SDK_SOURCE = 'https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js';
|
|
295
|
-
var APPLE_PAY_SDK_INTEGRITY_HASH = 'sha384-z/6BVHCcSypLSykOVpaT1PQWHOOgU45uOOlMkgi/bElX4yFqmChNMb7qiv80wFav';
|
|
296
|
-
var GOOGLE_PAY_SDK_SOURCE = 'https://pay.google.com/gp/p/js/pay.js';
|
|
297
|
-
var PAYMENT_REQUEST_BUTTON_HEIGHT = '50px';
|
|
298
|
-
var GOOGLE_PAY_BUTTON_RADIUS = 3;
|
|
299
|
-
var PAYMENT_REQUEST_BUTTON_ORIENTATION = {
|
|
300
|
-
HORIZONTAL: 'horizontal',
|
|
301
|
-
VERTICAL: 'vertical'
|
|
302
|
-
};
|
|
303
|
-
var PAYMENT_REQUEST_BUTTON_THEME = {
|
|
304
|
-
LIGHT: 'light',
|
|
305
|
-
DARK: 'dark'
|
|
306
|
-
};
|
|
307
|
-
var CHANNELS = {
|
|
308
|
-
APPLE_PAY: 'apple_pay',
|
|
309
|
-
GOOGLE_PAY: 'google_pay'
|
|
310
|
-
};
|
|
311
|
-
var TRANSACTION_STATUS = {
|
|
312
|
-
SUCCESS: 'success',
|
|
313
|
-
FAILED: 'failed',
|
|
314
|
-
AUTH: 'auth'
|
|
315
|
-
};
|
|
316
|
-
var TRANSACTION_DOMAIN = {
|
|
317
|
-
TEST: 'test',
|
|
318
|
-
LIVE: 'live'
|
|
319
|
-
};
|
|
320
|
-
var ENVIRONMENT = {
|
|
321
|
-
DEV: 'dev',
|
|
322
|
-
STAGING: 'staging',
|
|
323
|
-
PRODUCTION: 'production'
|
|
324
|
-
};
|
|
325
|
-
var GOOGLE_PAY_STATUS_CODE = {
|
|
326
|
-
CANCELED: 'CANCELED',
|
|
327
|
-
DEVELOPER_ERROR: 'DEVELOPER_ERROR',
|
|
328
|
-
MERCHANT_ACCOUNT_ERROR: 'MERCHANT_ACCOUNT_ERROR'
|
|
329
|
-
};
|
|
330
|
-
var GOOGLE_PAY_TIMEOUT_MS = 10000;
|
|
331
|
-
var COUNTRYCODE = {
|
|
332
|
-
COTE_D_IVOIRE: 'CI',
|
|
333
|
-
GHANA: 'GH',
|
|
334
|
-
KENYA: 'KE',
|
|
335
|
-
NIGERIA: 'NG',
|
|
336
|
-
SOUTH_AFRICA: 'ZA',
|
|
337
|
-
EGYPT: 'EG'
|
|
338
|
-
};
|
|
339
|
-
var CURRENCY_COUNTRYCODE_MAPPING = {
|
|
340
|
-
XOF: COUNTRYCODE.COTE_D_IVOIRE,
|
|
341
|
-
GHS: COUNTRYCODE.GHANA,
|
|
342
|
-
KES: COUNTRYCODE.KENYA,
|
|
343
|
-
NGN: COUNTRYCODE.NIGERIA,
|
|
344
|
-
ZAR: COUNTRYCODE.SOUTH_AFRICA,
|
|
345
|
-
EGP: COUNTRYCODE.EGYPT
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
var loaderHTML = "\n <!DOCTYPE html>\n <html lang=\"en\">\n\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">\n <title>Paystack Popup Loader</title>\n <style>\n .app-loader {\n margin: 200px 0;\n text-align: center;\n color: white;\n }\n @keyframes app-loader__spinner {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n @-webkit-keyframes app-loader__spinner {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n .app-loader__spinner {\n position: relative;\n display: inline-block;\n }\n .app-loader__spinner div {\n left: 95px;\n top: 35px;\n position: absolute;\n -webkit-animation: app-loader__spinner linear 1s infinite;\n animation: app-loader__spinner linear 1s infinite;\n background: white;\n width: 10px;\n height: 30px;\n border-radius: 40%;\n -webkit-transform-origin: 5px 65px;\n transform-origin: 5px 65px;\n }\n .app-loader__spinner div:nth-child(1) {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n -webkit-animation-delay: -0.916666666666667s;\n animation-delay: -0.916666666666667s;\n }\n .app-loader__spinner div:nth-child(2) {\n -webkit-transform: rotate(30deg);\n transform: rotate(30deg);\n -webkit-animation-delay: -0.833333333333333s;\n animation-delay: -0.833333333333333s;\n }\n .app-loader__spinner div:nth-child(3) {\n -webkit-transform: rotate(60deg);\n transform: rotate(60deg);\n -webkit-animation-delay: -0.75s;\n animation-delay: -0.75s;\n }\n .app-loader__spinner div:nth-child(4) {\n -webkit-transform: rotate(90deg);\n transform: rotate(90deg);\n -webkit-animation-delay: -0.666666666666667s;\n animation-delay: -0.666666666666667s;\n }\n .app-loader__spinner div:nth-child(5) {\n -webkit-transform: rotate(120deg);\n transform: rotate(120deg);\n -webkit-animation-delay: -0.583333333333333s;\n animation-delay: -0.583333333333333s;\n }\n .app-loader__spinner div:nth-child(6) {\n -webkit-transform: rotate(150deg);\n transform: rotate(150deg);\n -webkit-animation-delay: -0.5s;\n animation-delay: -0.5s;\n }\n .app-loader__spinner div:nth-child(7) {\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n -webkit-animation-delay: -0.416666666666667s;\n animation-delay: -0.416666666666667s;\n }\n .app-loader__spinner div:nth-child(8) {\n -webkit-transform: rotate(210deg);\n transform: rotate(210deg);\n -webkit-animation-delay: -0.333333333333333s;\n animation-delay: -0.333333333333333s;\n }\n .app-loader__spinner div:nth-child(9) {\n -webkit-transform: rotate(240deg);\n transform: rotate(240deg);\n -webkit-animation-delay: -0.25s;\n animation-delay: -0.25s;\n }\n .app-loader__spinner div:nth-child(10) {\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg);\n -webkit-animation-delay: -0.166666666666667s;\n animation-delay: -0.166666666666667s;\n }\n .app-loader__spinner div:nth-child(11) {\n -webkit-transform: rotate(300deg);\n transform: rotate(300deg);\n -webkit-animation-delay: -0.083333333333333s;\n animation-delay: -0.083333333333333s;\n }\n .app-loader__spinner div:nth-child(12) {\n -webkit-transform: rotate(330deg);\n transform: rotate(330deg);\n -webkit-animation-delay: 0s;\n animation-delay: 0s;\n }\n .app-loader__spinner {\n width: 40px;\n height: 40px;\n -webkit-transform: translate(-20px, -20px) scale(0.2) translate(20px, 20px);\n transform: translate(-20px, -20px) scale(0.2) translate(20px, 20px);\n }\n </style>\n </head>\n\n <body>\n <div id=\"app-loader\" class=\"app-loader\">\n <div id=\"spinner\" class=\"app-loader__spinner\">\n <div></div><div></div><div></div><div></div><div></div><div></div><div>\n </div><div></div><div></div><div></div><div></div><div></div>\n </div>\n </div>\n </body>\n\n </html>\n";
|
|
349
|
-
var backgroundCSS = "\n z-index: 999999999999999;\n background: transparent;\n background: rgba(0, 0, 0, 0.75);\n border: 0px none transparent;\n overflow-x: hidden;\n overflow-y: hidden;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n transition: opacity 0.3s;\n -webkit-transition: opacity 0.3s;\n visibility: hidden;\n display: none;\n";
|
|
350
|
-
var checkoutCSS = "\n z-index: 999999999999999;\n background: transparent;\n border: 0px none transparent;\n overflow-x: hidden;\n overflow-y: hidden;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n visibility: hidden;\n display: none;\n height: 100%;\n";
|
|
351
|
-
var embedCSS = "\n background: transparent;\n background: rgba(0,0,0,0);\n border: 0px none transparent;\n overflow-x: hidden;\n overflow-y: hidden;\n nmargin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n visibility: hidden;\n display: none;\n";
|
|
352
|
-
function generateInlineButtonCSS(variant) {
|
|
353
|
-
var baseCSS = "\n box-sizing: border-box;\n display: inline-block;\n line-height: 1;\n white-space: nowrap;\n margin: 0 0 10px;\n text-align: center;\n -webkit-appearance: none;\n outline: none;\n font-size: 14px;\n font-weight: 600;\n border-radius: 6px;\n cursor: pointer;\n padding: 16px 24px;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.15);\n transition: all .3s ease;\n border: none;\n min-width: 190px;\n ";
|
|
354
|
-
var greenCSS = "\n background: linear-gradient(180deg,#44b669 0,#40ad57);\n text-shadow: 1px 1px 1px rgba(0,0,0,.1);\n color: #ffffff;\n ";
|
|
355
|
-
var whiteCSS = "\n background: white;\n text-shadow: none;\n color: #011b33;\n ";
|
|
356
|
-
var colorVariants = {
|
|
357
|
-
normal: greenCSS,
|
|
358
|
-
light: whiteCSS
|
|
359
|
-
};
|
|
360
|
-
return "".concat(baseCSS).concat(colorVariants[variant]);
|
|
361
|
-
}
|
|
362
|
-
function generateInlineButtonHTML(options) {
|
|
363
|
-
var wordmarkVariants = {
|
|
364
|
-
normal: secureByPaystack,
|
|
365
|
-
light: secureByPaystackWhite
|
|
366
|
-
};
|
|
367
|
-
var buttonHTML = "\n <style>\n #inline-button-".concat(options.inlineId, " {\n position: relative;\n text-align: center;\n display: inline-block;\n }\n #inline-button-").concat(options.inlineId, "__trigger {\n ").concat(generateInlineButtonCSS(options.variant || 'normal'), "\n }\n #inline-button-").concat(options.inlineId, "__trigger:hover {\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.2);\n }\n #inline-button-").concat(options.inlineId, "__trigger:active {\n transform: translateY(3px);\n }\n </style>\n <button id=\"inline-button-").concat(options.inlineId, "__trigger\" data-inline-id=\"").concat(options.inlineId, "\">").concat(options.text || 'Pay', " ").concat(options.currency || 'NGN', " ").concat(options.amount, "</button>\n <div id=\"inline-button-").concat(options.inlineId, "__wordmark\">\n ").concat(wordmarkVariants[options.wordmarkVariant || 'normal'], "\n </div>\n ");
|
|
368
|
-
return buttonHTML;
|
|
369
|
-
}
|
|
370
|
-
var defaultCustomApplePayStyles = {
|
|
371
|
-
height: PAYMENT_REQUEST_BUTTON_HEIGHT,
|
|
372
|
-
width: 'auto',
|
|
373
|
-
borderRadius: '3px',
|
|
374
|
-
padding: '10px',
|
|
375
|
-
locale: 'en',
|
|
376
|
-
type: 'pay'
|
|
377
|
-
};
|
|
378
|
-
var parseApplePayCustomStyles = function parseApplePayCustomStyles(styles) {
|
|
379
|
-
if (!(styles && _typeof(styles) === 'object')) {
|
|
380
|
-
return defaultCustomApplePayStyles;
|
|
381
|
-
}
|
|
382
|
-
var customStyles = Object.keys(defaultCustomApplePayStyles).reduce(function (newDefaultStyles, key) {
|
|
383
|
-
return _objectSpread2(_objectSpread2({}, newDefaultStyles), {}, _defineProperty({}, key, styles[key] || defaultCustomApplePayStyles[key]));
|
|
384
|
-
}, {});
|
|
385
|
-
return customStyles;
|
|
386
|
-
};
|
|
387
|
-
var generateApplePayCSS = function generateApplePayCSS(_ref) {
|
|
388
|
-
var height = _ref.height,
|
|
389
|
-
width = _ref.width,
|
|
390
|
-
borderRadius = _ref.borderRadius,
|
|
391
|
-
padding = _ref.padding;
|
|
392
|
-
return "\n apple-pay-button {\n --apple-pay-button-width: ".concat(width, ";\n --apple-pay-button-height: ").concat(height, ";\n --apple-pay-button-border-radius: ").concat(borderRadius, ";\n --apple-pay-button-padding: ").concat(padding, ";\n --apple-pay-button-box-sizing: border-box;\n width: ").concat(width, ";\n }\n");
|
|
393
|
-
};
|
|
394
|
-
var generateApplePayFallbackCSS = function generateApplePayFallbackCSS(_ref2) {
|
|
395
|
-
var height = _ref2.height,
|
|
396
|
-
width = _ref2.width,
|
|
397
|
-
borderRadius = _ref2.borderRadius,
|
|
398
|
-
padding = _ref2.padding,
|
|
399
|
-
type = _ref2.type,
|
|
400
|
-
locale = _ref2.locale;
|
|
401
|
-
return "\n @supports (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n width: ".concat(width, ";\n height: ").concat(height, ";\n border-radius: ").concat(borderRadius, ";\n padding: ").concat(padding, ";\n -apple-pay-button-type: ").concat(type, ";\n -webkit-locale: ").concat(locale, ";\n }\n .apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n .apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n .apple-pay-button-white-with-line {\n -apple-pay-button-style: white-outline;\n }\n }\n\n @supports not (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n background-size: 100% 60%;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n border-radius: 5px;\n padding: 0px;\n box-sizing: border-box;\n min-width: 200px;\n min-height: 32px;\n max-height: 64px;\n }\n .apple-pay-button-black {\n background-image: -webkit-named-image(apple-pay-logo-white);\n background-color: black;\n }\n .apple-pay-button-white {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n }\n .apple-pay-button-white-with-line {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n border: .5px solid black;\n }\n }\n");
|
|
402
|
-
};
|
|
403
|
-
var generatePaymentRequestInnerWrapperCSS = function generatePaymentRequestInnerWrapperCSS(orientation) {
|
|
404
|
-
var isVertical = orientation === PAYMENT_REQUEST_BUTTON_ORIENTATION.VERTICAL;
|
|
405
|
-
return "\n #paystack-payment-request-inner-wrapper {\n display: flex;\n flex-direction: ".concat(isVertical ? 'column' : 'row', ";\n gap: 8px;\n width: 100%;\n max-width: 100%;\n }\n\n #paystack-payment-request-inner-wrapper > * {\n min-width: 0;\n ").concat(isVertical ? '' : 'flex: 1 1 0;', "\n }\n\n #paystack-payment-request-inner-wrapper > apple-pay-button,\n #paystack-payment-request-inner-wrapper > #apple-pay-button {\n order: 1;\n }\n #paystack-payment-request-inner-wrapper > #google-pay-button-container {\n order: 2;\n }\n");
|
|
406
|
-
};
|
|
407
|
-
var generateGooglePayCSS = function generateGooglePayCSS() {
|
|
408
|
-
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
409
|
-
height = _ref3.height,
|
|
410
|
-
width = _ref3.width;
|
|
411
|
-
return "\n #google-pay-button-container {\n width: ".concat(width || 'auto', ";\n height: ").concat(height || PAYMENT_REQUEST_BUTTON_HEIGHT, ";\n overflow: hidden;\n }\n #google-pay-button-container:empty {\n display: none;\n }\n #google-pay-button-container > div,\n #google-pay-button-container button,\n #google-pay-button-container iframe {\n width: 100%;\n max-width: 100%;\n height: 100%;\n min-width: 100%;\n }\n #google-pay-button-container button {\n outline: none !important;\n }\n");
|
|
412
|
-
};
|
|
413
|
-
var generateGooglePayLoadingCSS = function generateGooglePayLoadingCSS() {
|
|
414
|
-
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
415
|
-
borderRadius = _ref4.borderRadius,
|
|
416
|
-
buttonColor = _ref4.buttonColor;
|
|
417
|
-
var isWhite = buttonColor === 'white';
|
|
418
|
-
return "\n #google-pay-loading-button {\n width: 100%;\n height: 100%;\n border: ".concat(isWhite ? '1px solid #3C4043' : 'none', ";\n border-radius: ").concat(borderRadius === undefined ? GOOGLE_PAY_BUTTON_RADIUS : borderRadius, "px;\n background: ").concat(isWhite ? '#ffffff' : '#000000', ";\n cursor: default;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n #google-pay-loading-button__spinner {\n width: 18px;\n height: 18px;\n border: 2px solid ").concat(isWhite ? 'rgba(60, 64, 67, 0.25)' : 'rgba(255, 255, 255, 0.35)', ";\n border-top-color: ").concat(isWhite ? '#3c4043' : '#ffffff', ";\n border-radius: 50%;\n animation: google-pay-spin 0.8s linear infinite;\n }\n @keyframes google-pay-spin {\n to { transform: rotate(360deg); }\n }\n");
|
|
419
|
-
};
|
|
420
|
-
function appendCSS(container, css) {
|
|
421
|
-
var style = document.createElement('style');
|
|
422
|
-
style.type = 'text/css';
|
|
423
|
-
style.textContent = css;
|
|
424
|
-
container.appendChild(style);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
var amountSubunitToBase = function amountSubunitToBase() {
|
|
428
|
-
var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
429
|
-
return Number(parseFloat(amount / 100).toFixed(2));
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
/* eslint-disable prefer-promise-reject-errors */
|
|
433
|
-
/* eslint-env browser */
|
|
434
|
-
|
|
435
|
-
var loadScript = function loadScript(url) {
|
|
436
|
-
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
437
|
-
container = _ref.container,
|
|
438
|
-
integrity = _ref.integrity;
|
|
439
|
-
return new Promise(function (resolve, reject) {
|
|
440
|
-
if (!url) {
|
|
441
|
-
reject('No script url');
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
var script = document.createElement('script');
|
|
445
|
-
script.src = url;
|
|
446
|
-
if (integrity) {
|
|
447
|
-
script.crossOrigin = 'anonymous';
|
|
448
|
-
script.integrity = integrity;
|
|
449
|
-
}
|
|
450
|
-
script.addEventListener('load', function () {
|
|
451
|
-
resolve(true);
|
|
452
|
-
});
|
|
453
|
-
script.addEventListener('error', function () {
|
|
454
|
-
script.remove();
|
|
455
|
-
reject(false);
|
|
456
|
-
});
|
|
457
|
-
if (container) {
|
|
458
|
-
container.appendChild(script);
|
|
459
|
-
} else {
|
|
460
|
-
document.head.appendChild(script);
|
|
461
|
-
}
|
|
462
|
-
});
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
var requestConfig = {
|
|
466
|
-
headers: {
|
|
467
|
-
accept: 'application/json, text/plain, */*',
|
|
468
|
-
'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
|
|
469
|
-
'content-type': 'application/x-www-form-urlencoded',
|
|
470
|
-
'sec-ch-ua-mobile': '?0',
|
|
471
|
-
'sec-fetch-dest': 'empty',
|
|
472
|
-
'sec-fetch-mode': 'cors',
|
|
473
|
-
'sec-fetch-site': 'cross-site'
|
|
474
|
-
},
|
|
475
|
-
referrerPolicy: 'no-referrer-when-downgrade',
|
|
476
|
-
method: 'POST',
|
|
477
|
-
mode: 'cors',
|
|
478
|
-
credentials: 'omit'
|
|
479
|
-
};
|
|
480
|
-
function createFormBody(params) {
|
|
481
|
-
var formBody = Object.keys(params).reduce(function (formBodyArray, key) {
|
|
482
|
-
var encodedKey = encodeURIComponent(key);
|
|
483
|
-
var encodedValue = encodeURIComponent(params[key]);
|
|
484
|
-
var encodedFormBody = "".concat(encodedKey, "=").concat(encodedValue);
|
|
485
|
-
return [].concat(_toConsumableArray(formBodyArray), [encodedFormBody]);
|
|
486
|
-
}, []);
|
|
487
|
-
return formBody.join('&');
|
|
488
|
-
}
|
|
489
|
-
var formatIntervalString = function formatIntervalString(interval) {
|
|
490
|
-
var plans = {
|
|
491
|
-
biannually: 'BIANNUAL PLAN',
|
|
492
|
-
annually: 'ANNUAL PLAN'
|
|
493
|
-
};
|
|
494
|
-
return plans[interval] || "".concat(interval.toUpperCase(), " PLAN");
|
|
495
|
-
};
|
|
496
|
-
var generateApplePaymentRequestObject = function generateApplePaymentRequestObject(_ref) {
|
|
497
|
-
var currency = _ref.currency,
|
|
498
|
-
amount = _ref.amount,
|
|
499
|
-
merchantName = _ref.merchantName,
|
|
500
|
-
interval = _ref.interval;
|
|
501
|
-
return _objectSpread2({
|
|
502
|
-
countryCode: 'NG',
|
|
503
|
-
currencyCode: currency,
|
|
504
|
-
merchantCapabilities: ['supports3DS', 'supportsCredit', 'supportsDebit'],
|
|
505
|
-
supportedNetworks: ['visa', 'masterCard'],
|
|
506
|
-
requiredBillingContactFields: ['postalAddress', 'name', 'phone', 'email'],
|
|
507
|
-
total: {
|
|
508
|
-
label: "".concat(merchantName, " - Paystack"),
|
|
509
|
-
type: 'final',
|
|
510
|
-
amount: String(amountSubunitToBase(amount))
|
|
511
|
-
}
|
|
512
|
-
}, typeof interval === 'string' && interval.trim() !== '' && {
|
|
513
|
-
lineItems: [{
|
|
514
|
-
label: formatIntervalString(interval),
|
|
515
|
-
amount: String(amountSubunitToBase(amount))
|
|
516
|
-
}]
|
|
517
|
-
});
|
|
518
|
-
};
|
|
519
|
-
var validateApplePaySession = function validateApplePaySession(_ref2) {
|
|
520
|
-
var transactionId = _ref2.transactionId,
|
|
521
|
-
validationURL = _ref2.validationURL,
|
|
522
|
-
merchantName = _ref2.merchantName,
|
|
523
|
-
_ref2$domainName = _ref2.domainName,
|
|
524
|
-
domainName = _ref2$domainName === void 0 ? window && window.location && window.location.hostname : _ref2$domainName;
|
|
525
|
-
var validateSessionUrl = "".concat(config.paymentBaseUrl).concat(config.applePayValidateSessionPath);
|
|
526
|
-
var params = {
|
|
527
|
-
transaction: transactionId,
|
|
528
|
-
sessionUrl: validationURL,
|
|
529
|
-
displayName: merchantName,
|
|
530
|
-
domainName: domainName
|
|
531
|
-
};
|
|
532
|
-
var formBody = createFormBody(params);
|
|
533
|
-
var validateSession = fetch(validateSessionUrl, _objectSpread2(_objectSpread2({}, requestConfig), {}, {
|
|
534
|
-
body: formBody
|
|
535
|
-
})).then(function (response) {
|
|
536
|
-
return response.json();
|
|
537
|
-
});
|
|
538
|
-
return validateSession;
|
|
539
|
-
};
|
|
540
|
-
var chargeApplePay = function chargeApplePay(_ref3) {
|
|
541
|
-
var transactionId = _ref3.transactionId,
|
|
542
|
-
payment = _ref3.payment;
|
|
543
|
-
var chargeApplePayUrl = "".concat(config.paymentBaseUrl).concat(config.applePayChargePath);
|
|
544
|
-
var params = {
|
|
545
|
-
transaction: transactionId,
|
|
546
|
-
paymentObject: JSON.stringify(payment)
|
|
547
|
-
};
|
|
548
|
-
var formBody = createFormBody(params);
|
|
549
|
-
var charge = fetch(chargeApplePayUrl, _objectSpread2(_objectSpread2({}, requestConfig), {}, {
|
|
550
|
-
body: formBody
|
|
551
|
-
})).then(function (response) {
|
|
552
|
-
return response.json();
|
|
553
|
-
});
|
|
554
|
-
return charge;
|
|
555
|
-
};
|
|
556
|
-
var deviceSupportsApplePay = function deviceSupportsApplePay() {
|
|
557
|
-
try {
|
|
558
|
-
return window.isSecureContext && window.ApplePaySession && window.ApplePaySession.supportsVersion(config.applePayVersion);
|
|
559
|
-
} catch (error) {
|
|
560
|
-
return false;
|
|
561
|
-
}
|
|
562
|
-
};
|
|
563
|
-
var canUseApplePay = function canUseApplePay() {
|
|
564
|
-
var channels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
565
|
-
return deviceSupportsApplePay() && channels.includes(CHANNELS.APPLE_PAY);
|
|
566
|
-
};
|
|
567
|
-
var loadApplePay = function loadApplePay() {
|
|
568
|
-
return loadScript(APPLE_PAY_SDK_SOURCE, {
|
|
569
|
-
integrity: APPLE_PAY_SDK_INTEGRITY_HASH
|
|
570
|
-
}).then(function () {
|
|
571
|
-
/**
|
|
572
|
-
* The Apple Pay SDK expects `window.webpackJsonp` to be array-like
|
|
573
|
-
* but we have seen instances where that is not the case, causing the SDK to throw errors
|
|
574
|
-
* so in this scenario, we opt out of using the SDK
|
|
575
|
-
*/
|
|
576
|
-
if (window && !Array.isArray(window.webpackJsonp)) {
|
|
577
|
-
throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
};
|
|
581
|
-
|
|
582
|
-
var getChannelAmount = function getChannelAmount(response, channel) {
|
|
583
|
-
var channelFees = (response && response.channel_fees_and_amount || {})[channel];
|
|
584
|
-
var amount = channelFees && channelFees.amount;
|
|
585
|
-
return amount == null ? response && response.amount : amount;
|
|
586
|
-
};
|
|
587
|
-
|
|
588
|
-
// eslint-disable-next-line no-console
|
|
589
|
-
var logWarning = console ? console.warn || console.log : function () {};
|
|
590
|
-
function printDeprecationNotice(oldName, newName, extraMessage) {
|
|
591
|
-
logWarning("\"".concat(oldName, "\" has been deprecated, please use \"").concat(newName, "\". ").concat(extraMessage || ''));
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
var withTimeoutDelay = function withTimeoutDelay(work, delayInMilliseconds) {
|
|
595
|
-
var onTimeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {
|
|
596
|
-
return null;
|
|
597
|
-
};
|
|
598
|
-
var timeout;
|
|
599
|
-
var delay = new Promise(function (resolve) {
|
|
600
|
-
timeout = setTimeout(function () {
|
|
601
|
-
try {
|
|
602
|
-
resolve(onTimeout());
|
|
603
|
-
} catch (error) {
|
|
604
|
-
resolve(null);
|
|
605
|
-
}
|
|
606
|
-
}, delayInMilliseconds);
|
|
607
|
-
});
|
|
608
|
-
return Promise.race([work, delay]).finally(function () {
|
|
609
|
-
return clearTimeout(timeout);
|
|
610
|
-
});
|
|
611
|
-
};
|
|
612
|
-
|
|
613
|
-
/**
|
|
614
|
-
* Never advertised here: a `PAN_ONLY` charge comes back needing a 3DS step-up,
|
|
615
|
-
* and inline-js can't handle it
|
|
616
|
-
*/
|
|
617
|
-
var UNSUPPORTED_AUTH_METHODS = ['PAN_ONLY'];
|
|
618
|
-
var paymentsClient = null;
|
|
619
|
-
var paymentsClientEnvironment = null;
|
|
620
|
-
var getGooglePayConfig = function getGooglePayConfig(transaction) {
|
|
621
|
-
var response = transaction && transaction.response;
|
|
622
|
-
var channelSettings = response && response.channel_settings;
|
|
623
|
-
return channelSettings && channelSettings[CHANNELS.GOOGLE_PAY] || null;
|
|
624
|
-
};
|
|
625
|
-
var getSupportedAuthMethods = function getSupportedAuthMethods(googlePayConfig) {
|
|
626
|
-
return (googlePayConfig && googlePayConfig.allowed_card_auth_methods || []).filter(function (authMethod) {
|
|
627
|
-
return !UNSUPPORTED_AUTH_METHODS.includes(authMethod);
|
|
628
|
-
});
|
|
629
|
-
};
|
|
630
|
-
var resolveGooglePayEnvironment = function resolveGooglePayEnvironment(response) {
|
|
631
|
-
var isTest = !!response && response.domain === TRANSACTION_DOMAIN.TEST;
|
|
632
|
-
return config.environment === ENVIRONMENT.PRODUCTION && !isTest ? 'PRODUCTION' : 'TEST';
|
|
633
|
-
};
|
|
634
|
-
var getGooglePayClient = function getGooglePayClient(environment) {
|
|
635
|
-
if (!paymentsClient || paymentsClientEnvironment !== environment) {
|
|
636
|
-
paymentsClient = new window.google.payments.api.PaymentsClient({
|
|
637
|
-
environment: environment
|
|
638
|
-
});
|
|
639
|
-
paymentsClientEnvironment = environment;
|
|
640
|
-
}
|
|
641
|
-
return paymentsClient;
|
|
642
|
-
};
|
|
643
|
-
var hasGooglePaySDKLoaded = function hasGooglePaySDKLoaded() {
|
|
644
|
-
return !!(window.google && window.google.payments && window.google.payments.api && window.google.payments.api.PaymentsClient);
|
|
645
|
-
};
|
|
646
|
-
var buildBaseRequest = function buildBaseRequest(googlePayConfig) {
|
|
647
|
-
return {
|
|
648
|
-
apiVersion: googlePayConfig.api_version.major,
|
|
649
|
-
apiVersionMinor: googlePayConfig.api_version.minor
|
|
650
|
-
};
|
|
651
|
-
};
|
|
652
|
-
var buildCardPaymentMethod = function buildCardPaymentMethod(googlePayConfig, authMethods) {
|
|
653
|
-
return {
|
|
654
|
-
type: 'CARD',
|
|
655
|
-
parameters: {
|
|
656
|
-
allowedAuthMethods: authMethods,
|
|
657
|
-
allowedCardNetworks: googlePayConfig.allowed_card_networks,
|
|
658
|
-
billingAddressRequired: true,
|
|
659
|
-
billingAddressParameters: googlePayConfig.billing_address_parameters,
|
|
660
|
-
assuranceDetailsRequired: true
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
};
|
|
664
|
-
var buildMerchantInfo = function buildMerchantInfo(googlePayConfig) {
|
|
665
|
-
var merchantInfo = googlePayConfig.merchant_info || {};
|
|
666
|
-
return {
|
|
667
|
-
merchantId: merchantInfo.merchantId,
|
|
668
|
-
merchantName: merchantInfo.merchantName,
|
|
669
|
-
merchantOrigin: merchantInfo.merchantOrigin
|
|
670
|
-
};
|
|
671
|
-
};
|
|
672
|
-
var warnOnOriginMismatch = function warnOnOriginMismatch(googlePayConfig) {
|
|
673
|
-
var registeredOrigin = googlePayConfig.merchant_info && googlePayConfig.merchant_info.merchantOrigin;
|
|
674
|
-
var hostname = window.location.hostname;
|
|
675
|
-
if (registeredOrigin && registeredOrigin !== hostname) {
|
|
676
|
-
logWarning("Google Pay: the registered merchantOrigin (\"".concat(registeredOrigin, "\") does not match this page (\"").concat(hostname, "\"). Google may reject the payment sheet. Update the domain in Dashboard > Developers > Google Pay."));
|
|
677
|
-
}
|
|
678
|
-
};
|
|
679
|
-
var buildPaymentDataRequest = function buildPaymentDataRequest(transaction) {
|
|
680
|
-
var googlePayConfig = getGooglePayConfig(transaction);
|
|
681
|
-
var response = transaction.response;
|
|
682
|
-
var authMethods = getSupportedAuthMethods(googlePayConfig);
|
|
683
|
-
return _objectSpread2(_objectSpread2({}, buildBaseRequest(googlePayConfig)), {}, {
|
|
684
|
-
allowedPaymentMethods: [_objectSpread2(_objectSpread2({}, buildCardPaymentMethod(googlePayConfig, authMethods)), {}, {
|
|
685
|
-
tokenizationSpecification: googlePayConfig.tokenization_specification
|
|
686
|
-
})],
|
|
687
|
-
transactionInfo: {
|
|
688
|
-
totalPriceStatus: 'FINAL',
|
|
689
|
-
checkoutOption: 'COMPLETE_IMMEDIATE_PURCHASE',
|
|
690
|
-
totalPrice: amountSubunitToBase(getChannelAmount(response, CHANNELS.GOOGLE_PAY)).toFixed(2),
|
|
691
|
-
currencyCode: response.currency,
|
|
692
|
-
countryCode: CURRENCY_COUNTRYCODE_MAPPING[response.currency] || COUNTRYCODE.NIGERIA
|
|
693
|
-
},
|
|
694
|
-
merchantInfo: buildMerchantInfo(googlePayConfig),
|
|
695
|
-
emailRequired: true
|
|
696
|
-
});
|
|
697
|
-
};
|
|
698
|
-
var chargeGooglePay = function chargeGooglePay(_ref) {
|
|
699
|
-
var transactionId = _ref.transactionId,
|
|
700
|
-
paymentData = _ref.paymentData;
|
|
701
|
-
var chargeUrl = "".concat(config.paymentBaseUrl).concat(config.googlePayChargePath);
|
|
702
|
-
return fetch(chargeUrl, {
|
|
703
|
-
headers: {
|
|
704
|
-
'content-type': 'application/x-www-form-urlencoded'
|
|
705
|
-
},
|
|
706
|
-
method: 'POST',
|
|
707
|
-
mode: 'cors',
|
|
708
|
-
credentials: 'omit',
|
|
709
|
-
body: createFormBody({
|
|
710
|
-
transaction: transactionId,
|
|
711
|
-
paymentObject: JSON.stringify(paymentData)
|
|
712
|
-
})
|
|
713
|
-
}).then(function (response) {
|
|
714
|
-
return response.json();
|
|
715
|
-
});
|
|
716
|
-
};
|
|
717
|
-
var canUseGooglePay = function canUseGooglePay(transaction) {
|
|
718
|
-
var googlePayConfig = getGooglePayConfig(transaction);
|
|
719
|
-
if (!googlePayConfig) {
|
|
720
|
-
return Promise.resolve(null);
|
|
721
|
-
}
|
|
722
|
-
var authMethods = getSupportedAuthMethods(googlePayConfig);
|
|
723
|
-
if (!authMethods.length || !googlePayConfig.tokenization_specification || !hasGooglePaySDKLoaded()) {
|
|
724
|
-
return Promise.resolve(null);
|
|
725
|
-
}
|
|
726
|
-
warnOnOriginMismatch(googlePayConfig);
|
|
727
|
-
var readiness = Promise.resolve().then(function () {
|
|
728
|
-
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
729
|
-
return client.isReadyToPay(_objectSpread2(_objectSpread2({}, buildBaseRequest(googlePayConfig)), {}, {
|
|
730
|
-
allowedPaymentMethods: [buildCardPaymentMethod(googlePayConfig, authMethods)],
|
|
731
|
-
existingPaymentMethodRequired: true
|
|
732
|
-
}));
|
|
733
|
-
}).then(function (_ref2) {
|
|
734
|
-
var result = _ref2.result;
|
|
735
|
-
return !!result;
|
|
736
|
-
}).catch(function () {
|
|
737
|
-
return null;
|
|
738
|
-
});
|
|
739
|
-
return readiness;
|
|
740
|
-
};
|
|
741
|
-
var loadGooglePay = function loadGooglePay(transaction) {
|
|
742
|
-
var response = transaction && transaction.response || {};
|
|
743
|
-
var channels = response.channels || [];
|
|
744
|
-
if (!channels.includes(CHANNELS.GOOGLE_PAY)) {
|
|
745
|
-
return Promise.resolve(null);
|
|
746
|
-
}
|
|
747
|
-
var loadSdk = hasGooglePaySDKLoaded() ? Promise.resolve(true) : loadScript(GOOGLE_PAY_SDK_SOURCE).then(function () {
|
|
748
|
-
return hasGooglePaySDKLoaded();
|
|
749
|
-
});
|
|
750
|
-
return withTimeoutDelay(loadSdk.catch(function () {
|
|
751
|
-
return false;
|
|
752
|
-
}).then(function (loaded) {
|
|
753
|
-
if (!loaded) {
|
|
754
|
-
return null;
|
|
755
|
-
}
|
|
756
|
-
return canUseGooglePay(transaction);
|
|
757
|
-
}), GOOGLE_PAY_TIMEOUT_MS);
|
|
758
|
-
};
|
|
759
|
-
|
|
760
|
-
var _excluded$2 = ["height", "width", "borderRadius", "buttonRadius"];
|
|
761
|
-
function createIframe(id) {
|
|
762
|
-
var iframe = document.createElement('iframe');
|
|
763
|
-
iframe.setAttribute('frameBorder', '0');
|
|
764
|
-
iframe.setAttribute('allowtransparency', 'true');
|
|
765
|
-
iframe.id = id;
|
|
766
|
-
iframe.style.display = 'none';
|
|
767
|
-
return iframe;
|
|
768
|
-
}
|
|
769
|
-
function mountCheckoutIframe(id) {
|
|
770
|
-
var iframe = createIframe("inline-checkout-".concat(id));
|
|
771
|
-
// `precheckout=true` tells checkout to render the precheckout view itself;
|
|
772
|
-
// without it, checkout assumes an older inline-js that renders its own modal.
|
|
773
|
-
iframe.src = "".concat(config.checkoutUrl, "popup?precheckout=true");
|
|
774
|
-
iframe.style.cssText = checkoutCSS;
|
|
775
|
-
iframe.style.colorScheme = 'light';
|
|
776
|
-
iframe.setAttribute('allowpaymentrequest', 'true');
|
|
777
|
-
iframe.setAttribute('allow', 'payment; clipboard-read; clipboard-write');
|
|
778
|
-
document.body.appendChild(iframe);
|
|
779
|
-
return iframe;
|
|
780
|
-
}
|
|
781
|
-
function mountBackgroundIframe(id) {
|
|
782
|
-
var iframe = createIframe("inline-background-".concat(id));
|
|
783
|
-
iframe.style.cssText = backgroundCSS;
|
|
784
|
-
iframe.style.colorScheme = 'light';
|
|
785
|
-
document.body.appendChild(iframe);
|
|
786
|
-
var bgWindow = iframe.contentWindow.document;
|
|
787
|
-
bgWindow.open();
|
|
788
|
-
bgWindow.write(loaderHTML);
|
|
789
|
-
bgWindow.close();
|
|
790
|
-
return iframe;
|
|
791
|
-
}
|
|
792
|
-
function mountEmbedCheckoutIframe(id, src) {
|
|
793
|
-
var iframe = createIframe("embed-checkout-".concat(id));
|
|
794
|
-
iframe.style.cssText = embedCSS;
|
|
795
|
-
iframe.src = src;
|
|
796
|
-
iframe.id = id;
|
|
797
|
-
iframe.name = id;
|
|
798
|
-
iframe.setAttribute('allowpaymentrequest', 'true');
|
|
799
|
-
iframe.setAttribute('allow', 'payment; clipboard-read; clipboard-write');
|
|
800
|
-
return iframe;
|
|
801
|
-
}
|
|
802
|
-
function getApplePayButton(container) {
|
|
803
|
-
return container.querySelector('apple-pay-button') || container.querySelector('#apple-pay-button');
|
|
804
|
-
}
|
|
805
|
-
function appendIframeToContainer(containerId, iframe) {
|
|
806
|
-
var container = document.getElementById(containerId);
|
|
807
|
-
container.innerHTML = '';
|
|
808
|
-
container.removeAttribute('style');
|
|
809
|
-
container.className = 'paystack-embed-container';
|
|
810
|
-
container.style.position = 'relative';
|
|
811
|
-
container.style.width = '100%';
|
|
812
|
-
container.appendChild(iframe);
|
|
813
|
-
}
|
|
814
|
-
function hideLoader(iframe) {
|
|
815
|
-
var bgWindow = iframe.contentWindow.document;
|
|
816
|
-
if (bgWindow) {
|
|
817
|
-
bgWindow.getElementById('app-loader').style.display = 'none';
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
function animateCheckoutIn(domElements) {
|
|
821
|
-
return new Promise(function (resolve, reject) {
|
|
822
|
-
if (!domElements) {
|
|
823
|
-
reject('No dom element provided');
|
|
824
|
-
}
|
|
825
|
-
var checkoutIframe = domElements.checkoutIframe,
|
|
826
|
-
backgroundIframe = domElements.backgroundIframe;
|
|
827
|
-
if (!checkoutIframe || !backgroundIframe) {
|
|
828
|
-
reject('No dom element provided');
|
|
829
|
-
}
|
|
830
|
-
checkoutIframe.style.display = '';
|
|
831
|
-
checkoutIframe.style.visibility = 'visible';
|
|
832
|
-
backgroundIframe.style.display = '';
|
|
833
|
-
backgroundIframe.style.visibility = 'visible';
|
|
834
|
-
resolve();
|
|
835
|
-
});
|
|
836
|
-
}
|
|
837
|
-
function animateCheckoutOut(domElements) {
|
|
838
|
-
return new Promise(function (resolve, reject) {
|
|
839
|
-
if (!domElements) {
|
|
840
|
-
reject('No dom element provided');
|
|
841
|
-
}
|
|
842
|
-
var checkoutIframe = domElements.checkoutIframe,
|
|
843
|
-
backgroundIframe = domElements.backgroundIframe;
|
|
844
|
-
if (!checkoutIframe || !backgroundIframe) {
|
|
845
|
-
reject('No dom element provided');
|
|
846
|
-
}
|
|
847
|
-
backgroundIframe.style.opacity = 0;
|
|
848
|
-
checkoutIframe.style.display = 'none';
|
|
849
|
-
checkoutIframe.style.visibility = 'hidden';
|
|
850
|
-
setTimeout(function () {
|
|
851
|
-
backgroundIframe.style.display = 'none';
|
|
852
|
-
backgroundIframe.style.visibility = 'hidden';
|
|
853
|
-
backgroundIframe.style.opacity = 1;
|
|
854
|
-
resolve();
|
|
855
|
-
}, 300);
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
function mountLazyInlineButton(options) {
|
|
859
|
-
var inlineButton;
|
|
860
|
-
if (options.id) {
|
|
861
|
-
inlineButton = document.getElementById(options.id);
|
|
862
|
-
inlineButton.setAttribute('data-inline-id', options.id);
|
|
863
|
-
} else {
|
|
864
|
-
var inlineDiv = document.createElement('div');
|
|
865
|
-
inlineDiv.id = "inline-button-".concat(options.inlineId);
|
|
866
|
-
inlineDiv.innerHTML = generateInlineButtonHTML(options);
|
|
867
|
-
options.parent.parentNode.insertBefore(inlineDiv, options.parent.nextSibling);
|
|
868
|
-
var _inlineDiv$getElement = inlineDiv.getElementsByTagName('button');
|
|
869
|
-
var _inlineDiv$getElement2 = _slicedToArray(_inlineDiv$getElement, 1);
|
|
870
|
-
inlineButton = _inlineDiv$getElement2[0];
|
|
871
|
-
}
|
|
872
|
-
return inlineButton;
|
|
873
|
-
}
|
|
874
|
-
function animateEmbedCheckoutIn(checkoutIframe) {
|
|
875
|
-
return new Promise(function (resolve, reject) {
|
|
876
|
-
if (!checkoutIframe) {
|
|
877
|
-
reject('No dom element provided');
|
|
878
|
-
}
|
|
879
|
-
// eslint-disable-next-line no-param-reassign
|
|
880
|
-
checkoutIframe.style.display = '';
|
|
881
|
-
// eslint-disable-next-line no-param-reassign
|
|
882
|
-
checkoutIframe.style.visibility = 'visible';
|
|
883
|
-
resolve();
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
function mountInput(options) {
|
|
887
|
-
var type = options.type,
|
|
888
|
-
value = options.value,
|
|
889
|
-
name = options.name,
|
|
890
|
-
parent = options.parent;
|
|
891
|
-
var input = document.createElement('input');
|
|
892
|
-
input.type = type;
|
|
893
|
-
input.value = value;
|
|
894
|
-
input.name = name;
|
|
895
|
-
parent.appendChild(input);
|
|
896
|
-
}
|
|
897
|
-
function mountApplePayButton(container, _ref) {
|
|
898
|
-
var styles = _ref.styles,
|
|
899
|
-
theme = _ref.theme,
|
|
900
|
-
onClick = _ref.onClick;
|
|
901
|
-
appendCSS(container, generateApplePayCSS(styles));
|
|
902
|
-
var button = document.createElement('apple-pay-button');
|
|
903
|
-
button.setAttribute('buttonstyle', theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'white' : 'black');
|
|
904
|
-
button.setAttribute('type', styles.type);
|
|
905
|
-
button.setAttribute('locale', styles.locale);
|
|
906
|
-
if (onClick) {
|
|
907
|
-
button.onclick = onClick;
|
|
908
|
-
}
|
|
909
|
-
container.appendChild(button);
|
|
910
|
-
return button;
|
|
911
|
-
}
|
|
912
|
-
function mountApplePayFallbackButton(container, _ref2) {
|
|
913
|
-
var styles = _ref2.styles,
|
|
914
|
-
theme = _ref2.theme,
|
|
915
|
-
onClick = _ref2.onClick;
|
|
916
|
-
appendCSS(container, generateApplePayFallbackCSS(styles));
|
|
917
|
-
var button = document.createElement('button');
|
|
918
|
-
button.classList.add('apple-pay-button', theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'apple-pay-button-white' : 'apple-pay-button-black');
|
|
919
|
-
button.id = 'apple-pay-button';
|
|
920
|
-
var applePayLogo = document.createElement('span');
|
|
921
|
-
applePayLogo.classList.add('logo');
|
|
922
|
-
button.appendChild(applePayLogo);
|
|
923
|
-
if (onClick) {
|
|
924
|
-
button.onclick = onClick;
|
|
925
|
-
}
|
|
926
|
-
container.appendChild(button);
|
|
927
|
-
return button;
|
|
928
|
-
}
|
|
929
|
-
function getPaymentRequestContainer(container) {
|
|
930
|
-
return document.querySelector("#".concat(container));
|
|
931
|
-
}
|
|
932
|
-
function removeAllChildNodes(parent) {
|
|
933
|
-
while (parent.firstChild) {
|
|
934
|
-
parent.removeChild(parent.firstChild);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
function getGooglePayButton(container) {
|
|
938
|
-
return container.querySelector('#google-pay-button-container');
|
|
939
|
-
}
|
|
940
|
-
function toggleGooglePayLoadingState(container, isLoading) {
|
|
941
|
-
if (!container) {
|
|
942
|
-
return;
|
|
943
|
-
}
|
|
944
|
-
var button = container.querySelector('#google-pay-button');
|
|
945
|
-
var loadingButton = container.querySelector('#google-pay-loading-button');
|
|
946
|
-
if (!button || !loadingButton) {
|
|
947
|
-
return;
|
|
948
|
-
}
|
|
949
|
-
button.style.display = isLoading ? 'none' : '';
|
|
950
|
-
loadingButton.style.display = isLoading ? 'flex' : 'none';
|
|
951
|
-
}
|
|
952
|
-
var resolveGooglePayButtonRadius = function resolveGooglePayButtonRadius(borderRadius, buttonRadius) {
|
|
953
|
-
var parsed = parseFloat(borderRadius !== undefined ? borderRadius : buttonRadius);
|
|
954
|
-
return parsed >= 0 ? parsed : GOOGLE_PAY_BUTTON_RADIUS;
|
|
955
|
-
};
|
|
956
|
-
function mountGooglePayButton(container, _ref3) {
|
|
957
|
-
var transaction = _ref3.transaction,
|
|
958
|
-
_ref3$styles = _ref3.styles,
|
|
959
|
-
styles = _ref3$styles === void 0 ? {} : _ref3$styles,
|
|
960
|
-
onClick = _ref3.onClick;
|
|
961
|
-
var _ref4 = styles.googlePay || {},
|
|
962
|
-
height = _ref4.height,
|
|
963
|
-
width = _ref4.width,
|
|
964
|
-
borderRadius = _ref4.borderRadius,
|
|
965
|
-
buttonRadius = _ref4.buttonRadius,
|
|
966
|
-
googlePayStyles = _objectWithoutProperties(_ref4, _excluded$2);
|
|
967
|
-
var googlePayConfig = getGooglePayConfig(transaction);
|
|
968
|
-
var radius = resolveGooglePayButtonRadius(borderRadius, buttonRadius);
|
|
969
|
-
appendCSS(container, generateGooglePayCSS({
|
|
970
|
-
height: height,
|
|
971
|
-
width: width
|
|
972
|
-
}));
|
|
973
|
-
var buttonColor = googlePayStyles.buttonColor || (styles.theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'white' : 'black');
|
|
974
|
-
appendCSS(container, generateGooglePayLoadingCSS({
|
|
975
|
-
borderRadius: radius,
|
|
976
|
-
buttonColor: buttonColor
|
|
977
|
-
}));
|
|
978
|
-
var buttonContainer = document.createElement('div');
|
|
979
|
-
buttonContainer.id = 'google-pay-button-container';
|
|
980
|
-
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
981
|
-
var button = client.createButton(_objectSpread2(_objectSpread2({
|
|
982
|
-
buttonColor: buttonColor,
|
|
983
|
-
buttonType: 'pay',
|
|
984
|
-
buttonRadius: radius,
|
|
985
|
-
buttonSizeMode: 'fill'
|
|
986
|
-
}, googlePayStyles), {}, {
|
|
987
|
-
onClick: onClick,
|
|
988
|
-
allowedPaymentMethods: [buildCardPaymentMethod(googlePayConfig, getSupportedAuthMethods(googlePayConfig))]
|
|
989
|
-
}));
|
|
990
|
-
container.appendChild(buttonContainer);
|
|
991
|
-
var buttonWrapper = document.createElement('div');
|
|
992
|
-
buttonWrapper.id = 'google-pay-button';
|
|
993
|
-
buttonWrapper.appendChild(button);
|
|
994
|
-
buttonContainer.appendChild(buttonWrapper);
|
|
995
|
-
var loadingButton = document.createElement('button');
|
|
996
|
-
loadingButton.id = 'google-pay-loading-button';
|
|
997
|
-
loadingButton.type = 'button';
|
|
998
|
-
loadingButton.disabled = true;
|
|
999
|
-
loadingButton.setAttribute('aria-busy', 'true');
|
|
1000
|
-
loadingButton.style.display = 'none';
|
|
1001
|
-
var spinner = document.createElement('span');
|
|
1002
|
-
spinner.id = 'google-pay-loading-button__spinner';
|
|
1003
|
-
loadingButton.appendChild(spinner);
|
|
1004
|
-
buttonContainer.appendChild(loadingButton);
|
|
1005
|
-
return buttonContainer;
|
|
1006
|
-
}
|
|
1007
|
-
function getMountedPaymentRequestButtons(container) {
|
|
1008
|
-
if (!container) {
|
|
1009
|
-
return [];
|
|
1010
|
-
}
|
|
1011
|
-
return [getApplePayButton(container), getGooglePayButton(container)].filter(Boolean);
|
|
1012
|
-
}
|
|
1013
|
-
function mountPaymentRequestButtons(container, _ref5) {
|
|
1014
|
-
var transaction = _ref5.transaction,
|
|
1015
|
-
_ref5$styles = _ref5.styles,
|
|
1016
|
-
styles = _ref5$styles === void 0 ? {} : _ref5$styles,
|
|
1017
|
-
onClickApplePayButton = _ref5.onClickApplePayButton,
|
|
1018
|
-
onClickGooglePayButton = _ref5.onClickGooglePayButton;
|
|
1019
|
-
if (!container) {
|
|
1020
|
-
return Promise.reject('Container to mount elements was not provided');
|
|
1021
|
-
}
|
|
1022
|
-
removeAllChildNodes(container);
|
|
1023
|
-
appendCSS(container, generatePaymentRequestInnerWrapperCSS(styles.orientation));
|
|
1024
|
-
var innerWrapper = document.createElement('div');
|
|
1025
|
-
innerWrapper.id = 'paystack-payment-request-inner-wrapper';
|
|
1026
|
-
innerWrapper.style.display = 'none';
|
|
1027
|
-
container.appendChild(innerWrapper);
|
|
1028
|
-
var applePayOptions = {
|
|
1029
|
-
styles: parseApplePayCustomStyles(styles.applePay),
|
|
1030
|
-
theme: styles.theme,
|
|
1031
|
-
onClick: onClickApplePayButton
|
|
1032
|
-
};
|
|
1033
|
-
var channels = transaction.response && transaction.response.channels || [];
|
|
1034
|
-
var applePayButton = Promise.resolve(null);
|
|
1035
|
-
if (canUseApplePay(channels)) {
|
|
1036
|
-
applePayButton = loadApplePay().then(function () {
|
|
1037
|
-
return mountApplePayButton(innerWrapper, applePayOptions);
|
|
1038
|
-
}).catch(function () {
|
|
1039
|
-
return mountApplePayFallbackButton(innerWrapper, applePayOptions);
|
|
1040
|
-
}).catch(function () {
|
|
1041
|
-
return null;
|
|
1042
|
-
});
|
|
1043
|
-
} else if (channels.includes(CHANNELS.APPLE_PAY)) {
|
|
1044
|
-
logWarning('Apple Pay: this device or browser cannot pay with Apple Pay. It requires Safari on an Apple device, over HTTPS.');
|
|
1045
|
-
}
|
|
1046
|
-
var googlePayButton = loadGooglePay(transaction).then(function (isReadyToPay) {
|
|
1047
|
-
if (!isReadyToPay) {
|
|
1048
|
-
return null;
|
|
1049
|
-
}
|
|
1050
|
-
return mountGooglePayButton(innerWrapper, {
|
|
1051
|
-
transaction: transaction,
|
|
1052
|
-
styles: styles,
|
|
1053
|
-
onClick: onClickGooglePayButton
|
|
1054
|
-
});
|
|
1055
|
-
}).catch(function () {
|
|
1056
|
-
return null;
|
|
1057
|
-
});
|
|
1058
|
-
return Promise.all([applePayButton, googlePayButton]).then(function (_ref6) {
|
|
1059
|
-
var _ref7 = _slicedToArray(_ref6, 2),
|
|
1060
|
-
applePay = _ref7[0],
|
|
1061
|
-
googlePay = _ref7[1];
|
|
1062
|
-
if (!applePay && !googlePay) {
|
|
1063
|
-
return null;
|
|
1064
|
-
}
|
|
1065
|
-
innerWrapper.style.display = '';
|
|
1066
|
-
return {
|
|
1067
|
-
applePay: !!applePay,
|
|
1068
|
-
googlePay: !!googlePay
|
|
1069
|
-
};
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
var allParameters = [{
|
|
1074
|
-
value: 'key',
|
|
1075
|
-
required: true,
|
|
1076
|
-
types: ['string']
|
|
1077
|
-
}, {
|
|
1078
|
-
value: 'amount',
|
|
1079
|
-
required: true,
|
|
1080
|
-
or: ['plan', 'planCode'],
|
|
1081
|
-
types: ['string', 'number']
|
|
1082
|
-
}, {
|
|
1083
|
-
value: 'currency',
|
|
1084
|
-
required: false,
|
|
1085
|
-
types: ['string']
|
|
1086
|
-
}, {
|
|
1087
|
-
value: 'email',
|
|
1088
|
-
required: true,
|
|
1089
|
-
or: ['customerCode'],
|
|
1090
|
-
types: ['string']
|
|
1091
|
-
}, {
|
|
1092
|
-
value: 'label',
|
|
1093
|
-
required: false,
|
|
1094
|
-
types: ['string']
|
|
1095
|
-
}, {
|
|
1096
|
-
value: 'firstName',
|
|
1097
|
-
required: false,
|
|
1098
|
-
types: ['string']
|
|
1099
|
-
}, {
|
|
1100
|
-
value: 'lastName',
|
|
1101
|
-
required: false,
|
|
1102
|
-
types: ['string']
|
|
1103
|
-
}, {
|
|
1104
|
-
value: 'reference',
|
|
1105
|
-
required: false,
|
|
1106
|
-
types: ['string']
|
|
1107
|
-
}, {
|
|
1108
|
-
value: 'phone',
|
|
1109
|
-
required: false,
|
|
1110
|
-
types: ['string']
|
|
1111
|
-
}, {
|
|
1112
|
-
value: 'customerCode',
|
|
1113
|
-
required: false,
|
|
1114
|
-
override: 'email',
|
|
1115
|
-
types: ['string']
|
|
1116
|
-
}, {
|
|
1117
|
-
value: 'channels',
|
|
1118
|
-
required: false,
|
|
1119
|
-
types: ['array']
|
|
1120
|
-
}, {
|
|
1121
|
-
value: 'paymentRequest',
|
|
1122
|
-
required: false,
|
|
1123
|
-
types: ['string', 'number']
|
|
1124
|
-
}, {
|
|
1125
|
-
value: 'paymentPage',
|
|
1126
|
-
required: false,
|
|
1127
|
-
types: ['string']
|
|
1128
|
-
}, {
|
|
1129
|
-
value: 'hash',
|
|
1130
|
-
required: false,
|
|
1131
|
-
types: ['string']
|
|
1132
|
-
}, {
|
|
1133
|
-
value: 'container',
|
|
1134
|
-
required: false,
|
|
1135
|
-
types: ['string']
|
|
1136
|
-
}, {
|
|
1137
|
-
value: 'metadata',
|
|
1138
|
-
required: false,
|
|
1139
|
-
types: ['object']
|
|
1140
|
-
}, {
|
|
1141
|
-
value: 'subaccountCode',
|
|
1142
|
-
required: false,
|
|
1143
|
-
types: ['string']
|
|
1144
|
-
}, {
|
|
1145
|
-
value: 'bearer',
|
|
1146
|
-
required: false,
|
|
1147
|
-
types: ['string']
|
|
1148
|
-
}, {
|
|
1149
|
-
value: 'transactionCharge',
|
|
1150
|
-
required: false,
|
|
1151
|
-
types: ['string', 'number']
|
|
1152
|
-
}, {
|
|
1153
|
-
value: 'planCode',
|
|
1154
|
-
required: false,
|
|
1155
|
-
override: 'amount',
|
|
1156
|
-
types: ['string']
|
|
1157
|
-
}, {
|
|
1158
|
-
value: 'subscriptionCount',
|
|
1159
|
-
required: false,
|
|
1160
|
-
types: ['number']
|
|
1161
|
-
}, {
|
|
1162
|
-
value: 'planInterval',
|
|
1163
|
-
required: false,
|
|
1164
|
-
types: ['string']
|
|
1165
|
-
}, {
|
|
1166
|
-
value: 'subscriptionLimit',
|
|
1167
|
-
required: false,
|
|
1168
|
-
types: ['number']
|
|
1169
|
-
}, {
|
|
1170
|
-
value: 'subscriptionStartDate',
|
|
1171
|
-
required: false,
|
|
1172
|
-
types: ['string']
|
|
1173
|
-
}, {
|
|
1174
|
-
value: 'accessCode',
|
|
1175
|
-
required: false,
|
|
1176
|
-
types: ['string']
|
|
1177
|
-
}, {
|
|
1178
|
-
value: 'onError',
|
|
1179
|
-
required: false,
|
|
1180
|
-
types: ['function']
|
|
1181
|
-
}, {
|
|
1182
|
-
value: 'onLoad',
|
|
1183
|
-
required: false,
|
|
1184
|
-
types: ['function']
|
|
1185
|
-
}, {
|
|
1186
|
-
value: 'onSuccess',
|
|
1187
|
-
required: false,
|
|
1188
|
-
types: ['function']
|
|
1189
|
-
}, {
|
|
1190
|
-
value: 'onCancel',
|
|
1191
|
-
required: false,
|
|
1192
|
-
types: ['function']
|
|
1193
|
-
}, {
|
|
1194
|
-
value: 'callback',
|
|
1195
|
-
required: false,
|
|
1196
|
-
types: ['function']
|
|
1197
|
-
}, {
|
|
1198
|
-
value: 'onClose',
|
|
1199
|
-
required: false,
|
|
1200
|
-
types: ['function']
|
|
1201
|
-
}, {
|
|
1202
|
-
value: 'onBankTransferConfirmationPending',
|
|
1203
|
-
required: false,
|
|
1204
|
-
types: ['function']
|
|
1205
|
-
}, {
|
|
1206
|
-
value: 'firstname',
|
|
1207
|
-
required: false,
|
|
1208
|
-
types: ['string']
|
|
1209
|
-
}, {
|
|
1210
|
-
value: 'lastname',
|
|
1211
|
-
required: false,
|
|
1212
|
-
types: ['string']
|
|
1213
|
-
}, {
|
|
1214
|
-
value: 'customer_code',
|
|
1215
|
-
required: false,
|
|
1216
|
-
types: ['string']
|
|
1217
|
-
}, {
|
|
1218
|
-
value: 'payment_request',
|
|
1219
|
-
required: false,
|
|
1220
|
-
types: ['string', 'number']
|
|
1221
|
-
}, {
|
|
1222
|
-
value: 'subaccount',
|
|
1223
|
-
required: false,
|
|
1224
|
-
types: ['string']
|
|
1225
|
-
}, {
|
|
1226
|
-
value: 'transaction_charge',
|
|
1227
|
-
required: false,
|
|
1228
|
-
types: ['number', 'string']
|
|
1229
|
-
}, {
|
|
1230
|
-
value: 'plan',
|
|
1231
|
-
required: false,
|
|
1232
|
-
types: ['string']
|
|
1233
|
-
}, {
|
|
1234
|
-
value: 'quantity',
|
|
1235
|
-
required: false,
|
|
1236
|
-
types: ['number']
|
|
1237
|
-
}, {
|
|
1238
|
-
value: 'interval',
|
|
1239
|
-
required: false,
|
|
1240
|
-
types: ['string']
|
|
1241
|
-
}, {
|
|
1242
|
-
value: 'invoice_limit',
|
|
1243
|
-
required: false,
|
|
1244
|
-
types: ['number', 'string']
|
|
1245
|
-
}, {
|
|
1246
|
-
value: 'start_date',
|
|
1247
|
-
required: false,
|
|
1248
|
-
types: ['string']
|
|
1249
|
-
}, {
|
|
1250
|
-
value: 'payment_page',
|
|
1251
|
-
required: false,
|
|
1252
|
-
types: ['number', 'string']
|
|
1253
|
-
}, {
|
|
1254
|
-
value: 'order_id',
|
|
1255
|
-
required: false,
|
|
1256
|
-
types: ['number']
|
|
1257
|
-
}, {
|
|
1258
|
-
value: 'ref',
|
|
1259
|
-
required: false,
|
|
1260
|
-
types: ['string']
|
|
1261
|
-
}, {
|
|
1262
|
-
value: 'card',
|
|
1263
|
-
required: false,
|
|
1264
|
-
types: ['string']
|
|
1265
|
-
}, {
|
|
1266
|
-
value: 'bank',
|
|
1267
|
-
required: false,
|
|
1268
|
-
types: ['string']
|
|
1269
|
-
}, {
|
|
1270
|
-
value: 'split',
|
|
1271
|
-
required: false,
|
|
1272
|
-
types: ['object']
|
|
1273
|
-
}, {
|
|
1274
|
-
value: 'split_code',
|
|
1275
|
-
required: false,
|
|
1276
|
-
types: ['string']
|
|
1277
|
-
}, {
|
|
1278
|
-
value: 'transaction_type',
|
|
1279
|
-
required: false,
|
|
1280
|
-
types: ['string']
|
|
1281
|
-
}, {
|
|
1282
|
-
value: 'subscription',
|
|
1283
|
-
required: false,
|
|
1284
|
-
types: ['number']
|
|
1285
|
-
}, {
|
|
1286
|
-
value: 'language',
|
|
1287
|
-
required: false,
|
|
1288
|
-
types: ['string']
|
|
1289
|
-
}, {
|
|
1290
|
-
value: 'connect_account',
|
|
1291
|
-
required: false,
|
|
1292
|
-
types: ['string']
|
|
1293
|
-
}, {
|
|
1294
|
-
value: 'connect_split',
|
|
1295
|
-
required: false,
|
|
1296
|
-
types: ['array']
|
|
1297
|
-
}];
|
|
1298
|
-
function validate(args) {
|
|
1299
|
-
function ValidationError(message, issues) {
|
|
1300
|
-
this.message = message;
|
|
1301
|
-
this.issues = issues || [];
|
|
1302
|
-
}
|
|
1303
|
-
if (!args || _typeof(args) !== 'object') {
|
|
1304
|
-
throw new ValidationError('Transaction parameters should be a non-empty object');
|
|
1305
|
-
}
|
|
1306
|
-
var transactionParameters = args;
|
|
1307
|
-
|
|
1308
|
-
// If it's a transaction resumption, move on
|
|
1309
|
-
if ('accessCode' in transactionParameters) {
|
|
1310
|
-
var accessCode = transactionParameters.accessCode;
|
|
1311
|
-
return {
|
|
1312
|
-
accessCode: accessCode
|
|
1313
|
-
};
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
// Filter unneeded parameters
|
|
1317
|
-
Object.keys(transactionParameters).forEach(function (key) {
|
|
1318
|
-
var usedParameter = allParameters.find(function (parameter) {
|
|
1319
|
-
return parameter.value === key;
|
|
1320
|
-
}) !== undefined;
|
|
1321
|
-
if (!usedParameter) {
|
|
1322
|
-
delete transactionParameters[key];
|
|
1323
|
-
}
|
|
1324
|
-
});
|
|
1325
|
-
var transactionKeys = Object.keys(transactionParameters);
|
|
1326
|
-
var validationErrors = [];
|
|
1327
|
-
|
|
1328
|
-
// Check for required parameters
|
|
1329
|
-
var requiredParameters = allParameters.filter(function (param) {
|
|
1330
|
-
return param.required;
|
|
1331
|
-
});
|
|
1332
|
-
requiredParameters.forEach(function (key) {
|
|
1333
|
-
var parameterIsMissing = !transactionParameters[key.value];
|
|
1334
|
-
var parameterHasAlternative = key.or ? key.or.some(function (option) {
|
|
1335
|
-
return transactionParameters[option];
|
|
1336
|
-
}) : null;
|
|
1337
|
-
if (parameterIsMissing && !parameterHasAlternative) {
|
|
1338
|
-
validationErrors.push({
|
|
1339
|
-
message: "Required parameter missing: ".concat(key.value)
|
|
1340
|
-
});
|
|
1341
|
-
}
|
|
1342
|
-
});
|
|
1343
|
-
|
|
1344
|
-
// Check for validity
|
|
1345
|
-
transactionKeys.forEach(function (key) {
|
|
1346
|
-
var parameterValue = transactionParameters[key];
|
|
1347
|
-
var parameterObject = allParameters.find(function (parameter) {
|
|
1348
|
-
return parameter.value === key;
|
|
1349
|
-
});
|
|
1350
|
-
var providedType = _typeof(parameterValue);
|
|
1351
|
-
if (providedType === 'object' && Array.isArray(parameterValue)) {
|
|
1352
|
-
providedType = 'array';
|
|
1353
|
-
}
|
|
1354
|
-
var invalidType = parameterObject.types.indexOf(providedType) <= -1;
|
|
1355
|
-
if (invalidType) {
|
|
1356
|
-
validationErrors.push({
|
|
1357
|
-
message: "Invalid parameter type: ".concat(key),
|
|
1358
|
-
validTypes: parameterObject.types
|
|
1359
|
-
});
|
|
1360
|
-
}
|
|
1361
|
-
});
|
|
1362
|
-
|
|
1363
|
-
// Override keys where necessary
|
|
1364
|
-
transactionKeys.forEach(function (key) {
|
|
1365
|
-
var parameterObject = allParameters.find(function (parameter) {
|
|
1366
|
-
return parameter.value === key;
|
|
1367
|
-
});
|
|
1368
|
-
if (parameterObject.override) {
|
|
1369
|
-
delete transactionParameters[parameterObject.override];
|
|
1370
|
-
}
|
|
1371
|
-
});
|
|
1372
|
-
if (validationErrors.length) {
|
|
1373
|
-
throw new ValidationError('Invalid transaction parameters', validationErrors);
|
|
1374
|
-
}
|
|
1375
|
-
return transactionParameters;
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
/* eslint-env browser */
|
|
1379
|
-
function splitURL(url) {
|
|
1380
|
-
if ((url === null || url === void 0 ? void 0 : url.length) > 500) {
|
|
1381
|
-
return url.split('?')[0];
|
|
1382
|
-
}
|
|
1383
|
-
return url;
|
|
1384
|
-
}
|
|
1385
|
-
function getReferrer() {
|
|
1386
|
-
var _window$location = window.location,
|
|
1387
|
-
_window$location$href = _window$location.href,
|
|
1388
|
-
href = _window$location$href === void 0 ? '' : _window$location$href,
|
|
1389
|
-
_window$location$ance = _window$location.ancestorOrigins,
|
|
1390
|
-
ancestorOrigins = _window$location$ance === void 0 ? [] : _window$location$ance;
|
|
1391
|
-
return [href].concat(_toConsumableArray(ancestorOrigins)).map(splitURL).join(',');
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
function buildQuery(parameters) {
|
|
1395
|
-
var formattedParameters = _objectSpread2({}, parameters);
|
|
1396
|
-
formattedParameters.metadata = parameters.metadata || {};
|
|
1397
|
-
formattedParameters.metadata.referrer = getReferrer();
|
|
1398
|
-
formattedParameters.metadata = JSON.stringify(formattedParameters.metadata);
|
|
1399
|
-
formattedParameters.mode = 'popup';
|
|
1400
|
-
if (parameters.split && typeof parameters.split !== 'string') {
|
|
1401
|
-
formattedParameters.split = JSON.stringify(formattedParameters.split);
|
|
1402
|
-
}
|
|
1403
|
-
var parametersToChange = [{
|
|
1404
|
-
to: 'firstname',
|
|
1405
|
-
from: 'firstName'
|
|
1406
|
-
}, {
|
|
1407
|
-
to: 'lastname',
|
|
1408
|
-
from: 'lastName'
|
|
1409
|
-
}, {
|
|
1410
|
-
to: 'customer_code',
|
|
1411
|
-
from: 'customerCode'
|
|
1412
|
-
}, {
|
|
1413
|
-
to: 'payment_request',
|
|
1414
|
-
from: 'paymentRequest'
|
|
1415
|
-
}, {
|
|
1416
|
-
to: 'subaccount',
|
|
1417
|
-
from: 'subaccountCode'
|
|
1418
|
-
}, {
|
|
1419
|
-
to: 'transaction_charge',
|
|
1420
|
-
from: 'transactionCharge'
|
|
1421
|
-
}, {
|
|
1422
|
-
to: 'plan',
|
|
1423
|
-
from: 'planCode'
|
|
1424
|
-
}, {
|
|
1425
|
-
to: 'quantity',
|
|
1426
|
-
from: 'subscriptionCount'
|
|
1427
|
-
}, {
|
|
1428
|
-
to: 'interval',
|
|
1429
|
-
from: 'planInterval'
|
|
1430
|
-
}, {
|
|
1431
|
-
to: 'invoice_limit',
|
|
1432
|
-
from: 'subscriptionLimit'
|
|
1433
|
-
}, {
|
|
1434
|
-
to: 'start_date',
|
|
1435
|
-
from: 'subscriptionStartDate'
|
|
1436
|
-
}, {
|
|
1437
|
-
to: 'ref',
|
|
1438
|
-
from: 'reference'
|
|
1439
|
-
}];
|
|
1440
|
-
|
|
1441
|
-
// handle very old case of people disabling channels by sending card/bank params
|
|
1442
|
-
|
|
1443
|
-
if (formattedParameters.card !== undefined && ['false', false].indexOf(formattedParameters.card) > -1) {
|
|
1444
|
-
formattedParameters.channels = ['bank'];
|
|
1445
|
-
delete formattedParameters.card;
|
|
1446
|
-
}
|
|
1447
|
-
if (formattedParameters.bank !== undefined && ['false', false].indexOf(formattedParameters.bank) > -1) {
|
|
1448
|
-
formattedParameters.channels = ['card'];
|
|
1449
|
-
delete formattedParameters.bank;
|
|
1450
|
-
}
|
|
1451
|
-
parametersToChange.forEach(function (key) {
|
|
1452
|
-
var hasValue = formattedParameters[key.from];
|
|
1453
|
-
if (hasValue) {
|
|
1454
|
-
formattedParameters[key.to] = formattedParameters[key.from];
|
|
1455
|
-
delete formattedParameters[key.from];
|
|
1456
|
-
}
|
|
1457
|
-
});
|
|
1458
|
-
Object.values(parameters).forEach(function (value, index) {
|
|
1459
|
-
if (typeof value === 'function') {
|
|
1460
|
-
var key = Object.keys(parameters)[index];
|
|
1461
|
-
delete formattedParameters[key];
|
|
1462
|
-
}
|
|
1463
|
-
});
|
|
1464
|
-
return formattedParameters;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
/* eslint-env browser */
|
|
1468
|
-
|
|
1469
|
-
var iOSDevices = ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'];
|
|
1470
|
-
|
|
1471
|
-
/**
|
|
1472
|
-
* navigator.platform is deprecated and will eventually be removed
|
|
1473
|
-
* but the recommended alternative `navigator.userAgentData` has limited browser support
|
|
1474
|
-
* so it is used as a fallback here.
|
|
1475
|
-
*/
|
|
1476
|
-
var DEVICE_PLATFORM = window && window.navigator && (window.navigator.platform || window.navigator.userAgentData && window.navigator.userAgentData.platform);
|
|
1477
|
-
var isIOS = function isIOS() {
|
|
1478
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1479
|
-
platform = _ref.platform,
|
|
1480
|
-
_ref$userAgent = _ref.userAgent,
|
|
1481
|
-
userAgent = _ref$userAgent === void 0 ? window && window.navigator && window.navigator.userAgent : _ref$userAgent;
|
|
1482
|
-
var devicePlatform = platform || DEVICE_PLATFORM;
|
|
1483
|
-
return iOSDevices.includes(devicePlatform) ||
|
|
1484
|
-
// iPAD os safari detection. iPad OS uses the same version of safari as Mac OS
|
|
1485
|
-
userAgent.includes('Mac') && 'ontouchend' in document;
|
|
1486
|
-
};
|
|
1487
|
-
|
|
1488
|
-
/* eslint-env browser */
|
|
1489
|
-
var AnalyticsAPI = {
|
|
1490
|
-
saveLog: function saveLog(transactionId, merchantPublicKey, log) {
|
|
1491
|
-
var url = "".concat(config.paystackApiUrl, "transaction/update_log/").concat(transactionId);
|
|
1492
|
-
var headers = {
|
|
1493
|
-
Authorization: "Bearer ".concat(merchantPublicKey)
|
|
1494
|
-
};
|
|
1495
|
-
return fetch(url, {
|
|
1496
|
-
method: 'POST',
|
|
1497
|
-
body: JSON.stringify({
|
|
1498
|
-
payload: JSON.stringify(log)
|
|
1499
|
-
}),
|
|
1500
|
-
headers: headers
|
|
1501
|
-
});
|
|
1502
|
-
},
|
|
1503
|
-
saveIp: function saveIp(transactionId, merchantPublicKey) {
|
|
1504
|
-
var url = "".concat(config.paystackApiUrl, "transaction/set_ip/").concat(transactionId);
|
|
1505
|
-
var headers = {
|
|
1506
|
-
Authorization: "Bearer ".concat(merchantPublicKey)
|
|
1507
|
-
};
|
|
1508
|
-
return fetch(url, {
|
|
1509
|
-
method: 'POST',
|
|
1510
|
-
headers: headers
|
|
1511
|
-
});
|
|
1512
|
-
}
|
|
1513
|
-
};
|
|
1514
|
-
|
|
1515
|
-
var AnalyticsFunctions = {
|
|
1516
|
-
initializeLog: function initializeLog(log) {
|
|
1517
|
-
var _ref = log || {},
|
|
1518
|
-
attempts = _ref.attempts,
|
|
1519
|
-
authentication = _ref.authentication,
|
|
1520
|
-
errors = _ref.errors,
|
|
1521
|
-
history = _ref.history;
|
|
1522
|
-
this.log = {
|
|
1523
|
-
start_time: Math.round(Date.now() / 1000),
|
|
1524
|
-
time_spent: 0,
|
|
1525
|
-
attempts: attempts || 0,
|
|
1526
|
-
authentication: authentication,
|
|
1527
|
-
errors: errors || 0,
|
|
1528
|
-
success: false,
|
|
1529
|
-
mobile: isIOS(),
|
|
1530
|
-
input: [],
|
|
1531
|
-
history: history || []
|
|
1532
|
-
};
|
|
1533
|
-
},
|
|
1534
|
-
getTimeSpent: function getTimeSpent() {
|
|
1535
|
-
var currentTimeInSeconds = Math.round(Date.now() / 1000);
|
|
1536
|
-
this.log.time_spent = currentTimeInSeconds - this.log.start_time;
|
|
1537
|
-
return this.log.time_spent;
|
|
1538
|
-
},
|
|
1539
|
-
logAPIResponse: function logAPIResponse(response, channel) {
|
|
1540
|
-
switch (response.status) {
|
|
1541
|
-
case TRANSACTION_STATUS.SUCCESS:
|
|
1542
|
-
return this.logApiSuccess(channel);
|
|
1543
|
-
case TRANSACTION_STATUS.FAILED:
|
|
1544
|
-
return this.logApiError(response.message);
|
|
1545
|
-
default:
|
|
1546
|
-
return false;
|
|
1547
|
-
}
|
|
1548
|
-
},
|
|
1549
|
-
logValidationResponse: function logValidationResponse(message) {
|
|
1550
|
-
this.log.history.push({
|
|
1551
|
-
type: 'action',
|
|
1552
|
-
message: message,
|
|
1553
|
-
time: this.getTimeSpent()
|
|
1554
|
-
});
|
|
1555
|
-
return this.saveLog();
|
|
1556
|
-
},
|
|
1557
|
-
logAttempt: function logAttempt(channel) {
|
|
1558
|
-
var message = 'Attempted to pay';
|
|
1559
|
-
if (channel) {
|
|
1560
|
-
message += " with ".concat(channel);
|
|
1561
|
-
}
|
|
1562
|
-
this.log.attempts += 1;
|
|
1563
|
-
this.log.history.push({
|
|
1564
|
-
type: 'action',
|
|
1565
|
-
message: message,
|
|
1566
|
-
time: this.getTimeSpent()
|
|
1567
|
-
});
|
|
1568
|
-
return this.saveLog();
|
|
1569
|
-
},
|
|
1570
|
-
logApiError: function logApiError(error) {
|
|
1571
|
-
var message = 'Error';
|
|
1572
|
-
if (error) {
|
|
1573
|
-
message += ": ".concat(error);
|
|
1574
|
-
}
|
|
1575
|
-
this.log.errors += 1;
|
|
1576
|
-
this.log.history.push({
|
|
1577
|
-
type: 'error',
|
|
1578
|
-
message: message,
|
|
1579
|
-
time: this.getTimeSpent()
|
|
1580
|
-
});
|
|
1581
|
-
return this.saveLog();
|
|
1582
|
-
},
|
|
1583
|
-
logApiSuccess: function logApiSuccess(channel) {
|
|
1584
|
-
var message = 'Successfully paid';
|
|
1585
|
-
if (channel) {
|
|
1586
|
-
message += " with ".concat(channel);
|
|
1587
|
-
}
|
|
1588
|
-
this.log.success = true;
|
|
1589
|
-
this.log.history.push({
|
|
1590
|
-
type: 'success',
|
|
1591
|
-
message: message,
|
|
1592
|
-
time: this.getTimeSpent()
|
|
1593
|
-
});
|
|
1594
|
-
return this.saveLog();
|
|
1595
|
-
},
|
|
1596
|
-
saveLog: function saveLog() {
|
|
1597
|
-
try {
|
|
1598
|
-
if (this.response) {
|
|
1599
|
-
return AnalyticsAPI.saveLog(this.id, this.response.merchant_key, this.log);
|
|
1600
|
-
}
|
|
1601
|
-
} catch (error) {
|
|
1602
|
-
// we don't need to do anything since this should not affect the transaction
|
|
1603
|
-
}
|
|
1604
|
-
return undefined;
|
|
1605
|
-
},
|
|
1606
|
-
saveIpAddress: function saveIpAddress() {
|
|
1607
|
-
try {
|
|
1608
|
-
if (this.response) {
|
|
1609
|
-
return AnalyticsAPI.saveIp(this.id, this.response.merchant_key);
|
|
1610
|
-
}
|
|
1611
|
-
} catch (error) {
|
|
1612
|
-
// we don't need to do anything since this should not affect the transaction
|
|
1613
|
-
}
|
|
1614
|
-
return undefined;
|
|
1615
|
-
}
|
|
1616
|
-
};
|
|
1617
|
-
|
|
1618
|
-
var _excluded$1 = ["language", "connect_account"];
|
|
1619
|
-
var TransactionApi = {
|
|
1620
|
-
requestInline: function requestInline() {
|
|
1621
|
-
var inlineTransactionInstance = this;
|
|
1622
|
-
var _this$urlParameters = this.urlParameters,
|
|
1623
|
-
language = _this$urlParameters.language,
|
|
1624
|
-
connectAccount = _this$urlParameters.connect_account,
|
|
1625
|
-
params = _objectWithoutProperties(_this$urlParameters, _excluded$1);
|
|
1626
|
-
var request;
|
|
1627
|
-
var headers = _objectSpread2({
|
|
1628
|
-
'Content-Type': 'application/json'
|
|
1629
|
-
}, language && {
|
|
1630
|
-
'Accept-Language': language
|
|
1631
|
-
});
|
|
1632
|
-
if (this.accessCode) {
|
|
1633
|
-
request = fetch(new URL("transaction/verify_access_code/".concat(this.accessCode), config.paystackApiUrl).toString(), {
|
|
1634
|
-
headers: headers
|
|
1635
|
-
});
|
|
1636
|
-
} else {
|
|
1637
|
-
request = fetch(new URL('/checkout/request_inline', config.paystackApiUrl).toString(), {
|
|
1638
|
-
method: 'POST',
|
|
1639
|
-
body: JSON.stringify(params),
|
|
1640
|
-
headers: _objectSpread2(_objectSpread2({}, headers), connectAccount && {
|
|
1641
|
-
'x-connect-account': connectAccount
|
|
1642
|
-
})
|
|
1643
|
-
});
|
|
1644
|
-
}
|
|
1645
|
-
return request.then(function (res) {
|
|
1646
|
-
return res.json();
|
|
1647
|
-
}).then(function (res) {
|
|
1648
|
-
if (res.status === false) {
|
|
1649
|
-
throw new Error(res.message);
|
|
1650
|
-
}
|
|
1651
|
-
inlineTransactionInstance.response = res.data;
|
|
1652
|
-
inlineTransactionInstance.id = res.data.id;
|
|
1653
|
-
inlineTransactionInstance.status = res.data.transaction_status;
|
|
1654
|
-
inlineTransactionInstance.accessCode = res.data.access_code;
|
|
1655
|
-
|
|
1656
|
-
// Analytics
|
|
1657
|
-
inlineTransactionInstance.log = null;
|
|
1658
|
-
Object.assign(inlineTransactionInstance, AnalyticsFunctions);
|
|
1659
|
-
inlineTransactionInstance.initializeLog(res.data.log);
|
|
1660
|
-
inlineTransactionInstance.saveIpAddress();
|
|
1661
|
-
return res.data;
|
|
1662
|
-
});
|
|
1663
|
-
}
|
|
1664
|
-
};
|
|
1665
|
-
|
|
1666
|
-
var InlineTransaction = /*#__PURE__*/function () {
|
|
1667
|
-
function InlineTransaction(data) {
|
|
1668
|
-
_classCallCheck(this, InlineTransaction);
|
|
1669
|
-
validate(data);
|
|
1670
|
-
this.parameters = data;
|
|
1671
|
-
this.urlParameters = buildQuery(data);
|
|
1672
|
-
this.id = null;
|
|
1673
|
-
this.status = null;
|
|
1674
|
-
this.accessCode = data.accessCode || null;
|
|
1675
|
-
this.authorizationUrl = null;
|
|
1676
|
-
this.errors = [];
|
|
1677
|
-
this.response = null;
|
|
1678
|
-
this.isActive = true;
|
|
1679
|
-
var onError = data.onError,
|
|
1680
|
-
onLoad = data.onLoad,
|
|
1681
|
-
onSuccess = data.onSuccess,
|
|
1682
|
-
onCancel = data.onCancel,
|
|
1683
|
-
callback = data.callback,
|
|
1684
|
-
onClose = data.onClose,
|
|
1685
|
-
onBankTransferConfirmationPending = data.onBankTransferConfirmationPending;
|
|
1686
|
-
this.callbacks = {
|
|
1687
|
-
onError: onError,
|
|
1688
|
-
onLoad: onLoad,
|
|
1689
|
-
onSuccess: onSuccess,
|
|
1690
|
-
onCancel: onCancel,
|
|
1691
|
-
onBankTransferConfirmationPending: onBankTransferConfirmationPending
|
|
1692
|
-
};
|
|
1693
|
-
this.deprecatedCallbacks = {
|
|
1694
|
-
callback: callback,
|
|
1695
|
-
onClose: onClose
|
|
1696
|
-
};
|
|
1697
|
-
Object.assign(this, TransactionApi);
|
|
1698
|
-
}
|
|
1699
|
-
return _createClass(InlineTransaction, [{
|
|
1700
|
-
key: "onSetupError",
|
|
1701
|
-
value: function onSetupError(response) {
|
|
1702
|
-
this.logError(response);
|
|
1703
|
-
if (this.callbacks.onError) {
|
|
1704
|
-
this.callbacks.onError(response);
|
|
1705
|
-
}
|
|
1706
|
-
}
|
|
1707
|
-
}, {
|
|
1708
|
-
key: "onLoad",
|
|
1709
|
-
value: function onLoad(response) {
|
|
1710
|
-
var id = response.id,
|
|
1711
|
-
customer = response.customer,
|
|
1712
|
-
accessCode = response.accessCode;
|
|
1713
|
-
Object.assign(this, {
|
|
1714
|
-
id: id,
|
|
1715
|
-
customer: customer,
|
|
1716
|
-
accessCode: accessCode
|
|
1717
|
-
});
|
|
1718
|
-
this.authorizationUrl = "".concat(config.checkoutUrl).concat(accessCode);
|
|
1719
|
-
if (this.callbacks.onLoad) {
|
|
1720
|
-
this.callbacks.onLoad({
|
|
1721
|
-
id: id,
|
|
1722
|
-
customer: customer,
|
|
1723
|
-
accessCode: accessCode
|
|
1724
|
-
});
|
|
1725
|
-
}
|
|
1726
|
-
}
|
|
1727
|
-
}, {
|
|
1728
|
-
key: "onSuccess",
|
|
1729
|
-
value: function onSuccess(response) {
|
|
1730
|
-
this.isActive = false;
|
|
1731
|
-
this.response = response;
|
|
1732
|
-
this.status = response.status;
|
|
1733
|
-
if (this.callbacks.onSuccess) {
|
|
1734
|
-
this.callbacks.onSuccess(response);
|
|
1735
|
-
}
|
|
1736
|
-
// Added for backwards compatibility
|
|
1737
|
-
if (this.deprecatedCallbacks.callback) {
|
|
1738
|
-
this.deprecatedCallbacks.callback(response);
|
|
1739
|
-
}
|
|
1740
|
-
}
|
|
1741
|
-
}, {
|
|
1742
|
-
key: "setStatus",
|
|
1743
|
-
value: function setStatus(status) {
|
|
1744
|
-
this.status = status;
|
|
1745
|
-
}
|
|
1746
|
-
}, {
|
|
1747
|
-
key: "onCancel",
|
|
1748
|
-
value: function onCancel() {
|
|
1749
|
-
if (this.callbacks.onCancel) {
|
|
1750
|
-
this.callbacks.onCancel();
|
|
1751
|
-
}
|
|
1752
|
-
// Added for backwards compatibility
|
|
1753
|
-
if (this.deprecatedCallbacks.onClose) {
|
|
1754
|
-
this.deprecatedCallbacks.onClose();
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
}, {
|
|
1758
|
-
key: "cancel",
|
|
1759
|
-
value: function cancel() {
|
|
1760
|
-
this.isActive = false;
|
|
1761
|
-
this.onCancel();
|
|
1762
|
-
}
|
|
1763
|
-
}, {
|
|
1764
|
-
key: "onBankTransferConfirmationPending",
|
|
1765
|
-
value: function onBankTransferConfirmationPending() {
|
|
1766
|
-
this.cancel();
|
|
1767
|
-
if (this.callbacks.onBankTransferConfirmationPending) {
|
|
1768
|
-
this.callbacks.onBankTransferConfirmationPending();
|
|
1769
|
-
}
|
|
1770
|
-
}
|
|
1771
|
-
}, {
|
|
1772
|
-
key: "logError",
|
|
1773
|
-
value: function logError(error) {
|
|
1774
|
-
this.errors.push(error);
|
|
1775
|
-
}
|
|
1776
|
-
}]);
|
|
1777
|
-
}();
|
|
1778
|
-
|
|
1779
|
-
var _excluded = ["preload", "inlineTransaction", "transactionData"],
|
|
1780
|
-
_excluded2 = ["container", "styles", "onElementsMount"],
|
|
1781
|
-
_excluded3 = ["data"];
|
|
1782
|
-
var inlineInstance;
|
|
1783
|
-
function findResumableTransaction(transactions, parameters) {
|
|
1784
|
-
if (!transactions.length) {
|
|
1785
|
-
return null;
|
|
1786
|
-
}
|
|
1787
|
-
var similarAbandonedTransactions = transactions.filter(function (transaction) {
|
|
1788
|
-
var isAbandoned = !transaction.status || transaction.status === 'abandoned';
|
|
1789
|
-
var hasSimilarParameters = similarObjects(transaction.parameters, parameters);
|
|
1790
|
-
return isAbandoned && hasSimilarParameters;
|
|
1791
|
-
});
|
|
1792
|
-
var resumableTransaction = similarAbandonedTransactions.length ? similarAbandonedTransactions[similarAbandonedTransactions.length - 1] : null;
|
|
1793
|
-
return resumableTransaction;
|
|
1794
|
-
}
|
|
1795
|
-
function notifyIframeToUpdateURL(options) {
|
|
1796
|
-
var checkoutIframe = options.checkoutIframe,
|
|
1797
|
-
urlParameters = options.urlParameters;
|
|
1798
|
-
if (!checkoutIframe || !urlParameters) {
|
|
1799
|
-
return;
|
|
1800
|
-
}
|
|
1801
|
-
checkoutIframe.contentWindow.postMessage({
|
|
1802
|
-
type: 'inline:url',
|
|
1803
|
-
path: 'newTransaction',
|
|
1804
|
-
params: urlParameters
|
|
1805
|
-
}, '*');
|
|
1806
|
-
}
|
|
1807
|
-
var analyticsActions = {
|
|
1808
|
-
TRACK_PAYMENT_ERROR: 'trackPaymentError',
|
|
1809
|
-
TRACK_PAYMENT_ATTEMPT: 'trackPaymentAttempt',
|
|
1810
|
-
TRACK_PAYMENT_COMPLETION: 'trackPaymentCompletion'
|
|
1811
|
-
};
|
|
1812
|
-
function handleError(message) {
|
|
1813
|
-
logWarning(message);
|
|
1814
|
-
throw new Error(message);
|
|
1815
|
-
}
|
|
1816
|
-
var Inline = /*#__PURE__*/function () {
|
|
1817
|
-
function Inline(params) {
|
|
1818
|
-
_classCallCheck(this, Inline);
|
|
1819
|
-
this.id = randomId();
|
|
1820
|
-
this.transactions = [];
|
|
1821
|
-
this.isOpen = false;
|
|
1822
|
-
this.isLoaded = false;
|
|
1823
|
-
this.isCharging = false;
|
|
1824
|
-
this.isDeprecatedApi = params && params.isDeprecatedApi; // track deprecatedApi
|
|
1825
|
-
if (params && params.isEmbed) {
|
|
1826
|
-
this.isEmbed = true;
|
|
1827
|
-
} else if (params && params.isPaymentRequest) {
|
|
1828
|
-
if (!(params.container && getPaymentRequestContainer(params.container))) {
|
|
1829
|
-
handleError('A container is required to mount the payment request button');
|
|
1830
|
-
}
|
|
1831
|
-
this.paymentRequestContainer = getPaymentRequestContainer(params.container);
|
|
1832
|
-
this.paymentRequestTransaction = null;
|
|
1833
|
-
}
|
|
1834
|
-
this.backgroundIframe = mountBackgroundIframe(this.id);
|
|
1835
|
-
this.checkoutIframe = mountCheckoutIframe(this.id);
|
|
1836
|
-
this.registerListeners();
|
|
1837
|
-
}
|
|
1838
|
-
return _createClass(Inline, [{
|
|
1839
|
-
key: "registerListeners",
|
|
1840
|
-
value: function registerListeners() {
|
|
1841
|
-
var _this = this;
|
|
1842
|
-
window.addEventListener('message', function (event) {
|
|
1843
|
-
var isCheckoutIframe = "".concat(event.origin, "/") === config.checkoutUrl;
|
|
1844
|
-
var isThisInline = _this.checkoutIframe && _this.checkoutIframe.contentWindow === event.source;
|
|
1845
|
-
var isEmbed = _this.isEmbed;
|
|
1846
|
-
if (isCheckoutIframe || isThisInline) {
|
|
1847
|
-
_this.respondToEvent(event);
|
|
1848
|
-
} else if (isEmbed) {
|
|
1849
|
-
_this.respondToEmbedEvents(event);
|
|
1850
|
-
}
|
|
1851
|
-
});
|
|
1852
|
-
}
|
|
1853
|
-
}, {
|
|
1854
|
-
key: "sendAnalyticsEventToCheckout",
|
|
1855
|
-
value: function sendAnalyticsEventToCheckout(action, params) {
|
|
1856
|
-
this.checkoutIframe.contentWindow.postMessage({
|
|
1857
|
-
type: 'analytics',
|
|
1858
|
-
action: action,
|
|
1859
|
-
params: params
|
|
1860
|
-
}, '*');
|
|
1861
|
-
}
|
|
1862
|
-
}, {
|
|
1863
|
-
key: "checkout",
|
|
1864
|
-
value: function checkout(params) {
|
|
1865
|
-
if (this.activeTransaction()) {
|
|
1866
|
-
this.activeTransaction().cancel();
|
|
1867
|
-
}
|
|
1868
|
-
inlineInstance = this;
|
|
1869
|
-
var resumableTransaction = findResumableTransaction(this.transactions, params);
|
|
1870
|
-
var transaction = resumableTransaction || new InlineTransaction(params);
|
|
1871
|
-
return new Promise(function (resolve, reject) {
|
|
1872
|
-
transaction.requestInline().then(function (response) {
|
|
1873
|
-
inlineInstance.newTransaction({
|
|
1874
|
-
inlineTransaction: transaction,
|
|
1875
|
-
transactionData: response
|
|
1876
|
-
});
|
|
1877
|
-
resolve(transaction);
|
|
1878
|
-
}).catch(function (error) {
|
|
1879
|
-
transaction.onSetupError({
|
|
1880
|
-
status: false,
|
|
1881
|
-
message: error.message
|
|
1882
|
-
});
|
|
1883
|
-
reject(error);
|
|
1884
|
-
});
|
|
1885
|
-
});
|
|
1886
|
-
}
|
|
1887
|
-
}, {
|
|
1888
|
-
key: "newTransaction",
|
|
1889
|
-
value: function newTransaction(_ref) {
|
|
1890
|
-
var preload = _ref.preload,
|
|
1891
|
-
inlineTransaction = _ref.inlineTransaction,
|
|
1892
|
-
transactionData = _ref.transactionData,
|
|
1893
|
-
options = _objectWithoutProperties(_ref, _excluded);
|
|
1894
|
-
var hasPaymentRequestButtons = this.hasMountedPaymentRequestButtons();
|
|
1895
|
-
var activeTransaction = this.activeTransaction();
|
|
1896
|
-
if (activeTransaction && !hasPaymentRequestButtons && activeTransaction !== inlineTransaction) {
|
|
1897
|
-
activeTransaction.cancel();
|
|
1898
|
-
}
|
|
1899
|
-
if (inlineTransaction && transactionData) {
|
|
1900
|
-
if (!this.transactions.includes(inlineTransaction)) {
|
|
1901
|
-
this.transactions.push(inlineTransaction);
|
|
1902
|
-
}
|
|
1903
|
-
if (!this.isDeprecatedApi) {
|
|
1904
|
-
// TODO: reintroduce this when we resolve checkout caching issues
|
|
1905
|
-
// this.open({ transactionData }, preload);
|
|
1906
|
-
this.open({
|
|
1907
|
-
accessCode: transactionData.access_code,
|
|
1908
|
-
language: inlineTransaction.urlParameters.language
|
|
1909
|
-
}, preload);
|
|
1910
|
-
}
|
|
1911
|
-
return inlineTransaction;
|
|
1912
|
-
}
|
|
1913
|
-
var resumableTransaction = findResumableTransaction(this.transactions, inlineTransaction ? inlineTransaction.parameters : options);
|
|
1914
|
-
if (resumableTransaction) {
|
|
1915
|
-
resumableTransaction.isActive = true;
|
|
1916
|
-
if (!this.isDeprecatedApi) {
|
|
1917
|
-
// We could potentially optimize this also by checking if there is a `response` property on `resumableTransaction`
|
|
1918
|
-
this.open({
|
|
1919
|
-
accessCode: resumableTransaction.accessCode,
|
|
1920
|
-
language: resumableTransaction.urlParameters.language
|
|
1921
|
-
}, preload);
|
|
1922
|
-
}
|
|
1923
|
-
return resumableTransaction;
|
|
1924
|
-
}
|
|
1925
|
-
var transaction = inlineTransaction || new InlineTransaction(options);
|
|
1926
|
-
var params = transaction.accessCode ? {
|
|
1927
|
-
accessCode: transaction.accessCode,
|
|
1928
|
-
language: transaction.urlParameters.language
|
|
1929
|
-
} : transaction.urlParameters;
|
|
1930
|
-
this.transactions.push(transaction);
|
|
1931
|
-
if (!this.isDeprecatedApi) {
|
|
1932
|
-
this.open(params, preload);
|
|
1933
|
-
}
|
|
1934
|
-
return transaction;
|
|
1935
|
-
}
|
|
1936
|
-
}, {
|
|
1937
|
-
key: "preloadTransaction",
|
|
1938
|
-
value: function preloadTransaction(options) {
|
|
1939
|
-
var _this2 = this;
|
|
1940
|
-
this.newTransaction(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
1941
|
-
preload: true
|
|
1942
|
-
}));
|
|
1943
|
-
var loadPopup = function loadPopup() {
|
|
1944
|
-
return _this2.animateCheckoutIn();
|
|
1945
|
-
};
|
|
1946
|
-
return loadPopup;
|
|
1947
|
-
}
|
|
1948
|
-
}, {
|
|
1949
|
-
key: "paymentRequest",
|
|
1950
|
-
value: function paymentRequest(parameters) {
|
|
1951
|
-
var _this3 = this;
|
|
1952
|
-
var container = parameters.container,
|
|
1953
|
-
styles = parameters.styles,
|
|
1954
|
-
onElementsMount = parameters.onElementsMount,
|
|
1955
|
-
transactionParams = _objectWithoutProperties(parameters, _excluded2);
|
|
1956
|
-
inlineInstance = this;
|
|
1957
|
-
return new Promise(function (resolve, reject) {
|
|
1958
|
-
var loadPaystackCheckoutButton = document.querySelector("#".concat(parameters.loadPaystackCheckoutButton));
|
|
1959
|
-
if (inlineInstance.activeTransaction()) {
|
|
1960
|
-
inlineInstance.activeTransaction().cancel();
|
|
1961
|
-
}
|
|
1962
|
-
if (!(container && getPaymentRequestContainer(container))) {
|
|
1963
|
-
handleError('A container is required to mount the payment request button');
|
|
1964
|
-
}
|
|
1965
|
-
inlineInstance.paymentRequestContainer = getPaymentRequestContainer(container);
|
|
1966
|
-
var resumableTransaction = findResumableTransaction(inlineInstance.transactions, transactionParams);
|
|
1967
|
-
var transaction = resumableTransaction || new InlineTransaction(transactionParams);
|
|
1968
|
-
transaction.requestInline().then(function (response) {
|
|
1969
|
-
if (resumableTransaction) {
|
|
1970
|
-
transaction.isActive = true;
|
|
1971
|
-
} else {
|
|
1972
|
-
inlineInstance.transactions.push(transaction);
|
|
1973
|
-
}
|
|
1974
|
-
return mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
|
|
1975
|
-
transaction: transaction,
|
|
1976
|
-
styles: styles,
|
|
1977
|
-
onClickApplePayButton: function onClickApplePayButton() {
|
|
1978
|
-
return _this3.startApplePay(transaction);
|
|
1979
|
-
},
|
|
1980
|
-
onClickGooglePayButton: function onClickGooglePayButton() {
|
|
1981
|
-
return _this3.startGooglePay(transaction);
|
|
1982
|
-
}
|
|
1983
|
-
}).then(function (mountedElements) {
|
|
1984
|
-
if (onElementsMount) {
|
|
1985
|
-
onElementsMount(mountedElements);
|
|
1986
|
-
}
|
|
1987
|
-
}).catch(function () {
|
|
1988
|
-
if (onElementsMount) {
|
|
1989
|
-
onElementsMount(null);
|
|
1990
|
-
}
|
|
1991
|
-
}).finally(function () {
|
|
1992
|
-
if (loadPaystackCheckoutButton) {
|
|
1993
|
-
var loadPopup = inlineInstance.preloadTransaction({
|
|
1994
|
-
inlineTransaction: transaction,
|
|
1995
|
-
transactionData: response
|
|
1996
|
-
});
|
|
1997
|
-
loadPaystackCheckoutButton.onclick = loadPopup;
|
|
1998
|
-
} else if (!inlineInstance.hasMountedPaymentRequestButtons()) {
|
|
1999
|
-
logWarning("No payment request button could be mounted on this device. Please consult our documentation at https://developers.paystack.co/docs/paystack-inline to see how to load alternative payment options using 'loadPaystackCheckoutButton'");
|
|
2000
|
-
}
|
|
2001
|
-
resolve(transaction);
|
|
2002
|
-
});
|
|
2003
|
-
}).catch(function (error) {
|
|
2004
|
-
transaction.onSetupError({
|
|
2005
|
-
status: false,
|
|
2006
|
-
message: error.message
|
|
2007
|
-
});
|
|
2008
|
-
reject(error);
|
|
2009
|
-
});
|
|
2010
|
-
});
|
|
2011
|
-
}
|
|
2012
|
-
}, {
|
|
2013
|
-
key: "hasMountedPaymentRequestButtons",
|
|
2014
|
-
value: function hasMountedPaymentRequestButtons() {
|
|
2015
|
-
return getMountedPaymentRequestButtons(this.paymentRequestContainer).length > 0;
|
|
2016
|
-
}
|
|
2017
|
-
}, {
|
|
2018
|
-
key: "startGooglePay",
|
|
2019
|
-
value: function startGooglePay(inlineTransaction) {
|
|
2020
|
-
var _this4 = this;
|
|
2021
|
-
var paymentMethod = 'google pay';
|
|
2022
|
-
var transaction = inlineTransaction || this.activeTransaction();
|
|
2023
|
-
if (inlineTransaction && !inlineTransaction.isActive) {
|
|
2024
|
-
logWarning('Google Pay: this button belongs to a transaction that is no longer active.');
|
|
2025
|
-
return Promise.resolve();
|
|
2026
|
-
}
|
|
2027
|
-
if (transaction && transaction.response) {
|
|
2028
|
-
if (this.isCharging) {
|
|
2029
|
-
return Promise.resolve();
|
|
2030
|
-
}
|
|
2031
|
-
this.isCharging = true;
|
|
2032
|
-
var notifyMerchant = function notifyMerchant(notify) {
|
|
2033
|
-
try {
|
|
2034
|
-
notify();
|
|
2035
|
-
} catch (error) {
|
|
2036
|
-
logWarning("Google Pay: a merchant callback threw. ".concat(error && error.message || error));
|
|
2037
|
-
}
|
|
2038
|
-
};
|
|
2039
|
-
try {
|
|
2040
|
-
var analyticsPayload = {
|
|
2041
|
-
channel: CHANNELS.GOOGLE_PAY,
|
|
2042
|
-
currency: transaction.response.currency,
|
|
2043
|
-
amount: getChannelAmount(transaction.response, CHANNELS.GOOGLE_PAY)
|
|
2044
|
-
};
|
|
2045
|
-
transaction.logAttempt(paymentMethod);
|
|
2046
|
-
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2047
|
-
paymentMethod: paymentMethod
|
|
2048
|
-
}));
|
|
2049
|
-
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
2050
|
-
return client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
|
|
2051
|
-
toggleGooglePayLoadingState(_this4.paymentRequestContainer, true);
|
|
2052
|
-
return chargeGooglePay({
|
|
2053
|
-
transactionId: transaction.id,
|
|
2054
|
-
paymentData: paymentData
|
|
2055
|
-
});
|
|
2056
|
-
}).then(function (response) {
|
|
2057
|
-
toggleGooglePayLoadingState(_this4.paymentRequestContainer, false);
|
|
2058
|
-
_this4.isCharging = false;
|
|
2059
|
-
transaction.logAPIResponse(response, paymentMethod);
|
|
2060
|
-
if (response.status === TRANSACTION_STATUS.SUCCESS) {
|
|
2061
|
-
var data = response.data,
|
|
2062
|
-
envelope = _objectWithoutProperties(response, _excluded3);
|
|
2063
|
-
notifyMerchant(function () {
|
|
2064
|
-
return transaction.onSuccess(_objectSpread2(_objectSpread2({}, data), envelope));
|
|
2065
|
-
});
|
|
2066
|
-
_this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2067
|
-
timeSpent: transaction.getTimeSpent()
|
|
2068
|
-
}));
|
|
2069
|
-
return;
|
|
2070
|
-
}
|
|
2071
|
-
|
|
2072
|
-
// `auth` means a step-up we cannot render here, so say so rather
|
|
2073
|
-
// than leaving the customer holding a token with nowhere to go.
|
|
2074
|
-
var message = response.status === TRANSACTION_STATUS.AUTH ? 'This card requires additional authentication, which is not supported here. Please use another payment method.' : response && response.message || 'Transaction attempt failed';
|
|
2075
|
-
notifyMerchant(function () {
|
|
2076
|
-
return transaction.onSetupError(_objectSpread2(_objectSpread2({}, response), {}, {
|
|
2077
|
-
message: message
|
|
2078
|
-
}));
|
|
2079
|
-
});
|
|
2080
|
-
_this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2081
|
-
channel: CHANNELS.GOOGLE_PAY,
|
|
2082
|
-
message: message
|
|
2083
|
-
});
|
|
2084
|
-
}, function (error) {
|
|
2085
|
-
toggleGooglePayLoadingState(_this4.paymentRequestContainer, false);
|
|
2086
|
-
_this4.isCharging = false;
|
|
2087
|
-
if (error && error.statusCode === GOOGLE_PAY_STATUS_CODE.CANCELED) {
|
|
2088
|
-
notifyMerchant(function () {
|
|
2089
|
-
return transaction.onCancel();
|
|
2090
|
-
});
|
|
2091
|
-
return;
|
|
2092
|
-
}
|
|
2093
|
-
var statusCode = error && error.statusCode;
|
|
2094
|
-
if (statusCode === GOOGLE_PAY_STATUS_CODE.DEVELOPER_ERROR || statusCode === GOOGLE_PAY_STATUS_CODE.MERCHANT_ACCOUNT_ERROR) {
|
|
2095
|
-
logWarning("Google Pay: ".concat(statusCode, ". Google rejected the merchant or the origin serving the button. Check that the merchant ID and domain saved in Dashboard > Developers > Google Pay match this page."));
|
|
2096
|
-
}
|
|
2097
|
-
var message = error && (error.statusMessage || error.message) || 'Could not complete the Google Pay payment';
|
|
2098
|
-
notifyMerchant(function () {
|
|
2099
|
-
return transaction.onSetupError({
|
|
2100
|
-
status: false,
|
|
2101
|
-
message: message
|
|
2102
|
-
});
|
|
2103
|
-
});
|
|
2104
|
-
_this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2105
|
-
channel: CHANNELS.GOOGLE_PAY,
|
|
2106
|
-
message: message
|
|
2107
|
-
});
|
|
2108
|
-
}).catch(function (error) {
|
|
2109
|
-
_this4.isCharging = false;
|
|
2110
|
-
logWarning("Google Pay: the charge handler failed. ".concat(error && error.message || error));
|
|
2111
|
-
notifyMerchant(function () {
|
|
2112
|
-
return transaction.onSetupError({
|
|
2113
|
-
status: false,
|
|
2114
|
-
message: 'Could not complete the Google Pay payment'
|
|
2115
|
-
});
|
|
2116
|
-
});
|
|
2117
|
-
});
|
|
2118
|
-
} catch (error) {
|
|
2119
|
-
this.isCharging = false;
|
|
2120
|
-
logWarning('Google Pay: could not start the charge.');
|
|
2121
|
-
notifyMerchant(function () {
|
|
2122
|
-
return transaction.onSetupError({
|
|
2123
|
-
status: false,
|
|
2124
|
-
message: 'Could not complete the Google Pay payment'
|
|
2125
|
-
});
|
|
2126
|
-
});
|
|
2127
|
-
return Promise.resolve();
|
|
2128
|
-
}
|
|
2129
|
-
} else {
|
|
2130
|
-
handleError('Could not initiate google pay transaction');
|
|
2131
|
-
}
|
|
2132
|
-
return Promise.resolve();
|
|
2133
|
-
}
|
|
2134
|
-
}, {
|
|
2135
|
-
key: "startApplePay",
|
|
2136
|
-
value: function startApplePay(inlineTransaction) {
|
|
2137
|
-
var _this5 = this;
|
|
2138
|
-
var paymentMethod = 'apple pay';
|
|
2139
|
-
var transaction = inlineTransaction || this.activeTransaction();
|
|
2140
|
-
if (inlineTransaction && !inlineTransaction.isActive) {
|
|
2141
|
-
logWarning('Apple Pay: this button belongs to a transaction that is no longer active.');
|
|
2142
|
-
return;
|
|
2143
|
-
}
|
|
2144
|
-
if (transaction && transaction.response) {
|
|
2145
|
-
if (this.isCharging) {
|
|
2146
|
-
return;
|
|
2147
|
-
}
|
|
2148
|
-
this.isCharging = true;
|
|
2149
|
-
try {
|
|
2150
|
-
var analyticsPayload = {
|
|
2151
|
-
channel: CHANNELS.APPLE_PAY,
|
|
2152
|
-
currency: transaction.response.currency,
|
|
2153
|
-
amount: getChannelAmount(transaction.response, CHANNELS.APPLE_PAY)
|
|
2154
|
-
};
|
|
2155
|
-
transaction.logAttempt(paymentMethod);
|
|
2156
|
-
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2157
|
-
paymentMethod: paymentMethod
|
|
2158
|
-
}));
|
|
2159
|
-
var applePayPaymentRequest = generateApplePaymentRequestObject({
|
|
2160
|
-
currency: transaction.response.currency,
|
|
2161
|
-
amount: getChannelAmount(transaction.response, CHANNELS.APPLE_PAY),
|
|
2162
|
-
merchantName: transaction.response.merchant_name,
|
|
2163
|
-
interval: transaction.response.plan_details && transaction.response.plan_details.interval
|
|
2164
|
-
});
|
|
2165
|
-
var applePaySession = new window.ApplePaySession(config.applePayVersion, applePayPaymentRequest);
|
|
2166
|
-
applePaySession.onvalidatemerchant = function (_ref2) {
|
|
2167
|
-
var validationURL = _ref2.validationURL;
|
|
2168
|
-
var validateSession = validateApplePaySession({
|
|
2169
|
-
validationURL: validationURL,
|
|
2170
|
-
transactionId: transaction.id,
|
|
2171
|
-
merchantName: transaction.response.merchant_name
|
|
2172
|
-
});
|
|
2173
|
-
validateSession.then(function (response) {
|
|
2174
|
-
if (response.status !== TRANSACTION_STATUS.SUCCESS) {
|
|
2175
|
-
_this5.isCharging = false;
|
|
2176
|
-
transaction.onSetupError(response);
|
|
2177
|
-
} else {
|
|
2178
|
-
applePaySession.completeMerchantValidation(response.data);
|
|
2179
|
-
}
|
|
2180
|
-
transaction.logValidationResponse(response.message);
|
|
2181
|
-
}).catch(function (error) {
|
|
2182
|
-
_this5.isCharging = false;
|
|
2183
|
-
transaction.onSetupError(error);
|
|
2184
|
-
});
|
|
2185
|
-
};
|
|
2186
|
-
applePaySession.oncancel = function () {
|
|
2187
|
-
_this5.isCharging = false;
|
|
2188
|
-
transaction.onCancel();
|
|
2189
|
-
};
|
|
2190
|
-
applePaySession.onpaymentauthorized = function (_ref3) {
|
|
2191
|
-
var payment = _ref3.payment;
|
|
2192
|
-
var charge = chargeApplePay({
|
|
2193
|
-
transactionId: transaction.id,
|
|
2194
|
-
payment: payment
|
|
2195
|
-
});
|
|
2196
|
-
charge.then(function (response) {
|
|
2197
|
-
transaction.logAPIResponse(response, paymentMethod);
|
|
2198
|
-
_this5.isCharging = false;
|
|
2199
|
-
if (response.status === TRANSACTION_STATUS.SUCCESS) {
|
|
2200
|
-
applePaySession.completePayment(applePaySession.STATUS_SUCCESS);
|
|
2201
|
-
transaction.onSuccess(response);
|
|
2202
|
-
_this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2203
|
-
timeSpent: transaction.getTimeSpent()
|
|
2204
|
-
}));
|
|
2205
|
-
} else {
|
|
2206
|
-
applePaySession.completePayment(applePaySession.STATUS_FAILURE);
|
|
2207
|
-
transaction.onSetupError(response);
|
|
2208
|
-
_this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2209
|
-
channel: CHANNELS.APPLE_PAY,
|
|
2210
|
-
message: response && response.message || 'Transaction attempt failed'
|
|
2211
|
-
});
|
|
2212
|
-
}
|
|
2213
|
-
}).catch(function (error) {
|
|
2214
|
-
_this5.isCharging = false;
|
|
2215
|
-
applePaySession.completePayment(applePaySession.STATUS_FAILURE);
|
|
2216
|
-
transaction.onSetupError(error);
|
|
2217
|
-
_this5.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2218
|
-
channel: CHANNELS.APPLE_PAY,
|
|
2219
|
-
message: error && error.message || 'Error occurred'
|
|
2220
|
-
});
|
|
2221
|
-
});
|
|
2222
|
-
};
|
|
2223
|
-
applePaySession.begin();
|
|
2224
|
-
} catch (error) {
|
|
2225
|
-
this.isCharging = false;
|
|
2226
|
-
transaction.onSetupError(error);
|
|
2227
|
-
}
|
|
2228
|
-
} else {
|
|
2229
|
-
handleError('Could not initiate apple pay transaction');
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
}, {
|
|
2233
|
-
key: "resumeTransaction",
|
|
2234
|
-
value: function resumeTransaction(accessCode) {
|
|
2235
|
-
var callbacks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2236
|
-
var onSuccess = callbacks.onSuccess,
|
|
2237
|
-
onCancel = callbacks.onCancel,
|
|
2238
|
-
onLoad = callbacks.onLoad,
|
|
2239
|
-
onError = callbacks.onError;
|
|
2240
|
-
return this.newTransaction({
|
|
2241
|
-
accessCode: accessCode,
|
|
2242
|
-
onSuccess: onSuccess,
|
|
2243
|
-
onCancel: onCancel,
|
|
2244
|
-
onLoad: onLoad,
|
|
2245
|
-
onError: onError
|
|
2246
|
-
});
|
|
2247
|
-
}
|
|
2248
|
-
}, {
|
|
2249
|
-
key: "activeTransaction",
|
|
2250
|
-
value: function activeTransaction() {
|
|
2251
|
-
var activeTransactions = this.transactions.filter(function (transaction) {
|
|
2252
|
-
return transaction.isActive;
|
|
2253
|
-
});
|
|
2254
|
-
var activeTransaction = activeTransactions.length ? activeTransactions[activeTransactions.length - 1] : null;
|
|
2255
|
-
return activeTransaction;
|
|
2256
|
-
}
|
|
2257
|
-
}, {
|
|
2258
|
-
key: "cancelTransaction",
|
|
2259
|
-
value: function cancelTransaction(id) {
|
|
2260
|
-
var transaction = this.transactions.find(function (t) {
|
|
2261
|
-
return t.id === id;
|
|
2262
|
-
}) || this.activeTransaction();
|
|
2263
|
-
if (transaction) {
|
|
2264
|
-
transaction.cancel();
|
|
2265
|
-
this.close();
|
|
2266
|
-
}
|
|
2267
|
-
}
|
|
2268
|
-
}, {
|
|
2269
|
-
key: "respondToEvent",
|
|
2270
|
-
value: function respondToEvent(event) {
|
|
2271
|
-
if (!event) {
|
|
2272
|
-
return;
|
|
2273
|
-
}
|
|
2274
|
-
var activeTransaction = this.activeTransaction();
|
|
2275
|
-
try {
|
|
2276
|
-
var actualEvent = event.data || event.message;
|
|
2277
|
-
var eventType = actualEvent.event,
|
|
2278
|
-
eventData = actualEvent.data;
|
|
2279
|
-
if (eventType) {
|
|
2280
|
-
switch (eventType) {
|
|
2281
|
-
case 'loaded:checkout':
|
|
2282
|
-
this.isLoaded = true;
|
|
2283
|
-
if (activeTransaction) {
|
|
2284
|
-
var checkoutIframe = this.checkoutIframe;
|
|
2285
|
-
var urlParameters = activeTransaction.urlParameters,
|
|
2286
|
-
response = activeTransaction.response;
|
|
2287
|
-
// TODO: reintroduce this when we resolve checkout caching issues
|
|
2288
|
-
// const params = response
|
|
2289
|
-
// ? { transactionData: response }
|
|
2290
|
-
// : urlParameters;
|
|
2291
|
-
|
|
2292
|
-
var params = response ? {
|
|
2293
|
-
accessCode: response.access_code,
|
|
2294
|
-
language: urlParameters === null || urlParameters === void 0 ? void 0 : urlParameters.language
|
|
2295
|
-
} : urlParameters;
|
|
2296
|
-
notifyIframeToUpdateURL({
|
|
2297
|
-
checkoutIframe: checkoutIframe,
|
|
2298
|
-
urlParameters: params
|
|
2299
|
-
});
|
|
2300
|
-
}
|
|
2301
|
-
break;
|
|
2302
|
-
case 'loaded:transaction':
|
|
2303
|
-
hideLoader(this.backgroundIframe);
|
|
2304
|
-
activeTransaction.onLoad(eventData);
|
|
2305
|
-
break;
|
|
2306
|
-
case 'error':
|
|
2307
|
-
{
|
|
2308
|
-
var error = eventData;
|
|
2309
|
-
if (error.type === 'setup') {
|
|
2310
|
-
activeTransaction.onSetupError(eventData);
|
|
2311
|
-
} else {
|
|
2312
|
-
activeTransaction.logError(eventData);
|
|
2313
|
-
}
|
|
2314
|
-
break;
|
|
2315
|
-
}
|
|
2316
|
-
case 'cancel':
|
|
2317
|
-
case 'close':
|
|
2318
|
-
{
|
|
2319
|
-
this.close();
|
|
2320
|
-
var status = eventData && eventData.status;
|
|
2321
|
-
if (status) {
|
|
2322
|
-
activeTransaction.setStatus(status);
|
|
2323
|
-
}
|
|
2324
|
-
var hasPaymentRequestButtons = this.hasMountedPaymentRequestButtons();
|
|
2325
|
-
if (!hasPaymentRequestButtons) {
|
|
2326
|
-
activeTransaction.isActive = false;
|
|
2327
|
-
}
|
|
2328
|
-
activeTransaction.onCancel();
|
|
2329
|
-
break;
|
|
2330
|
-
}
|
|
2331
|
-
case 'transfer:pending':
|
|
2332
|
-
{
|
|
2333
|
-
this.close();
|
|
2334
|
-
var _status = eventData && eventData.status;
|
|
2335
|
-
if (_status) {
|
|
2336
|
-
activeTransaction.setStatus(_status);
|
|
2337
|
-
}
|
|
2338
|
-
activeTransaction.onBankTransferConfirmationPending();
|
|
2339
|
-
break;
|
|
2340
|
-
}
|
|
2341
|
-
case 'success':
|
|
2342
|
-
this.close();
|
|
2343
|
-
activeTransaction.onSuccess(eventData);
|
|
2344
|
-
break;
|
|
2345
|
-
default:
|
|
2346
|
-
break;
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
} catch (error) {
|
|
2350
|
-
// do nothing
|
|
2351
|
-
}
|
|
2352
|
-
}
|
|
2353
|
-
}, {
|
|
2354
|
-
key: "respondToEmbedEvents",
|
|
2355
|
-
value: function respondToEmbedEvents(event) {
|
|
2356
|
-
var activeTransaction = this.activeTransaction();
|
|
2357
|
-
var eventData = event.data || event.message;
|
|
2358
|
-
if (eventData && (typeof eventData === 'string' || eventData instanceof String)) {
|
|
2359
|
-
var response = parseResponse(eventData);
|
|
2360
|
-
var oldCheckoutCloseResponse = response && response.action === 'PaystackClose';
|
|
2361
|
-
if (oldCheckoutCloseResponse) {
|
|
2362
|
-
var chargeResponse = response.data;
|
|
2363
|
-
if (chargeResponse) {
|
|
2364
|
-
activeTransaction.onSuccess(eventData);
|
|
2365
|
-
}
|
|
2366
|
-
}
|
|
2367
|
-
if (response.action === 'PaystackTLSClose') {
|
|
2368
|
-
activeTransaction.cancel();
|
|
2369
|
-
}
|
|
2370
|
-
}
|
|
2371
|
-
}
|
|
2372
|
-
}, {
|
|
2373
|
-
key: "animateCheckoutIn",
|
|
2374
|
-
value: function animateCheckoutIn$1() {
|
|
2375
|
-
var _this6 = this;
|
|
2376
|
-
if (!this.isOpen) {
|
|
2377
|
-
var checkoutIframe = this.checkoutIframe,
|
|
2378
|
-
backgroundIframe = this.backgroundIframe;
|
|
2379
|
-
animateCheckoutIn({
|
|
2380
|
-
checkoutIframe: checkoutIframe,
|
|
2381
|
-
backgroundIframe: backgroundIframe
|
|
2382
|
-
}).then(function () {
|
|
2383
|
-
_this6.checkoutIframe.contentWindow.postMessage('render', '*');
|
|
2384
|
-
});
|
|
2385
|
-
this.isOpen = true;
|
|
2386
|
-
}
|
|
2387
|
-
}
|
|
2388
|
-
}, {
|
|
2389
|
-
key: "open",
|
|
2390
|
-
value: function open(urlParameters, preload) {
|
|
2391
|
-
if (!urlParameters) {
|
|
2392
|
-
return;
|
|
2393
|
-
}
|
|
2394
|
-
var checkoutIframe = this.checkoutIframe;
|
|
2395
|
-
notifyIframeToUpdateURL({
|
|
2396
|
-
checkoutIframe: checkoutIframe,
|
|
2397
|
-
urlParameters: urlParameters
|
|
2398
|
-
});
|
|
2399
|
-
if (!preload) {
|
|
2400
|
-
this.animateCheckoutIn();
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
|
-
}, {
|
|
2404
|
-
key: "close",
|
|
2405
|
-
value: function close() {
|
|
2406
|
-
var _this7 = this;
|
|
2407
|
-
if (!this.isOpen) {
|
|
2408
|
-
return;
|
|
2409
|
-
}
|
|
2410
|
-
var checkoutIframe = this.checkoutIframe,
|
|
2411
|
-
backgroundIframe = this.backgroundIframe;
|
|
2412
|
-
animateCheckoutOut({
|
|
2413
|
-
checkoutIframe: checkoutIframe,
|
|
2414
|
-
backgroundIframe: backgroundIframe
|
|
2415
|
-
}).then(function () {
|
|
2416
|
-
_this7.checkoutIframe.contentWindow.postMessage('close', '*');
|
|
2417
|
-
});
|
|
2418
|
-
this.isOpen = false;
|
|
2419
|
-
}
|
|
2420
|
-
}, {
|
|
2421
|
-
key: "isLoaded",
|
|
2422
|
-
value: function isLoaded() {
|
|
2423
|
-
return this.isLoaded;
|
|
2424
|
-
}
|
|
2425
|
-
}], [{
|
|
2426
|
-
key: "setup",
|
|
2427
|
-
value: function setup(parameters) {
|
|
2428
|
-
var isDeprecatedApi = true;
|
|
2429
|
-
var isEmbed = parameters && parameters.container;
|
|
2430
|
-
if (!inlineInstance) {
|
|
2431
|
-
inlineInstance = new Inline({
|
|
2432
|
-
isDeprecatedApi: isDeprecatedApi,
|
|
2433
|
-
isEmbed: isEmbed
|
|
2434
|
-
});
|
|
2435
|
-
}
|
|
2436
|
-
printDeprecationNotice('PaystackPop.setup()', 'new PaystackPop()', 'Please consult our documentation at https://developers.paystack.co/docs/paystack-inline');
|
|
2437
|
-
var transaction = inlineInstance.newTransaction(parameters, 'deprecated');
|
|
2438
|
-
var urlParameters = transaction.urlParameters;
|
|
2439
|
-
if (isEmbed) {
|
|
2440
|
-
var inlineUrl = "".concat(config.siteUrl, "/assets/payment/production/inline.html?").concat(serialize(urlParameters));
|
|
2441
|
-
var iframe = mountEmbedCheckoutIframe(inlineInstance.id, inlineUrl);
|
|
2442
|
-
appendIframeToContainer(parameters.container, iframe);
|
|
2443
|
-
iframe.onload = function onLoad() {
|
|
2444
|
-
iframe.contentWindow.postMessage("PaystackOpen ".concat(inlineInstance.id), '*');
|
|
2445
|
-
animateEmbedCheckoutIn(iframe);
|
|
2446
|
-
};
|
|
2447
|
-
} else {
|
|
2448
|
-
// attach openIframe method
|
|
2449
|
-
transaction.openIframe = function () {
|
|
2450
|
-
printDeprecationNotice('openIframe', 'open', 'Please consult our documentation at https://developers.paystack.co/docs/paystack-inline');
|
|
2451
|
-
inlineInstance.open(urlParameters);
|
|
2452
|
-
};
|
|
2453
|
-
}
|
|
2454
|
-
return transaction;
|
|
2455
|
-
}
|
|
2456
|
-
}]);
|
|
2457
|
-
}();
|
|
2458
|
-
if (scriptCanUseDataAttributes()) {
|
|
2459
|
-
var parameters = getDataAttributesAsParameters();
|
|
2460
|
-
var parentForm = getSourceScript().parentElement;
|
|
2461
|
-
if (!inlineInstance) {
|
|
2462
|
-
inlineInstance = new Inline();
|
|
2463
|
-
}
|
|
2464
|
-
var transaction;
|
|
2465
|
-
var inlineButton = mountLazyInlineButton({
|
|
2466
|
-
inlineId: inlineInstance.id,
|
|
2467
|
-
amount: parameters.amount / 100,
|
|
2468
|
-
currency: parameters.currency,
|
|
2469
|
-
id: parameters.buttonId,
|
|
2470
|
-
text: parameters.buttonText,
|
|
2471
|
-
variant: parameters.buttonVariant,
|
|
2472
|
-
wordmarkVariant: parameters.buttonWordmarkVariant,
|
|
2473
|
-
parent: getSourceScript()
|
|
2474
|
-
});
|
|
2475
|
-
inlineButton.addEventListener('click', function (e) {
|
|
2476
|
-
e.preventDefault();
|
|
2477
|
-
if (!transaction) {
|
|
2478
|
-
transaction = inlineInstance.newTransaction(_objectSpread2(_objectSpread2({}, parameters), {}, {
|
|
2479
|
-
onSuccess: function onSuccess(response) {
|
|
2480
|
-
mountInput({
|
|
2481
|
-
type: 'hidden',
|
|
2482
|
-
name: 'reference',
|
|
2483
|
-
value: response.reference,
|
|
2484
|
-
parent: parentForm
|
|
2485
|
-
});
|
|
2486
|
-
parentForm.submit();
|
|
2487
|
-
}
|
|
2488
|
-
}));
|
|
2489
|
-
} else {
|
|
2490
|
-
inlineInstance.resumeTransaction(transaction.accessCode);
|
|
2491
|
-
}
|
|
2492
|
-
});
|
|
2493
|
-
}
|
|
2494
|
-
|
|
2495
|
-
module.exports = Inline;
|
|
1
|
+
"use strict";function e(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,a=Array(n);t<n;t++)a[t]=e[t];return a}function n(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function t(e,n){for(var t=0;t<n.length;t++){var a=n[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,u(a.key),a)}}function a(e,n,a){return n&&t(e.prototype,n),a&&t(e,a),Object.defineProperty(e,"prototype",{writable:!1}),e}function r(e,n,t){return(n=u(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,a)}return t}function i(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach(function(n){r(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function c(e,n){if(null==e)return{};var t,a,r=function(e,n){if(null==e)return{};var t={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(-1!==n.indexOf(a))continue;t[a]=e[a]}return t}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)t=o[a],-1===n.indexOf(t)&&{}.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}function s(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var a,r,o,i,c=[],s=!0,l=!1;try{if(o=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;s=!1}else for(;!(s=(a=o.call(t)).done)&&(c.push(a.value),c.length!==n);s=!0);}catch(e){l=!0,r=e}finally{try{if(!s&&null!=t.return&&(i=t.return(),Object(i)!==i))return}finally{if(l)throw r}}return c}}(e,n)||d(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(n){return function(n){if(Array.isArray(n))return e(n)}(n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||d(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e){var n=function(e,n){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,n||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:n+""}function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function d(n,t){if(n){if("string"==typeof n)return e(n,t);var a={}.toString.call(n).slice(8,-1);return"Object"===a&&n.constructor&&(a=n.constructor.name),"Map"===a||"Set"===a?Array.from(n):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?e(n,t):void 0}}var h={cookieTestUrl:"https://legacy-staging.paystack.co/test-iframe/start.html",publishableKey:"uFmz/uE/SDT6GupOrSEXIZXGByjQ0zFkPyc9LqKHFqnTI0WPN3JS5kQPo/j9or0TOXlqMQj2lzHn/UGsQT4XeQ==",publicKey:"-----BEGIN PUBLIC KEY-----\r\nMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALhZs/7hP0g0+hrqTq0hFyGVxgco0NMx\r\nZD8nPS6ihxap0yNFjzdyUuZED6P4/aK9Ezl5ajEI9pcx5/1BrEE+F3kCAwEAAQ==\r\n-----END PUBLIC KEY-----",applePayVersion:6,applePayValidateSessionPath:"applepay/validate-session/",applePayChargePath:"applepay/charge",googlePayChargePath:"googlepay/charge"},m=i(i({},h),{},{environment:"dev",checkoutUrl:"http://localhost:8081/",paymentBaseUrl:"https://legacy-staging.paystack.co/",paystackApiUrl:"https://studio-api.paystack.co/",siteUrl:"https://paystack.com",pusherKey:"1c7b262ee18455815893",pusherUrl:"http://localhost:8081/static/vendor/pusher.min.js"}),y=i(i({},h),{},{environment:"staging",checkoutUrl:"https://checkout-studio.paystack.com/",paymentBaseUrl:"https://legacy-staging.paystack.co/",paystackApiUrl:"https://studio-api.paystack.co/",siteUrl:"https://beta.paystack.com",pusherKey:"1c7b262ee18455815893",pusherUrl:"https://checkout-studio.paystack.com/static/vendor/pusher.min.js"}),f={dev:m,staging:y,production:i(i({},h),{},{environment:"production",checkoutUrl:"https://checkout.paystack.com/",paymentBaseUrl:"https://standard.paystack.co/",paystackApiUrl:"https://api.paystack.co/",siteUrl:"https://paystack.com",pusherKey:"8e4b9b7ca3418bd5cdc8",pusherUrl:"https://checkout.paystack.com/static/vendor/pusher.min.js"})}.production||y;function g(e,n){var t=[];return Object.keys(e).forEach(function(a){var r=n?"".concat(n,"[").concat(a,"]"):a,o=e[r];t.push(null!==o&&"object"===("undefined"==typeof v?"undefined":p(v))?g(o,r):"".concat(encodeURIComponent(a),"=").concat(encodeURIComponent(o)))}),t.join("&")}function b(){return document.currentScript||(e=document.getElementsByTagName("script"))[e.length-1];var e}function k(){var e=[],n=b();if(n){var t=Array.prototype.slice.call(n.attributes);e=Object.keys(t).filter(function(e){var n=t[e].nodeName;return n&&n.indexOf("data")>-1}).map(function(e){return t[e].nodeName})}return e}var w="50px",C="vertical",P="light",A="apple_pay",E="google_pay",S="success",_="failed",q="auth",x="test",T="production",I="CANCELED",O="DEVELOPER_ERROR",M="MERCHANT_ACCOUNT_ERROR",j="NG",z={XOF:"CI",GHS:"GH",KES:"KE",NGN:j,ZAR:"ZA",EGP:"EG"};var V={height:w,width:"auto",borderRadius:"3px",padding:"10px",locale:"en",type:"pay"},N=function(e){return e&&"object"===p(e)?Object.keys(V).reduce(function(n,t){return i(i({},n),{},r({},t,e[t]||V[t]))},{}):V};function U(e,n){var t=document.createElement("style");t.type="text/css",t.textContent=n,e.appendChild(t)}var L=function(){return Number(parseFloat((arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)/100).toFixed(2))},R=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.container,a=n.integrity;return new Promise(function(n,r){if(e){var o=document.createElement("script");o.src=e,a&&(o.crossOrigin="anonymous",o.integrity=a),o.addEventListener("load",function(){n(!0)}),o.addEventListener("error",function(){o.remove(),r(!1)}),t?t.appendChild(o):document.head.appendChild(o)}else r("No script url")})},B={headers:{accept:"application/json, text/plain, */*","accept-language":"en-GB,en-US;q=0.9,en;q=0.8","content-type":"application/x-www-form-urlencoded","sec-ch-ua-mobile":"?0","sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"cross-site"},referrerPolicy:"no-referrer-when-downgrade",method:"POST",mode:"cors",credentials:"omit"};function D(e){return Object.keys(e).reduce(function(n,t){var a=encodeURIComponent(t),r=encodeURIComponent(e[t]),o="".concat(a,"=").concat(r);return[].concat(l(n),[o])},[]).join("&")}var G=function(e){return{biannually:"BIANNUAL PLAN",annually:"ANNUAL PLAN"}[e]||"".concat(e.toUpperCase()," PLAN")},F=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return function(){try{return window.isSecureContext&&window.ApplePaySession&&window.ApplePaySession.supportsVersion(f.applePayVersion)}catch(e){return!1}}()&&e.includes(A)},W=function(e,n){var t=(e&&e.channel_fees_and_amount||{})[n],a=t&&t.amount;return null==a?e&&e.amount:a},J=console?console.warn||console.log:function(){};function K(e,n,t){J('"'.concat(e,'" has been deprecated, please use "').concat(n,'". ').concat(t||""))}var H=["PAN_ONLY"],Q=null,X=null,Z=function(e){var n=e&&e.response,t=n&&n.channel_settings;return t&&t[E]||null},Y=function(e){return(e&&e.allowed_card_auth_methods||[]).filter(function(e){return!H.includes(e)})},$=function(e){var n=!!e&&e.domain===x;return f.environment!==T||n?"TEST":"PRODUCTION"},ee=function(e){return Q&&X===e||(Q=new window.google.payments.api.PaymentsClient({environment:e}),X=e),Q},ne=function(){return!!(window.google&&window.google.payments&&window.google.payments.api&&window.google.payments.api.PaymentsClient)},te=function(e){return{apiVersion:e.api_version.major,apiVersionMinor:e.api_version.minor}},ae=function(e,n){return{type:"CARD",parameters:{allowedAuthMethods:n,allowedCardNetworks:e.allowed_card_networks,billingAddressRequired:!0,billingAddressParameters:e.billing_address_parameters,assuranceDetailsRequired:!0}}},re=function(e){var n=e.merchant_info||{};return{merchantId:n.merchantId,merchantName:n.merchantName,merchantOrigin:n.merchantOrigin}},oe=function(e){var n=Z(e);if(!n)return Promise.resolve(null);var t=Y(n);return t.length&&n.tokenization_specification&&ne()?(function(e){var n=e.merchant_info&&e.merchant_info.merchantOrigin,t=window.location.hostname;n&&n!==t&&J('Google Pay: the registered merchantOrigin ("'.concat(n,'") does not match this page ("').concat(t,'"). Google may reject the payment sheet. Update the domain in Dashboard > Developers > Google Pay.'))}(n),Promise.resolve().then(function(){return ee($(e.response)).isReadyToPay(i(i({},te(n)),{},{allowedPaymentMethods:[ae(n,t)],existingPaymentMethodRequired:!0}))}).then(function(e){return!!e.result}).catch(function(){return null})):Promise.resolve(null)},ie=function(e){return((e&&e.response||{}).channels||[]).includes(E)?function(e,n){var t,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return null},r=new Promise(function(e){t=setTimeout(function(){try{e(a())}catch(n){e(null)}},n)});return Promise.race([e,r]).finally(function(){return clearTimeout(t)})}((ne()?Promise.resolve(!0):R("https://pay.google.com/gp/p/js/pay.js").then(function(){return ne()})).catch(function(){return!1}).then(function(n){return n?oe(e):null}),1e4):Promise.resolve(null)},ce=["height","width","borderRadius","buttonRadius"];function se(e){var n=document.createElement("iframe");return n.setAttribute("frameBorder","0"),n.setAttribute("allowtransparency","true"),n.id=e,n.style.display="none",n}function le(e){return e.querySelector("apple-pay-button")||e.querySelector("#apple-pay-button")}function ue(e){return document.querySelector("#".concat(e))}function pe(e){return e.querySelector("#google-pay-button-container")}function de(e,n){if(e){var t=e.querySelector("#google-pay-button"),a=e.querySelector("#google-pay-loading-button");t&&a&&(t.style.display=n?"none":"",a.style.display=n?"flex":"none")}}function he(e,n){var t=n.transaction,a=n.styles,r=void 0===a?{}:a,o=n.onClick,s=r.googlePay||{},l=s.height,u=s.width,p=s.borderRadius,d=s.buttonRadius,h=c(s,ce),m=Z(t),y=function(e,n){var t=parseFloat(void 0!==e?e:n);return t>=0?t:3}(p,d);U(e,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.height,t=e.width;return"\n #google-pay-button-container {\n width: ".concat(t||"auto",";\n height: ").concat(n||w,";\n overflow: hidden;\n }\n #google-pay-button-container:empty {\n display: none;\n }\n #google-pay-button-container > div,\n #google-pay-button-container button,\n #google-pay-button-container iframe {\n width: 100%;\n max-width: 100%;\n height: 100%;\n min-width: 100%;\n }\n #google-pay-button-container button {\n outline: none !important;\n }\n")}({height:l,width:u}));var f=h.buttonColor||(r.theme===P?"white":"black");U(e,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.borderRadius,t="white"===e.buttonColor;return"\n #google-pay-loading-button {\n width: 100%;\n height: 100%;\n border: ".concat(t?"1px solid #3C4043":"none",";\n border-radius: ").concat(void 0===n?3:n,"px;\n background: ").concat(t?"#ffffff":"#000000",";\n cursor: default;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n #google-pay-loading-button__spinner {\n width: 18px;\n height: 18px;\n border: 2px solid ").concat(t?"rgba(60, 64, 67, 0.25)":"rgba(255, 255, 255, 0.35)",";\n border-top-color: ").concat(t?"#3c4043":"#ffffff",";\n border-radius: 50%;\n animation: google-pay-spin 0.8s linear infinite;\n }\n @keyframes google-pay-spin {\n to { transform: rotate(360deg); }\n }\n")}({borderRadius:y,buttonColor:f}));var g=document.createElement("div");g.id="google-pay-button-container";var v=ee($(t.response)).createButton(i(i({buttonColor:f,buttonType:"pay",buttonRadius:y,buttonSizeMode:"fill"},h),{},{onClick:o,allowedPaymentMethods:[ae(m,Y(m))]}));e.appendChild(g);var b=document.createElement("div");b.id="google-pay-button",b.appendChild(v),g.appendChild(b);var k=document.createElement("button");k.id="google-pay-loading-button",k.type="button",k.disabled=!0,k.setAttribute("aria-busy","true"),k.style.display="none";var C=document.createElement("span");return C.id="google-pay-loading-button__spinner",k.appendChild(C),g.appendChild(k),g}function me(e,n){var t,a,r=n.transaction,o=n.styles,i=void 0===o?{}:o,c=n.onClickApplePayButton,l=n.onClickGooglePayButton;if(!e)return Promise.reject("Container to mount elements was not provided");!function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}(e),U(e,(t=i.orientation,"\n #paystack-payment-request-inner-wrapper {\n display: flex;\n flex-direction: ".concat((a=t===C)?"column":"row",";\n gap: 8px;\n width: 100%;\n max-width: 100%;\n }\n\n #paystack-payment-request-inner-wrapper > * {\n min-width: 0;\n ").concat(a?"":"flex: 1 1 0;","\n }\n\n #paystack-payment-request-inner-wrapper > apple-pay-button,\n #paystack-payment-request-inner-wrapper > #apple-pay-button {\n order: 1;\n }\n #paystack-payment-request-inner-wrapper > #google-pay-button-container {\n order: 2;\n }\n")));var u=document.createElement("div");u.id="paystack-payment-request-inner-wrapper",u.style.display="none",e.appendChild(u);var d={styles:N(i.applePay),theme:i.theme,onClick:c},h=r.response&&r.response.channels||[],m=Promise.resolve(null);F(h)?m=R("https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js",{integrity:"sha384-z/6BVHCcSypLSykOVpaT1PQWHOOgU45uOOlMkgi/bElX4yFqmChNMb7qiv80wFav"}).then(function(){if(window&&!Array.isArray(window.webpackJsonp))throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(p(window.webpackJsonp),". Switching to fallback apple pay button"))}).then(function(){return function(e,n){var t=n.styles,a=n.theme,r=n.onClick;U(e,function(e){var n=e.height,t=e.width,a=e.borderRadius,r=e.padding;return"\n apple-pay-button {\n --apple-pay-button-width: ".concat(t,";\n --apple-pay-button-height: ").concat(n,";\n --apple-pay-button-border-radius: ").concat(a,";\n --apple-pay-button-padding: ").concat(r,";\n --apple-pay-button-box-sizing: border-box;\n width: ").concat(t,";\n }\n")}(t));var o=document.createElement("apple-pay-button");return o.setAttribute("buttonstyle",a===P?"white":"black"),o.setAttribute("type",t.type),o.setAttribute("locale",t.locale),r&&(o.onclick=r),e.appendChild(o),o}(u,d)}).catch(function(){return function(e,n){var t=n.styles,a=n.theme,r=n.onClick;U(e,function(e){var n=e.height,t=e.width,a=e.borderRadius,r=e.padding,o=e.type,i=e.locale;return"\n @supports (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n width: ".concat(t,";\n height: ").concat(n,";\n border-radius: ").concat(a,";\n padding: ").concat(r,";\n -apple-pay-button-type: ").concat(o,";\n -webkit-locale: ").concat(i,";\n }\n .apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n .apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n .apple-pay-button-white-with-line {\n -apple-pay-button-style: white-outline;\n }\n }\n\n @supports not (-webkit-appearance: -apple-pay-button) {\n .apple-pay-button {\n display: inline-block;\n background-size: 100% 60%;\n background-repeat: no-repeat;\n background-position: 50% 50%;\n border-radius: 5px;\n padding: 0px;\n box-sizing: border-box;\n min-width: 200px;\n min-height: 32px;\n max-height: 64px;\n }\n .apple-pay-button-black {\n background-image: -webkit-named-image(apple-pay-logo-white);\n background-color: black;\n }\n .apple-pay-button-white {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n }\n .apple-pay-button-white-with-line {\n background-image: -webkit-named-image(apple-pay-logo-black);\n background-color: white;\n border: .5px solid black;\n }\n }\n")}(t));var o=document.createElement("button");o.classList.add("apple-pay-button",a===P?"apple-pay-button-white":"apple-pay-button-black"),o.id="apple-pay-button";var i=document.createElement("span");return i.classList.add("logo"),o.appendChild(i),r&&(o.onclick=r),e.appendChild(o),o}(u,d)}).catch(function(){return null}):h.includes(A)&&J("Apple Pay: this device or browser cannot pay with Apple Pay. It requires Safari on an Apple device, over HTTPS.");var y=ie(r).then(function(e){return e?he(u,{transaction:r,styles:i,onClick:l}):null}).catch(function(){return null});return Promise.all([m,y]).then(function(e){var n=s(e,2),t=n[0],a=n[1];return t||a?(u.style.display="",{applePay:!!t,googlePay:!!a}):null})}var ye=[{value:"key",required:!0,types:["string"]},{value:"amount",required:!0,or:["plan","planCode"],types:["string","number"]},{value:"currency",required:!1,types:["string"]},{value:"email",required:!0,or:["customerCode"],types:["string"]},{value:"label",required:!1,types:["string"]},{value:"firstName",required:!1,types:["string"]},{value:"lastName",required:!1,types:["string"]},{value:"reference",required:!1,types:["string"]},{value:"phone",required:!1,types:["string"]},{value:"customerCode",required:!1,override:"email",types:["string"]},{value:"channels",required:!1,types:["array"]},{value:"paymentRequest",required:!1,types:["string","number"]},{value:"paymentPage",required:!1,types:["string"]},{value:"hash",required:!1,types:["string"]},{value:"container",required:!1,types:["string"]},{value:"metadata",required:!1,types:["object"]},{value:"subaccountCode",required:!1,types:["string"]},{value:"bearer",required:!1,types:["string"]},{value:"transactionCharge",required:!1,types:["string","number"]},{value:"planCode",required:!1,override:"amount",types:["string"]},{value:"subscriptionCount",required:!1,types:["number"]},{value:"planInterval",required:!1,types:["string"]},{value:"subscriptionLimit",required:!1,types:["number"]},{value:"subscriptionStartDate",required:!1,types:["string"]},{value:"accessCode",required:!1,types:["string"]},{value:"onError",required:!1,types:["function"]},{value:"onLoad",required:!1,types:["function"]},{value:"onSuccess",required:!1,types:["function"]},{value:"onCancel",required:!1,types:["function"]},{value:"callback",required:!1,types:["function"]},{value:"onClose",required:!1,types:["function"]},{value:"onBankTransferConfirmationPending",required:!1,types:["function"]},{value:"firstname",required:!1,types:["string"]},{value:"lastname",required:!1,types:["string"]},{value:"customer_code",required:!1,types:["string"]},{value:"payment_request",required:!1,types:["string","number"]},{value:"subaccount",required:!1,types:["string"]},{value:"transaction_charge",required:!1,types:["number","string"]},{value:"plan",required:!1,types:["string"]},{value:"quantity",required:!1,types:["number"]},{value:"interval",required:!1,types:["string"]},{value:"invoice_limit",required:!1,types:["number","string"]},{value:"start_date",required:!1,types:["string"]},{value:"payment_page",required:!1,types:["number","string"]},{value:"order_id",required:!1,types:["number"]},{value:"ref",required:!1,types:["string"]},{value:"card",required:!1,types:["string"]},{value:"bank",required:!1,types:["string"]},{value:"split",required:!1,types:["object"]},{value:"split_code",required:!1,types:["string"]},{value:"transaction_type",required:!1,types:["string"]},{value:"subscription",required:!1,types:["number"]},{value:"language",required:!1,types:["string"]},{value:"connect_account",required:!1,types:["string"]},{value:"connect_split",required:!1,types:["array"]}];function fe(e){return(null==e?void 0:e.length)>500?e.split("?")[0]:e}function ge(e){var n,t,a,r,o=i({},e);o.metadata=e.metadata||{},o.metadata.referrer=(n=window.location,t=n.href,a=void 0===t?"":t,r=n.ancestorOrigins,[a].concat(l(void 0===r?[]:r)).map(fe).join(",")),o.metadata=JSON.stringify(o.metadata),o.mode="popup",e.split&&"string"!=typeof e.split&&(o.split=JSON.stringify(o.split));return void 0!==o.card&&["false",!1].indexOf(o.card)>-1&&(o.channels=["bank"],delete o.card),void 0!==o.bank&&["false",!1].indexOf(o.bank)>-1&&(o.channels=["card"],delete o.bank),[{to:"firstname",from:"firstName"},{to:"lastname",from:"lastName"},{to:"customer_code",from:"customerCode"},{to:"payment_request",from:"paymentRequest"},{to:"subaccount",from:"subaccountCode"},{to:"transaction_charge",from:"transactionCharge"},{to:"plan",from:"planCode"},{to:"quantity",from:"subscriptionCount"},{to:"interval",from:"planInterval"},{to:"invoice_limit",from:"subscriptionLimit"},{to:"start_date",from:"subscriptionStartDate"},{to:"ref",from:"reference"}].forEach(function(e){o[e.from]&&(o[e.to]=o[e.from],delete o[e.from])}),Object.values(e).forEach(function(n,t){if("function"==typeof n){var a=Object.keys(e)[t];delete o[a]}}),o}var ve,be=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"],ke=window&&window.navigator&&(window.navigator.platform||window.navigator.userAgentData&&window.navigator.userAgentData.platform),we=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.platform,t=e.userAgent,a=void 0===t?window&&window.navigator&&window.navigator.userAgent:t,r=n||ke;return be.includes(r)||a.includes("Mac")&&"ontouchend"in document},Ce=function(e,n,t){var a="".concat(f.paystackApiUrl,"transaction/update_log/").concat(e),r={Authorization:"Bearer ".concat(n)};return fetch(a,{method:"POST",body:JSON.stringify({payload:JSON.stringify(t)}),headers:r})},Pe=function(e,n){var t="".concat(f.paystackApiUrl,"transaction/set_ip/").concat(e),a={Authorization:"Bearer ".concat(n)};return fetch(t,{method:"POST",headers:a})},Ae={initializeLog:function(e){var n=e||{},t=n.attempts,a=n.authentication,r=n.errors,o=n.history;this.log={start_time:Math.round(Date.now()/1e3),time_spent:0,attempts:t||0,authentication:a,errors:r||0,success:!1,mobile:we(),input:[],history:o||[]}},getTimeSpent:function(){var e=Math.round(Date.now()/1e3);return this.log.time_spent=e-this.log.start_time,this.log.time_spent},logAPIResponse:function(e,n){switch(e.status){case S:return this.logApiSuccess(n);case _:return this.logApiError(e.message);default:return!1}},logValidationResponse:function(e){return this.log.history.push({type:"action",message:e,time:this.getTimeSpent()}),this.saveLog()},logAttempt:function(e){var n="Attempted to pay";return e&&(n+=" with ".concat(e)),this.log.attempts+=1,this.log.history.push({type:"action",message:n,time:this.getTimeSpent()}),this.saveLog()},logApiError:function(e){var n="Error";return e&&(n+=": ".concat(e)),this.log.errors+=1,this.log.history.push({type:"error",message:n,time:this.getTimeSpent()}),this.saveLog()},logApiSuccess:function(e){var n="Successfully paid";return e&&(n+=" with ".concat(e)),this.log.success=!0,this.log.history.push({type:"success",message:n,time:this.getTimeSpent()}),this.saveLog()},saveLog:function(){try{if(this.response)return Ce(this.id,this.response.merchant_key,this.log)}catch(e){}},saveIpAddress:function(){try{if(this.response)return Pe(this.id,this.response.merchant_key)}catch(e){}}},Ee=["language","connect_account"],Se={requestInline:function(){var e=this,n=this.urlParameters,t=n.language,a=n.connect_account,r=c(n,Ee),o=i({"Content-Type":"application/json"},t&&{"Accept-Language":t});return(this.accessCode?fetch(new URL("transaction/verify_access_code/".concat(this.accessCode),f.paystackApiUrl).toString(),{headers:o}):fetch(new URL("/checkout/request_inline",f.paystackApiUrl).toString(),{method:"POST",body:JSON.stringify(r),headers:i(i({},o),a&&{"x-connect-account":a})})).then(function(e){return e.json()}).then(function(n){if(!1===n.status)throw new Error(n.message);return e.response=n.data,e.id=n.data.id,e.status=n.data.transaction_status,e.accessCode=n.data.access_code,e.log=null,Object.assign(e,Ae),e.initializeLog(n.data.log),e.saveIpAddress(),n.data})}},_e=function(){return a(function e(t){n(this,e),function(e){function n(e,n){this.message=e,this.issues=n||[]}if(!e||"object"!==p(e))throw new n("Transaction parameters should be a non-empty object");var t=e;if("accessCode"in t)return{accessCode:t.accessCode};Object.keys(t).forEach(function(e){void 0!==ye.find(function(n){return n.value===e})||delete t[e]});var a=Object.keys(t),r=[];if(ye.filter(function(e){return e.required}).forEach(function(e){var n=!t[e.value],a=e.or?e.or.some(function(e){return t[e]}):null;n&&!a&&r.push({message:"Required parameter missing: ".concat(e.value)})}),a.forEach(function(e){var n=t[e],a=ye.find(function(n){return n.value===e}),o=p(n);"object"===o&&Array.isArray(n)&&(o="array"),a.types.indexOf(o)<=-1&&r.push({message:"Invalid parameter type: ".concat(e),validTypes:a.types})}),a.forEach(function(e){var n=ye.find(function(n){return n.value===e});n.override&&delete t[n.override]}),r.length)throw new n("Invalid transaction parameters",r)}(t),this.parameters=t,this.urlParameters=ge(t),this.id=null,this.status=null,this.accessCode=t.accessCode||null,this.authorizationUrl=null,this.errors=[],this.response=null,this.isActive=!0;var a=t.onError,r=t.onLoad,o=t.onSuccess,i=t.onCancel,c=t.callback,s=t.onClose,l=t.onBankTransferConfirmationPending;this.callbacks={onError:a,onLoad:r,onSuccess:o,onCancel:i,onBankTransferConfirmationPending:l},this.deprecatedCallbacks={callback:c,onClose:s},Object.assign(this,Se)},[{key:"onSetupError",value:function(e){this.logError(e),this.callbacks.onError&&this.callbacks.onError(e)}},{key:"onLoad",value:function(e){var n=e.id,t=e.customer,a=e.accessCode;Object.assign(this,{id:n,customer:t,accessCode:a}),this.authorizationUrl="".concat(f.checkoutUrl).concat(a),this.callbacks.onLoad&&this.callbacks.onLoad({id:n,customer:t,accessCode:a})}},{key:"onSuccess",value:function(e){this.isActive=!1,this.response=e,this.status=e.status,this.callbacks.onSuccess&&this.callbacks.onSuccess(e),this.deprecatedCallbacks.callback&&this.deprecatedCallbacks.callback(e)}},{key:"setStatus",value:function(e){this.status=e}},{key:"onCancel",value:function(){this.callbacks.onCancel&&this.callbacks.onCancel(),this.deprecatedCallbacks.onClose&&this.deprecatedCallbacks.onClose()}},{key:"cancel",value:function(){this.isActive=!1,this.onCancel()}},{key:"onBankTransferConfirmationPending",value:function(){this.cancel(),this.callbacks.onBankTransferConfirmationPending&&this.callbacks.onBankTransferConfirmationPending()}},{key:"logError",value:function(e){this.errors.push(e)}}])}(),qe=["preload","inlineTransaction","transactionData"],xe=["container","styles","onElementsMount"],Te=["data"];function Ie(e,n){if(!e.length)return null;var t=e.filter(function(e){var t,a,r,o,i=!e.status||"abandoned"===e.status,c=(t=e.parameters,a=n,r=Object.keys(t).sort().join("")===Object.keys(a).sort().join(""),o=Object.values(t).sort().join("")===Object.values(a).sort().join(""),r&&o);return i&&c});return t.length?t[t.length-1]:null}function Oe(e){var n=e.checkoutIframe,t=e.urlParameters;n&&t&&n.contentWindow.postMessage({type:"inline:url",path:"newTransaction",params:t},"*")}var Me="trackPaymentError",je="trackPaymentAttempt",ze="trackPaymentCompletion";function Ve(e){throw J(e),new Error(e)}var Ne,Ue,Le=function(){function e(t){var a,r;n(this,e),this.id=function(){for(var e="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=0;t<5;t+=1)e+=n.charAt(Math.floor(62*Math.random()));return e}(),this.transactions=[],this.isOpen=!1,this.isLoaded=!1,this.isCharging=!1,this.isDeprecatedApi=t&&t.isDeprecatedApi,t&&t.isEmbed?this.isEmbed=!0:t&&t.isPaymentRequest&&(t.container&&ue(t.container)||Ve("A container is required to mount the payment request button"),this.paymentRequestContainer=ue(t.container),this.paymentRequestTransaction=null),this.backgroundIframe=function(e){var n=se("inline-background-".concat(e));n.style.cssText="\n z-index: 999999999999999;\n background: transparent;\n background: rgba(0, 0, 0, 0.75);\n border: 0px none transparent;\n overflow-x: hidden;\n overflow-y: hidden;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n transition: opacity 0.3s;\n -webkit-transition: opacity 0.3s;\n visibility: hidden;\n display: none;\n",n.style.colorScheme="light",document.body.appendChild(n);var t=n.contentWindow.document;return t.open(),t.write('\n <!DOCTYPE html>\n <html lang="en">\n\n <head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <meta http-equiv="X-UA-Compatible" content="ie=edge">\n <title>Paystack Popup Loader</title>\n <style>\n .app-loader {\n margin: 200px 0;\n text-align: center;\n color: white;\n }\n @keyframes app-loader__spinner {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n @-webkit-keyframes app-loader__spinner {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n .app-loader__spinner {\n position: relative;\n display: inline-block;\n }\n .app-loader__spinner div {\n left: 95px;\n top: 35px;\n position: absolute;\n -webkit-animation: app-loader__spinner linear 1s infinite;\n animation: app-loader__spinner linear 1s infinite;\n background: white;\n width: 10px;\n height: 30px;\n border-radius: 40%;\n -webkit-transform-origin: 5px 65px;\n transform-origin: 5px 65px;\n }\n .app-loader__spinner div:nth-child(1) {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n -webkit-animation-delay: -0.916666666666667s;\n animation-delay: -0.916666666666667s;\n }\n .app-loader__spinner div:nth-child(2) {\n -webkit-transform: rotate(30deg);\n transform: rotate(30deg);\n -webkit-animation-delay: -0.833333333333333s;\n animation-delay: -0.833333333333333s;\n }\n .app-loader__spinner div:nth-child(3) {\n -webkit-transform: rotate(60deg);\n transform: rotate(60deg);\n -webkit-animation-delay: -0.75s;\n animation-delay: -0.75s;\n }\n .app-loader__spinner div:nth-child(4) {\n -webkit-transform: rotate(90deg);\n transform: rotate(90deg);\n -webkit-animation-delay: -0.666666666666667s;\n animation-delay: -0.666666666666667s;\n }\n .app-loader__spinner div:nth-child(5) {\n -webkit-transform: rotate(120deg);\n transform: rotate(120deg);\n -webkit-animation-delay: -0.583333333333333s;\n animation-delay: -0.583333333333333s;\n }\n .app-loader__spinner div:nth-child(6) {\n -webkit-transform: rotate(150deg);\n transform: rotate(150deg);\n -webkit-animation-delay: -0.5s;\n animation-delay: -0.5s;\n }\n .app-loader__spinner div:nth-child(7) {\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n -webkit-animation-delay: -0.416666666666667s;\n animation-delay: -0.416666666666667s;\n }\n .app-loader__spinner div:nth-child(8) {\n -webkit-transform: rotate(210deg);\n transform: rotate(210deg);\n -webkit-animation-delay: -0.333333333333333s;\n animation-delay: -0.333333333333333s;\n }\n .app-loader__spinner div:nth-child(9) {\n -webkit-transform: rotate(240deg);\n transform: rotate(240deg);\n -webkit-animation-delay: -0.25s;\n animation-delay: -0.25s;\n }\n .app-loader__spinner div:nth-child(10) {\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg);\n -webkit-animation-delay: -0.166666666666667s;\n animation-delay: -0.166666666666667s;\n }\n .app-loader__spinner div:nth-child(11) {\n -webkit-transform: rotate(300deg);\n transform: rotate(300deg);\n -webkit-animation-delay: -0.083333333333333s;\n animation-delay: -0.083333333333333s;\n }\n .app-loader__spinner div:nth-child(12) {\n -webkit-transform: rotate(330deg);\n transform: rotate(330deg);\n -webkit-animation-delay: 0s;\n animation-delay: 0s;\n }\n .app-loader__spinner {\n width: 40px;\n height: 40px;\n -webkit-transform: translate(-20px, -20px) scale(0.2) translate(20px, 20px);\n transform: translate(-20px, -20px) scale(0.2) translate(20px, 20px);\n }\n </style>\n </head>\n\n <body>\n <div id="app-loader" class="app-loader">\n <div id="spinner" class="app-loader__spinner">\n <div></div><div></div><div></div><div></div><div></div><div></div><div>\n </div><div></div><div></div><div></div><div></div><div></div>\n </div>\n </div>\n </body>\n\n </html>\n'),t.close(),n}(this.id),this.checkoutIframe=(a=this.id,(r=se("inline-checkout-".concat(a))).src="".concat(f.checkoutUrl,"popup?precheckout=true"),r.style.cssText="\n z-index: 999999999999999;\n background: transparent;\n border: 0px none transparent;\n overflow-x: hidden;\n overflow-y: hidden;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n visibility: hidden;\n display: none;\n height: 100%;\n",r.style.colorScheme="light",r.setAttribute("allowpaymentrequest","true"),r.setAttribute("allow","payment; clipboard-read; clipboard-write"),document.body.appendChild(r),r),this.registerListeners()}return a(e,[{key:"registerListeners",value:function(){var e=this;window.addEventListener("message",function(n){var t="".concat(n.origin,"/")===f.checkoutUrl,a=e.checkoutIframe&&e.checkoutIframe.contentWindow===n.source,r=e.isEmbed;t||a?e.respondToEvent(n):r&&e.respondToEmbedEvents(n)})}},{key:"sendAnalyticsEventToCheckout",value:function(e,n){this.checkoutIframe.contentWindow.postMessage({type:"analytics",action:e,params:n},"*")}},{key:"checkout",value:function(e){this.activeTransaction()&&this.activeTransaction().cancel(),ve=this;var n=Ie(this.transactions,e)||new _e(e);return new Promise(function(e,t){n.requestInline().then(function(t){ve.newTransaction({inlineTransaction:n,transactionData:t}),e(n)}).catch(function(e){n.onSetupError({status:!1,message:e.message}),t(e)})})}},{key:"newTransaction",value:function(e){var n=e.preload,t=e.inlineTransaction,a=e.transactionData,r=c(e,qe),o=this.hasMountedPaymentRequestButtons(),i=this.activeTransaction();if(i&&!o&&i!==t&&i.cancel(),t&&a)return this.transactions.includes(t)||this.transactions.push(t),this.isDeprecatedApi||this.open({accessCode:a.access_code,language:t.urlParameters.language},n),t;var s=Ie(this.transactions,t?t.parameters:r);if(s)return s.isActive=!0,this.isDeprecatedApi||this.open({accessCode:s.accessCode,language:s.urlParameters.language},n),s;var l=t||new _e(r),u=l.accessCode?{accessCode:l.accessCode,language:l.urlParameters.language}:l.urlParameters;return this.transactions.push(l),this.isDeprecatedApi||this.open(u,n),l}},{key:"preloadTransaction",value:function(e){var n=this;this.newTransaction(i(i({},e),{},{preload:!0}));return function(){return n.animateCheckoutIn()}}},{key:"paymentRequest",value:function(e){var n=this,t=e.container,a=e.styles,r=e.onElementsMount,o=c(e,xe);return ve=this,new Promise(function(i,c){var s=document.querySelector("#".concat(e.loadPaystackCheckoutButton));ve.activeTransaction()&&ve.activeTransaction().cancel(),t&&ue(t)||Ve("A container is required to mount the payment request button"),ve.paymentRequestContainer=ue(t);var l=Ie(ve.transactions,o),u=l||new _e(o);u.requestInline().then(function(e){return l?u.isActive=!0:ve.transactions.push(u),me(ve.paymentRequestContainer,{transaction:u,styles:a,onClickApplePayButton:function(){return n.startApplePay(u)},onClickGooglePayButton:function(){return n.startGooglePay(u)}}).then(function(e){r&&r(e)}).catch(function(){r&&r(null)}).finally(function(){if(s){var n=ve.preloadTransaction({inlineTransaction:u,transactionData:e});s.onclick=n}else ve.hasMountedPaymentRequestButtons()||J("No payment request button could be mounted on this device. Please consult our documentation at https://developers.paystack.co/docs/paystack-inline to see how to load alternative payment options using 'loadPaystackCheckoutButton'");i(u)})}).catch(function(e){u.onSetupError({status:!1,message:e.message}),c(e)})})}},{key:"hasMountedPaymentRequestButtons",value:function(){return(e=this.paymentRequestContainer,e?[le(e),pe(e)].filter(Boolean):[]).length>0;var e}},{key:"startGooglePay",value:function(e){var n=this,t="google pay",a=e||this.activeTransaction();if(e&&!e.isActive)return J("Google Pay: this button belongs to a transaction that is no longer active."),Promise.resolve();if(a&&a.response){if(this.isCharging)return Promise.resolve();this.isCharging=!0;var r=function(e){try{e()}catch(e){J("Google Pay: a merchant callback threw. ".concat(e&&e.message||e))}};try{var o={channel:E,currency:a.response.currency,amount:W(a.response,E)};return a.logAttempt(t),this.sendAnalyticsEventToCheckout(je,i(i({},o),{},{paymentMethod:t})),ee($(a.response)).loadPaymentData(function(e){var n=Z(e),t=e.response,a=Y(n);return i(i({},te(n)),{},{allowedPaymentMethods:[i(i({},ae(n,a)),{},{tokenizationSpecification:n.tokenization_specification})],transactionInfo:{totalPriceStatus:"FINAL",checkoutOption:"COMPLETE_IMMEDIATE_PURCHASE",totalPrice:L(W(t,E)).toFixed(2),currencyCode:t.currency,countryCode:z[t.currency]||j},merchantInfo:re(n),emailRequired:!0})}(a)).then(function(e){return de(n.paymentRequestContainer,!0),function(e){var n=e.transactionId,t=e.paymentData,a="".concat(f.paymentBaseUrl).concat(f.googlePayChargePath);return fetch(a,{headers:{"content-type":"application/x-www-form-urlencoded"},method:"POST",mode:"cors",credentials:"omit",body:D({transaction:n,paymentObject:JSON.stringify(t)})}).then(function(e){return e.json()})}({transactionId:a.id,paymentData:e})}).then(function(e){if(de(n.paymentRequestContainer,!1),n.isCharging=!1,a.logAPIResponse(e,t),e.status===S){var s=e.data,l=c(e,Te);return r(function(){return a.onSuccess(i(i({},s),l))}),void n.sendAnalyticsEventToCheckout(ze,i(i({},o),{},{timeSpent:a.getTimeSpent()}))}var u=e.status===q?"This card requires additional authentication, which is not supported here. Please use another payment method.":e&&e.message||"Transaction attempt failed";r(function(){return a.onSetupError(i(i({},e),{},{message:u}))}),n.sendAnalyticsEventToCheckout(Me,{channel:E,message:u})},function(e){if(de(n.paymentRequestContainer,!1),n.isCharging=!1,e&&e.statusCode===I)r(function(){return a.onCancel()});else{var t=e&&e.statusCode;t!==O&&t!==M||J("Google Pay: ".concat(t,". Google rejected the merchant or the origin serving the button. Check that the merchant ID and domain saved in Dashboard > Developers > Google Pay match this page."));var o=e&&(e.statusMessage||e.message)||"Could not complete the Google Pay payment";r(function(){return a.onSetupError({status:!1,message:o})}),n.sendAnalyticsEventToCheckout(Me,{channel:E,message:o})}}).catch(function(e){n.isCharging=!1,J("Google Pay: the charge handler failed. ".concat(e&&e.message||e)),r(function(){return a.onSetupError({status:!1,message:"Could not complete the Google Pay payment"})})})}catch(e){return this.isCharging=!1,J("Google Pay: could not start the charge."),r(function(){return a.onSetupError({status:!1,message:"Could not complete the Google Pay payment"})}),Promise.resolve()}}else Ve("Could not initiate google pay transaction");return Promise.resolve()}},{key:"startApplePay",value:function(e){var n,t,a,r,o,c=this,s="apple pay",l=e||this.activeTransaction();if(!e||e.isActive)if(l&&l.response){if(this.isCharging)return;this.isCharging=!0;try{var u={channel:A,currency:l.response.currency,amount:W(l.response,A)};l.logAttempt(s),this.sendAnalyticsEventToCheckout(je,i(i({},u),{},{paymentMethod:s}));var p=(n={currency:l.response.currency,amount:W(l.response,A),merchantName:l.response.merchant_name,interval:l.response.plan_details&&l.response.plan_details.interval},t=n.currency,a=n.amount,r=n.merchantName,o=n.interval,i({countryCode:"NG",currencyCode:t,merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["visa","masterCard"],requiredBillingContactFields:["postalAddress","name","phone","email"],total:{label:"".concat(r," - Paystack"),type:"final",amount:String(L(a))}},"string"==typeof o&&""!==o.trim()&&{lineItems:[{label:G(o),amount:String(L(a))}]})),d=new window.ApplePaySession(f.applePayVersion,p);d.onvalidatemerchant=function(e){var n=function(e){var n=e.transactionId,t=e.validationURL,a=e.merchantName,r=e.domainName,o=void 0===r?window&&window.location&&window.location.hostname:r,c="".concat(f.paymentBaseUrl).concat(f.applePayValidateSessionPath),s=D({transaction:n,sessionUrl:t,displayName:a,domainName:o});return fetch(c,i(i({},B),{},{body:s})).then(function(e){return e.json()})}({validationURL:e.validationURL,transactionId:l.id,merchantName:l.response.merchant_name});n.then(function(e){e.status!==S?(c.isCharging=!1,l.onSetupError(e)):d.completeMerchantValidation(e.data),l.logValidationResponse(e.message)}).catch(function(e){c.isCharging=!1,l.onSetupError(e)})},d.oncancel=function(){c.isCharging=!1,l.onCancel()},d.onpaymentauthorized=function(e){var n=e.payment,t=function(e){var n=e.transactionId,t=e.payment,a="".concat(f.paymentBaseUrl).concat(f.applePayChargePath),r=D({transaction:n,paymentObject:JSON.stringify(t)});return fetch(a,i(i({},B),{},{body:r})).then(function(e){return e.json()})}({transactionId:l.id,payment:n});t.then(function(e){l.logAPIResponse(e,s),c.isCharging=!1,e.status===S?(d.completePayment(d.STATUS_SUCCESS),l.onSuccess(e),c.sendAnalyticsEventToCheckout(ze,i(i({},u),{},{timeSpent:l.getTimeSpent()}))):(d.completePayment(d.STATUS_FAILURE),l.onSetupError(e),c.sendAnalyticsEventToCheckout(Me,{channel:A,message:e&&e.message||"Transaction attempt failed"}))}).catch(function(e){c.isCharging=!1,d.completePayment(d.STATUS_FAILURE),l.onSetupError(e),c.sendAnalyticsEventToCheckout(Me,{channel:A,message:e&&e.message||"Error occurred"})})},d.begin()}catch(e){this.isCharging=!1,l.onSetupError(e)}}else Ve("Could not initiate apple pay transaction");else J("Apple Pay: this button belongs to a transaction that is no longer active.")}},{key:"resumeTransaction",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.onSuccess,a=n.onCancel,r=n.onLoad,o=n.onError;return this.newTransaction({accessCode:e,onSuccess:t,onCancel:a,onLoad:r,onError:o})}},{key:"activeTransaction",value:function(){var e=this.transactions.filter(function(e){return e.isActive}),n=e.length?e[e.length-1]:null;return n}},{key:"cancelTransaction",value:function(e){var n=this.transactions.find(function(n){return n.id===e})||this.activeTransaction();n&&(n.cancel(),this.close())}},{key:"respondToEvent",value:function(e){if(e){var n,t,a=this.activeTransaction();try{var r=e.data||e.message,o=r.event,i=r.data;if(o)switch(o){case"loaded:checkout":if(this.isLoaded=!0,a){var c=this.checkoutIframe,s=a.urlParameters,l=a.response;Oe({checkoutIframe:c,urlParameters:l?{accessCode:l.access_code,language:null==s?void 0:s.language}:s})}break;case"loaded:transaction":n=this.backgroundIframe,(t=n.contentWindow.document)&&(t.getElementById("app-loader").style.display="none"),a.onLoad(i);break;case"error":"setup"===i.type?a.onSetupError(i):a.logError(i);break;case"cancel":case"close":this.close();var u=i&&i.status;u&&a.setStatus(u),this.hasMountedPaymentRequestButtons()||(a.isActive=!1),a.onCancel();break;case"transfer:pending":this.close();var p=i&&i.status;p&&a.setStatus(p),a.onBankTransferConfirmationPending();break;case"success":this.close(),a.onSuccess(i)}}catch(e){}}}},{key:"respondToEmbedEvents",value:function(e){var n,t,a=this.activeTransaction(),r=e.data||e.message;if(r&&("string"==typeof r||r instanceof String)){var o={action:t=(n=r)&&"string"==typeof n?n.split(" ")[0]:null,data:t?n.split(" ").slice(2).join(" "):null};if(o&&"PaystackClose"===o.action)o.data&&a.onSuccess(r);"PaystackTLSClose"===o.action&&a.cancel()}}},{key:"animateCheckoutIn",value:function(){var e,n=this;if(!this.isOpen){var t=this.checkoutIframe,a=this.backgroundIframe;(e={checkoutIframe:t,backgroundIframe:a},new Promise(function(n,t){e||t("No dom element provided");var a=e.checkoutIframe,r=e.backgroundIframe;a&&r||t("No dom element provided"),a.style.display="",a.style.visibility="visible",r.style.display="",r.style.visibility="visible",n()})).then(function(){n.checkoutIframe.contentWindow.postMessage("render","*")}),this.isOpen=!0}}},{key:"open",value:function(e,n){e&&(Oe({checkoutIframe:this.checkoutIframe,urlParameters:e}),n||this.animateCheckoutIn())}},{key:"close",value:function(){var e=this;if(this.isOpen){var n,t=this.checkoutIframe,a=this.backgroundIframe;(n={checkoutIframe:t,backgroundIframe:a},new Promise(function(e,t){n||t("No dom element provided");var a=n.checkoutIframe,r=n.backgroundIframe;a&&r||t("No dom element provided"),r.style.opacity=0,a.style.display="none",a.style.visibility="hidden",setTimeout(function(){r.style.display="none",r.style.visibility="hidden",r.style.opacity=1,e()},300)})).then(function(){e.checkoutIframe.contentWindow.postMessage("close","*")}),this.isOpen=!1}}},{key:"isLoaded",value:function(){return this.isLoaded}}],[{key:"setup",value:function(n){var t=n&&n.container;ve||(ve=new e({isDeprecatedApi:!0,isEmbed:t})),K("PaystackPop.setup()","new PaystackPop()","Please consult our documentation at https://developers.paystack.co/docs/paystack-inline");var a=ve.newTransaction(n,"deprecated"),r=a.urlParameters;if(t){var o="".concat(f.siteUrl,"/assets/payment/production/inline.html?").concat(g(r)),i=function(e,n){var t=se("embed-checkout-".concat(e));return t.style.cssText="\n background: transparent;\n background: rgba(0,0,0,0);\n border: 0px none transparent;\n overflow-x: hidden;\n overflow-y: hidden;\n nmargin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n -webkit-touch-callout: none;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n visibility: hidden;\n display: none;\n",t.src=n,t.id=e,t.name=e,t.setAttribute("allowpaymentrequest","true"),t.setAttribute("allow","payment; clipboard-read; clipboard-write"),t}(ve.id,o);!function(e,n){var t=document.getElementById(e);t.innerHTML="",t.removeAttribute("style"),t.className="paystack-embed-container",t.style.position="relative",t.style.width="100%",t.appendChild(n)}(n.container,i),i.onload=function(){var e;i.contentWindow.postMessage("PaystackOpen ".concat(ve.id),"*"),e=i,new Promise(function(n,t){e||t("No dom element provided"),e.style.display="",e.style.visibility="visible",n()})}}else a.openIframe=function(){K("openIframe","open","Please consult our documentation at https://developers.paystack.co/docs/paystack-inline"),ve.open(r)};return a}}])}();if(Ne=k().length>0,Ue=b()&&"FORM"===b().parentElement.tagName,Ne&&Ue){var Re,Be=function(){var e={},n=b();return k().forEach(function(t){var a=n.getAttribute(t),r=t.split("data-")[1].replace(/-([a-z])/g,function(e){return e[1].toUpperCase()});e[r]=a}),function(e){if(e.buttonId&&!document.getElementById(e.buttonId))throw new Error("Please make sure the buttonId is an element available in the DOM");var n=i({},e);n.buttonText=e.buttonText||"Pay",n.buttonVariant="normal",n.buttonWordmarkVariant="normal";var t=["normal","light"];return e.buttonVariant&&t.indexOf(e.buttonVariant)>-1&&(n.buttonVariant=e.buttonVariant),e.buttonWordmarkVariant&&t.indexOf(e.buttonWordmarkVariant)>-1&&(n.buttonWordmarkVariant=e.buttonWordmarkVariant),n}(e)}(),De=b().parentElement;ve||(ve=new Le),function(e){var n;if(e.id)(n=document.getElementById(e.id)).setAttribute("data-inline-id",e.id);else{var t=document.createElement("div");t.id="inline-button-".concat(e.inlineId),t.innerHTML=function(e){var n,t,a={normal:'\n <svg id="inline-button-wordmark" width="137" height="13" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M.037 5.095l1.075-.135c-.011-.774-.025-1.944-.013-2.149C1.19 1.364 2.38.134 3.81.013 3.9.006 3.99.002 4.077 0a2.947 2.947 0 0 1 2.046.76c.574.509.95 1.26 1.008 2.007.015.192.01 1.491.01 2.257l1.096.163L8.2 11.44 4.093 12 0 11.346l.037-6.251zm4.106-.514l1.724.256c-.007-.933-.05-2.295-.26-2.654-.319-.545-.846-.867-1.443-.88h-.063c-.607.008-1.138.322-1.458.864-.222.378-.266 1.66-.265 2.637l1.765-.223zM18.228 10.108c-.576 0-1.064-.072-1.464-.216a2.864 2.864 0 0 1-.972-.6 2.552 2.552 0 0 1-.588-.864 4.067 4.067 0 0 1-.252-1.044h1.008c.032.256.088.5.168.732.08.224.204.424.372.6.168.168.388.304.66.408.28.096.636.144 1.068.144.28 0 .536-.036.768-.108.24-.08.448-.192.624-.336.176-.144.312-.316.408-.516.104-.2.156-.42.156-.66 0-.24-.032-.448-.096-.624a1.02 1.02 0 0 0-.336-.468 1.885 1.885 0 0 0-.636-.324 6.4 6.4 0 0 0-1.008-.228 8.79 8.79 0 0 1-1.212-.276 3.246 3.246 0 0 1-.9-.432 1.982 1.982 0 0 1-.564-.672c-.128-.272-.192-.6-.192-.984 0-.328.068-.632.204-.912.136-.288.324-.536.564-.744.248-.208.54-.372.876-.492.336-.12.708-.18 1.116-.18.864 0 1.548.204 2.052.612.512.4.812.984.9 1.752h-.936c-.104-.544-.316-.932-.636-1.164-.32-.24-.78-.36-1.38-.36-.592 0-1.04.132-1.344.396a1.255 1.255 0 0 0-.444.996c0 .208.024.396.072.564.056.16.156.3.3.42.152.12.36.228.624.324a6.72 6.72 0 0 0 1.068.228c.48.072.9.168 1.26.288.36.12.664.276.912.468s.432.428.552.708c.128.28.192.624.192 1.032 0 .36-.076.696-.228 1.008a2.472 2.472 0 0 1-.612.804c-.264.224-.58.4-.948.528-.36.128-.752.192-1.176.192zM25.355 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM32.091 10.108c-.44 0-.848-.072-1.224-.216a3.054 3.054 0 0 1-.972-.636 3.12 3.12 0 0 1-.648-1.008 3.626 3.626 0 0 1-.228-1.32v-.096c0-.48.08-.916.24-1.308.16-.4.376-.74.648-1.02.28-.28.604-.496.972-.648.376-.16.772-.24 1.188-.24.328 0 .644.04.948.12.312.08.588.208.828.384.248.168.456.392.624.672.168.28.276.62.324 1.02h-.984c-.08-.496-.284-.848-.612-1.056-.32-.208-.696-.312-1.128-.312a1.93 1.93 0 0 0-.804.168c-.24.112-.452.272-.636.48a2.23 2.23 0 0 0-.42.744 2.991 2.991 0 0 0-.156.996v.096c0 .776.188 1.364.564 1.764.384.392.88.588 1.488.588.224 0 .436-.032.636-.096a1.651 1.651 0 0 0 .96-.768c.112-.192.18-.416.204-.672h.924a2.595 2.595 0 0 1-.276.948 2.386 2.386 0 0 1-.576.744c-.24.208-.52.372-.84.492-.32.12-.668.18-1.044.18zM38.335 10.108a2.83 2.83 0 0 1-.876-.132 1.724 1.724 0 0 1-.684-.42 2.145 2.145 0 0 1-.456-.756c-.112-.304-.168-.672-.168-1.104V3.724h.996v3.924c0 .552.116.956.348 1.212.24.256.608.384 1.104.384.224 0 .44-.036.648-.108.208-.072.392-.18.552-.324.16-.144.288-.324.384-.54.096-.216.144-.464.144-.744V3.724h.996V10h-.996v-.996c-.144.296-.388.556-.732.78-.336.216-.756.324-1.26.324zM43.216 3.724h.996v1.128c.2-.352.452-.64.756-.864.312-.232.748-.356 1.308-.372v.936a4.461 4.461 0 0 0-.852.12 1.647 1.647 0 0 0-.66.324 1.472 1.472 0 0 0-.408.612c-.096.248-.144.564-.144.948V10h-.996V3.724zM50 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM56.496 10.108c-.408 0-.788-.068-1.14-.204a2.683 2.683 0 0 1-.9-.612 3.01 3.01 0 0 1-.588-.984 4.01 4.01 0 0 1-.204-1.32v-.096c0-.48.072-.92.216-1.32.144-.4.344-.744.6-1.032.256-.296.564-.524.924-.684.36-.16.756-.24 1.188-.24.528 0 .956.112 1.284.336.328.216.584.476.768.78V.724h.996V10h-.996V8.92c-.088.152-.208.3-.36.444a2.792 2.792 0 0 1-.516.384 2.874 2.874 0 0 1-.6.252c-.216.072-.44.108-.672.108zm.108-.828c.288 0 .56-.048.816-.144.256-.096.476-.24.66-.432.184-.2.328-.448.432-.744.112-.304.168-.656.168-1.056v-.096c0-.808-.18-1.404-.54-1.788-.352-.384-.836-.576-1.452-.576-.624 0-1.112.208-1.464.624-.352.416-.528 1.008-.528 1.776v.096c0 .392.048.736.144 1.032.104.296.24.54.408.732.176.192.38.336.612.432.232.096.48.144.744.144zM67.712 10.108c-.512 0-.948-.112-1.308-.336a2.38 2.38 0 0 1-.816-.804V10h-.996V.724h.996V4.78a1.92 1.92 0 0 1 .348-.432c.152-.144.32-.268.504-.372.192-.112.396-.2.612-.264.216-.064.436-.096.66-.096.408 0 .788.072 1.14.216.352.144.652.352.9.624.256.272.456.604.6.996.144.392.216.832.216 1.32v.096c0 .48-.068.92-.204 1.32a3.103 3.103 0 0 1-.576 1.02 2.583 2.583 0 0 1-.9.672 2.937 2.937 0 0 1-1.176.228zm-.096-.828c.624 0 1.1-.2 1.428-.6.328-.408.492-.996.492-1.764V6.82c0-.4-.052-.748-.156-1.044a2.095 2.095 0 0 0-.42-.732 1.53 1.53 0 0 0-.612-.444 1.798 1.798 0 0 0-.744-.156c-.288 0-.56.048-.816.144a1.71 1.71 0 0 0-.648.444c-.184.192-.328.44-.432.744a3.152 3.152 0 0 0-.156 1.044v.096c0 .8.192 1.396.576 1.788.384.384.88.576 1.488.576zM73.63 9.352l-2.46-5.628h1.068l1.92 4.5 1.74-4.5h1.02l-3.468 8.46h-1.008l1.188-2.832zM87.127 3.669A3.138 3.138 0 0 0 86.1 2.95a3.09 3.09 0 0 0-1.228-.25c-.448 0-.848.086-1.187.26a2.199 2.199 0 0 0-.662.497v-.191a.387.387 0 0 0-.214-.348.323.323 0 0 0-.14-.03h-1.315a.314.314 0 0 0-.254.116.377.377 0 0 0-.1.262v8.97c0 .1.034.188.1.258a.34.34 0 0 0 .254.103h1.341a.342.342 0 0 0 .244-.103.336.336 0 0 0 .11-.259v-3.06c.178.202.417.357.702.464.35.134.72.203 1.093.203.43 0 .848-.082 1.242-.248a3.124 3.124 0 0 0 1.04-.724c.305-.326.545-.709.707-1.128a3.93 3.93 0 0 0 .263-1.477c0-.54-.086-1.037-.263-1.477a3.387 3.387 0 0 0-.706-1.12zm-1.204 3.24c-.073.19-.18.362-.315.51a1.415 1.415 0 0 1-1.065.466c-.2.001-.4-.04-.584-.12a1.484 1.484 0 0 1-.49-.346 1.593 1.593 0 0 1-.32-.51 1.738 1.738 0 0 1-.115-.63c0-.224.04-.435.115-.631a1.532 1.532 0 0 1 .804-.846c.185-.086.386-.13.59-.129.215 0 .414.044.593.13.177.083.338.199.474.341a1.622 1.622 0 0 1 .425 1.135c0 .225-.037.436-.112.63zM95.298 2.89h-1.33a.339.339 0 0 0-.246.11.384.384 0 0 0-.108.266v.166a1.856 1.856 0 0 0-.602-.472 2.525 2.525 0 0 0-1.166-.258 3.227 3.227 0 0 0-2.284.964 3.554 3.554 0 0 0-.734 1.123 3.827 3.827 0 0 0-.275 1.477c0 .54.092 1.037.275 1.477.184.434.427.817.728 1.128a3.146 3.146 0 0 0 2.277.973c.437 0 .834-.088 1.173-.259.25-.13.456-.287.608-.471v.177a.34.34 0 0 0 .11.259.341.341 0 0 0 .244.104h1.33a.324.324 0 0 0 .25-.105.349.349 0 0 0 .102-.258V3.267a.377.377 0 0 0-.1-.262.325.325 0 0 0-.252-.115zM93.502 6.9a1.55 1.55 0 0 1-.312.511c-.136.143-.296.26-.473.344-.178.085-.38.129-.596.129-.207 0-.407-.044-.59-.13a1.501 1.501 0 0 1-.791-.855 1.766 1.766 0 0 1-.112-.62c0-.225.038-.436.112-.632.075-.193.181-.364.314-.504.137-.143.3-.26.478-.342.182-.085.382-.129.59-.129.215 0 .417.044.595.13.178.085.338.2.473.341a1.623 1.623 0 0 1 .424 1.135c0 .215-.037.424-.112.622zM108.567 6.094a2.265 2.265 0 0 0-.654-.402c-.247-.101-.509-.181-.785-.235l-1.014-.204c-.26-.05-.441-.117-.543-.203a.328.328 0 0 1-.136-.264c0-.11.063-.2.189-.282.137-.086.329-.13.566-.13.26 0 .518.053.757.157.243.106.471.226.67.36.295.187.546.162.727-.053l.487-.57a.543.543 0 0 0 .152-.357c0-.128-.064-.245-.185-.351-.207-.184-.533-.378-.971-.568-.437-.192-.987-.29-1.637-.29-.427 0-.82.058-1.168.172-.35.116-.65.276-.893.474-.245.204-.438.44-.57.713a2 2 0 0 0-.198.875c0 .56.167 1.017.496 1.358.328.333.766.56 1.304.67l1.054.232c.3.062.528.132.675.21.129.067.19.163.19.297 0 .12-.061.227-.188.324-.133.104-.342.155-.622.155a1.83 1.83 0 0 1-.831-.19 3.056 3.056 0 0 1-.678-.458.995.995 0 0 0-.307-.17c-.126-.037-.268.003-.431.13l-.583.461c-.169.145-.24.32-.209.522.029.194.19.394.491.62.269.193.614.368 1.029.518.415.151.901.229 1.453.229.444 0 .854-.058 1.215-.172.362-.119.681-.278.941-.48a2.056 2.056 0 0 0 .819-1.663c0-.319-.053-.6-.165-.836a1.843 1.843 0 0 0-.447-.6zM114.383 7.73a.363.363 0 0 0-.295-.192.55.55 0 0 0-.343.113c-.095.062-.198.11-.306.141a.75.75 0 0 1-.426.013.43.43 0 0 1-.181-.093.554.554 0 0 1-.143-.204.92.92 0 0 1-.059-.362v-2.46h1.731c.099 0 .188-.04.266-.117a.368.368 0 0 0 .112-.26V3.268a.369.369 0 0 0-.115-.268.38.38 0 0 0-.263-.109h-1.732V1.216a.354.354 0 0 0-.108-.27.347.347 0 0 0-.243-.104h-1.344a.36.36 0 0 0-.34.226.371.371 0 0 0-.027.148V2.89h-.767a.324.324 0 0 0-.255.115.385.385 0 0 0-.098.262V4.31a.4.4 0 0 0 .212.346c.044.021.092.032.14.03h.768v2.925c0 .39.069.726.2 1.003.132.274.305.504.514.676.217.178.465.31.731.388.27.084.551.126.833.126.385 0 .75-.061 1.094-.18a2.13 2.13 0 0 0 .861-.552c.152-.181.17-.381.046-.581l-.463-.76zM121.672 2.89h-1.329a.339.339 0 0 0-.244.11.39.39 0 0 0-.08.122.394.394 0 0 0-.027.144v.166a1.906 1.906 0 0 0-.605-.472c-.335-.173-.726-.258-1.168-.258-.42 0-.834.083-1.226.249a3.24 3.24 0 0 0-1.055.715 3.528 3.528 0 0 0-.734 1.123 3.79 3.79 0 0 0-.276 1.477c0 .54.092 1.037.275 1.477.184.434.428.817.729 1.128a3.138 3.138 0 0 0 2.273.973 2.59 2.59 0 0 0 1.175-.259c.255-.13.457-.287.612-.471v.177a.34.34 0 0 0 .108.259.343.343 0 0 0 .243.104h1.329a.335.335 0 0 0 .252-.105.364.364 0 0 0 .102-.258V3.267a.38.38 0 0 0-.1-.262.332.332 0 0 0-.115-.087.311.311 0 0 0-.139-.028zM119.876 6.9a1.534 1.534 0 0 1-.786.855 1.362 1.362 0 0 1-.594.129c-.207 0-.405-.044-.588-.13a1.516 1.516 0 0 1-.792-.855 1.757 1.757 0 0 1-.113-.62c0-.225.037-.436.112-.632.073-.187.179-.358.314-.504.138-.143.3-.26.479-.342.184-.086.385-.13.588-.129.217 0 .415.044.594.13.181.085.34.2.472.341.134.143.24.313.314.504a1.73 1.73 0 0 1 0 1.253zM128.978 7.64l-.763-.593c-.146-.118-.284-.15-.404-.1a.742.742 0 0 0-.279.205 2.527 2.527 0 0 1-.583.535c-.192.122-.444.183-.742.183-.219 0-.42-.04-.6-.122a1.423 1.423 0 0 1-.469-.342 1.575 1.575 0 0 1-.308-.51 1.751 1.751 0 0 1-.106-.617c0-.228.034-.438.106-.632.07-.192.173-.363.308-.503.135-.144.295-.26.472-.342.187-.088.391-.132.597-.13.298 0 .547.064.742.187.198.126.396.306.584.534.078.092.17.16.278.206.122.048.259.016.401-.101l.762-.594a.53.53 0 0 0 .201-.269.437.437 0 0 0-.034-.365 3.329 3.329 0 0 0-1.18-1.127c-.504-.291-1.108-.441-1.784-.441a3.519 3.519 0 0 0-2.51 1.033c-.322.322-.576.71-.747 1.137a3.68 3.68 0 0 0-.273 1.407c0 .495.093.968.273 1.402.173.424.427.808.747 1.128a3.527 3.527 0 0 0 2.51 1.034c.676 0 1.28-.149 1.784-.444a3.286 3.286 0 0 0 1.182-1.13.411.411 0 0 0 .055-.173.415.415 0 0 0-.023-.182.624.624 0 0 0-.197-.273zM136.06 9.045l-2.104-3.143 1.801-2.415c.094-.139.119-.272.075-.397-.031-.09-.116-.2-.334-.2h-1.425a.52.52 0 0 0-.234.058.482.482 0 0 0-.209.205L132.191 5.2h-.349V.363a.37.37 0 0 0-.099-.26.352.352 0 0 0-.253-.103h-1.332a.37.37 0 0 0-.337.22.346.346 0 0 0-.027.143V9.29c0 .103.038.193.11.259a.353.353 0 0 0 .254.104h1.333a.328.328 0 0 0 .251-.105.346.346 0 0 0 .075-.119.333.333 0 0 0 .024-.14V6.927h.386l1.571 2.446c.112.187.267.281.46.281h1.491c.226 0 .32-.11.358-.202.054-.13.038-.262-.047-.406zM102.863 2.89h-1.489a.389.389 0 0 0-.298.122.544.544 0 0 0-.13.249l-1.099 4.167h-.268l-1.182-4.167a.66.66 0 0 0-.113-.247.329.329 0 0 0-.264-.124h-1.544c-.199 0-.325.066-.372.193a.588.588 0 0 0-.002.37l1.887 5.865c.03.093.08.17.145.232a.388.388 0 0 0 .281.104h.798l-.066.19-.19.547a.872.872 0 0 1-.29.426.7.7 0 0 1-.442.148.956.956 0 0 1-.4-.09 1.842 1.842 0 0 1-.35-.209.62.62 0 0 0-.335-.115h-.016c-.13 0-.243.074-.334.216l-.474.708c-.193.304-.086.504.039.615.234.224.528.399.875.524.344.125.723.186 1.126.186.682 0 1.252-.187 1.689-.565.435-.376.756-.887.952-1.524l2.188-7.258c.05-.155.05-.284.005-.389-.037-.08-.125-.174-.327-.174z" fill="#011B33"/>\n </svg>',light:'\n <svg id="inline-button-wordmark--white" width="137" height="13" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M.037 5.095l1.075-.135c-.011-.774-.025-1.944-.013-2.149C1.19 1.364 2.38.134 3.81.013 3.9.006 3.99.002 4.077 0a2.947 2.947 0 0 1 2.046.76c.574.509.95 1.26 1.008 2.007.015.192.01 1.491.01 2.257l1.096.163L8.2 11.44 4.093 12 0 11.346l.037-6.251zm4.106-.514l1.724.256c-.007-.933-.05-2.295-.26-2.654-.319-.545-.846-.867-1.443-.88h-.063c-.607.008-1.138.322-1.458.864-.222.378-.266 1.66-.265 2.637l1.765-.223zM18.228 10.108c-.576 0-1.064-.072-1.464-.216a2.864 2.864 0 0 1-.972-.6 2.552 2.552 0 0 1-.588-.864 4.067 4.067 0 0 1-.252-1.044h1.008c.032.256.088.5.168.732.08.224.204.424.372.6.168.168.388.304.66.408.28.096.636.144 1.068.144.28 0 .536-.036.768-.108.24-.08.448-.192.624-.336.176-.144.312-.316.408-.516.104-.2.156-.42.156-.66 0-.24-.032-.448-.096-.624a1.02 1.02 0 0 0-.336-.468 1.885 1.885 0 0 0-.636-.324 6.4 6.4 0 0 0-1.008-.228 8.79 8.79 0 0 1-1.212-.276 3.246 3.246 0 0 1-.9-.432 1.982 1.982 0 0 1-.564-.672c-.128-.272-.192-.6-.192-.984 0-.328.068-.632.204-.912.136-.288.324-.536.564-.744.248-.208.54-.372.876-.492.336-.12.708-.18 1.116-.18.864 0 1.548.204 2.052.612.512.4.812.984.9 1.752h-.936c-.104-.544-.316-.932-.636-1.164-.32-.24-.78-.36-1.38-.36-.592 0-1.04.132-1.344.396a1.255 1.255 0 0 0-.444.996c0 .208.024.396.072.564.056.16.156.3.3.42.152.12.36.228.624.324a6.72 6.72 0 0 0 1.068.228c.48.072.9.168 1.26.288.36.12.664.276.912.468s.432.428.552.708c.128.28.192.624.192 1.032 0 .36-.076.696-.228 1.008a2.472 2.472 0 0 1-.612.804c-.264.224-.58.4-.948.528-.36.128-.752.192-1.176.192zM25.355 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM32.091 10.108c-.44 0-.848-.072-1.224-.216a3.054 3.054 0 0 1-.972-.636 3.12 3.12 0 0 1-.648-1.008 3.626 3.626 0 0 1-.228-1.32v-.096c0-.48.08-.916.24-1.308.16-.4.376-.74.648-1.02.28-.28.604-.496.972-.648.376-.16.772-.24 1.188-.24.328 0 .644.04.948.12.312.08.588.208.828.384.248.168.456.392.624.672.168.28.276.62.324 1.02h-.984c-.08-.496-.284-.848-.612-1.056-.32-.208-.696-.312-1.128-.312a1.93 1.93 0 0 0-.804.168c-.24.112-.452.272-.636.48a2.23 2.23 0 0 0-.42.744 2.991 2.991 0 0 0-.156.996v.096c0 .776.188 1.364.564 1.764.384.392.88.588 1.488.588.224 0 .436-.032.636-.096a1.651 1.651 0 0 0 .96-.768c.112-.192.18-.416.204-.672h.924a2.595 2.595 0 0 1-.276.948 2.386 2.386 0 0 1-.576.744c-.24.208-.52.372-.84.492-.32.12-.668.18-1.044.18zM38.335 10.108a2.83 2.83 0 0 1-.876-.132 1.724 1.724 0 0 1-.684-.42 2.145 2.145 0 0 1-.456-.756c-.112-.304-.168-.672-.168-1.104V3.724h.996v3.924c0 .552.116.956.348 1.212.24.256.608.384 1.104.384.224 0 .44-.036.648-.108.208-.072.392-.18.552-.324.16-.144.288-.324.384-.54.096-.216.144-.464.144-.744V3.724h.996V10h-.996v-.996c-.144.296-.388.556-.732.78-.336.216-.756.324-1.26.324zM43.216 3.724h.996v1.128c.2-.352.452-.64.756-.864.312-.232.748-.356 1.308-.372v.936a4.461 4.461 0 0 0-.852.12 1.647 1.647 0 0 0-.66.324 1.472 1.472 0 0 0-.408.612c-.096.248-.144.564-.144.948V10h-.996V3.724zM50 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM56.496 10.108c-.408 0-.788-.068-1.14-.204a2.683 2.683 0 0 1-.9-.612 3.01 3.01 0 0 1-.588-.984 4.01 4.01 0 0 1-.204-1.32v-.096c0-.48.072-.92.216-1.32.144-.4.344-.744.6-1.032.256-.296.564-.524.924-.684.36-.16.756-.24 1.188-.24.528 0 .956.112 1.284.336.328.216.584.476.768.78V.724h.996V10h-.996V8.92c-.088.152-.208.3-.36.444a2.792 2.792 0 0 1-.516.384 2.874 2.874 0 0 1-.6.252c-.216.072-.44.108-.672.108zm.108-.828c.288 0 .56-.048.816-.144.256-.096.476-.24.66-.432.184-.2.328-.448.432-.744.112-.304.168-.656.168-1.056v-.096c0-.808-.18-1.404-.54-1.788-.352-.384-.836-.576-1.452-.576-.624 0-1.112.208-1.464.624-.352.416-.528 1.008-.528 1.776v.096c0 .392.048.736.144 1.032.104.296.24.54.408.732.176.192.38.336.612.432.232.096.48.144.744.144zM67.712 10.108c-.512 0-.948-.112-1.308-.336a2.38 2.38 0 0 1-.816-.804V10h-.996V.724h.996V4.78a1.92 1.92 0 0 1 .348-.432c.152-.144.32-.268.504-.372.192-.112.396-.2.612-.264.216-.064.436-.096.66-.096.408 0 .788.072 1.14.216.352.144.652.352.9.624.256.272.456.604.6.996.144.392.216.832.216 1.32v.096c0 .48-.068.92-.204 1.32a3.103 3.103 0 0 1-.576 1.02 2.583 2.583 0 0 1-.9.672 2.937 2.937 0 0 1-1.176.228zm-.096-.828c.624 0 1.1-.2 1.428-.6.328-.408.492-.996.492-1.764V6.82c0-.4-.052-.748-.156-1.044a2.095 2.095 0 0 0-.42-.732 1.53 1.53 0 0 0-.612-.444 1.798 1.798 0 0 0-.744-.156c-.288 0-.56.048-.816.144a1.71 1.71 0 0 0-.648.444c-.184.192-.328.44-.432.744a3.152 3.152 0 0 0-.156 1.044v.096c0 .8.192 1.396.576 1.788.384.384.88.576 1.488.576zM73.63 9.352l-2.46-5.628h1.068l1.92 4.5 1.74-4.5h1.02l-3.468 8.46h-1.008l1.188-2.832zM87.127 3.669A3.138 3.138 0 0 0 86.1 2.95a3.09 3.09 0 0 0-1.228-.25c-.448 0-.848.086-1.187.26a2.199 2.199 0 0 0-.662.497v-.191a.387.387 0 0 0-.214-.348.323.323 0 0 0-.14-.03h-1.315a.314.314 0 0 0-.254.116.377.377 0 0 0-.1.262v8.97c0 .1.034.188.1.258a.34.34 0 0 0 .254.103h1.341a.342.342 0 0 0 .244-.103.336.336 0 0 0 .11-.259v-3.06c.178.202.417.357.702.464.35.134.72.203 1.093.203.43 0 .848-.082 1.242-.248a3.124 3.124 0 0 0 1.04-.724c.305-.326.545-.709.707-1.128a3.93 3.93 0 0 0 .263-1.477c0-.54-.086-1.037-.263-1.477a3.387 3.387 0 0 0-.706-1.12zm-1.204 3.24c-.073.19-.18.362-.315.51a1.415 1.415 0 0 1-1.065.466c-.2.001-.4-.04-.584-.12a1.484 1.484 0 0 1-.49-.346 1.593 1.593 0 0 1-.32-.51 1.738 1.738 0 0 1-.115-.63c0-.224.04-.435.115-.631a1.532 1.532 0 0 1 .804-.846c.185-.086.386-.13.59-.129.215 0 .414.044.593.13.177.083.338.199.474.341a1.622 1.622 0 0 1 .425 1.135c0 .225-.037.436-.112.63zM95.298 2.89h-1.33a.339.339 0 0 0-.246.11.384.384 0 0 0-.108.266v.166a1.856 1.856 0 0 0-.602-.472 2.525 2.525 0 0 0-1.166-.258 3.227 3.227 0 0 0-2.284.964 3.554 3.554 0 0 0-.734 1.123 3.827 3.827 0 0 0-.275 1.477c0 .54.092 1.037.275 1.477.184.434.427.817.728 1.128a3.146 3.146 0 0 0 2.277.973c.437 0 .834-.088 1.173-.259.25-.13.456-.287.608-.471v.177a.34.34 0 0 0 .11.259.341.341 0 0 0 .244.104h1.33a.324.324 0 0 0 .25-.105.349.349 0 0 0 .102-.258V3.267a.377.377 0 0 0-.1-.262.325.325 0 0 0-.252-.115zM93.502 6.9a1.55 1.55 0 0 1-.312.511c-.136.143-.296.26-.473.344-.178.085-.38.129-.596.129-.207 0-.407-.044-.59-.13a1.501 1.501 0 0 1-.791-.855 1.766 1.766 0 0 1-.112-.62c0-.225.038-.436.112-.632.075-.193.181-.364.314-.504.137-.143.3-.26.478-.342.182-.085.382-.129.59-.129.215 0 .417.044.595.13.178.085.338.2.473.341a1.623 1.623 0 0 1 .424 1.135c0 .215-.037.424-.112.622zM108.567 6.094a2.265 2.265 0 0 0-.654-.402c-.247-.101-.509-.181-.785-.235l-1.014-.204c-.26-.05-.441-.117-.543-.203a.328.328 0 0 1-.136-.264c0-.11.063-.2.189-.282.137-.086.329-.13.566-.13.26 0 .518.053.757.157.243.106.471.226.67.36.295.187.546.162.727-.053l.487-.57a.543.543 0 0 0 .152-.357c0-.128-.064-.245-.185-.351-.207-.184-.533-.378-.971-.568-.437-.192-.987-.29-1.637-.29-.427 0-.82.058-1.168.172-.35.116-.65.276-.893.474-.245.204-.438.44-.57.713a2 2 0 0 0-.198.875c0 .56.167 1.017.496 1.358.328.333.766.56 1.304.67l1.054.232c.3.062.528.132.675.21.129.067.19.163.19.297 0 .12-.061.227-.188.324-.133.104-.342.155-.622.155a1.83 1.83 0 0 1-.831-.19 3.056 3.056 0 0 1-.678-.458.995.995 0 0 0-.307-.17c-.126-.037-.268.003-.431.13l-.583.461c-.169.145-.24.32-.209.522.029.194.19.394.491.62.269.193.614.368 1.029.518.415.151.901.229 1.453.229.444 0 .854-.058 1.215-.172.362-.119.681-.278.941-.48a2.056 2.056 0 0 0 .819-1.663c0-.319-.053-.6-.165-.836a1.843 1.843 0 0 0-.447-.6zM114.383 7.73a.363.363 0 0 0-.295-.192.55.55 0 0 0-.343.113c-.095.062-.198.11-.306.141a.75.75 0 0 1-.426.013.43.43 0 0 1-.181-.093.554.554 0 0 1-.143-.204.92.92 0 0 1-.059-.362v-2.46h1.731c.099 0 .188-.04.266-.117a.368.368 0 0 0 .112-.26V3.268a.369.369 0 0 0-.115-.268.38.38 0 0 0-.263-.109h-1.732V1.216a.354.354 0 0 0-.108-.27.347.347 0 0 0-.243-.104h-1.344a.36.36 0 0 0-.34.226.371.371 0 0 0-.027.148V2.89h-.767a.324.324 0 0 0-.255.115.385.385 0 0 0-.098.262V4.31a.4.4 0 0 0 .212.346c.044.021.092.032.14.03h.768v2.925c0 .39.069.726.2 1.003.132.274.305.504.514.676.217.178.465.31.731.388.27.084.551.126.833.126.385 0 .75-.061 1.094-.18a2.13 2.13 0 0 0 .861-.552c.152-.181.17-.381.046-.581l-.463-.76zM121.672 2.89h-1.329a.339.339 0 0 0-.244.11.39.39 0 0 0-.08.122.394.394 0 0 0-.027.144v.166a1.906 1.906 0 0 0-.605-.472c-.335-.173-.726-.258-1.168-.258-.42 0-.834.083-1.226.249a3.24 3.24 0 0 0-1.055.715 3.528 3.528 0 0 0-.734 1.123 3.79 3.79 0 0 0-.276 1.477c0 .54.092 1.037.275 1.477.184.434.428.817.729 1.128a3.138 3.138 0 0 0 2.273.973 2.59 2.59 0 0 0 1.175-.259c.255-.13.457-.287.612-.471v.177a.34.34 0 0 0 .108.259.343.343 0 0 0 .243.104h1.329a.335.335 0 0 0 .252-.105.364.364 0 0 0 .102-.258V3.267a.38.38 0 0 0-.1-.262.332.332 0 0 0-.115-.087.311.311 0 0 0-.139-.028zM119.876 6.9a1.534 1.534 0 0 1-.786.855 1.362 1.362 0 0 1-.594.129c-.207 0-.405-.044-.588-.13a1.516 1.516 0 0 1-.792-.855 1.757 1.757 0 0 1-.113-.62c0-.225.037-.436.112-.632.073-.187.179-.358.314-.504.138-.143.3-.26.479-.342.184-.086.385-.13.588-.129.217 0 .415.044.594.13.181.085.34.2.472.341.134.143.24.313.314.504a1.73 1.73 0 0 1 0 1.253zM128.978 7.64l-.763-.593c-.146-.118-.284-.15-.404-.1a.742.742 0 0 0-.279.205 2.527 2.527 0 0 1-.583.535c-.192.122-.444.183-.742.183-.219 0-.42-.04-.6-.122a1.423 1.423 0 0 1-.469-.342 1.575 1.575 0 0 1-.308-.51 1.751 1.751 0 0 1-.106-.617c0-.228.034-.438.106-.632.07-.192.173-.363.308-.503.135-.144.295-.26.472-.342.187-.088.391-.132.597-.13.298 0 .547.064.742.187.198.126.396.306.584.534.078.092.17.16.278.206.122.048.259.016.401-.101l.762-.594a.53.53 0 0 0 .201-.269.437.437 0 0 0-.034-.365 3.329 3.329 0 0 0-1.18-1.127c-.504-.291-1.108-.441-1.784-.441a3.519 3.519 0 0 0-2.51 1.033c-.322.322-.576.71-.747 1.137a3.68 3.68 0 0 0-.273 1.407c0 .495.093.968.273 1.402.173.424.427.808.747 1.128a3.527 3.527 0 0 0 2.51 1.034c.676 0 1.28-.149 1.784-.444a3.286 3.286 0 0 0 1.182-1.13.411.411 0 0 0 .055-.173.415.415 0 0 0-.023-.182.624.624 0 0 0-.197-.273zM136.06 9.045l-2.104-3.143 1.801-2.415c.094-.139.119-.272.075-.397-.031-.09-.116-.2-.334-.2h-1.425a.52.52 0 0 0-.234.058.482.482 0 0 0-.209.205L132.191 5.2h-.349V.363a.37.37 0 0 0-.099-.26.352.352 0 0 0-.253-.103h-1.332a.37.37 0 0 0-.337.22.346.346 0 0 0-.027.143V9.29c0 .103.038.193.11.259a.353.353 0 0 0 .254.104h1.333a.328.328 0 0 0 .251-.105.346.346 0 0 0 .075-.119.333.333 0 0 0 .024-.14V6.927h.386l1.571 2.446c.112.187.267.281.46.281h1.491c.226 0 .32-.11.358-.202.054-.13.038-.262-.047-.406zM102.863 2.89h-1.489a.389.389 0 0 0-.298.122.544.544 0 0 0-.13.249l-1.099 4.167h-.268l-1.182-4.167a.66.66 0 0 0-.113-.247.329.329 0 0 0-.264-.124h-1.544c-.199 0-.325.066-.372.193a.588.588 0 0 0-.002.37l1.887 5.865c.03.093.08.17.145.232a.388.388 0 0 0 .281.104h.798l-.066.19-.19.547a.872.872 0 0 1-.29.426.7.7 0 0 1-.442.148.956.956 0 0 1-.4-.09 1.842 1.842 0 0 1-.35-.209.62.62 0 0 0-.335-.115h-.016c-.13 0-.243.074-.334.216l-.474.708c-.193.304-.086.504.039.615.234.224.528.399.875.524.344.125.723.186 1.126.186.682 0 1.252-.187 1.689-.565.435-.376.756-.887.952-1.524l2.188-7.258c.05-.155.05-.284.005-.389-.037-.08-.125-.174-.327-.174z" fill="#ffffff"/>\n </svg>\n'};return"\n <style>\n #inline-button-".concat(e.inlineId," {\n position: relative;\n text-align: center;\n display: inline-block;\n }\n #inline-button-").concat(e.inlineId,"__trigger {\n ").concat((n=e.variant||"normal",t={normal:"\n background: linear-gradient(180deg,#44b669 0,#40ad57);\n text-shadow: 1px 1px 1px rgba(0,0,0,.1);\n color: #ffffff;\n ",light:"\n background: white;\n text-shadow: none;\n color: #011b33;\n "},"".concat("\n box-sizing: border-box;\n display: inline-block;\n line-height: 1;\n white-space: nowrap;\n margin: 0 0 10px;\n text-align: center;\n -webkit-appearance: none;\n outline: none;\n font-size: 14px;\n font-weight: 600;\n border-radius: 6px;\n cursor: pointer;\n padding: 16px 24px;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.15);\n transition: all .3s ease;\n border: none;\n min-width: 190px;\n ").concat(t[n])),"\n }\n #inline-button-").concat(e.inlineId,"__trigger:hover {\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.2);\n }\n #inline-button-").concat(e.inlineId,'__trigger:active {\n transform: translateY(3px);\n }\n </style>\n <button id="inline-button-').concat(e.inlineId,'__trigger" data-inline-id="').concat(e.inlineId,'">').concat(e.text||"Pay"," ").concat(e.currency||"NGN"," ").concat(e.amount,'</button>\n <div id="inline-button-').concat(e.inlineId,'__wordmark">\n ').concat(a[e.wordmarkVariant||"normal"],"\n </div>\n ")}(e),e.parent.parentNode.insertBefore(t,e.parent.nextSibling),n=s(t.getElementsByTagName("button"),1)[0]}return n}({inlineId:ve.id,amount:Be.amount/100,currency:Be.currency,id:Be.buttonId,text:Be.buttonText,variant:Be.buttonVariant,wordmarkVariant:Be.buttonWordmarkVariant,parent:b()}).addEventListener("click",function(e){e.preventDefault(),Re?ve.resumeTransaction(Re.accessCode):Re=ve.newTransaction(i(i({},Be),{},{onSuccess:function(e){var n,t,a,r,o,i;n={type:"hidden",name:"reference",value:e.reference,parent:De},t=n.type,a=n.value,r=n.name,o=n.parent,(i=document.createElement("input")).type=t,i.value=a,i.name=r,o.appendChild(i),De.submit()}}))})}module.exports=Le;
|