Plugin Directory

Changeset 3375717


Ignore:
Timestamp:
10/09/2025 12:52:12 PM (2 months ago)
Author:
slaFFik
Message:

Finix for WooCommerce 1.3.0

Location:
finix-for-woocommerce
Files:
117 added
5 deleted
43 edited

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
    118#radio-control-wc-payment-method-options-finix_google_pay_gateway__label img {
    219  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  
    161161
    162162.settings-content .form-table #woocommerce_finix_gateway_description,
     163.settings-content .form-table #woocommerce_finix_bank_gateway_description,
    163164.settings-content .form-table #woocommerce_finix_apple_pay_gateway_description {
    164165  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  
    55
    66.wc_payment_method.payment_method_finix_gateway label img,
     7.wc_payment_method.payment_method_finix_bank_gateway label img,
    78.wc_payment_method.payment_method_finix_apple_pay_gateway label img,
    89.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  
    11var 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();
    49
    510        // Clean unwanted currency symbols, letters, non-breaking spaces, etc.
     
    4247        return parseFloat( cleanTotal ).toFixed( decimals );
    4348    },
     49
     50    getUpdatedTotal: function () {
     51        return this.getUpdatedValue( '.woocommerce-checkout-review-order-table .order-total .woocommerce-Price-amount' );
     52    },
    4453};
  • finix-for-woocommerce/trunk/assets/js/finix-helpers.min.js

    r3316914 r3375717  
    1 var FinixHelpers={getUpdatedTotal: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)}};
     1var 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  
    312312        // The Apple Pay JS API is not available.
    313313        const applePayfieldset = document.querySelector( 'fieldset#wc-finix_apple_pay_gateway-form' );
     314        // If applePayfieldset is not found, return.
     315        if ( ! applePayfieldset ) {
     316            return;
     317        }
    314318        applePayfieldset.style.display = 'none';
    315319        const applePayContainer = document.querySelector( '.wc_payment_method.payment_method_finix_apple_pay_gateway' );
     
    351355     */
    352356    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() {
    353390        let placeOrderButton;
    354391        let applePayButton;
     
    371408            placeOrderButton.style.display = 'block';
    372409        }
    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    }
    382500
    383501    /**
     
    385503     */
    386504    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 );
    423509} );
  • 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")});
     1function 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  
    4848        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' ) }`,
    4949        fontFamily: referenceInput.css( 'font-family' ),
    50         fontSize: referenceInput.css( 'font-size' ),
     50        // fontSize: referenceInput.css( 'font-size' ),
    5151        fontWeight: referenceInput.css( 'font-weight' ),
    5252        lineHeight: referenceInput.css( 'line-height' ),
    5353        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' ) }`,
    5555        maxHeight: '100%',
     56        height: '100%',
    5657        appearance: 'auto',
    5758    };
     
    8788    jQuery.scroll_to_notices( scrollElement );
    8889
    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' );
    9091    jQuery( document.body ).trigger( 'checkout_error', [ errorMessage ] );
    9192}
    9293
    9394// Modify the tokenRequest function to accept successCallback and errorCallback as parameters.
    94 async function tokenRequest( form ) {
     95async function tokenRequest( form, selected_payment_method ) {
    9596    // Disable the place_order button to prevent multiple submissions.
    9697    document.getElementById( 'place_order' ).disabled = true;
     
    102103                // Handle error.
    103104                triggerFinixSubmitError();
    104                 document.getElementById( 'finix_token' ).value = '';
     105                document.getElementById( selected_payment_method + '_token' ).value = '';
    105106                document.getElementById( 'place_order' ).disabled = false;
     107
    106108                // Reject the promise with the error.
    107109                reject( err );
     
    110112                const tokenData = res.data || {};
    111113                const token = tokenData.id;
     114
    112115                // Handle success.
    113                 document.getElementById( 'finix_token' ).value = token;
     116                document.getElementById( selected_payment_method + '_token' ).value = token;
    114117                document.getElementById( 'place_order' ).disabled = false;
     118
    115119                // Resolve the promise with the token.
    116120                resolve( token );
     
    121125
    122126/**
    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.
    124130 *
    125131 * @returns {object|null}
    126132 */
    127 function initFinixForm() {
    128     const formIdentifier = 'finix-form';
    129     const formContent = document.getElementById( formIdentifier ).innerHTML;
     133function initFinixForm( identifier ) {
     134    const formContent = document.getElementById( identifier + '-form' ).innerHTML;
    130135
    131136    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        }
    147146    }
    148147
     
    157156 *
    158157 * @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 */
     159function processPlaceOrder( checkoutForm ) {
    162160    jQuery( document ).on( 'click', '#place_order', async function ( event ) {
    163161        const selected_payment_method = jQuery( 'input[name="payment_method"]:checked', checkoutForm ).val();
    164162
    165         if ( selected_payment_method !== finix_params.gateway ) {
     163        if ( ! [ 'finix_gateway', 'finix_bank_gateway' ].includes( selected_payment_method ) ) {
    166164            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;
    167176        }
    168177
     
    172181
    173182        // We don't have a token.
    174         if ( ! checkoutForm.find( '#finix_token' ).val() ) {
     183        if ( ! checkoutForm.find( '#' + selected_payment_method + '_token' ).val() ) {
    175184            try {
    176185                // Wait until the token request finishes.
    177                 let token = await tokenRequest( finixForm );
     186                let token = await tokenRequest( currentFinixForm, selected_payment_method );
    178187
    179188                if ( token ) {
     
    183192            } catch ( error ) {
    184193                // 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;
    186198
    187199                return false;
     
    215227    // Initialize the Finix Auth session together with our nonce.
    216228    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        }
    217233        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        }
    218239        checkoutForm.find( '#finix_nonce' ).val( finix_params.nonce );
    219240    } );
    220241
    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,
    242298    // so Finix will re-request it.
    243299    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 = '';
    245302    } );
    246303} );
  • 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=""})}});
     1let 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  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Finix for WooCommerce 1.2.0\n"
     5"Project-Id-Version: Finix for WooCommerce 1.3.0\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/finix-for-woocommerce\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"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"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.12.0\n"
     
    4040msgstr ""
    4141
    42 #: src/Admin/Admin.php:46
     42#: src/Admin/Admin.php:48
    4343msgid "Settings"
    4444msgstr ""
    4545
    4646#. translators: %s - current currency code.
    47 #: src/Admin/Admin.php:71
     47#: src/Admin/Admin.php:73
    4848#, php-format
    4949msgid "Finix for WooCommerce does not currently support the currency of your store: %s."
     
    5151
    5252#. translators: %s - supported currency codes.
    53 #: src/Admin/Admin.php:81
     53#: src/Admin/Admin.php:83
    5454#, php-format
    5555msgid "<strong>All the payments will be declined.</strong> Supported currencies: %s."
     
    7777#: src/Events/CardAchPaymentEvent.php:69
    7878#: src/Events/CardAchPaymentEvent.php:97
    79 #: src/Events/CardAchPaymentEvent.php:134
     79#: src/Events/CardAchPaymentEvent.php:136
    8080#: src/Events/GooglePayPaymentCompletedEvent.php:38
    8181msgid "Payment error: There was an error while processing your payment. Please try again."
    8282msgstr ""
    8383
    84 #: src/Events/ApplePayPaymentCompletedEvent.php:69
    85 #: src/Events/ApplePayPaymentCompletedEvent.php:80
    86 #: src/Events/ApplePayPaymentCompletedEvent.php:91
    87 #: src/Events/ApplePayPaymentCompletedEvent.php:103
    88 #: src/Events/GooglePayPaymentCompletedEvent.php:69
    89 #: src/Events/GooglePayPaymentCompletedEvent.php:80
    90 #: src/Events/GooglePayPaymentCompletedEvent.php:91
    91 #: src/Events/GooglePayPaymentCompletedEvent.php:103
     84#: 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
    9292msgid "Payment error: There was an error while processing your payment. Please contact support if you were charged."
    9393msgstr ""
    9494
    95 #: src/Events/ApplePayPaymentCompletedEvent.php:108
    96 #: src/Events/GooglePayPaymentCompletedEvent.php:108
     95#: src/Events/ApplePayPaymentCompletedEvent.php:112
     96#: src/Events/GooglePayPaymentCompletedEvent.php:112
    9797msgid "Payment error: Could not validate payment. Amounts do not match."
    9898msgstr ""
    9999
    100 #: src/Events/ApplePayPaymentCompletedEvent.php:115
     100#: src/Events/ApplePayPaymentCompletedEvent.php:119
    101101msgid "Finix Apple Pay payment SUCCEEDED"
    102102msgstr ""
     
    116116#: src/Events/ApplePaySessionEvent.php:50
    117117#: src/Events/GooglePayPaymentEvent.php:128
    118 #: src/Gateways/ApplePayGateway.php:532
    119 #: src/Gateways/GooglePayGateway.php:472
     118#: src/Gateways/ApplePayGateway.php:558
     119#: src/Gateways/GooglePayGateway.php:470
    120120msgid "There was an error processing the payment."
    121121msgstr ""
     
    123123#: src/Events/ApplePayPaymentEvent.php:144
    124124#: src/Events/GooglePayPaymentEvent.php:144
    125 #: src/Gateways/ApplePayGateway.php:479
    126 #: src/Gateways/ApplePayGateway.php:489
    127 #: src/Gateways/GooglePayGateway.php:434
    128 #: src/Gateways/GooglePayGateway.php:444
     125#: src/Gateways/ApplePayGateway.php:505
     126#: src/Gateways/ApplePayGateway.php:515
     127#: src/Gateways/GooglePayGateway.php:432
     128#: src/Gateways/GooglePayGateway.php:442
    129129msgid "There was an error while processing the payment. Please try again later."
    130130msgstr ""
     
    166166
    167167#. translators: %s: Error message from Finix.
    168 #: src/Events/CardAchPaymentEvent.php:103
     168#: src/Events/CardAchPaymentEvent.php:105
    169169#, php-format
    170170msgid "Finix Payment method creation failed: %s"
    171171msgstr ""
    172172
    173 #: src/Events/CardAchPaymentEvent.php:112
     173#: src/Events/CardAchPaymentEvent.php:114
    174174msgid "Finix Payment method created successfully"
    175175msgstr ""
    176176
    177177#. translators: %s: Error message from Finix.
    178 #: src/Events/CardAchPaymentEvent.php:142
     178#: src/Events/CardAchPaymentEvent.php:144
    179179#, php-format
    180180msgid "Finix Payment error: %s"
    181181msgstr ""
    182182
    183 #: src/Events/CardAchPaymentEvent.php:161
     183#: src/Events/CardAchPaymentEvent.php:163
    184184msgid "Payment pending: There was an error while processing your payment. Please try again."
    185185msgstr ""
    186186
    187 #: src/Events/CardAchPaymentEvent.php:167
     187#: src/Events/CardAchPaymentEvent.php:169
    188188msgid "Awaiting payment confirmation from Finix."
    189189msgstr ""
    190190
    191 #: src/Events/CardAchPaymentEvent.php:177
     191#: src/Events/CardAchPaymentEvent.php:179
    192192msgid "Finix Payment processed successfully."
    193193msgstr ""
    194194
    195 #: src/Events/CardAchPaymentEvent.php:189
     195#: src/Events/CardAchPaymentEvent.php:191
    196196msgid "Payment failed: There was an error while processing your payment. Please try again."
    197197msgstr ""
    198198
    199199#. translators: %s: State of the payment.
    200 #: src/Events/CardAchPaymentEvent.php:196
     200#: src/Events/CardAchPaymentEvent.php:198
    201201#, php-format
    202202msgid "Finix Payment failed. State: %s"
     
    211211msgstr ""
    212212
    213 #: src/Events/GooglePayPaymentCompletedEvent.php:115
     213#: src/Events/GooglePayPaymentCompletedEvent.php:119
    214214msgid "Finix Google Pay payment SUCCEEDED"
    215215msgstr ""
     
    244244
    245245#: src/Gateways/ApplePayGateway.php:40
    246 #: assets/js/block/src/apple-pay.js:13
     246#: assets/js/block/src/apple-pay.js:15
    247247msgid "Pay with Apple Pay"
    248248msgstr ""
    249249
    250250#: 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
    253254msgid "General Settings"
    254255msgstr ""
    255256
    256257#: 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
    259261msgid "Status"
    260262msgstr ""
     
    265267
    266268#: 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
     272msgid "Title"
     273msgstr ""
     274
     275#: src/Gateways/ApplePayGateway.php:96
     276#: src/Gateways/BankGateway.php:52
     277#: src/Gateways/CardGateway.php:61
    268278#: src/Gateways/GooglePayGateway.php:95
    269 msgid "Title"
    270 msgstr ""
    271 
    272 #: src/Gateways/ApplePayGateway.php:96
    273 #: src/Gateways/CardBankGateway.php:101
    274 #: src/Gateways/GooglePayGateway.php:97
    275279msgid "This controls the title which the user sees during checkout."
    276280msgstr ""
    277281
    278282#: src/Gateways/ApplePayGateway.php:97
    279 #: src/Gateways/FinixGateway.php:259
     283#: src/Gateways/FinixGateway.php:262
    280284msgid "Apple Pay"
    281285msgstr ""
    282286
    283287#: 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
     291msgid "Description"
     292msgstr ""
     293
     294#: src/Gateways/ApplePayGateway.php:103
     295#: src/Gateways/BankGateway.php:59
     296#: src/Gateways/CardGateway.php:68
    285297#: 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."
     298msgid "This controls the description which the user sees during checkout. It will be wrapped in the paragraph tag."
    293299msgstr ""
    294300
     
    314320
    315321#: src/Gateways/ApplePayGateway.php:120
    316 #: src/Gateways/GooglePayGateway.php:121
     322#: src/Gateways/GooglePayGateway.php:119
    317323msgid "Button Type"
    318324msgstr ""
     
    391397
    392398#: src/Gateways/ApplePayGateway.php:146
    393 #: src/Gateways/GooglePayGateway.php:145
     399#: src/Gateways/GooglePayGateway.php:143
    394400msgid "Display Name"
    395401msgstr ""
     
    435441
    436442#: src/Gateways/ApplePayGateway.php:249
    437 #: src/Gateways/ApplePayGateway.php:367
    438 #: src/Gateways/PaymentMethods/ApplePay.php:113
     443#: src/Gateways/ApplePayGateway.php:393
     444#: src/Gateways/PaymentMethods/ApplePay.php:126
    439445#: src/Gateways/PaymentMethods/GooglePay.php:131
    440446msgid "Please enter a valid billing address."
     
    442448
    443449#: src/Gateways/ApplePayGateway.php:262
    444 #: src/Gateways/CardBankGateway.php:162
    445 #: src/Gateways/GooglePayGateway.php:195
     450#: src/Gateways/CardBankGateway.php:79
     451#: src/Gateways/GooglePayGateway.php:193
    446452msgid "TEST MODE ENABLED. All the payments will go through the sandbox."
    447453msgstr ""
    448454
    449 #: src/Gateways/ApplePayGateway.php:366
    450 #: src/Gateways/ApplePayGateway.php:416
    451 #: src/Gateways/CardBankGateway.php:195
    452 #: src/Gateways/GooglePayGateway.php:323
    453 #: src/Gateways/GooglePayGateway.php:385
    454 #: src/Gateways/PaymentMethods/ApplePay.php:112
     455#: 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
    455461#: src/Gateways/PaymentMethods/GooglePay.php:130
    456462msgid "There was an error while processing your payment. Please try again later."
    457463msgstr ""
    458464
    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
     468msgid "Subtotal"
     469msgstr ""
     470
     471#: src/Gateways/ApplePayGateway.php:395
     472#: src/Gateways/PaymentMethods/ApplePay.php:128
     473#: assets/js/block/src/apple-pay.js:305
     474msgid "Shipping"
     475msgstr ""
     476
     477#: src/Gateways/ApplePayGateway.php:396
     478#: src/Gateways/PaymentMethods/ApplePay.php:129
     479#: assets/js/block/src/apple-pay.js:314
     480msgid "Tax"
     481msgstr ""
     482
     483#: src/Gateways/ApplePayGateway.php:397
     484#: src/Gateways/PaymentMethods/ApplePay.php:130
     485#: assets/js/block/src/apple-pay.js:296
     486msgid "Discount code:"
     487msgstr ""
     488
     489#: src/Gateways/BankGateway.php:20
     490msgid "Finix Bank/ACH"
     491msgstr ""
     492
     493#: src/Gateways/BankGateway.php:21
     494msgid "Accept direct Bank payments with Finix."
     495msgstr ""
     496
     497#: src/Gateways/BankGateway.php:44
     498msgid "Enable Bank Gateway"
     499msgstr ""
     500
     501#: src/Gateways/BankGateway.php:53
     502#: assets/js/block/src/bank.js:15
     503msgid "Pay with Bank"
     504msgstr ""
     505
     506#: src/Gateways/BankGateway.php:74
     507msgid "Bank Payment Method"
     508msgstr ""
     509
     510#: src/Gateways/BankGateway.php:75
     511msgid "Take bank payments with Finix. You can configure available options on this page."
     512msgstr ""
     513
     514#: src/Gateways/CardBankGateway.php:34
     515msgid "Pay with Finix"
     516msgstr ""
     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
     525msgid "Full Name"
     526msgstr ""
     527
     528#: src/Gateways/CardBankGateway.php:151
     529#: src/Gateways/CardBankGateway.php:169
     530#: src/Gateways/PaymentMethods/CardBankMethod.php:111
     531msgid "Please enter a valid full name"
     532msgstr ""
     533
     534#: src/Gateways/CardBankGateway.php:170
     535#: assets/js/block/src/bank.js:106
     536#: assets/js/block/src/card.js:106
     537msgid "Please enter a valid city"
     538msgstr ""
     539
     540#: src/Gateways/CardBankGateway.php:215
    507541msgid "Refund failed."
    508542msgstr ""
    509543
    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
     545msgid "Finix Cards"
     546msgstr ""
     547
     548#: src/Gateways/CardGateway.php:21
     549msgid "Accept Credit and Debit Cards with Finix."
     550msgstr ""
     551
     552#: src/Gateways/CardGateway.php:53
     553msgid "Enable Card Gateway"
     554msgstr ""
     555
     556#: src/Gateways/CardGateway.php:62
     557#: assets/js/block/src/card.js:15
     558msgid "Pay with Card"
     559msgstr ""
     560
     561#: src/Gateways/CardGateway.php:83
     562msgid "Card Payment Method"
     563msgstr ""
     564
     565#: src/Gateways/CardGateway.php:84
     566msgid "Take card payments with Finix. You can configure available options on this page."
     567msgstr ""
     568
     569#: src/Gateways/FinixGateway.php:72
    531570msgid "Environment Settings"
    532571msgstr ""
    533572
    534 #: src/Gateways/FinixGateway.php:75
    535 #: src/Gateways/FinixGateway.php:76
     573#: src/Gateways/FinixGateway.php:77
     574#: src/Gateways/FinixGateway.php:78
    536575msgid "Environment"
    537576msgstr ""
    538577
    539 #: src/Gateways/FinixGateway.php:78
     578#: src/Gateways/FinixGateway.php:80
    540579msgid "Place the payment gateway in sandbox mode using test API keys."
    541580msgstr ""
    542581
    543 #: src/Gateways/FinixGateway.php:80
     582#: src/Gateways/FinixGateway.php:82
    544583msgid "Sandbox"
    545584msgstr ""
    546585
    547 #: src/Gateways/FinixGateway.php:81
     586#: src/Gateways/FinixGateway.php:83
    548587msgid "Live"
    549588msgstr ""
    550589
    551 #: src/Gateways/FinixGateway.php:87
     590#: src/Gateways/FinixGateway.php:89
    552591msgid "Custom Source Tag"
    553592msgstr ""
    554593
    555 #: src/Gateways/FinixGateway.php:89
     594#: src/Gateways/FinixGateway.php:91
    556595msgid "This tag will be used to identify the source of the payment. It will be used to tag the payment details send to Finix."
    557596msgstr ""
    558597
    559 #: src/Gateways/FinixGateway.php:97
     598#: src/Gateways/FinixGateway.php:99
    560599msgid "Sandbox Details"
    561600msgstr ""
    562601
    563 #: src/Gateways/FinixGateway.php:102
     602#: src/Gateways/FinixGateway.php:104
    564603msgid "Sandbox Application ID"
    565604msgstr ""
    566605
    567 #: src/Gateways/FinixGateway.php:104
     606#: src/Gateways/FinixGateway.php:106
    568607msgid "This is the application ID provided on Finix dashboard -> developer menu by selecting sandbox environment"
    569608msgstr ""
    570609
    571 #: src/Gateways/FinixGateway.php:109
     610#: src/Gateways/FinixGateway.php:111
    572611msgid "Sandbox Username"
    573612msgstr ""
    574613
    575 #: src/Gateways/FinixGateway.php:113
     614#: src/Gateways/FinixGateway.php:115
    576615msgid "Sandbox Password"
    577616msgstr ""
    578617
    579 #: src/Gateways/FinixGateway.php:117
     618#: src/Gateways/FinixGateway.php:119
    580619msgid "Sandbox Merchant ID (USD)"
    581620msgstr ""
    582621
    583 #: src/Gateways/FinixGateway.php:119
     622#: src/Gateways/FinixGateway.php:121
     623#: src/Gateways/FinixGateway.php:158
     624msgid "This is the USD merchant ID that you can get on the Finix Merchant Accounts page"
     625msgstr ""
     626
     627#: src/Gateways/FinixGateway.php:126
     628msgid "Sandbox Merchant ID (CAD)"
     629msgstr ""
     630
     631#: src/Gateways/FinixGateway.php:128
     632#: src/Gateways/FinixGateway.php:165
     633msgid "This is the CAD merchant ID that you can get on the Finix Merchant Accounts page"
     634msgstr ""
     635
     636#: src/Gateways/FinixGateway.php:136
     637msgid "Production Details"
     638msgstr ""
     639
     640#: src/Gateways/FinixGateway.php:141
     641msgid "Live Application ID"
     642msgstr ""
     643
     644#: src/Gateways/FinixGateway.php:143
     645msgid "This is the application ID provided on Finix dashboard -> developer menu by selecting live environment"
     646msgstr ""
     647
     648#: src/Gateways/FinixGateway.php:148
     649msgid "Live Username"
     650msgstr ""
     651
     652#: src/Gateways/FinixGateway.php:152
     653msgid "Live Password"
     654msgstr ""
     655
    584656#: 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
     657msgid "Live Merchant ID (USD)"
     658msgstr ""
     659
    593660#: 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:134
    598 msgid "Production Details"
    599 msgstr ""
    600 
    601 #: src/Gateways/FinixGateway.php:139
    602 msgid "Live Application ID"
    603 msgstr ""
    604 
    605 #: src/Gateways/FinixGateway.php:141
    606 msgid "This is the application ID provided on Finix dashboard -> developer menu by selecting live environment"
    607 msgstr ""
    608 
    609 #: src/Gateways/FinixGateway.php:146
    610 msgid "Live Username"
    611 msgstr ""
    612 
    613 #: src/Gateways/FinixGateway.php:150
    614 msgid "Live Password"
    615 msgstr ""
    616 
    617 #: src/Gateways/FinixGateway.php:154
    618 msgid "Live Merchant ID (USD)"
    619 msgstr ""
    620 
    621 #: src/Gateways/FinixGateway.php:161
    622661msgid "Live Merchant ID (CAD)"
    623662msgstr ""
    624663
    625 #: src/Gateways/FinixGateway.php:171
     664#: src/Gateways/FinixGateway.php:173
    626665msgid "Advanced Settings"
    627666msgstr ""
    628667
    629 #: src/Gateways/FinixGateway.php:176
    630 #: src/Gateways/FinixGateway.php:177
     668#: src/Gateways/FinixGateway.php:178
     669#: src/Gateways/FinixGateway.php:179
    631670msgid "Dispute Created"
    632671msgstr ""
    633672
    634 #: src/Gateways/FinixGateway.php:179
     673#: src/Gateways/FinixGateway.php:181
    635674msgid "If enabled, the plugin will listen to the dispute.created webhook event and update the order state if a dispute is created."
    636675msgstr ""
    637676
    638 #: src/Gateways/FinixGateway.php:184
     677#: src/Gateways/FinixGateway.php:186
    639678msgid "Disputes Order State"
    640679msgstr ""
    641680
    642 #: src/Gateways/FinixGateway.php:186
     681#: src/Gateways/FinixGateway.php:188
    643682msgid "Choose an order status when a payment dispute is received."
    644683msgstr ""
    645684
    646 #: src/Gateways/FinixGateway.php:192
    647 #: src/Gateways/FinixGateway.php:193
     685#: src/Gateways/FinixGateway.php:194
     686#: src/Gateways/FinixGateway.php:195
    648687msgid "ACH Return Created"
    649688msgstr ""
    650689
    651 #: src/Gateways/FinixGateway.php:195
     690#: src/Gateways/FinixGateway.php:197
    652691msgid "If enabled, the plugin will listen to ACH returns and update the order state if ACH return is created."
    653692msgstr ""
    654693
    655 #: src/Gateways/FinixGateway.php:200
     694#: src/Gateways/FinixGateway.php:202
    656695msgid "ACH Return Order State"
    657696msgstr ""
    658697
    659 #: src/Gateways/FinixGateway.php:202
     698#: src/Gateways/FinixGateway.php:204
    660699msgid "Choose an order status when an ACH Return is received."
    661700msgstr ""
    662701
    663 #: src/Gateways/FinixGateway.php:257
     702#: src/Gateways/FinixGateway.php:259
    664703msgid "Plugin Options"
    665704msgstr ""
    666705
    667706#: src/Gateways/FinixGateway.php:260
    668 #: src/Gateways/GooglePayGateway.php:98
     707msgid "Cards"
     708msgstr ""
     709
     710#: src/Gateways/FinixGateway.php:261
     711msgid "Bank/ACH"
     712msgstr ""
     713
     714#: src/Gateways/FinixGateway.php:263
     715#: src/Gateways/GooglePayGateway.php:96
    669716msgid "Google Pay"
    670717msgstr ""
    671718
    672 #: src/Gateways/FinixGateway.php:272
    673 #: src/Gateways/FinixGateway.php:273
     719#: src/Gateways/FinixGateway.php:275
     720#: src/Gateways/FinixGateway.php:276
    674721msgid "Finix Payments"
    675722msgstr ""
    676723
    677 #: src/Gateways/FinixGateway.php:318
     724#: src/Gateways/FinixGateway.php:321
    678725msgid "Webhook Configuration"
    679726msgstr ""
    680727
    681728#. translators: %s - Finix Dashboard URL.
    682 #: src/Gateways/FinixGateway.php:324
     729#: src/Gateways/FinixGateway.php:327
    683730#, php-format
    684731msgid "To enable webhook, please add the following details to your <a href=\"%s\" target=\"_blank\">Finix Dashboard</a>:"
    685732msgstr ""
    686733
    687 #: src/Gateways/FinixGateway.php:340
     734#: src/Gateways/FinixGateway.php:343
    688735msgid "URL:"
    689736msgstr ""
    690737
    691 #: src/Gateways/FinixGateway.php:344
     738#: src/Gateways/FinixGateway.php:347
    692739msgid "Authentication Type:"
    693740msgstr ""
    694741
    695 #: src/Gateways/FinixGateway.php:345
     742#: src/Gateways/FinixGateway.php:348
    696743msgid "Basic"
    697744msgstr ""
    698745
    699 #: src/Gateways/FinixGateway.php:348
     746#: src/Gateways/FinixGateway.php:351
    700747msgid "Username:"
    701748msgstr ""
    702749
    703 #: src/Gateways/FinixGateway.php:352
     750#: src/Gateways/FinixGateway.php:355
    704751msgid "Password:"
    705752msgstr ""
    706753
    707 #: src/Gateways/FinixGateway.php:356
     754#: src/Gateways/FinixGateway.php:359
    708755msgid "Required Events:"
    709756msgstr ""
    710757
    711 #: src/Gateways/GooglePayGateway.php:34
     758#: src/Gateways/GooglePayGateway.php:32
    712759msgid "Finix Google Pay"
    713760msgstr ""
    714761
    715 #: src/Gateways/GooglePayGateway.php:35
     762#: src/Gateways/GooglePayGateway.php:33
    716763msgid "Accept Google Pay payments with Finix."
    717764msgstr ""
    718765
    719 #: src/Gateways/GooglePayGateway.php:40
    720 #: assets/js/block/src/google-pay.js:14
     766#: src/Gateways/GooglePayGateway.php:38
     767#: assets/js/block/src/google-pay.js:16
    721768msgid "Pay with Google Pay"
    722769msgstr ""
    723770
    724 #: src/Gateways/GooglePayGateway.php:89
     771#: src/Gateways/GooglePayGateway.php:87
    725772msgid "Enable Google Pay Gateway"
    726773msgstr ""
    727774
     775#: src/Gateways/GooglePayGateway.php:107
     776msgid "Button Color"
     777msgstr ""
     778
    728779#: src/Gateways/GooglePayGateway.php:109
    729 msgid "Button Color"
     780msgid "Choose color for the Google Pay button."
    730781msgstr ""
    731782
    732783#: src/Gateways/GooglePayGateway.php:111
    733 msgid "Choose color for the Google Pay button."
     784msgid "Default Button"
     785msgstr ""
     786
     787#: src/Gateways/GooglePayGateway.php:112
     788msgid "Black Button"
    734789msgstr ""
    735790
    736791#: src/Gateways/GooglePayGateway.php:113
    737 msgid "Default Button"
    738 msgstr ""
    739 
    740 #: src/Gateways/GooglePayGateway.php:114
    741 msgid "Black Button"
    742 msgstr ""
    743 
    744 #: src/Gateways/GooglePayGateway.php:115
    745792msgid "White Button"
    746793msgstr ""
    747794
     795#: src/Gateways/GooglePayGateway.php:121
     796msgid "Choose which type of Google Pay button you want."
     797msgstr ""
     798
    748799#: src/Gateways/GooglePayGateway.php:123
    749 msgid "Choose which type of Google Pay button you want."
     800msgid "Plain Button"
     801msgstr ""
     802
     803#: src/Gateways/GooglePayGateway.php:124
     804msgid "Buy Button"
    750805msgstr ""
    751806
    752807#: src/Gateways/GooglePayGateway.php:125
    753 msgid "Plain Button"
     808msgid "Checkout Button"
    754809msgstr ""
    755810
    756811#: src/Gateways/GooglePayGateway.php:126
    757 msgid "Buy Button"
     812msgid "Donate Button"
    758813msgstr ""
    759814
    760815#: src/Gateways/GooglePayGateway.php:127
    761 msgid "Checkout Button"
     816msgid "Subscribe Button"
    762817msgstr ""
    763818
    764819#: src/Gateways/GooglePayGateway.php:128
    765 msgid "Donate Button"
     820msgid "Book Button"
    766821msgstr ""
    767822
    768823#: src/Gateways/GooglePayGateway.php:129
    769 msgid "Subscribe Button"
     824msgid "Order Button"
    770825msgstr ""
    771826
    772827#: src/Gateways/GooglePayGateway.php:130
    773 msgid "Book Button"
    774 msgstr ""
    775 
    776 #: src/Gateways/GooglePayGateway.php:131
    777 msgid "Order Button"
    778 msgstr ""
    779 
    780 #: src/Gateways/GooglePayGateway.php:132
    781828msgid "Pay Button"
    782829msgstr ""
    783830
     831#: src/Gateways/GooglePayGateway.php:136
     832msgid "Button Corner Radius"
     833msgstr ""
     834
    784835#: src/Gateways/GooglePayGateway.php:138
    785 msgid "Button Corner Radius"
    786 msgstr ""
    787 
    788 #: src/Gateways/GooglePayGateway.php:140
    789836msgid "Choose the corner radius for the Google Pay button. Default is 5px."
    790837msgstr ""
    791838
    792 #: src/Gateways/GooglePayGateway.php:147
     839#: src/Gateways/GooglePayGateway.php:145
    793840msgid "This will be the merchant name shown to users when making a purchase via Google Pay."
    794841msgstr ""
    795842
     843#: src/Gateways/GooglePayGateway.php:150
     844msgid "Google Merchant ID"
     845msgstr ""
     846
    796847#: src/Gateways/GooglePayGateway.php:152
    797 msgid "Google Merchant ID"
    798 msgstr ""
    799 
    800 #: src/Gateways/GooglePayGateway.php:154
    801848msgid "This is the Google Merchant ID. You can find it on your Google Business console."
    802849msgstr ""
    803850
     851#: src/Gateways/GooglePayGateway.php:167
     852msgid "Google Pay Payment Method"
     853msgstr ""
     854
    804855#: src/Gateways/GooglePayGateway.php:169
    805 msgid "Google Pay Payment Method"
    806 msgstr ""
    807 
    808 #: src/Gateways/GooglePayGateway.php:171
    809856msgid "Receive payments via Google Pay with Finix. You can configure the available options on this page."
    810857msgstr ""
    811858
     859#: src/Gateways/GooglePayGateway.php:322
     860msgid "There was an error processing the payment through Google Pay. Please try a different method or try again later."
     861msgstr ""
     862
     863#: src/Gateways/GooglePayGateway.php:323
     864msgid "Please enter a valid billing details."
     865msgstr ""
     866
    812867#: 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."
     868msgid "Please enter a valid shipping details."
    814869msgstr ""
    815870
    816871#: src/Gateways/GooglePayGateway.php:325
    817 msgid "Please enter a valid billing details."
    818 msgstr ""
    819 
    820 #: src/Gateways/GooglePayGateway.php:326
    821 msgid "Please enter a valid shipping details."
    822 msgstr ""
    823 
    824 #: src/Gateways/GooglePayGateway.php:327
    825872msgid "Missing details for Google Pay. Please contact the store owner."
    826873msgstr ""
    827874
    828 #: src/Payments.php:100
     875#: src/Payments.php:104
    829876msgid "Your order is currently on hold and will be processed once the payment is approved."
    830877msgstr ""
    831878
    832 #: src/Payments.php:115
     879#: src/Payments.php:119
    833880msgid "There was an error while processing this request."
    834881msgstr ""
    835882
    836 #: src/Payments.php:145
     883#: src/Payments.php:149
    837884msgid "Please review and fill in all the required information."
    838885msgstr ""
    839886
    840 #: src/Payments.php:171
     887#: src/Payments.php:175
    841888msgid "Please review and fill all the required information."
    842889msgstr ""
    843890
    844 #: src/Payments.php:184
     891#: src/Payments.php:188
    845892msgid "Invalid country provided."
    846893msgstr ""
    847894
    848 #: src/Payments.php:196
     895#: src/Payments.php:200
    849896msgid "Invalid state provided."
    850897msgstr ""
    851898
    852 #: src/Payments.php:226
     899#: src/Payments.php:230
    853900msgid "No shipping methods available for the provided address."
    854901msgstr ""
    855902
    856 #: src/Payments.php:246
     903#: src/Payments.php:250
    857904msgid "Shipping is required for this order."
    858905msgstr ""
    859906
    860 #: assets/js/block/src/apple-pay.js:235
     907#: assets/js/block/src/apple-pay.js:270
    861908msgid "Please make sure shipping and billing information is correct."
    862909msgstr ""
    863910
    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
    865913msgid "Please enter a valid name"
    866914msgstr ""
    867915
    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
    869918msgid "Unfortunately, there was an error while loading the payment form. Please try again later."
    870919msgstr ""
    871920
    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
    873923msgid "Unfortunately, there was an error while initializing a payment form."
    874924msgstr ""
     
    878928msgstr ""
    879929
    880 #: assets/js/block/src/google-pay.js:113
     930#: assets/js/block/src/google-pay.js:117
    881931msgid "There was an error while initializing Google Pay. Please check all the details and try again."
    882932msgstr ""
    883933
    884 #: assets/js/block/src/google-pay.js:124
     934#: assets/js/block/src/google-pay.js:128
    885935msgid "Please make sure shipping and billing information is correct and then try again."
    886936msgstr ""
  • finix-for-woocommerce/trunk/finix-for-woocommerce.php

    r3316914 r3375717  
    33 * Plugin Name:          Finix for WooCommerce
    44 * 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.0
     5 * Description:          Take credit card, bank, Apple Pay, and Google Pay payments on your store using Finix.
     6 * Version:              1.3.0
    77 * Author:               Finix
    88 * Author URI:           https://finix.com
    99 * License:              GPL v2 or later
    1010 * License URI:          https://www.gnu.org/licenses/gpl-2.0.html
    11  * Requires at least:    6.6
     11 * Requires at least:    6.7
    1212 * Requires PHP:         7.4
    1313 * Requires Plugins:     woocommerce
     
    1515 * Domain Path:          /assets/languages
    1616 *
    17  * WC requires at least: 9.7
    18  * WC tested up to:      9.9
     17 * WC requires at least: 9.9
     18 * WC tested up to:      10.2
    1919 */
    2020
     
    2222
    2323// phpcs:disable WPForms.Comments.PHPDocDefine.MissPHPDoc
    24 const FINIXWC_VERSION        = '1.2.0';
     24const FINIXWC_VERSION        = '1.3.0';
    2525const FINIXWC_PLUGIN_FILE    = __FILE__;
    26 const FINIXWC_MIN_WC_VERSION = '9.7.0';
     26const FINIXWC_MIN_WC_VERSION = '9.9.0';
    2727
    2828define( 'FINIXWC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
  • finix-for-woocommerce/trunk/readme.txt

    r3316914 r3375717  
    22Contributors: finixpayments, slaFFik
    33Tags: finix, credit card, ach, apple pay, woocommerce
    4 Requires at least: 6.6
     4Requires at least: 6.7
    55Tested up to: 6.8
    66Requires PHP: 7.4
    77Requires Plugins: woocommerce
    8 WC requires at least: 9.7
    9 WC tested up to: 9.9
    10 Stable tag: 1.2.0
     8WC requires at least: 9.9
     9WC tested up to: 10.2
     10Stable tag: 1.3.0
    1111License: GPLv2 or later
    1212License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    9191
    9292* PHP version 7.4 or greater
    93 * WordPress 6.6 or greater
    94 * WooCommerce 9.7 or greater
     93* WordPress 6.7 or greater
     94* WooCommerce 9.9 or greater
    9595* Finix account
    9696
    9797= Automatic installation =
    9898
    99 1. Install the plugin via Plugins -> New plugin. Search for "Finix for WooCommerce".
     991. Install the plugin via Plugins -> New plugin. Search for "Finix" or "Finix for WooCommerce".
    1001002. Activate the 'Finix for WooCommerce' plugin through the 'Plugins' menu in WordPress.
    1011013. Set your Finix API credentials key at WooCommerce -> Settings -> Payments -> Finix Gateway -> Plugin Options (or use the *Settings* link in the Plugins overview).
     
    117117
    1181181. 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
     1191. Card payment method settings
     1201. Bank payment method settings
     1211. Apple Pay payment method settings
     1221. Google Pay payment method settings
     1231. Plugin Options
    123124
    124125== 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.
    125136
    126137= 1.2.0 =
  • finix-for-woocommerce/trunk/src/Admin/Admin.php

    r3316914 r3375717  
    44
    55use FinixWC\Gateways\ApplePayGateway;
    6 use FinixWC\Gateways\CardBankGateway;
     6use FinixWC\Gateways\BankGateway;
     7use FinixWC\Gateways\CardGateway;
    78use FinixWC\Gateways\GooglePayGateway;
    89use FinixWC\Payments;
     
    1718     */
    1819    public const SECTIONS = [
    19         CardBankGateway::SLUG,
     20        CardGateway::SLUG,
     21        BankGateway::SLUG,
    2022        ApplePayGateway::SLUG,
    2123        GooglePayGateway::SLUG,
     
    2830
    2931    /**
    30      * Hooks for plugin admin area.
     32     * Hooks for the plugin admin area.
    3133     */
    3234    public function hooks(): void {
  • finix-for-woocommerce/trunk/src/Events/ApplePayPaymentCompletedEvent.php

    r3316914 r3375717  
    5757
    5858        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 );
    6569        }
    6670
  • finix-for-woocommerce/trunk/src/Events/CardAchPaymentEvent.php

    r3316914 r3375717  
    2424     * Process the payment.
    2525     */
    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
    2727
    2828        if ( empty( $this->order ) ) {
     
    6565
    6666        // phpcs:ignore WordPress.Security.NonceVerification.Missing
    67         if ( empty( $_POST['finix_token'] ) ) {
     67        if ( empty( $_POST[ $this->gateway->id . '_token' ] ) ) {
    6868            wc_add_notice(
    6969                esc_html__( 'Payment error: There was an error while processing your payment. Please try again.', 'finix-for-woocommerce' ),
     
    7979
    8080        // 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' ] ) );
    8282
    8383        $payment_instrument_feedback = finixwc()->finix_api->create_instrument_token()
     
    9999            );
    100100
     101            $errors = $payment_instrument_feedback['response']->_embedded->errors ?? $payment_instrument_feedback['error'] ?? [ '' ];
     102
    101103            $this->order->add_order_note(
    102104                sprintf( /* translators: %s: Error message from Finix. */
    103105                    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 )
    105107                )
    106108            );
  • finix-for-woocommerce/trunk/src/Events/GooglePayPaymentCompletedEvent.php

    r3316914 r3375717  
    5757
    5858        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 );
    6569        }
    6670
  • finix-for-woocommerce/trunk/src/Finix/API.php

    r3316914 r3375717  
    4343
    4444    public Endpoint $endpoint;
     45    public Tags $tags;
    4546
    4647    /**
     
    115116        }
    116117
    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();
    125143
    126144        $token = $this->get_token();
     
    173191        $data->idempotency_id = $order_id . '_' . time();
    174192
    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();
    181207
    182208        $token = $this->get_token();
  • finix-for-woocommerce/trunk/src/Finix/BuyerIdentity.php

    r3316914 r3375717  
    1313
    1414    protected $entity;
    15     protected $tags;
     15    protected Tags $tags;
    1616
    1717    protected WC_Abstract_Order $order;
     
    2323
    2424        $this->entity = new stdClass();
    25         $this->tags   = new stdClass();
     25        $this->tags   = new Tags();
    2626    }
    2727
     
    4949        $this->entity->personal_address->region      = $order->get_billing_state();
    5050
    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        );
    5458
    5559        return $this;
     
    7579        $this->entity->personal_address->region      = $data['state'] ?? '';
    7680
    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        );
    8088
    8189        return $this;
     
    97105        }
    98106
     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
    99113        $data = new stdClass();
    100114
    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 
    104115        $data->entity = $this->entity;
    105         $data->tags   = $this->tags;
     116        $data->tags   = $this->tags->prepare();
    106117
    107118        $response = wp_remote_post(
  • finix-for-woocommerce/trunk/src/Finix/InstrumentToken.php

    r3316914 r3375717  
    44
    55use FinixWC\Gateways\ApplePayGateway;
    6 use FinixWC\Gateways\CardBankGateway;
     6use FinixWC\Gateways\BankGateway;
     7use FinixWC\Gateways\CardGateway;
    78use FinixWC\Gateways\GooglePayGateway;
    89use stdClass;
     
    2829
    2930        switch ( sanitize_key( $gateway ) ) {
    30             case CardBankGateway::SLUG:
     31            case BankGateway::SLUG:
     32            case CardGateway::SLUG:
    3133                $this->type = 'TOKEN';
    3234                break;
     
    120122        $data->name     = $this->buyer_name;
    121123
    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();
    126137
    127138        $token = finixwc()->finix_api->get_token();
  • finix-for-woocommerce/trunk/src/Finix/Transfer.php

    r3316914 r3375717  
    5757     *
    5858     * @param string $transfer_id Transfer ID for which we want to update the tags.
    59      * @param array  $tags        Passing 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.
    6060     */
    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 {
    6262
    63         if ( empty( $tags ) ) {
     63        if ( empty( $raw_tags ) ) {
    6464            return [
    6565                'status'   => 400,
     
    7979        }
    8080
     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
    8187        $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();
    8989
    9090        $response = wp_safe_remote_request(
  • finix-for-woocommerce/trunk/src/Gateways/ApplePayGateway.php

    r3316914 r3375717  
    1010use FinixWC\Helpers\Assets;
    1111use FinixWC\Helpers\Convert;
     12use FinixWC\Helpers\CartData;
     13use stdClass;
    1214
    1315/**
     
    2123    public string $button_type;
    2224    public string $merchant_name;
    23 
    24     public array $plugin_options;
    2525
    2626    /**
     
    101101                'title'       => __( 'Description', 'finix-for-woocommerce' ),
    102102                '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' ),
    104104                'default'     => '',
    105105                'desc_tip'    => true,
     
    291291     * Enqueue the payment script and styles for shortcode-based checkout.
    292292     */
    293     public function payment_scripts(): void {
     293    public function payment_scripts(): void { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
    294294
    295295        // Only if gateway is enabled.
     
    349349            true
    350350        );
     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();
    351372
    352373        // Pass params to JavaScript and enqueue them.
     
    363384                'gateway'           => esc_html( $this->id ),
    364385                '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'] ?? [],
    365391                'text'              => [
    366392                    'error_processing' => esc_html__( 'There was an error while processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    367393                    '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' ),
    368398                ],
    369399                'url'               => [
     
    395425        }
    396426
    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>';
    402428
    403429        return $place_order_button;
  • finix-for-woocommerce/trunk/src/Gateways/CardBankGateway.php

    r3316914 r3375717  
    33namespace FinixWC\Gateways;
    44
     5use FinixWC\Events\AchPaymentProcessedEvent;
    56use FinixWC\Events\AchReturnEvent;
    6 use FinixWC\Events\AchPaymentProcessedEvent;
    77use FinixWC\Events\CardAchPaymentEvent;
    88use FinixWC\Events\DisputeEvent;
     
    1212
    1313/**
    14  * Gateway used for Card and Bank (ACH) payments.
     14 * Shared codebase between Bank (ACH) and Card (Credit/Debit) gateways.
    1515 */
    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;
     16abstract class CardBankGateway extends FinixGateway {
    2617
    2718    protected bool $is_dispute_managed;
     
    3627    public function __construct() { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks
    3728
    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 );
    4230
    4331        parent::__construct();
    4432
    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' );
    5836
    5937        $this->is_dispute_managed   = ( $this->get_option( 'manage_disputes' ) === 'yes' );
     
    6644
    6745        $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.Recommended
    77         $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         <?php
    151     }
    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         <?php
    18146    }
    18247
     
    20469
    20570    /**
    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
    24296    }
    24397
     
    247101    public function payment_scripts(): void {
    248102
    249         // Only if gateway is enabled.
     103        // Only if the gateway is enabled.
    250104        if ( $this->enabled === 'no' ) {
    251105            return;
     
    260114        // Only when legacy shortcode is used.
    261115        if ( has_block( 'woocommerce/checkout' ) && ! is_checkout_pay_page() ) {
     116            return;
     117        }
     118
     119        if ( wp_script_is( 'finix_gateway-checkout-shortcode', 'enqueued' ) ) {
    262120            return;
    263121        }
     
    306164                'merchant'           => get_woocommerce_currency() === 'CAD' ? esc_html( $this->merchant_id_cad ) : esc_html( $this->merchant_id ),
    307165                'application'        => esc_html( $this->application_id ),
    308                 'gateway'            => esc_html( $this->id ),
    309                 'payment_method'     => esc_html( $this->payment_method ),
    310166                'text'               => [
    311167                    'full_name'      => esc_html__( 'Full Name', 'finix-for-woocommerce' ),
     
    326182            Assets::ver()
    327183        );
     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 );
    328249    }
    329250
     
    489410        exit;
    490411    }
    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_decode
    506         $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     }
    517412}
  • finix-for-woocommerce/trunk/src/Gateways/FinixGateway.php

    r3316914 r3375717  
    3232    private WC_Logger $logger;
    3333
     34    public array $plugin_options;
     35
    3436    /**
    3537     * Common constructor.
     
    5557     * Should be called before any $this->get_option() calls.
    5658     */
    57     protected function init() {
     59    protected function init(): void {
    5860
    5961        $this->init_form_fields();
     
    6264
    6365    /**
    64      * Initialise settings form fields.
     66     * Initialize settings form fields.
    6567     */
    6668    public function init_form_fields(): void {
     
    255257
    256258        $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' ),
    261264        ];
    262265        ?>
     
    339342                    <tr>
    340343                        <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>
    342345                    </tr>
    343346                    <tr>
     
    377380    public function set_plugin_options(): void { // phpcs:ignore Generic.Metrics.CyclomaticComplexity
    378381
    379         $this->plugin_options = get_option( 'woocommerce_' . CardBankGateway::SLUG . '_settings', [] );
     382        $this->plugin_options = get_option( 'woocommerce_' . CardGateway::SLUG . '_settings', [] );
    380383
    381384        $this->is_sandbox_mode = ! isset( $this->plugin_options['testmode'] ) || $this->plugin_options['testmode'] === 'sandbox';
  • finix-for-woocommerce/trunk/src/Gateways/GooglePayGateway.php

    r3316914 r3375717  
    2121    public string $merchant_name;
    2222    public string $google_merchant_id;
    23 
    24     public array $plugin_options;
    2523
    2624    /**
     
    102100                'title'       => __( 'Description', 'finix-for-woocommerce' ),
    103101                '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' ),
    105103                'default'     => '',
    106104                'desc_tip'    => true,
  • finix-for-woocommerce/trunk/src/Gateways/PaymentMethods/ApplePay.php

    r3316914 r3375717  
    66use FinixWC\Helpers\Assets;
    77use FinixWC\Helpers\Convert;
     8use FinixWC\Helpers\CartData;
    89
    910/**
     
    4445     * Prepare JS scripts handles used to embed JS on the front-end.
    4546     */
    46     public function get_payment_method_script_handles(): array { // phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
     47    public function get_payment_method_script_handles(): array { // phpcs:ignore Generic.Metrics.CyclomaticComplexity
    4748
    4849        $handles = [];
     
    8081        $order_amount = '0.00';
    8182
     83        $is_order_pay_page = false;
     84        $order_id          = 0;
     85
    8286        // We might not have a cart over here, so retrieve the data from the current order page.
    8387        if ( is_checkout_pay_page() ) {
     
    9599        }
    96100
     101        // Get data for order details.
     102        $order_details = CartData::prepare_order_tracking_details();
     103
    97104        wp_localize_script(
    98105            'finix_apple_pay_gateway-checkout-block',
     
    104111                'merchant_country'  => sanitize_text_field( wc_format_country_state_string( get_option( 'woocommerce_default_country', '' ) )['country'] ),
    105112                'amount'            => Convert::amount_to_number( $order_amount ),
     113                'currency_code'     => sanitize_text_field( get_woocommerce_currency() ),
    106114                'button_style'      => esc_attr( $this->gateway->button_style ),
    107115                'button_type'       => esc_attr( $this->gateway->button_type ),
     
    109117                'gateway'           => esc_html( $this->gateway->id ),
    110118                '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'] ?? [],
    111124                'text'              => [
    112125                    'error_processing' => esc_html__( 'There was an error while processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    113126                    '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' ),
    114131                ],
    115132                'url'               => [
  • finix-for-woocommerce/trunk/src/Gateways/PaymentMethods/FinixMethod.php

    r3278388 r3375717  
    1414     * Payment gateway powering this method.
    1515     */
    16     protected FinixGateway $gateway;
     16    protected ?FinixGateway $gateway;
    1717
    1818    /**
     
    2121    public function is_active(): bool {
    2222
    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;
    2437    }
    2538
    2639    /**
    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.
    2842     */
    2943    public function get_payment_method_data(): array {
     
    3751
    3852    /**
    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.
    4054     */
    4155    public function get_payment_method_script_handles_for_admin(): array {
  • finix-for-woocommerce/trunk/src/Payments.php

    r3316914 r3375717  
    33namespace FinixWC;
    44
    5 use FinixWC\Gateways\CardBankGateway;
     5use FinixWC\Gateways\CardGateway;
    66use FinixWC\Helpers\Convert;
     7use FinixWC\Helpers\CartData;
    78
    89/**
     
    3334        add_action( 'wp_ajax_validate_shipping_required', [ $this, 'validate_shipping_required' ] );
    3435        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' ] );
    3539    }
    3640
     
    8993
    9094        if (
    91             $order->get_payment_method() === CardBankGateway::SLUG &&
     95            $order->get_payment_method() === CardGateway::SLUG &&
    9296            $order->get_status() === 'on-hold'
    9397        ) {
     
    247251        die();
    248252    }
     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    }
    249273}
  • finix-for-woocommerce/trunk/src/Plugin.php

    r3316914 r3375717  
    88use FinixWC\Admin\Admin;
    99use FinixWC\Finix\API;
    10 use FinixWC\Gateways\PaymentMethods\CardBank;
     10use FinixWC\Gateways\PaymentMethods\BankMethod;
     11use FinixWC\Gateways\PaymentMethods\CardMethod;
    1112use FinixWC\Gateways\PaymentMethods\ApplePay;
    1213use FinixWC\Gateways\PaymentMethods\GooglePay;
    1314use FinixWC\Gateways\ApplePayGateway;
    14 use FinixWC\Gateways\CardBankGateway;
     15use FinixWC\Gateways\BankGateway;
     16use FinixWC\Gateways\CardGateway;
    1517use FinixWC\Gateways\GooglePayGateway;
    1618
     
    107109    public function register_finix_gateways( array $gateways ): array {
    108110
    109         $gateways[] = CardBankGateway::class;
     111        $gateways[] = CardGateway::class;
     112        $gateways[] = BankGateway::class;
    110113        $gateways[] = ApplePayGateway::class;
    111114        $gateways[] = GooglePayGateway::class;
     
    140143            'woocommerce_blocks_payment_method_type_registration',
    141144            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() );
    143147                $payment_method_registry->register( new ApplePay() );
    144148                $payment_method_registry->register( new GooglePay() );
  • finix-for-woocommerce/trunk/vendor/composer/autoload_classmap.php

    r3316914 r3375717  
    2626    'FinixWC\\Finix\\Endpoint' => $baseDir . '/src/Finix/Endpoint.php',
    2727    'FinixWC\\Finix\\InstrumentToken' => $baseDir . '/src/Finix/InstrumentToken.php',
     28    'FinixWC\\Finix\\Tags' => $baseDir . '/src/Finix/Tags.php',
    2829    'FinixWC\\Finix\\Transfer' => $baseDir . '/src/Finix/Transfer.php',
    2930    'FinixWC\\Gateways\\ApplePayGateway' => $baseDir . '/src/Gateways/ApplePayGateway.php',
     31    'FinixWC\\Gateways\\BankGateway' => $baseDir . '/src/Gateways/BankGateway.php',
    3032    'FinixWC\\Gateways\\CardBankGateway' => $baseDir . '/src/Gateways/CardBankGateway.php',
     33    'FinixWC\\Gateways\\CardGateway' => $baseDir . '/src/Gateways/CardGateway.php',
    3134    'FinixWC\\Gateways\\FinixGateway' => $baseDir . '/src/Gateways/FinixGateway.php',
    3235    'FinixWC\\Gateways\\GooglePayGateway' => $baseDir . '/src/Gateways/GooglePayGateway.php',
    3336    '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',
    3540    'FinixWC\\Gateways\\PaymentMethods\\FinixMethod' => $baseDir . '/src/Gateways/PaymentMethods/FinixMethod.php',
    3641    'FinixWC\\Gateways\\PaymentMethods\\GooglePay' => $baseDir . '/src/Gateways/PaymentMethods/GooglePay.php',
    3742    'FinixWC\\Helpers\\Assets' => $baseDir . '/src/Helpers/Assets.php',
     43    'FinixWC\\Helpers\\CartData' => $baseDir . '/src/Helpers/CartData.php',
    3844    'FinixWC\\Helpers\\Check' => $baseDir . '/src/Helpers/Check.php',
    3945    'FinixWC\\Helpers\\Convert' => $baseDir . '/src/Helpers/Convert.php',
  • finix-for-woocommerce/trunk/vendor/composer/autoload_static.php

    r3316914 r3375717  
    4141        'FinixWC\\Finix\\Endpoint' => __DIR__ . '/../..' . '/src/Finix/Endpoint.php',
    4242        'FinixWC\\Finix\\InstrumentToken' => __DIR__ . '/../..' . '/src/Finix/InstrumentToken.php',
     43        'FinixWC\\Finix\\Tags' => __DIR__ . '/../..' . '/src/Finix/Tags.php',
    4344        'FinixWC\\Finix\\Transfer' => __DIR__ . '/../..' . '/src/Finix/Transfer.php',
    4445        'FinixWC\\Gateways\\ApplePayGateway' => __DIR__ . '/../..' . '/src/Gateways/ApplePayGateway.php',
     46        'FinixWC\\Gateways\\BankGateway' => __DIR__ . '/../..' . '/src/Gateways/BankGateway.php',
    4547        'FinixWC\\Gateways\\CardBankGateway' => __DIR__ . '/../..' . '/src/Gateways/CardBankGateway.php',
     48        'FinixWC\\Gateways\\CardGateway' => __DIR__ . '/../..' . '/src/Gateways/CardGateway.php',
    4649        'FinixWC\\Gateways\\FinixGateway' => __DIR__ . '/../..' . '/src/Gateways/FinixGateway.php',
    4750        'FinixWC\\Gateways\\GooglePayGateway' => __DIR__ . '/../..' . '/src/Gateways/GooglePayGateway.php',
    4851        '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',
    5055        'FinixWC\\Gateways\\PaymentMethods\\FinixMethod' => __DIR__ . '/../..' . '/src/Gateways/PaymentMethods/FinixMethod.php',
    5156        'FinixWC\\Gateways\\PaymentMethods\\GooglePay' => __DIR__ . '/../..' . '/src/Gateways/PaymentMethods/GooglePay.php',
    5257        'FinixWC\\Helpers\\Assets' => __DIR__ . '/../..' . '/src/Helpers/Assets.php',
     58        'FinixWC\\Helpers\\CartData' => __DIR__ . '/../..' . '/src/Helpers/CartData.php',
    5359        'FinixWC\\Helpers\\Check' => __DIR__ . '/../..' . '/src/Helpers/Check.php',
    5460        'FinixWC\\Helpers\\Convert' => __DIR__ . '/../..' . '/src/Helpers/Convert.php',
  • finix-for-woocommerce/trunk/vendor/composer/installed.php

    r3316914 r3375717  
    22    'root' => array(
    33        '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',
    66        'reference' => null,
    77        'type' => 'library',
     
    1212    'versions' => array(
    1313        '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',
    1616            'reference' => null,
    1717            'type' => 'library',
Note: See TracChangeset for help on using the changeset viewer.