Plugin Directory

Changeset 3418263


Ignore:
Timestamp:
12/12/2025 12:47:18 PM (39 hours ago)
Author:
slaFFik
Message:

Finix for WooCommerce v1.4.0

Location:
finix-for-woocommerce
Files:
107 added
36 edited

Legend:

Unmodified
Added
Removed
  • finix-for-woocommerce/trunk/assets/js/block/build/bank.asset.php

    r3375717 r3418263  
    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' => '3e642aa3fde434ddffe3');
     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' => 'ec1d57eff57dea20cade');
  • finix-for-woocommerce/trunk/assets/js/block/build/bank.js

    r3375717 r3418263  
    1 (()=>{"use strict";const e=window.wp.i18n,t=window.wp.element,o=window.wc.wcBlocksRegistry,n=window.wp.htmlEntities,r=window.wc.wcSettings,s=window.wc.wcBlocksData,i=window.wp.data,a=window.ReactJSXRuntime,c="finix_bank_gateway",d=(0,r.getSetting)("finix_bank_gateway_data",{}),l=(0,n.decodeEntities)(d.title)||(0,e.__)("Pay with Bank","finix-for-woocommerce"),m=e=>{const{PaymentMethodLabel:o}=e.components,n=()=>(0,t.createElement)("img",{src:d.icon});return(0,a.jsx)(o,{text:l,icon:(0,a.jsx)(n,{})})},u=o=>{const{activePaymentMethod:n,eventRegistration:r,emitResponse:a}=o,{onPaymentSetup:l,onCheckoutFail:m}=r,[u,f]=(0,t.useState)(null),[p,w]=(0,t.useState)(""),[_,y]=(0,t.useState)(""),{totals:h}=(0,i.useSelect)(e=>e(s.cartStore).getCartData(),[]),[b,g]=(0,t.useState)("");(0,t.useEffect)(()=>{g("CAD"===h.currency_code?d.merchant:d.merchant_cad)},[h]),(0,t.useEffect)(()=>{y("")},[m]),(0,t.useEffect)(()=>{const t=jQuery("input#billing-city, input#shipping-city"),o={showAddress:d.finix_form_options.showAddress||!0,showLabels:d.finix_form_options.showLabels||!0,labels:d.finix_form_options.labels||{name:(0,e.__)("Full Name","finix-for-woocommerce")},showPlaceholders:d.finix_form_options.showPlaceholders||!0,placeholders:d.finix_form_options.placeholders||{name:d.text.full_name},hideFields:d.finix_form_options.hideFields||["address_line1","address_line2","address_city","address_state"],requiredFields:d.finix_form_options.requiredFields||["name","address_country","address_postal_code"],hideErrorMessages:d.finix_form_options.hideErrorMessages||!1,errorMessages:d.finix_form_options.errorMessages||{name:(0,e.__)("Please enter a valid name","finix-for-woocommerce"),address_city:(0,e.__)("Please enter a valid city","finix-for-woocommerce")},styles:{default:{color:t.css("color"),backgroundColor:t.css("background-color"),border:`${t.css("border-width")} ${t.css("border-style")} ${t.css("border-color")}`,borderRadius:`${t.css("border-top-left-radius")} ${t.css("border-top-right-radius")} ${t.css("border-bottom-right-radius")} ${t.css("border-bottom-left-radius")}`,fontFamily:t.css("font-family"),fontWeight:t.css("font-weight"),lineHeight:t.css("line-height"),boxShadow:t.css("box-shadow"),maxHeight:"100%",appearance:"auto"},success:{},error:{color:"#d9534f",border:"1px solid rgba(255,0,0, 0.3)"}},onUpdate(e,t,o){},onLoad(){}};window.Finix.Auth(d.environment,b,e=>{w(e)});const n=c+"-form",r=(t,s=null)=>{t>4?document.getElementById(n).innerHTML="<p>"+(0,e.__)("Unfortunately, there was an error while loading the payment form. Please try again later.","finix-for-woocommerce")+"</p>":""===document.getElementById(n).innerHTML?(s=window.Finix.BankTokenForm(n,o),setTimeout(()=>{t++,r(t,s)},500)):f(s)};return r(0),()=>{}},[l]),(0,t.useEffect)(()=>{const t=l(async()=>{const t=document.querySelector('input[name="radio-control-wc-payment-method-options"]:checked').value;if(t!==c)return;if(t!==n)return;if(!u)return{type:a.responseTypes.ERROR,message:(0,e.__)("Unfortunately, there was an error while initializing a payment form.","finix-for-woocommerce")};let o={finix_fraud_session_id:p,finix_nonce:d.nonce};if(!_||""===_)try{const e=await(async()=>(document.querySelector("button.wc-block-components-checkout-place-order-button").disabled=!0,new Promise((e,t)=>{u.submit(d.environment,d.application,function(o,n){if(o)document.querySelector("button.wc-block-components-checkout-place-order-button").disabled=!1,t(o);else{const t=(n.data||{}).id;e(t)}})})))();return y(e),o[c+"_token"]=e,{type:a.responseTypes.SUCCESS,meta:{paymentMethodData:o}}}catch(e){return y(""),document.querySelector("button.wc-block-components-checkout-place-order-button").disabled=!1,{type:a.responseTypes.ERROR,message:e}}return o[c+"_token"]=_,{type:a.responseTypes.SUCCESS,meta:{paymentMethodData:o}}});return()=>t()},[l,u,a.responseTypes.SUCCESS,a.responseTypes.ERROR,p]);const x=jQuery("#billing-city").outerHeight()+"px !important"||0;return(0,t.createElement)("fieldset",{id:"wc-"+c+"-form",className:"finix-wc-form wc-payment-form"},(S=d.description)&&""!==S.trim()?(0,t.createElement)("div",{},(0,t.createElement)("p",{dangerouslySetInnerHTML:{__html:d.description}})):null,(0,t.createElement)("div",{id:c+"-form"}),(0,t.createElement)("style",{},`\n\t          .finix-wc-form iframe {\n\t              height: ${x};\n\t          }\n            `));var S},f=()=>{};(0,o.registerPaymentMethod)({name:c,label:(0,a.jsx)(m,{}),content:(0,a.jsx)(u,{}),edit:(0,a.jsx)(f,{}),canMakePayment:()=>!0,ariaLabel:l,supports:{features:d.supports}})})();
     1(()=>{"use strict";const e=window.wp.i18n,t=window.wp.element,o=window.wc.wcBlocksRegistry,n=window.wp.htmlEntities,r=window.wc.wcSettings,s=window.wc.wcBlocksData,i=window.wp.data,a=window.ReactJSXRuntime,c="finix_bank_gateway",d=(0,r.getSetting)("finix_bank_gateway_data",{}),l=(0,n.decodeEntities)(d.title)||(0,e.__)("Pay with Bank","finix-for-woocommerce"),m=e=>{const{PaymentMethodLabel:o}=e.components,n=()=>(0,t.createElement)("img",{src:d.icon});return(0,a.jsx)(o,{text:l,icon:(0,a.jsx)(n,{})})},u=o=>{const{activePaymentMethod:n,eventRegistration:r,emitResponse:a}=o,{onPaymentSetup:l,onCheckoutFail:m}=r,[u,f]=(0,t.useState)(null),[p,w]=(0,t.useState)(""),[_,y]=(0,t.useState)(""),{totals:h}=(0,i.useSelect)(e=>e(s.cartStore).getCartData(),[]),[b,g]=(0,t.useState)("");(0,t.useEffect)(()=>{g("CAD"===h.currency_code?d.merchant:d.merchant_cad)},[h]),(0,t.useEffect)(()=>{y("")},[m]),(0,t.useEffect)(()=>{const t=jQuery("input#billing-city, input#shipping-city"),o={showAddress:d.finix_form_options.showAddress||!0,showLabels:d.finix_form_options.showLabels||!0,labels:d.finix_form_options.labels||{name:(0,e.__)("Full Name","finix-for-woocommerce")},showPlaceholders:d.finix_form_options.showPlaceholders||!0,placeholders:d.finix_form_options.placeholders||{name:d.text.full_name},defaultValues:d.finix_form_options.defaultValues,hideFields:d.finix_form_options.hideFields||["address_line1","address_line2","address_city","address_state"],requiredFields:d.finix_form_options.requiredFields||["name","address_country","address_postal_code"],hideErrorMessages:d.finix_form_options.hideErrorMessages||!1,errorMessages:d.finix_form_options.errorMessages||{name:(0,e.__)("Please enter a valid name","finix-for-woocommerce"),address_city:(0,e.__)("Please enter a valid city","finix-for-woocommerce")},styles:{default:{color:t.css("color"),backgroundColor:t.css("background-color"),border:`${t.css("border-width")} ${t.css("border-style")} ${t.css("border-color")}`,borderRadius:`${t.css("border-top-left-radius")} ${t.css("border-top-right-radius")} ${t.css("border-bottom-right-radius")} ${t.css("border-bottom-left-radius")}`,fontFamily:t.css("font-family"),fontWeight:t.css("font-weight"),lineHeight:t.css("line-height"),boxShadow:t.css("box-shadow"),maxHeight:"100%",appearance:"auto"},success:{},error:{color:"#d9534f",border:"1px solid rgba(255,0,0, 0.3)"}},onUpdate(e,t,o){},onLoad(){}};window.Finix.Auth(d.environment,b,e=>{w(e)});const n=c+"-form",r=(t,s=null)=>{t>4?document.getElementById(n).innerHTML="<p>"+(0,e.__)("Unfortunately, there was an error while loading the payment form. Please try again later.","finix-for-woocommerce")+"</p>":""===document.getElementById(n).innerHTML?(s=window.Finix.BankTokenForm(n,o),setTimeout(()=>{t++,r(t,s)},500)):f(s)};return r(0),()=>{}},[l]),(0,t.useEffect)(()=>{const t=l(async()=>{const t=document.querySelector('input[name="radio-control-wc-payment-method-options"]:checked').value;if(t!==c)return;if(t!==n)return;if(!u)return{type:a.responseTypes.ERROR,message:(0,e.__)("Unfortunately, there was an error while initializing a payment form.","finix-for-woocommerce")};let o={finix_fraud_session_id:p,finix_nonce:d.nonce};if(!_||""===_)try{const e=await(async()=>(document.querySelector("button.wc-block-components-checkout-place-order-button").disabled=!0,new Promise((e,t)=>{u.submit(d.environment,d.application,function(o,n){if(o)document.querySelector("button.wc-block-components-checkout-place-order-button").disabled=!1,t(o);else{const t=(n.data||{}).id;e(t)}})})))();return y(e),o[c+"_token"]=e,{type:a.responseTypes.SUCCESS,meta:{paymentMethodData:o}}}catch(e){return y(""),document.querySelector("button.wc-block-components-checkout-place-order-button").disabled=!1,{type:a.responseTypes.ERROR,message:e}}return o[c+"_token"]=_,{type:a.responseTypes.SUCCESS,meta:{paymentMethodData:o}}});return()=>t()},[l,u,a.responseTypes.SUCCESS,a.responseTypes.ERROR,p]);const x=jQuery("#billing-city").outerHeight()+"px !important"||0;return(0,t.createElement)("fieldset",{id:"wc-"+c+"-form",className:"finix-wc-form wc-payment-form"},(S=d.description)&&""!==S.trim()?(0,t.createElement)("div",{},(0,t.createElement)("p",{dangerouslySetInnerHTML:{__html:d.description}})):null,(0,t.createElement)("div",{id:c+"-form"}),(0,t.createElement)("style",{},`\n\t          .finix-wc-form iframe {\n\t              height: ${x};\n\t          }\n            `));var S},f=()=>{};(0,o.registerPaymentMethod)({name:c,label:(0,a.jsx)(m,{}),content:(0,a.jsx)(u,{}),edit:(0,a.jsx)(f,{}),canMakePayment:()=>!0,ariaLabel:l,supports:{features:d.supports}})})();
  • finix-for-woocommerce/trunk/assets/js/block/build/card.asset.php

    r3375717 r3418263  
    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' => '37fbae2e33c1ca564348');
     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' => '2c64252111acd34319ce');
  • finix-for-woocommerce/trunk/assets/js/block/build/card.js

    r3375717 r3418263  
    1 (()=>{"use strict";const e=window.wp.i18n,t=window.wp.element,o=window.wc.wcBlocksRegistry,n=window.wp.htmlEntities,r=window.wc.wcSettings,s=window.wc.wcBlocksData,i=window.wp.data,a=window.ReactJSXRuntime,c="finix_gateway",d=(0,r.getSetting)("finix_gateway_data",{}),l=(0,n.decodeEntities)(d.title)||(0,e.__)("Pay with Card","finix-for-woocommerce"),m=e=>{const{PaymentMethodLabel:o}=e.components,n=()=>(0,t.createElement)("img",{src:d.icon});return(0,a.jsx)(o,{text:l,icon:(0,a.jsx)(n,{})})},u=o=>{const{activePaymentMethod:n,eventRegistration:r,emitResponse:a}=o,{onPaymentSetup:l,onCheckoutFail:m}=r,[u,f]=(0,t.useState)(null),[p,w]=(0,t.useState)(""),[y,h]=(0,t.useState)(""),{totals:_}=(0,i.useSelect)(e=>e(s.cartStore).getCartData(),[]),[b,g]=(0,t.useState)("");(0,t.useEffect)(()=>{g("CAD"===_.currency_code?d.merchant:d.merchant_cad)},[_]),(0,t.useEffect)(()=>{h("")},[m]),(0,t.useEffect)(()=>{const t=jQuery("input#billing-city, input#shipping-city"),o={showAddress:d.finix_form_options.showAddress||!0,showLabels:d.finix_form_options.showLabels||!0,labels:d.finix_form_options.labels||{name:(0,e.__)("Full Name","finix-for-woocommerce")},showPlaceholders:d.finix_form_options.showPlaceholders||!0,placeholders:d.finix_form_options.placeholders||{name:d.text.full_name},hideFields:d.finix_form_options.hideFields||["address_line1","address_line2","address_city","address_state"],requiredFields:d.finix_form_options.requiredFields||["name","address_country","address_postal_code"],hideErrorMessages:d.finix_form_options.hideErrorMessages||!1,errorMessages:d.finix_form_options.errorMessages||{name:(0,e.__)("Please enter a valid name","finix-for-woocommerce"),address_city:(0,e.__)("Please enter a valid city","finix-for-woocommerce")},styles:{default:{color:t.css("color"),backgroundColor:t.css("background-color"),border:`${t.css("border-width")} ${t.css("border-style")} ${t.css("border-color")}`,borderRadius:`${t.css("border-top-left-radius")} ${t.css("border-top-right-radius")} ${t.css("border-bottom-right-radius")} ${t.css("border-bottom-left-radius")}`,fontFamily:t.css("font-family"),fontWeight:t.css("font-weight"),lineHeight:t.css("line-height"),boxShadow:t.css("box-shadow"),maxHeight:"100%",appearance:"auto"},success:{},error:{color:"#d9534f",border:"1px solid rgba(255,0,0, 0.3)"}},onUpdate(e,t,o){},onLoad(){}};window.Finix.Auth(d.environment,b,e=>{w(e)});const n=c+"-form",r=(t,s=null)=>{t>4?document.getElementById(n).innerHTML="<p>"+(0,e.__)("Unfortunately, there was an error while loading the payment form. Please try again later.","finix-for-woocommerce")+"</p>":""===document.getElementById(n).innerHTML?(s=window.Finix.CardTokenForm(n,o),setTimeout(()=>{t++,r(t,s)},500)):f(s)};return r(0),()=>{}},[l]),(0,t.useEffect)(()=>{const t=l(async()=>{const t=document.querySelector('input[name="radio-control-wc-payment-method-options"]:checked').value;if(t!==c)return;if(t!==n)return;if(!u)return{type:a.responseTypes.ERROR,message:(0,e.__)("Unfortunately, there was an error while initializing a payment form.","finix-for-woocommerce")};let o={finix_fraud_session_id:p,finix_nonce:d.nonce};if(!y||""===y)try{const e=await(async()=>(document.querySelector("button.wc-block-components-checkout-place-order-button").disabled=!0,new Promise((e,t)=>{u.submit(d.environment,d.application,function(o,n){if(o)document.querySelector("button.wc-block-components-checkout-place-order-button").disabled=!1,t(o);else{const t=(n.data||{}).id;e(t)}})})))();return h(e),o[c+"_token"]=e,{type:a.responseTypes.SUCCESS,meta:{paymentMethodData:o}}}catch(e){return h(""),document.querySelector("button.wc-block-components-checkout-place-order-button").disabled=!1,{type:a.responseTypes.ERROR,message:e}}return o[c+"_token"]=y,{type:a.responseTypes.SUCCESS,meta:{paymentMethodData:o}}});return()=>t()},[l,u,a.responseTypes.SUCCESS,a.responseTypes.ERROR,p]);const x=jQuery("#billing-city").outerHeight()+"px !important"||0;return(0,t.createElement)("fieldset",{id:"wc-"+c+"-form",className:"finix-wc-form wc-payment-form"},(S=d.description)&&""!==S.trim()?(0,t.createElement)("div",{},(0,t.createElement)("p",{dangerouslySetInnerHTML:{__html:d.description}})):null,(0,t.createElement)("div",{id:c+"-form"}),(0,t.createElement)("style",{},`\n\t          .finix-wc-form iframe {\n\t              height: ${x};\n\t          }\n            `));var S},f=()=>{};(0,o.registerPaymentMethod)({name:c,label:(0,a.jsx)(m,{}),content:(0,a.jsx)(u,{}),edit:(0,a.jsx)(f,{}),canMakePayment:()=>!0,ariaLabel:l,supports:{features:d.supports}})})();
     1(()=>{"use strict";const e=window.wp.i18n,t=window.wp.element,o=window.wc.wcBlocksRegistry,n=window.wp.htmlEntities,r=window.wc.wcSettings,s=window.wc.wcBlocksData,i=window.wp.data,a=window.ReactJSXRuntime,c="finix_gateway",d=(0,r.getSetting)("finix_gateway_data",{}),l=(0,n.decodeEntities)(d.title)||(0,e.__)("Pay with Card","finix-for-woocommerce"),m=e=>{const{PaymentMethodLabel:o}=e.components,n=()=>(0,t.createElement)("img",{src:d.icon});return(0,a.jsx)(o,{text:l,icon:(0,a.jsx)(n,{})})},u=o=>{const{activePaymentMethod:n,eventRegistration:r,emitResponse:a}=o,{onPaymentSetup:l,onCheckoutFail:m}=r,[u,f]=(0,t.useState)(null),[p,w]=(0,t.useState)(""),[_,y]=(0,t.useState)(""),{totals:h}=(0,i.useSelect)(e=>e(s.cartStore).getCartData(),[]),[b,g]=(0,t.useState)("");(0,t.useEffect)(()=>{g("CAD"===h.currency_code?d.merchant:d.merchant_cad)},[h]),(0,t.useEffect)(()=>{y("")},[m]),(0,t.useEffect)(()=>{const t=jQuery("input#billing-city, input#shipping-city"),o={showAddress:d.finix_form_options.showAddress||!0,showLabels:d.finix_form_options.showLabels||!0,labels:d.finix_form_options.labels||{name:(0,e.__)("Full Name","finix-for-woocommerce")},showPlaceholders:d.finix_form_options.showPlaceholders||!0,placeholders:d.finix_form_options.placeholders||{name:d.text.full_name},defaultValues:d.finix_form_options.defaultValues,hideFields:d.finix_form_options.hideFields||["address_line1","address_line2","address_city","address_state"],requiredFields:d.finix_form_options.requiredFields||["name","address_country","address_postal_code"],hideErrorMessages:d.finix_form_options.hideErrorMessages||!1,errorMessages:d.finix_form_options.errorMessages||{name:(0,e.__)("Please enter a valid name","finix-for-woocommerce"),address_city:(0,e.__)("Please enter a valid city","finix-for-woocommerce")},styles:{default:{color:t.css("color"),backgroundColor:t.css("background-color"),border:`${t.css("border-width")} ${t.css("border-style")} ${t.css("border-color")}`,borderRadius:`${t.css("border-top-left-radius")} ${t.css("border-top-right-radius")} ${t.css("border-bottom-right-radius")} ${t.css("border-bottom-left-radius")}`,fontFamily:t.css("font-family"),fontWeight:t.css("font-weight"),lineHeight:t.css("line-height"),boxShadow:t.css("box-shadow"),maxHeight:"100%",appearance:"auto"},success:{},error:{color:"#d9534f",border:"1px solid rgba(255,0,0, 0.3)"}},onUpdate(e,t,o){},onLoad(){}};window.Finix.Auth(d.environment,b,e=>{w(e)});const n=c+"-form",r=(t,s=null)=>{t>4?document.getElementById(n).innerHTML="<p>"+(0,e.__)("Unfortunately, there was an error while loading the payment form. Please try again later.","finix-for-woocommerce")+"</p>":""===document.getElementById(n).innerHTML?(s=window.Finix.CardTokenForm(n,o),setTimeout(()=>{t++,r(t,s)},500)):f(s)};return r(0),()=>{}},[l]),(0,t.useEffect)(()=>{const t=l(async()=>{const t=document.querySelector('input[name="radio-control-wc-payment-method-options"]:checked').value;if(t!==c)return;if(t!==n)return;if(!u)return{type:a.responseTypes.ERROR,message:(0,e.__)("Unfortunately, there was an error while initializing a payment form.","finix-for-woocommerce")};let o={finix_fraud_session_id:p,finix_nonce:d.nonce};if(!_||""===_)try{const e=await(async()=>(document.querySelector("button.wc-block-components-checkout-place-order-button").disabled=!0,new Promise((e,t)=>{u.submit(d.environment,d.application,function(o,n){if(o)document.querySelector("button.wc-block-components-checkout-place-order-button").disabled=!1,t(o);else{const t=(n.data||{}).id;e(t)}})})))();return y(e),o[c+"_token"]=e,{type:a.responseTypes.SUCCESS,meta:{paymentMethodData:o}}}catch(e){return y(""),document.querySelector("button.wc-block-components-checkout-place-order-button").disabled=!1,{type:a.responseTypes.ERROR,message:e}}return o[c+"_token"]=_,{type:a.responseTypes.SUCCESS,meta:{paymentMethodData:o}}});return()=>t()},[l,u,a.responseTypes.SUCCESS,a.responseTypes.ERROR,p]);const x=jQuery("#billing-city").outerHeight()+"px !important"||0;return(0,t.createElement)("fieldset",{id:"wc-"+c+"-form",className:"finix-wc-form wc-payment-form"},(S=d.description)&&""!==S.trim()?(0,t.createElement)("div",{},(0,t.createElement)("p",{dangerouslySetInnerHTML:{__html:d.description}})):null,(0,t.createElement)("div",{id:c+"-form"}),(0,t.createElement)("style",{},`\n\t          .finix-wc-form iframe {\n\t              height: ${x};\n\t          }\n            `));var S},f=()=>{};(0,o.registerPaymentMethod)({name:c,label:(0,a.jsx)(m,{}),content:(0,a.jsx)(u,{}),edit:(0,a.jsx)(f,{}),canMakePayment:()=>!0,ariaLabel:l,supports:{features:d.supports}})})();
  • finix-for-woocommerce/trunk/assets/js/block/build/google-pay.asset.php

    r3375717 r3418263  
    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');
     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' => 'b70c80180425b2a86a71');
  • finix-for-woocommerce/trunk/assets/js/block/build/google-pay.js

    r3375717 r3418263  
    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}})})();
     1(()=>{"use strict";const e=window.wp.element,t=window.wp.i18n,a=window.wc.wcBlocksRegistry,o=window.wp.htmlEntities,n=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(){let e=[];return Object.values(finix_google_pay_params.products).forEach(t=>{0!==parseFloat(t.total)&&e.push({label:t.quantity>1?`${t.name} x${t.quantity}`:t.name,type:"LINE_ITEM",price:t.total})}),e.push({label:(0,t.__)("Subtotal","finix-for-woocommerce"),type:"SUBTOTAL",price:finix_google_pay_params.subtotal||finix_google_pay_params.amount}),e.push(...finix_google_pay_params.coupons.map(e=>({label:(0,t.__)("Discount code:","finix-for-woocommerce")+" "+e.code,type:"DISCOUNT",price:(-1*parseFloat(e.total).toFixed(2)).toString()}))),finix_google_pay_params.shipping_amount>0&&e.push({label:(0,t.__)("Shipping","finix-for-woocommerce"),type:"SHIPPING_OPTION",price:finix_google_pay_params.shipping_amount||"0.00"}),finix_google_pay_params.tax_amount>0&&e.push({label:(0,t.__)("Tax","finix-for-woocommerce"),type:"TAX",price:finix_google_pay_params.tax_amount||"0.00"}),{countryCode:finix_google_pay_params.merchant_country,currencyCode:finix_google_pay_params.currency_code,totalPriceStatus:"FINAL",totalPriceLabel:(0,t.__)("Total","finix-for-woocommerce"),totalPrice:finix_google_pay_params.amount,displayItems:e}}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},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()}}const _=window.ReactJSXRuntime,p="finix_google_pay_gateway",c=(0,n.getSetting)("finix_google_pay_gateway_data",{}),l=(0,o.decodeEntities)(c.title)||(0,t.__)("Pay with Google Pay","finix-for-woocommerce"),g=t=>{const{PaymentMethodLabel:a}=t.components,o=()=>(0,e.createElement)("img",{src:c.icon});return(0,_.jsx)(a,{text:l,icon:(0,_.jsx)(o,{})})},m=a=>{const{eventRegistration:o,emitResponse:n}=a,{onPaymentSetup:_}=o,{shippingAddress:l,billingAddress:g,totals:m,coupons:y,items:d}=(0,s.useSelect)(e=>e(i.cartStore).getCartData(),[]);return(0,e.useEffect)(()=>{finix_google_pay_params.shipping_data=l},[l]),(0,e.useEffect)(()=>{finix_google_pay_params.billing_data=g},[g]),(0,e.useEffect)(()=>{finix_google_pay_params.amount=(m.total_price/100).toFixed(2),finix_google_pay_params.currency_code=m.currency_code,finix_google_pay_params.subtotal=(m.total_items/100).toFixed(2),finix_google_pay_params.shipping_amount=(m.total_shipping/100).toFixed(2),finix_google_pay_params.tax_amount=(m.total_tax/100).toFixed(2)},[m]),(0,e.useEffect)(()=>{finix_google_pay_params.coupons=y.map(e=>({code:e.code,total:(e.totals.total_discount/100).toFixed(2)}))},[y]),(0,e.useEffect)(()=>{finix_google_pay_params.products=d.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/100).toFixed(2)}))},[d]),(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:n.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:n.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:n.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:n.responseTypes.FAIL,message:finix_google_pay_params.text.error_processing}}catch(e){return{type:n.responseTypes.FAIL,message:finix_google_pay_params.text.error_processing}}})},[_]),(0,e.createElement)("fieldset",{id:"wc-"+p+"-form",style:{background:"transparent",padding:"0"}},(u=c.description)&&""!==u.trim()?(0,e.createElement)("div",{},(0,e.createElement)("p",{dangerouslySetInnerHTML:{__html:c.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 u},y=()=>{};(0,a.registerPaymentMethod)({name:p,label:(0,_.jsx)(g,{}),content:(0,_.jsx)(m,{}),edit:(0,_.jsx)(y,{}),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:l,supports:{features:c.supports}})})();
  • finix-for-woocommerce/trunk/assets/js/finix-google-pay.js

    r3316914 r3418263  
    5656
    5757    getTransactionInfo: function () {
     58        let lineItems = [];
     59
     60        // Add product line items if value is not zero.
     61        Object.values( finix_google_pay_params.products ).forEach( ( product ) => {
     62            if ( parseFloat( product.total ) !== 0 ) {
     63                lineItems.push( {
     64                    label: product.quantity > 1 ? `${ product.name } x${ product.quantity }` : product.name,
     65                    type: 'LINE_ITEM',
     66                    price: product.total,
     67                } );
     68            }
     69        } );
     70
     71        lineItems.push( {
     72            label: finix_google_pay_params.text.subtotal,
     73            type: 'SUBTOTAL',
     74            price: finix_google_pay_params.subtotal || finix_google_pay_params.amount,
     75        } );
     76
     77        // Add any offer details to the transaction info.
     78        lineItems.push(
     79            ...finix_google_pay_params.coupons.map( ( offer ) => ( {
     80                label: finix_google_pay_params.text.discount_code + ' ' + offer.code,
     81                type: 'DISCOUNT',
     82                price: (parseFloat( offer.total ) * -1).toFixed( 2 ), // Ensure negative value for discounts.
     83            } ) )
     84        );
     85
     86        // Add Shipping if is not Zero.
     87        if ( finix_google_pay_params.shipping_amount > 0 ) {
     88            lineItems.push( {
     89                label: finix_google_pay_params.text.shipping,
     90                type: 'SHIPPING_OPTION',
     91                price: finix_google_pay_params.shipping_amount || '0.00',
     92            } );
     93        }
     94
     95        // Add Tax if is not Zero.
     96        if ( finix_google_pay_params.tax_amount > 0 ) {
     97            lineItems.push( {
     98                label: finix_google_pay_params.text.tax,
     99                type: 'TAX',
     100                price: finix_google_pay_params.tax_amount || '0.00',
     101            } );
     102        }
    58103        return {
    59104            countryCode: finix_google_pay_params.merchant_country,
    60105            currencyCode: finix_google_pay_params.currency_code,
    61106            totalPriceStatus: 'FINAL',
     107            totalPriceLabel: finix_google_pay_params.text.total,
    62108            totalPrice: finix_google_pay_params.amount,
     109            displayItems: lineItems,
    63110        };
    64111    },
  • finix-for-woocommerce/trunk/assets/js/finix-google-pay.min.js

    r3316914 r3418263  
    1 var FinixGooglePay={paymentsClient:null,baseRequest:{apiVersion:2,apiVersionMinor:0},environment:"sandbox"===finix_google_pay_params.environment?"TEST":"PRODUCTION",allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],allowedCardAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],tokenSpec:{type:"PAYMENT_GATEWAY",parameters:{gateway:"finix",gatewayMerchantId:finix_google_pay_params.merchant_identity}},baseCardMethod:{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}},getCardMethod:function(){return Object.assign({},this.baseCardMethod,{tokenizationSpecification:this.tokenSpec})},getPaymentsClient:function(){return this.paymentsClient||(this.paymentsClient=new google.payments.api.PaymentsClient({environment:this.environment})),this.paymentsClient},getPaymentDataRequest:function(){var e=Object.assign({},this.baseRequest);return e.allowedPaymentMethods=[this.getCardMethod()],e.transactionInfo=this.getTransactionInfo(),e.merchantInfo={merchantId:finix_google_pay_params.google_merchant_id,merchantName:finix_google_pay_params.merchant_name},e},getIsReadyToPayRequest:function(){return Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.baseCardMethod]})},prefetch:function(){var e=Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.getCardMethod()]});e.transactionInfo={totalPriceStatus:"NOT_CURRENTLY_KNOWN",currencyCode:"USD"},this.getPaymentsClient().prefetchPaymentData(e)},getTransactionInfo:function(){return{countryCode:finix_google_pay_params.merchant_country,currencyCode:finix_google_pay_params.currency_code,totalPriceStatus:"FINAL",totalPrice:finix_google_pay_params.amount}},async processPayment(e,t){var e={provider:"GOOGLE_PAY",payment_token:e,process_payment:!0,merchant_identity:finix_google_pay_params.merchant_identity,wp_nonce:finix_google_pay_params.nonce,billing_info:t},t=document.querySelector("#finix_google_pay_order_id"),a=document.querySelector("#finix_google_pay_order_key");return t&&a&&(e.order_id=t.value,e.order_key=a.value),fetch(finix_google_pay_params.url.webhook,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.json()).then(e=>201===e.status?{success:!0,transactionId:e.response.id}:{success:!1,error:finix_google_pay_params.text.error_processing}).catch(e=>({success:!1,error:finix_google_pay_params.text.error_setting_payment}))}};
     1var FinixGooglePay={paymentsClient:null,baseRequest:{apiVersion:2,apiVersionMinor:0},environment:"sandbox"===finix_google_pay_params.environment?"TEST":"PRODUCTION",allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],allowedCardAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],tokenSpec:{type:"PAYMENT_GATEWAY",parameters:{gateway:"finix",gatewayMerchantId:finix_google_pay_params.merchant_identity}},baseCardMethod:{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"]}},getCardMethod:function(){return Object.assign({},this.baseCardMethod,{tokenizationSpecification:this.tokenSpec})},getPaymentsClient:function(){return this.paymentsClient||(this.paymentsClient=new google.payments.api.PaymentsClient({environment:this.environment})),this.paymentsClient},getPaymentDataRequest:function(){var e=Object.assign({},this.baseRequest);return e.allowedPaymentMethods=[this.getCardMethod()],e.transactionInfo=this.getTransactionInfo(),e.merchantInfo={merchantId:finix_google_pay_params.google_merchant_id,merchantName:finix_google_pay_params.merchant_name},e},getIsReadyToPayRequest:function(){return Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.baseCardMethod]})},prefetch:function(){var e=Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.getCardMethod()]});e.transactionInfo={totalPriceStatus:"NOT_CURRENTLY_KNOWN",currencyCode:"USD"},this.getPaymentsClient().prefetchPaymentData(e)},getTransactionInfo:function(){let a=[];return Object.values(finix_google_pay_params.products).forEach(e=>{0!==parseFloat(e.total)&&a.push({label:1<e.quantity?e.name+" x"+e.quantity:e.name,type:"LINE_ITEM",price:e.total})}),a.push({label:finix_google_pay_params.text.subtotal,type:"SUBTOTAL",price:finix_google_pay_params.subtotal||finix_google_pay_params.amount}),a.push(...finix_google_pay_params.coupons.map(e=>({label:finix_google_pay_params.text.discount_code+" "+e.code,type:"DISCOUNT",price:(-1*parseFloat(e.total)).toFixed(2)}))),0<finix_google_pay_params.shipping_amount&&a.push({label:finix_google_pay_params.text.shipping,type:"SHIPPING_OPTION",price:finix_google_pay_params.shipping_amount||"0.00"}),0<finix_google_pay_params.tax_amount&&a.push({label:finix_google_pay_params.text.tax,type:"TAX",price:finix_google_pay_params.tax_amount||"0.00"}),{countryCode:finix_google_pay_params.merchant_country,currencyCode:finix_google_pay_params.currency_code,totalPriceStatus:"FINAL",totalPriceLabel:finix_google_pay_params.text.total,totalPrice:finix_google_pay_params.amount,displayItems:a}},async processPayment(e,a){var e={provider:"GOOGLE_PAY",payment_token:e,process_payment:!0,merchant_identity:finix_google_pay_params.merchant_identity,wp_nonce:finix_google_pay_params.nonce,billing_info:a},a=document.querySelector("#finix_google_pay_order_id"),t=document.querySelector("#finix_google_pay_order_key");return a&&t&&(e.order_id=a.value,e.order_key=t.value),fetch(finix_google_pay_params.url.webhook,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(e=>e.json()).then(e=>201===e.status?{success:!0,transactionId:e.response.id}:{success:!1,error:finix_google_pay_params.text.error_processing}).catch(e=>({success:!1,error:finix_google_pay_params.text.error_setting_payment}))}};
  • finix-for-woocommerce/trunk/assets/js/shortcode-card-bank.js

    r3375717 r3418263  
    1414        name: finix_params.text.full_name,
    1515    },
     16    defaultValues: finix_params.finix_form_options.defaultValues,
    1617    hideFields: finix_params.finix_form_options.hideFields || [ 'address_line1', 'address_line2', 'address_city', 'address_state' ],
    1718    requiredFields: finix_params.finix_form_options.requiredFields || [ 'name', 'address_country', 'address_postal_code' ],
  • finix-for-woocommerce/trunk/assets/js/shortcode-card-bank.min.js

    r3375717 r3418263  
    1 let FinixFormOptions={showAddress:!!finix_params.finix_form_options.showAddress,showLabels:!!finix_params.finix_form_options.showLabels,labels:finix_params.finix_form_options.labels||{name:finix_params.text.full_name},showPlaceholders:!!finix_params.finix_form_options.showPlaceholders,placeholders:finix_params.finix_form_options.placeholders||{name:finix_params.text.full_name},hideFields:finix_params.finix_form_options.hideFields||["address_line1","address_line2","address_city","address_state"],requiredFields:finix_params.finix_form_options.requiredFields||["name","address_country","address_postal_code"],hideErrorMessages:!!finix_params.finix_form_options.hideErrorMessages,errorMessages:finix_params.finix_form_options.errorMessages||{name:finix_params.text.error_messages.name,address_city:finix_params.text.error_messages.address_city},styles:{default:{},success:{},error:{color:"#e2401c",boxShadow:"inset 2px 0 0 #e2401c"}},onUpdate(e,i,r){},onLoad(){}};function copyWooInputStylesToFinix(){var e=jQuery("input#billing_city, input#shipping_city");return FinixFormOptions.styles.default={color:e.css("color"),backgroundColor:e.css("background-color"),border:`${e.css("border-width")} ${e.css("border-style")} `+e.css("border-color"),borderRadius:`${e.css("border-top-left-radius")} ${e.css("border-top-right-radius")} ${e.css("border-bottom-right-radius")} `+e.css("border-bottom-left-radius"),fontFamily:e.css("font-family"),fontWeight:e.css("font-weight"),lineHeight:e.css("line-height"),boxShadow:e.css("box-shadow"),maxHeight:"100%",height:"100%",appearance:"auto"},FinixFormOptions}function triggerFinixSubmitError(e){var i=jQuery("form.woocommerce-checkout, form#order_review");void 0!==e&&0!==e.length||(e='<div class="woocommerce-error">'+wc_checkout_params.i18n_checkout_error+"</div>"),jQuery(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message, .is-error, .is-success").remove(),i.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+e+"</div>"),i.removeClass("processing").unblock(),i.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur");let r=jQuery(".woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout");r.length||(r=i),jQuery.scroll_to_notices(r),i.find('.woocommerce-error[tabindex="-1"], .wc-block-components-notice-banner.is-error[tabindex="-1"]').trigger("focus"),jQuery(document.body).trigger("checkout_error",[e])}async function tokenRequest(e,o){return document.getElementById("place_order").disabled=!0,new Promise((r,n)=>{e.submit(finix_params.environment,finix_params.application,function(e,i){e?(triggerFinixSubmitError(),document.getElementById(o+"_token").value="",document.getElementById("place_order").disabled=!1,n(e)):(e=(i.data||{}).id,document.getElementById(o+"_token").value=e,document.getElementById("place_order").disabled=!1,r(e))})})}function initFinixForm(e){if(""===document.getElementById(e+"-form").innerHTML)switch(e){case"finix_gateway":return finix_params.finixForms.finix_gateway=window.Finix.CardTokenForm(e+"-form",FinixFormOptions),finix_params.finixForms.finix_gateway;case"finix_bank_gateway":return finix_params.finixForms.finix_bank_gateway=window.Finix.BankTokenForm(e+"-form",FinixFormOptions),finix_params.finixForms.finix_bank_gateway}return null}function processPlaceOrder(n){jQuery(document).on("click","#place_order",async function(e){var i=jQuery('input[name="payment_method"]:checked',n).val();if(!["finix_gateway","finix_bank_gateway"].includes(i))return!0;let r;switch(i){case"finix_gateway":r=finix_params.finixForms.finix_gateway;break;case"finix_bank_gateway":r=finix_params.finixForms.finix_bank_gateway}if(e.preventDefault(),e.stopImmediatePropagation(),n.find("#"+i+"_token").val())return n.trigger("submit"),!0;try{if(await tokenRequest(r,i))return n.trigger("submit"),!0}catch(e){return n.find("#"+i+"_token").val(""),triggerFinixSubmitError(),document.getElementById("place_order").disabled=!1}})}jQuery(function(){let r=jQuery("form.woocommerce-checkout, form#order_review");if(r.length){copyWooInputStylesToFinix(),window.Finix.Auth(finix_params.environment,finix_params.merchant,e=>{jQuery("#finix_fraud_session_id",r).length||r.prepend('<input type="hidden" id="finix_fraud_session_id" name="finix_fraud_session_id" value=""/>'),r.find("#finix_fraud_session_id").val(e);e=jQuery("#finix_nonce",r);e.length||r.prepend('<input type="hidden" id="finix_nonce" name="finix_nonce" value=""/>'),r.find("#finix_nonce").val(finix_params.nonce)}),finix_params.finixForms=finix_params.finixForms||{};var e=`
     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},defaultValues:finix_params.finix_form_options.defaultValues,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=`
    22            <style id="test">
    33                #finix_gateway-form .finix-form-container iframe,
  • finix-for-woocommerce/trunk/assets/js/shortcode-google-pay.js

    r3316914 r3418263  
    172172    const billingData = retrieveBillingData();
    173173
    174     if ( ! billingData.first_name || ! billingData.last_name || ! billingData.address1 || ! billingData.city || ! billingData.state || ! billingData.postcode || ! billingData.country || ! billingData.email ) {
     174    if ( ! billingData.first_name || ! billingData.last_name || ! billingData.address1 || ! billingData.city || ( billingData.country === 'US' && billingData.state === '' ) || ! billingData.postcode || ! billingData.country || ! billingData.email ) {
    175175        triggerGooglePaySubmitError( finix_google_pay_params.text.error_billing );
    176176        return;
     
    291291     * We need to make sure we keep in sync our finix_apple_pay_params.amount value.
    292292     */
    293     jQuery(document).on('updated_checkout', function () {
    294 
    295         finix_google_pay_params.amount = FinixHelpers.getUpdatedTotal();
    296        
    297     });
    298 
     293    jQuery( document ).on( 'updated_checkout', function () {
     294        finix_google_pay_params.amount = FinixHelpers.getUpdatedValue( '.woocommerce-checkout-review-order-table .order-total .woocommerce-Price-amount' );
     295
     296        // Get order details via AJAX.
     297
     298        fetch( finix_google_pay_params.url.ajax + '?action=get_order_tracking_details', {
     299            method: 'POST',
     300            headers: { 'Content-Type': 'application/json' },
     301            body: JSON.stringify( { nonce: finix_google_pay_params.nonce } ),
     302        } )
     303            .then( ( response ) => response.json() )
     304            .then( ( data ) => {
     305                if ( data.success === true ) {
     306                    finix_google_pay_params.subtotal = data.data.subtotal || finix_google_pay_params.amount;
     307                    finix_google_pay_params.shipping_amount = data.data.shipping_amount || 0;
     308                    finix_google_pay_params.tax_amount = data.data.tax_amount || 0;
     309                    finix_google_pay_params.products = data.data.products || [];
     310                    finix_google_pay_params.coupons = data.data.coupons || [];
     311                }
     312            } )
     313            .catch( ( err ) => {} );
     314    } );
    299315} );
  • finix-for-woocommerce/trunk/assets/js/shortcode-google-pay.min.js

    r3316914 r3418263  
    1 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_google_pay_params.billing_data.first_name,last_name:finix_google_pay_params.billing_data.last_name,address1:finix_google_pay_params.billing_data.address_1,city:finix_google_pay_params.billing_data.city,postcode:finix_google_pay_params.billing_data.postcode,country:finix_google_pay_params.billing_data.country,state:finix_google_pay_params.billing_data.state,email:finix_google_pay_params.billing_data.email,phone:finix_google_pay_params.billing_data.phone},e}function retrieveShippingData(){var e,o,t,i,a,n=retrieveBillingData();return""===n.address1||""===n.city||"US"===n.country&&""===n.state||""===n.postcode||""===n.country?(triggerGooglePaySubmitError(finix_google_pay_params.text.error_billing),!1):(e=document.querySelector("#shipping_country")?.value||"",o=document.querySelector("#shipping_state")?.value||"",t=document.querySelector("#shipping_postcode")?.value||"",i=document.querySelector("#shipping_city")?.value||"",a=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(o)&&(n.shipping_state=o),nonEmptyValue(t)&&(n.shipping_postcode=t),nonEmptyValue(i)&&(n.shipping_city=i),nonEmptyValue(a)&&(n.shipping_address_1=a),n)}function triggerGooglePaySubmitError(e){var o=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(),o.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+e+"</div>"),o.removeClass("processing").unblock(),o.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur");let t=jQuery(".woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout");t.length||(t=o),jQuery.scroll_to_notices(t),o.find('.woocommerce-error[tabindex="-1"], .wc-block-components-notice-banner.is-error[tabindex="-1"]').trigger("focus"),jQuery(document.body).trigger("checkout_error",[e])}function onGooglePayLoaded(){FinixGooglePay.getPaymentsClient().isReadyToPay(FinixGooglePay.getIsReadyToPayRequest()).then(function(e){e.result&&(addGooglePayButton(),FinixGooglePay.prefetch())}).catch(function(e){})}function validateWhetherGooglePaySelected(){var e;jQuery('input[name="payment_method"]:checked').val()===finix_google_pay_params.gateway&&(e=document.getElementById("wc-finix_google_pay_gateway-form"))&&"block"!==e.style.display&&(onGooglePayLoaded(),e.style.display="block")}function addGooglePayButton(){var e=FinixGooglePay.getPaymentsClient().createButton({onClick:onGooglePaymentButtonClicked,allowedPaymentMethods:[FinixGooglePay.getCardMethod()],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});finix_google_pay_params.google_merchant_id&&""!==finix_google_pay_params.google_merchant_id&&void 0!==finix_google_pay_params.google_merchant_id&&document.getElementById("wc-finix_google_pay_gateway-form").appendChild(e)}function onGooglePaymentButtonClicked(){if(finix_google_pay_params.google_merchant_id&&""!==finix_google_pay_params.google_merchant_id&&void 0!==finix_google_pay_params.google_merchant_id){var t=retrieveBillingData();if(t.first_name&&t.last_name&&t.address1&&t.city&&t.state&&t.postcode&&t.country&&t.email){let e=retrieveShippingData(),o=(nonEmptyValue(e.shipping_country)&&nonEmptyValue(e.shipping_state)&&nonEmptyValue(e.shipping_postcode)&&nonEmptyValue(e.shipping_city)&&nonEmptyValue(e.shipping_address_1)||(e={shipping_country:t.country,shipping_state:t.state,shipping_postcode:t.postcode,shipping_city:t.city,shipping_address_1:t.address1}),FinixGooglePay.getPaymentsClient());e.nonce=finix_google_pay_params.nonce,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=>{!0===e.success?((e=FinixGooglePay.getPaymentDataRequest()).transactionInfo=FinixGooglePay.getTransactionInfo(),o.loadPaymentData(e).then(e=>{processPaymentData(e)}).catch(e=>{})):triggerGooglePaySubmitError(finix_google_pay_params.text.error_shipping)}).catch(e=>{})}else triggerGooglePaySubmitError(finix_google_pay_params.text.error_billing)}else triggerGooglePaySubmitError(finix_google_pay_params.text.error_merchant_id)}async function processPaymentData(e){var o,e=e.paymentMethodData.tokenizationData.token;e?((o=retrieveBillingData()).address2=document.querySelector("#billing_address_2")?.value||"",FinixGooglePay.processPayment(e,o).then(e=>{e&&e.success?(document.querySelector("#finix_google_pay_success").value=e.success,document.querySelector("#finix_google_pay_transaction_id").value=e.transactionId||"",jQuery("form.woocommerce-checkout, form#order_review").trigger("submit")):(triggerGooglePaySubmitError(finix_google_pay_params.text.error_processing),document.querySelector("#finix_google_pay_success").value=!1)}).catch(e=>{triggerGooglePaySubmitError(finix_google_pay_params.text.error_processing),document.querySelector("#finix_google_pay_success").value=!1})):(triggerGooglePaySubmitError(finix_google_pay_params.text.error_setting_payment),document.querySelector("#finix_google_pay_success").value=!1)}function nonEmptyValue(e){return null!=e&&""!==e&&"undefined"!==e&&""!==e.trim()}jQuery(function(){let t=jQuery("form.woocommerce-checkout, form#order_review");if(t.length){let e=0,o=setInterval(function(){validateWhetherGooglePaySelected(),5<=++e&&clearInterval(o)},1e3);jQuery(document).on("click","#place_order",async function(e){if(jQuery('input[name="payment_method"]:checked',t).val()!==finix_google_pay_params.gateway)return!0;e.preventDefault(),e.stopImmediatePropagation(),onGooglePaymentButtonClicked()}),jQuery(document).on("updated_checkout",function(){finix_google_pay_params.amount=FinixHelpers.getUpdatedTotal()})}});
     1function 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_google_pay_params.billing_data.first_name,last_name:finix_google_pay_params.billing_data.last_name,address1:finix_google_pay_params.billing_data.address_1,city:finix_google_pay_params.billing_data.city,postcode:finix_google_pay_params.billing_data.postcode,country:finix_google_pay_params.billing_data.country,state:finix_google_pay_params.billing_data.state,email:finix_google_pay_params.billing_data.email,phone:finix_google_pay_params.billing_data.phone},e}function retrieveShippingData(){var e,o,t,a,i,n=retrieveBillingData();return""===n.address1||""===n.city||"US"===n.country&&""===n.state||""===n.postcode||""===n.country?(triggerGooglePaySubmitError(finix_google_pay_params.text.error_billing),!1):(e=document.querySelector("#shipping_country")?.value||"",o=document.querySelector("#shipping_state")?.value||"",t=document.querySelector("#shipping_postcode")?.value||"",a=document.querySelector("#shipping_city")?.value||"",i=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(o)&&(n.shipping_state=o),nonEmptyValue(t)&&(n.shipping_postcode=t),nonEmptyValue(a)&&(n.shipping_city=a),nonEmptyValue(i)&&(n.shipping_address_1=i),n)}function triggerGooglePaySubmitError(e){var o=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(),o.prepend('<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">'+e+"</div>"),o.removeClass("processing").unblock(),o.find(".input-text, select, input:checkbox").trigger("validate").trigger("blur");let t=jQuery(".woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout");t.length||(t=o),jQuery.scroll_to_notices(t),o.find('.woocommerce-error[tabindex="-1"], .wc-block-components-notice-banner.is-error[tabindex="-1"]').trigger("focus"),jQuery(document.body).trigger("checkout_error",[e])}function onGooglePayLoaded(){FinixGooglePay.getPaymentsClient().isReadyToPay(FinixGooglePay.getIsReadyToPayRequest()).then(function(e){e.result&&(addGooglePayButton(),FinixGooglePay.prefetch())}).catch(function(e){})}function validateWhetherGooglePaySelected(){var e;jQuery('input[name="payment_method"]:checked').val()===finix_google_pay_params.gateway&&(e=document.getElementById("wc-finix_google_pay_gateway-form"))&&"block"!==e.style.display&&(onGooglePayLoaded(),e.style.display="block")}function addGooglePayButton(){var e=FinixGooglePay.getPaymentsClient().createButton({onClick:onGooglePaymentButtonClicked,allowedPaymentMethods:[FinixGooglePay.getCardMethod()],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});finix_google_pay_params.google_merchant_id&&""!==finix_google_pay_params.google_merchant_id&&void 0!==finix_google_pay_params.google_merchant_id&&document.getElementById("wc-finix_google_pay_gateway-form").appendChild(e)}function onGooglePaymentButtonClicked(){if(finix_google_pay_params.google_merchant_id&&""!==finix_google_pay_params.google_merchant_id&&void 0!==finix_google_pay_params.google_merchant_id){var t=retrieveBillingData();if(t.first_name&&t.last_name&&t.address1&&t.city&&("US"!==t.country||""!==t.state)&&t.postcode&&t.country&&t.email){let e=retrieveShippingData(),o=(nonEmptyValue(e.shipping_country)&&nonEmptyValue(e.shipping_state)&&nonEmptyValue(e.shipping_postcode)&&nonEmptyValue(e.shipping_city)&&nonEmptyValue(e.shipping_address_1)||(e={shipping_country:t.country,shipping_state:t.state,shipping_postcode:t.postcode,shipping_city:t.city,shipping_address_1:t.address1}),FinixGooglePay.getPaymentsClient());e.nonce=finix_google_pay_params.nonce,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=>{!0===e.success?((e=FinixGooglePay.getPaymentDataRequest()).transactionInfo=FinixGooglePay.getTransactionInfo(),o.loadPaymentData(e).then(e=>{processPaymentData(e)}).catch(e=>{})):triggerGooglePaySubmitError(finix_google_pay_params.text.error_shipping)}).catch(e=>{})}else triggerGooglePaySubmitError(finix_google_pay_params.text.error_billing)}else triggerGooglePaySubmitError(finix_google_pay_params.text.error_merchant_id)}async function processPaymentData(e){var o,e=e.paymentMethodData.tokenizationData.token;e?((o=retrieveBillingData()).address2=document.querySelector("#billing_address_2")?.value||"",FinixGooglePay.processPayment(e,o).then(e=>{e&&e.success?(document.querySelector("#finix_google_pay_success").value=e.success,document.querySelector("#finix_google_pay_transaction_id").value=e.transactionId||"",jQuery("form.woocommerce-checkout, form#order_review").trigger("submit")):(triggerGooglePaySubmitError(finix_google_pay_params.text.error_processing),document.querySelector("#finix_google_pay_success").value=!1)}).catch(e=>{triggerGooglePaySubmitError(finix_google_pay_params.text.error_processing),document.querySelector("#finix_google_pay_success").value=!1})):(triggerGooglePaySubmitError(finix_google_pay_params.text.error_setting_payment),document.querySelector("#finix_google_pay_success").value=!1)}function nonEmptyValue(e){return null!=e&&""!==e&&"undefined"!==e&&""!==e.trim()}jQuery(function(){let t=jQuery("form.woocommerce-checkout, form#order_review");if(t.length){let e=0,o=setInterval(function(){validateWhetherGooglePaySelected(),5<=++e&&clearInterval(o)},1e3);jQuery(document).on("click","#place_order",async function(e){if(jQuery('input[name="payment_method"]:checked',t).val()!==finix_google_pay_params.gateway)return!0;e.preventDefault(),e.stopImmediatePropagation(),onGooglePaymentButtonClicked()}),jQuery(document).on("updated_checkout",function(){finix_google_pay_params.amount=FinixHelpers.getUpdatedValue(".woocommerce-checkout-review-order-table .order-total .woocommerce-Price-amount"),fetch(finix_google_pay_params.url.ajax+"?action=get_order_tracking_details",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({nonce:finix_google_pay_params.nonce})}).then(e=>e.json()).then(e=>{!0===e.success&&(finix_google_pay_params.subtotal=e.data.subtotal||finix_google_pay_params.amount,finix_google_pay_params.shipping_amount=e.data.shipping_amount||0,finix_google_pay_params.tax_amount=e.data.tax_amount||0,finix_google_pay_params.products=e.data.products||[],finix_google_pay_params.coupons=e.data.coupons||[])}).catch(e=>{})})}});
  • finix-for-woocommerce/trunk/assets/languages/finix-for-woocommerce.pot

    r3375717 r3418263  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Finix for WooCommerce 1.3.0\n"
     5"Project-Id-Version: Finix for WooCommerce 1.4.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-10-09T12:02:03+00:00\n"
     12"POT-Creation-Date: 2025-12-12T12:24:02+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.12.0\n"
     
    2727#. Description of the plugin
    2828#: finix-for-woocommerce.php
    29 msgid "Take credit card, ACH, and Apple Pay payments on your store using Finix."
     29msgid "Accept credit card, bank, Apple Pay, and Google Pay payments on your store using Finix."
    3030msgstr ""
    3131
     
    5353#: src/Admin/Admin.php:83
    5454#, php-format
    55 msgid "<strong>All the payments will be declined.</strong> Supported currencies: %s."
     55msgid "<strong>All payments will be declined.</strong> Supported currencies: %s."
     56msgstr ""
     57
     58#: src/Admin/Admin.php:114
     59msgid "Apple Pay and Google Pay can only run over HTTPS."
     60msgstr ""
     61
     62#: src/Admin/Admin.php:115
     63msgid "Please enable SSL (HTTPS) on your website to use them at checkout OR disable these payment methods."
    5664msgstr ""
    5765
     
    7987#: src/Events/CardAchPaymentEvent.php:136
    8088#: src/Events/GooglePayPaymentCompletedEvent.php:38
    81 msgid "Payment error: There was an error while processing your payment. Please try again."
     89msgid "Payment error: There was an error processing your payment. Please try again later."
    8290msgstr ""
    8391
     
    9098#: src/Events/GooglePayPaymentCompletedEvent.php:95
    9199#: src/Events/GooglePayPaymentCompletedEvent.php:107
    92 msgid "Payment error: There was an error while processing your payment. Please contact support if you were charged."
     100msgid "Payment error: There was an error processing your payment. Please contact support if you were charged."
    93101msgstr ""
    94102
     
    104112#: src/Events/ApplePayPaymentEvent.php:79
    105113#: src/Events/GooglePayPaymentEvent.php:79
    106 msgid "There was an error while processing your payment."
     114#: src/Gateways/ApplePayGateway.php:391
     115#: src/Gateways/ApplePayGateway.php:441
     116#: src/Gateways/CardBankGateway.php:61
     117#: src/Gateways/GooglePayGateway.php:350
     118#: src/Gateways/GooglePayGateway.php:417
     119#: src/Gateways/PaymentMethods/ApplePay.php:125
     120#: src/Gateways/PaymentMethods/GooglePay.php:139
     121msgid "There was an error processing your payment. Please try again later."
    107122msgstr ""
    108123
     
    116131#: src/Events/ApplePaySessionEvent.php:50
    117132#: src/Events/GooglePayPaymentEvent.php:128
    118 #: src/Gateways/ApplePayGateway.php:558
    119 #: src/Gateways/GooglePayGateway.php:470
     133#: src/Gateways/ApplePayGateway.php:557
     134#: src/Gateways/GooglePayGateway.php:504
    120135msgid "There was an error processing the payment."
    121136msgstr ""
     
    123138#: src/Events/ApplePayPaymentEvent.php:144
    124139#: src/Events/GooglePayPaymentEvent.php:144
    125 #: src/Gateways/ApplePayGateway.php:505
    126 #: src/Gateways/ApplePayGateway.php:515
    127 #: src/Gateways/GooglePayGateway.php:432
    128 #: src/Gateways/GooglePayGateway.php:442
     140#: src/Gateways/ApplePayGateway.php:504
     141#: src/Gateways/ApplePayGateway.php:514
     142#: src/Gateways/GooglePayGateway.php:466
     143#: src/Gateways/GooglePayGateway.php:476
    129144msgid "There was an error while processing the payment. Please try again later."
    130145msgstr ""
     
    182197
    183198#: src/Events/CardAchPaymentEvent.php:163
    184 msgid "Payment pending: There was an error while processing your payment. Please try again."
     199msgid "Payment pending: There was an error processing your payment. Please try again later."
    185200msgstr ""
    186201
     
    194209
    195210#: src/Events/CardAchPaymentEvent.php:191
    196 msgid "Payment failed: There was an error while processing your payment. Please try again."
     211msgid "Payment failed: There was an error processing your payment. Please try again later."
    197212msgstr ""
    198213
     
    235250msgstr ""
    236251
     252#: src/Gateways/ApplePayGateway.php:33
     253msgid "Finix Apple Pay"
     254msgstr ""
     255
    237256#: src/Gateways/ApplePayGateway.php:34
    238 msgid "Finix Apple Pay"
    239 msgstr ""
    240 
    241 #: src/Gateways/ApplePayGateway.php:35
    242257msgid "Accept Apple Pay payments with Finix."
    243258msgstr ""
    244259
    245 #: src/Gateways/ApplePayGateway.php:40
     260#: src/Gateways/ApplePayGateway.php:39
    246261#: assets/js/block/src/apple-pay.js:15
    247262msgid "Pay with Apple Pay"
    248263msgstr ""
    249264
    250 #: src/Gateways/ApplePayGateway.php:82
     265#: src/Gateways/ApplePayGateway.php:81
    251266#: src/Gateways/BankGateway.php:38
    252267#: src/Gateways/CardGateway.php:47
    253 #: src/Gateways/GooglePayGateway.php:81
     268#: src/Gateways/GooglePayGateway.php:82
    254269msgid "General Settings"
    255270msgstr ""
    256271
    257 #: src/Gateways/ApplePayGateway.php:87
     272#: src/Gateways/ApplePayGateway.php:86
    258273#: src/Gateways/BankGateway.php:43
    259274#: src/Gateways/CardGateway.php:52
    260 #: src/Gateways/GooglePayGateway.php:86
     275#: src/Gateways/GooglePayGateway.php:87
    261276msgid "Status"
    262277msgstr ""
    263278
    264 #: src/Gateways/ApplePayGateway.php:88
    265 msgid "Enable Apply Pay Gateway"
    266 msgstr ""
    267 
    268 #: src/Gateways/ApplePayGateway.php:94
     279#: src/Gateways/ApplePayGateway.php:87
     280msgid "Enable Apple Pay Gateway"
     281msgstr ""
     282
     283#: src/Gateways/ApplePayGateway.php:93
    269284#: src/Gateways/BankGateway.php:50
    270285#: src/Gateways/CardGateway.php:59
    271 #: src/Gateways/GooglePayGateway.php:93
     286#: src/Gateways/GooglePayGateway.php:94
    272287msgid "Title"
    273288msgstr ""
    274289
    275 #: src/Gateways/ApplePayGateway.php:96
     290#: src/Gateways/ApplePayGateway.php:95
    276291#: src/Gateways/BankGateway.php:52
    277292#: src/Gateways/CardGateway.php:61
    278 #: src/Gateways/GooglePayGateway.php:95
     293#: src/Gateways/GooglePayGateway.php:96
    279294msgid "This controls the title which the user sees during checkout."
    280295msgstr ""
    281296
    282 #: src/Gateways/ApplePayGateway.php:97
     297#: src/Gateways/ApplePayGateway.php:96
    283298#: src/Gateways/FinixGateway.php:262
    284299msgid "Apple Pay"
    285300msgstr ""
    286301
    287 #: src/Gateways/ApplePayGateway.php:101
     302#: src/Gateways/ApplePayGateway.php:100
    288303#: src/Gateways/BankGateway.php:57
    289304#: src/Gateways/CardGateway.php:66
    290 #: src/Gateways/GooglePayGateway.php:100
     305#: src/Gateways/GooglePayGateway.php:101
    291306msgid "Description"
    292307msgstr ""
    293308
    294 #: src/Gateways/ApplePayGateway.php:103
     309#: src/Gateways/ApplePayGateway.php:102
    295310#: src/Gateways/BankGateway.php:59
    296311#: src/Gateways/CardGateway.php:68
    297 #: src/Gateways/GooglePayGateway.php:102
     312#: src/Gateways/GooglePayGateway.php:103
    298313msgid "This controls the description which the user sees during checkout. It will be wrapped in the paragraph tag."
    299314msgstr ""
    300315
    301 #: src/Gateways/ApplePayGateway.php:108
     316#: src/Gateways/ApplePayGateway.php:107
    302317msgid "Button Style"
    303318msgstr ""
    304319
    305 #: src/Gateways/ApplePayGateway.php:110
     320#: src/Gateways/ApplePayGateway.php:109
    306321msgid "Choose the style for the Apple Pay button."
    307322msgstr ""
    308323
     324#: src/Gateways/ApplePayGateway.php:111
     325#: src/Gateways/GooglePayGateway.php:113
     326msgid "Black"
     327msgstr ""
     328
    309329#: src/Gateways/ApplePayGateway.php:112
    310 msgid "Black"
     330#: src/Gateways/GooglePayGateway.php:114
     331msgid "White"
    311332msgstr ""
    312333
    313334#: src/Gateways/ApplePayGateway.php:113
    314 msgid "White"
    315 msgstr ""
    316 
    317 #: src/Gateways/ApplePayGateway.php:114
    318335msgid "White with outline"
    319336msgstr ""
    320337
    321 #: src/Gateways/ApplePayGateway.php:120
    322 #: src/Gateways/GooglePayGateway.php:119
     338#: src/Gateways/ApplePayGateway.php:119
     339#: src/Gateways/GooglePayGateway.php:120
    323340msgid "Button Type"
    324341msgstr ""
    325342
    326 #: src/Gateways/ApplePayGateway.php:122
    327 msgid "Choose the type of the Apple Pay button. This affects wording on a button."
     343#: src/Gateways/ApplePayGateway.php:121
     344msgid "Choose the type of the Apple Pay button. This affects the button text."
     345msgstr ""
     346
     347#: src/Gateways/ApplePayGateway.php:123
     348#: src/Gateways/GooglePayGateway.php:124
     349msgid "Plain"
    328350msgstr ""
    329351
    330352#: src/Gateways/ApplePayGateway.php:124
    331 msgid "Plain"
     353msgid "Continue"
    332354msgstr ""
    333355
    334356#: src/Gateways/ApplePayGateway.php:125
    335 msgid "Continue"
     357msgid "Add Money"
    336358msgstr ""
    337359
    338360#: src/Gateways/ApplePayGateway.php:126
    339 msgid "Add Money"
     361#: src/Gateways/GooglePayGateway.php:129
     362msgid "Book"
    340363msgstr ""
    341364
    342365#: src/Gateways/ApplePayGateway.php:127
    343 msgid "Book"
     366#: src/Gateways/GooglePayGateway.php:125
     367msgid "Buy"
    344368msgstr ""
    345369
    346370#: src/Gateways/ApplePayGateway.php:128
    347 msgid "Buy"
     371msgid "Check Out"
    348372msgstr ""
    349373
    350374#: src/Gateways/ApplePayGateway.php:129
    351 msgid "Check Out"
     375msgid "Contribute"
    352376msgstr ""
    353377
    354378#: src/Gateways/ApplePayGateway.php:130
    355 msgid "Contribute"
     379#: src/Gateways/GooglePayGateway.php:127
     380msgid "Donate"
    356381msgstr ""
    357382
    358383#: src/Gateways/ApplePayGateway.php:131
    359 msgid "Donate"
     384#: src/Gateways/GooglePayGateway.php:130
     385msgid "Order"
    360386msgstr ""
    361387
    362388#: src/Gateways/ApplePayGateway.php:132
    363 msgid "Order"
     389#: src/Gateways/GooglePayGateway.php:131
     390msgid "Pay"
    364391msgstr ""
    365392
    366393#: src/Gateways/ApplePayGateway.php:133
    367 msgid "Pay"
     394msgid "Reload"
    368395msgstr ""
    369396
    370397#: src/Gateways/ApplePayGateway.php:134
    371 msgid "Reload"
     398msgid "Rent"
    372399msgstr ""
    373400
    374401#: src/Gateways/ApplePayGateway.php:135
    375 msgid "Rent"
     402msgid "Set Up"
    376403msgstr ""
    377404
    378405#: src/Gateways/ApplePayGateway.php:136
    379 msgid "Set Up"
     406#: src/Gateways/GooglePayGateway.php:128
     407msgid "Subscribe"
    380408msgstr ""
    381409
    382410#: src/Gateways/ApplePayGateway.php:137
    383 msgid "Subscribe"
     411msgid "Support"
    384412msgstr ""
    385413
    386414#: src/Gateways/ApplePayGateway.php:138
    387 msgid "Support"
     415msgid "Tip"
    388416msgstr ""
    389417
    390418#: src/Gateways/ApplePayGateway.php:139
    391 msgid "Tip"
    392 msgstr ""
    393 
    394 #: src/Gateways/ApplePayGateway.php:140
    395419msgid "Top Up"
    396420msgstr ""
    397421
    398 #: src/Gateways/ApplePayGateway.php:146
    399 #: src/Gateways/GooglePayGateway.php:143
     422#: src/Gateways/ApplePayGateway.php:145
     423#: src/Gateways/GooglePayGateway.php:144
    400424msgid "Display Name"
    401425msgstr ""
    402426
    403 #: src/Gateways/ApplePayGateway.php:148
     427#: src/Gateways/ApplePayGateway.php:147
    404428msgid "This will be the merchant name shown to users when making a purchase via Apple Pay."
    405429msgstr ""
    406430
    407 #: src/Gateways/ApplePayGateway.php:163
     431#: src/Gateways/ApplePayGateway.php:162
    408432msgid "Apple Pay Payment Method"
    409433msgstr ""
    410434
    411 #: src/Gateways/ApplePayGateway.php:165
    412 msgid "Receive payments via Apple Pay with Finix. You can configure the available options on this page."
     435#: src/Gateways/ApplePayGateway.php:164
     436msgid "Accept payments via Apple Pay with Finix. You can configure available options on this page."
    413437msgstr ""
    414438
    415439#. translators: %s - plugin version.
    416 #: src/Gateways/ApplePayGateway.php:169
     440#: src/Gateways/ApplePayGateway.php:168
    417441msgid "<strong>Note:</strong> Apple Pay with Finix for WooCommerce is only supported with Live Credentials."
    418442msgstr ""
    419443
    420 #: src/Gateways/ApplePayGateway.php:182
     444#: src/Gateways/ApplePayGateway.php:181
    421445msgid "Register Domain"
    422446msgstr ""
    423447
    424 #: src/Gateways/ApplePayGateway.php:185
     448#: src/Gateways/ApplePayGateway.php:184
    425449msgid "This plugin attempts to add the domain association to your server automatically when you click the \"Register Domain\" button."
    426450msgstr ""
    427451
    428 #: src/Gateways/ApplePayGateway.php:187
     452#: src/Gateways/ApplePayGateway.php:186
    429453msgid "In order for Apple Pay to display you must test with an iOS device and have a payment method saved in the Apple Wallet."
    430454msgstr ""
    431455
    432456#. translators: %s - domain name.
    433 #: src/Gateways/ApplePayGateway.php:195
     457#: src/Gateways/ApplePayGateway.php:194
    434458#, php-format
    435459msgid "Register Domain: %s"
    436460msgstr ""
    437461
     462#: src/Gateways/ApplePayGateway.php:247
     463msgid "Registering domain..."
     464msgstr ""
     465
    438466#: src/Gateways/ApplePayGateway.php:248
    439 msgid "Registering domain..."
    440 msgstr ""
    441 
    442 #: src/Gateways/ApplePayGateway.php:249
     467#: src/Gateways/ApplePayGateway.php:392
     468#: src/Gateways/GooglePayGateway.php:352
     469#: src/Gateways/PaymentMethods/ApplePay.php:126
     470#: src/Gateways/PaymentMethods/GooglePay.php:140
     471msgid "Please enter a valid billing address."
     472msgstr ""
     473
     474#: src/Gateways/ApplePayGateway.php:261
     475#: src/Gateways/CardBankGateway.php:80
     476#: src/Gateways/GooglePayGateway.php:194
     477msgid "TEST MODE ENABLED. All the payments will go through the sandbox."
     478msgstr ""
     479
    443480#: src/Gateways/ApplePayGateway.php:393
    444 #: src/Gateways/PaymentMethods/ApplePay.php:126
    445 #: src/Gateways/PaymentMethods/GooglePay.php:131
    446 msgid "Please enter a valid billing address."
    447 msgstr ""
    448 
    449 #: src/Gateways/ApplePayGateway.php:262
    450 #: src/Gateways/CardBankGateway.php:79
    451 #: src/Gateways/GooglePayGateway.php:193
    452 msgid "TEST MODE ENABLED. All the payments will go through the sandbox."
    453 msgstr ""
    454 
    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
    461 #: src/Gateways/PaymentMethods/GooglePay.php:130
    462 msgid "There was an error while processing your payment. Please try again later."
     481#: src/Gateways/GooglePayGateway.php:355
     482#: src/Gateways/PaymentMethods/ApplePay.php:127
     483#: src/Gateways/PaymentMethods/GooglePay.php:141
     484#: assets/js/block/src/apple-pay.js:288
     485#: assets/js/block/src/FinixGooglePay.js:70
     486msgid "Subtotal"
    463487msgstr ""
    464488
    465489#: src/Gateways/ApplePayGateway.php:394
    466 #: src/Gateways/PaymentMethods/ApplePay.php:127
    467 #: assets/js/block/src/apple-pay.js:288
    468 msgid "Subtotal"
     490#: src/Gateways/GooglePayGateway.php:356
     491#: src/Gateways/PaymentMethods/ApplePay.php:128
     492#: src/Gateways/PaymentMethods/GooglePay.php:142
     493#: assets/js/block/src/apple-pay.js:305
     494#: assets/js/block/src/FinixGooglePay.js:87
     495msgid "Shipping"
    469496msgstr ""
    470497
    471498#: src/Gateways/ApplePayGateway.php:395
    472 #: src/Gateways/PaymentMethods/ApplePay.php:128
    473 #: assets/js/block/src/apple-pay.js:305
    474 msgid "Shipping"
     499#: src/Gateways/GooglePayGateway.php:357
     500#: src/Gateways/PaymentMethods/ApplePay.php:129
     501#: src/Gateways/PaymentMethods/GooglePay.php:143
     502#: assets/js/block/src/apple-pay.js:314
     503#: assets/js/block/src/FinixGooglePay.js:96
     504msgid "Tax"
    475505msgstr ""
    476506
    477507#: src/Gateways/ApplePayGateway.php:396
    478 #: src/Gateways/PaymentMethods/ApplePay.php:129
    479 #: assets/js/block/src/apple-pay.js:314
    480 msgid "Tax"
    481 msgstr ""
    482 
    483 #: src/Gateways/ApplePayGateway.php:397
     508#: src/Gateways/GooglePayGateway.php:358
    484509#: src/Gateways/PaymentMethods/ApplePay.php:130
     510#: src/Gateways/PaymentMethods/GooglePay.php:144
    485511#: assets/js/block/src/apple-pay.js:296
     512#: assets/js/block/src/FinixGooglePay.js:78
    486513msgid "Discount code:"
    487514msgstr ""
     
    509536
    510537#: src/Gateways/BankGateway.php:75
    511 msgid "Take bank payments with Finix. You can configure available options on this page."
    512 msgstr ""
    513 
    514 #: src/Gateways/CardBankGateway.php:34
     538msgid "Accept bank payments with Finix. You can configure available options on this page."
     539msgstr ""
     540
     541#: src/Gateways/CardBankGateway.php:35
    515542msgid "Pay with Finix"
    516543msgstr ""
    517544
    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
     545#: src/Gateways/CardBankGateway.php:152
     546#: src/Helpers/CartData.php:128
     547#: src/Helpers/CartData.php:132
    523548#: assets/js/block/src/bank.js:95
    524549#: assets/js/block/src/card.js:95
     
    526551msgstr ""
    527552
    528 #: src/Gateways/CardBankGateway.php:151
    529 #: src/Gateways/CardBankGateway.php:169
    530 #: src/Gateways/PaymentMethods/CardBankMethod.php:111
    531 msgid "Please enter a valid full name"
    532 msgstr ""
    533 
    534 #: src/Gateways/CardBankGateway.php:170
    535 #: assets/js/block/src/bank.js:106
    536 #: assets/js/block/src/card.js:106
    537 msgid "Please enter a valid city"
    538 msgstr ""
    539 
    540 #: src/Gateways/CardBankGateway.php:215
     553#: src/Gateways/CardBankGateway.php:154
     554#: src/Helpers/CartData.php:139
     555msgid "Please enter a valid full name."
     556msgstr ""
     557
     558#: src/Gateways/CardBankGateway.php:155
     559msgid "Please enter a valid city."
     560msgstr ""
     561
     562#: src/Gateways/CardBankGateway.php:200
    541563msgid "Refund failed."
    542564msgstr ""
     
    564586
    565587#: src/Gateways/CardGateway.php:84
    566 msgid "Take card payments with Finix. You can configure available options on this page."
     588msgid "Accept card payments with Finix. You can configure available options on this page."
    567589msgstr ""
    568590
     
    593615
    594616#: src/Gateways/FinixGateway.php:91
    595 msgid "This tag will be used to identify the source of the payment. It will be used to tag the payment details send to Finix."
     617msgid "This tag will be used to identify the source of the payment. It will be used to tag payment details sent to Finix."
    596618msgstr ""
    597619
     
    605627
    606628#: src/Gateways/FinixGateway.php:106
    607 msgid "This is the application ID provided on Finix dashboard -> developer menu by selecting sandbox environment"
     629msgid "This is the application ID provided in Finix Dashboard > Developer menu by selecting your Sandbox environment"
    608630msgstr ""
    609631
     
    643665
    644666#: src/Gateways/FinixGateway.php:143
    645 msgid "This is the application ID provided on Finix dashboard -> developer menu by selecting live environment"
     667msgid "This is the application ID provided in Finix Dashboard > Developer menu by selecting your Live environment"
    646668msgstr ""
    647669
     
    672694
    673695#: src/Gateways/FinixGateway.php:181
    674 msgid "If enabled, the plugin will listen to the dispute.created webhook event and update the order state if a dispute is created."
     696msgid "If enabled, the plugin will listen to the dispute.created webhook event and update the order status if a dispute is created."
    675697msgstr ""
    676698
    677699#: src/Gateways/FinixGateway.php:186
    678 msgid "Disputes Order State"
     700msgid "Disputes Order Status"
    679701msgstr ""
    680702
     
    689711
    690712#: src/Gateways/FinixGateway.php:197
    691 msgid "If enabled, the plugin will listen to ACH returns and update the order state if ACH return is created."
     713msgid "If enabled, the plugin will listen to ACH returns and update the order status if ACH return is created."
    692714msgstr ""
    693715
    694716#: src/Gateways/FinixGateway.php:202
    695 msgid "ACH Return Order State"
     717msgid "ACH Return Order Status"
    696718msgstr ""
    697719
     
    713735
    714736#: src/Gateways/FinixGateway.php:263
    715 #: src/Gateways/GooglePayGateway.php:96
     737#: src/Gateways/GooglePayGateway.php:97
    716738msgid "Google Pay"
    717739msgstr ""
    718740
    719 #: src/Gateways/FinixGateway.php:275
    720 #: src/Gateways/FinixGateway.php:276
     741#: src/Gateways/FinixGateway.php:277
     742#: src/Gateways/FinixGateway.php:278
    721743msgid "Finix Payments"
    722744msgstr ""
    723745
    724 #: src/Gateways/FinixGateway.php:321
     746#: src/Gateways/FinixGateway.php:323
    725747msgid "Webhook Configuration"
    726748msgstr ""
    727749
    728750#. translators: %s - Finix Dashboard URL.
    729 #: src/Gateways/FinixGateway.php:327
     751#: src/Gateways/FinixGateway.php:329
    730752#, php-format
    731753msgid "To enable webhook, please add the following details to your <a href=\"%s\" target=\"_blank\">Finix Dashboard</a>:"
    732754msgstr ""
    733755
    734 #: src/Gateways/FinixGateway.php:343
     756#: src/Gateways/FinixGateway.php:345
    735757msgid "URL:"
    736758msgstr ""
    737759
    738 #: src/Gateways/FinixGateway.php:347
     760#: src/Gateways/FinixGateway.php:349
    739761msgid "Authentication Type:"
    740762msgstr ""
    741763
    742 #: src/Gateways/FinixGateway.php:348
     764#: src/Gateways/FinixGateway.php:350
    743765msgid "Basic"
    744766msgstr ""
    745767
    746 #: src/Gateways/FinixGateway.php:351
     768#: src/Gateways/FinixGateway.php:353
    747769msgid "Username:"
    748770msgstr ""
    749771
    750 #: src/Gateways/FinixGateway.php:355
     772#: src/Gateways/FinixGateway.php:357
    751773msgid "Password:"
    752774msgstr ""
    753775
    754 #: src/Gateways/FinixGateway.php:359
     776#: src/Gateways/FinixGateway.php:361
    755777msgid "Required Events:"
    756778msgstr ""
    757779
    758 #: src/Gateways/GooglePayGateway.php:32
     780#: src/Gateways/GooglePayGateway.php:33
    759781msgid "Finix Google Pay"
    760782msgstr ""
    761783
    762 #: src/Gateways/GooglePayGateway.php:33
     784#: src/Gateways/GooglePayGateway.php:34
    763785msgid "Accept Google Pay payments with Finix."
    764786msgstr ""
    765787
    766 #: src/Gateways/GooglePayGateway.php:38
     788#: src/Gateways/GooglePayGateway.php:39
    767789#: assets/js/block/src/google-pay.js:16
    768790msgid "Pay with Google Pay"
    769791msgstr ""
    770792
    771 #: src/Gateways/GooglePayGateway.php:87
     793#: src/Gateways/GooglePayGateway.php:88
    772794msgid "Enable Google Pay Gateway"
    773795msgstr ""
    774796
    775 #: src/Gateways/GooglePayGateway.php:107
     797#: src/Gateways/GooglePayGateway.php:108
    776798msgid "Button Color"
    777799msgstr ""
    778800
    779 #: src/Gateways/GooglePayGateway.php:109
    780 msgid "Choose color for the Google Pay button."
    781 msgstr ""
    782 
    783 #: src/Gateways/GooglePayGateway.php:111
    784 msgid "Default Button"
     801#: src/Gateways/GooglePayGateway.php:110
     802msgid "Choose the color for the Google Pay button."
    785803msgstr ""
    786804
    787805#: src/Gateways/GooglePayGateway.php:112
    788 msgid "Black Button"
    789 msgstr ""
    790 
    791 #: src/Gateways/GooglePayGateway.php:113
    792 msgid "White Button"
    793 msgstr ""
    794 
    795 #: src/Gateways/GooglePayGateway.php:121
     806msgid "Default"
     807msgstr ""
     808
     809#: src/Gateways/GooglePayGateway.php:122
    796810msgid "Choose which type of Google Pay button you want."
    797811msgstr ""
    798812
    799 #: src/Gateways/GooglePayGateway.php:123
    800 msgid "Plain Button"
    801 msgstr ""
    802 
    803 #: src/Gateways/GooglePayGateway.php:124
    804 msgid "Buy Button"
    805 msgstr ""
    806 
    807 #: src/Gateways/GooglePayGateway.php:125
    808 msgid "Checkout Button"
    809 msgstr ""
    810 
    811813#: src/Gateways/GooglePayGateway.php:126
    812 msgid "Donate Button"
    813 msgstr ""
    814 
    815 #: src/Gateways/GooglePayGateway.php:127
    816 msgid "Subscribe Button"
    817 msgstr ""
    818 
    819 #: src/Gateways/GooglePayGateway.php:128
    820 msgid "Book Button"
    821 msgstr ""
    822 
    823 #: src/Gateways/GooglePayGateway.php:129
    824 msgid "Order Button"
    825 msgstr ""
    826 
    827 #: src/Gateways/GooglePayGateway.php:130
    828 msgid "Pay Button"
    829 msgstr ""
    830 
    831 #: src/Gateways/GooglePayGateway.php:136
     814msgid "Checkout"
     815msgstr ""
     816
     817#: src/Gateways/GooglePayGateway.php:137
    832818msgid "Button Corner Radius"
    833819msgstr ""
    834820
    835 #: src/Gateways/GooglePayGateway.php:138
     821#: src/Gateways/GooglePayGateway.php:139
    836822msgid "Choose the corner radius for the Google Pay button. Default is 5px."
    837823msgstr ""
    838824
    839 #: src/Gateways/GooglePayGateway.php:145
     825#: src/Gateways/GooglePayGateway.php:146
    840826msgid "This will be the merchant name shown to users when making a purchase via Google Pay."
    841827msgstr ""
    842828
    843 #: src/Gateways/GooglePayGateway.php:150
     829#: src/Gateways/GooglePayGateway.php:151
    844830msgid "Google Merchant ID"
    845831msgstr ""
    846832
    847 #: src/Gateways/GooglePayGateway.php:152
     833#: src/Gateways/GooglePayGateway.php:153
    848834msgid "This is the Google Merchant ID. You can find it on your Google Business console."
    849835msgstr ""
    850836
    851 #: src/Gateways/GooglePayGateway.php:167
     837#: src/Gateways/GooglePayGateway.php:168
    852838msgid "Google Pay Payment Method"
    853839msgstr ""
    854840
    855 #: src/Gateways/GooglePayGateway.php:169
    856 msgid "Receive payments via Google Pay with Finix. You can configure the available options on this page."
    857 msgstr ""
    858 
    859 #: src/Gateways/GooglePayGateway.php:322
     841#: src/Gateways/GooglePayGateway.php:170
     842msgid "Accept payments via Google Pay with Finix. You can configure available options on this page."
     843msgstr ""
     844
     845#: src/Gateways/GooglePayGateway.php:351
    860846msgid "There was an error processing the payment through Google Pay. Please try a different method or try again later."
    861847msgstr ""
    862848
    863 #: src/Gateways/GooglePayGateway.php:323
    864 msgid "Please enter a valid billing details."
    865 msgstr ""
    866 
    867 #: src/Gateways/GooglePayGateway.php:324
    868 msgid "Please enter a valid shipping details."
    869 msgstr ""
    870 
    871 #: src/Gateways/GooglePayGateway.php:325
     849#: src/Gateways/GooglePayGateway.php:353
     850msgid "Please enter a valid shipping address."
     851msgstr ""
     852
     853#: src/Gateways/GooglePayGateway.php:354
    872854msgid "Missing details for Google Pay. Please contact the store owner."
     855msgstr ""
     856
     857#: src/Gateways/GooglePayGateway.php:359
     858#: assets/js/block/src/FinixGooglePay.js:106
     859msgid "Total"
     860msgstr ""
     861
     862#: src/Helpers/CartData.php:145
     863#: src/Helpers/CartData.php:146
     864msgid "Postal Code"
     865msgstr ""
     866
     867#: src/Helpers/CartData.php:147
     868#: src/Helpers/CartData.php:148
     869msgid "Province"
    873870msgstr ""
    874871
     
    882879
    883880#: src/Payments.php:149
     881#: src/Payments.php:175
    884882msgid "Please review and fill in all the required information."
    885 msgstr ""
    886 
    887 #: src/Payments.php:175
    888 msgid "Please review and fill all the required information."
    889883msgstr ""
    890884
     
    909903msgstr ""
    910904
    911 #: assets/js/block/src/bank.js:105
    912 #: assets/js/block/src/card.js:105
     905#: assets/js/block/src/bank.js:106
     906#: assets/js/block/src/card.js:106
    913907msgid "Please enter a valid name"
    914908msgstr ""
    915909
    916 #: assets/js/block/src/bank.js:148
    917 #: assets/js/block/src/card.js:148
     910#: assets/js/block/src/bank.js:107
     911#: assets/js/block/src/card.js:107
     912msgid "Please enter a valid city"
     913msgstr ""
     914
     915#: assets/js/block/src/bank.js:149
     916#: assets/js/block/src/card.js:149
    918917msgid "Unfortunately, there was an error while loading the payment form. Please try again later."
    919918msgstr ""
    920919
    921 #: assets/js/block/src/bank.js:189
    922 #: assets/js/block/src/card.js:189
     920#: assets/js/block/src/bank.js:190
     921#: assets/js/block/src/card.js:190
    923922msgid "Unfortunately, there was an error while initializing a payment form."
    924923msgstr ""
    925924
    926 #: assets/js/block/src/FinixGooglePay.js:81
     925#: assets/js/block/src/FinixGooglePay.js:129
    927926msgid "There was an error while processing the payment using Google Pay."
    928927msgstr ""
    929928
    930 #: assets/js/block/src/google-pay.js:117
     929#: assets/js/block/src/google-pay.js:139
    931930msgid "There was an error while initializing Google Pay. Please check all the details and try again."
    932931msgstr ""
    933932
    934 #: assets/js/block/src/google-pay.js:128
     933#: assets/js/block/src/google-pay.js:150
    935934msgid "Please make sure shipping and billing information is correct and then try again."
    936935msgstr ""
  • finix-for-woocommerce/trunk/finix-for-woocommerce.php

    r3375717 r3418263  
    33 * Plugin Name:          Finix for WooCommerce
    44 * Plugin URI:           https://docs.finix.com/additional-resources/plugins/woocommerce-plugin
    5  * Description:          Take credit card, bank, Apple Pay, and Google Pay payments on your store using Finix.
    6  * Version:              1.3.0
     5 * Description:          Accept credit card, bank, Apple Pay, and Google Pay payments on your store using Finix.
     6 * Version:              1.4.0
    77 * Author:               Finix
    88 * Author URI:           https://finix.com
     
    1515 * Domain Path:          /assets/languages
    1616 *
    17  * WC requires at least: 9.9
    18  * WC tested up to:      10.2
     17 * WC requires at least: 10.0
     18 * WC tested up to:      10.4
    1919 */
    2020
     
    2222
    2323// phpcs:disable WPForms.Comments.PHPDocDefine.MissPHPDoc
    24 const FINIXWC_VERSION        = '1.3.0';
     24const FINIXWC_VERSION        = '1.4.0';
    2525const FINIXWC_PLUGIN_FILE    = __FILE__;
    26 const FINIXWC_MIN_WC_VERSION = '9.9.0';
     26const FINIXWC_MIN_WC_VERSION = '10.0';
    2727
    2828define( 'FINIXWC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
  • finix-for-woocommerce/trunk/readme.txt

    r3375717 r3418263  
    33Tags: finix, credit card, ach, apple pay, woocommerce
    44Requires at least: 6.7
    5 Tested up to: 6.8
     5Tested up to: 6.9
    66Requires PHP: 7.4
    77Requires Plugins: woocommerce
    8 WC requires at least: 9.9
    9 WC tested up to: 10.2
    10 Stable tag: 1.3.0
     8WC requires at least: 10.0
     9WC tested up to: 10.4
     10Stable tag: 1.4.0
    1111License: GPLv2 or later
    1212License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2323* <strong>Flexible Payment Methods:</strong> Accept major credit and debit cards, Apple Pay, and bank transfers. Offer flexibility customers expect and reduce checkout friction.
    2424* <strong>Transparent Pricing:</strong> Finix uses interchange-plus pricing for clear, detailed fee breakdowns, ideal for high-volume merchants.
    25 * <strong>Apple Pay Integration:</strong> Enable Apple Pay on supported browsers like Safari and Chrome, with customizable button styles and types that blend seamlessly into your storefront.
     25* <strong>Apple Pay Integration:</strong> Enable Apple Pay, with customizable button styles and types that blend seamlessly into your storefront.
     26* <strong>Google Pay Integration:</strong> Enable Google Pay, with customizable button styles and types that blend seamlessly into your storefront.
    2627* <strong>Customizable Checkout Display:</strong> Match your brand’s voice by tailoring the look and language of each payment method for a more intuitive customer experience.
    27 * <strong>WooCommerce Blocks Checkout Compatible</strong> Fully supports WooCommerce’s new block-based checkout and the classic flow, keeping your store aligned with the latest updates.
     28* <strong>WooCommerce Blocks Checkout Compatible</strong> Fully supports WooCommerce’s new block-based checkout and the classic shortcode-based flow, keeping your store aligned with the latest updates.
    2829* <strong>Automated Dispute & Bank Return Handling</strong> Reduce operational overhead with automatic order status updates triggered by webhook events.
    2930
     
    6061= How can I issue refunds through the Finix plugin? =
    6162
    62 You can issue refunds directly through the WooCommerce order management interface. Simply navigate to the order you wish to refund, click the "Refund" button and follow the prompts to process the refund.
     63You can issue refunds directly through the WooCommerce order management interface. Simply navigate to the order you wish to refund, click the "Refund" button, and follow the prompts to process the refund.
    6364
    6465Once the WooCommerce processes the refund, the plugin will notify Finix to perform the same action in the Finix system.
     
    9293* PHP version 7.4 or greater
    9394* WordPress 6.7 or greater
    94 * WooCommerce 9.9 or greater
     95* WooCommerce 10.0 or greater
    9596* Finix account
    9697
     
    1011023. Set your Finix API credentials key at WooCommerce -> Settings -> Payments -> Finix Gateway -> Plugin Options (or use the *Settings* link in the Plugins overview).
    1021034. You're done, the active payment methods should be visible on the checkout page of your shop.
    103 5. You can configure payment methods in the Finix "Card and ACH" and "Apple Pay" settings pages.
     1045. You can configure payment methods in the Finix settings pages for each individual Payment Method.
    104105
    105106= Manual installation =
     
    124125
    125126== Changelog ==
     127
     128= 1.4.0 =
     129* Added: Display a lot more relevant order information in the Google Pay payment popup - not just the total amount, but also all the products, discounts/tax/shipping if present.
     130* Changed: If the store currency is set to CAD (Canadian Dollar), the plugin will set "Canada" as a default country in payment forms for both Cards and Bank payment methods.
     131* Changed: If the store currency is set to CAD (Canadian Dollar), the plugin will adjust the address labels accordingly ("Province" and "Postal Code" instead of "Region" and "ZIP", respectively).
     132* Changed: Plugin was tested to be fully compatible with WooCommerce 10.4.
     133* Changed: Plugin was tested to be fully compatible with WordPress 6.9.
     134* Changed: Simplified and improved a lot of labels, descriptions, or error messages throughout the plugin.
     135* Fixed: Do not allow Apple Pay and Google Pay payment methods to be available for customers when the checkout page does not use HTTPS protocol. This is a requirement from Apple and Google.
    126136
    127137= 1.3.0 =
     
    160170* Added: Credit Card payment method, with custom title and description.
    161171* Added: ACH or Bank payment method, with custom title and description.
    162 * Added: Apple Pay payment method - Safari, Chrome and other browsers are supported, with custom title and description.
     172* Added: Apple Pay payment method - Safari, Chrome, and other browsers are supported, with custom title and description.
    163173* Added: Apple Pay button can be configured how it will look on the checkout pages (button type and style).
    164174* Added: Live and Sandbox accounts support for all payment methods.
    165 * Added: Webhooks processing support for payments, refunds, disputes and ACH returns.
     175* Added: Webhooks processing support for payments, refunds, disputes, and ACH returns.
    166176* Added: Disputes support - automatically change the order status when receiving a dispute.
    167177* Added: ACH Returns support - automatically change the order status when receiving a notification about ACH Return.
  • finix-for-woocommerce/trunk/src/Admin/Admin.php

    r3375717 r3418263  
    8181                printf(
    8282                    wp_kses( /* translators: %s - supported currency codes. */
    83                         __( '<strong>All the payments will be declined.</strong> Supported currencies: %s.', 'finix-for-woocommerce' ),
     83                        __( '<strong>All payments will be declined.</strong> Supported currencies: %s.', 'finix-for-woocommerce' ),
    8484                        [
    8585                            'strong' => [],
     
    9696        <?php
    9797    }
     98
     99    /**
     100     * Add a conditional notice about HTTPS requirement for Apple Pay and Google Pay.
     101     */
     102    public function maybe_notify_about_https(): void {
     103
     104        $gateways = WC()->payment_gateways()->payment_gateways();
     105
     106        if (
     107            ! is_ssl() &&
     108            (
     109                $gateways[ ApplePayGateway::SLUG ]->is_available() ||
     110                $gateways[ GooglePayGateway::SLUG ]->is_available()
     111            )
     112        ) {
     113            echo '<div class="notice notice-error">';
     114            echo '<p><strong>' . esc_html__( 'Apple Pay and Google Pay can only run over HTTPS.', 'finix-for-woocommerce' ) . '</strong></p>';
     115            echo '<p>' . esc_html__( 'Please enable SSL (HTTPS) on your website to use them at checkout OR disable these payment methods.', 'finix-for-woocommerce' ) . '</p>';
     116            echo '</div>';
     117        }
     118    }
    98119}
  • finix-for-woocommerce/trunk/src/Events/ApplePayPaymentCompletedEvent.php

    r3375717 r3418263  
    3636        if ( $is_success !== 'true' || empty( $transaction_id ) ) {
    3737            wc_add_notice(
    38                 esc_html__( 'Payment error: There was an error while processing your payment. Please try again.', 'finix-for-woocommerce' ),
     38                esc_html__( 'Payment error: There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    3939                'error'
    4040            );
     
    7171        if ( $transaction_details['status'] !== 200 ) {
    7272            wc_add_notice(
    73                 esc_html__( 'Payment error: There was an error while processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
     73                esc_html__( 'Payment error: There was an error processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
    7474                'error'
    7575            );
     
    8282        if ( empty( $transaction_details['response']->id ) ) {
    8383            wc_add_notice(
    84                 esc_html__( 'Payment error: There was an error while processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
     84                esc_html__( 'Payment error: There was an error processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
    8585                'error'
    8686            );
     
    9393        if ( $transaction_details['response']->state !== 'SUCCEEDED' ) {
    9494            wc_add_notice(
    95                 esc_html__( 'Payment error: There was an error while processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
     95                esc_html__( 'Payment error: There was an error processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
    9696                'error'
    9797            );
     
    105105        if ( (int) $transaction_details['response']->amount !== (int) ( $this->order->get_total() * 100 ) ) {
    106106            wc_add_notice(
    107                 esc_html__( 'Payment error: There was an error while processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
     107                esc_html__( 'Payment error: There was an error processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
    108108                'error'
    109109            );
  • finix-for-woocommerce/trunk/src/Events/ApplePayPaymentEvent.php

    r3316914 r3418263  
    7777            wp_send_json_error(
    7878                [
    79                     'message' => esc_html__( 'There was an error while processing your payment.', 'finix-for-woocommerce' ),
     79                    'message' => esc_html__( 'There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    8080                    'errors'  => wp_json_encode( $buyer['response']->_embedded->errors ),
    8181                ]
  • finix-for-woocommerce/trunk/src/Events/CardAchPaymentEvent.php

    r3375717 r3418263  
    2828        if ( empty( $this->order ) ) {
    2929            wc_add_notice(
    30                 esc_html__( 'Payment error: There was an error while processing your payment. Please try again.', 'finix-for-woocommerce' ),
     30                esc_html__( 'Payment error: There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    3131                'error'
    3232            );
     
    4141        if ( $buyer['status'] !== 201 || ! is_object( $buyer['response'] ) || empty( $buyer['response']->id ) ) {
    4242            wc_add_notice(
    43                 esc_html__( 'Payment error: There was an error while processing your payment. Please try again.', 'finix-for-woocommerce' ),
     43                esc_html__( 'Payment error: There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    4444                'error'
    4545            );
     
    6767        if ( empty( $_POST[ $this->gateway->id . '_token' ] ) ) {
    6868            wc_add_notice(
    69                 esc_html__( 'Payment error: There was an error while processing your payment. Please try again.', 'finix-for-woocommerce' ),
     69                esc_html__( 'Payment error: There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    7070                'error'
    7171            );
     
    9595        ) {
    9696            wc_add_notice(
    97                 esc_html__( 'Payment error: There was an error while processing your payment. Please try again.', 'finix-for-woocommerce' ),
     97                esc_html__( 'Payment error: There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    9898                'error'
    9999            );
     
    134134        if ( $response['status'] !== 201 ) {
    135135            wc_add_notice(
    136                 esc_html__( 'Payment error: There was an error while processing your payment. Please try again.', 'finix-for-woocommerce' ),
     136                esc_html__( 'Payment error: There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    137137                'error'
    138138            );
     
    161161            case 'UNKNOWN':
    162162                wc_add_notice(
    163                     esc_html__( 'Payment pending: There was an error while processing your payment. Please try again.', 'finix-for-woocommerce' ),
     163                    esc_html__( 'Payment pending: There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    164164                    'notice'
    165165                );
     
    189189            default:
    190190                wc_add_notice(
    191                     esc_html__( 'Payment failed: There was an error while processing your payment. Please try again.', 'finix-for-woocommerce' ),
     191                    esc_html__( 'Payment failed: There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    192192                    'error'
    193193                );
  • finix-for-woocommerce/trunk/src/Events/GooglePayPaymentCompletedEvent.php

    r3375717 r3418263  
    3636        if ( $is_success !== 'true' || empty( $transaction_id ) ) {
    3737            wc_add_notice(
    38                 esc_html__( 'Payment error: There was an error while processing your payment. Please try again.', 'finix-for-woocommerce' ),
     38                esc_html__( 'Payment error: There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    3939                'error'
    4040            );
     
    7171        if ( $transaction_details['status'] !== 200 ) {
    7272            wc_add_notice(
    73                 esc_html__( 'Payment error: There was an error while processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
     73                esc_html__( 'Payment error: There was an error processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
    7474                'error'
    7575            );
     
    8282        if ( empty( $transaction_details['response']->id ) ) {
    8383            wc_add_notice(
    84                 esc_html__( 'Payment error: There was an error while processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
     84                esc_html__( 'Payment error: There was an error processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
    8585                'error'
    8686            );
     
    9393        if ( $transaction_details['response']->state !== 'SUCCEEDED' ) {
    9494            wc_add_notice(
    95                 esc_html__( 'Payment error: There was an error while processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
     95                esc_html__( 'Payment error: There was an error processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
    9696                'error'
    9797            );
     
    105105        if ( (int) $transaction_details['response']->amount !== (int) ( $this->order->get_total() * 100 ) ) {
    106106            wc_add_notice(
    107                 esc_html__( 'Payment error: There was an error while processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
     107                esc_html__( 'Payment error: There was an error processing your payment. Please contact support if you were charged.', 'finix-for-woocommerce' ),
    108108                'error'
    109109            );
  • finix-for-woocommerce/trunk/src/Events/GooglePayPaymentEvent.php

    r3316914 r3418263  
    7777            wp_send_json_error(
    7878                [
    79                     'message' => esc_html__( 'There was an error while processing your payment.', 'finix-for-woocommerce' ),
     79                    'message' => esc_html__( 'There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    8080                    'errors'  => wp_json_encode( $buyer['response']->_embedded->errors ),
    8181                ]
  • finix-for-woocommerce/trunk/src/Gateways/ApplePayGateway.php

    r3375717 r3418263  
    33namespace FinixWC\Gateways;
    44
     5use FinixWC\Events\ApplePayPaymentCompletedEvent;
    56use FinixWC\Events\ApplePayPaymentEvent;
     7use FinixWC\Events\ApplePayRegisterDomain;
    68use FinixWC\Events\ApplePaySessionEvent;
    7 use FinixWC\Events\ApplePayPaymentCompletedEvent;
    8 use FinixWC\Events\ApplePayRegisterDomain;
    99use FinixWC\Events\RefundEvent;
    1010use FinixWC\Helpers\Assets;
     11use FinixWC\Helpers\CartData;
    1112use FinixWC\Helpers\Convert;
    12 use FinixWC\Helpers\CartData;
    13 use stdClass;
    1413
    1514/**
     
    8685            'enabled'          => [
    8786                'title'       => __( 'Status', 'finix-for-woocommerce' ),
    88                 'label'       => __( 'Enable Apply Pay Gateway', 'finix-for-woocommerce' ),
     87                'label'       => __( 'Enable Apple Pay Gateway', 'finix-for-woocommerce' ),
    8988                'type'        => 'checkbox',
    9089                'description' => '',
     
    120119                'title'       => __( 'Button Type', 'finix-for-woocommerce' ),
    121120                'type'        => 'select',
    122                 'description' => __( 'Choose the type of the Apple Pay button. This affects wording on a button.', 'finix-for-woocommerce' ),
     121                'description' => __( 'Choose the type of the Apple Pay button. This affects the button text.', 'finix-for-woocommerce' ),
    123122                'options'     => [
    124123                    'plain'      => __( 'Plain', 'finix-for-woocommerce' ),
     
    163162                <h2><?php esc_html_e( 'Apple Pay Payment Method', 'finix-for-woocommerce' ); ?></h2>
    164163                <p>
    165                     <?php esc_html_e( 'Receive payments via Apple Pay with Finix. You can configure the available options on this page.', 'finix-for-woocommerce' ); ?>
     164                    <?php esc_html_e( 'Accept payments via Apple Pay with Finix. You can configure available options on this page.', 'finix-for-woocommerce' ); ?>
    166165                    <br>
    167166                    <?php
     
    384383                'gateway'           => esc_html( $this->id ),
    385384                'billing_data'      => WC()->customer->get_billing(),
    386                 'products'          => $order_details['products'] ?? new stdClass(),
     385                'products'          => $order_details['products'],
    387386                'subtotal'          => $order_details['subtotal'],
    388387                'shipping_amount'   => $order_details['shipping_amount'],
     
    390389                'coupons'           => $order_details['coupons'] ?? [],
    391390                'text'              => [
    392                     'error_processing' => esc_html__( 'There was an error while processing your payment. Please try again later.', 'finix-for-woocommerce' ),
     391                    'error_processing' => esc_html__( 'There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    393392                    'error_billing'    => esc_html__( 'Please enter a valid billing address.', 'finix-for-woocommerce' ),
    394393                    'subtotal'         => esc_html__( 'Subtotal', 'finix-for-woocommerce' ),
     
    440439        if ( empty( $_POST['finix_apple_pay_transaction_id'] ) ) {
    441440            wc_add_notice(
    442                 esc_html__( 'There was an error while processing your payment. Please try again later.', 'finix-for-woocommerce' ),
     441                esc_html__( 'There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    443442                'error'
    444443            );
  • finix-for-woocommerce/trunk/src/Gateways/BankGateway.php

    r3375717 r3418263  
    7373            <div class="links-content">
    7474                <h2><?php esc_html_e( 'Bank Payment Method', 'finix-for-woocommerce' ); ?></h2>
    75                 <p><?php esc_html_e( 'Take bank payments with Finix. You can configure available options on this page.', 'finix-for-woocommerce' ); ?></p>
     75                <p><?php esc_html_e( 'Accept bank payments with Finix. You can configure available options on this page.', 'finix-for-woocommerce' ); ?></p>
    7676            </div>
    7777        </div>
  • finix-for-woocommerce/trunk/src/Gateways/CardBankGateway.php

    r3375717 r3418263  
    99use FinixWC\Events\RefundEvent;
    1010use FinixWC\Helpers\Assets;
     11use FinixWC\Helpers\CartData;
    1112use WP_Error;
    1213
     
    5859        ) {
    5960            wc_add_notice(
    60                 esc_html__( 'There was an error while processing your payment. Please try again later.', 'finix-for-woocommerce' ),
     61                esc_html__( 'There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    6162                'error'
    6263            );
     
    135136        $finix_form_options = apply_filters(
    136137            'finixwc_cardbankgateway_finix_form_params',
    137             [
    138                 'showAddress'       => true,
    139                 'showLabels'        => true,
    140                 'labels'            => [
    141                     'name' => esc_html__( 'Full Name', 'finix-for-woocommerce' ),
    142                 ],
    143                 'showPlaceholders'  => true,
    144                 'placeholders'      => [
    145                     'name' => esc_attr__( 'Full Name', 'finix-for-woocommerce' ),
    146                 ],
    147                 'hideFields'        => [ 'address_line1', 'address_line2', 'address_city', 'address_state' ],
    148                 'requiredFields'    => [ 'name', 'address_country', 'address_postal_code' ],
    149                 'hideErrorMessages' => false,
    150                 'errorMessages'     => [
    151                     'name' => esc_html__( 'Please enter a valid full name', 'finix-for-woocommerce' ),
    152                 ],
    153             ],
     138            CartData::get_finix_form_default_data(),
    154139            $this->id
    155140        );
     
    167152                    'full_name'      => esc_html__( 'Full Name', 'finix-for-woocommerce' ),
    168153                    'error_messages' => [
    169                         'name'         => esc_html__( 'Please enter a valid full name', 'finix-for-woocommerce' ),
    170                         'address_city' => esc_html__( 'Please enter a valid city', 'finix-for-woocommerce' ),
     154                        'name'         => esc_html__( 'Please enter a valid full name.', 'finix-for-woocommerce' ),
     155                        'address_city' => esc_html__( 'Please enter a valid city.', 'finix-for-woocommerce' ),
    171156                    ],
    172157                ],
  • finix-for-woocommerce/trunk/src/Gateways/CardGateway.php

    r3375717 r3418263  
    8282            <div class="links-content">
    8383                <h2><?php esc_html_e( 'Card Payment Method', 'finix-for-woocommerce' ); ?></h2>
    84                 <p><?php esc_html_e( 'Take card payments with Finix. You can configure available options on this page.', 'finix-for-woocommerce' ); ?></p>
     84                <p><?php esc_html_e( 'Accept card payments with Finix. You can configure available options on this page.', 'finix-for-woocommerce' ); ?></p>
    8585            </div>
    8686        </div>
  • finix-for-woocommerce/trunk/src/Gateways/FinixGateway.php

    r3375717 r3418263  
    8989                'title'       => __( 'Custom Source Tag', 'finix-for-woocommerce' ),
    9090                'type'        => 'text',
    91                 'description' => __( 'This tag will be used to identify the source of the payment. It will be used to tag the payment details send to Finix.', 'finix-for-woocommerce' ),
     91                'description' => __( 'This tag will be used to identify the source of the payment. It will be used to tag payment details sent to Finix.', 'finix-for-woocommerce' ),
    9292                'default'     => 'woocommerce',
    9393                'desc_tip'    => true,
     
    104104                'title'       => __( 'Sandbox Application ID', 'finix-for-woocommerce' ),
    105105                'type'        => 'text',
    106                 'description' => __( 'This is the application ID provided on Finix dashboard -> developer menu by selecting sandbox environment', 'finix-for-woocommerce' ),
     106                'description' => __( 'This is the application ID provided in Finix Dashboard > Developer menu by selecting your Sandbox environment', 'finix-for-woocommerce' ),
    107107                'default'     => '',
    108108                'desc_tip'    => true,
     
    141141                'title'       => __( 'Live Application ID', 'finix-for-woocommerce' ),
    142142                'type'        => 'text',
    143                 'description' => __( 'This is the application ID provided on Finix dashboard -> developer menu by selecting live environment', 'finix-for-woocommerce' ),
     143                'description' => __( 'This is the application ID provided in Finix Dashboard > Developer menu by selecting your Live environment', 'finix-for-woocommerce' ),
    144144                'default'     => '',
    145145                'desc_tip'    => true,
     
    179179                'label'       => __( 'Dispute Created', 'finix-for-woocommerce' ),
    180180                'type'        => 'checkbox',
    181                 'description' => __( 'If enabled, the plugin will listen to the dispute.created webhook event and update the order state if a dispute is created.', 'finix-for-woocommerce' ),
     181                'description' => __( 'If enabled, the plugin will listen to the dispute.created webhook event and update the order status if a dispute is created.', 'finix-for-woocommerce' ),
    182182                'default'     => 'yes',
    183183                'desc_tip'    => true,
    184184            ],
    185185            'disputes_order_state'   => [
    186                 'title'       => __( 'Disputes Order State', 'finix-for-woocommerce' ),
     186                'title'       => __( 'Disputes Order Status', 'finix-for-woocommerce' ),
    187187                'type'        => 'select',
    188188                'description' => __( 'Choose an order status when a payment dispute is received.', 'finix-for-woocommerce' ),
     
    195195                'label'       => __( 'ACH Return Created', 'finix-for-woocommerce' ),
    196196                'type'        => 'checkbox',
    197                 'description' => __( 'If enabled, the plugin will listen to ACH returns and update the order state if ACH return is created.', 'finix-for-woocommerce' ),
     197                'description' => __( 'If enabled, the plugin will listen to ACH returns and update the order status if ACH return is created.', 'finix-for-woocommerce' ),
    198198                'default'     => 'yes',
    199199                'desc_tip'    => true,
    200200            ],
    201201            'ach_return_order_state' => [
    202                 'title'       => __( 'ACH Return Order State', 'finix-for-woocommerce' ),
     202                'title'       => __( 'ACH Return Order Status', 'finix-for-woocommerce' ),
    203203                'type'        => 'select',
    204204                'description' => __( 'Choose an order status when an ACH Return is received.', 'finix-for-woocommerce' ),
     
    266266
    267267        <?php finixwc()->admin->maybe_notify_about_unsupported_currency(); ?>
     268
     269        <?php finixwc()->admin->maybe_notify_about_https(); ?>
    268270
    269271        <div class="global-container">
     
    414416
    415417        // phpcs:ignore PluginCheck.CodeAnalysis.ImageFunctions.NonEnqueuedImage
    416         $icon = '<img src="' . esc_url( WC_HTTPS::force_https_url( $this->icon_checkout ) ) . '" alt="' . esc_attr( $this->get_title() ) . '" />';
    417 
    418         /**
    419          * Filter the gateway icon.
     418        return '<img src="' . esc_url( WC_HTTPS::force_https_url( $this->icon_checkout ) ) . '" alt="' . esc_attr( $this->get_title() ) . '" />';
     419    }
     420
     421    /**
     422     * Get the provider links list.
     423     */
     424    public function get_provider_links( $country_code ): array {
     425        /*
     426         * These constants require WooCommerce 10.4.
     427         * Until we drop support for older versions, we will not use them.
    420428         *
    421          * @since 1.5.8
    422          *
    423          * @param string $icon Gateway icon.
    424          * @param string $id   Gateway ID.
    425          *
    426          * @return string
     429         * PaymentsProviders::LINK_TYPE_SUPPORT = 'support';
     430         * PaymentsProviders::LINK_TYPE_DOCS    = 'documentation';
     431         * PaymentsProviders::LINK_TYPE_ABOUT   = 'about';
     432         * PaymentsProviders::LINK_TYPE_TERMS   = 'terms';
     433         * PaymentsProviders::LINK_TYPE_PRICING = 'pricing';
    427434         */
    428         return apply_filters( 'woocommerce_gateway_icon', $icon, $this->id );
     435
     436        return [
     437            [
     438                '_type' => 'about',
     439                'url'   => URL::add_utm( 'https://finix.com/about-finix', 'WooSettingsPayments', 'about', 'link' ),
     440            ],
     441            [
     442                '_type' => 'documentation',
     443                'url'   => URL::add_utm( 'https://docs.finix.com/additional-resources/plugins/woocommerce-plugin', 'WooSettingsPayments', 'docs', 'link' ),
     444            ],
     445            [
     446                '_type' => 'terms',
     447                'url'   => URL::add_utm( 'https://finix.com/terms-and-policies', 'WooSettingsPayments', 'terms', 'link' ),
     448            ],
     449            [
     450                '_type' => 'support',
     451                'url'   => URL::add_utm( 'https://docs.finix.com/guides/getting-started/support-at-finix', 'WooSettingsPayments', 'support', 'link' ),
     452            ],
     453            [
     454                '_type' => 'pricing',
     455                'url'   => URL::add_utm( 'https://finix.com/pricing', 'WooSettingsPayments', 'pricing', 'link' ),
     456            ],
     457        ];
    429458    }
    430459
  • finix-for-woocommerce/trunk/src/Gateways/GooglePayGateway.php

    r3375717 r3418263  
    33namespace FinixWC\Gateways;
    44
     5use FinixWC\Events\GooglePayPaymentCompletedEvent;
    56use FinixWC\Events\GooglePayPaymentEvent;
    6 use FinixWC\Events\GooglePayPaymentCompletedEvent;
    77use FinixWC\Events\RefundEvent;
    88use FinixWC\Helpers\Assets;
     9use FinixWC\Helpers\CartData;
    910use FinixWC\Helpers\Convert;
    1011
     
    107108                'title'       => __( 'Button Color', 'finix-for-woocommerce' ),
    108109                'type'        => 'select',
    109                 'description' => __( 'Choose color for the Google Pay button.', 'finix-for-woocommerce' ),
     110                'description' => __( 'Choose the color for the Google Pay button.', 'finix-for-woocommerce' ),
    110111                'options'     => [
    111                     'default' => __( 'Default Button', 'finix-for-woocommerce' ),
    112                     'black'   => __( 'Black Button', 'finix-for-woocommerce' ),
    113                     'white'   => __( 'White Button', 'finix-for-woocommerce' ),
     112                    'default' => __( 'Default', 'finix-for-woocommerce' ),
     113                    'black'   => __( 'Black', 'finix-for-woocommerce' ),
     114                    'white'   => __( 'White', 'finix-for-woocommerce' ),
    114115                ],
    115116                'default'     => 'default',
     
    121122                'description' => __( 'Choose which type of Google Pay button you want.', 'finix-for-woocommerce' ),
    122123                'options'     => [
    123                     'plain'     => __( 'Plain Button', 'finix-for-woocommerce' ),
    124                     'buy'       => __( 'Buy Button', 'finix-for-woocommerce' ),
    125                     'checkout'  => __( 'Checkout Button', 'finix-for-woocommerce' ),
    126                     'donate'    => __( 'Donate Button', 'finix-for-woocommerce' ),
    127                     'subscribe' => __( 'Subscribe Button', 'finix-for-woocommerce' ),
    128                     'book'      => __( 'Book Button', 'finix-for-woocommerce' ),
    129                     'order'     => __( 'Order Button', 'finix-for-woocommerce' ),
    130                     'pay'       => __( 'Pay Button', 'finix-for-woocommerce' ),
     124                    'plain'     => __( 'Plain', 'finix-for-woocommerce' ),
     125                    'buy'       => __( 'Buy', 'finix-for-woocommerce' ),
     126                    'checkout'  => __( 'Checkout', 'finix-for-woocommerce' ),
     127                    'donate'    => __( 'Donate', 'finix-for-woocommerce' ),
     128                    'subscribe' => __( 'Subscribe', 'finix-for-woocommerce' ),
     129                    'book'      => __( 'Book', 'finix-for-woocommerce' ),
     130                    'order'     => __( 'Order', 'finix-for-woocommerce' ),
     131                    'pay'       => __( 'Pay', 'finix-for-woocommerce' ),
    131132                ],
    132133                'default'     => 'plain',
     
    167168                <h2><?php esc_html_e( 'Google Pay Payment Method', 'finix-for-woocommerce' ); ?></h2>
    168169                <p>
    169                     <?php esc_html_e( 'Receive payments via Google Pay with Finix. You can configure the available options on this page.', 'finix-for-woocommerce' ); ?>
     170                    <?php esc_html_e( 'Accept payments via Google Pay with Finix. You can configure available options on this page.', 'finix-for-woocommerce' ); ?>
    170171                </p>
    171172            </div>
     
    211212                $order_key = sanitize_text_field( wp_unslash( $_GET['key'] ?? '' ) );
    212213                ?>
    213                 <input type="hidden" id="finix_google_pay_order_id" name="finix_google_pay_order_id" value="<?php echo absint( $wp->query_vars['order-pay'] ?? 0 ); ?>">
    214                 <input type="hidden" id="finix_google_pay_order_key" name="finix_google_pay_order_key" value="<?php echo esc_attr( $order_key ); ?>">
     214                <input type="hidden" id="finix_google_pay_order_id" name="finix_google_pay_order_id"
     215                        value="<?php echo absint( $wp->query_vars['order-pay'] ?? 0 ); ?>">
     216                <input type="hidden" id="finix_google_pay_order_key" name="finix_google_pay_order_key"
     217                        value="<?php echo esc_attr( $order_key ); ?>">
    215218            <?php endif; ?>
    216219        </fieldset>
     
    222225     * Enqueue the payment script and styles for shortcode-based checkout.
    223226     */
    224     public function payment_scripts(): void {
     227    public function payment_scripts(): void { // phpcs:ignore Generic.Metrics.CyclomaticComplexity
    225228
    226229        // Only if gateway is enabled.
     
    303306        );
    304307
     308        $is_order_pay_page = false;
     309        $order_id          = 0;
     310
     311        // We might not have a cart over here, so retrieve the data from the current order page.
     312        if ( is_checkout_pay_page() ) {
     313            global $wp;
     314
     315            $order_id = absint( $wp->query_vars['order-pay'] );
     316            $order    = wc_get_order( $order_id );
     317
     318            if ( $order ) {
     319                $order_amount = $order->get_total();
     320            }
     321        } else {
     322            // Get the current cart total as we are most likely on the Checkout page.
     323            $order_amount = (string) WC()->cart->get_total( '' );
     324        }
     325
     326        // Get data for order details.
     327        $order_details = CartData::prepare_order_tracking_details();
     328
    305329        $finix_google_pay_params = [
    306330            'nonce'              => wp_create_nonce( 'get_secret_action' ),
     
    313337            'gateway'            => esc_html( $this->id ),
    314338            'billing_data'       => WC()->customer->get_billing(),
     339            'products'           => $order_details['products'],
     340            'subtotal'           => $order_details['subtotal'],
     341            'shipping_amount'    => $order_details['shipping_amount'],
     342            'tax_amount'         => $order_details['tax_amount'],
     343            'coupons'            => $order_details['coupons'] ?? [],
    315344            'button_color'       => $this->button_color,
    316345            'button_type'        => $this->button_type,
     
    319348            'google_merchant_id' => esc_html( $this->google_merchant_id ),
    320349            'text'               => [
    321                 'error_processing'      => esc_html__( 'There was an error while processing your payment. Please try again later.', 'finix-for-woocommerce' ),
     350                'error_processing'      => esc_html__( 'There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    322351                'error_setting_payment' => esc_html__( 'There was an error processing the payment through Google Pay. Please try a different method or try again later.', 'finix-for-woocommerce' ),
    323                 'error_billing'         => esc_html__( 'Please enter a valid billing details.', 'finix-for-woocommerce' ),
    324                 'error_shipping'        => esc_html__( 'Please enter a valid shipping details.', 'finix-for-woocommerce' ),
     352                'error_billing'         => esc_html__( 'Please enter a valid billing address.', 'finix-for-woocommerce' ),
     353                'error_shipping'        => esc_html__( 'Please enter a valid shipping address.', 'finix-for-woocommerce' ),
    325354                'error_merchant_id'     => esc_html__( 'Missing details for Google Pay. Please contact the store owner.', 'finix-for-woocommerce' ),
     355                'subtotal'              => esc_html__( 'Subtotal', 'finix-for-woocommerce' ),
     356                'shipping'              => esc_html__( 'Shipping', 'finix-for-woocommerce' ),
     357                'tax'                   => esc_html__( 'Tax', 'finix-for-woocommerce' ),
     358                'discount_code'         => esc_html__( 'Discount code:', 'finix-for-woocommerce' ),
     359                'total'                 => esc_html__( 'Total', 'finix-for-woocommerce' ),
    326360            ],
    327361            'url'                => [
     
    381415        if ( empty( $_POST['finix_google_pay_transaction_id'] ) ) {
    382416            wc_add_notice(
    383                 esc_html__( 'There was an error while processing your payment. Please try again later.', 'finix-for-woocommerce' ),
     417                esc_html__( 'There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    384418                'error'
    385419            );
  • finix-for-woocommerce/trunk/src/Gateways/PaymentMethods/ApplePay.php

    r3375717 r3418263  
    55use FinixWC\Gateways\ApplePayGateway;
    66use FinixWC\Helpers\Assets;
     7use FinixWC\Helpers\CartData;
    78use FinixWC\Helpers\Convert;
    8 use FinixWC\Helpers\CartData;
    99
    1010/**
     
    117117                'gateway'           => esc_html( $this->gateway->id ),
    118118                'billing_data'      => WC()->customer->get_billing(),
    119                 'products'          => $order_details['products'] ?? new stdClass(),
     119                'products'          => $order_details['products'],
    120120                'subtotal'          => $order_details['subtotal'],
    121121                'shipping_amount'   => $order_details['shipping_amount'],
     
    123123                'coupons'           => $order_details['coupons'] ?? [],
    124124                'text'              => [
    125                     'error_processing' => esc_html__( 'There was an error while processing your payment. Please try again later.', 'finix-for-woocommerce' ),
     125                    'error_processing' => esc_html__( 'There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    126126                    'error_billing'    => esc_html__( 'Please enter a valid billing address.', 'finix-for-woocommerce' ),
    127127                    'subtotal'         => esc_html__( 'Subtotal', 'finix-for-woocommerce' ),
  • finix-for-woocommerce/trunk/src/Gateways/PaymentMethods/CardBankMethod.php

    r3375717 r3418263  
    44
    55use FinixWC\Helpers\Assets;
     6use FinixWC\Helpers\CartData;
    67
    78/**
     
    9596        return apply_filters(
    9697            'finixwc_cardbankgateway_finix_form_params',
    97             [
    98                 'showAddress'       => true,
    99                 'showLabels'        => true,
    100                 'labels'            => [
    101                     'name' => esc_html__( 'Full Name', 'finix-for-woocommerce' ),
    102                 ],
    103                 'showPlaceholders'  => true,
    104                 'placeholders'      => [
    105                     'name' => esc_attr__( 'Full Name', 'finix-for-woocommerce' ),
    106                 ],
    107                 'hideFields'        => [ 'address_line1', 'address_line2', 'address_city', 'address_state' ],
    108                 'requiredFields'    => [ 'name', 'address_country', 'address_postal_code' ],
    109                 'hideErrorMessages' => false,
    110                 'errorMessages'     => [
    111                     'name' => esc_html__( 'Please enter a valid full name', 'finix-for-woocommerce' ),
    112                 ],
    113             ],
     98            CartData::get_finix_form_default_data(),
    11499            $this->name
    115100        );
  • finix-for-woocommerce/trunk/src/Gateways/PaymentMethods/GooglePay.php

    r3316914 r3418263  
    55use FinixWC\Gateways\GooglePayGateway;
    66use FinixWC\Helpers\Assets;
     7use FinixWC\Helpers\CartData;
    78use FinixWC\Helpers\Convert;
    89
     
    109110        }
    110111
     112        // Get data for order details.
     113        $order_details = CartData::prepare_order_tracking_details();
     114
    111115        wp_localize_script(
    112116            'finix_google_pay_gateway-checkout-block',
     
    122126                'gateway'            => esc_html( $this->gateway->id ),
    123127                'billing_data'       => WC()->customer->get_billing(),
     128                'products'           => $order_details['products'],
     129                'subtotal'           => $order_details['subtotal'],
     130                'shipping_amount'    => $order_details['shipping_amount'],
     131                'tax_amount'         => $order_details['tax_amount'],
     132                'coupons'            => $order_details['coupons'] ?? [],
    124133                'button_color'       => esc_html( $this->gateway->button_color ),
    125134                'button_type'        => esc_html( $this->gateway->button_type ),
     
    128137                'google_merchant_id' => esc_html( $this->gateway->google_merchant_id ),
    129138                'text'               => [
    130                     'error_processing' => esc_html__( 'There was an error while processing your payment. Please try again later.', 'finix-for-woocommerce' ),
     139                    'error_processing' => esc_html__( 'There was an error processing your payment. Please try again later.', 'finix-for-woocommerce' ),
    131140                    'error_billing'    => esc_html__( 'Please enter a valid billing address.', 'finix-for-woocommerce' ),
     141                    'subtotal'         => esc_html__( 'Subtotal', 'finix-for-woocommerce' ),
     142                    'shipping'         => esc_html__( 'Shipping', 'finix-for-woocommerce' ),
     143                    'tax'              => esc_html__( 'Tax', 'finix-for-woocommerce' ),
     144                    'discount_code'    => esc_html__( 'Discount code:', 'finix-for-woocommerce' ),
    132145                ],
    133146                'url'                => [
  • finix-for-woocommerce/trunk/src/Helpers/CartData.php

    r3375717 r3418263  
    116116        ];
    117117    }
     118
     119    /**
     120     * Return the default data for finix form options based on currency.
     121     */
     122    public static function get_finix_form_default_data(): array {
     123
     124        $default_data = [
     125            'showAddress'       => true,
     126            'showLabels'        => true,
     127            'labels'            => [
     128                'name' => esc_html__( 'Full Name', 'finix-for-woocommerce' ),
     129            ],
     130            'showPlaceholders'  => true,
     131            'placeholders'      => [
     132                'name' => esc_attr__( 'Full Name', 'finix-for-woocommerce' ),
     133            ],
     134            'defaultValues'     => [],
     135            'hideFields'        => [ 'address_line1', 'address_line2', 'address_city', 'address_state' ],
     136            'requiredFields'    => [ 'name', 'address_country', 'address_postal_code' ],
     137            'hideErrorMessages' => false,
     138            'errorMessages'     => [
     139                'name' => esc_html__( 'Please enter a valid full name.', 'finix-for-woocommerce' ),
     140            ],
     141        ];
     142
     143        if ( get_woocommerce_currency() === 'CAD' ) {
     144            $default_data['defaultValues']['address_country']    = 'CAN';
     145            $default_data['labels']['address_postal_code']       = esc_html__( 'Postal Code', 'finix-for-woocommerce' );
     146            $default_data['placeholders']['address_postal_code'] = esc_attr__( 'Postal Code', 'finix-for-woocommerce' );
     147            $default_data['labels']['address_region']            = esc_html__( 'Province', 'finix-for-woocommerce' );
     148            $default_data['placeholders']['address_region']      = esc_attr__( 'Province', 'finix-for-woocommerce' );
     149        }
     150
     151        return $default_data;
     152    }
    118153}
  • finix-for-woocommerce/trunk/src/Helpers/URL.php

    r3278388 r3418263  
    1414     * @param string $medium  The page or location description. Example: "plugin_admin".
    1515     * @param string $content The feature's name, the button's content, the link's text. Example: "logo".
     16     * @param string $term    The feature's type. Example: "link", or "image".
    1617     */
    17     public static function add_utm( string $url, string $medium, string $content = '' ): string {
     18    public static function add_utm( string $url, string $medium, string $content = '', string $term = '' ): string {
    1819
    1920        return add_query_arg(
     
    2425                    'utm_medium'   => rawurlencode( $medium ),
    2526                    'utm_content'  => rawurlencode( $content ),
     27                    'utm_term'     => rawurlencode( $term ),
    2628                ]
    2729            ),
  • finix-for-woocommerce/trunk/src/Payments.php

    r3375717 r3418263  
    44
    55use FinixWC\Gateways\CardGateway;
     6use FinixWC\Helpers\CartData;
    67use FinixWC\Helpers\Convert;
    7 use FinixWC\Helpers\CartData;
    88
    99/**
     
    173173            wp_send_json_error(
    174174                [
    175                     'message' => esc_html__( 'Please review and fill all the required information.', 'finix-for-woocommerce' ),
     175                    'message' => esc_html__( 'Please review and fill in all the required information.', 'finix-for-woocommerce' ),
    176176                ]
    177177            );
     
    253253
    254254    /**
    255      * Returns data for order tracking details based on WC.
     255     * Return data for order tracking details based on WC.
    256256     */
    257257    public function get_order_tracking_details(): void {
  • finix-for-woocommerce/trunk/src/Plugin.php

    r3375717 r3418263  
    88use FinixWC\Admin\Admin;
    99use FinixWC\Finix\API;
    10 use FinixWC\Gateways\PaymentMethods\BankMethod;
    11 use FinixWC\Gateways\PaymentMethods\CardMethod;
    12 use FinixWC\Gateways\PaymentMethods\ApplePay;
    13 use FinixWC\Gateways\PaymentMethods\GooglePay;
    1410use FinixWC\Gateways\ApplePayGateway;
    1511use FinixWC\Gateways\BankGateway;
    1612use FinixWC\Gateways\CardGateway;
    1713use FinixWC\Gateways\GooglePayGateway;
     14use FinixWC\Gateways\PaymentMethods\ApplePay;
     15use FinixWC\Gateways\PaymentMethods\BankMethod;
     16use FinixWC\Gateways\PaymentMethods\CardMethod;
     17use FinixWC\Gateways\PaymentMethods\GooglePay;
    1818
    1919/**
     
    100100
    101101        add_action( 'woocommerce_blocks_loaded', [ $this, 'register_payment_method_types' ] );
     102
     103        add_filter( 'woocommerce_available_payment_gateways', [ $this, 'remove_unsupported_methods_on_http' ] );
    102104    }
    103105
     
    170172
    171173    /**
     174     * Remove unsupported payment methods on HTTP (Apple Pay and Google Pay).
     175     */
     176    public function remove_unsupported_methods_on_http( $available_gateways ) {
     177
     178        // If not HTTPS, remove Apple Pay and Google Pay gateways.
     179        if ( ! is_ssl() ) {
     180            unset(
     181                $available_gateways[ ApplePayGateway::SLUG ],
     182                $available_gateways[ GooglePayGateway::SLUG ]
     183            );
     184        }
     185
     186        return $available_gateways;
     187    }
     188
     189    /**
    172190     * Cloning is forbidden.
    173191     */
  • finix-for-woocommerce/trunk/vendor/composer/autoload_static.php

    r3375717 r3418263  
    88{
    99    public static $prefixLengthsPsr4 = array (
    10         'F' => 
     10        'F' =>
    1111        array (
    1212            'FinixWC\\' => 8,
     
    1515
    1616    public static $prefixDirsPsr4 = array (
    17         'FinixWC\\' => 
     17        'FinixWC\\' =>
    1818        array (
    1919            0 => __DIR__ . '/../..' . '/src',
  • finix-for-woocommerce/trunk/vendor/composer/installed.php

    r3375717 r3418263  
    22    'root' => array(
    33        'name' => 'finix-payments/finix-for-woocommerce',
    4         'pretty_version' => '1.3.0',
    5         'version' => '1.3.0.0',
     4        'pretty_version' => '1.4.0',
     5        'version' => '1.4.0.0',
    66        'reference' => null,
    77        'type' => 'library',
     
    1212    'versions' => array(
    1313        'finix-payments/finix-for-woocommerce' => array(
    14             'pretty_version' => '1.3.0',
    15             'version' => '1.3.0.0',
     14            'pretty_version' => '1.4.0',
     15            'version' => '1.4.0.0',
    1616            'reference' => null,
    1717            'type' => 'library',
Note: See TracChangeset for help on using the changeset viewer.