@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/lib/inline.js
CHANGED
|
@@ -153,9 +153,11 @@ var baseConfig = {
|
|
|
153
153
|
publicKey: '-----BEGIN PUBLIC KEY-----' + '\r\n' + 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALhZs/7hP0g0+hrqTq0hFyGVxgco0NMx' + '\r\n' + 'ZD8nPS6ihxap0yNFjzdyUuZED6P4/aK9Ezl5ajEI9pcx5/1BrEE+F3kCAwEAAQ==' + '\r\n' + '-----END PUBLIC KEY-----',
|
|
154
154
|
applePayVersion: 6,
|
|
155
155
|
applePayValidateSessionPath: 'applepay/validate-session/',
|
|
156
|
-
applePayChargePath: 'applepay/charge'
|
|
156
|
+
applePayChargePath: 'applepay/charge',
|
|
157
|
+
googlePayChargePath: 'googlepay/charge'
|
|
157
158
|
};
|
|
158
159
|
var devConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
160
|
+
environment: 'dev',
|
|
159
161
|
checkoutUrl: 'http://localhost:8081/',
|
|
160
162
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
161
163
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
@@ -164,6 +166,7 @@ var devConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
|
164
166
|
pusherUrl: 'http://localhost:8081/static/vendor/pusher.min.js'
|
|
165
167
|
});
|
|
166
168
|
var stagingConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
169
|
+
environment: 'staging',
|
|
167
170
|
checkoutUrl: 'https://checkout-studio.paystack.com/',
|
|
168
171
|
paymentBaseUrl: 'https://legacy-staging.paystack.co/',
|
|
169
172
|
paystackApiUrl: 'https://studio-api.paystack.co/',
|
|
@@ -172,6 +175,7 @@ var stagingConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
|
172
175
|
pusherUrl: 'https://checkout-studio.paystack.com/static/vendor/pusher.min.js'
|
|
173
176
|
});
|
|
174
177
|
var productionConfig = _objectSpread2(_objectSpread2({}, baseConfig), {}, {
|
|
178
|
+
environment: 'production',
|
|
175
179
|
checkoutUrl: 'https://checkout.paystack.com/',
|
|
176
180
|
paymentBaseUrl: 'https://standard.paystack.co/',
|
|
177
181
|
paystackApiUrl: 'https://api.paystack.co/',
|
|
@@ -287,8 +291,46 @@ function getDataAttributesAsParameters() {
|
|
|
287
291
|
var secureByPaystack = "\n <svg id=\"inline-button-wordmark\" width=\"137\" height=\"13\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M.037 5.095l1.075-.135c-.011-.774-.025-1.944-.013-2.149C1.19 1.364 2.38.134 3.81.013 3.9.006 3.99.002 4.077 0a2.947 2.947 0 0 1 2.046.76c.574.509.95 1.26 1.008 2.007.015.192.01 1.491.01 2.257l1.096.163L8.2 11.44 4.093 12 0 11.346l.037-6.251zm4.106-.514l1.724.256c-.007-.933-.05-2.295-.26-2.654-.319-.545-.846-.867-1.443-.88h-.063c-.607.008-1.138.322-1.458.864-.222.378-.266 1.66-.265 2.637l1.765-.223zM18.228 10.108c-.576 0-1.064-.072-1.464-.216a2.864 2.864 0 0 1-.972-.6 2.552 2.552 0 0 1-.588-.864 4.067 4.067 0 0 1-.252-1.044h1.008c.032.256.088.5.168.732.08.224.204.424.372.6.168.168.388.304.66.408.28.096.636.144 1.068.144.28 0 .536-.036.768-.108.24-.08.448-.192.624-.336.176-.144.312-.316.408-.516.104-.2.156-.42.156-.66 0-.24-.032-.448-.096-.624a1.02 1.02 0 0 0-.336-.468 1.885 1.885 0 0 0-.636-.324 6.4 6.4 0 0 0-1.008-.228 8.79 8.79 0 0 1-1.212-.276 3.246 3.246 0 0 1-.9-.432 1.982 1.982 0 0 1-.564-.672c-.128-.272-.192-.6-.192-.984 0-.328.068-.632.204-.912.136-.288.324-.536.564-.744.248-.208.54-.372.876-.492.336-.12.708-.18 1.116-.18.864 0 1.548.204 2.052.612.512.4.812.984.9 1.752h-.936c-.104-.544-.316-.932-.636-1.164-.32-.24-.78-.36-1.38-.36-.592 0-1.04.132-1.344.396a1.255 1.255 0 0 0-.444.996c0 .208.024.396.072.564.056.16.156.3.3.42.152.12.36.228.624.324a6.72 6.72 0 0 0 1.068.228c.48.072.9.168 1.26.288.36.12.664.276.912.468s.432.428.552.708c.128.28.192.624.192 1.032 0 .36-.076.696-.228 1.008a2.472 2.472 0 0 1-.612.804c-.264.224-.58.4-.948.528-.36.128-.752.192-1.176.192zM25.355 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM32.091 10.108c-.44 0-.848-.072-1.224-.216a3.054 3.054 0 0 1-.972-.636 3.12 3.12 0 0 1-.648-1.008 3.626 3.626 0 0 1-.228-1.32v-.096c0-.48.08-.916.24-1.308.16-.4.376-.74.648-1.02.28-.28.604-.496.972-.648.376-.16.772-.24 1.188-.24.328 0 .644.04.948.12.312.08.588.208.828.384.248.168.456.392.624.672.168.28.276.62.324 1.02h-.984c-.08-.496-.284-.848-.612-1.056-.32-.208-.696-.312-1.128-.312a1.93 1.93 0 0 0-.804.168c-.24.112-.452.272-.636.48a2.23 2.23 0 0 0-.42.744 2.991 2.991 0 0 0-.156.996v.096c0 .776.188 1.364.564 1.764.384.392.88.588 1.488.588.224 0 .436-.032.636-.096a1.651 1.651 0 0 0 .96-.768c.112-.192.18-.416.204-.672h.924a2.595 2.595 0 0 1-.276.948 2.386 2.386 0 0 1-.576.744c-.24.208-.52.372-.84.492-.32.12-.668.18-1.044.18zM38.335 10.108a2.83 2.83 0 0 1-.876-.132 1.724 1.724 0 0 1-.684-.42 2.145 2.145 0 0 1-.456-.756c-.112-.304-.168-.672-.168-1.104V3.724h.996v3.924c0 .552.116.956.348 1.212.24.256.608.384 1.104.384.224 0 .44-.036.648-.108.208-.072.392-.18.552-.324.16-.144.288-.324.384-.54.096-.216.144-.464.144-.744V3.724h.996V10h-.996v-.996c-.144.296-.388.556-.732.78-.336.216-.756.324-1.26.324zM43.216 3.724h.996v1.128c.2-.352.452-.64.756-.864.312-.232.748-.356 1.308-.372v.936a4.461 4.461 0 0 0-.852.12 1.647 1.647 0 0 0-.66.324 1.472 1.472 0 0 0-.408.612c-.096.248-.144.564-.144.948V10h-.996V3.724zM50 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM56.496 10.108c-.408 0-.788-.068-1.14-.204a2.683 2.683 0 0 1-.9-.612 3.01 3.01 0 0 1-.588-.984 4.01 4.01 0 0 1-.204-1.32v-.096c0-.48.072-.92.216-1.32.144-.4.344-.744.6-1.032.256-.296.564-.524.924-.684.36-.16.756-.24 1.188-.24.528 0 .956.112 1.284.336.328.216.584.476.768.78V.724h.996V10h-.996V8.92c-.088.152-.208.3-.36.444a2.792 2.792 0 0 1-.516.384 2.874 2.874 0 0 1-.6.252c-.216.072-.44.108-.672.108zm.108-.828c.288 0 .56-.048.816-.144.256-.096.476-.24.66-.432.184-.2.328-.448.432-.744.112-.304.168-.656.168-1.056v-.096c0-.808-.18-1.404-.54-1.788-.352-.384-.836-.576-1.452-.576-.624 0-1.112.208-1.464.624-.352.416-.528 1.008-.528 1.776v.096c0 .392.048.736.144 1.032.104.296.24.54.408.732.176.192.38.336.612.432.232.096.48.144.744.144zM67.712 10.108c-.512 0-.948-.112-1.308-.336a2.38 2.38 0 0 1-.816-.804V10h-.996V.724h.996V4.78a1.92 1.92 0 0 1 .348-.432c.152-.144.32-.268.504-.372.192-.112.396-.2.612-.264.216-.064.436-.096.66-.096.408 0 .788.072 1.14.216.352.144.652.352.9.624.256.272.456.604.6.996.144.392.216.832.216 1.32v.096c0 .48-.068.92-.204 1.32a3.103 3.103 0 0 1-.576 1.02 2.583 2.583 0 0 1-.9.672 2.937 2.937 0 0 1-1.176.228zm-.096-.828c.624 0 1.1-.2 1.428-.6.328-.408.492-.996.492-1.764V6.82c0-.4-.052-.748-.156-1.044a2.095 2.095 0 0 0-.42-.732 1.53 1.53 0 0 0-.612-.444 1.798 1.798 0 0 0-.744-.156c-.288 0-.56.048-.816.144a1.71 1.71 0 0 0-.648.444c-.184.192-.328.44-.432.744a3.152 3.152 0 0 0-.156 1.044v.096c0 .8.192 1.396.576 1.788.384.384.88.576 1.488.576zM73.63 9.352l-2.46-5.628h1.068l1.92 4.5 1.74-4.5h1.02l-3.468 8.46h-1.008l1.188-2.832zM87.127 3.669A3.138 3.138 0 0 0 86.1 2.95a3.09 3.09 0 0 0-1.228-.25c-.448 0-.848.086-1.187.26a2.199 2.199 0 0 0-.662.497v-.191a.387.387 0 0 0-.214-.348.323.323 0 0 0-.14-.03h-1.315a.314.314 0 0 0-.254.116.377.377 0 0 0-.1.262v8.97c0 .1.034.188.1.258a.34.34 0 0 0 .254.103h1.341a.342.342 0 0 0 .244-.103.336.336 0 0 0 .11-.259v-3.06c.178.202.417.357.702.464.35.134.72.203 1.093.203.43 0 .848-.082 1.242-.248a3.124 3.124 0 0 0 1.04-.724c.305-.326.545-.709.707-1.128a3.93 3.93 0 0 0 .263-1.477c0-.54-.086-1.037-.263-1.477a3.387 3.387 0 0 0-.706-1.12zm-1.204 3.24c-.073.19-.18.362-.315.51a1.415 1.415 0 0 1-1.065.466c-.2.001-.4-.04-.584-.12a1.484 1.484 0 0 1-.49-.346 1.593 1.593 0 0 1-.32-.51 1.738 1.738 0 0 1-.115-.63c0-.224.04-.435.115-.631a1.532 1.532 0 0 1 .804-.846c.185-.086.386-.13.59-.129.215 0 .414.044.593.13.177.083.338.199.474.341a1.622 1.622 0 0 1 .425 1.135c0 .225-.037.436-.112.63zM95.298 2.89h-1.33a.339.339 0 0 0-.246.11.384.384 0 0 0-.108.266v.166a1.856 1.856 0 0 0-.602-.472 2.525 2.525 0 0 0-1.166-.258 3.227 3.227 0 0 0-2.284.964 3.554 3.554 0 0 0-.734 1.123 3.827 3.827 0 0 0-.275 1.477c0 .54.092 1.037.275 1.477.184.434.427.817.728 1.128a3.146 3.146 0 0 0 2.277.973c.437 0 .834-.088 1.173-.259.25-.13.456-.287.608-.471v.177a.34.34 0 0 0 .11.259.341.341 0 0 0 .244.104h1.33a.324.324 0 0 0 .25-.105.349.349 0 0 0 .102-.258V3.267a.377.377 0 0 0-.1-.262.325.325 0 0 0-.252-.115zM93.502 6.9a1.55 1.55 0 0 1-.312.511c-.136.143-.296.26-.473.344-.178.085-.38.129-.596.129-.207 0-.407-.044-.59-.13a1.501 1.501 0 0 1-.791-.855 1.766 1.766 0 0 1-.112-.62c0-.225.038-.436.112-.632.075-.193.181-.364.314-.504.137-.143.3-.26.478-.342.182-.085.382-.129.59-.129.215 0 .417.044.595.13.178.085.338.2.473.341a1.623 1.623 0 0 1 .424 1.135c0 .215-.037.424-.112.622zM108.567 6.094a2.265 2.265 0 0 0-.654-.402c-.247-.101-.509-.181-.785-.235l-1.014-.204c-.26-.05-.441-.117-.543-.203a.328.328 0 0 1-.136-.264c0-.11.063-.2.189-.282.137-.086.329-.13.566-.13.26 0 .518.053.757.157.243.106.471.226.67.36.295.187.546.162.727-.053l.487-.57a.543.543 0 0 0 .152-.357c0-.128-.064-.245-.185-.351-.207-.184-.533-.378-.971-.568-.437-.192-.987-.29-1.637-.29-.427 0-.82.058-1.168.172-.35.116-.65.276-.893.474-.245.204-.438.44-.57.713a2 2 0 0 0-.198.875c0 .56.167 1.017.496 1.358.328.333.766.56 1.304.67l1.054.232c.3.062.528.132.675.21.129.067.19.163.19.297 0 .12-.061.227-.188.324-.133.104-.342.155-.622.155a1.83 1.83 0 0 1-.831-.19 3.056 3.056 0 0 1-.678-.458.995.995 0 0 0-.307-.17c-.126-.037-.268.003-.431.13l-.583.461c-.169.145-.24.32-.209.522.029.194.19.394.491.62.269.193.614.368 1.029.518.415.151.901.229 1.453.229.444 0 .854-.058 1.215-.172.362-.119.681-.278.941-.48a2.056 2.056 0 0 0 .819-1.663c0-.319-.053-.6-.165-.836a1.843 1.843 0 0 0-.447-.6zM114.383 7.73a.363.363 0 0 0-.295-.192.55.55 0 0 0-.343.113c-.095.062-.198.11-.306.141a.75.75 0 0 1-.426.013.43.43 0 0 1-.181-.093.554.554 0 0 1-.143-.204.92.92 0 0 1-.059-.362v-2.46h1.731c.099 0 .188-.04.266-.117a.368.368 0 0 0 .112-.26V3.268a.369.369 0 0 0-.115-.268.38.38 0 0 0-.263-.109h-1.732V1.216a.354.354 0 0 0-.108-.27.347.347 0 0 0-.243-.104h-1.344a.36.36 0 0 0-.34.226.371.371 0 0 0-.027.148V2.89h-.767a.324.324 0 0 0-.255.115.385.385 0 0 0-.098.262V4.31a.4.4 0 0 0 .212.346c.044.021.092.032.14.03h.768v2.925c0 .39.069.726.2 1.003.132.274.305.504.514.676.217.178.465.31.731.388.27.084.551.126.833.126.385 0 .75-.061 1.094-.18a2.13 2.13 0 0 0 .861-.552c.152-.181.17-.381.046-.581l-.463-.76zM121.672 2.89h-1.329a.339.339 0 0 0-.244.11.39.39 0 0 0-.08.122.394.394 0 0 0-.027.144v.166a1.906 1.906 0 0 0-.605-.472c-.335-.173-.726-.258-1.168-.258-.42 0-.834.083-1.226.249a3.24 3.24 0 0 0-1.055.715 3.528 3.528 0 0 0-.734 1.123 3.79 3.79 0 0 0-.276 1.477c0 .54.092 1.037.275 1.477.184.434.428.817.729 1.128a3.138 3.138 0 0 0 2.273.973 2.59 2.59 0 0 0 1.175-.259c.255-.13.457-.287.612-.471v.177a.34.34 0 0 0 .108.259.343.343 0 0 0 .243.104h1.329a.335.335 0 0 0 .252-.105.364.364 0 0 0 .102-.258V3.267a.38.38 0 0 0-.1-.262.332.332 0 0 0-.115-.087.311.311 0 0 0-.139-.028zM119.876 6.9a1.534 1.534 0 0 1-.786.855 1.362 1.362 0 0 1-.594.129c-.207 0-.405-.044-.588-.13a1.516 1.516 0 0 1-.792-.855 1.757 1.757 0 0 1-.113-.62c0-.225.037-.436.112-.632.073-.187.179-.358.314-.504.138-.143.3-.26.479-.342.184-.086.385-.13.588-.129.217 0 .415.044.594.13.181.085.34.2.472.341.134.143.24.313.314.504a1.73 1.73 0 0 1 0 1.253zM128.978 7.64l-.763-.593c-.146-.118-.284-.15-.404-.1a.742.742 0 0 0-.279.205 2.527 2.527 0 0 1-.583.535c-.192.122-.444.183-.742.183-.219 0-.42-.04-.6-.122a1.423 1.423 0 0 1-.469-.342 1.575 1.575 0 0 1-.308-.51 1.751 1.751 0 0 1-.106-.617c0-.228.034-.438.106-.632.07-.192.173-.363.308-.503.135-.144.295-.26.472-.342.187-.088.391-.132.597-.13.298 0 .547.064.742.187.198.126.396.306.584.534.078.092.17.16.278.206.122.048.259.016.401-.101l.762-.594a.53.53 0 0 0 .201-.269.437.437 0 0 0-.034-.365 3.329 3.329 0 0 0-1.18-1.127c-.504-.291-1.108-.441-1.784-.441a3.519 3.519 0 0 0-2.51 1.033c-.322.322-.576.71-.747 1.137a3.68 3.68 0 0 0-.273 1.407c0 .495.093.968.273 1.402.173.424.427.808.747 1.128a3.527 3.527 0 0 0 2.51 1.034c.676 0 1.28-.149 1.784-.444a3.286 3.286 0 0 0 1.182-1.13.411.411 0 0 0 .055-.173.415.415 0 0 0-.023-.182.624.624 0 0 0-.197-.273zM136.06 9.045l-2.104-3.143 1.801-2.415c.094-.139.119-.272.075-.397-.031-.09-.116-.2-.334-.2h-1.425a.52.52 0 0 0-.234.058.482.482 0 0 0-.209.205L132.191 5.2h-.349V.363a.37.37 0 0 0-.099-.26.352.352 0 0 0-.253-.103h-1.332a.37.37 0 0 0-.337.22.346.346 0 0 0-.027.143V9.29c0 .103.038.193.11.259a.353.353 0 0 0 .254.104h1.333a.328.328 0 0 0 .251-.105.346.346 0 0 0 .075-.119.333.333 0 0 0 .024-.14V6.927h.386l1.571 2.446c.112.187.267.281.46.281h1.491c.226 0 .32-.11.358-.202.054-.13.038-.262-.047-.406zM102.863 2.89h-1.489a.389.389 0 0 0-.298.122.544.544 0 0 0-.13.249l-1.099 4.167h-.268l-1.182-4.167a.66.66 0 0 0-.113-.247.329.329 0 0 0-.264-.124h-1.544c-.199 0-.325.066-.372.193a.588.588 0 0 0-.002.37l1.887 5.865c.03.093.08.17.145.232a.388.388 0 0 0 .281.104h.798l-.066.19-.19.547a.872.872 0 0 1-.29.426.7.7 0 0 1-.442.148.956.956 0 0 1-.4-.09 1.842 1.842 0 0 1-.35-.209.62.62 0 0 0-.335-.115h-.016c-.13 0-.243.074-.334.216l-.474.708c-.193.304-.086.504.039.615.234.224.528.399.875.524.344.125.723.186 1.126.186.682 0 1.252-.187 1.689-.565.435-.376.756-.887.952-1.524l2.188-7.258c.05-.155.05-.284.005-.389-.037-.08-.125-.174-.327-.174z\" fill=\"#011B33\"/>\n </svg>";
|
|
288
292
|
var secureByPaystackWhite = "\n <svg id=\"inline-button-wordmark--white\" width=\"137\" height=\"13\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M.037 5.095l1.075-.135c-.011-.774-.025-1.944-.013-2.149C1.19 1.364 2.38.134 3.81.013 3.9.006 3.99.002 4.077 0a2.947 2.947 0 0 1 2.046.76c.574.509.95 1.26 1.008 2.007.015.192.01 1.491.01 2.257l1.096.163L8.2 11.44 4.093 12 0 11.346l.037-6.251zm4.106-.514l1.724.256c-.007-.933-.05-2.295-.26-2.654-.319-.545-.846-.867-1.443-.88h-.063c-.607.008-1.138.322-1.458.864-.222.378-.266 1.66-.265 2.637l1.765-.223zM18.228 10.108c-.576 0-1.064-.072-1.464-.216a2.864 2.864 0 0 1-.972-.6 2.552 2.552 0 0 1-.588-.864 4.067 4.067 0 0 1-.252-1.044h1.008c.032.256.088.5.168.732.08.224.204.424.372.6.168.168.388.304.66.408.28.096.636.144 1.068.144.28 0 .536-.036.768-.108.24-.08.448-.192.624-.336.176-.144.312-.316.408-.516.104-.2.156-.42.156-.66 0-.24-.032-.448-.096-.624a1.02 1.02 0 0 0-.336-.468 1.885 1.885 0 0 0-.636-.324 6.4 6.4 0 0 0-1.008-.228 8.79 8.79 0 0 1-1.212-.276 3.246 3.246 0 0 1-.9-.432 1.982 1.982 0 0 1-.564-.672c-.128-.272-.192-.6-.192-.984 0-.328.068-.632.204-.912.136-.288.324-.536.564-.744.248-.208.54-.372.876-.492.336-.12.708-.18 1.116-.18.864 0 1.548.204 2.052.612.512.4.812.984.9 1.752h-.936c-.104-.544-.316-.932-.636-1.164-.32-.24-.78-.36-1.38-.36-.592 0-1.04.132-1.344.396a1.255 1.255 0 0 0-.444.996c0 .208.024.396.072.564.056.16.156.3.3.42.152.12.36.228.624.324a6.72 6.72 0 0 0 1.068.228c.48.072.9.168 1.26.288.36.12.664.276.912.468s.432.428.552.708c.128.28.192.624.192 1.032 0 .36-.076.696-.228 1.008a2.472 2.472 0 0 1-.612.804c-.264.224-.58.4-.948.528-.36.128-.752.192-1.176.192zM25.355 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM32.091 10.108c-.44 0-.848-.072-1.224-.216a3.054 3.054 0 0 1-.972-.636 3.12 3.12 0 0 1-.648-1.008 3.626 3.626 0 0 1-.228-1.32v-.096c0-.48.08-.916.24-1.308.16-.4.376-.74.648-1.02.28-.28.604-.496.972-.648.376-.16.772-.24 1.188-.24.328 0 .644.04.948.12.312.08.588.208.828.384.248.168.456.392.624.672.168.28.276.62.324 1.02h-.984c-.08-.496-.284-.848-.612-1.056-.32-.208-.696-.312-1.128-.312a1.93 1.93 0 0 0-.804.168c-.24.112-.452.272-.636.48a2.23 2.23 0 0 0-.42.744 2.991 2.991 0 0 0-.156.996v.096c0 .776.188 1.364.564 1.764.384.392.88.588 1.488.588.224 0 .436-.032.636-.096a1.651 1.651 0 0 0 .96-.768c.112-.192.18-.416.204-.672h.924a2.595 2.595 0 0 1-.276.948 2.386 2.386 0 0 1-.576.744c-.24.208-.52.372-.84.492-.32.12-.668.18-1.044.18zM38.335 10.108a2.83 2.83 0 0 1-.876-.132 1.724 1.724 0 0 1-.684-.42 2.145 2.145 0 0 1-.456-.756c-.112-.304-.168-.672-.168-1.104V3.724h.996v3.924c0 .552.116.956.348 1.212.24.256.608.384 1.104.384.224 0 .44-.036.648-.108.208-.072.392-.18.552-.324.16-.144.288-.324.384-.54.096-.216.144-.464.144-.744V3.724h.996V10h-.996v-.996c-.144.296-.388.556-.732.78-.336.216-.756.324-1.26.324zM43.216 3.724h.996v1.128c.2-.352.452-.64.756-.864.312-.232.748-.356 1.308-.372v.936a4.461 4.461 0 0 0-.852.12 1.647 1.647 0 0 0-.66.324 1.472 1.472 0 0 0-.408.612c-.096.248-.144.564-.144.948V10h-.996V3.724zM50 10.108c-.44 0-.848-.076-1.224-.228a2.916 2.916 0 0 1-.96-.636 2.966 2.966 0 0 1-.636-1.008 3.77 3.77 0 0 1-.216-1.308v-.096c0-.472.072-.904.216-1.296.144-.4.344-.74.6-1.02.264-.288.576-.508.936-.66.36-.16.756-.24 1.188-.24.36 0 .708.06 1.044.18.344.112.648.292.912.54.264.248.472.572.624.972.16.392.24.868.24 1.428v.324h-4.728c.024.72.204 1.272.54 1.656.336.376.828.564 1.476.564.984 0 1.54-.364 1.668-1.092h.996c-.112.632-.408 1.112-.888 1.44-.48.32-1.076.48-1.788.48zm1.704-3.852c-.048-.648-.232-1.112-.552-1.392-.312-.28-.728-.42-1.248-.42-.512 0-.932.164-1.26.492-.32.32-.524.76-.612 1.32h3.672zM56.496 10.108c-.408 0-.788-.068-1.14-.204a2.683 2.683 0 0 1-.9-.612 3.01 3.01 0 0 1-.588-.984 4.01 4.01 0 0 1-.204-1.32v-.096c0-.48.072-.92.216-1.32.144-.4.344-.744.6-1.032.256-.296.564-.524.924-.684.36-.16.756-.24 1.188-.24.528 0 .956.112 1.284.336.328.216.584.476.768.78V.724h.996V10h-.996V8.92c-.088.152-.208.3-.36.444a2.792 2.792 0 0 1-.516.384 2.874 2.874 0 0 1-.6.252c-.216.072-.44.108-.672.108zm.108-.828c.288 0 .56-.048.816-.144.256-.096.476-.24.66-.432.184-.2.328-.448.432-.744.112-.304.168-.656.168-1.056v-.096c0-.808-.18-1.404-.54-1.788-.352-.384-.836-.576-1.452-.576-.624 0-1.112.208-1.464.624-.352.416-.528 1.008-.528 1.776v.096c0 .392.048.736.144 1.032.104.296.24.54.408.732.176.192.38.336.612.432.232.096.48.144.744.144zM67.712 10.108c-.512 0-.948-.112-1.308-.336a2.38 2.38 0 0 1-.816-.804V10h-.996V.724h.996V4.78a1.92 1.92 0 0 1 .348-.432c.152-.144.32-.268.504-.372.192-.112.396-.2.612-.264.216-.064.436-.096.66-.096.408 0 .788.072 1.14.216.352.144.652.352.9.624.256.272.456.604.6.996.144.392.216.832.216 1.32v.096c0 .48-.068.92-.204 1.32a3.103 3.103 0 0 1-.576 1.02 2.583 2.583 0 0 1-.9.672 2.937 2.937 0 0 1-1.176.228zm-.096-.828c.624 0 1.1-.2 1.428-.6.328-.408.492-.996.492-1.764V6.82c0-.4-.052-.748-.156-1.044a2.095 2.095 0 0 0-.42-.732 1.53 1.53 0 0 0-.612-.444 1.798 1.798 0 0 0-.744-.156c-.288 0-.56.048-.816.144a1.71 1.71 0 0 0-.648.444c-.184.192-.328.44-.432.744a3.152 3.152 0 0 0-.156 1.044v.096c0 .8.192 1.396.576 1.788.384.384.88.576 1.488.576zM73.63 9.352l-2.46-5.628h1.068l1.92 4.5 1.74-4.5h1.02l-3.468 8.46h-1.008l1.188-2.832zM87.127 3.669A3.138 3.138 0 0 0 86.1 2.95a3.09 3.09 0 0 0-1.228-.25c-.448 0-.848.086-1.187.26a2.199 2.199 0 0 0-.662.497v-.191a.387.387 0 0 0-.214-.348.323.323 0 0 0-.14-.03h-1.315a.314.314 0 0 0-.254.116.377.377 0 0 0-.1.262v8.97c0 .1.034.188.1.258a.34.34 0 0 0 .254.103h1.341a.342.342 0 0 0 .244-.103.336.336 0 0 0 .11-.259v-3.06c.178.202.417.357.702.464.35.134.72.203 1.093.203.43 0 .848-.082 1.242-.248a3.124 3.124 0 0 0 1.04-.724c.305-.326.545-.709.707-1.128a3.93 3.93 0 0 0 .263-1.477c0-.54-.086-1.037-.263-1.477a3.387 3.387 0 0 0-.706-1.12zm-1.204 3.24c-.073.19-.18.362-.315.51a1.415 1.415 0 0 1-1.065.466c-.2.001-.4-.04-.584-.12a1.484 1.484 0 0 1-.49-.346 1.593 1.593 0 0 1-.32-.51 1.738 1.738 0 0 1-.115-.63c0-.224.04-.435.115-.631a1.532 1.532 0 0 1 .804-.846c.185-.086.386-.13.59-.129.215 0 .414.044.593.13.177.083.338.199.474.341a1.622 1.622 0 0 1 .425 1.135c0 .225-.037.436-.112.63zM95.298 2.89h-1.33a.339.339 0 0 0-.246.11.384.384 0 0 0-.108.266v.166a1.856 1.856 0 0 0-.602-.472 2.525 2.525 0 0 0-1.166-.258 3.227 3.227 0 0 0-2.284.964 3.554 3.554 0 0 0-.734 1.123 3.827 3.827 0 0 0-.275 1.477c0 .54.092 1.037.275 1.477.184.434.427.817.728 1.128a3.146 3.146 0 0 0 2.277.973c.437 0 .834-.088 1.173-.259.25-.13.456-.287.608-.471v.177a.34.34 0 0 0 .11.259.341.341 0 0 0 .244.104h1.33a.324.324 0 0 0 .25-.105.349.349 0 0 0 .102-.258V3.267a.377.377 0 0 0-.1-.262.325.325 0 0 0-.252-.115zM93.502 6.9a1.55 1.55 0 0 1-.312.511c-.136.143-.296.26-.473.344-.178.085-.38.129-.596.129-.207 0-.407-.044-.59-.13a1.501 1.501 0 0 1-.791-.855 1.766 1.766 0 0 1-.112-.62c0-.225.038-.436.112-.632.075-.193.181-.364.314-.504.137-.143.3-.26.478-.342.182-.085.382-.129.59-.129.215 0 .417.044.595.13.178.085.338.2.473.341a1.623 1.623 0 0 1 .424 1.135c0 .215-.037.424-.112.622zM108.567 6.094a2.265 2.265 0 0 0-.654-.402c-.247-.101-.509-.181-.785-.235l-1.014-.204c-.26-.05-.441-.117-.543-.203a.328.328 0 0 1-.136-.264c0-.11.063-.2.189-.282.137-.086.329-.13.566-.13.26 0 .518.053.757.157.243.106.471.226.67.36.295.187.546.162.727-.053l.487-.57a.543.543 0 0 0 .152-.357c0-.128-.064-.245-.185-.351-.207-.184-.533-.378-.971-.568-.437-.192-.987-.29-1.637-.29-.427 0-.82.058-1.168.172-.35.116-.65.276-.893.474-.245.204-.438.44-.57.713a2 2 0 0 0-.198.875c0 .56.167 1.017.496 1.358.328.333.766.56 1.304.67l1.054.232c.3.062.528.132.675.21.129.067.19.163.19.297 0 .12-.061.227-.188.324-.133.104-.342.155-.622.155a1.83 1.83 0 0 1-.831-.19 3.056 3.056 0 0 1-.678-.458.995.995 0 0 0-.307-.17c-.126-.037-.268.003-.431.13l-.583.461c-.169.145-.24.32-.209.522.029.194.19.394.491.62.269.193.614.368 1.029.518.415.151.901.229 1.453.229.444 0 .854-.058 1.215-.172.362-.119.681-.278.941-.48a2.056 2.056 0 0 0 .819-1.663c0-.319-.053-.6-.165-.836a1.843 1.843 0 0 0-.447-.6zM114.383 7.73a.363.363 0 0 0-.295-.192.55.55 0 0 0-.343.113c-.095.062-.198.11-.306.141a.75.75 0 0 1-.426.013.43.43 0 0 1-.181-.093.554.554 0 0 1-.143-.204.92.92 0 0 1-.059-.362v-2.46h1.731c.099 0 .188-.04.266-.117a.368.368 0 0 0 .112-.26V3.268a.369.369 0 0 0-.115-.268.38.38 0 0 0-.263-.109h-1.732V1.216a.354.354 0 0 0-.108-.27.347.347 0 0 0-.243-.104h-1.344a.36.36 0 0 0-.34.226.371.371 0 0 0-.027.148V2.89h-.767a.324.324 0 0 0-.255.115.385.385 0 0 0-.098.262V4.31a.4.4 0 0 0 .212.346c.044.021.092.032.14.03h.768v2.925c0 .39.069.726.2 1.003.132.274.305.504.514.676.217.178.465.31.731.388.27.084.551.126.833.126.385 0 .75-.061 1.094-.18a2.13 2.13 0 0 0 .861-.552c.152-.181.17-.381.046-.581l-.463-.76zM121.672 2.89h-1.329a.339.339 0 0 0-.244.11.39.39 0 0 0-.08.122.394.394 0 0 0-.027.144v.166a1.906 1.906 0 0 0-.605-.472c-.335-.173-.726-.258-1.168-.258-.42 0-.834.083-1.226.249a3.24 3.24 0 0 0-1.055.715 3.528 3.528 0 0 0-.734 1.123 3.79 3.79 0 0 0-.276 1.477c0 .54.092 1.037.275 1.477.184.434.428.817.729 1.128a3.138 3.138 0 0 0 2.273.973 2.59 2.59 0 0 0 1.175-.259c.255-.13.457-.287.612-.471v.177a.34.34 0 0 0 .108.259.343.343 0 0 0 .243.104h1.329a.335.335 0 0 0 .252-.105.364.364 0 0 0 .102-.258V3.267a.38.38 0 0 0-.1-.262.332.332 0 0 0-.115-.087.311.311 0 0 0-.139-.028zM119.876 6.9a1.534 1.534 0 0 1-.786.855 1.362 1.362 0 0 1-.594.129c-.207 0-.405-.044-.588-.13a1.516 1.516 0 0 1-.792-.855 1.757 1.757 0 0 1-.113-.62c0-.225.037-.436.112-.632.073-.187.179-.358.314-.504.138-.143.3-.26.479-.342.184-.086.385-.13.588-.129.217 0 .415.044.594.13.181.085.34.2.472.341.134.143.24.313.314.504a1.73 1.73 0 0 1 0 1.253zM128.978 7.64l-.763-.593c-.146-.118-.284-.15-.404-.1a.742.742 0 0 0-.279.205 2.527 2.527 0 0 1-.583.535c-.192.122-.444.183-.742.183-.219 0-.42-.04-.6-.122a1.423 1.423 0 0 1-.469-.342 1.575 1.575 0 0 1-.308-.51 1.751 1.751 0 0 1-.106-.617c0-.228.034-.438.106-.632.07-.192.173-.363.308-.503.135-.144.295-.26.472-.342.187-.088.391-.132.597-.13.298 0 .547.064.742.187.198.126.396.306.584.534.078.092.17.16.278.206.122.048.259.016.401-.101l.762-.594a.53.53 0 0 0 .201-.269.437.437 0 0 0-.034-.365 3.329 3.329 0 0 0-1.18-1.127c-.504-.291-1.108-.441-1.784-.441a3.519 3.519 0 0 0-2.51 1.033c-.322.322-.576.71-.747 1.137a3.68 3.68 0 0 0-.273 1.407c0 .495.093.968.273 1.402.173.424.427.808.747 1.128a3.527 3.527 0 0 0 2.51 1.034c.676 0 1.28-.149 1.784-.444a3.286 3.286 0 0 0 1.182-1.13.411.411 0 0 0 .055-.173.415.415 0 0 0-.023-.182.624.624 0 0 0-.197-.273zM136.06 9.045l-2.104-3.143 1.801-2.415c.094-.139.119-.272.075-.397-.031-.09-.116-.2-.334-.2h-1.425a.52.52 0 0 0-.234.058.482.482 0 0 0-.209.205L132.191 5.2h-.349V.363a.37.37 0 0 0-.099-.26.352.352 0 0 0-.253-.103h-1.332a.37.37 0 0 0-.337.22.346.346 0 0 0-.027.143V9.29c0 .103.038.193.11.259a.353.353 0 0 0 .254.104h1.333a.328.328 0 0 0 .251-.105.346.346 0 0 0 .075-.119.333.333 0 0 0 .024-.14V6.927h.386l1.571 2.446c.112.187.267.281.46.281h1.491c.226 0 .32-.11.358-.202.054-.13.038-.262-.047-.406zM102.863 2.89h-1.489a.389.389 0 0 0-.298.122.544.544 0 0 0-.13.249l-1.099 4.167h-.268l-1.182-4.167a.66.66 0 0 0-.113-.247.329.329 0 0 0-.264-.124h-1.544c-.199 0-.325.066-.372.193a.588.588 0 0 0-.002.37l1.887 5.865c.03.093.08.17.145.232a.388.388 0 0 0 .281.104h.798l-.066.19-.19.547a.872.872 0 0 1-.29.426.7.7 0 0 1-.442.148.956.956 0 0 1-.4-.09 1.842 1.842 0 0 1-.35-.209.62.62 0 0 0-.335-.115h-.016c-.13 0-.243.074-.334.216l-.474.708c-.193.304-.086.504.039.615.234.224.528.399.875.524.344.125.723.186 1.126.186.682 0 1.252-.187 1.689-.565.435-.376.756-.887.952-1.524l2.188-7.258c.05-.155.05-.284.005-.389-.037-.08-.125-.174-.327-.174z\" fill=\"#ffffff\"/>\n </svg>\n";
|
|
289
293
|
|
|
290
|
-
var
|
|
291
|
-
var
|
|
294
|
+
var APPLE_PAY_SDK_SOURCE = 'https://applepay.cdn-apple.com/jsapi/v1.1.0/apple-pay-sdk.js';
|
|
295
|
+
var APPLE_PAY_SDK_INTEGRITY_HASH = 'sha384-z/6BVHCcSypLSykOVpaT1PQWHOOgU45uOOlMkgi/bElX4yFqmChNMb7qiv80wFav';
|
|
296
|
+
var GOOGLE_PAY_SDK_SOURCE = 'https://pay.google.com/gp/p/js/pay.js';
|
|
297
|
+
var PAYMENT_REQUEST_BUTTON_HEIGHT = '50px';
|
|
298
|
+
var GOOGLE_PAY_BUTTON_RADIUS = 3;
|
|
299
|
+
var PAYMENT_REQUEST_BUTTON_ORIENTATION = {
|
|
300
|
+
HORIZONTAL: 'horizontal',
|
|
301
|
+
VERTICAL: 'vertical'
|
|
302
|
+
};
|
|
303
|
+
var PAYMENT_REQUEST_BUTTON_THEME = {
|
|
304
|
+
LIGHT: 'light',
|
|
305
|
+
DARK: 'dark'
|
|
306
|
+
};
|
|
307
|
+
var CHANNELS = {
|
|
308
|
+
APPLE_PAY: 'apple_pay',
|
|
309
|
+
GOOGLE_PAY: 'google_pay'
|
|
310
|
+
};
|
|
311
|
+
var TRANSACTION_STATUS = {
|
|
312
|
+
SUCCESS: 'success',
|
|
313
|
+
FAILED: 'failed',
|
|
314
|
+
AUTH: 'auth'
|
|
315
|
+
};
|
|
316
|
+
var TRANSACTION_DOMAIN = {
|
|
317
|
+
TEST: 'test',
|
|
318
|
+
LIVE: 'live'
|
|
319
|
+
};
|
|
320
|
+
var ENVIRONMENT = {
|
|
321
|
+
DEV: 'dev',
|
|
322
|
+
STAGING: 'staging',
|
|
323
|
+
PRODUCTION: 'production'
|
|
324
|
+
};
|
|
325
|
+
var GOOGLE_PAY_STATUS_CODE = {
|
|
326
|
+
CANCELED: 'CANCELED',
|
|
327
|
+
DEVELOPER_ERROR: 'DEVELOPER_ERROR',
|
|
328
|
+
MERCHANT_ACCOUNT_ERROR: 'MERCHANT_ACCOUNT_ERROR'
|
|
329
|
+
};
|
|
330
|
+
var GOOGLE_PAY_READINESS_TIMEOUT_MS = 5000;
|
|
331
|
+
|
|
332
|
+
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";
|
|
333
|
+
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";
|
|
292
334
|
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";
|
|
293
335
|
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";
|
|
294
336
|
function generateInlineButtonCSS(variant) {
|
|
@@ -310,12 +352,12 @@ function generateInlineButtonHTML(options) {
|
|
|
310
352
|
return buttonHTML;
|
|
311
353
|
}
|
|
312
354
|
var defaultCustomApplePayStyles = {
|
|
313
|
-
height: '
|
|
355
|
+
height: '100%',
|
|
314
356
|
width: 'auto',
|
|
315
357
|
borderRadius: '3px',
|
|
316
|
-
padding: '
|
|
358
|
+
padding: '10px',
|
|
317
359
|
locale: 'en',
|
|
318
|
-
type: '
|
|
360
|
+
type: 'pay'
|
|
319
361
|
};
|
|
320
362
|
var parseApplePayCustomStyles = function parseApplePayCustomStyles(styles) {
|
|
321
363
|
if (!(styles && _typeof(styles) === 'object')) {
|
|
@@ -340,14 +382,64 @@ var generateApplePayFallbackCSS = function generateApplePayFallbackCSS(_ref2) {
|
|
|
340
382
|
padding = _ref2.padding,
|
|
341
383
|
type = _ref2.type,
|
|
342
384
|
locale = _ref2.locale;
|
|
343
|
-
return "\n @supports (-webkit-appearance: -apple-pay-button) {
|
|
385
|
+
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");
|
|
386
|
+
};
|
|
387
|
+
var generatePaymentRequestInnerWrapperCSS = function generatePaymentRequestInnerWrapperCSS(orientation) {
|
|
388
|
+
var isVertical = orientation === PAYMENT_REQUEST_BUTTON_ORIENTATION.VERTICAL;
|
|
389
|
+
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");
|
|
390
|
+
};
|
|
391
|
+
var generateGooglePayCSS = function generateGooglePayCSS() {
|
|
392
|
+
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";
|
|
393
|
+
};
|
|
394
|
+
var generateGooglePayLoadingCSS = function generateGooglePayLoadingCSS() {
|
|
395
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
396
|
+
borderRadius = _ref3.borderRadius;
|
|
397
|
+
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");
|
|
344
398
|
};
|
|
399
|
+
function appendCSS(container, css) {
|
|
400
|
+
var style = document.createElement('style');
|
|
401
|
+
style.type = 'text/css';
|
|
402
|
+
style.textContent = css;
|
|
403
|
+
container.appendChild(style);
|
|
404
|
+
}
|
|
345
405
|
|
|
346
406
|
var amountSubunitToBase = function amountSubunitToBase() {
|
|
347
407
|
var amount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
348
408
|
return Number(parseFloat(amount / 100).toFixed(2));
|
|
349
409
|
};
|
|
350
410
|
|
|
411
|
+
/* eslint-disable prefer-promise-reject-errors */
|
|
412
|
+
/* eslint-env browser */
|
|
413
|
+
|
|
414
|
+
var loadScript = function loadScript(url) {
|
|
415
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
416
|
+
container = _ref.container,
|
|
417
|
+
integrity = _ref.integrity;
|
|
418
|
+
return new Promise(function (resolve, reject) {
|
|
419
|
+
if (!url) {
|
|
420
|
+
reject('No script url');
|
|
421
|
+
}
|
|
422
|
+
var script = document.createElement('script');
|
|
423
|
+
script.src = url;
|
|
424
|
+
if (integrity) {
|
|
425
|
+
script.crossOrigin = 'anonymous';
|
|
426
|
+
script.integrity = integrity;
|
|
427
|
+
}
|
|
428
|
+
script.addEventListener('load', function () {
|
|
429
|
+
resolve(true);
|
|
430
|
+
});
|
|
431
|
+
script.addEventListener('error', function () {
|
|
432
|
+
script.remove();
|
|
433
|
+
reject(false);
|
|
434
|
+
});
|
|
435
|
+
if (container) {
|
|
436
|
+
container.appendChild(script);
|
|
437
|
+
} else {
|
|
438
|
+
document.head.appendChild(script);
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
};
|
|
442
|
+
|
|
351
443
|
var requestConfig = {
|
|
352
444
|
headers: {
|
|
353
445
|
accept: 'application/json, text/plain, */*',
|
|
@@ -372,12 +464,6 @@ function createFormBody(params) {
|
|
|
372
464
|
}, []);
|
|
373
465
|
return formBody.join('&');
|
|
374
466
|
}
|
|
375
|
-
var APPLE_PAY_CAPABILITY_STATUS = {
|
|
376
|
-
AVAILABLE: 'paymentCredentialsAvailable',
|
|
377
|
-
UNAVAILABLE: 'paymentCredentialsUnavailable',
|
|
378
|
-
UNKNOWN: 'paymentCredentialStatusUnknown',
|
|
379
|
-
UNSUPPORTED: 'applePayUnsupported'
|
|
380
|
-
};
|
|
381
467
|
var formatIntervalString = function formatIntervalString(interval) {
|
|
382
468
|
var plans = {
|
|
383
469
|
biannually: 'BIANNUAL PLAN',
|
|
@@ -447,76 +533,205 @@ var chargeApplePay = function chargeApplePay(_ref3) {
|
|
|
447
533
|
};
|
|
448
534
|
var deviceSupportsApplePay = function deviceSupportsApplePay() {
|
|
449
535
|
try {
|
|
450
|
-
return
|
|
536
|
+
return window.isSecureContext && window.ApplePaySession && window.ApplePaySession.supportsVersion(config.applePayVersion);
|
|
451
537
|
} catch (error) {
|
|
452
538
|
return false;
|
|
453
539
|
}
|
|
454
540
|
};
|
|
455
|
-
var
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}
|
|
459
|
-
if (typeof capabilities === 'string') {
|
|
460
|
-
return capabilities;
|
|
461
|
-
}
|
|
462
|
-
if (typeof capabilities.paymentCredentialStatus === 'string') {
|
|
463
|
-
return capabilities.paymentCredentialStatus;
|
|
464
|
-
}
|
|
465
|
-
return null;
|
|
541
|
+
var canUseApplePay = function canUseApplePay() {
|
|
542
|
+
var channels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
543
|
+
return deviceSupportsApplePay() && channels.includes(CHANNELS.APPLE_PAY);
|
|
466
544
|
};
|
|
467
|
-
var
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
if (typeof ApplePaySession.canMakePayments === 'function') {
|
|
489
|
-
return Promise.resolve(ApplePaySession.canMakePayments()).then(function (canMakePayments) {
|
|
490
|
-
return canMakePayments ? APPLE_PAY_CAPABILITY_STATUS.UNKNOWN : APPLE_PAY_CAPABILITY_STATUS.UNSUPPORTED;
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
return Promise.resolve(null);
|
|
494
|
-
} catch (error) {
|
|
495
|
-
try {
|
|
496
|
-
if (window.ApplePaySession.canMakePayments()) {
|
|
497
|
-
return Promise.resolve(APPLE_PAY_CAPABILITY_STATUS.UNKNOWN);
|
|
545
|
+
var loadApplePay = function loadApplePay(transaction) {
|
|
546
|
+
var response = transaction && transaction.response || {};
|
|
547
|
+
return loadScript(APPLE_PAY_SDK_SOURCE, {
|
|
548
|
+
integrity: APPLE_PAY_SDK_INTEGRITY_HASH
|
|
549
|
+
}).then(function () {
|
|
550
|
+
/**
|
|
551
|
+
* We are currently attempting to deprecate the below code to check webpackjsonp is an array.
|
|
552
|
+
* To do this safely, we are limiting this change to single test integration before rolling
|
|
553
|
+
* out more widely
|
|
554
|
+
*/
|
|
555
|
+
var TEST_INTEGRATION = 1077497;
|
|
556
|
+
/**
|
|
557
|
+
* The Apple Pay SDK expects `window.webpackJsonp` to be array-like
|
|
558
|
+
* but we have seen instances where that is not the case, causing the SDK to throw errors
|
|
559
|
+
* so in this scenario, we opt out of using the SDK
|
|
560
|
+
*/
|
|
561
|
+
if (response.merchant_id && response.merchant_id !== TEST_INTEGRATION) {
|
|
562
|
+
if (window && !Array.isArray(window.webpackJsonp)) {
|
|
563
|
+
throw new Error("Incorrect data type for 'webpackJsonp', expected array, got ".concat(_typeof(window.webpackJsonp), ". Switching to fallback apple pay button"));
|
|
498
564
|
}
|
|
499
|
-
} catch (fallbackError) {
|
|
500
|
-
return Promise.resolve(null);
|
|
501
565
|
}
|
|
502
|
-
|
|
566
|
+
});
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
var getChannelAmount = function getChannelAmount(response, channel) {
|
|
570
|
+
var channelFees = (response && response.channel_fees_and_amount || {})[channel];
|
|
571
|
+
var amount = channelFees && channelFees.amount;
|
|
572
|
+
return amount === undefined || amount === null ? response && response.amount : amount;
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
// eslint-disable-next-line no-console
|
|
576
|
+
var logWarning = console ? console.warn || console.log : function () {};
|
|
577
|
+
function printDeprecationNotice(oldName, newName, extraMessage) {
|
|
578
|
+
logWarning("\"".concat(oldName, "\" has been deprecated, please use \"").concat(newName, "\". ").concat(extraMessage || ''));
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Never advertised here: a `PAN_ONLY` charge comes back needing a 3DS step-up,
|
|
583
|
+
* and inline-js can't handle it
|
|
584
|
+
*/
|
|
585
|
+
var UNSUPPORTED_AUTH_METHODS = ['PAN_ONLY'];
|
|
586
|
+
var paymentsClient = null;
|
|
587
|
+
var paymentsClientEnvironment = null;
|
|
588
|
+
var getGooglePayConfig = function getGooglePayConfig(transaction) {
|
|
589
|
+
var response = transaction && transaction.response;
|
|
590
|
+
var channelSettings = response && response.channel_settings;
|
|
591
|
+
return channelSettings && channelSettings[CHANNELS.GOOGLE_PAY] || null;
|
|
592
|
+
};
|
|
593
|
+
var getSupportedAuthMethods = function getSupportedAuthMethods(googlePayConfig) {
|
|
594
|
+
return (googlePayConfig && googlePayConfig.allowed_card_auth_methods || []).filter(function (authMethod) {
|
|
595
|
+
return !UNSUPPORTED_AUTH_METHODS.includes(authMethod);
|
|
596
|
+
});
|
|
597
|
+
};
|
|
598
|
+
var resolveGooglePayEnvironment = function resolveGooglePayEnvironment(response) {
|
|
599
|
+
var isTest = !!response && response.domain === TRANSACTION_DOMAIN.TEST;
|
|
600
|
+
return config.environment === ENVIRONMENT.PRODUCTION && !isTest ? 'PRODUCTION' : 'TEST';
|
|
601
|
+
};
|
|
602
|
+
var getGooglePayClient = function getGooglePayClient(environment) {
|
|
603
|
+
if (!paymentsClient || paymentsClientEnvironment !== environment) {
|
|
604
|
+
paymentsClient = new window.google.payments.api.PaymentsClient({
|
|
605
|
+
environment: environment
|
|
606
|
+
});
|
|
607
|
+
paymentsClientEnvironment = environment;
|
|
503
608
|
}
|
|
609
|
+
return paymentsClient;
|
|
504
610
|
};
|
|
505
|
-
var
|
|
506
|
-
return
|
|
611
|
+
var hasGooglePaySDKLoaded = function hasGooglePaySDKLoaded() {
|
|
612
|
+
return !!(window.google && window.google.payments && window.google.payments.api && window.google.payments.api.PaymentsClient);
|
|
507
613
|
};
|
|
508
|
-
var
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
614
|
+
var buildBaseRequest = function buildBaseRequest(googlePayConfig) {
|
|
615
|
+
return {
|
|
616
|
+
apiVersion: googlePayConfig.api_version.major,
|
|
617
|
+
apiVersionMinor: googlePayConfig.api_version.minor
|
|
618
|
+
};
|
|
619
|
+
};
|
|
620
|
+
var buildCardPaymentMethod = function buildCardPaymentMethod(googlePayConfig, authMethods) {
|
|
621
|
+
return {
|
|
622
|
+
type: 'CARD',
|
|
623
|
+
parameters: {
|
|
624
|
+
allowedAuthMethods: authMethods,
|
|
625
|
+
allowedCardNetworks: googlePayConfig.allowed_card_networks,
|
|
626
|
+
billingAddressRequired: true,
|
|
627
|
+
billingAddressParameters: googlePayConfig.billing_address_parameters,
|
|
628
|
+
assuranceDetailsRequired: true
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
};
|
|
632
|
+
var buildMerchantInfo = function buildMerchantInfo(googlePayConfig) {
|
|
633
|
+
var merchantInfo = googlePayConfig.merchant_info || {};
|
|
634
|
+
return {
|
|
635
|
+
merchantId: merchantInfo.merchantId,
|
|
636
|
+
merchantName: merchantInfo.merchantName,
|
|
637
|
+
merchantOrigin: merchantInfo.merchantOrigin
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
var warnOnOriginMismatch = function warnOnOriginMismatch(googlePayConfig) {
|
|
641
|
+
var registeredOrigin = googlePayConfig.merchant_info && googlePayConfig.merchant_info.merchantOrigin;
|
|
642
|
+
var hostname = window.location.hostname;
|
|
643
|
+
if (registeredOrigin && registeredOrigin !== hostname) {
|
|
644
|
+
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."));
|
|
512
645
|
}
|
|
513
|
-
|
|
514
|
-
|
|
646
|
+
};
|
|
647
|
+
var buildPaymentDataRequest = function buildPaymentDataRequest(transaction) {
|
|
648
|
+
var googlePayConfig = getGooglePayConfig(transaction);
|
|
649
|
+
var response = transaction.response;
|
|
650
|
+
var authMethods = getSupportedAuthMethods(googlePayConfig);
|
|
651
|
+
return _objectSpread2(_objectSpread2({}, buildBaseRequest(googlePayConfig)), {}, {
|
|
652
|
+
allowedPaymentMethods: [_objectSpread2(_objectSpread2({}, buildCardPaymentMethod(googlePayConfig, authMethods)), {}, {
|
|
653
|
+
tokenizationSpecification: googlePayConfig.tokenization_specification
|
|
654
|
+
})],
|
|
655
|
+
transactionInfo: {
|
|
656
|
+
totalPriceStatus: 'FINAL',
|
|
657
|
+
totalPrice: String(amountSubunitToBase(getChannelAmount(response, CHANNELS.GOOGLE_PAY))),
|
|
658
|
+
currencyCode: response.currency
|
|
659
|
+
},
|
|
660
|
+
merchantInfo: buildMerchantInfo(googlePayConfig),
|
|
661
|
+
emailRequired: true
|
|
662
|
+
});
|
|
663
|
+
};
|
|
664
|
+
var chargeGooglePay = function chargeGooglePay(_ref) {
|
|
665
|
+
var transactionId = _ref.transactionId,
|
|
666
|
+
paymentData = _ref.paymentData;
|
|
667
|
+
var chargeUrl = "".concat(config.paymentBaseUrl).concat(config.googlePayChargePath);
|
|
668
|
+
return fetch(chargeUrl, {
|
|
669
|
+
headers: {
|
|
670
|
+
'content-type': 'application/x-www-form-urlencoded'
|
|
671
|
+
},
|
|
672
|
+
method: 'POST',
|
|
673
|
+
mode: 'cors',
|
|
674
|
+
credentials: 'omit',
|
|
675
|
+
body: createFormBody({
|
|
676
|
+
transaction: transactionId,
|
|
677
|
+
paymentObject: JSON.stringify(paymentData)
|
|
678
|
+
})
|
|
679
|
+
}).then(function (response) {
|
|
680
|
+
return response.json();
|
|
681
|
+
});
|
|
682
|
+
};
|
|
683
|
+
var canUseGooglePay = function canUseGooglePay(transaction) {
|
|
684
|
+
var googlePayConfig = getGooglePayConfig(transaction);
|
|
685
|
+
if (!googlePayConfig) {
|
|
686
|
+
logWarning('Google Pay: no merchant configuration on this transaction. Add your merchant details in Dashboard > Developers > Google Pay.');
|
|
687
|
+
return Promise.resolve(null);
|
|
688
|
+
}
|
|
689
|
+
var authMethods = getSupportedAuthMethods(googlePayConfig);
|
|
690
|
+
if (!authMethods.length || !googlePayConfig.tokenization_specification || !hasGooglePaySDKLoaded()) {
|
|
691
|
+
return Promise.resolve(null);
|
|
692
|
+
}
|
|
693
|
+
warnOnOriginMismatch(googlePayConfig);
|
|
694
|
+
var readiness = Promise.resolve().then(function () {
|
|
695
|
+
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
696
|
+
return client.isReadyToPay(_objectSpread2(_objectSpread2({}, buildBaseRequest(googlePayConfig)), {}, {
|
|
697
|
+
allowedPaymentMethods: [buildCardPaymentMethod(googlePayConfig, authMethods)],
|
|
698
|
+
existingPaymentMethodRequired: true
|
|
699
|
+
}));
|
|
700
|
+
}).then(function (_ref2) {
|
|
701
|
+
var result = _ref2.result;
|
|
702
|
+
return !!result;
|
|
703
|
+
}).catch(function () {
|
|
704
|
+
return null;
|
|
705
|
+
});
|
|
706
|
+
var timeoutId;
|
|
707
|
+
var timeout = new Promise(function (resolve) {
|
|
708
|
+
timeoutId = setTimeout(function () {
|
|
709
|
+
resolve(null);
|
|
710
|
+
}, GOOGLE_PAY_READINESS_TIMEOUT_MS);
|
|
711
|
+
});
|
|
712
|
+
return Promise.race([readiness, timeout]).then(function (isReadyToPay) {
|
|
713
|
+
clearTimeout(timeoutId);
|
|
714
|
+
return isReadyToPay;
|
|
715
|
+
});
|
|
716
|
+
};
|
|
717
|
+
var loadGooglePay = function loadGooglePay(transaction) {
|
|
718
|
+
var response = transaction && transaction.response || {};
|
|
719
|
+
var channels = response.channels || [];
|
|
720
|
+
if (!channels.includes(CHANNELS.GOOGLE_PAY)) {
|
|
721
|
+
return Promise.resolve(null);
|
|
722
|
+
}
|
|
723
|
+
var loadSdk = hasGooglePaySDKLoaded() ? Promise.resolve(true) : loadScript(GOOGLE_PAY_SDK_SOURCE).then(function () {
|
|
724
|
+
return hasGooglePaySDKLoaded();
|
|
725
|
+
});
|
|
726
|
+
return loadSdk.catch(function () {
|
|
727
|
+
return false;
|
|
728
|
+
}).then(function (loaded) {
|
|
729
|
+
if (!loaded) {
|
|
730
|
+
return null;
|
|
731
|
+
}
|
|
732
|
+
return canUseGooglePay(transaction);
|
|
515
733
|
});
|
|
516
734
|
};
|
|
517
|
-
|
|
518
|
-
var APPLE_PAY_SDK_SOURCE = 'https://applepay.cdn-apple.com/jsapi/v1.2.0/apple-pay-sdk.js';
|
|
519
|
-
var APPLE_PAY_SDK_INTEGRITY_HASH = 'sha384-hopRfycfKWs+MFyVuNk99Lb7EEhZdyoatMFJRsBk8bXoxaBXkQ+LCPm98iPgFw3a';
|
|
520
735
|
|
|
521
736
|
function createIframe(id) {
|
|
522
737
|
var iframe = document.createElement('iframe');
|
|
@@ -562,55 +777,6 @@ function mountEmbedCheckoutIframe(id, src) {
|
|
|
562
777
|
function getApplePayButton(container) {
|
|
563
778
|
return container.querySelector('apple-pay-button') || container.querySelector('#apple-pay-button');
|
|
564
779
|
}
|
|
565
|
-
var applePaySdkPromise;
|
|
566
|
-
var loadScript = function loadScript(url, _ref) {
|
|
567
|
-
var container = _ref.container,
|
|
568
|
-
integrity = _ref.integrity;
|
|
569
|
-
return new Promise(function (resolve, reject) {
|
|
570
|
-
if (!url) {
|
|
571
|
-
reject('No script url');
|
|
572
|
-
}
|
|
573
|
-
var script = document.createElement('script');
|
|
574
|
-
script.src = url;
|
|
575
|
-
script.crossOrigin = 'anonymous';
|
|
576
|
-
if (integrity) {
|
|
577
|
-
script.integrity = integrity;
|
|
578
|
-
}
|
|
579
|
-
script.addEventListener('load', function () {
|
|
580
|
-
resolve(true);
|
|
581
|
-
});
|
|
582
|
-
script.addEventListener('error', function () {
|
|
583
|
-
script.remove();
|
|
584
|
-
reject(false);
|
|
585
|
-
});
|
|
586
|
-
if (container) {
|
|
587
|
-
container.appendChild(script);
|
|
588
|
-
} else {
|
|
589
|
-
document.head.appendChild(script);
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
};
|
|
593
|
-
var applePayButtonComponentIsAvailable = function applePayButtonComponentIsAvailable() {
|
|
594
|
-
return !!(window && window.customElements && window.customElements.get('apple-pay-button'));
|
|
595
|
-
};
|
|
596
|
-
var ensureApplePaySdkLoaded = function ensureApplePaySdkLoaded(container) {
|
|
597
|
-
if (applePayButtonComponentIsAvailable()) {
|
|
598
|
-
return Promise.resolve(true);
|
|
599
|
-
}
|
|
600
|
-
if (applePaySdkPromise) {
|
|
601
|
-
return applePaySdkPromise;
|
|
602
|
-
}
|
|
603
|
-
applePaySdkPromise = loadScript(APPLE_PAY_SDK_SOURCE, {
|
|
604
|
-
container: container,
|
|
605
|
-
integrity: APPLE_PAY_SDK_INTEGRITY_HASH
|
|
606
|
-
}).then(function () {
|
|
607
|
-
return true;
|
|
608
|
-
}).catch(function (error) {
|
|
609
|
-
applePaySdkPromise = null;
|
|
610
|
-
throw error;
|
|
611
|
-
});
|
|
612
|
-
return applePaySdkPromise;
|
|
613
|
-
};
|
|
614
780
|
function appendIframeToContainer(containerId, iframe) {
|
|
615
781
|
var container = document.getElementById(containerId);
|
|
616
782
|
container.innerHTML = '';
|
|
@@ -703,94 +869,157 @@ function mountInput(options) {
|
|
|
703
869
|
input.name = name;
|
|
704
870
|
parent.appendChild(input);
|
|
705
871
|
}
|
|
706
|
-
function mountApplePayButton(container,
|
|
707
|
-
var styles =
|
|
708
|
-
theme =
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
style.type = 'text/css';
|
|
712
|
-
if (style.styleSheet) {
|
|
713
|
-
style.styleSheet.cssText = applePayCSS;
|
|
714
|
-
} else {
|
|
715
|
-
style.appendChild(document.createTextNode(applePayCSS));
|
|
716
|
-
}
|
|
717
|
-
container.appendChild(style);
|
|
872
|
+
function mountApplePayButton(container, _ref) {
|
|
873
|
+
var styles = _ref.styles,
|
|
874
|
+
theme = _ref.theme,
|
|
875
|
+
onClick = _ref.onClick;
|
|
876
|
+
appendCSS(container, generateApplePayCSS(styles));
|
|
718
877
|
var button = document.createElement('apple-pay-button');
|
|
719
|
-
button.setAttribute('buttonstyle', theme ===
|
|
878
|
+
button.setAttribute('buttonstyle', theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'white' : 'black');
|
|
720
879
|
button.setAttribute('type', styles.type);
|
|
721
880
|
button.setAttribute('locale', styles.locale);
|
|
881
|
+
if (onClick) {
|
|
882
|
+
button.onclick = onClick;
|
|
883
|
+
}
|
|
722
884
|
container.appendChild(button);
|
|
885
|
+
return button;
|
|
723
886
|
}
|
|
724
|
-
function mountApplePayFallbackButton(container,
|
|
725
|
-
var styles =
|
|
726
|
-
theme =
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
style.type = 'text/css';
|
|
730
|
-
if (style.styleSheet) {
|
|
731
|
-
style.styleSheet.cssText = applePayCSS;
|
|
732
|
-
} else {
|
|
733
|
-
style.appendChild(document.createTextNode(applePayCSS));
|
|
734
|
-
}
|
|
735
|
-
container.appendChild(style);
|
|
887
|
+
function mountApplePayFallbackButton(container, _ref2) {
|
|
888
|
+
var styles = _ref2.styles,
|
|
889
|
+
theme = _ref2.theme,
|
|
890
|
+
onClick = _ref2.onClick;
|
|
891
|
+
appendCSS(container, generateApplePayFallbackCSS(styles));
|
|
736
892
|
var button = document.createElement('button');
|
|
737
|
-
button.classList.add('apple-pay-button', theme ===
|
|
893
|
+
button.classList.add('apple-pay-button', theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'apple-pay-button-white' : 'apple-pay-button-black');
|
|
738
894
|
button.id = 'apple-pay-button';
|
|
739
895
|
var applePayLogo = document.createElement('span');
|
|
740
896
|
applePayLogo.classList.add('logo');
|
|
741
897
|
button.appendChild(applePayLogo);
|
|
898
|
+
if (onClick) {
|
|
899
|
+
button.onclick = onClick;
|
|
900
|
+
}
|
|
742
901
|
container.appendChild(button);
|
|
902
|
+
return button;
|
|
743
903
|
}
|
|
744
904
|
function getPaymentRequestContainer(container) {
|
|
745
905
|
return document.querySelector("#".concat(container));
|
|
746
906
|
}
|
|
907
|
+
function removeAllChildNodes(parent) {
|
|
908
|
+
while (parent.firstChild) {
|
|
909
|
+
parent.removeChild(parent.firstChild);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
function getGooglePayButton(container) {
|
|
913
|
+
return container.querySelector('#google-pay-button-container');
|
|
914
|
+
}
|
|
915
|
+
function toggleGooglePayLoadingState(container, isLoading) {
|
|
916
|
+
if (!container) {
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
var buttonContainer = getGooglePayButton(container);
|
|
920
|
+
var loadingButton = container.querySelector('#google-pay-loading-button');
|
|
921
|
+
if (!buttonContainer || !loadingButton) {
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
buttonContainer.style.display = isLoading ? 'none' : '';
|
|
925
|
+
loadingButton.style.display = isLoading ? 'flex' : 'none';
|
|
926
|
+
}
|
|
927
|
+
function mountGooglePayButton(container, _ref3) {
|
|
928
|
+
var transaction = _ref3.transaction,
|
|
929
|
+
_ref3$styles = _ref3.styles,
|
|
930
|
+
styles = _ref3$styles === void 0 ? {} : _ref3$styles,
|
|
931
|
+
onClick = _ref3.onClick;
|
|
932
|
+
var googlePayStyles = styles.googlePay || {};
|
|
933
|
+
var googlePayConfig = getGooglePayConfig(transaction);
|
|
934
|
+
appendCSS(container, generateGooglePayCSS());
|
|
935
|
+
appendCSS(container, generateGooglePayLoadingCSS({
|
|
936
|
+
borderRadius: googlePayStyles.buttonRadius
|
|
937
|
+
}));
|
|
938
|
+
var buttonContainer = document.createElement('div');
|
|
939
|
+
buttonContainer.id = 'google-pay-button-container';
|
|
940
|
+
container.appendChild(buttonContainer);
|
|
941
|
+
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response));
|
|
942
|
+
var button = client.createButton(_objectSpread2(_objectSpread2({
|
|
943
|
+
buttonColor: styles.theme === PAYMENT_REQUEST_BUTTON_THEME.LIGHT ? 'white' : 'black',
|
|
944
|
+
buttonType: 'pay',
|
|
945
|
+
buttonSizeMode: 'fill',
|
|
946
|
+
buttonRadius: GOOGLE_PAY_BUTTON_RADIUS
|
|
947
|
+
}, googlePayStyles), {}, {
|
|
948
|
+
onClick: onClick,
|
|
949
|
+
allowedPaymentMethods: [buildCardPaymentMethod(googlePayConfig, getSupportedAuthMethods(googlePayConfig))]
|
|
950
|
+
}));
|
|
951
|
+
buttonContainer.appendChild(button);
|
|
952
|
+
var loadingButton = document.createElement('button');
|
|
953
|
+
loadingButton.id = 'google-pay-loading-button';
|
|
954
|
+
loadingButton.type = 'button';
|
|
955
|
+
loadingButton.disabled = true;
|
|
956
|
+
loadingButton.setAttribute('aria-busy', 'true');
|
|
957
|
+
loadingButton.style.display = 'none';
|
|
958
|
+
var spinner = document.createElement('span');
|
|
959
|
+
spinner.id = 'google-pay-loading-button__spinner';
|
|
960
|
+
loadingButton.appendChild(spinner);
|
|
961
|
+
container.appendChild(loadingButton);
|
|
962
|
+
return buttonContainer;
|
|
963
|
+
}
|
|
964
|
+
function getMountedPaymentRequestButtons(container) {
|
|
965
|
+
if (!container) {
|
|
966
|
+
return [];
|
|
967
|
+
}
|
|
968
|
+
return [getApplePayButton(container), getGooglePayButton(container)].filter(Boolean);
|
|
969
|
+
}
|
|
747
970
|
function mountPaymentRequestButtons(container, _ref4) {
|
|
748
|
-
var
|
|
749
|
-
channels = _ref4$channels === void 0 ? [] : _ref4$channels,
|
|
971
|
+
var transaction = _ref4.transaction,
|
|
750
972
|
_ref4$styles = _ref4.styles,
|
|
751
|
-
styles = _ref4$styles === void 0 ? {} : _ref4$styles
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
};
|
|
973
|
+
styles = _ref4$styles === void 0 ? {} : _ref4$styles,
|
|
974
|
+
onClickApplePayButton = _ref4.onClickApplePayButton,
|
|
975
|
+
onClickGooglePayButton = _ref4.onClickGooglePayButton;
|
|
755
976
|
if (!container) {
|
|
756
|
-
return Promise.reject(
|
|
977
|
+
return Promise.reject('Container to mount elements was not provided');
|
|
757
978
|
}
|
|
758
|
-
|
|
759
|
-
|
|
979
|
+
removeAllChildNodes(container);
|
|
980
|
+
appendCSS(container, generatePaymentRequestInnerWrapperCSS(styles.orientation));
|
|
981
|
+
var innerWrapper = document.createElement('div');
|
|
982
|
+
innerWrapper.id = 'paystack-payment-request-inner-wrapper';
|
|
983
|
+
container.appendChild(innerWrapper);
|
|
984
|
+
var applePayOptions = {
|
|
985
|
+
styles: parseApplePayCustomStyles(styles.applePay),
|
|
986
|
+
theme: styles.theme,
|
|
987
|
+
onClick: onClickApplePayButton
|
|
988
|
+
};
|
|
989
|
+
var channels = transaction.response && transaction.response.channels || [];
|
|
990
|
+
var applePayButton = Promise.resolve(null);
|
|
991
|
+
if (canUseApplePay(channels)) {
|
|
992
|
+
applePayButton = loadApplePay(transaction).then(function () {
|
|
993
|
+
return mountApplePayButton(innerWrapper, applePayOptions);
|
|
994
|
+
}).catch(function () {
|
|
995
|
+
return mountApplePayFallbackButton(innerWrapper, applePayOptions);
|
|
996
|
+
}).catch(function () {
|
|
997
|
+
return null;
|
|
998
|
+
});
|
|
999
|
+
} else if (channels.includes(CHANNELS.APPLE_PAY)) {
|
|
1000
|
+
logWarning('Apple Pay: this device or browser cannot pay with Apple Pay. It requires Safari on an Apple device, over HTTPS.');
|
|
760
1001
|
}
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
}).then(function () {
|
|
765
|
-
return canUseApplePay(channels);
|
|
766
|
-
}).then(function (applePayAvailable) {
|
|
767
|
-
if (!applePayAvailable) {
|
|
768
|
-
throw new Error('No wallet payment method is available on this device');
|
|
769
|
-
}
|
|
770
|
-
if (getApplePayButton(container)) {
|
|
771
|
-
mountedElements.applePay = true;
|
|
772
|
-
return mountedElements;
|
|
773
|
-
}
|
|
774
|
-
try {
|
|
775
|
-
mountApplePayButton(container, {
|
|
776
|
-
styles: parseApplePayCustomStyles(styles.applePay),
|
|
777
|
-
theme: styles.theme
|
|
778
|
-
});
|
|
779
|
-
} catch (error) {
|
|
780
|
-
// If the web component is unavailable, fall back to the CSS-based Apple Pay button.
|
|
781
|
-
mountApplePayFallbackButton(container, {
|
|
782
|
-
styles: parseApplePayCustomStyles(styles.applePay),
|
|
783
|
-
theme: styles.theme
|
|
784
|
-
});
|
|
1002
|
+
var googlePayButton = loadGooglePay(transaction).then(function (isReadyToPay) {
|
|
1003
|
+
if (!isReadyToPay) {
|
|
1004
|
+
return null;
|
|
785
1005
|
}
|
|
786
|
-
|
|
787
|
-
|
|
1006
|
+
return mountGooglePayButton(innerWrapper, {
|
|
1007
|
+
transaction: transaction,
|
|
1008
|
+
styles: styles,
|
|
1009
|
+
onClick: onClickGooglePayButton
|
|
1010
|
+
});
|
|
1011
|
+
}).catch(function () {
|
|
1012
|
+
return null;
|
|
1013
|
+
});
|
|
1014
|
+
return Promise.all([applePayButton, googlePayButton]).then(function (_ref5) {
|
|
1015
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
1016
|
+
applePay = _ref6[0],
|
|
1017
|
+
googlePay = _ref6[1];
|
|
1018
|
+
return {
|
|
1019
|
+
applePay: !!applePay,
|
|
1020
|
+
googlePay: !!googlePay
|
|
1021
|
+
};
|
|
788
1022
|
});
|
|
789
|
-
}
|
|
790
|
-
function removeAllChildNodes(parent) {
|
|
791
|
-
while (parent.firstChild) {
|
|
792
|
-
parent.removeChild(parent.firstChild);
|
|
793
|
-
}
|
|
794
1023
|
}
|
|
795
1024
|
|
|
796
1025
|
var allParameters = [{
|
|
@@ -1261,9 +1490,9 @@ var AnalyticsFunctions = {
|
|
|
1261
1490
|
},
|
|
1262
1491
|
logAPIResponse: function logAPIResponse(response, channel) {
|
|
1263
1492
|
switch (response.status) {
|
|
1264
|
-
case
|
|
1493
|
+
case TRANSACTION_STATUS.SUCCESS:
|
|
1265
1494
|
return this.logApiSuccess(channel);
|
|
1266
|
-
case
|
|
1495
|
+
case TRANSACTION_STATUS.FAILED:
|
|
1267
1496
|
return this.logApiError(response.message);
|
|
1268
1497
|
default:
|
|
1269
1498
|
return false;
|
|
@@ -1499,12 +1728,6 @@ var InlineTransaction = /*#__PURE__*/function () {
|
|
|
1499
1728
|
}]);
|
|
1500
1729
|
}();
|
|
1501
1730
|
|
|
1502
|
-
// eslint-disable-next-line no-console
|
|
1503
|
-
var logWarning = console ? console.warn || console.log : function () {};
|
|
1504
|
-
function printDeprecationNotice(oldName, newName, extraMessage) {
|
|
1505
|
-
logWarning("\"".concat(oldName, "\" has been deprecated, please use \"").concat(newName, "\". ").concat(extraMessage || ''));
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
1731
|
var _excluded = ["preload", "inlineTransaction", "transactionData"],
|
|
1509
1732
|
_excluded2 = ["container", "styles", "onElementsMount"];
|
|
1510
1733
|
var inlineInstance;
|
|
@@ -1548,6 +1771,7 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1548
1771
|
this.transactions = [];
|
|
1549
1772
|
this.isOpen = false;
|
|
1550
1773
|
this.isLoaded = false;
|
|
1774
|
+
this.isCharging = false;
|
|
1551
1775
|
this.isDeprecatedApi = params && params.isDeprecatedApi; // track deprecatedApi
|
|
1552
1776
|
if (params && params.isEmbed) {
|
|
1553
1777
|
this.isEmbed = true;
|
|
@@ -1618,12 +1842,14 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1618
1842
|
inlineTransaction = _ref.inlineTransaction,
|
|
1619
1843
|
transactionData = _ref.transactionData,
|
|
1620
1844
|
options = _objectWithoutProperties(_ref, _excluded);
|
|
1621
|
-
var hasPaymentRequestButtons = this.
|
|
1845
|
+
var hasPaymentRequestButtons = this.hasMountedPaymentRequestButtons();
|
|
1622
1846
|
if (this.activeTransaction() && !hasPaymentRequestButtons) {
|
|
1623
1847
|
this.activeTransaction().cancel();
|
|
1624
1848
|
}
|
|
1625
1849
|
if (inlineTransaction && transactionData) {
|
|
1626
|
-
this.transactions.
|
|
1850
|
+
if (!this.transactions.includes(inlineTransaction)) {
|
|
1851
|
+
this.transactions.push(inlineTransaction);
|
|
1852
|
+
}
|
|
1627
1853
|
if (!this.isDeprecatedApi) {
|
|
1628
1854
|
// TODO: reintroduce this when we resolve checkout caching issues
|
|
1629
1855
|
// this.open({ transactionData }, preload);
|
|
@@ -1689,10 +1915,21 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1689
1915
|
var resumableTransaction = findResumableTransaction(inlineInstance.transactions, transactionParams);
|
|
1690
1916
|
var transaction = resumableTransaction || new InlineTransaction(transactionParams);
|
|
1691
1917
|
transaction.requestInline().then(function (response) {
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1918
|
+
if (resumableTransaction) {
|
|
1919
|
+
transaction.isActive = true;
|
|
1920
|
+
} else {
|
|
1921
|
+
inlineInstance.transactions.push(transaction);
|
|
1922
|
+
}
|
|
1923
|
+
return mountPaymentRequestButtons(inlineInstance.paymentRequestContainer, {
|
|
1924
|
+
transaction: transaction,
|
|
1925
|
+
styles: styles,
|
|
1926
|
+
onClickApplePayButton: function onClickApplePayButton() {
|
|
1927
|
+
return inlineInstance.startApplePay();
|
|
1928
|
+
},
|
|
1929
|
+
onClickGooglePayButton: function onClickGooglePayButton() {
|
|
1930
|
+
return inlineInstance.startGooglePay();
|
|
1931
|
+
}
|
|
1932
|
+
}).then(function (mountedElements) {
|
|
1696
1933
|
if (onElementsMount) {
|
|
1697
1934
|
onElementsMount(mountedElements);
|
|
1698
1935
|
}
|
|
@@ -1701,18 +1938,14 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1701
1938
|
onElementsMount(null);
|
|
1702
1939
|
}
|
|
1703
1940
|
}).finally(function () {
|
|
1704
|
-
if (resumableTransaction) {
|
|
1705
|
-
transaction.isActive = true;
|
|
1706
|
-
} else {
|
|
1707
|
-
inlineInstance.transactions.push(transaction);
|
|
1708
|
-
}
|
|
1709
|
-
inlineInstance.registerPaymentRequestEventListeners();
|
|
1710
1941
|
if (loadPaystackCheckoutButton) {
|
|
1711
1942
|
var loadPopup = inlineInstance.preloadTransaction({
|
|
1712
1943
|
inlineTransaction: transaction,
|
|
1713
1944
|
transactionData: response
|
|
1714
1945
|
});
|
|
1715
1946
|
loadPaystackCheckoutButton.onclick = loadPopup;
|
|
1947
|
+
} else if (!inlineInstance.hasMountedPaymentRequestButtons()) {
|
|
1948
|
+
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'");
|
|
1716
1949
|
}
|
|
1717
1950
|
resolve(transaction);
|
|
1718
1951
|
});
|
|
@@ -1726,26 +1959,83 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1726
1959
|
});
|
|
1727
1960
|
}
|
|
1728
1961
|
}, {
|
|
1729
|
-
key: "
|
|
1730
|
-
value: function
|
|
1731
|
-
|
|
1732
|
-
var applePayButton = getApplePayButton(this.paymentRequestContainer);
|
|
1733
|
-
if (applePayButton) {
|
|
1734
|
-
applePayButton.onclick = function () {
|
|
1735
|
-
return _this3.startApplePay();
|
|
1736
|
-
};
|
|
1737
|
-
}
|
|
1962
|
+
key: "hasMountedPaymentRequestButtons",
|
|
1963
|
+
value: function hasMountedPaymentRequestButtons() {
|
|
1964
|
+
return getMountedPaymentRequestButtons(this.paymentRequestContainer).length > 0;
|
|
1738
1965
|
}
|
|
1739
1966
|
}, {
|
|
1740
|
-
key: "
|
|
1741
|
-
value: function
|
|
1967
|
+
key: "startGooglePay",
|
|
1968
|
+
value: function startGooglePay() {
|
|
1969
|
+
var _this3 = this;
|
|
1970
|
+
var paymentMethod = 'google pay';
|
|
1742
1971
|
var transaction = this.activeTransaction();
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1972
|
+
if (!transaction) {
|
|
1973
|
+
handleError('Could not initiate google pay transaction');
|
|
1974
|
+
return;
|
|
1975
|
+
}
|
|
1976
|
+
if (this.isCharging) {
|
|
1977
|
+
return;
|
|
1748
1978
|
}
|
|
1979
|
+
this.isCharging = true;
|
|
1980
|
+
var analyticsPayload = {
|
|
1981
|
+
channel: CHANNELS.GOOGLE_PAY,
|
|
1982
|
+
currency: transaction.response.currency,
|
|
1983
|
+
amount: getChannelAmount(transaction.response, CHANNELS.GOOGLE_PAY)
|
|
1984
|
+
};
|
|
1985
|
+
transaction.logAttempt(paymentMethod);
|
|
1986
|
+
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
1987
|
+
paymentMethod: paymentMethod
|
|
1988
|
+
}));
|
|
1989
|
+
var client = getGooglePayClient(resolveGooglePayEnvironment(transaction.response.domain === TRANSACTION_DOMAIN.TEST));
|
|
1990
|
+
client.loadPaymentData(buildPaymentDataRequest(transaction)).then(function (paymentData) {
|
|
1991
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, true);
|
|
1992
|
+
return chargeGooglePay({
|
|
1993
|
+
transactionId: transaction.id,
|
|
1994
|
+
paymentData: paymentData
|
|
1995
|
+
});
|
|
1996
|
+
}).then(function (response) {
|
|
1997
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
1998
|
+
_this3.isCharging = false;
|
|
1999
|
+
transaction.logAPIResponse(response, paymentMethod);
|
|
2000
|
+
if (response.status === TRANSACTION_STATUS.SUCCESS) {
|
|
2001
|
+
transaction.onSuccess(response);
|
|
2002
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2003
|
+
timeSpent: transaction.getTimeSpent()
|
|
2004
|
+
}));
|
|
2005
|
+
return;
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
// `auth` means a step-up we cannot render here, so say so rather
|
|
2009
|
+
// than leaving the customer holding a token with nowhere to go.
|
|
2010
|
+
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';
|
|
2011
|
+
transaction.onSetupError(_objectSpread2(_objectSpread2({}, response), {}, {
|
|
2012
|
+
message: message
|
|
2013
|
+
}));
|
|
2014
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2015
|
+
channel: CHANNELS.GOOGLE_PAY,
|
|
2016
|
+
message: message
|
|
2017
|
+
});
|
|
2018
|
+
}).catch(function (error) {
|
|
2019
|
+
toggleGooglePayLoadingState(_this3.paymentRequestContainer, false);
|
|
2020
|
+
_this3.isCharging = false;
|
|
2021
|
+
if (error && error.statusCode === GOOGLE_PAY_STATUS_CODE.CANCELED) {
|
|
2022
|
+
transaction.onCancel();
|
|
2023
|
+
return;
|
|
2024
|
+
}
|
|
2025
|
+
var statusCode = error && error.statusCode;
|
|
2026
|
+
if (statusCode === GOOGLE_PAY_STATUS_CODE.DEVELOPER_ERROR || statusCode === GOOGLE_PAY_STATUS_CODE.MERCHANT_ACCOUNT_ERROR) {
|
|
2027
|
+
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."));
|
|
2028
|
+
}
|
|
2029
|
+
var message = error && (error.statusMessage || error.message) || 'Could not complete the Google Pay payment';
|
|
2030
|
+
transaction.onSetupError({
|
|
2031
|
+
status: false,
|
|
2032
|
+
message: message
|
|
2033
|
+
});
|
|
2034
|
+
_this3.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
2035
|
+
channel: CHANNELS.GOOGLE_PAY,
|
|
2036
|
+
message: message
|
|
2037
|
+
});
|
|
2038
|
+
});
|
|
1749
2039
|
}
|
|
1750
2040
|
}, {
|
|
1751
2041
|
key: "startApplePay",
|
|
@@ -1754,24 +2044,23 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1754
2044
|
var paymentMethod = 'apple pay';
|
|
1755
2045
|
var transaction = this.activeTransaction();
|
|
1756
2046
|
if (transaction) {
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
currency: transaction.currency,
|
|
1766
|
-
amount: transaction.amount,
|
|
1767
|
-
timeSpent: transaction.getTimeSpent()
|
|
2047
|
+
if (this.isCharging) {
|
|
2048
|
+
return;
|
|
2049
|
+
}
|
|
2050
|
+
this.isCharging = true;
|
|
2051
|
+
var analyticsPayload = {
|
|
2052
|
+
channel: CHANNELS.APPLE_PAY,
|
|
2053
|
+
currency: transaction.response.currency,
|
|
2054
|
+
amount: getChannelAmount(transaction.response, CHANNELS.APPLE_PAY)
|
|
1768
2055
|
};
|
|
1769
2056
|
try {
|
|
1770
2057
|
transaction.logAttempt(paymentMethod);
|
|
1771
|
-
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT,
|
|
2058
|
+
this.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ATTEMPT, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2059
|
+
paymentMethod: paymentMethod
|
|
2060
|
+
}));
|
|
1772
2061
|
var applePayPaymentRequest = generateApplePaymentRequestObject({
|
|
1773
2062
|
currency: transaction.response.currency,
|
|
1774
|
-
amount: transaction.response.
|
|
2063
|
+
amount: getChannelAmount(transaction.response, CHANNELS.APPLE_PAY),
|
|
1775
2064
|
merchantName: transaction.response.merchant_name,
|
|
1776
2065
|
interval: transaction.response.plan_details && transaction.response.plan_details.interval
|
|
1777
2066
|
});
|
|
@@ -1784,7 +2073,8 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1784
2073
|
merchantName: transaction.response.merchant_name
|
|
1785
2074
|
});
|
|
1786
2075
|
validateSession.then(function (response) {
|
|
1787
|
-
if (response.status !==
|
|
2076
|
+
if (response.status !== TRANSACTION_STATUS.SUCCESS) {
|
|
2077
|
+
_this4.isCharging = false;
|
|
1788
2078
|
transaction.onSetupError(response);
|
|
1789
2079
|
} else {
|
|
1790
2080
|
applePaySession.completeMerchantValidation(response.data);
|
|
@@ -1795,6 +2085,7 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1795
2085
|
});
|
|
1796
2086
|
};
|
|
1797
2087
|
applePaySession.oncancel = function () {
|
|
2088
|
+
_this4.isCharging = false;
|
|
1798
2089
|
transaction.onCancel();
|
|
1799
2090
|
};
|
|
1800
2091
|
applePaySession.onpaymentauthorized = function (_ref3) {
|
|
@@ -1805,29 +2096,34 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1805
2096
|
});
|
|
1806
2097
|
charge.then(function (response) {
|
|
1807
2098
|
transaction.logAPIResponse(response, paymentMethod);
|
|
1808
|
-
|
|
2099
|
+
_this4.isCharging = false;
|
|
2100
|
+
if (response.status === TRANSACTION_STATUS.SUCCESS) {
|
|
1809
2101
|
applePaySession.completePayment(applePaySession.STATUS_SUCCESS);
|
|
1810
2102
|
transaction.onSuccess(response);
|
|
1811
|
-
_this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION,
|
|
2103
|
+
_this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_COMPLETION, _objectSpread2(_objectSpread2({}, analyticsPayload), {}, {
|
|
2104
|
+
timeSpent: transaction.getTimeSpent()
|
|
2105
|
+
}));
|
|
1812
2106
|
} else {
|
|
1813
2107
|
applePaySession.completePayment(applePaySession.STATUS_FAILURE);
|
|
1814
2108
|
transaction.onSetupError(response);
|
|
1815
2109
|
_this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
1816
|
-
channel:
|
|
2110
|
+
channel: CHANNELS.APPLE_PAY,
|
|
1817
2111
|
message: response && response.message || 'Transaction attempt failed'
|
|
1818
2112
|
});
|
|
1819
2113
|
}
|
|
1820
2114
|
}).catch(function (error) {
|
|
2115
|
+
_this4.isCharging = false;
|
|
1821
2116
|
applePaySession.completePayment(applePaySession.STATUS_FAILURE);
|
|
1822
2117
|
transaction.onSetupError(error);
|
|
1823
2118
|
_this4.sendAnalyticsEventToCheckout(analyticsActions.TRACK_PAYMENT_ERROR, {
|
|
1824
|
-
channel:
|
|
2119
|
+
channel: CHANNELS.APPLE_PAY,
|
|
1825
2120
|
message: error && error.message || 'Error occurred'
|
|
1826
2121
|
});
|
|
1827
2122
|
});
|
|
1828
2123
|
};
|
|
1829
2124
|
applePaySession.begin();
|
|
1830
2125
|
} catch (error) {
|
|
2126
|
+
this.isCharging = false;
|
|
1831
2127
|
transaction.onSetupError(error);
|
|
1832
2128
|
}
|
|
1833
2129
|
} else {
|
|
@@ -1926,7 +2222,7 @@ var Inline = /*#__PURE__*/function () {
|
|
|
1926
2222
|
if (status) {
|
|
1927
2223
|
activeTransaction.setStatus(status);
|
|
1928
2224
|
}
|
|
1929
|
-
var hasPaymentRequestButtons = this.
|
|
2225
|
+
var hasPaymentRequestButtons = this.hasMountedPaymentRequestButtons();
|
|
1930
2226
|
if (!hasPaymentRequestButtons) {
|
|
1931
2227
|
activeTransaction.isActive = false;
|
|
1932
2228
|
}
|