Changeset 3375717
- Timestamp:
- 10/09/2025 12:52:12 PM (2 months ago)
- Location:
- finix-for-woocommerce
- Files:
-
- 117 added
- 5 deleted
- 43 edited
-
assets/screenshot-1.png (modified) (previous)
-
assets/screenshot-2.png (modified) (previous)
-
assets/screenshot-3.png (modified) (previous)
-
assets/screenshot-4.png (modified) (previous)
-
assets/screenshot-5.png (modified) (previous)
-
assets/screenshot-6.png (added)
-
tags/1.3.0 (added)
-
tags/1.3.0/assets (added)
-
tags/1.3.0/assets/css (added)
-
tags/1.3.0/assets/css/block-checkout.css (added)
-
tags/1.3.0/assets/css/block-checkout.min.css (added)
-
tags/1.3.0/assets/css/finix-admin.css (added)
-
tags/1.3.0/assets/css/finix-admin.min.css (added)
-
tags/1.3.0/assets/css/shortcode-checkout.css (added)
-
tags/1.3.0/assets/css/shortcode-checkout.min.css (added)
-
tags/1.3.0/assets/images (added)
-
tags/1.3.0/assets/images/all-methods.svg (added)
-
tags/1.3.0/assets/images/apple-pay.svg (added)
-
tags/1.3.0/assets/images/bank.svg (added)
-
tags/1.3.0/assets/images/cards.svg (added)
-
tags/1.3.0/assets/images/finix-logo.svg (added)
-
tags/1.3.0/assets/images/finix-squared.svg (added)
-
tags/1.3.0/assets/images/google-pay.svg (added)
-
tags/1.3.0/assets/js (added)
-
tags/1.3.0/assets/js/admin-apple-pay.js (added)
-
tags/1.3.0/assets/js/admin-apple-pay.min.js (added)
-
tags/1.3.0/assets/js/block (added)
-
tags/1.3.0/assets/js/block/build (added)
-
tags/1.3.0/assets/js/block/build/apple-pay.asset.php (added)
-
tags/1.3.0/assets/js/block/build/apple-pay.js (added)
-
tags/1.3.0/assets/js/block/build/bank.asset.php (added)
-
tags/1.3.0/assets/js/block/build/bank.js (added)
-
tags/1.3.0/assets/js/block/build/card.asset.php (added)
-
tags/1.3.0/assets/js/block/build/card.js (added)
-
tags/1.3.0/assets/js/block/build/google-pay.asset.php (added)
-
tags/1.3.0/assets/js/block/build/google-pay.js (added)
-
tags/1.3.0/assets/js/finix-google-pay.js (added)
-
tags/1.3.0/assets/js/finix-google-pay.min.js (added)
-
tags/1.3.0/assets/js/finix-helpers.js (added)
-
tags/1.3.0/assets/js/finix-helpers.min.js (added)
-
tags/1.3.0/assets/js/shortcode-apple-pay.js (added)
-
tags/1.3.0/assets/js/shortcode-apple-pay.min.js (added)
-
tags/1.3.0/assets/js/shortcode-card-bank.js (added)
-
tags/1.3.0/assets/js/shortcode-card-bank.min.js (added)
-
tags/1.3.0/assets/js/shortcode-google-pay.js (added)
-
tags/1.3.0/assets/js/shortcode-google-pay.min.js (added)
-
tags/1.3.0/assets/languages (added)
-
tags/1.3.0/assets/languages/finix-for-woocommerce.pot (added)
-
tags/1.3.0/finix-for-woocommerce.php (added)
-
tags/1.3.0/readme.txt (added)
-
tags/1.3.0/src (added)
-
tags/1.3.0/src/Admin (added)
-
tags/1.3.0/src/Admin/Admin.php (added)
-
tags/1.3.0/src/Events (added)
-
tags/1.3.0/src/Events/AchPaymentProcessedEvent.php (added)
-
tags/1.3.0/src/Events/AchReturnEvent.php (added)
-
tags/1.3.0/src/Events/ApplePayPaymentCompletedEvent.php (added)
-
tags/1.3.0/src/Events/ApplePayPaymentEvent.php (added)
-
tags/1.3.0/src/Events/ApplePayRegisterDomain.php (added)
-
tags/1.3.0/src/Events/ApplePaySessionEvent.php (added)
-
tags/1.3.0/src/Events/CardAchPaymentEvent.php (added)
-
tags/1.3.0/src/Events/DisputeEvent.php (added)
-
tags/1.3.0/src/Events/Event.php (added)
-
tags/1.3.0/src/Events/GooglePayPaymentCompletedEvent.php (added)
-
tags/1.3.0/src/Events/GooglePayPaymentEvent.php (added)
-
tags/1.3.0/src/Events/RefundEvent.php (added)
-
tags/1.3.0/src/Finix (added)
-
tags/1.3.0/src/Finix/API.php (added)
-
tags/1.3.0/src/Finix/ApplePay.php (added)
-
tags/1.3.0/src/Finix/BuyerIdentity.php (added)
-
tags/1.3.0/src/Finix/Endpoint.php (added)
-
tags/1.3.0/src/Finix/InstrumentToken.php (added)
-
tags/1.3.0/src/Finix/Tags.php (added)
-
tags/1.3.0/src/Finix/Transfer.php (added)
-
tags/1.3.0/src/Gateways (added)
-
tags/1.3.0/src/Gateways/ApplePayGateway.php (added)
-
tags/1.3.0/src/Gateways/BankGateway.php (added)
-
tags/1.3.0/src/Gateways/CardBankGateway.php (added)
-
tags/1.3.0/src/Gateways/CardGateway.php (added)
-
tags/1.3.0/src/Gateways/FinixGateway.php (added)
-
tags/1.3.0/src/Gateways/GooglePayGateway.php (added)
-
tags/1.3.0/src/Gateways/PaymentMethods (added)
-
tags/1.3.0/src/Gateways/PaymentMethods/ApplePay.php (added)
-
tags/1.3.0/src/Gateways/PaymentMethods/BankMethod.php (added)
-
tags/1.3.0/src/Gateways/PaymentMethods/CardBankMethod.php (added)
-
tags/1.3.0/src/Gateways/PaymentMethods/CardMethod.php (added)
-
tags/1.3.0/src/Gateways/PaymentMethods/FinixMethod.php (added)
-
tags/1.3.0/src/Gateways/PaymentMethods/GooglePay.php (added)
-
tags/1.3.0/src/Helpers (added)
-
tags/1.3.0/src/Helpers/Assets.php (added)
-
tags/1.3.0/src/Helpers/CartData.php (added)
-
tags/1.3.0/src/Helpers/Check.php (added)
-
tags/1.3.0/src/Helpers/Convert.php (added)
-
tags/1.3.0/src/Helpers/URL.php (added)
-
tags/1.3.0/src/Options.php (added)
-
tags/1.3.0/src/Payments.php (added)
-
tags/1.3.0/src/Plugin.php (added)
-
tags/1.3.0/uninstall.php (added)
-
tags/1.3.0/vendor (added)
-
tags/1.3.0/vendor/autoload.php (added)
-
tags/1.3.0/vendor/composer (added)
-
tags/1.3.0/vendor/composer/ClassLoader.php (added)
-
tags/1.3.0/vendor/composer/InstalledVersions.php (added)
-
tags/1.3.0/vendor/composer/LICENSE (added)
-
tags/1.3.0/vendor/composer/autoload_classmap.php (added)
-
tags/1.3.0/vendor/composer/autoload_namespaces.php (added)
-
tags/1.3.0/vendor/composer/autoload_psr4.php (added)
-
tags/1.3.0/vendor/composer/autoload_real.php (added)
-
tags/1.3.0/vendor/composer/autoload_static.php (added)
-
tags/1.3.0/vendor/composer/installed.json (added)
-
tags/1.3.0/vendor/composer/installed.php (added)
-
trunk/assets/css/block-checkout.css (modified) (1 diff)
-
trunk/assets/css/block-checkout.min.css (modified) (1 diff)
-
trunk/assets/css/finix-admin.css (modified) (1 diff)
-
trunk/assets/css/finix-admin.min.css (modified) (1 diff)
-
trunk/assets/css/shortcode-checkout.css (modified) (1 diff)
-
trunk/assets/css/shortcode-checkout.min.css (modified) (1 diff)
-
trunk/assets/js/block/build/apple-pay.asset.php (modified) (1 diff)
-
trunk/assets/js/block/build/apple-pay.js (modified) (1 diff)
-
trunk/assets/js/block/build/bank.asset.php (added)
-
trunk/assets/js/block/build/bank.js (added)
-
trunk/assets/js/block/build/card-bank.asset.php (deleted)
-
trunk/assets/js/block/build/card-bank.js (deleted)
-
trunk/assets/js/block/build/card.asset.php (added)
-
trunk/assets/js/block/build/card.js (added)
-
trunk/assets/js/block/build/google-pay.asset.php (modified) (1 diff)
-
trunk/assets/js/block/build/google-pay.js (modified) (1 diff)
-
trunk/assets/js/block/src (deleted)
-
trunk/assets/js/finix-helpers.js (modified) (2 diffs)
-
trunk/assets/js/finix-helpers.min.js (modified) (1 diff)
-
trunk/assets/js/shortcode-apple-pay.js (modified) (4 diffs)
-
trunk/assets/js/shortcode-apple-pay.min.js (modified) (1 diff)
-
trunk/assets/js/shortcode-card-bank.js (modified) (9 diffs)
-
trunk/assets/js/shortcode-card-bank.min.js (modified) (1 diff)
-
trunk/assets/languages/finix-for-woocommerce.pot (modified) (16 diffs)
-
trunk/composer.json (deleted)
-
trunk/finix-for-woocommerce.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/src/Admin/Admin.php (modified) (3 diffs)
-
trunk/src/Events/ApplePayPaymentCompletedEvent.php (modified) (1 diff)
-
trunk/src/Events/CardAchPaymentEvent.php (modified) (4 diffs)
-
trunk/src/Events/GooglePayPaymentCompletedEvent.php (modified) (1 diff)
-
trunk/src/Finix/API.php (modified) (3 diffs)
-
trunk/src/Finix/BuyerIdentity.php (modified) (5 diffs)
-
trunk/src/Finix/InstrumentToken.php (modified) (3 diffs)
-
trunk/src/Finix/Tags.php (added)
-
trunk/src/Finix/Transfer.php (modified) (2 diffs)
-
trunk/src/Gateways/ApplePayGateway.php (modified) (7 diffs)
-
trunk/src/Gateways/BankGateway.php (added)
-
trunk/src/Gateways/CardBankGateway.php (modified) (10 diffs)
-
trunk/src/Gateways/CardGateway.php (added)
-
trunk/src/Gateways/FinixGateway.php (modified) (6 diffs)
-
trunk/src/Gateways/GooglePayGateway.php (modified) (2 diffs)
-
trunk/src/Gateways/PaymentMethods/ApplePay.php (modified) (6 diffs)
-
trunk/src/Gateways/PaymentMethods/BankMethod.php (added)
-
trunk/src/Gateways/PaymentMethods/CardBank.php (deleted)
-
trunk/src/Gateways/PaymentMethods/CardBankMethod.php (added)
-
trunk/src/Gateways/PaymentMethods/CardMethod.php (added)
-
trunk/src/Gateways/PaymentMethods/FinixMethod.php (modified) (3 diffs)
-
trunk/src/Helpers/CartData.php (added)
-
trunk/src/Payments.php (modified) (4 diffs)
-
trunk/src/Plugin.php (modified) (3 diffs)
-
trunk/vendor/composer/autoload_classmap.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_static.php (modified) (1 diff)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
finix-for-woocommerce/trunk/assets/css/block-checkout.css
r3316914 r3375717 1 .finix-wc-form { 2 background: transparent; 3 } 4 .finix-wc-form > div { 5 min-width: 250px; 6 width: 90%; 7 max-width: 714px; 8 } 9 10 #radio-control-wc-payment-method-options-finix_gateway__label img, 11 #radio-control-wc-payment-method-options-finix_bank_gateway__label img { 12 position: absolute; 13 right: 20px; 14 height: 30px; 15 width: auto; 16 } 17 1 18 #radio-control-wc-payment-method-options-finix_google_pay_gateway__label img { 2 19 position: absolute; -
finix-for-woocommerce/trunk/assets/css/block-checkout.min.css
r3316914 r3375717 1 #radio-control-wc-payment-method-options-finix_google_pay_gateway__label img{position:absolute;right:20px;height:60px;width:auto;float:right}1 .finix-wc-form{background:rgba(0,0,0,0)}.finix-wc-form>div{min-width:250px;width:90%;max-width:714px}#radio-control-wc-payment-method-options-finix_gateway__label img,#radio-control-wc-payment-method-options-finix_bank_gateway__label img{position:absolute;right:20px;height:30px;width:auto}#radio-control-wc-payment-method-options-finix_google_pay_gateway__label img{position:absolute;right:20px;height:60px;width:auto;float:right} -
finix-for-woocommerce/trunk/assets/css/finix-admin.css
r3278388 r3375717 161 161 162 162 .settings-content .form-table #woocommerce_finix_gateway_description, 163 .settings-content .form-table #woocommerce_finix_bank_gateway_description, 163 164 .settings-content .form-table #woocommerce_finix_apple_pay_gateway_description { 164 165 max-width: 25rem; -
finix-for-woocommerce/trunk/assets/css/finix-admin.min.css
r3278388 r3375717 1 .header-container{display:flex;justify-content:center;align-items:center;border-bottom:1px solid #d7dde4}.header-content{width:70%;text-align:center;padding:20px;background:rgba(0,0,0,0);margin-bottom:1em}.header-content h2,.header-content h3,.header-content p{color:#0d121a}.header-content .logo{display:block;text-align:center;line-height:initial;font-size:0;max-height:61px;cursor:pointer}.header-content .logo img{display:inline-block;pointer-events:none}.finix-nav-container{display:flex;justify-content:center;align-items:center;margin-top:20px}.finix-nav-content{width:60%;text-align:center}.links-container{display:flex;justify-content:center;align-items:center;margin-top:20px}.links-content{width:60%;text-align:center}.links-content h2{color:#0d121a;font-size:2.5em;font-weight:bolder}.links-content p{text-align:left}.features-container{display:flex;justify-content:center;align-items:center;margin-top:20px}.features-container .register-domain-button{text-align:left}.features-container .register-domain-message{padding:10px}.features-content{width:60%}.features-lists{display:flex;flex-direction:row;justify-content:left;gap:20px}.features-lists>ul{list-style-type:none;padding:0;margin:0}.features-lists>ul>li{background-color:#f0f0f0;margin-bottom:5px;border-radius:5px;position:relative;padding:5px 10px 5px 20px}.features-lists>ul>li::before{content:"✓";color:green;position:absolute;left:0;top:50%;transform:translateY(-50%)}.webhook-container{display:flex;justify-content:center;align-items:center;margin-top:20px}.webhook-content{width:60%}.webhook-content table{width:100%;border-collapse:collapse;margin-top:20px}.webhook-content table td{padding-top:5px;padding-bottom:5px}.settings-container{display:flex;justify-content:center;align-items:center;margin-top:20px}.settings-content{width:60%;text-align:center}.settings-content .form-table{text-align:left}.settings-content .form-table #woocommerce_finix_gateway_description,.settings-content .form-table #woocommerce_finix_ apple_pay_gateway_description{max-width:25rem;padding:4px 8px}.global-container h2,h3{color:#0d121a;text-align:left}.global-container p{text-align:left}.global-container h3{margin-left:15rem}.global-container .features-container h3,.global-container .webhook-container h3{margin-left:0}.woocommerce .global-container table.form-table th label .woocommerce-help-tip{position:relative}1 .header-container{display:flex;justify-content:center;align-items:center;border-bottom:1px solid #d7dde4}.header-content{width:70%;text-align:center;padding:20px;background:rgba(0,0,0,0);margin-bottom:1em}.header-content h2,.header-content h3,.header-content p{color:#0d121a}.header-content .logo{display:block;text-align:center;line-height:initial;font-size:0;max-height:61px;cursor:pointer}.header-content .logo img{display:inline-block;pointer-events:none}.finix-nav-container{display:flex;justify-content:center;align-items:center;margin-top:20px}.finix-nav-content{width:60%;text-align:center}.links-container{display:flex;justify-content:center;align-items:center;margin-top:20px}.links-content{width:60%;text-align:center}.links-content h2{color:#0d121a;font-size:2.5em;font-weight:bolder}.links-content p{text-align:left}.features-container{display:flex;justify-content:center;align-items:center;margin-top:20px}.features-container .register-domain-button{text-align:left}.features-container .register-domain-message{padding:10px}.features-content{width:60%}.features-lists{display:flex;flex-direction:row;justify-content:left;gap:20px}.features-lists>ul{list-style-type:none;padding:0;margin:0}.features-lists>ul>li{background-color:#f0f0f0;margin-bottom:5px;border-radius:5px;position:relative;padding:5px 10px 5px 20px}.features-lists>ul>li::before{content:"✓";color:green;position:absolute;left:0;top:50%;transform:translateY(-50%)}.webhook-container{display:flex;justify-content:center;align-items:center;margin-top:20px}.webhook-content{width:60%}.webhook-content table{width:100%;border-collapse:collapse;margin-top:20px}.webhook-content table td{padding-top:5px;padding-bottom:5px}.settings-container{display:flex;justify-content:center;align-items:center;margin-top:20px}.settings-content{width:60%;text-align:center}.settings-content .form-table{text-align:left}.settings-content .form-table #woocommerce_finix_gateway_description,.settings-content .form-table #woocommerce_finix_bank_gateway_description,.settings-content .form-table #woocommerce_finix_apple_pay_gateway_description{max-width:25rem;padding:4px 8px}.global-container h2,h3{color:#0d121a;text-align:left}.global-container p{text-align:left}.global-container h3{margin-left:15rem}.global-container .features-container h3,.global-container .webhook-container h3{margin-left:0}.woocommerce .global-container table.form-table th label .woocommerce-help-tip{position:relative} -
finix-for-woocommerce/trunk/assets/css/shortcode-checkout.css
r3316914 r3375717 5 5 6 6 .wc_payment_method.payment_method_finix_gateway label img, 7 .wc_payment_method.payment_method_finix_bank_gateway label img, 7 8 .wc_payment_method.payment_method_finix_apple_pay_gateway label img, 8 9 .wc_payment_method.payment_method_finix_google_pay_gateway label img { -
finix-for-woocommerce/trunk/assets/css/shortcode-checkout.min.css
r3316914 r3375717 1 #finix-form{min-width:250px;max-width:714px}.wc_payment_method.payment_method_finix_gateway label img,.wc_payment_method.payment_method_finix_ apple_pay_gateway label img,.wc_payment_method.payment_method_finix_google_pay_gateway label img{float:right;height:30px;width:auto}#wc-finix_apple_pay_gateway-form,#google-pay-finix-form{display:none}apple-pay-button{--apple-pay-button-width: 150px;--apple-pay-button-height: 30px;--apple-pay-button-border-radius: 3px;--apple-pay-button-padding: 0px 0px;--apple-pay-button-box-sizing: border-box}#finix-apple-pay-button{cursor:pointer;display:none}#finix-google-pay-button{cursor:pointer;height:40px;max-height:40px;max-width:100%;min-width:200px;width:100%}#place_order.finix-hide-place-order{height:0 !important;opacity:0 !important;padding:0 !important;position:absolute !important;z-index:-1000 !important}1 #finix-form{min-width:250px;max-width:714px}.wc_payment_method.payment_method_finix_gateway label img,.wc_payment_method.payment_method_finix_bank_gateway label img,.wc_payment_method.payment_method_finix_apple_pay_gateway label img,.wc_payment_method.payment_method_finix_google_pay_gateway label img{float:right;height:30px;width:auto}#wc-finix_apple_pay_gateway-form,#google-pay-finix-form{display:none}apple-pay-button{--apple-pay-button-width: 150px;--apple-pay-button-height: 30px;--apple-pay-button-border-radius: 3px;--apple-pay-button-padding: 0px 0px;--apple-pay-button-box-sizing: border-box}#finix-apple-pay-button{cursor:pointer;display:none}#finix-google-pay-button{cursor:pointer;height:40px;max-height:40px;max-width:100%;min-width:200px;width:100%}#place_order.finix-hide-place-order{height:0 !important;opacity:0 !important;padding:0 !important;position:absolute !important;z-index:-1000 !important} -
finix-for-woocommerce/trunk/assets/js/block/build/apple-pay.asset.php
r3316914 r3375717 1 <?php return array('dependencies' => array('react ', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-settings', 'wp-data', 'wp-html-entities', 'wp-i18n'), 'version' => 'ea75bbf44b0a728f3a90');1 <?php return array('dependencies' => array('react-jsx-runtime', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-settings', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => '1449d80f1ecc51ad3234'); -
finix-for-woocommerce/trunk/assets/js/block/build/apple-pay.js
r3316914 r3375717 1 (()=>{"use strict"; var e={20:(e,a,n)=>{var t=n(609),p=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};a.jsx=function(e,a,n){var t,r={},_=null,c=null;for(t in void 0!==n&&(_=""+n),void 0!==a.key&&(_=""+a.key),void 0!==a.ref&&(c=a.ref),a)i.call(a,t)&&!o.hasOwnProperty(t)&&(r[t]=a[t]);if(e&&e.defaultProps)for(t in a=e.defaultProps)void 0===r[t]&&(r[t]=a[t]);return{$$typeof:p,type:e,key:_,ref:c,props:r,_owner:s.current}}},609:e=>{e.exports=window.React},848:(e,a,n)=>{e.exports=n(20)}},a={};const n=window.wp.i18n,t=window.wc.wcBlocksRegistry,p=window.wp.htmlEntities,i=window.wc.wcSettings,s=window.wc.wcBlocksData,o=window.wp.data;var r=function n(t){var p=a[t];if(void 0!==p)return p.exports;var i=a[t]={exports:{}};return e[t](i,i.exports,n),i.exports}(848);const{useState:_,useEffect:c,createElement:l}=window.wp.element,y=(0,i.getSetting)("finix_apple_pay_gateway_data",{}),d=(0,p.decodeEntities)(y.title)||(0,n.__)("Pay with Apple Pay","finix-for-woocommerce"),m=e=>{const{PaymentMethodLabel:a}=e.components,n=()=>l("img",{src:y.icon,style:{position:"absolute",right:"20px",height:"30px",width:"auto"}});return(0,r.jsx)(a,{text:d,icon:(0,r.jsx)(n,{})})},f=e=>{const{eventRegistration:a,emitResponse:t}=e,{onPaymentSetup:p}=a,{shippingAddress:i,billingAddress:r,totals:y}=(0,o.useSelect)(e=>e(s.cartStore).getCartData(),[]),[d,m]=_(!0);return c(()=>{finix_apple_pay_params.shipping_data=i,(async()=>{const e=await new Promise(e=>{let a=(()=>{const e=finix_apple_pay_params.billing_data,a=finix_apple_pay_params.shipping_data;return{shipping_country:a.country||e.country||"",shipping_state:a.state||e.state||"",shipping_postcode:a.postcode||e.postcode||"",shipping_city:a.city||e.city||"",shipping_address_1:a.address_1||e.address1||""}})();a.nonce=finix_apple_pay_params.nonce,fetch(finix_apple_pay_params.url.ajax+"?action=validate_shipping_method",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(e=>e.json()).then(a=>{!0===a.success?e(!0):e(!1)}).catch(()=>e(!1))});m(e)})()},[i]),c(()=>{finix_apple_pay_params.billing_data=r},[r]),c(()=>{finix_apple_pay_params.amount=(y.total_price/100).toFixed(2)},[y]),c(()=>p(async()=>{if(!d)return{type:t.responseTypes.ERROR,message:(0,n.__)("Please make sure shipping and billing information is correct.","finix-for-woocommerce")};const e=new window.ApplePaySession(10,{countryCode:finix_apple_pay_params.merchant_country,currencyCode:y.currency_code,merchantCapabilities:["supports3DS"],supportedNetworks:["visa","masterCard","amex","discover"],total:{label:finix_apple_pay_params.merchant_name,amount:finix_apple_pay_params.amount}});try{const a=await(async e=>new Promise((a,n)=>{e.onvalidatemerchant=async a=>{try{if(!(t=a.validationURL)||""===t.trim())return void n(finix_apple_pay_params.text.error_processing);const p={provider:"APPLE_PAY",validation_url:a.validationURL,merchant_identity:finix_apple_pay_params.merchant_identity,domain_name:window.location.hostname,display_name:finix_apple_pay_params.merchant_name,session_request:!0,wp_nonce:finix_apple_pay_params.nonce},i=await fetch(finix_apple_pay_params.url.webhook,{method:"POST",body:JSON.stringify(p),headers:{"Content-Type":"application/json"}}),s=await i.json(),o=s?.response?.session_details||"";if(!o)return void n(finix_apple_pay_params.text.error_processing);const r=JSON.parse(o);e.completeMerchantValidation(r)}catch(e){n(finix_apple_pay_params.text.error_processing)}var t},e.onpaymentauthorized=async t=>{try{const p=t.payment;if(!p)return e.completePayment(window.ApplePaySession.STATUS_FAILURE),void n(finix_apple_pay_params.text.error_processing);const i={provider:"APPLE_PAY",payment_token:JSON.stringify(p),process_payment:!0,merchant_identity:finix_apple_pay_params.merchant_identity,wp_nonce:finix_apple_pay_params.nonce,billing_info:finix_apple_pay_params.billing_data},s=await fetch(finix_apple_pay_params.url.webhook,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),o=await s.json();201===o.status?(e.completePayment(window.ApplePaySession.STATUS_SUCCESS),document.getElementById("finix_apple_pay_success").value=!0,document.getElementById("finix_apple_pay_transaction_id").value=o.response.id,a(!0)):(e.completePayment(window.ApplePaySession.STATUS_FAILURE),document.getElementById("finix_apple_pay_success").value=!1,document.getElementById("finix_apple_pay_transaction_id").value="",n(o.data.message))}catch(a){e.completePayment(window.ApplePaySession.STATUS_FAILURE),document.getElementById("finix_apple_pay_success").value=!1,n(finix_apple_pay_params.text.error_processing)}},e.oncancel=async function(){n()},e.begin()}))(e);if(!0===a)return{type:t.responseTypes.SUCCESS,meta:{paymentMethodData:{finix_apple_pay_success:document.getElementById("finix_apple_pay_success").value,finix_apple_pay_transaction_id:document.getElementById("finix_apple_pay_transaction_id").value,finix_nonce:finix_apple_pay_params.nonce}}}}catch(e){return{type:t.responseTypes.FAIL,message:e.toString()}}return{type:t.responseTypes.FAIL,message:finix_apple_pay_params.text.error_processing}}),[p]),l("fieldset",{id:"wc-finix-apple-pay-form",style:{background:"transparent",padding:"0"}},l("apple-pay-button",{id:"finix-apple-pay-button",buttonstyle:finix_apple_pay_params.button_style,type:finix_apple_pay_params.button_type,locale:finix_apple_pay_params.button_locale}),l("input",{type:"hidden",name:"finix_apple_pay_success",id:"finix_apple_pay_success"}),l("input",{type:"hidden",name:"finix_apple_pay_transaction_id",id:"finix_apple_pay_transaction_id"}))},u=()=>{};(0,t.registerPaymentMethod)({name:"finix_apple_pay_gateway",label:(0,r.jsx)(m,{}),content:(0,r.jsx)(f,{}),edit:(0,r.jsx)(u,{}),canMakePayment:()=>window.ApplePaySession&&window.ApplePaySession.canMakePayments()&&window.ApplePaySession.supportsVersion(10),ariaLabel:d,supports:{features:y.supports}})})();1 (()=>{"use strict";const e=window.wp.element,a=window.wp.i18n,t=window.wc.wcBlocksRegistry,n=window.wp.htmlEntities,p=window.wc.wcSettings,i=window.wc.wcBlocksData,s=window.wp.data,o=window.ReactJSXRuntime,_="finix_apple_pay_gateway",r=(0,p.getSetting)("finix_apple_pay_gateway_data",{}),l=(0,n.decodeEntities)(r.title)||(0,a.__)("Pay with Apple Pay","finix-for-woocommerce"),c=e=>e&&""!==e.trim(),m=a=>{const{PaymentMethodLabel:t}=a.components,n=()=>(0,e.createElement)("img",{src:r.icon,style:{position:"absolute",right:"20px",height:"30px",width:"auto"}});return(0,o.jsx)(t,{text:l,icon:(0,o.jsx)(n,{})})},y=t=>{const{eventRegistration:n,emitResponse:p}=t,{onPaymentSetup:o}=n,{shippingAddress:l,billingAddress:m,totals:y,coupons:d,items:u}=(0,s.useSelect)(e=>e(i.cartStore).getCartData(),[]),[f,x]=(0,e.useState)(!0),w=(0,e.useRef)(null),g=(0,e.useRef)(!1);return(0,e.useEffect)(()=>{finix_apple_pay_params.shipping_data=l;const e=JSON.stringify(l||{});g.current&&e===w.current||(w.current=e,g.current=!0,(async()=>{const e=await new Promise(e=>{let a=(()=>{const e=finix_apple_pay_params.billing_data,a=finix_apple_pay_params.shipping_data;return{shipping_country:a.country||e.country||"",shipping_state:a.state||e.state||"",shipping_postcode:a.postcode||e.postcode||"",shipping_city:a.city||e.city||"",shipping_address_1:a.address_1||e.address1||""}})();a.nonce=finix_apple_pay_params.nonce,fetch(finix_apple_pay_params.url.ajax+"?action=validate_shipping_method",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(e=>e.json()).then(a=>{!0===a.success?e(!0):e(!1)}).catch(()=>e(!1))});x(e)})())},[l]),(0,e.useEffect)(()=>{finix_apple_pay_params.billing_data=m},[m]),(0,e.useEffect)(()=>{finix_apple_pay_params.amount=(y.total_price/100).toFixed(2),finix_apple_pay_params.currency_code=y.currency_code,finix_apple_pay_params.subtotal=(y.total_items/100).toFixed(2),finix_apple_pay_params.shipping_amount=(y.total_shipping/100).toFixed(2),finix_apple_pay_params.tax_amount=(y.total_tax/100).toFixed(2)},[y]),(0,e.useEffect)(()=>{finix_apple_pay_params.coupons=d.map(e=>({code:e.code,total:(e.totals.total_discount/100).toFixed(2)}))},[d]),(0,e.useEffect)(()=>{finix_apple_pay_params.items=u.map(e=>({name:e.name,quantity:e.quantity,image:e.images.length&&e.images.length>0?e.images[0].thumbnail:"",total:e.prices.price*e.quantity}))},[u]),(0,e.useEffect)(()=>o(async()=>{if(!f)return{type:p.responseTypes.ERROR,message:(0,a.__)("Please make sure shipping and billing information is correct.","finix-for-woocommerce")};let e=[];Object.values(finix_apple_pay_params.products).forEach(a=>{0!==parseFloat(a.total)&&e.push({label:a.quantity>1?`${a.name} x${a.quantity}`:a.name,type:"final",amount:a.total})}),e.push({label:(0,a.__)("Subtotal","finix-for-woocommerce"),type:"final",amount:finix_apple_pay_params.subtotal||finix_apple_pay_params.amount}),e.push(...finix_apple_pay_params.coupons.map(e=>({label:(0,a.__)("Discount code:","finix-for-woocommerce")+" "+e.code,type:"final",amount:-1*parseFloat(e.total).toFixed(2)}))),finix_apple_pay_params.shipping_amount>0&&e.push({label:(0,a.__)("Shipping","finix-for-woocommerce"),type:"final",amount:finix_apple_pay_params.shipping_amount||"0.00"}),finix_apple_pay_params.tax_amount>0&&e.push({label:(0,a.__)("Tax","finix-for-woocommerce"),type:"final",amount:finix_apple_pay_params.tax_amount||"0.00"});const t=new window.ApplePaySession(10,{countryCode:finix_apple_pay_params.merchant_country,currencyCode:finix_apple_pay_params.currency_code,merchantCapabilities:["supports3DS"],supportedNetworks:["visa","masterCard","amex","discover"],total:{label:finix_apple_pay_params.merchant_name,amount:finix_apple_pay_params.amount},lineItems:e});try{const e=await(async e=>new Promise((a,t)=>{e.onvalidatemerchant=async a=>{try{if(!c(a.validationURL))return void t(finix_apple_pay_params.text.error_processing);const n={provider:"APPLE_PAY",validation_url:a.validationURL,merchant_identity:finix_apple_pay_params.merchant_identity,domain_name:window.location.hostname,display_name:finix_apple_pay_params.merchant_name,session_request:!0,wp_nonce:finix_apple_pay_params.nonce},p=await fetch(finix_apple_pay_params.url.webhook,{method:"POST",body:JSON.stringify(n),headers:{"Content-Type":"application/json"}}),i=await p.json(),s=i?.response?.session_details||"";if(!s)return void t(finix_apple_pay_params.text.error_processing);const o=JSON.parse(s);e.completeMerchantValidation(o)}catch(e){t(finix_apple_pay_params.text.error_processing)}},e.onpaymentauthorized=async n=>{try{const p=n.payment;if(!p)return e.completePayment(window.ApplePaySession.STATUS_FAILURE),void t(finix_apple_pay_params.text.error_processing);const i={provider:"APPLE_PAY",payment_token:JSON.stringify(p),process_payment:!0,merchant_identity:finix_apple_pay_params.merchant_identity,wp_nonce:finix_apple_pay_params.nonce,billing_info:finix_apple_pay_params.billing_data},s=await fetch(finix_apple_pay_params.url.webhook,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)}),o=await s.json();201===o.status?(e.completePayment(window.ApplePaySession.STATUS_SUCCESS),document.getElementById("finix_apple_pay_success").value=!0,document.getElementById("finix_apple_pay_transaction_id").value=o.response.id,a(!0)):(e.completePayment(window.ApplePaySession.STATUS_FAILURE),document.getElementById("finix_apple_pay_success").value=!1,document.getElementById("finix_apple_pay_transaction_id").value="",t(o.data.message))}catch(a){e.completePayment(window.ApplePaySession.STATUS_FAILURE),document.getElementById("finix_apple_pay_success").value=!1,t(finix_apple_pay_params.text.error_processing)}},e.oncancel=async function(){t()},e.begin()}))(t);if(!0===e)return{type:p.responseTypes.SUCCESS,meta:{paymentMethodData:{finix_apple_pay_success:document.getElementById("finix_apple_pay_success").value,finix_apple_pay_transaction_id:document.getElementById("finix_apple_pay_transaction_id").value,finix_nonce:finix_apple_pay_params.nonce}}}}catch(e){return{type:p.responseTypes.FAIL,message:e?.toString()}}return{type:p.responseTypes.FAIL,message:finix_apple_pay_params.text.error_processing}}),[o]),(0,e.createElement)("fieldset",{id:"wc-"+_+"-form",style:{background:"transparent",padding:"0"}},c(r.description)?(0,e.createElement)("div",{},(0,e.createElement)("p",{dangerouslySetInnerHTML:{__html:r.description}})):null,(0,e.createElement)("apple-pay-button",{id:"finix-apple-pay-button",buttonstyle:finix_apple_pay_params.button_style,type:finix_apple_pay_params.button_type,locale:finix_apple_pay_params.button_locale}),(0,e.createElement)("input",{type:"hidden",name:"finix_apple_pay_success",id:"finix_apple_pay_success"}),(0,e.createElement)("input",{type:"hidden",name:"finix_apple_pay_transaction_id",id:"finix_apple_pay_transaction_id"}))},d=()=>{};(0,t.registerPaymentMethod)({name:_,label:(0,o.jsx)(m,{}),content:(0,o.jsx)(y,{}),edit:(0,o.jsx)(d,{}),canMakePayment:()=>window.ApplePaySession&&window.ApplePaySession.canMakePayments()&&window.ApplePaySession.supportsVersion(10),ariaLabel:l,supports:{features:r.supports}})})(); -
finix-for-woocommerce/trunk/assets/js/block/build/google-pay.asset.php
r3316914 r3375717 1 <?php return array('dependencies' => array('react ', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-settings', 'wp-data', 'wp-html-entities', 'wp-i18n'), 'version' => '534fcd2c7fd393a23a8e');1 <?php return array('dependencies' => array('react-jsx-runtime', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-settings', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n'), 'version' => 'e247941ef06602be4cc3'); -
finix-for-woocommerce/trunk/assets/js/block/build/google-pay.js
r3316914 r3375717 1 (()=>{"use strict"; var e={20:(e,t,a)=>{var o=a(609),n=Symbol.for("react.element"),i=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),s=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,r={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,a){var o,_={},p=null,c=null;for(o in void 0!==a&&(p=""+a),void 0!==t.key&&(p=""+t.key),void 0!==t.ref&&(c=t.ref),t)i.call(t,o)&&!r.hasOwnProperty(o)&&(_[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===_[o]&&(_[o]=t[o]);return{$$typeof:n,type:e,key:p,ref:c,props:_,_owner:s.current}}},609:e=>{e.exports=window.React},848:(e,t,a)=>{e.exports=a(20)}},t={};const a=window.wp.i18n,o=window.wc.wcBlocksRegistry,n=window.wp.htmlEntities,i=window.wc.wcSettings,s=window.wc.wcBlocksData,r=window.wp.data;class _{static paymentsClient=null;static baseRequest={apiVersion:2,apiVersionMinor:0};static environment="sandbox"===finix_google_pay_params.environment?"TEST":"PRODUCTION";static allowedCardNetworks=["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"];static allowedCardAuthMethods=["PAN_ONLY","CRYPTOGRAM_3DS"];static tokenizationSpecification={type:"PAYMENT_GATEWAY",parameters:{gateway:"finix",gatewayMerchantId:finix_google_pay_params.merchant_identity}};static baseCardPaymentMethod={type:"CARD",parameters:{allowedAuthMethods:_.allowedCardAuthMethods,allowedCardNetworks:_.allowedCardNetworks}};static cardPaymentMethod={..._.baseCardPaymentMethod,tokenizationSpecification:_.tokenizationSpecification};static getPaymentsClient(){return _.paymentsClient||(_.paymentsClient=new google.payments.api.PaymentsClient({environment:_.environment})),_.paymentsClient}static getIsReadyToPayRequest(){return{..._.baseRequest,allowedPaymentMethods:[_.baseCardPaymentMethod]}}static getTransactionInfo(){return{countryCode:finix_google_pay_params.merchant_country,currencyCode:finix_google_pay_params.currency_code,totalPriceStatus:"FINAL",totalPrice:finix_google_pay_params.amount}}static getPaymentDataRequest(){return{..._.baseRequest,allowedPaymentMethods:[_.cardPaymentMethod],transactionInfo:_.getTransactionInfo(),merchantInfo:{merchantId:finix_google_pay_params.google_merchant_id,merchantName:finix_google_pay_params.merchant_name}}}static prefetchPaymentData(){_.getPaymentsClient().prefetchPaymentData(_.getPaymentDataRequest())}static processPayment=async()=>{const e=(0,a.__)("There was an error while processing the payment using Google Pay.","finix-for-woocommerce");try{const t=(await _.getPaymentsClient().loadPaymentData(_.getPaymentDataRequest())).paymentMethodData.tokenizationData.token;if(!t)throw new Error(e);const a={provider:"GOOGLE_PAY",payment_token:t,process_payment:!0,merchant_identity:finix_google_pay_params.merchant_identity,wp_nonce:finix_google_pay_params.nonce,billing_info:finix_google_pay_params.billing_data},o=await fetch(finix_google_pay_params.url.webhook,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(e=>e.json());if(201===o.status)return document.getElementById("finix_google_pay_success").value=!0,document.getElementById("finix_google_pay_transaction_id").value=o.response.id,!0;throw document.getElementById("finix_google_pay_success").value=!1,document.getElementById("finix_google_pay_transaction_id").value="",new Error(e)}catch(t){throw new Error(t.message||e)}};static triggerPayment(){const e=document.querySelector(".wc-block-components-checkout-place-order-button");e&&e.click()}}var p=function a(o){var n=t[o];if(void 0!==n)return n.exports;var i=t[o]={exports:{}};return e[o](i,i.exports,a),i.exports}(848);const{useEffect:c,createElement:g}=window.wp.element,l=(0,i.getSetting)("finix_google_pay_gateway_data",{}),y=(0,n.decodeEntities)(l.title)||(0,a.__)("Pay with Google Pay","finix-for-woocommerce"),d=e=>{const{PaymentMethodLabel:t}=e.components,a=()=>g("img",{src:l.icon});return(0,p.jsx)(t,{text:y,icon:(0,p.jsx)(a,{})})},m=e=>{const{eventRegistration:t,emitResponse:o}=e,{onPaymentSetup:n}=t,{shippingAddress:i,billingAddress:p,totals:l}=(0,r.useSelect)(e=>e(s.cartStore).getCartData(),[]);return c(()=>{finix_google_pay_params.shipping_data=i},[i]),c(()=>{finix_google_pay_params.billing_data=p},[p]),c(()=>{finix_google_pay_params.amount=(l.total_price/100).toFixed(2),finix_google_pay_params.currency_code=l.currency_code},[l]),c(()=>{const e=_.getPaymentsClient();return e.isReadyToPay(_.getIsReadyToPayRequest()).then(t=>{if(t.result){const t=document.querySelector("#wc-finix-google-pay-form"),a=e.createButton({onClick:_.triggerPayment,allowedPaymentMethods:[_.cardPaymentMethod],buttonColor:finix_google_pay_params.button_color,buttonType:finix_google_pay_params.button_type,buttonRadius:finix_google_pay_params.button_radius,buttonLocale:finix_google_pay_params.button_locale});t.appendChild(a),_.prefetchPaymentData()}}).catch(e=>({type:o.responseTypes.ERROR,message:(0,a.__)("There was an error while initializing Google Pay. Please check all the details and try again.","finix-for-woocommerce")})),n(async()=>{if(!await(()=>{let e=(()=>{const e=finix_google_pay_params.billing_data,t=finix_google_pay_params.shipping_data;return{shipping_country:t.country||e.country||"",shipping_state:t.state||e.state||"",shipping_postcode:t.postcode||e.postcode||"",shipping_city:t.city||e.city||"",shipping_address_1:t.address_1||e.address1||""}})();return e.nonce=finix_google_pay_params.nonce,new Promise(t=>{fetch(finix_google_pay_params.url.ajax+"?action=validate_shipping_method",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.json()).then(e=>{t(!0===e.success)}).catch(()=>t(!1))})})())return{type:o.responseTypes.ERROR,message:(0,a.__)("Please make sure shipping and billing information is correct and then try again.","finix-for-woocommerce")};try{return!0===await _.processPayment()?{type:o.responseTypes.SUCCESS,meta:{paymentMethodData:{finix_google_pay_success:document.getElementById("finix_google_pay_success").value,finix_google_pay_transaction_id:document.getElementById("finix_google_pay_transaction_id").value,finix_nonce:finix_google_pay_params.nonce}}}:{type:o.responseTypes.FAIL,message:finix_google_pay_params.text.error_processing}}catch(e){return{type:o.responseTypes.FAIL,message:finix_google_pay_params.text.error_processing}}})},[n]),g("fieldset",{id:"wc-finix-google-pay-form",style:{background:"transparent",padding:"0"}},g("google-pay-button",{id:"finix-google-pay-button",buttonstyle:finix_google_pay_params.button_style,type:finix_google_pay_params.button_type,locale:finix_google_pay_params.button_locale}),g("input",{type:"hidden",name:"finix_google_pay_success",id:"finix_google_pay_success"}),g("input",{type:"hidden",name:"finix_google_pay_transaction_id",id:"finix_google_pay_transaction_id"}))},u=()=>{};(0,o.registerPaymentMethod)({name:"finix_google_pay_gateway",label:(0,p.jsx)(d,{}),content:(0,p.jsx)(m,{}),edit:(0,p.jsx)(u,{}),canMakePayment:()=>void 0!==finix_google_pay_params.google_merchant_id&&""!==finix_google_pay_params.google_merchant_id&&!(!google||!google.payments)&&_.getPaymentsClient().isReadyToPay(_.getIsReadyToPayRequest()).then(e=>e.result),ariaLabel:y,supports:{features:l.supports}})})();1 (()=>{"use strict";const e=window.wp.element,t=window.wp.i18n,a=window.wc.wcBlocksRegistry,n=window.wp.htmlEntities,o=window.wc.wcSettings,i=window.wc.wcBlocksData,s=window.wp.data;class r{static paymentsClient=null;static baseRequest={apiVersion:2,apiVersionMinor:0};static environment="sandbox"===finix_google_pay_params.environment?"TEST":"PRODUCTION";static allowedCardNetworks=["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"];static allowedCardAuthMethods=["PAN_ONLY","CRYPTOGRAM_3DS"];static tokenizationSpecification={type:"PAYMENT_GATEWAY",parameters:{gateway:"finix",gatewayMerchantId:finix_google_pay_params.merchant_identity}};static baseCardPaymentMethod={type:"CARD",parameters:{allowedAuthMethods:r.allowedCardAuthMethods,allowedCardNetworks:r.allowedCardNetworks}};static cardPaymentMethod={...r.baseCardPaymentMethod,tokenizationSpecification:r.tokenizationSpecification};static getPaymentsClient(){return r.paymentsClient||(r.paymentsClient=new google.payments.api.PaymentsClient({environment:r.environment})),r.paymentsClient}static getIsReadyToPayRequest(){return{...r.baseRequest,allowedPaymentMethods:[r.baseCardPaymentMethod]}}static getTransactionInfo(){return{countryCode:finix_google_pay_params.merchant_country,currencyCode:finix_google_pay_params.currency_code,totalPriceStatus:"FINAL",totalPrice:finix_google_pay_params.amount}}static getPaymentDataRequest(){return{...r.baseRequest,allowedPaymentMethods:[r.cardPaymentMethod],transactionInfo:r.getTransactionInfo(),merchantInfo:{merchantId:finix_google_pay_params.google_merchant_id,merchantName:finix_google_pay_params.merchant_name}}}static prefetchPaymentData(){r.getPaymentsClient().prefetchPaymentData(r.getPaymentDataRequest())}static processPayment=async()=>{const e=(0,t.__)("There was an error while processing the payment using Google Pay.","finix-for-woocommerce");try{const t=(await r.getPaymentsClient().loadPaymentData(r.getPaymentDataRequest())).paymentMethodData.tokenizationData.token;if(!t)throw new Error(e);const a={provider:"GOOGLE_PAY",payment_token:t,process_payment:!0,merchant_identity:finix_google_pay_params.merchant_identity,wp_nonce:finix_google_pay_params.nonce,billing_info:finix_google_pay_params.billing_data},n=await fetch(finix_google_pay_params.url.webhook,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}).then(e=>e.json());if(201===n.status)return document.getElementById("finix_google_pay_success").value=!0,document.getElementById("finix_google_pay_transaction_id").value=n.response.id,!0;throw document.getElementById("finix_google_pay_success").value=!1,document.getElementById("finix_google_pay_transaction_id").value="",new Error(e)}catch(t){throw new Error(t.message||e)}};static triggerPayment(){const e=document.querySelector(".wc-block-components-checkout-place-order-button");e&&e.click()}}const _=window.ReactJSXRuntime,c="finix_google_pay_gateway",p=(0,o.getSetting)("finix_google_pay_gateway_data",{}),g=(0,n.decodeEntities)(p.title)||(0,t.__)("Pay with Google Pay","finix-for-woocommerce"),l=t=>{const{PaymentMethodLabel:a}=t.components,n=()=>(0,e.createElement)("img",{src:p.icon});return(0,_.jsx)(a,{text:g,icon:(0,_.jsx)(n,{})})},y=a=>{const{eventRegistration:n,emitResponse:o}=a,{onPaymentSetup:_}=n,{shippingAddress:g,billingAddress:l,totals:y}=(0,s.useSelect)(e=>e(i.cartStore).getCartData(),[]);return(0,e.useEffect)(()=>{finix_google_pay_params.shipping_data=g},[g]),(0,e.useEffect)(()=>{finix_google_pay_params.billing_data=l},[l]),(0,e.useEffect)(()=>{finix_google_pay_params.amount=(y.total_price/100).toFixed(2),finix_google_pay_params.currency_code=y.currency_code},[y]),(0,e.useEffect)(()=>{const e=r.getPaymentsClient();return e.isReadyToPay(r.getIsReadyToPayRequest()).then(t=>{if(t.result){const t=document.querySelector("#wc-finix-google-pay-form"),a=e.createButton({onClick:r.triggerPayment,allowedPaymentMethods:[r.cardPaymentMethod],buttonColor:finix_google_pay_params.button_color,buttonType:finix_google_pay_params.button_type,buttonRadius:finix_google_pay_params.button_radius,buttonLocale:finix_google_pay_params.button_locale});t.appendChild(a),r.prefetchPaymentData()}}).catch(e=>({type:o.responseTypes.ERROR,message:(0,t.__)("There was an error while initializing Google Pay. Please check all the details and try again.","finix-for-woocommerce")})),_(async()=>{if(!await(()=>{let e=(()=>{const e=finix_google_pay_params.billing_data,t=finix_google_pay_params.shipping_data;return{shipping_country:t.country||e.country||"",shipping_state:t.state||e.state||"",shipping_postcode:t.postcode||e.postcode||"",shipping_city:t.city||e.city||"",shipping_address_1:t.address_1||e.address1||""}})();return e.nonce=finix_google_pay_params.nonce,new Promise(t=>{fetch(finix_google_pay_params.url.ajax+"?action=validate_shipping_method",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.json()).then(e=>{t(!0===e.success)}).catch(()=>t(!1))})})())return{type:o.responseTypes.ERROR,message:(0,t.__)("Please make sure shipping and billing information is correct and then try again.","finix-for-woocommerce")};try{return!0===await r.processPayment()?{type:o.responseTypes.SUCCESS,meta:{paymentMethodData:{finix_google_pay_success:document.getElementById("finix_google_pay_success").value,finix_google_pay_transaction_id:document.getElementById("finix_google_pay_transaction_id").value,finix_nonce:finix_google_pay_params.nonce}}}:{type:o.responseTypes.FAIL,message:finix_google_pay_params.text.error_processing}}catch(e){return{type:o.responseTypes.FAIL,message:finix_google_pay_params.text.error_processing}}})},[_]),(0,e.createElement)("fieldset",{id:"wc-"+c+"-form",style:{background:"transparent",padding:"0"}},(m=p.description)&&""!==m.trim()?(0,e.createElement)("div",{},(0,e.createElement)("p",{dangerouslySetInnerHTML:{__html:p.description}})):null,(0,e.createElement)("google-pay-button",{id:"finix-google-pay-button",buttonstyle:finix_google_pay_params.button_style,type:finix_google_pay_params.button_type,locale:finix_google_pay_params.button_locale}),(0,e.createElement)("input",{type:"hidden",name:"finix_google_pay_success",id:"finix_google_pay_success"}),(0,e.createElement)("input",{type:"hidden",name:"finix_google_pay_transaction_id",id:"finix_google_pay_transaction_id"}));var m},m=()=>{};(0,a.registerPaymentMethod)({name:c,label:(0,_.jsx)(l,{}),content:(0,_.jsx)(y,{}),edit:(0,_.jsx)(m,{}),canMakePayment:()=>void 0!==finix_google_pay_params.google_merchant_id&&""!==finix_google_pay_params.google_merchant_id&&!(!google||!google.payments)&&r.getPaymentsClient().isReadyToPay(r.getIsReadyToPayRequest()).then(e=>e.result),ariaLabel:g,supports:{features:p.supports}})})(); -
finix-for-woocommerce/trunk/assets/js/finix-helpers.js
r3316914 r3375717 1 1 var FinixHelpers = { 2 getUpdatedTotal: function () { 3 let rawTotal = jQuery( '.woocommerce-checkout-review-order-table .order-total .woocommerce-Price-amount' ).text().trim(); 2 getUpdatedValue: function ( selector ) { 3 // Validate existence of the selector 4 if ( ! jQuery( selector ).length ) { 5 return '0.00'; 6 } 7 8 let rawTotal = jQuery( selector ).text().trim(); 4 9 5 10 // Clean unwanted currency symbols, letters, non-breaking spaces, etc. … … 42 47 return parseFloat( cleanTotal ).toFixed( decimals ); 43 48 }, 49 50 getUpdatedTotal: function () { 51 return this.getUpdatedValue( '.woocommerce-checkout-review-order-table .order-total .woocommerce-Price-amount' ); 52 }, 44 53 }; -
finix-for-woocommerce/trunk/assets/js/finix-helpers.min.js
r3316914 r3375717 1 var FinixHelpers={getUpdated Total:function(){var e=jQuery(".woocommerce-checkout-review-order-table .order-total .woocommerce-Price-amount").text().trim().replace(/[^\d.,]/g,"").replace(/\u00A0/g,"").trim(),r=e.includes(","),c=e.includes(".");let a=e,t=(r&&!c?a=e.replace(",","."):c&&!r?a=e:r&&c&&(r=e.lastIndexOf(","),c=e.lastIndexOf("."),a=c<r?e.replace(/\./g,"").replace(",","."):e.replace(/,/g,"")),2);return"undefined"!=typeof wc_checkout_params&&wc_checkout_params.currency_format_num_decimals&&(t=parseInt(wc_checkout_params.currency_format_num_decimals)),parseFloat(a).toFixed(t)}};1 var FinixHelpers={getUpdatedValue:function(e){if(!jQuery(e).length)return"0.00";var e=jQuery(e).text().trim().replace(/[^\d.,]/g,"").replace(/\u00A0/g,"").trim(),r=e.includes(","),t=e.includes(".");let a=e,c=(r&&!t?a=e.replace(",","."):t&&!r?a=e:r&&t&&(r=e.lastIndexOf(","),t=e.lastIndexOf("."),a=t<r?e.replace(/\./g,"").replace(",","."):e.replace(/,/g,"")),2);return"undefined"!=typeof wc_checkout_params&&wc_checkout_params.currency_format_num_decimals&&(c=parseInt(wc_checkout_params.currency_format_num_decimals)),parseFloat(a).toFixed(c)},getUpdatedTotal:function(){return this.getUpdatedValue(".woocommerce-checkout-review-order-table .order-total .woocommerce-Price-amount")}}; -
finix-for-woocommerce/trunk/assets/js/shortcode-apple-pay.js
r3316914 r3375717 312 312 // The Apple Pay JS API is not available. 313 313 const applePayfieldset = document.querySelector( 'fieldset#wc-finix_apple_pay_gateway-form' ); 314 // If applePayfieldset is not found, return. 315 if ( ! applePayfieldset ) { 316 return; 317 } 314 318 applePayfieldset.style.display = 'none'; 315 319 const applePayContainer = document.querySelector( '.wc_payment_method.payment_method_finix_apple_pay_gateway' ); … … 351 355 */ 352 356 jQuery( document ).on( 'change', 'input[name="payment_method"]', function () { 357 validateApplePayButtonVisibility(); 358 } ); 359 360 /** 361 * When the coupon code is applied or removed, the checkout total can be updated. 362 * We need to make sure we keep in sync our finix_apple_pay_params.amount value. 363 */ 364 jQuery( document ).on( 'updated_checkout', function () { 365 finix_apple_pay_params.amount = FinixHelpers.getUpdatedTotal(); 366 367 // Get order details via AJAX. 368 fetch( finix_apple_pay_params.url.ajax + '?action=get_order_tracking_details', { 369 method: 'POST', 370 headers: { 'Content-Type': 'application/json' }, 371 body: JSON.stringify( { nonce: finix_apple_pay_params.nonce } ), 372 } ) 373 .then( ( response ) => response.json() ) 374 .then( ( data ) => { 375 if ( data.success === true ) { 376 finix_apple_pay_params.subtotal = data.data.subtotal || finix_apple_pay_params.amount; 377 finix_apple_pay_params.shipping_amount = data.data.shipping_amount || 0; 378 finix_apple_pay_params.tax_amount = data.data.tax_amount || 0; 379 finix_apple_pay_params.products = data.data.products || []; 380 finix_apple_pay_params.coupons = data.data.coupons || []; 381 finix_apple_pay_params.currency_code = data.data.currency_code || finix_apple_pay_params.currency_code; 382 } 383 } ) 384 .catch( ( err ) => {} ); 385 386 addApplePayEventListener(); 387 } ); 388 389 function validateApplePayButtonVisibility() { 353 390 let placeOrderButton; 354 391 let applePayButton; … … 371 408 placeOrderButton.style.display = 'block'; 372 409 } 373 } ); 374 375 /** 376 * When the coupon code is applied or removed, the checkout total can be updated. 377 * We need to make sure we keep in sync our finix_apple_pay_params.amount value. 378 */ 379 jQuery( document ).on( 'updated_checkout', function () { 380 finix_apple_pay_params.amount = FinixHelpers.getUpdatedTotal(); 381 } ); 410 } 411 412 function addApplePayEventListener() { 413 const button = document.getElementById( 'finix-apple-pay-button' ); 414 415 if ( ! button || button.dataset.finixBound ) return; 416 417 button.addEventListener( 'click', () => { 418 419 const shippingData = retrieveShippingData(); 420 421 /* 422 * In the future update to a newer API version. 423 * This interface is created specifically outside of the promise. 424 * 425 * @see https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession 426 * @see https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_on_the_web_version_history 427 */ 428 429 let lineItems = []; 430 431 // Add product line items if value is not Zero. 432 Object.values( finix_apple_pay_params.products ).forEach( ( product ) => { 433 if ( parseFloat( product.total ) !== 0 ) { 434 lineItems.push( { 435 label: product.quantity > 1 ? `${ product.name } x${ product.quantity }` : product.name, 436 type: 'final', 437 amount: product.total, 438 } ); 439 } 440 } ); 441 442 lineItems.push( { 443 label: finix_apple_pay_params.text.subtotal, 444 type: 'final', 445 amount: finix_apple_pay_params.subtotal || finix_apple_pay_params.amount, 446 } ); 447 448 // Add any offer details to the transaction info. 449 lineItems.push( 450 ...finix_apple_pay_params.coupons.map( ( offer ) => ( { 451 label: finix_apple_pay_params.text.discount_code + ' ' + offer.code, 452 type: 'final', 453 amount: -1 * parseFloat( offer.total ).toFixed( 2 ), // Ensure negative value for discounts. 454 } ) ) 455 ); 456 457 // Add Shipping if it is not zero. 458 if ( finix_apple_pay_params.shipping_amount > 0 ) { 459 lineItems.push( { 460 label: finix_apple_pay_params.text.shipping, 461 type: 'final', 462 amount: finix_apple_pay_params.shipping_amount, 463 } ); 464 } 465 466 // Add Tax if it is not zero. 467 if ( finix_apple_pay_params.tax_amount > 0 ) { 468 lineItems.push( { 469 label: finix_apple_pay_params.text.tax, 470 type: 'final', 471 amount: finix_apple_pay_params.tax_amount, 472 } ); 473 } 474 475 const applePayParameters = { 476 countryCode: finix_apple_pay_params.merchant_country, 477 currencyCode: finix_apple_pay_params.currency_code, 478 merchantCapabilities: [ 'supports3DS' ], 479 supportedNetworks: [ 'visa', 'masterCard', 'amex', 'discover' ], 480 total: { 481 label: finix_apple_pay_params.merchant_name, 482 amount: finix_apple_pay_params.amount, 483 }, 484 lineItems: lineItems, 485 }; 486 487 const applePaySession = new window.ApplePaySession( 10, applePayParameters ); 488 489 validateShippingData( shippingData ).then( ( validShippingResult ) => { 490 if ( validShippingResult ) { 491 beginFinixApplePaySession( applePaySession ); 492 } 493 } ); 494 495 return false; 496 } ); 497 498 button.dataset.finixBound = '1'; 499 } 382 500 383 501 /** … … 385 503 */ 386 504 const applePayTimer = setTimeout( () => { 387 const button = document.getElementById( 'finix-apple-pay-button' ); 388 389 if ( button ) { 390 button.addEventListener( 'click', () => { 391 const shippingData = retrieveShippingData(); 392 393 /* 394 * In the future update to a newer API version. 395 * This interface is created specifically outside of the promise. 396 * 397 * @see https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession 398 * @see https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_on_the_web_version_history 399 */ 400 const applePaySession = new window.ApplePaySession( 10, { 401 countryCode: finix_apple_pay_params.merchant_country, 402 currencyCode: finix_apple_pay_params.currency_code, 403 merchantCapabilities: [ 'supports3DS' ], 404 supportedNetworks: [ 'visa', 'masterCard', 'amex', 'discover' ], 405 total: { 406 label: finix_apple_pay_params.merchant_name, 407 amount: finix_apple_pay_params.amount, 408 }, 409 } ); 410 411 validateShippingData( shippingData ).then( ( validShippingResult ) => { 412 if ( validShippingResult ) { 413 beginFinixApplePaySession( applePaySession ); 414 } 415 } ); 416 417 return false; 418 } ); 419 420 clearTimeout( applePayTimer ); 421 } 422 }, 1000 ); 505 validateApplePayButtonVisibility(); 506 addApplePayEventListener(); 507 clearTimeout( applePayTimer ); 508 }, 2000 ); 423 509 } ); -
finix-for-woocommerce/trunk/assets/js/shortcode-apple-pay.min.js
r3316914 r3375717 1 function nonEmptyValue(e){return null!=e&&""!==e&&""!==e.trim()}function triggerApplePaySubmitError(e){var a=jQuery("form.woocommerce-checkout, form#order_review");void 0!==e&&0!==e.length||(e='<div class="woocommerce-error">'+finix_params.text.error_processing+"</div>"),jQuery(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message, .is-error, .is-success").remove(),a.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+e+"</div>"),a.removeClass("processing").unblock(),a.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur");let t=jQuery(".woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout");t.length||(t=a),jQuery.scroll_to_notices(t),a.find('.woocommerce-error[tabindex="-1"], .wc-block-components-notice-banner.is-error[tabindex="-1"]').trigger("focus"),jQuery(document.body).trigger("checkout_error",[e])}function validateWhetherApplePaySelected(){var e;jQuery('input[name="payment_method"]:checked').val()===finix_apple_pay_params.gateway&&((e=document.querySelector("#finix-apple-pay-button"))&&"block"!==e.style.display&&(e.style.display="block"),e=document.querySelector("#place_order"))&&!e.classList.contains("finix-hide-place-order")&&e.classList.add("finix-hide-place-order")}function beginFinixApplePaySession(i){i.onvalidatemerchant=function(e){try{var a;e.validationURL?(a={provider:"APPLE_PAY",validation_url:e.validationURL,merchant_identity:finix_apple_pay_params.merchant_identity,domain_name:window.location.hostname,display_name:finix_apple_pay_params.merchant_name,session_request:!0,wp_nonce:finix_apple_pay_params.nonce},fetch(finix_apple_pay_params.url.webhook,{method:"POST",body:JSON.stringify(a),headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{var e=e?.response?.session_details||"";e?(e=JSON.parse(e),i.completeMerchantValidation(e)):triggerApplePaySubmitError()})):triggerApplePaySubmitError()}catch(e){throw e}},i.onpaymentauthorized=function(e){try{var a,t=e.payment;t?(a={provider:"APPLE_PAY",payment_token:JSON.stringify(t),process_payment:!0,merchant_identity:finix_apple_pay_params.merchant_identity,wp_nonce:finix_apple_pay_params.nonce,billing_info:retrieveBillingData()},document.querySelector("#finix_apple_pay_order_id")&&document.querySelector("#finix_apple_pay_order_key")&&(a.order_id=document.querySelector("#finix_apple_pay_order_id").value,a.order_key=document.querySelector("#finix_apple_pay_order_key").value),fetch(finix_apple_pay_params.url.webhook,{method:"POST",body:JSON.stringify(a),headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{201===e.status?(i.completePayment(i.STATUS_SUCCESS),document.querySelector("#finix_apple_pay_success").value="true",document.querySelector("#finix_apple_pay_transaction_id").value=e.response.id,jQuery("form.woocommerce-checkout, form#order_review").trigger("submit")):(triggerApplePaySubmitError(),i.completePayment(i.STATUS_FAILURE),document.querySelector("#finix_apple_pay_success").value=!1)}).catch(e=>{triggerApplePaySubmitError(),i.completePayment(i.STATUS_FAILURE),document.querySelector("#finix_apple_pay_success").value=!1})):i.completePayment(i.STATUS_FAILURE)}catch(e){throw e}},i.oncancel=function(e){},i.begin()}function retrieveBillingData(){let e={};return document.querySelector("#billing_country")&&document.querySelector("#billing_email")?(e={first_name:document.querySelector("#billing_first_name")?.value||"",last_name:document.querySelector("#billing_last_name")?.value||"",address1:document.querySelector("#billing_address_1")?.value||"",city:document.querySelector("#billing_city")?.value||"",postcode:document.querySelector("#billing_postcode")?.value||"",country:document.querySelector("#billing_country")?.value||"",state:"hidden"!==document.querySelector("#billing_state")?.type&&document.querySelector("#billing_state")?.value||"",email:document.querySelector("#billing_email")?.value||""},document.querySelector("#billing_phone")?.closest("p.form-row")?.classList.contains("validate-required")&&(e.phone=document.querySelector("#billing_phone")?.value||"")):e={first_name:finix_apple_pay_params.billing_data.first_name,last_name:finix_apple_pay_params.billing_data.last_name,address1:finix_apple_pay_params.billing_data.address_1,city:finix_apple_pay_params.billing_data.city,postcode:finix_apple_pay_params.billing_data.postcode,country:finix_apple_pay_params.billing_data.country,state:finix_apple_pay_params.billing_data.state,email:finix_apple_pay_params.billing_data.email,phone:finix_apple_pay_params.billing_data.phone},e}function retrieveShippingData(){var e,a,t,i, r,n=retrieveBillingData();return""===n.address1||""===n.city||"US"===n.country&&""===n.state||""===n.postcode||""===n.country?(triggerApplePaySubmitError('<div class="woocommerce-error">'+finix_apple_pay_params.text.error_billing+"</div>"),!1):(e=document.querySelector("#shipping_country")?.value||"",a=document.querySelector("#shipping_state")?.value||"",t=document.querySelector("#shipping_postcode")?.value||"",i=document.querySelector("#shipping_city")?.value||"",r=document.querySelector("#shipping_address_1")?.value||"",n={shipping_country:n.country,shipping_state:n.state,shipping_postcode:n.postcode,shipping_city:n.city,shipping_address_1:n.address1},nonEmptyValue(e)&&(n.shipping_country=e),nonEmptyValue(a)&&(n.shipping_state=a),nonEmptyValue(t)&&(n.shipping_postcode=t),nonEmptyValue(i)&&(n.shipping_city=i),nonEmptyValue(r)&&(n.shipping_address_1=r),n)}function validateShippingData(e){return new Promise(a=>{e.nonce=finix_apple_pay_params.nonce,fetch(finix_apple_pay_params.url.ajax+"?action=validate_shipping_method",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.json()).then(e=>{!0===e.success?a(!0):(triggerApplePaySubmitError('<div class="woocommerce-error">'+e.data.message+"</div>"),a(!1))}).catch(()=>a(!1))})}jQuery(function(){var e;if(window.ApplePaySession&&window.ApplePaySession.canMakePayments()&&window.ApplePaySession.supportsVersion(10)){if(jQuery("form.woocommerce-checkout, form#order_review").length){let e=0,a=setInterval(function(){e++,validateWhetherApplePaySelected(),5<=e&&clearInterval(a)},1e3),t=(jQuery(document).on("change",'input[name="payment_method"]',function(){let e,a;jQuery('input[name="payment_method"]:checked').val()===finix_apple_pay_params.gateway?((a=document.querySelector("#finix-apple-pay-button")).style.display="block",(e=document.querySelector("#place_order")).classList.add("finix-hide-place-order"),e.style.display="none"):((a=document.querySelector("#finix-apple-pay-button")).style.display="none",(e=document.querySelector("#place_order")).classList.remove("finix-hide-place-order"),e.style.display="block")}),jQuery(document).on("updated_checkout",function(){finix_apple_pay_params.amount=FinixHelpers.getUpdatedTotal()}),setTimeout(()=>{var e=document.getElementById("finix-apple-pay-button");e&&(e.addEventListener("click",()=>{var e=retrieveShippingData();let a=new window.ApplePaySession(10,{countryCode:finix_apple_pay_params.merchant_country,currencyCode:finix_apple_pay_params.currency_code,merchantCapabilities:["supports3DS"],supportedNetworks:["visa","masterCard","amex","discover"],total:{label:finix_apple_pay_params.merchant_name,amount:finix_apple_pay_params.amount}});return validateShippingData(e).then(e=>{e&&beginFinixApplePaySession(a)}),!1}),clearTimeout(t))},1e3))}}else document.querySelector("fieldset#wc-finix_apple_pay_gateway-form").style.display="none",document.querySelector(".wc_payment_method.payment_method_finix_apple_pay_gateway").style.display="none",(e=document.querySelector("#finix-apple-pay-button"))&&(e.style.display="none")});1 function nonEmptyValue(e){return null!=e&&""!==e&&""!==e.trim()}function triggerApplePaySubmitError(e){var a=jQuery("form.woocommerce-checkout, form#order_review");void 0!==e&&0!==e.length||(e='<div class="woocommerce-error">'+finix_params.text.error_processing+"</div>"),jQuery(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message, .is-error, .is-success").remove(),a.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+e+"</div>"),a.removeClass("processing").unblock(),a.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur");let t=jQuery(".woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout");t.length||(t=a),jQuery.scroll_to_notices(t),a.find('.woocommerce-error[tabindex="-1"], .wc-block-components-notice-banner.is-error[tabindex="-1"]').trigger("focus"),jQuery(document.body).trigger("checkout_error",[e])}function validateWhetherApplePaySelected(){var e;jQuery('input[name="payment_method"]:checked').val()===finix_apple_pay_params.gateway&&((e=document.querySelector("#finix-apple-pay-button"))&&"block"!==e.style.display&&(e.style.display="block"),e=document.querySelector("#place_order"))&&!e.classList.contains("finix-hide-place-order")&&e.classList.add("finix-hide-place-order")}function beginFinixApplePaySession(i){i.onvalidatemerchant=function(e){try{var a;e.validationURL?(a={provider:"APPLE_PAY",validation_url:e.validationURL,merchant_identity:finix_apple_pay_params.merchant_identity,domain_name:window.location.hostname,display_name:finix_apple_pay_params.merchant_name,session_request:!0,wp_nonce:finix_apple_pay_params.nonce},fetch(finix_apple_pay_params.url.webhook,{method:"POST",body:JSON.stringify(a),headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{var e=e?.response?.session_details||"";e?(e=JSON.parse(e),i.completeMerchantValidation(e)):triggerApplePaySubmitError()})):triggerApplePaySubmitError()}catch(e){throw e}},i.onpaymentauthorized=function(e){try{var a,t=e.payment;t?(a={provider:"APPLE_PAY",payment_token:JSON.stringify(t),process_payment:!0,merchant_identity:finix_apple_pay_params.merchant_identity,wp_nonce:finix_apple_pay_params.nonce,billing_info:retrieveBillingData()},document.querySelector("#finix_apple_pay_order_id")&&document.querySelector("#finix_apple_pay_order_key")&&(a.order_id=document.querySelector("#finix_apple_pay_order_id").value,a.order_key=document.querySelector("#finix_apple_pay_order_key").value),fetch(finix_apple_pay_params.url.webhook,{method:"POST",body:JSON.stringify(a),headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{201===e.status?(i.completePayment(i.STATUS_SUCCESS),document.querySelector("#finix_apple_pay_success").value="true",document.querySelector("#finix_apple_pay_transaction_id").value=e.response.id,jQuery("form.woocommerce-checkout, form#order_review").trigger("submit")):(triggerApplePaySubmitError(),i.completePayment(i.STATUS_FAILURE),document.querySelector("#finix_apple_pay_success").value=!1)}).catch(e=>{triggerApplePaySubmitError(),i.completePayment(i.STATUS_FAILURE),document.querySelector("#finix_apple_pay_success").value=!1})):i.completePayment(i.STATUS_FAILURE)}catch(e){throw e}},i.oncancel=function(e){},i.begin()}function retrieveBillingData(){let e={};return document.querySelector("#billing_country")&&document.querySelector("#billing_email")?(e={first_name:document.querySelector("#billing_first_name")?.value||"",last_name:document.querySelector("#billing_last_name")?.value||"",address1:document.querySelector("#billing_address_1")?.value||"",city:document.querySelector("#billing_city")?.value||"",postcode:document.querySelector("#billing_postcode")?.value||"",country:document.querySelector("#billing_country")?.value||"",state:"hidden"!==document.querySelector("#billing_state")?.type&&document.querySelector("#billing_state")?.value||"",email:document.querySelector("#billing_email")?.value||""},document.querySelector("#billing_phone")?.closest("p.form-row")?.classList.contains("validate-required")&&(e.phone=document.querySelector("#billing_phone")?.value||"")):e={first_name:finix_apple_pay_params.billing_data.first_name,last_name:finix_apple_pay_params.billing_data.last_name,address1:finix_apple_pay_params.billing_data.address_1,city:finix_apple_pay_params.billing_data.city,postcode:finix_apple_pay_params.billing_data.postcode,country:finix_apple_pay_params.billing_data.country,state:finix_apple_pay_params.billing_data.state,email:finix_apple_pay_params.billing_data.email,phone:finix_apple_pay_params.billing_data.phone},e}function retrieveShippingData(){var e,a,t,i,n,p=retrieveBillingData();return""===p.address1||""===p.city||"US"===p.country&&""===p.state||""===p.postcode||""===p.country?(triggerApplePaySubmitError('<div class="woocommerce-error">'+finix_apple_pay_params.text.error_billing+"</div>"),!1):(e=document.querySelector("#shipping_country")?.value||"",a=document.querySelector("#shipping_state")?.value||"",t=document.querySelector("#shipping_postcode")?.value||"",i=document.querySelector("#shipping_city")?.value||"",n=document.querySelector("#shipping_address_1")?.value||"",p={shipping_country:p.country,shipping_state:p.state,shipping_postcode:p.postcode,shipping_city:p.city,shipping_address_1:p.address1},nonEmptyValue(e)&&(p.shipping_country=e),nonEmptyValue(a)&&(p.shipping_state=a),nonEmptyValue(t)&&(p.shipping_postcode=t),nonEmptyValue(i)&&(p.shipping_city=i),nonEmptyValue(n)&&(p.shipping_address_1=n),p)}function validateShippingData(e){return new Promise(a=>{e.nonce=finix_apple_pay_params.nonce,fetch(finix_apple_pay_params.url.ajax+"?action=validate_shipping_method",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.json()).then(e=>{!0===e.success?a(!0):(triggerApplePaySubmitError('<div class="woocommerce-error">'+e.data.message+"</div>"),a(!1))}).catch(()=>a(!1))})}jQuery(function(){if(window.ApplePaySession&&window.ApplePaySession.canMakePayments()&&window.ApplePaySession.supportsVersion(10)){if(jQuery("form.woocommerce-checkout, form#order_review").length){let e=0,a=setInterval(function(){e++,validateWhetherApplePaySelected(),5<=e&&clearInterval(a)},1e3),t=(jQuery(document).on("change",'input[name="payment_method"]',function(){i()}),jQuery(document).on("updated_checkout",function(){finix_apple_pay_params.amount=FinixHelpers.getUpdatedTotal(),fetch(finix_apple_pay_params.url.ajax+"?action=get_order_tracking_details",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nonce:finix_apple_pay_params.nonce})}).then(e=>e.json()).then(e=>{!0===e.success&&(finix_apple_pay_params.subtotal=e.data.subtotal||finix_apple_pay_params.amount,finix_apple_pay_params.shipping_amount=e.data.shipping_amount||0,finix_apple_pay_params.tax_amount=e.data.tax_amount||0,finix_apple_pay_params.products=e.data.products||[],finix_apple_pay_params.coupons=e.data.coupons||[],finix_apple_pay_params.currency_code=e.data.currency_code||finix_apple_pay_params.currency_code)}).catch(e=>{}),n()}),setTimeout(()=>{i(),n(),clearTimeout(t)},2e3));function i(){let e,a;jQuery('input[name="payment_method"]:checked').val()===finix_apple_pay_params.gateway?((a=document.querySelector("#finix-apple-pay-button")).style.display="block",(e=document.querySelector("#place_order")).classList.add("finix-hide-place-order"),e.style.display="none"):((a=document.querySelector("#finix-apple-pay-button")).style.display="none",(e=document.querySelector("#place_order")).classList.remove("finix-hide-place-order"),e.style.display="block")}function n(){var e=document.getElementById("finix-apple-pay-button");e&&!e.dataset.finixBound&&(e.addEventListener("click",()=>{var e=retrieveShippingData();let a=[];Object.values(finix_apple_pay_params.products).forEach(e=>{0!==parseFloat(e.total)&&a.push({label:1<e.quantity?e.name+" x"+e.quantity:e.name,type:"final",amount:e.total})}),a.push({label:finix_apple_pay_params.text.subtotal,type:"final",amount:finix_apple_pay_params.subtotal||finix_apple_pay_params.amount}),a.push(...finix_apple_pay_params.coupons.map(e=>({label:finix_apple_pay_params.text.discount_code+" "+e.code,type:"final",amount:-1*parseFloat(e.total).toFixed(2)}))),0<finix_apple_pay_params.shipping_amount&&a.push({label:finix_apple_pay_params.text.shipping,type:"final",amount:finix_apple_pay_params.shipping_amount}),0<finix_apple_pay_params.tax_amount&&a.push({label:finix_apple_pay_params.text.tax,type:"final",amount:finix_apple_pay_params.tax_amount});var t={countryCode:finix_apple_pay_params.merchant_country,currencyCode:finix_apple_pay_params.currency_code,merchantCapabilities:["supports3DS"],supportedNetworks:["visa","masterCard","amex","discover"],total:{label:finix_apple_pay_params.merchant_name,amount:finix_apple_pay_params.amount},lineItems:a};let i=new window.ApplePaySession(10,t);return validateShippingData(e).then(e=>{e&&beginFinixApplePaySession(i)}),!1}),e.dataset.finixBound="1")}}}else{var e=document.querySelector("fieldset#wc-finix_apple_pay_gateway-form");e&&(e.style.display="none",document.querySelector(".wc_payment_method.payment_method_finix_apple_pay_gateway").style.display="none",e=document.querySelector("#finix-apple-pay-button"))&&(e.style.display="none")}}); -
finix-for-woocommerce/trunk/assets/js/shortcode-card-bank.js
r3316914 r3375717 48 48 borderRadius: `${ referenceInput.css( 'border-top-left-radius' ) } ${ referenceInput.css( 'border-top-right-radius' ) } ${ referenceInput.css( 'border-bottom-right-radius' ) } ${ referenceInput.css( 'border-bottom-left-radius' ) }`, 49 49 fontFamily: referenceInput.css( 'font-family' ), 50 fontSize: referenceInput.css( 'font-size' ),50 // fontSize: referenceInput.css( 'font-size' ), 51 51 fontWeight: referenceInput.css( 'font-weight' ), 52 52 lineHeight: referenceInput.css( 'line-height' ), 53 53 boxShadow: referenceInput.css( 'box-shadow' ), 54 padding: `${ referenceInput.css( 'padding-bottom' ) } ${ referenceInput.css( 'padding-right' ) } ${ referenceInput.css( 'padding-bottom' ) } ${ referenceInput.css( 'padding-left' ) }`,54 // padding: `${ referenceInput.css( 'padding-bottom' ) } ${ referenceInput.css( 'padding-right' ) } ${ referenceInput.css( 'padding-bottom' ) } ${ referenceInput.css( 'padding-left' ) }`, 55 55 maxHeight: '100%', 56 height: '100%', 56 57 appearance: 'auto', 57 58 }; … … 87 88 jQuery.scroll_to_notices( scrollElement ); 88 89 89 checkoutForm.find( '.woocommerce-error[tabindex="-1"], .wc-block-components-notice-banner.is-error[tabindex="-1"]' ). focus();90 checkoutForm.find( '.woocommerce-error[tabindex="-1"], .wc-block-components-notice-banner.is-error[tabindex="-1"]' ).trigger( 'focus' ); 90 91 jQuery( document.body ).trigger( 'checkout_error', [ errorMessage ] ); 91 92 } 92 93 93 94 // Modify the tokenRequest function to accept successCallback and errorCallback as parameters. 94 async function tokenRequest( form ) {95 async function tokenRequest( form, selected_payment_method ) { 95 96 // Disable the place_order button to prevent multiple submissions. 96 97 document.getElementById( 'place_order' ).disabled = true; … … 102 103 // Handle error. 103 104 triggerFinixSubmitError(); 104 document.getElementById( 'finix_token' ).value = '';105 document.getElementById( selected_payment_method + '_token' ).value = ''; 105 106 document.getElementById( 'place_order' ).disabled = false; 107 106 108 // Reject the promise with the error. 107 109 reject( err ); … … 110 112 const tokenData = res.data || {}; 111 113 const token = tokenData.id; 114 112 115 // Handle success. 113 document.getElementById( 'finix_token' ).value = token;116 document.getElementById( selected_payment_method + '_token' ).value = token; 114 117 document.getElementById( 'place_order' ).disabled = false; 118 115 119 // Resolve the promise with the token. 116 120 resolve( token ); … … 121 125 122 126 /** 123 * Request from Finix JS library to generate and embed the Finix payment form. 127 * Request from the Finix JS library to generate and embed the Finix payment form. 128 * 129 * @param {string} identifier - The identifier of the payment method. 124 130 * 125 131 * @returns {object|null} 126 132 */ 127 function initFinixForm() { 128 const formIdentifier = 'finix-form'; 129 const formContent = document.getElementById( formIdentifier ).innerHTML; 133 function initFinixForm( identifier ) { 134 const formContent = document.getElementById( identifier + '-form' ).innerHTML; 130 135 131 136 if ( formContent === '' ) { 132 let form; 133 134 switch ( finix_params.payment_method ) { 135 case 'card': 136 form = window.Finix.CardTokenForm( formIdentifier, FinixFormOptions ); 137 break; 138 case 'ach': 139 form = window.Finix.BankTokenForm( formIdentifier, FinixFormOptions ); 140 break; 141 default: 142 form = window.Finix.TokenForm( formIdentifier, FinixFormOptions ); 143 break; 144 } 145 146 return form; 137 switch ( identifier ) { 138 case 'finix_gateway': 139 finix_params.finixForms.finix_gateway = window.Finix.CardTokenForm( identifier + '-form', FinixFormOptions ); 140 return finix_params.finixForms.finix_gateway; 141 142 case 'finix_bank_gateway': 143 finix_params.finixForms.finix_bank_gateway = window.Finix.BankTokenForm( identifier + '-form', FinixFormOptions ); 144 return finix_params.finixForms.finix_bank_gateway; 145 } 147 146 } 148 147 … … 157 156 * 158 157 * @param {object} checkoutForm jQuery-fused object of the checkout form. 159 * @param {object} finixForm Finix form object with methods to submit Finix form. 160 */ 161 function processPlaceOrder( checkoutForm, finixForm ) { 158 */ 159 function processPlaceOrder( checkoutForm ) { 162 160 jQuery( document ).on( 'click', '#place_order', async function ( event ) { 163 161 const selected_payment_method = jQuery( 'input[name="payment_method"]:checked', checkoutForm ).val(); 164 162 165 if ( selected_payment_method !== finix_params.gateway) {163 if ( ! [ 'finix_gateway', 'finix_bank_gateway' ].includes( selected_payment_method ) ) { 166 164 return true; 165 } 166 167 let currentFinixForm; 168 169 switch ( selected_payment_method ) { 170 case 'finix_gateway': 171 currentFinixForm = finix_params.finixForms.finix_gateway; 172 break; 173 case 'finix_bank_gateway': 174 currentFinixForm = finix_params.finixForms.finix_bank_gateway; 175 break; 167 176 } 168 177 … … 172 181 173 182 // We don't have a token. 174 if ( ! checkoutForm.find( '# finix_token' ).val() ) {183 if ( ! checkoutForm.find( '#' + selected_payment_method + '_token' ).val() ) { 175 184 try { 176 185 // Wait until the token request finishes. 177 let token = await tokenRequest( finixForm);186 let token = await tokenRequest( currentFinixForm, selected_payment_method ); 178 187 179 188 if ( token ) { … … 183 192 } catch ( error ) { 184 193 // Make sure the token is empty. 185 checkoutForm.find( '#finix_token' ).val( '' ); 194 checkoutForm.find( '#' + selected_payment_method + '_token' ).val( '' ); 195 196 triggerFinixSubmitError(); 197 document.getElementById( 'place_order' ).disabled = false; 186 198 187 199 return false; … … 215 227 // Initialize the Finix Auth session together with our nonce. 216 228 window.Finix.Auth( finix_params.environment, finix_params.merchant, ( sessionKey ) => { 229 const fraudInput = jQuery( '#finix_fraud_session_id', checkoutForm ); 230 if ( ! fraudInput.length ) { 231 checkoutForm.prepend( '<input type="hidden" id="finix_fraud_session_id" name="finix_fraud_session_id" value=""/>' ); 232 } 217 233 checkoutForm.find( '#finix_fraud_session_id' ).val( sessionKey ); 234 235 const nonceInput = jQuery( '#finix_nonce', checkoutForm ); 236 if ( ! nonceInput.length ) { 237 checkoutForm.prepend( '<input type="hidden" id="finix_nonce" name="finix_nonce" value=""/>' ); 238 } 218 239 checkoutForm.find( '#finix_nonce' ).val( finix_params.nonce ); 219 240 } ); 220 241 221 let finixForm; 222 let formLoaded = false; 223 224 // Set the timer to retrieve the finixForm up until we successfully get it. 225 const timer = setInterval( () => { 226 finixForm = initFinixForm(); 227 228 if ( finixForm !== null && typeof finixForm.submit === 'function' ) { 229 jQuery( '#finix-form-container iframe' ).css( 'height', checkoutForm.find( '#billing_city' ).outerHeight() + 'px' ); 230 231 processPlaceOrder( checkoutForm, finixForm ); 232 233 // If the Finix form is already loaded, we can stop the timer in next step. (that gives some time in case the checkout is reloaded) 234 formLoaded = true; 235 } else if ( formLoaded ) { 236 // If the form is already loaded, we can stop the timer. 237 clearInterval( timer ); 238 } 239 }, 2000 ); 240 241 // The form submission may fail, we need to listed to that event and clear the token 242 finix_params.finixForms = finix_params.finixForms || {}; 243 244 const customIframeHeight = ` 245 <style id="test"> 246 #finix_gateway-form .finix-form-container iframe, 247 #finix_bank_gateway-form .finix-form-container iframe { 248 height: ${ checkoutForm.find( '#billing_city' ).outerHeight() }px !important; 249 </style> 250 `; 251 252 checkoutForm.prepend( customIframeHeight ); 253 254 /* 255 * Here we are generating Finix forms separately for Card and Bank payment gateways. 256 * We do that only if the relevant payment gateway is enabled and thus - present in DOM. 257 */ 258 if ( document.getElementById( 'finix_gateway-form' ) ) { 259 let cardFormLoaded = false; 260 261 // Set the timer to retrieve the finixForm up until we successfully get it. 262 const cardFormTimer = setInterval( () => { 263 initFinixForm( 'finix_gateway' ); 264 265 if ( finix_params.finixForms.finix_gateway !== null && typeof finix_params.finixForms.finix_gateway.submit === 'function' ) { 266 processPlaceOrder( checkoutForm ); 267 268 // If the Finix form is already loaded, we can stop the timer in the next step 269 // (that gives some time in case the checkout is reloaded). 270 cardFormLoaded = true; 271 } else if ( cardFormLoaded ) { 272 // If the form is already loaded, we can stop the timer. 273 clearInterval( cardFormTimer ); 274 } 275 }, 2000 ); 276 } 277 if ( document.getElementById( 'finix_bank_gateway-form' ) ) { 278 let bankFormLoaded = false; 279 280 // Set the timer to retrieve the finixForm up until we successfully get it. 281 const bankFormTimer = setInterval( () => { 282 initFinixForm( 'finix_bank_gateway' ); 283 284 if ( finix_params.finixForms.finix_bank_gateway !== null && typeof finix_params.finixForms.finix_bank_gateway.submit === 'function' ) { 285 processPlaceOrder( checkoutForm ); 286 287 // If the Finix form is already loaded, we can stop the timer in the next step 288 // (that gives some time in case the checkout is reloaded). 289 bankFormLoaded = true; 290 } else if ( bankFormLoaded ) { 291 // If the form is already loaded, we can stop the timer. 292 clearInterval( bankFormTimer ); 293 } 294 }, 2000 ); 295 } 296 297 // The form submission may fail, we need to listen to that event and clear the token, 242 298 // so Finix will re-request it. 243 299 jQuery( document.body ).on( 'checkout_error', function ( event, data ) { 244 document.getElementById( 'finix_token' ).value = ''; 300 document.getElementById( 'finix_gateway_token' ).value = ''; 301 document.getElementById( 'finix_bank_gateway_token' ).value = ''; 245 302 } ); 246 303 } ); -
finix-for-woocommerce/trunk/assets/js/shortcode-card-bank.min.js
r3316914 r3375717 1 let FinixFormOptions={showAddress:!!finix_params.finix_form_options.showAddress,showLabels:!!finix_params.finix_form_options.showLabels,labels:finix_params.finix_form_options.labels||{name:finix_params.text.full_name},showPlaceholders:!!finix_params.finix_form_options.showPlaceholders,placeholders:finix_params.finix_form_options.placeholders||{name:finix_params.text.full_name},hideFields:finix_params.finix_form_options.hideFields||["address_line1","address_line2","address_city","address_state"],requiredFields:finix_params.finix_form_options.requiredFields||["name","address_country","address_postal_code"],hideErrorMessages:!!finix_params.finix_form_options.hideErrorMessages,errorMessages:finix_params.finix_form_options.errorMessages||{name:finix_params.text.error_messages.name,address_city:finix_params.text.error_messages.address_city},styles:{default:{},success:{},error:{color:"#e2401c",boxShadow:"inset 2px 0 0 #e2401c"}},onUpdate(e,i,o){},onLoad(){}};function copyWooInputStylesToFinix(){var e=jQuery("input#billing_city, input#shipping_city");return FinixFormOptions.styles.default={color:e.css("color"),backgroundColor:e.css("background-color"),border:`${e.css("border-width")} ${e.css("border-style")} `+e.css("border-color"),borderRadius:`${e.css("border-top-left-radius")} ${e.css("border-top-right-radius")} ${e.css("border-bottom-right-radius")} `+e.css("border-bottom-left-radius"),fontFamily:e.css("font-family"),fontSize:e.css("font-size"),fontWeight:e.css("font-weight"),lineHeight:e.css("line-height"),boxShadow:e.css("box-shadow"),padding:`${e.css("padding-bottom")} ${e.css("padding-right")} ${e.css("padding-bottom")} `+e.css("padding-left"),maxHeight:"100%",appearance:"auto"},FinixFormOptions}function triggerFinixSubmitError(e){var i=jQuery("form.woocommerce-checkout, form#order_review");void 0!==e&&0!==e.length||(e='<div class="woocommerce-error">'+wc_checkout_params.i18n_checkout_error+"</div>"),jQuery(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message, .is-error, .is-success").remove(),i.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+e+"</div>"),i.removeClass("processing").unblock(),i.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur");let o=jQuery(".woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout");o.length||(o=i),jQuery.scroll_to_notices(o),i.find('.woocommerce-error[tabindex="-1"], .wc-block-components-notice-banner.is-error[tabindex="-1"]').focus(),jQuery(document.body).trigger("checkout_error",[e])}async function tokenRequest(e){return document.getElementById("place_order").disabled=!0,new Promise((o,r)=>{e.submit(finix_params.environment,finix_params.application,function(e,i){e?(triggerFinixSubmitError(),document.getElementById("finix_token").value="",document.getElementById("place_order").disabled=!1,r(e)):(e=(i.data||{}).id,document.getElementById("finix_token").value=e,document.getElementById("place_order").disabled=!1,o(e))})})}function initFinixForm(){var i="finix-form";if(""!==document.getElementById(i).innerHTML)return null;{let e;switch(finix_params.payment_method){case"card":e=window.Finix.CardTokenForm(i,FinixFormOptions);break;case"ach":e=window.Finix.BankTokenForm(i,FinixFormOptions);break;default:e=window.Finix.TokenForm(i,FinixFormOptions)}return e}}function processPlaceOrder(i,o){jQuery(document).on("click","#place_order",async function(e){if(jQuery('input[name="payment_method"]:checked',i).val()!==finix_params.gateway)return!0;if(e.preventDefault(),e.stopImmediatePropagation(),i.find("#finix_token").val())return i.trigger("submit"),!0;try{if(await tokenRequest(o))return i.trigger("submit"),!0}catch(e){return i.find("#finix_token").val(""),!1}})}jQuery(function(){let r=jQuery("form.woocommerce-checkout, form#order_review");if(r.length){copyWooInputStylesToFinix(),window.Finix.Auth(finix_params.environment,finix_params.merchant,e=>{r.find("#finix_fraud_session_id").val(e),r.find("#finix_nonce").val(finix_params.nonce)});let e,i=!1,o=setInterval(()=>{null!==(e=initFinixForm())&&"function"==typeof e.submit?(jQuery("#finix-form-container iframe").css("height",r.find("#billing_city").outerHeight()+"px"),processPlaceOrder(r,e),i=!0):i&&clearInterval(o)},2e3);jQuery(document.body).on("checkout_error",function(e,i){document.getElementById("finix_token").value=""})}}); 1 let FinixFormOptions={showAddress:!!finix_params.finix_form_options.showAddress,showLabels:!!finix_params.finix_form_options.showLabels,labels:finix_params.finix_form_options.labels||{name:finix_params.text.full_name},showPlaceholders:!!finix_params.finix_form_options.showPlaceholders,placeholders:finix_params.finix_form_options.placeholders||{name:finix_params.text.full_name},hideFields:finix_params.finix_form_options.hideFields||["address_line1","address_line2","address_city","address_state"],requiredFields:finix_params.finix_form_options.requiredFields||["name","address_country","address_postal_code"],hideErrorMessages:!!finix_params.finix_form_options.hideErrorMessages,errorMessages:finix_params.finix_form_options.errorMessages||{name:finix_params.text.error_messages.name,address_city:finix_params.text.error_messages.address_city},styles:{default:{},success:{},error:{color:"#e2401c",boxShadow:"inset 2px 0 0 #e2401c"}},onUpdate(e,i,r){},onLoad(){}};function copyWooInputStylesToFinix(){var e=jQuery("input#billing_city, input#shipping_city");return FinixFormOptions.styles.default={color:e.css("color"),backgroundColor:e.css("background-color"),border:`${e.css("border-width")} ${e.css("border-style")} `+e.css("border-color"),borderRadius:`${e.css("border-top-left-radius")} ${e.css("border-top-right-radius")} ${e.css("border-bottom-right-radius")} `+e.css("border-bottom-left-radius"),fontFamily:e.css("font-family"),fontWeight:e.css("font-weight"),lineHeight:e.css("line-height"),boxShadow:e.css("box-shadow"),maxHeight:"100%",height:"100%",appearance:"auto"},FinixFormOptions}function triggerFinixSubmitError(e){var i=jQuery("form.woocommerce-checkout, form#order_review");void 0!==e&&0!==e.length||(e='<div class="woocommerce-error">'+wc_checkout_params.i18n_checkout_error+"</div>"),jQuery(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message, .is-error, .is-success").remove(),i.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+e+"</div>"),i.removeClass("processing").unblock(),i.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur");let r=jQuery(".woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout");r.length||(r=i),jQuery.scroll_to_notices(r),i.find('.woocommerce-error[tabindex="-1"], .wc-block-components-notice-banner.is-error[tabindex="-1"]').trigger("focus"),jQuery(document.body).trigger("checkout_error",[e])}async function tokenRequest(e,o){return document.getElementById("place_order").disabled=!0,new Promise((r,n)=>{e.submit(finix_params.environment,finix_params.application,function(e,i){e?(triggerFinixSubmitError(),document.getElementById(o+"_token").value="",document.getElementById("place_order").disabled=!1,n(e)):(e=(i.data||{}).id,document.getElementById(o+"_token").value=e,document.getElementById("place_order").disabled=!1,r(e))})})}function initFinixForm(e){if(""===document.getElementById(e+"-form").innerHTML)switch(e){case"finix_gateway":return finix_params.finixForms.finix_gateway=window.Finix.CardTokenForm(e+"-form",FinixFormOptions),finix_params.finixForms.finix_gateway;case"finix_bank_gateway":return finix_params.finixForms.finix_bank_gateway=window.Finix.BankTokenForm(e+"-form",FinixFormOptions),finix_params.finixForms.finix_bank_gateway}return null}function processPlaceOrder(n){jQuery(document).on("click","#place_order",async function(e){var i=jQuery('input[name="payment_method"]:checked',n).val();if(!["finix_gateway","finix_bank_gateway"].includes(i))return!0;let r;switch(i){case"finix_gateway":r=finix_params.finixForms.finix_gateway;break;case"finix_bank_gateway":r=finix_params.finixForms.finix_bank_gateway}if(e.preventDefault(),e.stopImmediatePropagation(),n.find("#"+i+"_token").val())return n.trigger("submit"),!0;try{if(await tokenRequest(r,i))return n.trigger("submit"),!0}catch(e){return n.find("#"+i+"_token").val(""),triggerFinixSubmitError(),document.getElementById("place_order").disabled=!1}})}jQuery(function(){let r=jQuery("form.woocommerce-checkout, form#order_review");if(r.length){copyWooInputStylesToFinix(),window.Finix.Auth(finix_params.environment,finix_params.merchant,e=>{jQuery("#finix_fraud_session_id",r).length||r.prepend('<input type="hidden" id="finix_fraud_session_id" name="finix_fraud_session_id" value=""/>'),r.find("#finix_fraud_session_id").val(e);e=jQuery("#finix_nonce",r);e.length||r.prepend('<input type="hidden" id="finix_nonce" name="finix_nonce" value=""/>'),r.find("#finix_nonce").val(finix_params.nonce)}),finix_params.finixForms=finix_params.finixForms||{};var e=` 2 <style id="test"> 3 #finix_gateway-form .finix-form-container iframe, 4 #finix_bank_gateway-form .finix-form-container iframe { 5 height: ${r.find("#billing_city").outerHeight()}px !important; 6 </style> 7 `;if(r.prepend(e),document.getElementById("finix_gateway-form")){let e=!1,i=setInterval(()=>{initFinixForm("finix_gateway"),null!==finix_params.finixForms.finix_gateway&&"function"==typeof finix_params.finixForms.finix_gateway.submit?(processPlaceOrder(r),e=!0):e&&clearInterval(i)},2e3)}if(document.getElementById("finix_bank_gateway-form")){let e=!1,i=setInterval(()=>{initFinixForm("finix_bank_gateway"),null!==finix_params.finixForms.finix_bank_gateway&&"function"==typeof finix_params.finixForms.finix_bank_gateway.submit?(processPlaceOrder(r),e=!0):e&&clearInterval(i)},2e3)}jQuery(document.body).on("checkout_error",function(e,i){document.getElementById("finix_gateway_token").value="",document.getElementById("finix_bank_gateway_token").value=""})}}); -
finix-for-woocommerce/trunk/assets/languages/finix-for-woocommerce.pot
r3316914 r3375717 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Finix for WooCommerce 1. 2.0\n"5 "Project-Id-Version: Finix for WooCommerce 1.3.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/finix-for-woocommerce\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2025- 06-23T10:58:22+00:00\n"12 "POT-Creation-Date: 2025-10-09T12:02:03+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.12.0\n" … … 40 40 msgstr "" 41 41 42 #: src/Admin/Admin.php:4 642 #: src/Admin/Admin.php:48 43 43 msgid "Settings" 44 44 msgstr "" 45 45 46 46 #. translators: %s - current currency code. 47 #: src/Admin/Admin.php:7 147 #: src/Admin/Admin.php:73 48 48 #, php-format 49 49 msgid "Finix for WooCommerce does not currently support the currency of your store: %s." … … 51 51 52 52 #. translators: %s - supported currency codes. 53 #: src/Admin/Admin.php:8 153 #: src/Admin/Admin.php:83 54 54 #, php-format 55 55 msgid "<strong>All the payments will be declined.</strong> Supported currencies: %s." … … 77 77 #: src/Events/CardAchPaymentEvent.php:69 78 78 #: src/Events/CardAchPaymentEvent.php:97 79 #: src/Events/CardAchPaymentEvent.php:13 479 #: src/Events/CardAchPaymentEvent.php:136 80 80 #: src/Events/GooglePayPaymentCompletedEvent.php:38 81 81 msgid "Payment error: There was an error while processing your payment. Please try again." 82 82 msgstr "" 83 83 84 #: src/Events/ApplePayPaymentCompletedEvent.php: 6985 #: src/Events/ApplePayPaymentCompletedEvent.php:8 086 #: src/Events/ApplePayPaymentCompletedEvent.php:9 187 #: src/Events/ApplePayPaymentCompletedEvent.php:10 388 #: src/Events/GooglePayPaymentCompletedEvent.php: 6989 #: src/Events/GooglePayPaymentCompletedEvent.php:8 090 #: src/Events/GooglePayPaymentCompletedEvent.php:9 191 #: src/Events/GooglePayPaymentCompletedEvent.php:10 384 #: src/Events/ApplePayPaymentCompletedEvent.php:73 85 #: src/Events/ApplePayPaymentCompletedEvent.php:84 86 #: src/Events/ApplePayPaymentCompletedEvent.php:95 87 #: src/Events/ApplePayPaymentCompletedEvent.php:107 88 #: src/Events/GooglePayPaymentCompletedEvent.php:73 89 #: src/Events/GooglePayPaymentCompletedEvent.php:84 90 #: src/Events/GooglePayPaymentCompletedEvent.php:95 91 #: src/Events/GooglePayPaymentCompletedEvent.php:107 92 92 msgid "Payment error: There was an error while processing your payment. Please contact support if you were charged." 93 93 msgstr "" 94 94 95 #: src/Events/ApplePayPaymentCompletedEvent.php:1 0896 #: src/Events/GooglePayPaymentCompletedEvent.php:1 0895 #: src/Events/ApplePayPaymentCompletedEvent.php:112 96 #: src/Events/GooglePayPaymentCompletedEvent.php:112 97 97 msgid "Payment error: Could not validate payment. Amounts do not match." 98 98 msgstr "" 99 99 100 #: src/Events/ApplePayPaymentCompletedEvent.php:11 5100 #: src/Events/ApplePayPaymentCompletedEvent.php:119 101 101 msgid "Finix Apple Pay payment SUCCEEDED" 102 102 msgstr "" … … 116 116 #: src/Events/ApplePaySessionEvent.php:50 117 117 #: src/Events/GooglePayPaymentEvent.php:128 118 #: src/Gateways/ApplePayGateway.php:5 32119 #: src/Gateways/GooglePayGateway.php:47 2118 #: src/Gateways/ApplePayGateway.php:558 119 #: src/Gateways/GooglePayGateway.php:470 120 120 msgid "There was an error processing the payment." 121 121 msgstr "" … … 123 123 #: src/Events/ApplePayPaymentEvent.php:144 124 124 #: src/Events/GooglePayPaymentEvent.php:144 125 #: src/Gateways/ApplePayGateway.php: 479126 #: src/Gateways/ApplePayGateway.php: 489127 #: src/Gateways/GooglePayGateway.php:43 4128 #: src/Gateways/GooglePayGateway.php:44 4125 #: src/Gateways/ApplePayGateway.php:505 126 #: src/Gateways/ApplePayGateway.php:515 127 #: src/Gateways/GooglePayGateway.php:432 128 #: src/Gateways/GooglePayGateway.php:442 129 129 msgid "There was an error while processing the payment. Please try again later." 130 130 msgstr "" … … 166 166 167 167 #. translators: %s: Error message from Finix. 168 #: src/Events/CardAchPaymentEvent.php:10 3168 #: src/Events/CardAchPaymentEvent.php:105 169 169 #, php-format 170 170 msgid "Finix Payment method creation failed: %s" 171 171 msgstr "" 172 172 173 #: src/Events/CardAchPaymentEvent.php:11 2173 #: src/Events/CardAchPaymentEvent.php:114 174 174 msgid "Finix Payment method created successfully" 175 175 msgstr "" 176 176 177 177 #. translators: %s: Error message from Finix. 178 #: src/Events/CardAchPaymentEvent.php:14 2178 #: src/Events/CardAchPaymentEvent.php:144 179 179 #, php-format 180 180 msgid "Finix Payment error: %s" 181 181 msgstr "" 182 182 183 #: src/Events/CardAchPaymentEvent.php:16 1183 #: src/Events/CardAchPaymentEvent.php:163 184 184 msgid "Payment pending: There was an error while processing your payment. Please try again." 185 185 msgstr "" 186 186 187 #: src/Events/CardAchPaymentEvent.php:16 7187 #: src/Events/CardAchPaymentEvent.php:169 188 188 msgid "Awaiting payment confirmation from Finix." 189 189 msgstr "" 190 190 191 #: src/Events/CardAchPaymentEvent.php:17 7191 #: src/Events/CardAchPaymentEvent.php:179 192 192 msgid "Finix Payment processed successfully." 193 193 msgstr "" 194 194 195 #: src/Events/CardAchPaymentEvent.php:1 89195 #: src/Events/CardAchPaymentEvent.php:191 196 196 msgid "Payment failed: There was an error while processing your payment. Please try again." 197 197 msgstr "" 198 198 199 199 #. translators: %s: State of the payment. 200 #: src/Events/CardAchPaymentEvent.php:19 6200 #: src/Events/CardAchPaymentEvent.php:198 201 201 #, php-format 202 202 msgid "Finix Payment failed. State: %s" … … 211 211 msgstr "" 212 212 213 #: src/Events/GooglePayPaymentCompletedEvent.php:11 5213 #: src/Events/GooglePayPaymentCompletedEvent.php:119 214 214 msgid "Finix Google Pay payment SUCCEEDED" 215 215 msgstr "" … … 244 244 245 245 #: src/Gateways/ApplePayGateway.php:40 246 #: assets/js/block/src/apple-pay.js:1 3246 #: assets/js/block/src/apple-pay.js:15 247 247 msgid "Pay with Apple Pay" 248 248 msgstr "" 249 249 250 250 #: src/Gateways/ApplePayGateway.php:82 251 #: src/Gateways/CardBankGateway.php:87 252 #: src/Gateways/GooglePayGateway.php:83 251 #: src/Gateways/BankGateway.php:38 252 #: src/Gateways/CardGateway.php:47 253 #: src/Gateways/GooglePayGateway.php:81 253 254 msgid "General Settings" 254 255 msgstr "" 255 256 256 257 #: src/Gateways/ApplePayGateway.php:87 257 #: src/Gateways/CardBankGateway.php:92 258 #: src/Gateways/GooglePayGateway.php:88 258 #: src/Gateways/BankGateway.php:43 259 #: src/Gateways/CardGateway.php:52 260 #: src/Gateways/GooglePayGateway.php:86 259 261 msgid "Status" 260 262 msgstr "" … … 265 267 266 268 #: src/Gateways/ApplePayGateway.php:94 267 #: src/Gateways/CardBankGateway.php:99 269 #: src/Gateways/BankGateway.php:50 270 #: src/Gateways/CardGateway.php:59 271 #: src/Gateways/GooglePayGateway.php:93 272 msgid "Title" 273 msgstr "" 274 275 #: src/Gateways/ApplePayGateway.php:96 276 #: src/Gateways/BankGateway.php:52 277 #: src/Gateways/CardGateway.php:61 268 278 #: src/Gateways/GooglePayGateway.php:95 269 msgid "Title"270 msgstr ""271 272 #: src/Gateways/ApplePayGateway.php:96273 #: src/Gateways/CardBankGateway.php:101274 #: src/Gateways/GooglePayGateway.php:97275 279 msgid "This controls the title which the user sees during checkout." 276 280 msgstr "" 277 281 278 282 #: src/Gateways/ApplePayGateway.php:97 279 #: src/Gateways/FinixGateway.php:2 59283 #: src/Gateways/FinixGateway.php:262 280 284 msgid "Apple Pay" 281 285 msgstr "" 282 286 283 287 #: src/Gateways/ApplePayGateway.php:101 284 #: src/Gateways/CardBankGateway.php:118 288 #: src/Gateways/BankGateway.php:57 289 #: src/Gateways/CardGateway.php:66 290 #: src/Gateways/GooglePayGateway.php:100 291 msgid "Description" 292 msgstr "" 293 294 #: src/Gateways/ApplePayGateway.php:103 295 #: src/Gateways/BankGateway.php:59 296 #: src/Gateways/CardGateway.php:68 285 297 #: src/Gateways/GooglePayGateway.php:102 286 msgid "Description" 287 msgstr "" 288 289 #: src/Gateways/ApplePayGateway.php:103 290 #: src/Gateways/CardBankGateway.php:120 291 #: src/Gateways/GooglePayGateway.php:104 292 msgid "This controls the description which the user sees during checkout." 298 msgid "This controls the description which the user sees during checkout. It will be wrapped in the paragraph tag." 293 299 msgstr "" 294 300 … … 314 320 315 321 #: src/Gateways/ApplePayGateway.php:120 316 #: src/Gateways/GooglePayGateway.php:1 21322 #: src/Gateways/GooglePayGateway.php:119 317 323 msgid "Button Type" 318 324 msgstr "" … … 391 397 392 398 #: src/Gateways/ApplePayGateway.php:146 393 #: src/Gateways/GooglePayGateway.php:14 5399 #: src/Gateways/GooglePayGateway.php:143 394 400 msgid "Display Name" 395 401 msgstr "" … … 435 441 436 442 #: src/Gateways/ApplePayGateway.php:249 437 #: src/Gateways/ApplePayGateway.php:3 67438 #: src/Gateways/PaymentMethods/ApplePay.php:1 13443 #: src/Gateways/ApplePayGateway.php:393 444 #: src/Gateways/PaymentMethods/ApplePay.php:126 439 445 #: src/Gateways/PaymentMethods/GooglePay.php:131 440 446 msgid "Please enter a valid billing address." … … 442 448 443 449 #: src/Gateways/ApplePayGateway.php:262 444 #: src/Gateways/CardBankGateway.php: 162445 #: src/Gateways/GooglePayGateway.php:19 5450 #: src/Gateways/CardBankGateway.php:79 451 #: src/Gateways/GooglePayGateway.php:193 446 452 msgid "TEST MODE ENABLED. All the payments will go through the sandbox." 447 453 msgstr "" 448 454 449 #: src/Gateways/ApplePayGateway.php:3 66450 #: src/Gateways/ApplePayGateway.php:4 16451 #: src/Gateways/CardBankGateway.php: 195452 #: src/Gateways/GooglePayGateway.php:32 3453 #: src/Gateways/GooglePayGateway.php:38 5454 #: src/Gateways/PaymentMethods/ApplePay.php:1 12455 #: src/Gateways/ApplePayGateway.php:392 456 #: src/Gateways/ApplePayGateway.php:442 457 #: src/Gateways/CardBankGateway.php:60 458 #: src/Gateways/GooglePayGateway.php:321 459 #: src/Gateways/GooglePayGateway.php:383 460 #: src/Gateways/PaymentMethods/ApplePay.php:125 455 461 #: src/Gateways/PaymentMethods/GooglePay.php:130 456 462 msgid "There was an error while processing your payment. Please try again later." 457 463 msgstr "" 458 464 459 #: src/Gateways/CardBankGateway.php:40 460 msgid "Finix Card and ACH" 461 msgstr "" 462 463 #: src/Gateways/CardBankGateway.php:41 464 msgid "Accept Card and ACH payments with Finix." 465 msgstr "" 466 467 #: src/Gateways/CardBankGateway.php:46 468 #: src/Gateways/CardBankGateway.php:102 469 #: assets/js/block/src/card-bank.js:13 470 msgid "Pay with Card and/or ACH" 471 msgstr "" 472 473 #: src/Gateways/CardBankGateway.php:93 474 msgid "Enable Card and ACH Gateway" 475 msgstr "" 476 477 #: src/Gateways/CardBankGateway.php:106 478 msgid "Payment Methods" 479 msgstr "" 480 481 #: src/Gateways/CardBankGateway.php:108 482 msgid "Choose which payment methods to allow." 483 msgstr "" 484 485 #: src/Gateways/CardBankGateway.php:110 486 msgid "Card" 487 msgstr "" 488 489 #: src/Gateways/CardBankGateway.php:111 490 msgid "ACH" 491 msgstr "" 492 493 #: src/Gateways/CardBankGateway.php:112 494 #: src/Gateways/FinixGateway.php:258 495 msgid "Card and ACH" 496 msgstr "" 497 498 #: src/Gateways/CardBankGateway.php:135 499 msgid "Card and ACH Payment Method" 500 msgstr "" 501 502 #: src/Gateways/CardBankGateway.php:136 503 msgid "Take Card and ACH payments with Finix. You can configure the available options on this page." 504 msgstr "" 505 506 #: src/Gateways/CardBankGateway.php:234 465 #: src/Gateways/ApplePayGateway.php:394 466 #: src/Gateways/PaymentMethods/ApplePay.php:127 467 #: assets/js/block/src/apple-pay.js:288 468 msgid "Subtotal" 469 msgstr "" 470 471 #: src/Gateways/ApplePayGateway.php:395 472 #: src/Gateways/PaymentMethods/ApplePay.php:128 473 #: assets/js/block/src/apple-pay.js:305 474 msgid "Shipping" 475 msgstr "" 476 477 #: src/Gateways/ApplePayGateway.php:396 478 #: src/Gateways/PaymentMethods/ApplePay.php:129 479 #: assets/js/block/src/apple-pay.js:314 480 msgid "Tax" 481 msgstr "" 482 483 #: src/Gateways/ApplePayGateway.php:397 484 #: src/Gateways/PaymentMethods/ApplePay.php:130 485 #: assets/js/block/src/apple-pay.js:296 486 msgid "Discount code:" 487 msgstr "" 488 489 #: src/Gateways/BankGateway.php:20 490 msgid "Finix Bank/ACH" 491 msgstr "" 492 493 #: src/Gateways/BankGateway.php:21 494 msgid "Accept direct Bank payments with Finix." 495 msgstr "" 496 497 #: src/Gateways/BankGateway.php:44 498 msgid "Enable Bank Gateway" 499 msgstr "" 500 501 #: src/Gateways/BankGateway.php:53 502 #: assets/js/block/src/bank.js:15 503 msgid "Pay with Bank" 504 msgstr "" 505 506 #: src/Gateways/BankGateway.php:74 507 msgid "Bank Payment Method" 508 msgstr "" 509 510 #: src/Gateways/BankGateway.php:75 511 msgid "Take bank payments with Finix. You can configure available options on this page." 512 msgstr "" 513 514 #: src/Gateways/CardBankGateway.php:34 515 msgid "Pay with Finix" 516 msgstr "" 517 518 #: src/Gateways/CardBankGateway.php:141 519 #: src/Gateways/CardBankGateway.php:145 520 #: src/Gateways/CardBankGateway.php:167 521 #: src/Gateways/PaymentMethods/CardBankMethod.php:101 522 #: src/Gateways/PaymentMethods/CardBankMethod.php:105 523 #: assets/js/block/src/bank.js:95 524 #: assets/js/block/src/card.js:95 525 msgid "Full Name" 526 msgstr "" 527 528 #: src/Gateways/CardBankGateway.php:151 529 #: src/Gateways/CardBankGateway.php:169 530 #: src/Gateways/PaymentMethods/CardBankMethod.php:111 531 msgid "Please enter a valid full name" 532 msgstr "" 533 534 #: src/Gateways/CardBankGateway.php:170 535 #: assets/js/block/src/bank.js:106 536 #: assets/js/block/src/card.js:106 537 msgid "Please enter a valid city" 538 msgstr "" 539 540 #: src/Gateways/CardBankGateway.php:215 507 541 msgid "Refund failed." 508 542 msgstr "" 509 543 510 #: src/Gateways/CardBankGateway.php:283 511 #: src/Gateways/CardBankGateway.php:287 512 #: src/Gateways/CardBankGateway.php:311 513 #: src/Gateways/PaymentMethods/CardBank.php:90 514 #: src/Gateways/PaymentMethods/CardBank.php:94 515 #: assets/js/block/src/card-bank.js:97 516 msgid "Full Name" 517 msgstr "" 518 519 #: src/Gateways/CardBankGateway.php:293 520 #: src/Gateways/CardBankGateway.php:313 521 #: src/Gateways/PaymentMethods/CardBank.php:100 522 msgid "Please enter a valid full name" 523 msgstr "" 524 525 #: src/Gateways/CardBankGateway.php:314 526 #: assets/js/block/src/card-bank.js:108 527 msgid "Please enter a valid city" 528 msgstr "" 529 530 #: src/Gateways/FinixGateway.php:70 544 #: src/Gateways/CardGateway.php:20 545 msgid "Finix Cards" 546 msgstr "" 547 548 #: src/Gateways/CardGateway.php:21 549 msgid "Accept Credit and Debit Cards with Finix." 550 msgstr "" 551 552 #: src/Gateways/CardGateway.php:53 553 msgid "Enable Card Gateway" 554 msgstr "" 555 556 #: src/Gateways/CardGateway.php:62 557 #: assets/js/block/src/card.js:15 558 msgid "Pay with Card" 559 msgstr "" 560 561 #: src/Gateways/CardGateway.php:83 562 msgid "Card Payment Method" 563 msgstr "" 564 565 #: src/Gateways/CardGateway.php:84 566 msgid "Take card payments with Finix. You can configure available options on this page." 567 msgstr "" 568 569 #: src/Gateways/FinixGateway.php:72 531 570 msgid "Environment Settings" 532 571 msgstr "" 533 572 534 #: src/Gateways/FinixGateway.php:7 5535 #: src/Gateways/FinixGateway.php:7 6573 #: src/Gateways/FinixGateway.php:77 574 #: src/Gateways/FinixGateway.php:78 536 575 msgid "Environment" 537 576 msgstr "" 538 577 539 #: src/Gateways/FinixGateway.php: 78578 #: src/Gateways/FinixGateway.php:80 540 579 msgid "Place the payment gateway in sandbox mode using test API keys." 541 580 msgstr "" 542 581 543 #: src/Gateways/FinixGateway.php:8 0582 #: src/Gateways/FinixGateway.php:82 544 583 msgid "Sandbox" 545 584 msgstr "" 546 585 547 #: src/Gateways/FinixGateway.php:8 1586 #: src/Gateways/FinixGateway.php:83 548 587 msgid "Live" 549 588 msgstr "" 550 589 551 #: src/Gateways/FinixGateway.php:8 7590 #: src/Gateways/FinixGateway.php:89 552 591 msgid "Custom Source Tag" 553 592 msgstr "" 554 593 555 #: src/Gateways/FinixGateway.php: 89594 #: src/Gateways/FinixGateway.php:91 556 595 msgid "This tag will be used to identify the source of the payment. It will be used to tag the payment details send to Finix." 557 596 msgstr "" 558 597 559 #: src/Gateways/FinixGateway.php:9 7598 #: src/Gateways/FinixGateway.php:99 560 599 msgid "Sandbox Details" 561 600 msgstr "" 562 601 563 #: src/Gateways/FinixGateway.php:10 2602 #: src/Gateways/FinixGateway.php:104 564 603 msgid "Sandbox Application ID" 565 604 msgstr "" 566 605 567 #: src/Gateways/FinixGateway.php:10 4606 #: src/Gateways/FinixGateway.php:106 568 607 msgid "This is the application ID provided on Finix dashboard -> developer menu by selecting sandbox environment" 569 608 msgstr "" 570 609 571 #: src/Gateways/FinixGateway.php:1 09610 #: src/Gateways/FinixGateway.php:111 572 611 msgid "Sandbox Username" 573 612 msgstr "" 574 613 575 #: src/Gateways/FinixGateway.php:11 3614 #: src/Gateways/FinixGateway.php:115 576 615 msgid "Sandbox Password" 577 616 msgstr "" 578 617 579 #: src/Gateways/FinixGateway.php:11 7618 #: src/Gateways/FinixGateway.php:119 580 619 msgid "Sandbox Merchant ID (USD)" 581 620 msgstr "" 582 621 583 #: src/Gateways/FinixGateway.php:119 622 #: src/Gateways/FinixGateway.php:121 623 #: src/Gateways/FinixGateway.php:158 624 msgid "This is the USD merchant ID that you can get on the Finix Merchant Accounts page" 625 msgstr "" 626 627 #: src/Gateways/FinixGateway.php:126 628 msgid "Sandbox Merchant ID (CAD)" 629 msgstr "" 630 631 #: src/Gateways/FinixGateway.php:128 632 #: src/Gateways/FinixGateway.php:165 633 msgid "This is the CAD merchant ID that you can get on the Finix Merchant Accounts page" 634 msgstr "" 635 636 #: src/Gateways/FinixGateway.php:136 637 msgid "Production Details" 638 msgstr "" 639 640 #: src/Gateways/FinixGateway.php:141 641 msgid "Live Application ID" 642 msgstr "" 643 644 #: src/Gateways/FinixGateway.php:143 645 msgid "This is the application ID provided on Finix dashboard -> developer menu by selecting live environment" 646 msgstr "" 647 648 #: src/Gateways/FinixGateway.php:148 649 msgid "Live Username" 650 msgstr "" 651 652 #: src/Gateways/FinixGateway.php:152 653 msgid "Live Password" 654 msgstr "" 655 584 656 #: src/Gateways/FinixGateway.php:156 585 msgid "This is the USD merchant ID that you can get on the Finix Merchant Accounts page" 586 msgstr "" 587 588 #: src/Gateways/FinixGateway.php:124 589 msgid "Sandbox Merchant ID (CAD)" 590 msgstr "" 591 592 #: src/Gateways/FinixGateway.php:126 657 msgid "Live Merchant ID (USD)" 658 msgstr "" 659 593 660 #: src/Gateways/FinixGateway.php:163 594 msgid "This is the CAD merchant ID that you can get on the Finix Merchant Accounts page"595 msgstr ""596 597 #: src/Gateways/FinixGateway.php:134598 msgid "Production Details"599 msgstr ""600 601 #: src/Gateways/FinixGateway.php:139602 msgid "Live Application ID"603 msgstr ""604 605 #: src/Gateways/FinixGateway.php:141606 msgid "This is the application ID provided on Finix dashboard -> developer menu by selecting live environment"607 msgstr ""608 609 #: src/Gateways/FinixGateway.php:146610 msgid "Live Username"611 msgstr ""612 613 #: src/Gateways/FinixGateway.php:150614 msgid "Live Password"615 msgstr ""616 617 #: src/Gateways/FinixGateway.php:154618 msgid "Live Merchant ID (USD)"619 msgstr ""620 621 #: src/Gateways/FinixGateway.php:161622 661 msgid "Live Merchant ID (CAD)" 623 662 msgstr "" 624 663 625 #: src/Gateways/FinixGateway.php:17 1664 #: src/Gateways/FinixGateway.php:173 626 665 msgid "Advanced Settings" 627 666 msgstr "" 628 667 629 #: src/Gateways/FinixGateway.php:17 6630 #: src/Gateways/FinixGateway.php:17 7668 #: src/Gateways/FinixGateway.php:178 669 #: src/Gateways/FinixGateway.php:179 631 670 msgid "Dispute Created" 632 671 msgstr "" 633 672 634 #: src/Gateways/FinixGateway.php:1 79673 #: src/Gateways/FinixGateway.php:181 635 674 msgid "If enabled, the plugin will listen to the dispute.created webhook event and update the order state if a dispute is created." 636 675 msgstr "" 637 676 638 #: src/Gateways/FinixGateway.php:18 4677 #: src/Gateways/FinixGateway.php:186 639 678 msgid "Disputes Order State" 640 679 msgstr "" 641 680 642 #: src/Gateways/FinixGateway.php:18 6681 #: src/Gateways/FinixGateway.php:188 643 682 msgid "Choose an order status when a payment dispute is received." 644 683 msgstr "" 645 684 646 #: src/Gateways/FinixGateway.php:19 2647 #: src/Gateways/FinixGateway.php:19 3685 #: src/Gateways/FinixGateway.php:194 686 #: src/Gateways/FinixGateway.php:195 648 687 msgid "ACH Return Created" 649 688 msgstr "" 650 689 651 #: src/Gateways/FinixGateway.php:19 5690 #: src/Gateways/FinixGateway.php:197 652 691 msgid "If enabled, the plugin will listen to ACH returns and update the order state if ACH return is created." 653 692 msgstr "" 654 693 655 #: src/Gateways/FinixGateway.php:20 0694 #: src/Gateways/FinixGateway.php:202 656 695 msgid "ACH Return Order State" 657 696 msgstr "" 658 697 659 #: src/Gateways/FinixGateway.php:20 2698 #: src/Gateways/FinixGateway.php:204 660 699 msgid "Choose an order status when an ACH Return is received." 661 700 msgstr "" 662 701 663 #: src/Gateways/FinixGateway.php:25 7702 #: src/Gateways/FinixGateway.php:259 664 703 msgid "Plugin Options" 665 704 msgstr "" 666 705 667 706 #: src/Gateways/FinixGateway.php:260 668 #: src/Gateways/GooglePayGateway.php:98 707 msgid "Cards" 708 msgstr "" 709 710 #: src/Gateways/FinixGateway.php:261 711 msgid "Bank/ACH" 712 msgstr "" 713 714 #: src/Gateways/FinixGateway.php:263 715 #: src/Gateways/GooglePayGateway.php:96 669 716 msgid "Google Pay" 670 717 msgstr "" 671 718 672 #: src/Gateways/FinixGateway.php:27 2673 #: src/Gateways/FinixGateway.php:27 3719 #: src/Gateways/FinixGateway.php:275 720 #: src/Gateways/FinixGateway.php:276 674 721 msgid "Finix Payments" 675 722 msgstr "" 676 723 677 #: src/Gateways/FinixGateway.php:3 18724 #: src/Gateways/FinixGateway.php:321 678 725 msgid "Webhook Configuration" 679 726 msgstr "" 680 727 681 728 #. translators: %s - Finix Dashboard URL. 682 #: src/Gateways/FinixGateway.php:32 4729 #: src/Gateways/FinixGateway.php:327 683 730 #, php-format 684 731 msgid "To enable webhook, please add the following details to your <a href=\"%s\" target=\"_blank\">Finix Dashboard</a>:" 685 732 msgstr "" 686 733 687 #: src/Gateways/FinixGateway.php:34 0734 #: src/Gateways/FinixGateway.php:343 688 735 msgid "URL:" 689 736 msgstr "" 690 737 691 #: src/Gateways/FinixGateway.php:34 4738 #: src/Gateways/FinixGateway.php:347 692 739 msgid "Authentication Type:" 693 740 msgstr "" 694 741 695 #: src/Gateways/FinixGateway.php:34 5742 #: src/Gateways/FinixGateway.php:348 696 743 msgid "Basic" 697 744 msgstr "" 698 745 699 #: src/Gateways/FinixGateway.php:3 48746 #: src/Gateways/FinixGateway.php:351 700 747 msgid "Username:" 701 748 msgstr "" 702 749 703 #: src/Gateways/FinixGateway.php:35 2750 #: src/Gateways/FinixGateway.php:355 704 751 msgid "Password:" 705 752 msgstr "" 706 753 707 #: src/Gateways/FinixGateway.php:35 6754 #: src/Gateways/FinixGateway.php:359 708 755 msgid "Required Events:" 709 756 msgstr "" 710 757 711 #: src/Gateways/GooglePayGateway.php:3 4758 #: src/Gateways/GooglePayGateway.php:32 712 759 msgid "Finix Google Pay" 713 760 msgstr "" 714 761 715 #: src/Gateways/GooglePayGateway.php:3 5762 #: src/Gateways/GooglePayGateway.php:33 716 763 msgid "Accept Google Pay payments with Finix." 717 764 msgstr "" 718 765 719 #: src/Gateways/GooglePayGateway.php: 40720 #: assets/js/block/src/google-pay.js:1 4766 #: src/Gateways/GooglePayGateway.php:38 767 #: assets/js/block/src/google-pay.js:16 721 768 msgid "Pay with Google Pay" 722 769 msgstr "" 723 770 724 #: src/Gateways/GooglePayGateway.php:8 9771 #: src/Gateways/GooglePayGateway.php:87 725 772 msgid "Enable Google Pay Gateway" 726 773 msgstr "" 727 774 775 #: src/Gateways/GooglePayGateway.php:107 776 msgid "Button Color" 777 msgstr "" 778 728 779 #: src/Gateways/GooglePayGateway.php:109 729 msgid " Button Color"780 msgid "Choose color for the Google Pay button." 730 781 msgstr "" 731 782 732 783 #: src/Gateways/GooglePayGateway.php:111 733 msgid "Choose color for the Google Pay button." 784 msgid "Default Button" 785 msgstr "" 786 787 #: src/Gateways/GooglePayGateway.php:112 788 msgid "Black Button" 734 789 msgstr "" 735 790 736 791 #: src/Gateways/GooglePayGateway.php:113 737 msgid "Default Button"738 msgstr ""739 740 #: src/Gateways/GooglePayGateway.php:114741 msgid "Black Button"742 msgstr ""743 744 #: src/Gateways/GooglePayGateway.php:115745 792 msgid "White Button" 746 793 msgstr "" 747 794 795 #: src/Gateways/GooglePayGateway.php:121 796 msgid "Choose which type of Google Pay button you want." 797 msgstr "" 798 748 799 #: src/Gateways/GooglePayGateway.php:123 749 msgid "Choose which type of Google Pay button you want." 800 msgid "Plain Button" 801 msgstr "" 802 803 #: src/Gateways/GooglePayGateway.php:124 804 msgid "Buy Button" 750 805 msgstr "" 751 806 752 807 #: src/Gateways/GooglePayGateway.php:125 753 msgid " PlainButton"808 msgid "Checkout Button" 754 809 msgstr "" 755 810 756 811 #: src/Gateways/GooglePayGateway.php:126 757 msgid " BuyButton"812 msgid "Donate Button" 758 813 msgstr "" 759 814 760 815 #: src/Gateways/GooglePayGateway.php:127 761 msgid " CheckoutButton"816 msgid "Subscribe Button" 762 817 msgstr "" 763 818 764 819 #: src/Gateways/GooglePayGateway.php:128 765 msgid " DonateButton"820 msgid "Book Button" 766 821 msgstr "" 767 822 768 823 #: src/Gateways/GooglePayGateway.php:129 769 msgid " SubscribeButton"824 msgid "Order Button" 770 825 msgstr "" 771 826 772 827 #: src/Gateways/GooglePayGateway.php:130 773 msgid "Book Button"774 msgstr ""775 776 #: src/Gateways/GooglePayGateway.php:131777 msgid "Order Button"778 msgstr ""779 780 #: src/Gateways/GooglePayGateway.php:132781 828 msgid "Pay Button" 782 829 msgstr "" 783 830 831 #: src/Gateways/GooglePayGateway.php:136 832 msgid "Button Corner Radius" 833 msgstr "" 834 784 835 #: src/Gateways/GooglePayGateway.php:138 785 msgid "Button Corner Radius"786 msgstr ""787 788 #: src/Gateways/GooglePayGateway.php:140789 836 msgid "Choose the corner radius for the Google Pay button. Default is 5px." 790 837 msgstr "" 791 838 792 #: src/Gateways/GooglePayGateway.php:14 7839 #: src/Gateways/GooglePayGateway.php:145 793 840 msgid "This will be the merchant name shown to users when making a purchase via Google Pay." 794 841 msgstr "" 795 842 843 #: src/Gateways/GooglePayGateway.php:150 844 msgid "Google Merchant ID" 845 msgstr "" 846 796 847 #: src/Gateways/GooglePayGateway.php:152 797 msgid "Google Merchant ID"798 msgstr ""799 800 #: src/Gateways/GooglePayGateway.php:154801 848 msgid "This is the Google Merchant ID. You can find it on your Google Business console." 802 849 msgstr "" 803 850 851 #: src/Gateways/GooglePayGateway.php:167 852 msgid "Google Pay Payment Method" 853 msgstr "" 854 804 855 #: src/Gateways/GooglePayGateway.php:169 805 msgid "Google Pay Payment Method"806 msgstr ""807 808 #: src/Gateways/GooglePayGateway.php:171809 856 msgid "Receive payments via Google Pay with Finix. You can configure the available options on this page." 810 857 msgstr "" 811 858 859 #: src/Gateways/GooglePayGateway.php:322 860 msgid "There was an error processing the payment through Google Pay. Please try a different method or try again later." 861 msgstr "" 862 863 #: src/Gateways/GooglePayGateway.php:323 864 msgid "Please enter a valid billing details." 865 msgstr "" 866 812 867 #: src/Gateways/GooglePayGateway.php:324 813 msgid " There was an error processing the payment through Google Pay. Please try a different method or try again later."868 msgid "Please enter a valid shipping details." 814 869 msgstr "" 815 870 816 871 #: src/Gateways/GooglePayGateway.php:325 817 msgid "Please enter a valid billing details."818 msgstr ""819 820 #: src/Gateways/GooglePayGateway.php:326821 msgid "Please enter a valid shipping details."822 msgstr ""823 824 #: src/Gateways/GooglePayGateway.php:327825 872 msgid "Missing details for Google Pay. Please contact the store owner." 826 873 msgstr "" 827 874 828 #: src/Payments.php:10 0875 #: src/Payments.php:104 829 876 msgid "Your order is currently on hold and will be processed once the payment is approved." 830 877 msgstr "" 831 878 832 #: src/Payments.php:11 5879 #: src/Payments.php:119 833 880 msgid "There was an error while processing this request." 834 881 msgstr "" 835 882 836 #: src/Payments.php:14 5883 #: src/Payments.php:149 837 884 msgid "Please review and fill in all the required information." 838 885 msgstr "" 839 886 840 #: src/Payments.php:17 1887 #: src/Payments.php:175 841 888 msgid "Please review and fill all the required information." 842 889 msgstr "" 843 890 844 #: src/Payments.php:18 4891 #: src/Payments.php:188 845 892 msgid "Invalid country provided." 846 893 msgstr "" 847 894 848 #: src/Payments.php: 196895 #: src/Payments.php:200 849 896 msgid "Invalid state provided." 850 897 msgstr "" 851 898 852 #: src/Payments.php:2 26899 #: src/Payments.php:230 853 900 msgid "No shipping methods available for the provided address." 854 901 msgstr "" 855 902 856 #: src/Payments.php:2 46903 #: src/Payments.php:250 857 904 msgid "Shipping is required for this order." 858 905 msgstr "" 859 906 860 #: assets/js/block/src/apple-pay.js:2 35907 #: assets/js/block/src/apple-pay.js:270 861 908 msgid "Please make sure shipping and billing information is correct." 862 909 msgstr "" 863 910 864 #: assets/js/block/src/card-bank.js:107 911 #: assets/js/block/src/bank.js:105 912 #: assets/js/block/src/card.js:105 865 913 msgid "Please enter a valid name" 866 914 msgstr "" 867 915 868 #: assets/js/block/src/card-bank.js:149 916 #: assets/js/block/src/bank.js:148 917 #: assets/js/block/src/card.js:148 869 918 msgid "Unfortunately, there was an error while loading the payment form. Please try again later." 870 919 msgstr "" 871 920 872 #: assets/js/block/src/card-bank.js:197 921 #: assets/js/block/src/bank.js:189 922 #: assets/js/block/src/card.js:189 873 923 msgid "Unfortunately, there was an error while initializing a payment form." 874 924 msgstr "" … … 878 928 msgstr "" 879 929 880 #: assets/js/block/src/google-pay.js:11 3930 #: assets/js/block/src/google-pay.js:117 881 931 msgid "There was an error while initializing Google Pay. Please check all the details and try again." 882 932 msgstr "" 883 933 884 #: assets/js/block/src/google-pay.js:12 4934 #: assets/js/block/src/google-pay.js:128 885 935 msgid "Please make sure shipping and billing information is correct and then try again." 886 936 msgstr "" -
finix-for-woocommerce/trunk/finix-for-woocommerce.php
r3316914 r3375717 3 3 * Plugin Name: Finix for WooCommerce 4 4 * Plugin URI: https://docs.finix.com/additional-resources/plugins/woocommerce-plugin 5 * Description: Take credit card, ACH, and Apple Pay payments on your store using Finix.6 * Version: 1. 2.05 * Description: Take credit card, bank, Apple Pay, and Google Pay payments on your store using Finix. 6 * Version: 1.3.0 7 7 * Author: Finix 8 8 * Author URI: https://finix.com 9 9 * License: GPL v2 or later 10 10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 11 * Requires at least: 6. 611 * Requires at least: 6.7 12 12 * Requires PHP: 7.4 13 13 * Requires Plugins: woocommerce … … 15 15 * Domain Path: /assets/languages 16 16 * 17 * WC requires at least: 9. 718 * WC tested up to: 9.917 * WC requires at least: 9.9 18 * WC tested up to: 10.2 19 19 */ 20 20 … … 22 22 23 23 // phpcs:disable WPForms.Comments.PHPDocDefine.MissPHPDoc 24 const FINIXWC_VERSION = '1. 2.0';24 const FINIXWC_VERSION = '1.3.0'; 25 25 const FINIXWC_PLUGIN_FILE = __FILE__; 26 const FINIXWC_MIN_WC_VERSION = '9. 7.0';26 const FINIXWC_MIN_WC_VERSION = '9.9.0'; 27 27 28 28 define( 'FINIXWC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); -
finix-for-woocommerce/trunk/readme.txt
r3316914 r3375717 2 2 Contributors: finixpayments, slaFFik 3 3 Tags: finix, credit card, ach, apple pay, woocommerce 4 Requires at least: 6. 64 Requires at least: 6.7 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 7 Requires Plugins: woocommerce 8 WC requires at least: 9. 79 WC tested up to: 9.910 Stable tag: 1. 2.08 WC requires at least: 9.9 9 WC tested up to: 10.2 10 Stable tag: 1.3.0 11 11 License: GPLv2 or later 12 12 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 91 91 92 92 * PHP version 7.4 or greater 93 * WordPress 6. 6or greater94 * WooCommerce 9. 7or greater93 * WordPress 6.7 or greater 94 * WooCommerce 9.9 or greater 95 95 * Finix account 96 96 97 97 = Automatic installation = 98 98 99 1. Install the plugin via Plugins -> New plugin. Search for "Finix for WooCommerce".99 1. Install the plugin via Plugins -> New plugin. Search for "Finix" or "Finix for WooCommerce". 100 100 2. Activate the 'Finix for WooCommerce' plugin through the 'Plugins' menu in WordPress. 101 101 3. Set your Finix API credentials key at WooCommerce -> Settings -> Payments -> Finix Gateway -> Plugin Options (or use the *Settings* link in the Plugins overview). … … 117 117 118 118 1. Payment form 119 2. Card & ACH payment method settings 120 3. Apple Pay payment method settings 121 4. Google Pay payment method settings 122 5. Plugin Options 119 1. Card payment method settings 120 1. Bank payment method settings 121 1. Apple Pay payment method settings 122 1. Google Pay payment method settings 123 1. Plugin Options 123 124 124 125 == Changelog == 126 127 = 1.3.0 = 128 * Added: Coupon codes that were applied to the order are now passed to the Finix API as transaction tags. 129 * Added: Display a lot more relevant order information in the Apple Pay popup on Apple devices, not just the total amount, but also all the products, discounts/tax/shipping if present. 130 * Changed: Much more robust system to manage tags for orders and buyers: validated and filterable. 131 * Changed: Plugin was tested to be fully compatible with WooCommerce v10.2. 132 * Changed: The minimum compatible and tested WordPress version is now 6.7 - to be aligned with WooCommerce strategy. 133 * Changed: Split a currently unified Card/Bank gateway into separate Finix Cards and Finix Bank/ACH gateways for easier control and configuration. 134 * Fixed: Finix form styles should now blend even better with your current theme. 135 * Fixed: Sometimes the payment forms by Finix were not loading properly on the checkout page. 125 136 126 137 = 1.2.0 = -
finix-for-woocommerce/trunk/src/Admin/Admin.php
r3316914 r3375717 4 4 5 5 use FinixWC\Gateways\ApplePayGateway; 6 use FinixWC\Gateways\CardBankGateway; 6 use FinixWC\Gateways\BankGateway; 7 use FinixWC\Gateways\CardGateway; 7 8 use FinixWC\Gateways\GooglePayGateway; 8 9 use FinixWC\Payments; … … 17 18 */ 18 19 public const SECTIONS = [ 19 CardBankGateway::SLUG, 20 CardGateway::SLUG, 21 BankGateway::SLUG, 20 22 ApplePayGateway::SLUG, 21 23 GooglePayGateway::SLUG, … … 28 30 29 31 /** 30 * Hooks for plugin admin area.32 * Hooks for the plugin admin area. 31 33 */ 32 34 public function hooks(): void { -
finix-for-woocommerce/trunk/src/Events/ApplePayPaymentCompletedEvent.php
r3316914 r3375717 57 57 58 58 if ( $transaction_details['status'] === 200 ) { 59 finixwc()->finix_api->update_transfer_with_tags( 60 $transaction_id, 61 [ 62 'order_id' => $this->order->get_id(), 63 ] 64 ); 59 $tags = []; 60 61 $tags['order_id'] = $this->order->get_id(); 62 $coupons = $this->order->get_coupon_codes(); 63 64 if ( ! empty( $coupons ) ) { 65 $tags['order_coupons'] = implode( ',', $coupons ); 66 } 67 68 finixwc()->finix_api->update_transfer_with_tags( $transaction_id, $tags ); 65 69 } 66 70 -
finix-for-woocommerce/trunk/src/Events/CardAchPaymentEvent.php
r3316914 r3375717 24 24 * Process the payment. 25 25 */ 26 public function process(): array { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh 26 public function process(): array { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh,Generic.Metrics.CyclomaticComplexity.MaxExceeded 27 27 28 28 if ( empty( $this->order ) ) { … … 65 65 66 66 // phpcs:ignore WordPress.Security.NonceVerification.Missing 67 if ( empty( $_POST[ 'finix_token'] ) ) {67 if ( empty( $_POST[ $this->gateway->id . '_token' ] ) ) { 68 68 wc_add_notice( 69 69 esc_html__( 'Payment error: There was an error while processing your payment. Please try again.', 'finix-for-woocommerce' ), … … 79 79 80 80 // phpcs:ignore WordPress.Security.NonceVerification.Missing 81 $payment_instrument_token = sanitize_text_field( wp_unslash( $_POST[ 'finix_token'] ) );81 $payment_instrument_token = sanitize_text_field( wp_unslash( $_POST[ $this->gateway->id . '_token' ] ) ); 82 82 83 83 $payment_instrument_feedback = finixwc()->finix_api->create_instrument_token() … … 99 99 ); 100 100 101 $errors = $payment_instrument_feedback['response']->_embedded->errors ?? $payment_instrument_feedback['error'] ?? [ '' ]; 102 101 103 $this->order->add_order_note( 102 104 sprintf( /* translators: %s: Error message from Finix. */ 103 105 esc_html__( 'Finix Payment method creation failed: %s', 'finix-for-woocommerce' ), 104 wp_json_encode( $ payment_instrument_feedback['response']->_embedded->errors )106 wp_json_encode( $errors ) 105 107 ) 106 108 ); -
finix-for-woocommerce/trunk/src/Events/GooglePayPaymentCompletedEvent.php
r3316914 r3375717 57 57 58 58 if ( $transaction_details['status'] === 200 ) { 59 finixwc()->finix_api->update_transfer_with_tags( 60 $transaction_id, 61 [ 62 'order_id' => $this->order->get_id(), 63 ] 64 ); 59 $tags = []; 60 61 $tags['order_id'] = $this->order->get_id(); 62 $coupons = $this->order->get_coupon_codes(); 63 64 if ( ! empty( $coupons ) ) { 65 $tags['order_coupons'] = implode( ',', $coupons ); 66 } 67 68 finixwc()->finix_api->update_transfer_with_tags( $transaction_id, $tags ); 65 69 } 66 70 -
finix-for-woocommerce/trunk/src/Finix/API.php
r3316914 r3375717 43 43 44 44 public Endpoint $endpoint; 45 public Tags $tags; 45 46 46 47 /** … … 115 116 } 116 117 117 // TODO: Validate tags. 118 $tags = new stdClass(); 119 120 $tags->order_id = ! empty( $order_id ) ? absint( $order_id ) : ''; 121 $tags->order_date = gmdate( 'Y-m-d H:i:s' ); 122 $tags->source = $this->custom_source_tag; 123 124 $data->tags = $tags; 118 $tags = new Tags(); 119 120 if ( ! empty( $order_id ) ) { 121 $order = wc_get_order( $order_id ); 122 123 if ( $order ) { 124 $coupons = $order->get_coupon_codes(); 125 126 if ( ! empty( $coupons ) ) { 127 $tags->add( 'order_coupons', implode( ',', $coupons ) ); 128 } 129 } 130 } 131 132 $tags->add_bulk( 133 [ 134 'order_id' => ! empty( $order_id ) ? $order_id : '', 135 'order_date' => gmdate( 'Y-m-d H:i:s' ), 136 'source' => $this->custom_source_tag, 137 ] 138 ); 139 140 $tags = apply_filters( 'finixwc_api_make_payment_tags', $tags, $order_id ); 141 142 $data->tags = $tags->prepare(); 125 143 126 144 $token = $this->get_token(); … … 173 191 $data->idempotency_id = $order_id . '_' . time(); 174 192 175 // TODO: Validate tags. 176 $data->tags = new stdClass(); 177 $data->tags->order_id = $order_id; 178 $data->tags->refund_date = gmdate( 'Y-m-d H:i:s' ); 179 $data->tags->source = $this->custom_source_tag; 180 $data->tags->refund_reason = $refund_reason; 193 $tags = new Tags(); 194 195 $tags->add_bulk( 196 [ 197 'order_id' => $order_id, 198 'refund_date' => gmdate( 'Y-m-d H:i:s' ), 199 'source' => $this->custom_source_tag, 200 'refund_reason' => $refund_reason, 201 ] 202 ); 203 204 $tags = apply_filters( 'finixwc_api_refund_payment_tags', $tags, $order_id ); 205 206 $data->tags = $tags->prepare(); 181 207 182 208 $token = $this->get_token(); -
finix-for-woocommerce/trunk/src/Finix/BuyerIdentity.php
r3316914 r3375717 13 13 14 14 protected $entity; 15 protected $tags;15 protected Tags $tags; 16 16 17 17 protected WC_Abstract_Order $order; … … 23 23 24 24 $this->entity = new stdClass(); 25 $this->tags = new stdClass();25 $this->tags = new Tags(); 26 26 } 27 27 … … 49 49 $this->entity->personal_address->region = $order->get_billing_state(); 50 50 51 $this->tags->order_id = $this->order->get_id(); 52 $this->tags->order_date = $this->order->get_date_created(); 53 $this->tags->user_id = $this->order->get_customer_id(); 51 $this->tags->add_bulk( 52 [ 53 'order_id' => $this->order->get_id(), 54 'order_date' => $this->order->get_date_created(), 55 'user_id' => $this->order->get_customer_id(), 56 ] 57 ); 54 58 55 59 return $this; … … 75 79 $this->entity->personal_address->region = $data['state'] ?? ''; 76 80 77 $this->tags->order_id = ''; 78 $this->tags->order_date = gmdate( 'Y-m-d H:i:s' ); 79 $this->tags->user_id = $this->get_user_id_from_email( $this->entity->email ); 81 $this->tags->add_bulk( 82 [ 83 'order_id' => '', 84 'order_date' => gmdate( 'Y-m-d H:i:s' ), 85 'user_id' => $this->get_user_id_from_email( $this->entity->email ), 86 ] 87 ); 80 88 81 89 return $this; … … 97 105 } 98 106 107 // phpcs:ignore Universal.Operators.DisallowShortTernary.Found 108 $this->tags->add( 'user_id', $this->tags->get( 'user_id' ) ?: get_current_user_id() ); 109 $this->tags->add( 'source', finixwc()->finix_api->custom_source_tag ); 110 111 $this->tags = apply_filters( 'finixwc_api_create_buyeridentity_tags', $this->tags, $this->entity ); 112 99 113 $data = new stdClass(); 100 114 101 $this->tags->user_id = ( $this->tags->user_id ) ? $this->tags->user_id : get_current_user_id();102 $this->tags->source = finixwc()->finix_api->custom_source_tag;103 104 115 $data->entity = $this->entity; 105 $data->tags = $this->tags ;116 $data->tags = $this->tags->prepare(); 106 117 107 118 $response = wp_remote_post( -
finix-for-woocommerce/trunk/src/Finix/InstrumentToken.php
r3316914 r3375717 4 4 5 5 use FinixWC\Gateways\ApplePayGateway; 6 use FinixWC\Gateways\CardBankGateway; 6 use FinixWC\Gateways\BankGateway; 7 use FinixWC\Gateways\CardGateway; 7 8 use FinixWC\Gateways\GooglePayGateway; 8 9 use stdClass; … … 28 29 29 30 switch ( sanitize_key( $gateway ) ) { 30 case CardBankGateway::SLUG: 31 case BankGateway::SLUG: 32 case CardGateway::SLUG: 31 33 $this->type = 'TOKEN'; 32 34 break; … … 120 122 $data->name = $this->buyer_name; 121 123 122 $data->tags = new stdClass(); 123 $data->tags->order_id = $this->order_id; 124 $data->tags->order_date = gmdate( 'Y-m-d H:i:s' ); 125 $data->tags->source = finixwc()->finix_api->custom_source_tag; 124 $tags = new Tags(); 125 126 $tags->add_bulk( 127 [ 128 'order_id' => $this->order_id, 129 'order_date' => gmdate( 'Y-m-d H:i:s' ), 130 'source' => finixwc()->finix_api->custom_source_tag, 131 ] 132 ); 133 134 $tags = apply_filters( 'finixwc_api_create_instrumenttoken_tags', $tags ); 135 136 $data->tags = $tags->prepare(); 126 137 127 138 $token = finixwc()->finix_api->get_token(); -
finix-for-woocommerce/trunk/src/Finix/Transfer.php
r3316914 r3375717 57 57 * 58 58 * @param string $transfer_id Transfer ID for which we want to update the tags. 59 * @param array $ tagsPassing the same key in the array will override an existing tag if it exists.59 * @param array $raw_tags Passing the same key in the array will override an existing tag if it exists. 60 60 */ 61 public function update_transfer_with_tags( string $transfer_id, array $ tags ): array {61 public function update_transfer_with_tags( string $transfer_id, array $raw_tags ): array { 62 62 63 if ( empty( $ tags ) ) {63 if ( empty( $raw_tags ) ) { 64 64 return [ 65 65 'status' => 400, … … 79 79 } 80 80 81 $tags = new Tags(); 82 83 $tags->add_bulk( $raw_tags ); 84 85 $tags = apply_filters( 'finixwc_api_update_transfer_tags', $tags, $transfer_id ); 86 81 87 $data = new stdClass(); 82 $data->tags = new stdClass(); 83 84 foreach ( $tags as $key => $value ) { 85 $key = sanitize_key( $key ); 86 87 $data->tags->{$key} = sanitize_text_field( $value ); 88 } 88 $data->tags = $tags->prepare(); 89 89 90 90 $response = wp_safe_remote_request( -
finix-for-woocommerce/trunk/src/Gateways/ApplePayGateway.php
r3316914 r3375717 10 10 use FinixWC\Helpers\Assets; 11 11 use FinixWC\Helpers\Convert; 12 use FinixWC\Helpers\CartData; 13 use stdClass; 12 14 13 15 /** … … 21 23 public string $button_type; 22 24 public string $merchant_name; 23 24 public array $plugin_options;25 25 26 26 /** … … 101 101 'title' => __( 'Description', 'finix-for-woocommerce' ), 102 102 'type' => 'textarea', 103 'description' => __( 'This controls the description which the user sees during checkout. ', 'finix-for-woocommerce' ),103 'description' => __( 'This controls the description which the user sees during checkout. It will be wrapped in the paragraph tag.', 'finix-for-woocommerce' ), 104 104 'default' => '', 105 105 'desc_tip' => true, … … 291 291 * Enqueue the payment script and styles for shortcode-based checkout. 292 292 */ 293 public function payment_scripts(): void { 293 public function payment_scripts(): void { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh 294 294 295 295 // Only if gateway is enabled. … … 349 349 true 350 350 ); 351 352 $is_order_pay_page = false; 353 $order_id = 0; 354 355 // We might not have a cart over here, so retrieve the data from the current order page. 356 if ( is_checkout_pay_page() ) { 357 global $wp; 358 359 $order_id = absint( $wp->query_vars['order-pay'] ); 360 $order = wc_get_order( $order_id ); 361 362 if ( $order ) { 363 $order_amount = $order->get_total(); 364 } 365 } else { 366 // Get the current cart total as we are most likely on the Checkout page. 367 $order_amount = (string) WC()->cart->get_total( '' ); 368 } 369 370 // Get data for order details. 371 $order_details = CartData::prepare_order_tracking_details(); 351 372 352 373 // Pass params to JavaScript and enqueue them. … … 363 384 'gateway' => esc_html( $this->id ), 364 385 'billing_data' => WC()->customer->get_billing(), 386 'products' => $order_details['products'] ?? new stdClass(), 387 'subtotal' => $order_details['subtotal'], 388 'shipping_amount' => $order_details['shipping_amount'], 389 'tax_amount' => $order_details['tax_amount'], 390 'coupons' => $order_details['coupons'] ?? [], 365 391 'text' => [ 366 392 'error_processing' => esc_html__( 'There was an error while processing your payment. Please try again later.', 'finix-for-woocommerce' ), 367 393 'error_billing' => esc_html__( 'Please enter a valid billing address.', 'finix-for-woocommerce' ), 394 'subtotal' => esc_html__( 'Subtotal', 'finix-for-woocommerce' ), 395 'shipping' => esc_html__( 'Shipping', 'finix-for-woocommerce' ), 396 'tax' => esc_html__( 'Tax', 'finix-for-woocommerce' ), 397 'discount_code' => esc_html__( 'Discount code:', 'finix-for-woocommerce' ), 368 398 ], 369 399 'url' => [ … … 395 425 } 396 426 397 $place_order_button .= '<apple-pay-button id="finix-apple-pay-button" 398 buttonstyle="' . esc_attr( $this->button_style ) . '" 399 type="' . esc_attr( $this->button_type ) . '" 400 locale="' . esc_attr( str_replace( '_', '-', determine_locale() ) ) . '"></apple-pay-button> 401 '; 427 $place_order_button .= '<apple-pay-button id="finix-apple-pay-button" buttonstyle="' . esc_attr( $this->button_style ) . '" type="' . esc_attr( $this->button_type ) . '" locale="' . esc_attr( str_replace( '_', '-', determine_locale() ) ) . '"></apple-pay-button>'; 402 428 403 429 return $place_order_button; -
finix-for-woocommerce/trunk/src/Gateways/CardBankGateway.php
r3316914 r3375717 3 3 namespace FinixWC\Gateways; 4 4 5 use FinixWC\Events\AchPaymentProcessedEvent; 5 6 use FinixWC\Events\AchReturnEvent; 6 use FinixWC\Events\AchPaymentProcessedEvent;7 7 use FinixWC\Events\CardAchPaymentEvent; 8 8 use FinixWC\Events\DisputeEvent; … … 12 12 13 13 /** 14 * Gateway used for Card and Bank (ACH) payments.14 * Shared codebase between Bank (ACH) and Card (Credit/Debit) gateways. 15 15 */ 16 final class CardBankGateway extends FinixGateway { 17 18 public const SLUG = 'finix_gateway'; 19 20 /** 21 * Payment method to use. Possible values: card, ach, both. 22 * 23 * @var string $payment_method 24 */ 25 public string $payment_method; 16 abstract class CardBankGateway extends FinixGateway { 26 17 27 18 protected bool $is_dispute_managed; … … 36 27 public function __construct() { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks 37 28 38 $this->id = self::SLUG; 39 $this->icon = Assets::url( 'images/finix-squared.svg', false ); 40 $this->method_title = __( 'Finix Card and ACH', 'finix-for-woocommerce' ); 41 $this->method_description = __( 'Accept Card and ACH payments with Finix.', 'finix-for-woocommerce' ); 29 $this->icon = Assets::url( 'images/finix-squared.svg', false ); 42 30 43 31 parent::__construct(); 44 32 45 $this->enabled = $this->get_option( 'enabled' ); 46 $this->title = $this->get_option( 'title' ) ?: __( 'Pay with Card and/or ACH', 'finix-for-woocommerce' ); // phpcs:ignore Universal.Operators.DisallowShortTernary.Found 47 $this->description = $this->get_option( 'description' ); 48 $this->payment_method = $this->get_option( 'payment_methods' ); 49 50 // Switch icon based on payment method. 51 if ( $this->payment_method === 'card' ) { 52 $this->icon_checkout = Assets::url( 'images/cards.svg', false ); 53 } elseif ( $this->payment_method === 'ach' ) { 54 $this->icon_checkout = Assets::url( 'images/bank.svg', false ); 55 } elseif ( $this->payment_method === 'both' ) { 56 $this->icon_checkout = Assets::url( 'images/all-methods.svg', false ); 57 } 33 $this->enabled = $this->get_option( 'enabled' ); 34 $this->title = $this->get_option( 'title' ) ?: __( 'Pay with Finix', 'finix-for-woocommerce' ); // phpcs:ignore Universal.Operators.DisallowShortTernary.Found 35 $this->description = $this->get_option( 'description' ); 58 36 59 37 $this->is_dispute_managed = ( $this->get_option( 'manage_disputes' ) === 'yes' ); … … 66 44 67 45 $this->hooks(); 68 }69 70 /**71 * Initialize the form fields.72 * Admin settings for the gateway.73 */74 public function init_form_fields(): void {75 76 // phpcs:ignore WordPress.Security.NonceVerification.Recommended77 $is_options_page = (bool) absint( $_GET['options'] ?? 0 );78 79 if ( $is_options_page ) {80 parent::init_form_fields();81 82 return;83 }84 85 $this->form_fields = [86 'general_settings' => [87 'title' => __( 'General Settings', 'finix-for-woocommerce' ),88 'type' => 'title',89 'description' => '',90 ],91 'enabled' => [92 'title' => __( 'Status', 'finix-for-woocommerce' ),93 'label' => __( 'Enable Card and ACH Gateway', 'finix-for-woocommerce' ),94 'type' => 'checkbox',95 'description' => '',96 'default' => 'yes',97 ],98 'title' => [99 'title' => __( 'Title', 'finix-for-woocommerce' ),100 'type' => 'text',101 'description' => __( 'This controls the title which the user sees during checkout.', 'finix-for-woocommerce' ),102 'default' => __( 'Pay with Card and/or ACH', 'finix-for-woocommerce' ),103 'desc_tip' => true,104 ],105 'payment_methods' => [106 'title' => __( 'Payment Methods', 'finix-for-woocommerce' ),107 'type' => 'select',108 'description' => __( 'Choose which payment methods to allow.', 'finix-for-woocommerce' ),109 'options' => [110 'card' => __( 'Card', 'finix-for-woocommerce' ),111 'ach' => __( 'ACH', 'finix-for-woocommerce' ),112 'both' => __( 'Card and ACH', 'finix-for-woocommerce' ),113 ],114 'default' => 'card',115 'desc_tip' => true,116 ],117 'description' => [118 'title' => __( 'Description', 'finix-for-woocommerce' ),119 'type' => 'textarea',120 'description' => __( 'This controls the description which the user sees during checkout.', 'finix-for-woocommerce' ),121 'default' => '',122 'desc_tip' => true,123 ],124 ];125 }126 127 /**128 * Gateway-specific options page.129 */130 protected function admin_options_gateway(): void {131 ?>132 133 <div class="links-container">134 <div class="links-content">135 <h2><?php esc_html_e( 'Card and ACH Payment Method', 'finix-for-woocommerce' ); ?></h2>136 <p><?php esc_html_e( 'Take Card and ACH payments with Finix. You can configure the available options on this page.', 'finix-for-woocommerce' ); ?></p>137 </div>138 </div>139 140 <div class="settings-container">141 <div class="settings-content">142 <table class="form-table">143 <?php $this->generate_settings_html(); ?>144 </table>145 </div>146 </div>147 148 <div class="clear"></div>149 150 <?php151 }152 153 /**154 * Render the payment form for the Finix JS SDK library.155 * Loaded only on shortcode-based checkout page.156 */157 public function payment_fields(): void {158 159 // Display some description before the payment form.160 if ( $this->description ) {161 if ( $this->is_sandbox_mode ) {162 $this->description .= ' ' . esc_html__( 'TEST MODE ENABLED. All the payments will go through the sandbox.', 'finix-for-woocommerce' );163 }164 165 echo esc_html( trim( $this->description ) );166 }167 ?>168 169 <fieldset id="wc-<?php echo esc_attr( $this->id ); ?>-cc-form" class="finix-wc-form wc-credit-card-form wc-payment-form" style="background:transparent;">170 <div id="finix-form"></div>171 <div class="clear"></div>172 173 <input type="hidden" id="finix_token" name="finix_token" value=""/>174 <input type="hidden" id="finix_fraud_session_id" name="finix_fraud_session_id" value=""/>175 <input type="hidden" id="finix_nonce" name="finix_nonce" value=""/>176 177 <div class="clear"></div>178 </fieldset>179 180 <?php181 46 } 182 47 … … 204 69 205 70 /** 206 * Process order payments. 207 * Validation of whether the payment should proceed is done in the validate_fields() method. 208 * 209 * @see validate_fields() 210 */ 211 public function process_payment( $order_id ): array { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh,Generic.Metrics.CyclomaticComplexity.MaxExceeded 212 213 $order = wc_get_order( $order_id ); 214 215 return ( new CardAchPaymentEvent( $order ) ) 216 ->set_gateway( $this ) 217 ->process(); 218 } 219 220 /** 221 * Process order refunds. 222 * 223 * @param int $order_id Order ID. 224 * @param float|null $amount Refund amount. 225 * @param string $reason Refund reason. 226 * 227 * @return bool|WP_Error True or false based on success, or a WP_Error object. 228 */ 229 public function process_refund( $order_id, $amount = null, $reason = '' ) { 230 231 $order = wc_get_order( $order_id ); 232 233 if ( ! $this->can_refund_order( $order ) ) { 234 return new WP_Error( 'error', __( 'Refund failed.', 'finix-for-woocommerce' ) ); 235 } 236 237 return ( new RefundEvent( $order_id ) ) 238 ->set_gateway( $this ) 239 ->set_amount( $amount ) 240 ->set_reason( $reason ) 241 ->process(); 71 * Render the payment form for the Finix JS SDK library. 72 * Loaded only on the shortcode-based checkout page. 73 */ 74 public function payment_fields(): void { 75 76 // Display some description before the payment form. 77 if ( $this->description ) { 78 if ( $this->is_sandbox_mode ) { 79 $this->description .= ' ' . esc_html__( 'TEST MODE ENABLED. All the payments will go through the sandbox.', 'finix-for-woocommerce' ); 80 } 81 82 echo esc_html( trim( $this->description ) ); 83 } 84 ?> 85 86 <fieldset id="wc-<?php echo esc_attr( $this->id ); ?>-form" class="finix-wc-form wc-payment-form" style="background:transparent;"> 87 <div id="<?php echo esc_attr( $this->id ); ?>-form"></div> 88 <div class="clear"></div> 89 90 <input type="hidden" id="<?php echo esc_attr( $this->id ); ?>_token" name="<?php echo esc_attr( $this->id ); ?>_token" value=""/> 91 92 <div class="clear"></div> 93 </fieldset> 94 95 <?php 242 96 } 243 97 … … 247 101 public function payment_scripts(): void { 248 102 249 // Only if gateway is enabled.103 // Only if the gateway is enabled. 250 104 if ( $this->enabled === 'no' ) { 251 105 return; … … 260 114 // Only when legacy shortcode is used. 261 115 if ( has_block( 'woocommerce/checkout' ) && ! is_checkout_pay_page() ) { 116 return; 117 } 118 119 if ( wp_script_is( 'finix_gateway-checkout-shortcode', 'enqueued' ) ) { 262 120 return; 263 121 } … … 306 164 'merchant' => get_woocommerce_currency() === 'CAD' ? esc_html( $this->merchant_id_cad ) : esc_html( $this->merchant_id ), 307 165 'application' => esc_html( $this->application_id ), 308 'gateway' => esc_html( $this->id ),309 'payment_method' => esc_html( $this->payment_method ),310 166 'text' => [ 311 167 'full_name' => esc_html__( 'Full Name', 'finix-for-woocommerce' ), … … 326 182 Assets::ver() 327 183 ); 184 } 185 186 /** 187 * Process order payments. 188 * Validation of whether the payment should proceed is done in the validate_fields() method. 189 * 190 * @see validate_fields() 191 */ 192 public function process_payment( $order_id ): array { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh,Generic.Metrics.CyclomaticComplexity.MaxExceeded 193 194 $order = wc_get_order( $order_id ); 195 196 return ( new CardAchPaymentEvent( $order ) ) 197 ->set_gateway( $this ) 198 ->process(); 199 } 200 201 /** 202 * Process order refunds. 203 * 204 * @param int $order_id Order ID. 205 * @param float|null $amount Refund amount. 206 * @param string $reason Refund reason. 207 * 208 * @return bool|WP_Error True or false based on success, or a WP_Error object. 209 */ 210 public function process_refund( $order_id, $amount = null, $reason = '' ) { 211 212 $order = wc_get_order( $order_id ); 213 214 if ( ! $this->can_refund_order( $order ) ) { 215 return new WP_Error( 'error', __( 'Refund failed.', 'finix-for-woocommerce' ) ); 216 } 217 218 return ( new RefundEvent( $order_id ) ) 219 ->set_gateway( $this ) 220 ->set_amount( $amount ) 221 ->set_reason( $reason ) 222 ->process(); 223 } 224 225 /** 226 * Used in a webhook() method to validate the incoming request header. 227 */ 228 protected function is_auth_header_valid( $auth_header ): bool { 229 230 // Extract credentials from the Authorization header. 231 $auth_token = explode( ' ', $auth_header ); 232 233 if ( count( $auth_token ) !== 2 || $auth_token[0] !== 'Basic' ) { 234 return false; 235 } 236 237 // Decode and validate user:pass. 238 // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode 239 $decoded = base64_decode( $auth_token[1], true ); 240 241 if ( $decoded === false ) { 242 return false; 243 } 244 245 // Extract user and pass. 246 [ $user, $pass ] = explode( ':', $decoded ); 247 248 return ( $user === $this->webhook_user && $pass === $this->webhook_password ); 328 249 } 329 250 … … 489 410 exit; 490 411 } 491 492 /**493 * Used in a webhook() method to validate the incoming request header.494 */495 private function is_auth_header_valid( $auth_header ): bool {496 497 // Extract credentials from Authorization header.498 $auth_token = explode( ' ', $auth_header );499 500 if ( count( $auth_token ) !== 2 || $auth_token[0] !== 'Basic' ) {501 return false;502 }503 504 // Decode and validate user:pass.505 // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode506 $decoded = base64_decode( $auth_token[1], true );507 508 if ( $decoded === false ) {509 return false;510 }511 512 // Extract user and pass.513 [ $user, $pass ] = explode( ':', $decoded );514 515 return ( $user === $this->webhook_user && $pass === $this->webhook_password );516 }517 412 } -
finix-for-woocommerce/trunk/src/Gateways/FinixGateway.php
r3316914 r3375717 32 32 private WC_Logger $logger; 33 33 34 public array $plugin_options; 35 34 36 /** 35 37 * Common constructor. … … 55 57 * Should be called before any $this->get_option() calls. 56 58 */ 57 protected function init() {59 protected function init(): void { 58 60 59 61 $this->init_form_fields(); … … 62 64 63 65 /** 64 * Initiali se settings form fields.66 * Initialize settings form fields. 65 67 */ 66 68 public function init_form_fields(): void { … … 255 257 256 258 $subpages = [ 257 'finix_gateway_options' => __( 'Plugin Options', 'finix-for-woocommerce' ), 258 'finix_gateway' => __( 'Card and ACH', 'finix-for-woocommerce' ), 259 'finix_apple_pay_gateway' => __( 'Apple Pay', 'finix-for-woocommerce' ), 260 'finix_google_pay_gateway' => __( 'Google Pay', 'finix-for-woocommerce' ), 259 'finix_gateway_options' => __( 'Plugin Options', 'finix-for-woocommerce' ), 260 CardGateway::SLUG => __( 'Cards', 'finix-for-woocommerce' ), 261 BankGateway::SLUG => __( 'Bank/ACH', 'finix-for-woocommerce' ), 262 ApplePayGateway::SLUG => __( 'Apple Pay', 'finix-for-woocommerce' ), 263 GooglePayGateway::SLUG => __( 'Google Pay', 'finix-for-woocommerce' ), 261 264 ]; 262 265 ?> … … 339 342 <tr> 340 343 <td><?php esc_html_e( 'URL:', 'finix-for-woocommerce' ); ?></td> 341 <td><code><?php echo esc_url( home_url( 'wc-api/finix_gateway') ); ?></code></td>344 <td><code><?php echo esc_url( WC()->api_request_url( CardGateway::SLUG ) ); ?></code></td> 342 345 </tr> 343 346 <tr> … … 377 380 public function set_plugin_options(): void { // phpcs:ignore Generic.Metrics.CyclomaticComplexity 378 381 379 $this->plugin_options = get_option( 'woocommerce_' . Card BankGateway::SLUG . '_settings', [] );382 $this->plugin_options = get_option( 'woocommerce_' . CardGateway::SLUG . '_settings', [] ); 380 383 381 384 $this->is_sandbox_mode = ! isset( $this->plugin_options['testmode'] ) || $this->plugin_options['testmode'] === 'sandbox'; -
finix-for-woocommerce/trunk/src/Gateways/GooglePayGateway.php
r3316914 r3375717 21 21 public string $merchant_name; 22 22 public string $google_merchant_id; 23 24 public array $plugin_options;25 23 26 24 /** … … 102 100 'title' => __( 'Description', 'finix-for-woocommerce' ), 103 101 'type' => 'textarea', 104 'description' => __( 'This controls the description which the user sees during checkout. ', 'finix-for-woocommerce' ),102 'description' => __( 'This controls the description which the user sees during checkout. It will be wrapped in the paragraph tag.', 'finix-for-woocommerce' ), 105 103 'default' => '', 106 104 'desc_tip' => true, -
finix-for-woocommerce/trunk/src/Gateways/PaymentMethods/ApplePay.php
r3316914 r3375717 6 6 use FinixWC\Helpers\Assets; 7 7 use FinixWC\Helpers\Convert; 8 use FinixWC\Helpers\CartData; 8 9 9 10 /** … … 44 45 * Prepare JS scripts handles used to embed JS on the front-end. 45 46 */ 46 public function get_payment_method_script_handles(): array { // phpcs:ignore Generic.Metrics.CyclomaticComplexity .TooHigh47 public function get_payment_method_script_handles(): array { // phpcs:ignore Generic.Metrics.CyclomaticComplexity 47 48 48 49 $handles = []; … … 80 81 $order_amount = '0.00'; 81 82 83 $is_order_pay_page = false; 84 $order_id = 0; 85 82 86 // We might not have a cart over here, so retrieve the data from the current order page. 83 87 if ( is_checkout_pay_page() ) { … … 95 99 } 96 100 101 // Get data for order details. 102 $order_details = CartData::prepare_order_tracking_details(); 103 97 104 wp_localize_script( 98 105 'finix_apple_pay_gateway-checkout-block', … … 104 111 'merchant_country' => sanitize_text_field( wc_format_country_state_string( get_option( 'woocommerce_default_country', '' ) )['country'] ), 105 112 'amount' => Convert::amount_to_number( $order_amount ), 113 'currency_code' => sanitize_text_field( get_woocommerce_currency() ), 106 114 'button_style' => esc_attr( $this->gateway->button_style ), 107 115 'button_type' => esc_attr( $this->gateway->button_type ), … … 109 117 'gateway' => esc_html( $this->gateway->id ), 110 118 'billing_data' => WC()->customer->get_billing(), 119 'products' => $order_details['products'] ?? new stdClass(), 120 'subtotal' => $order_details['subtotal'], 121 'shipping_amount' => $order_details['shipping_amount'], 122 'tax_amount' => $order_details['tax_amount'], 123 'coupons' => $order_details['coupons'] ?? [], 111 124 'text' => [ 112 125 'error_processing' => esc_html__( 'There was an error while processing your payment. Please try again later.', 'finix-for-woocommerce' ), 113 126 'error_billing' => esc_html__( 'Please enter a valid billing address.', 'finix-for-woocommerce' ), 127 'subtotal' => esc_html__( 'Subtotal', 'finix-for-woocommerce' ), 128 'shipping' => esc_html__( 'Shipping', 'finix-for-woocommerce' ), 129 'tax' => esc_html__( 'Tax', 'finix-for-woocommerce' ), 130 'discount_code' => esc_html__( 'Discount code:', 'finix-for-woocommerce' ), 114 131 ], 115 132 'url' => [ -
finix-for-woocommerce/trunk/src/Gateways/PaymentMethods/FinixMethod.php
r3278388 r3375717 14 14 * Payment gateway powering this method. 15 15 */ 16 protected FinixGateway $gateway;16 protected ?FinixGateway $gateway; 17 17 18 18 /** … … 21 21 public function is_active(): bool { 22 22 23 return $this->gateway->is_available(); 23 static $initialized = []; 24 25 if ( isset( $initialized[ $this->name ] ) && $initialized[ $this->name ] && ! empty( $this->gateway ) ) { 26 return $this->gateway->is_available(); 27 } 28 29 // Get the instance of the gateway from WooCommerce. 30 $gateways = WC()->payment_gateways()->get_available_payment_gateways(); 31 32 $this->gateway = $gateways[ $this->name ] ?? null; 33 34 $initialized[ $this->name ] = true; 35 36 return $this->gateway ? $this->gateway->is_available() : false; 24 37 } 25 38 26 39 /** 27 * Prepare the payment method data that will be passed to the front-end and used on Checkout page. 40 * Prepare the payment method data that will be passed to the front-end and used on the Checkout page. 41 * TODO: move here some (if not all) finix_params values. Currently only Card & Bank migrated. 28 42 */ 29 43 public function get_payment_method_data(): array { … … 37 51 38 52 /** 39 * Prepare JS scripts handles used to embed JS in the admin area.53 * Prepare JS scripts handles that are used to embed JS in the admin area. 40 54 */ 41 55 public function get_payment_method_script_handles_for_admin(): array { -
finix-for-woocommerce/trunk/src/Payments.php
r3316914 r3375717 3 3 namespace FinixWC; 4 4 5 use FinixWC\Gateways\Card BankGateway;5 use FinixWC\Gateways\CardGateway; 6 6 use FinixWC\Helpers\Convert; 7 use FinixWC\Helpers\CartData; 7 8 8 9 /** … … 33 34 add_action( 'wp_ajax_validate_shipping_required', [ $this, 'validate_shipping_required' ] ); 34 35 add_action( 'wp_ajax_nopriv_validate_shipping_required', [ $this, 'validate_shipping_required' ] ); 36 37 add_action( 'wp_ajax_get_order_tracking_details', [ $this, 'get_order_tracking_details' ] ); 38 add_action( 'wp_ajax_nopriv_get_order_tracking_details', [ $this, 'get_order_tracking_details' ] ); 35 39 } 36 40 … … 89 93 90 94 if ( 91 $order->get_payment_method() === Card BankGateway::SLUG &&95 $order->get_payment_method() === CardGateway::SLUG && 92 96 $order->get_status() === 'on-hold' 93 97 ) { … … 247 251 die(); 248 252 } 253 254 /** 255 * Returns data for order tracking details based on WC. 256 */ 257 public function get_order_tracking_details(): void { 258 259 // Prepare the request to get order tracking details. 260 $body = file_get_contents( 'php://input' ); 261 $data = json_decode( $body, true ); 262 263 // Sanitize before using data. Skip nonce as it is sanitized in wp_verify_nonce. 264 $data = array_map( 'sanitize_text_field', $data ); 265 266 $response_data = CartData::prepare_order_tracking_details( 267 $data['is_order_pay_page'] ?? false, 268 $data['order_id'] ?? 0 269 ); 270 271 wp_send_json_success( $response_data ); 272 } 249 273 } -
finix-for-woocommerce/trunk/src/Plugin.php
r3316914 r3375717 8 8 use FinixWC\Admin\Admin; 9 9 use FinixWC\Finix\API; 10 use FinixWC\Gateways\PaymentMethods\CardBank; 10 use FinixWC\Gateways\PaymentMethods\BankMethod; 11 use FinixWC\Gateways\PaymentMethods\CardMethod; 11 12 use FinixWC\Gateways\PaymentMethods\ApplePay; 12 13 use FinixWC\Gateways\PaymentMethods\GooglePay; 13 14 use FinixWC\Gateways\ApplePayGateway; 14 use FinixWC\Gateways\CardBankGateway; 15 use FinixWC\Gateways\BankGateway; 16 use FinixWC\Gateways\CardGateway; 15 17 use FinixWC\Gateways\GooglePayGateway; 16 18 … … 107 109 public function register_finix_gateways( array $gateways ): array { 108 110 109 $gateways[] = CardBankGateway::class; 111 $gateways[] = CardGateway::class; 112 $gateways[] = BankGateway::class; 110 113 $gateways[] = ApplePayGateway::class; 111 114 $gateways[] = GooglePayGateway::class; … … 140 143 'woocommerce_blocks_payment_method_type_registration', 141 144 static function ( WooPaymentMethodRegistry $payment_method_registry ) { 142 $payment_method_registry->register( new CardBank() ); 145 $payment_method_registry->register( new CardMethod() ); 146 $payment_method_registry->register( new BankMethod() ); 143 147 $payment_method_registry->register( new ApplePay() ); 144 148 $payment_method_registry->register( new GooglePay() ); -
finix-for-woocommerce/trunk/vendor/composer/autoload_classmap.php
r3316914 r3375717 26 26 'FinixWC\\Finix\\Endpoint' => $baseDir . '/src/Finix/Endpoint.php', 27 27 'FinixWC\\Finix\\InstrumentToken' => $baseDir . '/src/Finix/InstrumentToken.php', 28 'FinixWC\\Finix\\Tags' => $baseDir . '/src/Finix/Tags.php', 28 29 'FinixWC\\Finix\\Transfer' => $baseDir . '/src/Finix/Transfer.php', 29 30 'FinixWC\\Gateways\\ApplePayGateway' => $baseDir . '/src/Gateways/ApplePayGateway.php', 31 'FinixWC\\Gateways\\BankGateway' => $baseDir . '/src/Gateways/BankGateway.php', 30 32 'FinixWC\\Gateways\\CardBankGateway' => $baseDir . '/src/Gateways/CardBankGateway.php', 33 'FinixWC\\Gateways\\CardGateway' => $baseDir . '/src/Gateways/CardGateway.php', 31 34 'FinixWC\\Gateways\\FinixGateway' => $baseDir . '/src/Gateways/FinixGateway.php', 32 35 'FinixWC\\Gateways\\GooglePayGateway' => $baseDir . '/src/Gateways/GooglePayGateway.php', 33 36 'FinixWC\\Gateways\\PaymentMethods\\ApplePay' => $baseDir . '/src/Gateways/PaymentMethods/ApplePay.php', 34 'FinixWC\\Gateways\\PaymentMethods\\CardBank' => $baseDir . '/src/Gateways/PaymentMethods/CardBank.php', 37 'FinixWC\\Gateways\\PaymentMethods\\BankMethod' => $baseDir . '/src/Gateways/PaymentMethods/BankMethod.php', 38 'FinixWC\\Gateways\\PaymentMethods\\CardBankMethod' => $baseDir . '/src/Gateways/PaymentMethods/CardBankMethod.php', 39 'FinixWC\\Gateways\\PaymentMethods\\CardMethod' => $baseDir . '/src/Gateways/PaymentMethods/CardMethod.php', 35 40 'FinixWC\\Gateways\\PaymentMethods\\FinixMethod' => $baseDir . '/src/Gateways/PaymentMethods/FinixMethod.php', 36 41 'FinixWC\\Gateways\\PaymentMethods\\GooglePay' => $baseDir . '/src/Gateways/PaymentMethods/GooglePay.php', 37 42 'FinixWC\\Helpers\\Assets' => $baseDir . '/src/Helpers/Assets.php', 43 'FinixWC\\Helpers\\CartData' => $baseDir . '/src/Helpers/CartData.php', 38 44 'FinixWC\\Helpers\\Check' => $baseDir . '/src/Helpers/Check.php', 39 45 'FinixWC\\Helpers\\Convert' => $baseDir . '/src/Helpers/Convert.php', -
finix-for-woocommerce/trunk/vendor/composer/autoload_static.php
r3316914 r3375717 41 41 'FinixWC\\Finix\\Endpoint' => __DIR__ . '/../..' . '/src/Finix/Endpoint.php', 42 42 'FinixWC\\Finix\\InstrumentToken' => __DIR__ . '/../..' . '/src/Finix/InstrumentToken.php', 43 'FinixWC\\Finix\\Tags' => __DIR__ . '/../..' . '/src/Finix/Tags.php', 43 44 'FinixWC\\Finix\\Transfer' => __DIR__ . '/../..' . '/src/Finix/Transfer.php', 44 45 'FinixWC\\Gateways\\ApplePayGateway' => __DIR__ . '/../..' . '/src/Gateways/ApplePayGateway.php', 46 'FinixWC\\Gateways\\BankGateway' => __DIR__ . '/../..' . '/src/Gateways/BankGateway.php', 45 47 'FinixWC\\Gateways\\CardBankGateway' => __DIR__ . '/../..' . '/src/Gateways/CardBankGateway.php', 48 'FinixWC\\Gateways\\CardGateway' => __DIR__ . '/../..' . '/src/Gateways/CardGateway.php', 46 49 'FinixWC\\Gateways\\FinixGateway' => __DIR__ . '/../..' . '/src/Gateways/FinixGateway.php', 47 50 'FinixWC\\Gateways\\GooglePayGateway' => __DIR__ . '/../..' . '/src/Gateways/GooglePayGateway.php', 48 51 'FinixWC\\Gateways\\PaymentMethods\\ApplePay' => __DIR__ . '/../..' . '/src/Gateways/PaymentMethods/ApplePay.php', 49 'FinixWC\\Gateways\\PaymentMethods\\CardBank' => __DIR__ . '/../..' . '/src/Gateways/PaymentMethods/CardBank.php', 52 'FinixWC\\Gateways\\PaymentMethods\\BankMethod' => __DIR__ . '/../..' . '/src/Gateways/PaymentMethods/BankMethod.php', 53 'FinixWC\\Gateways\\PaymentMethods\\CardBankMethod' => __DIR__ . '/../..' . '/src/Gateways/PaymentMethods/CardBankMethod.php', 54 'FinixWC\\Gateways\\PaymentMethods\\CardMethod' => __DIR__ . '/../..' . '/src/Gateways/PaymentMethods/CardMethod.php', 50 55 'FinixWC\\Gateways\\PaymentMethods\\FinixMethod' => __DIR__ . '/../..' . '/src/Gateways/PaymentMethods/FinixMethod.php', 51 56 'FinixWC\\Gateways\\PaymentMethods\\GooglePay' => __DIR__ . '/../..' . '/src/Gateways/PaymentMethods/GooglePay.php', 52 57 'FinixWC\\Helpers\\Assets' => __DIR__ . '/../..' . '/src/Helpers/Assets.php', 58 'FinixWC\\Helpers\\CartData' => __DIR__ . '/../..' . '/src/Helpers/CartData.php', 53 59 'FinixWC\\Helpers\\Check' => __DIR__ . '/../..' . '/src/Helpers/Check.php', 54 60 'FinixWC\\Helpers\\Convert' => __DIR__ . '/../..' . '/src/Helpers/Convert.php', -
finix-for-woocommerce/trunk/vendor/composer/installed.php
r3316914 r3375717 2 2 'root' => array( 3 3 'name' => 'finix-payments/finix-for-woocommerce', 4 'pretty_version' => '1. 2.0',5 'version' => '1. 2.0.0',4 'pretty_version' => '1.3.0', 5 'version' => '1.3.0.0', 6 6 'reference' => null, 7 7 'type' => 'library', … … 12 12 'versions' => array( 13 13 'finix-payments/finix-for-woocommerce' => array( 14 'pretty_version' => '1. 2.0',15 'version' => '1. 2.0.0',14 'pretty_version' => '1.3.0', 15 'version' => '1.3.0.0', 16 16 'reference' => null, 17 17 'type' => 'library',
Note: See TracChangeset
for help on using the changeset viewer.