@paystack/inline-js 2.25.0-dev.1 → 2.25.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -16
- package/dist/inline.js +536 -240
- package/es/inline.js +536 -240
- package/lib/inline.js +536 -240
- package/package.json +1 -2
package/dist/inline.js
CHANGED
|
@@ -154,9 +154,11 @@ var PaystackPop = (function () {
|
|
|
154
154
|
publicKey: '-----BEGIN PUBLIC KEY-----' + '\r\n' + 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALhZs/7hP0g0+hrqTq0hFyGVxgco0NMx' + '\r\n' + 'ZD8nPS6ihxap0yNFjzdyUuZED6P4/aK9Ezl5ajEI9pcx5/1BrEE+F3kCAwEAAQ==' + '\r\n' + '-----END PUBLIC KEY-----',
|
|
155
155
|
applePayVersion: 6,
|
|
156
156
|
applePayValidateSessionPath: 'applepay/validate-session/',
|
|
157
|
-
applePayChargePath: 'applepay/charge'
|
|
157
|
+
applePayChargePath: 'applepay/charge',
|
|
158
|
+
googlePayChargePath: 'googlepay/charge'
|
|
158
159
|
};
|
|
159
160
|
var devConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
161
|
+
environment: 'dev',
|
|
160
162
|
checkoutUrl: 'http://localhost:8081/',
|
|
161
163
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
162
164
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
@@ -165,6 +167,7 @@ var PaystackPop = (function () {
|
|
|
165
167
|
pusherUrl: 'http://localhost:8081/static/vendor/pusher.min.js'
|
|
166
168
|
});
|
|
167
169
|
var stagingConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
170
|
+
environment: 'staging',
|
|
168
171
|
checkoutUrl: 'https://checkout-studio.paystack.com/',
|
|
169
172
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
170
173
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
@@ -173,6 +176,7 @@ var PaystackPop = (function () {
|
|
|
173
176
|
pusherUrl: 'https://checkout-studio.paystack.com/static/vendor/pusher.min.js'
|
|
174
177
|
});
|
|
175
178
|
var productionConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
179
|
+
environment: 'production',
|
|
176
180
|
checkoutUrl: 'https://checkout.paystack.com/',
|
|
177
181
|
paymentBaseUrl: 'https://standard.paystack.co/',
|
|
178
182
|
paystackApiUrl: 'https://api.paystack.co/',
|
|
@@ -288,8 +292,46 @@ var PaystackPop = (function () {
|
|
|
288
292
|
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>";
|
|
289
293
|
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";
|
|
290
294
|
|
|
291
|
-
var
|
|
292
|
-
var
|
|
295
|
+
var APPLE_PAY_SDK_SOURCE = 'https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js';
|
|
296
|
+
var APPLE_PAY_SDK_INTEGRITY_HASH = 'sha384-z/6BVHCcSypLSykOVpaT1PQWHOOgU45uOOlMkgi/bElX4yFqmChNMb7qiv80wFav';
|
|
297
|
+
var GOOGLE_PAY_SDK_SOURCE = 'https://pay.google.com/gp/p/js/pay.js';
|
|
298
|
+
var PAYMENT_REQUEST_BUTTON_HEIGHT = '50px';
|
|
299
|
+
var GOOGLE_PAY_BUTTON_RADIUS = 3;
|
|
300
|
+
var PAYMENT_REQUEST_BUTTON_ORIENTATION = {
|
|
301
|
+
HORIZONTAL: 'horizontal',
|
|
302
|
+
VERTICAL: 'vertical'
|
|
303
|
+
};
|
|
304
|
+
var PAYMENT_REQUEST_BUTTON_THEME = {
|
|
305
|
+
LIGHT: 'light',
|
|
306
|
+
DARK: 'dark'
|
|
307
|
+
};
|
|
308
|
+
var CHANNELS = {
|
|
309
|
+
APPLE_PAY: 'apple_pay',
|
|
310
|
+
GOOGLE_PAY: 'google_pay'
|
|
311
|
+
};
|
|
312
|
+
var TRANSACTION_STATUS = {
|
|
313
|
+
SUCCESS: 'success',
|
|
314
|
+
FAILED: 'failed',
|
|
315
|
+
AUTH: 'auth'
|
|
316
|
+
};
|
|
317
|
+
var TRANSACTION_DOMAIN = {
|
|
318
|
+
TEST: 'test',
|
|
319
|
+
LIVE: 'live'
|
|
320
|
+
};
|
|
321
|
+
var ENVIRONMENT = {
|
|
322
|
+
DEV: 'dev',
|
|
323
|
+
STAGING: 'staging',
|
|
324
|
+
PRODUCTION: 'production'
|
|
325
|
+
};
|
|
326
|
+
var GOOGLE_PAY_STATUS_CODE = {
|
|
327
|
+
CANCELED: 'CANCELED',
|
|
328
|
+
DEVELOPER_ERROR: 'DEVELOPER_ERROR',
|
|
329
|
+
MERCHANT_ACCOUNT_ERROR: 'MERCHANT_ACCOUNT_ERROR'
|
|
330
|
+
};
|
|
331
|
+
var GOOGLE_PAY_READINESS_TIMEOUT_MS = 5000;
|
|
332
|
+
|
|
333
|
+
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";
|
|
334
|
+
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";
|
|
293
335
|
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";
|
|
294
336
|
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";
|
|
295
337
|
function generateInlineButtonCSS(variant) {
|
|
@@ -311,12 +353,12 @@ var PaystackPop = (function () {
|
|
|
311
353
|
return buttonHTML;
|
|
312
354
|
}
|
|
313
355
|
var defaultCustomApplePayStyles = {
|
|
314
|
-
height: '
|
|
356
|
+
height: '100%',
|
|
315
357
|
width: 'auto',
|
|
316
358
|
borderRadius: '3px',
|
|
317
|
-
padding: '
|
|
359
|
+
padding: '10px',
|
|
318
360
|
locale: 'en',
|
|
319
|
-
type: '
|
|
361
|
+
type: 'pay'
|
|
320
362
|
};
|
|
321
363
|
var parseApplePayCustomStyles = function parseApplePayCustomStyles(styles) {
|
|
322
364
|
if (!(styles && _typeof(styles) === 'object')) {
|
|
@@ -341,14 +383,64 @@ var PaystackPop = (function () {
|
|
|
341
383
|
padding = _ref2.padding,
|
|
342
384
|
type = _ref2.type,
|
|
343
385
|
locale = _ref2.locale;
|
|
344
|
-
return "\n @supports (-webkit-appearance: -apple-pay-button) {
|
|
386
|
+
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");
|
|
387
|
+
};
|
|
388
|
+
var generatePaymentRequestInnerWrapperCSS = function generatePaymentRequestInnerWrapperCSS(orientation) {
|
|
389
|
+
var isVertical = orientation === PAYMENT_REQUEST_BUTTON_ORIENTATION.VERTICAL;
|
|
390
|
+
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 ").concat(isVertical ? '' : "height: ".concat(PAYMENT_REQUEST_BUTTON_HEIGHT, ";"), "\n }\n\n #paystack-payment-request-inner-wrapper > * {\n flex: 1;\n min-width: 0;\n height: ").concat(isVertical ? PAYMENT_REQUEST_BUTTON_HEIGHT : '100%', ";\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 #paystack-payment-request-inner-wrapper > #google-pay-loading-button {\n order: 2;\n }\n");
|
|
391
|
+
};
|
|
392
|
+
var generateGooglePayCSS = function generateGooglePayCSS() {
|
|
393
|
+
return "\n #google-pay-button-container {\n width: 100%;\n max-width: 100%;\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 min-width: 100%;\n max-width: 100%;\n height: 100%;\n }\n #google-pay-button-container button {\n outline: none !important;\n }\n";
|
|
394
|
+
};
|
|
395
|
+
var generateGooglePayLoadingCSS = function generateGooglePayLoadingCSS() {
|
|
396
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
397
|
+
borderRadius = _ref3.borderRadius;
|
|
398
|
+
return "\n #google-pay-loading-button {\n width: 100%;\n height: 100%;\n border: none;\n border-radius: ".concat(borderRadius === undefined ? GOOGLE_PAY_BUTTON_RADIUS : borderRadius, "px;\n background: #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 rgba(255, 255, 255, 0.35);\n border-top-color: #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");
|
|
345
399
|
};
|
|
400
|
+
function appendCSS(container, css) {
|
|
401
|
+
var style = document.createElement('style');
|
|
402
|
+
style.type = 'text/css';
|
|
403
|
+
style.textContent = css;
|
|
404
|
+
container.appendChild(style);
|
|
405
|
+
}
|
|
346
406
|
|
|
347
407
|
var amountSubunitToBase = function amountSubunitToBase() {
|
|
348
408
|
var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
349
409
|
return Number(parseFloat(amount / 100).toFixed(2));
|
|
350
410
|
};
|
|
351
411
|
|
|
412
|
+
/* eslint-disable prefer-promise-reject-errors */
|
|
413
|
+
/* eslint-env browser */
|
|
414
|
+
|
|
415
|
+
var loadScript = function loadScript(url) {
|
|
416
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
417
|
+
container = _ref.container,
|
|
418
|
+
integrity = _ref.integrity;
|
|
419
|
+
return new Promise(function (resolve, reject) {
|
|
420
|
+
if (!url) {
|
|
421
|
+
reject('No script url');
|
|
422
|
+
}
|
|
423
|
+
var script = document.createElement('script');
|
|
424
|
+
script.src = url;
|
|
425
|
+
if (integrity) {
|
|
426
|
+
script.crossOrigin = 'anonymous';
|
|
427
|
+
script.integrity = integrity;
|
|
428
|
+
}
|
|
429
|
+
script.addEventListener('load', function () {
|
|
430
|
+
resolve(true);
|
|
431
|
+
});
|
|
432
|
+
script.addEventListener('error', function () {
|
|
433
|
+
script.remove();
|
|
434
|
+
reject(false);
|
|
435
|
+
});
|
|
436
|
+
if (container) {
|
|
437
|
+
container.appendChild(script);
|
|
438
|
+
} else {
|
|
439
|
+
document.head.appendChild(script);
|
|
440
|
+
}
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
|
|
352
444
|
var requestConfig = {
|
|
353
445
|
headers: {
|
|
354
446
|
accept: 'application/json, text/plain, */*',
|
|
@@ -373,12 +465,6 @@ var PaystackPop = (function () {
|
|
|
373
465
|
}, []);
|
|
374
466
|
return formBody.join('&');
|
|
375
467
|
}
|
|
376
|
-
var APPLE_PAY_CAPABILITY_STATUS = {
|
|
377
|
-
AVAILABLE: 'paymentCredentialsAvailable',
|
|
378
|
-
UNAVAILABLE: 'paymentCredentialsUnavailable',
|
|
379
|
-
UNKNOWN: 'paymentCredentialStatusUnknown',
|
|
380
|
-
UNSUPPORTED: 'applePayUnsupported'
|
|
381
|
-
};
|
|
382
468
|
var formatIntervalString = function formatIntervalString(interval) {
|
|
383
469
|
var plans = {
|
|
384
470
|
biannually: 'BIANNUAL PLAN',
|
|
@@ -448,76 +534,205 @@ var PaystackPop = (function () {
|
|
|
448
534
|
};
|
|
449
535
|
var deviceSupportsApplePay = function deviceSupportsApplePay() {
|
|
450
536
|
try {
|
|
451
|
-
return
|
|
537
|
+
return window.isSecureContext && window.ApplePaySession && window.ApplePaySession.supportsVersion(config.applePayVersion);
|
|
452
538
|
} catch (error) {
|
|
453
539
|
return false;
|
|
454
540
|
}
|
|
455
541
|
};
|
|
456
|
-
var
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
if (typeof capabilities === 'string') {
|
|
461
|
-
return capabilities;
|
|
462
|
-
}
|
|
463
|
-
if (typeof capabilities.paymentCredentialStatus === 'string') {
|
|
464
|
-
return capabilities.paymentCredentialStatus;
|
|
465
|
-
}
|
|
466
|
-
return null;
|
|
542
|
+
var canUseApplePay = function canUseApplePay() {
|
|
543
|
+
var channels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
544
|
+
return deviceSupportsApplePay() && channels.includes(CHANNELS.APPLE_PAY);
|
|
467
545
|
};
|
|
468
|
-
var
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
if (typeof ApplePaySession.canMakePayments === 'function') {
|
|
490
|
-
return Promise.resolve(ApplePaySession.canMakePayments()).then(function (canMakePayments) {
|
|
491
|
-
return canMakePayments ? APPLE_PAY_CAPABILITY_STATUS.UNKNOWN : APPLE_PAY_CAPABILITY_STATUS.UNSUPPORTED;
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
return Promise.resolve(null);
|
|
495
|
-
} catch (error) {
|
|
496
|
-
try {
|
|
497
|
-
if (window.ApplePaySession.canMakePayments()) {
|
|
498
|
-
return Promise.resolve(APPLE_PAY_CAPABILITY_STATUS.UNKNOWN);
|
|
546
|
+
var loadApplePay = function loadApplePay(transaction) {
|
|
547
|
+
var response = transaction && transaction.response || {};
|
|
548
|
+
return loadScript(APPLE_PAY_SDK_SOURCE, {
|
|
549
|
+
integrity: APPLE_PAY_SDK_INTEGRITY_HASH
|
|
550
|
+
}).then(function () {
|
|
551
|
+
/**
|
|
552
|
+
* We are currently attempting to deprecate the below code to check webpackjsonp is an array.
|
|
553
|
+
* To do this safely, we are limiting this change to single test integration before rolling
|
|
554
|
+
* out more widely
|
|
555
|
+
*/
|
|
556
|
+
var TEST_INTEGRATION = 1077497;
|
|
557
|
+
/**
|
|
558
|
+
* The Apple Pay SDK expects `window.webpackJsonp` to be array-like
|
|
559
|
+
* but we have seen instances where that is not the case, causing the SDK to throw errors
|
|
560
|
+
* so in this scenario, we opt out of using the SDK
|
|
561
|
+
*/
|
|
562
|
+
if (response.merchant_id && response.merchant_id !== TEST_INTEGRATION) {
|
|
563
|
+
if (window && !Array.isArray(window.webpackJsonp)) {
|
|
564
|
+
throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
|
|
499
565
|
}
|
|
500
|
-
} catch (fallbackError) {
|
|
501
|
-
return Promise.resolve(null);
|
|
502
566
|
}
|
|
503
|
-
|
|
567
|
+
});
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
var getChannelAmount = function getChannelAmount(response, channel) {
|
|
571
|
+
var channelFees = (response && response.channel_fees_and_amount || {})[channel];
|
|
572
|
+
var amount = channelFees && channelFees.amount;
|
|
573
|
+
return amount === undefined || amount === null ? response && response.amount : amount;
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
// eslint-disable-next-line no-console
|
|
577
|
+
var logWarning = console ? console.warn || console.log : function () {};
|
|
578
|
+
function printDeprecationNotice(oldName, newName, extraMessage) {
|
|
579
|
+
logWarning("\"".concat(oldName, "\" has been deprecated, please use \"").concat(newName, "\". ").concat(extraMessage || ''));
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Never advertised here: a `PAN_ONLY` charge comes back needing a 3DS step-up,
|
|
584
|
+
* and inline-js can't handle it
|
|
585
|
+
*/
|
|
586
|
+
var UNSUPPORTED_AUTH_METHODS = ['PAN_ONLY'];
|
|
587
|
+
var paymentsClient = null;
|
|
588
|
+
var paymentsClientEnvironment = null;
|
|
589
|
+
var getGooglePayConfig = function getGooglePayConfig(transaction) {
|
|
590
|
+
var response = transaction && transaction.response;
|
|
591
|
+
var channelSettings = response && response.channel_settings;
|
|
592
|
+
return channelSettings && channelSettings[CHANNELS.GOOGLE_PAY] || null;
|
|
593
|
+
};
|
|
594
|
+
var getSupportedAuthMethods = function getSupportedAuthMethods(googlePayConfig) {
|
|
595
|
+
return (googlePayConfig && googlePayConfig.allowed_card_auth_methods || []).filter(function (authMethod) {
|
|
596
|
+
return !UNSUPPORTED_AUTH_METHODS.includes(authMethod);
|
|
597
|
+
});
|
|
598
|
+
};
|
|
599
|
+
var resolveGooglePayEnvironment = function resolveGooglePayEnvironment(response) {
|
|
600
|
+
var isTest = !!response && response.domain === TRANSACTION_DOMAIN.TEST;
|
|
601
|
+
return config.environment === ENVIRONMENT.PRODUCTION && !isTest ? 'PRODUCTION' : 'TEST';
|
|
602
|
+
};
|
|
603
|
+
var getGooglePayClient = function getGooglePayClient(environment) {
|
|
604
|
+
if (!paymentsClient || paymentsClientEnvironment !== environment) {
|
|
605
|
+
paymentsClient = new window.google.payments.api.PaymentsClient({
|
|
606
|
+
environment: environment
|
|
607
|
+
});
|
|
608
|
+
paymentsClientEnvironment = environment;
|
|
504
609
|
}
|
|
610
|
+
return paymentsClient;
|
|
505
611
|
};
|
|
506
|
-
var
|
|
507
|
-
return
|
|
612
|
+
var hasGooglePaySDKLoaded = function hasGooglePaySDKLoaded() {
|
|
613
|
+
return !!(window.google && window.google.payments && window.google.payments.api && window.google.payments.api.PaymentsClient);
|
|
508
614
|
};
|
|
509
|
-
var
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
615
|
+
var buildBaseRequest = function buildBaseRequest(googlePayConfig) {
|
|
616
|
+
return {
|
|
617
|
+
apiVersion: googlePayConfig.api_version.major,
|
|
618
|
+
apiVersionMinor: googlePayConfig.api_version.minor
|
|
619
|
+
};
|
|
620
|
+
};
|
|
621
|
+
var buildCardPaymentMethod = function buildCardPaymentMethod(googlePayConfig, authMethods) {
|
|
622
|
+
return {
|
|
623
|
+
type: 'CARD',
|
|
624
|
+
parameters: {
|
|
625
|
+
allowedAuthMethods: authMethods,
|
|
626
|
+
allowedCardNetworks: googlePayConfig.allowed_card_networks,
|
|
627
|
+
billingAddressRequired: true,
|
|
628
|
+
billingAddressParameters: googlePayConfig.billing_address_parameters,
|
|
629
|
+
assuranceDetailsRequired: true
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
};
|
|
633
|
+
var buildMerchantInfo = function buildMerchantInfo(googlePayConfig) {
|
|
634
|
+
var merchantInfo = googlePayConfig.merchant_info || {};
|
|
635
|
+
return {
|
|
636
|
+
merchantId: merchantInfo.merchantId,
|
|
637
|
+
merchantName: merchantInfo.merchantName,
|
|
638
|
+
merchantOrigin: merchantInfo.merchantOrigin
|
|
639
|
+
};
|
|
640
|
+
};
|
|
641
|
+
var warnOnOriginMismatch = function warnOnOriginMismatch(googlePayConfig) {
|
|
642
|
+
var registeredOrigin = googlePayConfig.merchant_info && googlePayConfig.merchant_info.merchantOrigin;
|
|
643
|
+
var hostname = window.location.hostname;
|
|
644
|
+
if (registeredOrigin && registeredOrigin !== hostname) {
|
|
645
|
+
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."));
|
|
513
646
|
}
|
|
514
|
-
|
|
515
|
-
|
|
647
|
+
};
|
|
648
|
+
var buildPaymentDataRequest = function buildPaymentDataRequest(transaction) {
|
|
649
|
+
var googlePayConfig = getGooglePayConfig(transaction);
|
|
650
|
+
var response = transaction.response;
|
|
651
|
+
var authMethods = getSupportedAuthMethods(googlePayConfig);
|
|
652
|
+
return _objectSpread2(_objectSpread2({}, buildBaseRequest(googlePayConfig)), {}, {
|
|
653
|
+
allowedPaymentMethods: [_objectSpread2(_objectSpread2({}, buildCardPaymentMethod(googlePayConfig, authMethods)), {}, {
|
|
654
|
+
tokenizationSpecification: googlePayConfig.tokenization_specification
|
|
655
|
+
})],
|
|
656
|
+
transactionInfo: {
|
|
657
|
+
totalPriceStatus: 'FINAL',
|
|
658
|
+
totalPrice: String(amountSubunitToBase(getChannelAmount(response, CHANNELS.GOOGLE_PAY))),
|
|
659
|
+
currencyCode: response.currency
|
|
660
|
+
},
|
|
661
|
+
merchantInfo: buildMerchantInfo(googlePayConfig),
|
|
662
|
+
emailRequired: true
|
|
663
|
+
});
|
|
664
|
+
};
|
|
665
|
+
var chargeGooglePay = function chargeGooglePay(_ref) {
|
|
666
|
+
var transactionId = _ref.transactionId,
|
|
667
|
+
paymentData = _ref.paymentData;
|
|
668
|
+
var chargeUrl = "".concat(config.paymentBaseUrl).concat(config.googlePayChargePath);
|
|
669
|
+
return fetch(chargeUrl, {
|
|
670
|
+
headers: {
|
|
671
|
+
'content-type': 'application/x-www-form-urlencoded'
|
|
672
|
+
},
|
|
673
|
+
method: 'POST',
|
|
674
|
+
mode: 'cors',
|
|
675
|
+
credentials: 'omit',
|
|
676
|
+
body: createFormBody({
|
|
677
|
+
transaction: transactionId,
|
|
678
|
+
paymentObject: JSON.stringify(paymentData)
|
|
679
|
+
})
|
|
680
|
+
}).then(function (response) {
|
|
681
|
+
return response.json();
|
|
682
|
+
});
|
|
683
|
+
};
|
|
684
|
+
var canUseGooglePay = function canUseGooglePay(transaction) {
|
|
685
|
+
var googlePayConfig = getGooglePayConfig(transaction);
|
|
686
|
+
if (!googlePayConfig) {
|
|
687
|
+
logWarning('Google Pay: no merchant configuration on this transaction. Add your merchant details in Dashboard > Developers > Google Pay.');
|
|
688
|
+
return Promise.resolve(null);
|
|
689
|
+
}
|
|
690
|
+
var authMethods = getSupportedAuthMethods(googlePayConfig);
|
|
691
|
+
if (!authMethods.length || !googlePayConfig.tokenization_specification || !hasGooglePaySDKLoaded()) {
|
|
692
|
+
return Promise.resolve(null);
|
|
693
|
+
}
|
|
694
|
+
warnOnOriginMismatch(googlePayConfig);
|
|
695
|
+
var readiness = Promise.resolve().then(function () {
|
|
696
|
+
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
697
|
+
return client.isReadyToPay(_objectSpread2(_objectSpread2({}, buildBaseRequest(googlePayConfig)), {}, {
|
|
698
|
+
allowedPaymentMethods: [buildCardPaymentMethod(googlePayConfig, authMethods)],
|
|
699
|
+
existingPaymentMethodRequired: true
|
|
700
|
+
}));
|
|
701
|
+
}).then(function (_ref2) {
|
|
702
|
+
var result = _ref2.result;
|
|
703
|
+
return !!result;
|
|
704
|
+
}).catch(function () {
|
|
705
|
+
return null;
|
|
706
|
+
});
|
|
707
|
+
var timeoutId;
|
|
708
|
+
var timeout = new Promise(function (resolve) {
|
|
709
|
+
timeoutId = setTimeout(function () {
|
|
710
|
+
resolve(null);
|
|
711
|
+
}, GOOGLE_PAY_READINESS_TIMEOUT_MS);
|
|
712
|
+
});
|
|
713
|
+
return Promise.race([readiness, timeout]).then(function (isReadyToPay) {
|
|
714
|
+
clearTimeout(timeoutId);
|
|
715
|
+
return isReadyToPay;
|
|
716
|
+
});
|
|
717
|
+
};
|
|
718
|
+
var loadGooglePay = function loadGooglePay(transaction) {
|
|
719
|
+
var response = transaction && transaction.response || {};
|
|
720
|
+
var channels = response.channels || [];
|
|
721
|
+
if (!channels.includes(CHANNELS.GOOGLE_PAY)) {
|
|
722
|
+
return Promise.resolve(null);
|
|
723
|
+
}
|
|
724
|
+
var loadSdk = hasGooglePaySDKLoaded() ? Promise.resolve(true) : loadScript(GOOGLE_PAY_SDK_SOURCE).then(function () {
|
|
725
|
+
return hasGooglePaySDKLoaded();
|
|
726
|
+
});
|
|
727
|
+
return loadSdk.catch(function () {
|
|
728
|
+
return false;
|
|
729
|
+
}).then(function (loaded) {
|
|
730
|
+
if (!loaded) {
|
|
731
|
+
return null;
|
|
732
|
+
}
|
|
733
|
+
return canUseGooglePay(transaction);
|
|
516
734
|
});
|
|
517
735
|
};
|
|
518
|
-
|
|
519
|
-
var APPLE_PAY_SDK_SOURCE = 'https://applepay.cdn-apple.com/jsapi/v1.2.0/apple-pay-sdk.js';
|
|
520
|
-
var APPLE_PAY_SDK_INTEGRITY_HASH = 'sha384-hopRfycfKWs+MFyVuNk99Lb7EEhZdyoatMFJRsBk8bXoxaBXkQ+LCPm98iPgFw3a';
|
|
521
736
|
|
|
522
737
|
function createIframe(id) {
|
|
523
738
|
var iframe = document.createElement('iframe');
|
|
@@ -563,55 +778,6 @@ var PaystackPop = (function () {
|
|
|
563
778
|
function getApplePayButton(container) {
|
|
564
779
|
return container.querySelector('apple-pay-button') || container.querySelector('#apple-pay-button');
|
|
565
780
|
}
|
|
566
|
-
var applePaySdkPromise;
|
|
567
|
-
var loadScript = function loadScript(url, _ref) {
|
|
568
|
-
var container = _ref.container,
|
|
569
|
-
integrity = _ref.integrity;
|
|
570
|
-
return new Promise(function (resolve, reject) {
|
|
571
|
-
if (!url) {
|
|
572
|
-
reject('No script url');
|
|
573
|
-
}
|
|
574
|
-
var script = document.createElement('script');
|
|
575
|
-
script.src = url;
|
|
576
|
-
script.crossOrigin = 'anonymous';
|
|
577
|
-
if (integrity) {
|
|
578
|
-
script.integrity = integrity;
|
|
579
|
-
}
|
|
580
|
-
script.addEventListener('load', function () {
|
|
581
|
-
resolve(true);
|
|
582
|
-
});
|
|
583
|
-
script.addEventListener('error', function () {
|
|
584
|
-
script.remove();
|
|
585
|
-
reject(false);
|
|
586
|
-
});
|
|
587
|
-
if (container) {
|
|
588
|
-
container.appendChild(script);
|
|
589
|
-
} else {
|
|
590
|
-
document.head.appendChild(script);
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
};
|
|
594
|
-
var applePayButtonComponentIsAvailable = function applePayButtonComponentIsAvailable() {
|
|
595
|
-
return !!(window && window.customElements && window.customElements.get('apple-pay-button'));
|
|
596
|
-
};
|
|
597
|
-
var ensureApplePaySdkLoaded = function ensureApplePaySdkLoaded(container) {
|
|
598
|
-
if (applePayButtonComponentIsAvailable()) {
|
|
599
|
-
return Promise.resolve(true);
|
|
600
|
-
}
|
|
601
|
-
if (applePaySdkPromise) {
|
|
602
|
-
return applePaySdkPromise;
|
|
603
|
-
}
|
|
604
|
-
applePaySdkPromise = loadScript(APPLE_PAY_SDK_SOURCE, {
|
|
605
|
-
container: container,
|
|
606
|
-
integrity: APPLE_PAY_SDK_INTEGRITY_HASH
|
|
607
|
-
}).then(function () {
|
|
608
|
-
return true;
|
|
609
|
-
}).catch(function (error) {
|
|
610
|
-
applePaySdkPromise = null;
|
|
611
|
-
throw error;
|
|
612
|
-
});
|
|
613
|
-
return applePaySdkPromise;
|
|
614
|
-
};
|
|
615
781
|
function appendIframeToContainer(containerId, iframe) {
|
|
616
782
|
var container = document.getElementById(containerId);
|
|
617
783
|
container.innerHTML = '';
|
|
@@ -704,94 +870,157 @@ var PaystackPop = (function () {
|
|
|
704
870
|
input.name = name;
|
|
705
871
|
parent.appendChild(input);
|
|
706
872
|
}
|
|
707
|
-
function mountApplePayButton(container,
|
|
708
|
-
var styles =
|
|
709
|
-
theme =
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
style.type = 'text/css';
|
|
713
|
-
if (style.styleSheet) {
|
|
714
|
-
style.styleSheet.cssText = applePayCSS;
|
|
715
|
-
} else {
|
|
716
|
-
style.appendChild(document.createTextNode(applePayCSS));
|
|
717
|
-
}
|
|
718
|
-
container.appendChild(style);
|
|
873
|
+
function mountApplePayButton(container, _ref) {
|
|
874
|
+
var styles = _ref.styles,
|
|
875
|
+
theme = _ref.theme,
|
|
876
|
+
onClick = _ref.onClick;
|
|
877
|
+
appendCSS(container, generateApplePayCSS(styles));
|
|
719
878
|
var button = document.createElement('apple-pay-button');
|
|
720
|
-
button.setAttribute('buttonstyle', theme ===
|
|
879
|
+
button.setAttribute('buttonstyle', theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'white' : 'black');
|
|
721
880
|
button.setAttribute('type', styles.type);
|
|
722
881
|
button.setAttribute('locale', styles.locale);
|
|
882
|
+
if (onClick) {
|
|
883
|
+
button.onclick = onClick;
|
|
884
|
+
}
|
|
723
885
|
container.appendChild(button);
|
|
886
|
+
return button;
|
|
724
887
|
}
|
|
725
|
-
function mountApplePayFallbackButton(container,
|
|
726
|
-
var styles =
|
|
727
|
-
theme =
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
style.type = 'text/css';
|
|
731
|
-
if (style.styleSheet) {
|
|
732
|
-
style.styleSheet.cssText = applePayCSS;
|
|
733
|
-
} else {
|
|
734
|
-
style.appendChild(document.createTextNode(applePayCSS));
|
|
735
|
-
}
|
|
736
|
-
container.appendChild(style);
|
|
888
|
+
function mountApplePayFallbackButton(container, _ref2) {
|
|
889
|
+
var styles = _ref2.styles,
|
|
890
|
+
theme = _ref2.theme,
|
|
891
|
+
onClick = _ref2.onClick;
|
|
892
|
+
appendCSS(container, generateApplePayFallbackCSS(styles));
|
|
737
893
|
var button = document.createElement('button');
|
|
738
|
-
button.classList.add('apple-pay-button', theme ===
|
|
894
|
+
button.classList.add('apple-pay-button', theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'apple-pay-button-white' : 'apple-pay-button-black');
|
|
739
895
|
button.id = 'apple-pay-button';
|
|
740
896
|
var applePayLogo = document.createElement('span');
|
|
741
897
|
applePayLogo.classList.add('logo');
|
|
742
898
|
button.appendChild(applePayLogo);
|
|
899
|
+
if (onClick) {
|
|
900
|
+
button.onclick = onClick;
|
|
901
|
+
}
|
|
743
902
|
container.appendChild(button);
|
|
903
|
+
return button;
|
|
744
904
|
}
|
|
745
905
|
function getPaymentRequestContainer(container) {
|
|
746
906
|
return document.querySelector("#".concat(container));
|
|
747
907
|
}
|
|
908
|
+
function removeAllChildNodes(parent) {
|
|
909
|
+
while (parent.firstChild) {
|
|
910
|
+
parent.removeChild(parent.firstChild);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
function getGooglePayButton(container) {
|
|
914
|
+
return container.querySelector('#google-pay-button-container');
|
|
915
|
+
}
|
|
916
|
+
function toggleGooglePayLoadingState(container, isLoading) {
|
|
917
|
+
if (!container) {
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
var buttonContainer = getGooglePayButton(container);
|
|
921
|
+
var loadingButton = container.querySelector('#google-pay-loading-button');
|
|
922
|
+
if (!buttonContainer || !loadingButton) {
|
|
923
|
+
return;
|
|
924
|
+
}
|
|
925
|
+
buttonContainer.style.display = isLoading ? 'none' : '';
|
|
926
|
+
loadingButton.style.display = isLoading ? 'flex' : 'none';
|
|
927
|
+
}
|
|
928
|
+
function mountGooglePayButton(container, _ref3) {
|
|
929
|
+
var transaction = _ref3.transaction,
|
|
930
|
+
_ref3$styles = _ref3.styles,
|
|
931
|
+
styles = _ref3$styles === void 0 ? {} : _ref3$styles,
|
|
932
|
+
onClick = _ref3.onClick;
|
|
933
|
+
var googlePayStyles = styles.googlePay || {};
|
|
934
|
+
var googlePayConfig = getGooglePayConfig(transaction);
|
|
935
|
+
appendCSS(container, generateGooglePayCSS());
|
|
936
|
+
appendCSS(container, generateGooglePayLoadingCSS({
|
|
937
|
+
borderRadius: googlePayStyles.buttonRadius
|
|
938
|
+
}));
|
|
939
|
+
var buttonContainer = document.createElement('div');
|
|
940
|
+
buttonContainer.id = 'google-pay-button-container';
|
|
941
|
+
container.appendChild(buttonContainer);
|
|
942
|
+
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
943
|
+
var button = client.createButton(_objectSpread2(_objectSpread2({
|
|
944
|
+
buttonColor: styles.theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'white' : 'black',
|
|
945
|
+
buttonType: 'pay',
|
|
946
|
+
buttonSizeMode: 'fill',
|
|
947
|
+
buttonRadius: GOOGLE_PAY_BUTTON_RADIUS
|
|
948
|
+
}, googlePayStyles), {}, {
|
|
949
|
+
onClick: onClick,
|
|
950
|
+
allowedPaymentMethods: [buildCardPaymentMethod(googlePayConfig, getSupportedAuthMethods(googlePayConfig))]
|
|
951
|
+
}));
|
|
952
|
+
buttonContainer.appendChild(button);
|
|
953
|
+
var loadingButton = document.createElement('button');
|
|
954
|
+
loadingButton.id = 'google-pay-loading-button';
|
|
955
|
+
loadingButton.type = 'button';
|
|
956
|
+
loadingButton.disabled = true;
|
|
957
|
+
loadingButton.setAttribute('aria-busy', 'true');
|
|
958
|
+
loadingButton.style.display = 'none';
|
|
959
|
+
var spinner = document.createElement('span');
|
|
960
|
+
spinner.id = 'google-pay-loading-button__spinner';
|
|
961
|
+
loadingButton.appendChild(spinner);
|
|
962
|
+
container.appendChild(loadingButton);
|
|
963
|
+
return buttonContainer;
|
|
964
|
+
}
|
|
965
|
+
function getMountedPaymentRequestButtons(container) {
|
|
966
|
+
if (!container) {
|
|
967
|
+
return [];
|
|
968
|
+
}
|
|
969
|
+
return [getApplePayButton(container), getGooglePayButton(container)].filter(Boolean);
|
|
970
|
+
}
|
|
748
971
|
function mountPaymentRequestButtons(container, _ref4) {
|
|
749
|
-
var
|
|
750
|
-
channels = _ref4$channels === void 0 ? [] : _ref4$channels,
|
|
972
|
+
var transaction = _ref4.transaction,
|
|
751
973
|
_ref4$styles = _ref4.styles,
|
|
752
|
-
styles = _ref4$styles === void 0 ? {} : _ref4$styles
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
};
|
|
974
|
+
styles = _ref4$styles === void 0 ? {} : _ref4$styles,
|
|
975
|
+
onClickApplePayButton = _ref4.onClickApplePayButton,
|
|
976
|
+
onClickGooglePayButton = _ref4.onClickGooglePayButton;
|
|
756
977
|
if (!container) {
|
|
757
|
-
return Promise.reject(
|
|
978
|
+
return Promise.reject('Container to mount elements was not provided');
|
|
758
979
|
}
|
|
759
|
-
|
|
760
|
-
|
|
980
|
+
removeAllChildNodes(container);
|
|
981
|
+
appendCSS(container, generatePaymentRequestInnerWrapperCSS(styles.orientation));
|
|
982
|
+
var innerWrapper = document.createElement('div');
|
|
983
|
+
innerWrapper.id = 'paystack-payment-request-inner-wrapper';
|
|
984
|
+
container.appendChild(innerWrapper);
|
|
985
|
+
var applePayOptions = {
|
|
986
|
+
styles: parseApplePayCustomStyles(styles.applePay),
|
|
987
|
+
theme: styles.theme,
|
|
988
|
+
onClick: onClickApplePayButton
|
|
989
|
+
};
|
|
990
|
+
var channels = transaction.response && transaction.response.channels || [];
|
|
991
|
+
var applePayButton = Promise.resolve(null);
|
|
992
|
+
if (canUseApplePay(channels)) {
|
|
993
|
+
applePayButton = loadApplePay(transaction).then(function () {
|
|
994
|
+
return mountApplePayButton(innerWrapper, applePayOptions);
|
|
995
|
+
}).catch(function () {
|
|
996
|
+
return mountApplePayFallbackButton(innerWrapper, applePayOptions);
|
|
997
|
+
}).catch(function () {
|
|
998
|
+
return null;
|
|
999
|
+
});
|
|
1000
|
+
} else if (channels.includes(CHANNELS.APPLE_PAY)) {
|
|
1001
|
+
logWarning('Apple Pay: this device or browser cannot pay with Apple Pay. It requires Safari on an Apple device, over HTTPS.');
|
|
761
1002
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
}).then(function () {
|
|
766
|
-
return canUseApplePay(channels);
|
|
767
|
-
}).then(function (applePayAvailable) {
|
|
768
|
-
if (!applePayAvailable) {
|
|
769
|
-
throw new Error('No wallet payment method is available on this device');
|
|
770
|
-
}
|
|
771
|
-
if (getApplePayButton(container)) {
|
|
772
|
-
mountedElements.applePay = true;
|
|
773
|
-
return mountedElements;
|
|
774
|
-
}
|
|
775
|
-
try {
|
|
776
|
-
mountApplePayButton(container, {
|
|
777
|
-
styles: parseApplePayCustomStyles(styles.applePay),
|
|
778
|
-
theme: styles.theme
|
|
779
|
-
});
|
|
780
|
-
} catch (error) {
|
|
781
|
-
// If the web component is unavailable, fall back to the CSS-based Apple Pay button.
|
|
782
|
-
mountApplePayFallbackButton(container, {
|
|
783
|
-
styles: parseApplePayCustomStyles(styles.applePay),
|
|
784
|
-
theme: styles.theme
|
|
785
|
-
});
|
|
1003
|
+
var googlePayButton = loadGooglePay(transaction).then(function (isReadyToPay) {
|
|
1004
|
+
if (!isReadyToPay) {
|
|
1005
|
+
return null;
|
|
786
1006
|
}
|
|
787
|
-
|
|
788
|
-
|
|
1007
|
+
return mountGooglePayButton(innerWrapper, {
|
|
1008
|
+
transaction: transaction,
|
|
1009
|
+
styles: styles,
|
|
1010
|
+
onClick: onClickGooglePayButton
|
|
1011
|
+
});
|
|
1012
|
+
}).catch(function () {
|
|
1013
|
+
return null;
|
|
1014
|
+
});
|
|
1015
|
+
return Promise.all([applePayButton, googlePayButton]).then(function (_ref5) {
|
|
1016
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
1017
|
+
applePay = _ref6[0],
|
|
1018
|
+
googlePay = _ref6[1];
|
|
1019
|
+
return {
|
|
1020
|
+
applePay: !!applePay,
|
|
1021
|
+
googlePay: !!googlePay
|
|
1022
|
+
};
|
|
789
1023
|
});
|
|
790
|
-
}
|
|
791
|
-
function removeAllChildNodes(parent) {
|
|
792
|
-
while (parent.firstChild) {
|
|
793
|
-
parent.removeChild(parent.firstChild);
|
|
794
|
-
}
|
|
795
1024
|
}
|
|
796
1025
|
|
|
797
1026
|
var allParameters = [{
|
|
@@ -1262,9 +1491,9 @@ var PaystackPop = (function () {
|
|
|
1262
1491
|
},
|
|
1263
1492
|
logAPIResponse: function logAPIResponse(response, channel) {
|
|
1264
1493
|
switch (response.status) {
|
|
1265
|
-
case
|
|
1494
|
+
case TRANSACTION_STATUS.SUCCESS:
|
|
1266
1495
|
return this.logApiSuccess(channel);
|
|
1267
|
-
case
|
|
1496
|
+
case TRANSACTION_STATUS.FAILED:
|
|
1268
1497
|
return this.logApiError(response.message);
|
|
1269
1498
|
default:
|
|
1270
1499
|
return false;
|
|
@@ -1500,12 +1729,6 @@ var PaystackPop = (function () {
|
|
|
1500
1729
|
}]);
|
|
1501
1730
|
}();
|
|
1502
1731
|
|
|
1503
|
-
// eslint-disable-next-line no-console
|
|
1504
|
-
var logWarning = console ? console.warn || console.log : function () {};
|
|
1505
|
-
function printDeprecationNotice(oldName, newName, extraMessage) {
|
|
1506
|
-
logWarning("\"".concat(oldName, "\" has been deprecated, please use \"").concat(newName, "\". ").concat(extraMessage || ''));
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
1732
|
var _excluded = ["preload", "inlineTransaction", "transactionData"],
|
|
1510
1733
|
_excluded2 = ["container", "styles", "onElementsMount"];
|
|
1511
1734
|
var inlineInstance;
|
|
@@ -1549,6 +1772,7 @@ var PaystackPop = (function () {
|
|
|
1549
1772
|
this.transactions = [];
|
|
1550
1773
|
this.isOpen = false;
|
|
1551
1774
|
this.isLoaded = false;
|
|
1775
|
+
this.isCharging = false;
|
|
1552
1776
|
this.isDeprecatedApi = params && params.isDeprecatedApi; // track deprecatedApi
|
|
1553
1777
|
if (params && params.isEmbed) {
|
|
1554
1778
|
this.isEmbed = true;
|
|
@@ -1619,12 +1843,14 @@ var PaystackPop = (function () {
|
|
|
1619
1843
|
inlineTransaction = _ref.inlineTransaction,
|
|
1620
1844
|
transactionData = _ref.transactionData,
|
|
1621
1845
|
options = _objectWithoutProperties(_ref, _excluded);
|
|
1622
|
-
var hasPaymentRequestButtons = this.
|
|
1846
|
+
var hasPaymentRequestButtons = this.hasMountedPaymentRequestButtons();
|
|
1623
1847
|
if (this.activeTransaction() && !hasPaymentRequestButtons) {
|
|
1624
1848
|
this.activeTransaction().cancel();
|
|
1625
1849
|
}
|
|
1626
1850
|
if (inlineTransaction && transactionData) {
|
|
1627
|
-
this.transactions.
|
|
1851
|
+
if (!this.transactions.includes(inlineTransaction)) {
|
|
1852
|
+
this.transactions.push(inlineTransaction);
|
|
1853
|
+
}
|
|
1628
1854
|
if (!this.isDeprecatedApi) {
|
|
1629
1855
|
// TODO: reintroduce this when we resolve checkout caching issues
|
|
1630
1856
|
// this.open({ transactionData }, preload);
|
|
@@ -1690,10 +1916,21 @@ var PaystackPop = (function () {
|
|
|
1690
1916
|
var resumableTransaction = findResumableTransaction(inlineInstance.transactions, transactionParams);
|
|
1691
1917
|
var transaction = resumableTransaction || new InlineTransaction(transactionParams);
|
|
1692
1918
|
transaction.requestInline().then(function (response) {
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1919
|
+
if (resumableTransaction) {
|
|
1920
|
+
transaction.isActive = true;
|
|
1921
|
+
} else {
|
|
1922
|
+
inlineInstance.transactions.push(transaction);
|
|
1923
|
+
}
|
|
1924
|
+
return mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
|
|
1925
|
+
transaction: transaction,
|
|
1926
|
+
styles: styles,
|
|
1927
|
+
onClickApplePayButton: function onClickApplePayButton() {
|
|
1928
|
+
return inlineInstance.startApplePay();
|
|
1929
|
+
},
|
|
1930
|
+
onClickGooglePayButton: function onClickGooglePayButton() {
|
|
1931
|
+
return inlineInstance.startGooglePay();
|
|
1932
|
+
}
|
|
1933
|
+
}).then(function (mountedElements) {
|
|
1697
1934
|
if (onElementsMount) {
|
|
1698
1935
|
onElementsMount(mountedElements);
|
|
1699
1936
|
}
|
|
@@ -1702,18 +1939,14 @@ var PaystackPop = (function () {
|
|
|
1702
1939
|
onElementsMount(null);
|
|
1703
1940
|
}
|
|
1704
1941
|
}).finally(function () {
|
|
1705
|
-
if (resumableTransaction) {
|
|
1706
|
-
transaction.isActive = true;
|
|
1707
|
-
} else {
|
|
1708
|
-
inlineInstance.transactions.push(transaction);
|
|
1709
|
-
}
|
|
1710
|
-
inlineInstance.registerPaymentRequestEventListeners();
|
|
1711
1942
|
if (loadPaystackCheckoutButton) {
|
|
1712
1943
|
var loadPopup = inlineInstance.preloadTransaction({
|
|
1713
1944
|
inlineTransaction: transaction,
|
|
1714
1945
|
transactionData: response
|
|
1715
1946
|
});
|
|
1716
1947
|
loadPaystackCheckoutButton.onclick = loadPopup;
|
|
1948
|
+
} else if (!inlineInstance.hasMountedPaymentRequestButtons()) {
|
|
1949
|
+
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'");
|
|
1717
1950
|
}
|
|
1718
1951
|
resolve(transaction);
|
|
1719
1952
|
});
|
|
@@ -1727,26 +1960,83 @@ var PaystackPop = (function () {
|
|
|
1727
1960
|
});
|
|
1728
1961
|
}
|
|
1729
1962
|
}, {
|
|
1730
|
-
key: "
|
|
1731
|
-
value: function
|
|
1732
|
-
|
|
1733
|
-
var applePayButton = getApplePayButton(this.paymentRequestContainer);
|
|
1734
|
-
if (applePayButton) {
|
|
1735
|
-
applePayButton.onclick = function () {
|
|
1736
|
-
return _this3.startApplePay();
|
|
1737
|
-
};
|
|
1738
|
-
}
|
|
1963
|
+
key: "hasMountedPaymentRequestButtons",
|
|
1964
|
+
value: function hasMountedPaymentRequestButtons() {
|
|
1965
|
+
return getMountedPaymentRequestButtons(this.paymentRequestContainer).length > 0;
|
|
1739
1966
|
}
|
|
1740
1967
|
}, {
|
|
1741
|
-
key: "
|
|
1742
|
-
value: function
|
|
1968
|
+
key: "startGooglePay",
|
|
1969
|
+
value: function startGooglePay() {
|
|
1970
|
+
var _this3 = this;
|
|
1971
|
+
var paymentMethod = 'google pay';
|
|
1743
1972
|
var transaction = this.activeTransaction();
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1973
|
+
if (!transaction) {
|
|
1974
|
+
handleError('Could not initiate google pay transaction');
|
|
1975
|
+
return;
|
|
1976
|
+
}
|
|
1977
|
+
if (this.isCharging) {
|
|
1978
|
+
return;
|
|
1749
1979
|
}
|
|
1980
|
+
this.isCharging = true;
|
|
1981
|
+
var analyticsPayload = {
|
|
1982
|
+
channel: CHANNELS.GOOGLE_PAY,
|
|
1983
|
+
currency: transaction.response.currency,
|
|
1984
|
+
amount: getChannelAmount(transaction.response, CHANNELS.GOOGLE_PAY)
|
|
1985
|
+
};
|
|
1986
|
+
transaction.logAttempt(paymentMethod);
|
|
1987
|
+
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
1988
|
+
paymentMethod: paymentMethod
|
|
1989
|
+
}));
|
|
1990
|
+
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response.domain === TRANSACTION_DOMAIN.TEST));
|
|
1991
|
+
client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
|
|
1992
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, true);
|
|
1993
|
+
return chargeGooglePay({
|
|
1994
|
+
transactionId: transaction.id,
|
|
1995
|
+
paymentData: paymentData
|
|
1996
|
+
});
|
|
1997
|
+
}).then(function (response) {
|
|
1998
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
1999
|
+
_this3.isCharging = false;
|
|
2000
|
+
transaction.logAPIResponse(response, paymentMethod);
|
|
2001
|
+
if (response.status === TRANSACTION_STATUS.SUCCESS) {
|
|
2002
|
+
transaction.onSuccess(response);
|
|
2003
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2004
|
+
timeSpent: transaction.getTimeSpent()
|
|
2005
|
+
}));
|
|
2006
|
+
return;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
// `auth` means a step-up we cannot render here, so say so rather
|
|
2010
|
+
// than leaving the customer holding a token with nowhere to go.
|
|
2011
|
+
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';
|
|
2012
|
+
transaction.onSetupError(_objectSpread2(_objectSpread2({}, response), {}, {
|
|
2013
|
+
message: message
|
|
2014
|
+
}));
|
|
2015
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2016
|
+
channel: CHANNELS.GOOGLE_PAY,
|
|
2017
|
+
message: message
|
|
2018
|
+
});
|
|
2019
|
+
}).catch(function (error) {
|
|
2020
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
2021
|
+
_this3.isCharging = false;
|
|
2022
|
+
if (error && error.statusCode === GOOGLE_PAY_STATUS_CODE.CANCELED) {
|
|
2023
|
+
transaction.onCancel();
|
|
2024
|
+
return;
|
|
2025
|
+
}
|
|
2026
|
+
var statusCode = error && error.statusCode;
|
|
2027
|
+
if (statusCode === GOOGLE_PAY_STATUS_CODE.DEVELOPER_ERROR || statusCode === GOOGLE_PAY_STATUS_CODE.MERCHANT_ACCOUNT_ERROR) {
|
|
2028
|
+
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."));
|
|
2029
|
+
}
|
|
2030
|
+
var message = error && (error.statusMessage || error.message) || 'Could not complete the Google Pay payment';
|
|
2031
|
+
transaction.onSetupError({
|
|
2032
|
+
status: false,
|
|
2033
|
+
message: message
|
|
2034
|
+
});
|
|
2035
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2036
|
+
channel: CHANNELS.GOOGLE_PAY,
|
|
2037
|
+
message: message
|
|
2038
|
+
});
|
|
2039
|
+
});
|
|
1750
2040
|
}
|
|
1751
2041
|
}, {
|
|
1752
2042
|
key: "startApplePay",
|
|
@@ -1755,24 +2045,23 @@ var PaystackPop = (function () {
|
|
|
1755
2045
|
var paymentMethod = 'apple pay';
|
|
1756
2046
|
var transaction = this.activeTransaction();
|
|
1757
2047
|
if (transaction) {
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
currency: transaction.currency,
|
|
1767
|
-
amount: transaction.amount,
|
|
1768
|
-
timeSpent: transaction.getTimeSpent()
|
|
2048
|
+
if (this.isCharging) {
|
|
2049
|
+
return;
|
|
2050
|
+
}
|
|
2051
|
+
this.isCharging = true;
|
|
2052
|
+
var analyticsPayload = {
|
|
2053
|
+
channel: CHANNELS.APPLE_PAY,
|
|
2054
|
+
currency: transaction.response.currency,
|
|
2055
|
+
amount: getChannelAmount(transaction.response, CHANNELS.APPLE_PAY)
|
|
1769
2056
|
};
|
|
1770
2057
|
try {
|
|
1771
2058
|
transaction.logAttempt(paymentMethod);
|
|
1772
|
-
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT,
|
|
2059
|
+
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2060
|
+
paymentMethod: paymentMethod
|
|
2061
|
+
}));
|
|
1773
2062
|
var applePayPaymentRequest = generateApplePaymentRequestObject({
|
|
1774
2063
|
currency: transaction.response.currency,
|
|
1775
|
-
amount: transaction.response.
|
|
2064
|
+
amount: getChannelAmount(transaction.response, CHANNELS.APPLE_PAY),
|
|
1776
2065
|
merchantName: transaction.response.merchant_name,
|
|
1777
2066
|
interval: transaction.response.plan_details && transaction.response.plan_details.interval
|
|
1778
2067
|
});
|
|
@@ -1785,7 +2074,8 @@ var PaystackPop = (function () {
|
|
|
1785
2074
|
merchantName: transaction.response.merchant_name
|
|
1786
2075
|
});
|
|
1787
2076
|
validateSession.then(function (response) {
|
|
1788
|
-
if (response.status !==
|
|
2077
|
+
if (response.status !== TRANSACTION_STATUS.SUCCESS) {
|
|
2078
|
+
_this4.isCharging = false;
|
|
1789
2079
|
transaction.onSetupError(response);
|
|
1790
2080
|
} else {
|
|
1791
2081
|
applePaySession.completeMerchantValidation(response.data);
|
|
@@ -1796,6 +2086,7 @@ var PaystackPop = (function () {
|
|
|
1796
2086
|
});
|
|
1797
2087
|
};
|
|
1798
2088
|
applePaySession.oncancel = function () {
|
|
2089
|
+
_this4.isCharging = false;
|
|
1799
2090
|
transaction.onCancel();
|
|
1800
2091
|
};
|
|
1801
2092
|
applePaySession.onpaymentauthorized = function (_ref3) {
|
|
@@ -1806,29 +2097,34 @@ var PaystackPop = (function () {
|
|
|
1806
2097
|
});
|
|
1807
2098
|
charge.then(function (response) {
|
|
1808
2099
|
transaction.logAPIResponse(response, paymentMethod);
|
|
1809
|
-
|
|
2100
|
+
_this4.isCharging = false;
|
|
2101
|
+
if (response.status === TRANSACTION_STATUS.SUCCESS) {
|
|
1810
2102
|
applePaySession.completePayment(applePaySession.STATUS_SUCCESS);
|
|
1811
2103
|
transaction.onSuccess(response);
|
|
1812
|
-
_this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION,
|
|
2104
|
+
_this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2105
|
+
timeSpent: transaction.getTimeSpent()
|
|
2106
|
+
}));
|
|
1813
2107
|
} else {
|
|
1814
2108
|
applePaySession.completePayment(applePaySession.STATUS_FAILURE);
|
|
1815
2109
|
transaction.onSetupError(response);
|
|
1816
2110
|
_this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
1817
|
-
channel:
|
|
2111
|
+
channel: CHANNELS.APPLE_PAY,
|
|
1818
2112
|
message: response && response.message || 'Transaction attempt failed'
|
|
1819
2113
|
});
|
|
1820
2114
|
}
|
|
1821
2115
|
}).catch(function (error) {
|
|
2116
|
+
_this4.isCharging = false;
|
|
1822
2117
|
applePaySession.completePayment(applePaySession.STATUS_FAILURE);
|
|
1823
2118
|
transaction.onSetupError(error);
|
|
1824
2119
|
_this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
1825
|
-
channel:
|
|
2120
|
+
channel: CHANNELS.APPLE_PAY,
|
|
1826
2121
|
message: error && error.message || 'Error occurred'
|
|
1827
2122
|
});
|
|
1828
2123
|
});
|
|
1829
2124
|
};
|
|
1830
2125
|
applePaySession.begin();
|
|
1831
2126
|
} catch (error) {
|
|
2127
|
+
this.isCharging = false;
|
|
1832
2128
|
transaction.onSetupError(error);
|
|
1833
2129
|
}
|
|
1834
2130
|
} else {
|
|
@@ -1927,7 +2223,7 @@ var PaystackPop = (function () {
|
|
|
1927
2223
|
if (status) {
|
|
1928
2224
|
activeTransaction.setStatus(status);
|
|
1929
2225
|
}
|
|
1930
|
-
var hasPaymentRequestButtons = this.
|
|
2226
|
+
var hasPaymentRequestButtons = this.hasMountedPaymentRequestButtons();
|
|
1931
2227
|
if (!hasPaymentRequestButtons) {
|
|
1932
2228
|
activeTransaction.isActive = false;
|
|
1933
2229
|
}
|