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