Plugin Directory

Changeset 3267715


Ignore:
Timestamp:
04/07/2025 08:44:58 AM (12 months ago)
Author:
ecommpay
Message:

new version 4.1.0

Location:
ecommpay-payments/trunk
Files:
6 added
5 deleted
57 edited

Legend:

Unmodified
Added
Removed
  • ecommpay-payments/trunk/build/index.asset.php

    r3158829 r3267715  
    1 <?php return array('dependencies' => array('react', 'wp-element', 'wp-html-entities'), 'version' => 'c849c8efab5f9621cc9a');
     1<?php return array('dependencies' => array('react', 'wp-element', 'wp-html-entities'), 'version' => 'af9eb17cb39243c860e1');
  • ecommpay-payments/trunk/build/index.js

    r3158829 r3267715  
    1 (()=>{"use strict";const e=window.React,i=window.wp.htmlEntities,n=window.wp.element;const t=["billing_address","billing_city","billing_country","billing_postal","customer_first_name","customer_last_name","customer_phone","customer_zip","customer_address","customer_city","customer_country","customer_email"],a=function(e){const i={};return Object.keys(e).forEach((n=>{let a;a=t.includes(n)?"BillingInfo["+n+"]":n,"billing_country"===n?i["BillingInfo[country]"]=e[n]:i[a]=e[n]})),i},l=()=>({back:(0,n.useCallback)((()=>{const e=[];e.push({name:"action",value:"ecommpay_break"}),window.ECP.order_id>0&&e.push({name:"order_id",value:window.ECP.order_id}),window.jQuery.ajax({type:"POST",url:window.ECP.ajax_url+"?"+window.location.href.split("?")[1],data:e,dataType:"json",success:function(e){console.log(e)},error:function(e,i,n){console.error(e,i,n)}})}),[])}),s=function(e){const[i,t]=(0,n.useState)(e);return{value:i,setTrue:(0,n.useCallback)((()=>{t(!0)}),[]),setFalse:(0,n.useCallback)((()=>{t(!1)}),[]),toggle:(0,n.useCallback)((()=>{t((e=>!e))}),[])}},r=function(i){const{darkMode:n}=i;return(0,e.createElement)("img",{style:{display:"block"},src:n?"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3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T0icm90YXRlKDI3MCA1MCA1MCkiPgogIDxyZWN0IHg9IjQ4LjUiIHk9IjYiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjYiIGhlaWdodD0iMjUiIGZpbGw9IiMwMDU3OWUiPgogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIxOzAiIGtleVRpbWVzPSIwOzEiIGR1cj0iMXMiIGJlZ2luPSItMC4xMjVzIiByZXBlYXRDb3VudD0iaW5kZWZpbml0ZSI+PC9hbmltYXRlPgogIDwvcmVjdD4KPC9nPjxnIHRyYW5zZm9ybT0icm90YXRlKDMxNSA1MCA1MCkiPgogIDxyZWN0IHg9IjQ4LjUiIHk9IjYiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjYiIGhlaWdodD0iMjUiIGZpbGw9IiMwMDU3OWUiPgogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIxOzAiIGtleVRpbWVzPSIwOzEiIGR1cj0iMXMiIGJlZ2luPSIwcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiPjwvYW5pbWF0ZT4KICA8L3JlY3Q+CjwvZz4KPCEtLSBbbGRpb10gZ2VuZXJhdGVkIGJ5IGh0dHBzOi8vbG9hZGluZy5pby8gLS0+PC9zdmc+",alt:"Loading...",width:34,height:34})},d=function(i){const{show:t}=i,a=function(e,i){const[t,a]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{let n;return e&&!t?a(!0):!e&&t&&(n=setTimeout((()=>a(!1)),i)),()=>clearTimeout(n)}),[e,i,t]),t}(t,300),l=(0,n.useMemo)((()=>{var e;return null!==(e=window.ECP.darkMode)&&void 0!==e?e:window.matchMedia("(prefers-color-scheme: dark)").matches}),[]);return(0,n.useEffect)((()=>(document.body.style.overflow=t?"hidden":"auto",()=>{document.body.style.overflow="auto"})),[t]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("style",null,"\n          @keyframes fade-in {\n            from {\n              opacity: 0;\n            }\n            to {\n              opacity: 1;\n            }\n          }\n        "),a&&(0,e.createElement)("div",{id:"ecommpay-loader-embedded",style:{display:"flex",position:"fixed",top:0,left:0,width:"100%",height:"100%",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"10px",backgroundColor:l?"rgba(0, 0, 0, 0.9)":"rgba(255, 255, 255, 0.9)",opacity:t?1:0,animation:"fade-in 300ms",transition:"opacity 500ms",zIndex:9999}},(0,e.createElement)(r,{darkMode:l})))},o=function(i){const{value:t,setTrue:r,setFalse:o}=s(!1),{value:c,setTrue:I}=s(!1),{value:m,setFalse:g}=s(!0),{back:u}=l(),p=(0,n.useCallback)((e=>{const i=document.createElement("form");i.setAttribute("method",e.method),i.setAttribute("action",e.url),i.setAttribute("style","display:none;"),i.setAttribute("name","3dsForm");for(let n in e.body){const t=document.createElement("input");t.name=n,t.value=e.body[n],i.appendChild(t)}document.body.appendChild(i),i.submit()}),[]),b=(0,n.useCallback)((e=>{if(e.origin!==window.ECP.origin_url)return;const i=JSON.parse(e.data);switch(i.message){case"epframe.show_clarification_page":return window.ECP.listeners.onShowClarificationPage();case"epframe.embedded_mode.check_validation_response":return window.ECP.listeners.onEmbeddedModeCheckValidationResponse(i);case"epframe.payment.success":case"epframe.card.verify.success":return window.ECP.listeners.onSuccess();case"epframe.payment.fail":case"epframe.card.verify.fail":return window.ECP.listeners.onFail()}}),[]),y=(0,n.useCallback)((e=>new Promise((n=>{window.ECP.listeners={onShowClarificationPage:()=>{I(),o(),n({type:i.emitResponse.responseTypes.ERROR,messageContext:i.emitResponse.noticeContexts.PAYMENTS,message:"Clarification required"})},onEmbeddedModeCheckValidationResponse:t=>{if(l='[for="radio-control-wc-payment-method-options-ecommpay-card"]',document.querySelector(l)?.scrollIntoView({behavior:"smooth"}),0===Object.keys(t.data).length)window.postMessage(JSON.stringify({message:"epframe.embedded_mode.submit",fields:a(e),from_another_domain:!0}));else{const e=Array.from(new Set(Object.values(t.data)));n({type:i.emitResponse.responseTypes.ERROR,messageContext:i.emitResponse.noticeContexts.PAYMENTS,message:"<b>Validation failed:</b> <ul><li>"+e.join("</li><li>")+"</li></ul>",retry:!0})}var l},onSuccess:()=>{o(),n({type:i.emitResponse.responseTypes.SUCCESS,redirectUrl:e.redirect_success_url})},onFail:()=>{o(),n({type:i.emitResponse.responseTypes.FAIL,messageContext:i.emitResponse.noticeContexts.PAYMENTS,message:"Payment failed"})}},setTimeout((()=>{window.postMessage(JSON.stringify({message:"epframe.embedded_mode.check_validation",from_another_domain:!0}))}),2e3)}))),[]),w=function(i,n,t){var a=this,l=(0,e.useRef)(null),s=(0,e.useRef)(0),r=(0,e.useRef)(null),d=(0,e.useRef)([]),o=(0,e.useRef)(),c=(0,e.useRef)(),I=(0,e.useRef)(i),m=(0,e.useRef)(!0);I.current=i;var g="undefined"!=typeof window,u=!n&&0!==n&&g;if("function"!=typeof i)throw new TypeError("Expected a function");n=+n||0;var p=!!(t=t||{}).leading,b=!("trailing"in t)||!!t.trailing,y="maxWait"in t,w="debounceOnServer"in t&&!!t.debounceOnServer,P=y?Math.max(+t.maxWait||0,n):null;(0,e.useEffect)((function(){return m.current=!0,function(){m.current=!1}}),[]);var Z=(0,e.useMemo)((function(){var e=function(e){var i=d.current,n=o.current;return d.current=o.current=null,s.current=e,c.current=I.current.apply(n,i)},i=function(e,i){u&&cancelAnimationFrame(r.current),r.current=u?requestAnimationFrame(e):setTimeout(e,i)},t=function(e){if(!m.current)return!1;var i=e-l.current;return!l.current||i>=n||i<0||y&&e-s.current>=P},Z=function(i){return r.current=null,b&&d.current?e(i):(d.current=o.current=null,c.current)},C=function e(){var a=Date.now();if(t(a))return Z(a);if(m.current){var r=n-(a-l.current),d=y?Math.min(r,P-(a-s.current)):r;i(e,d)}},h=function(){if(g||w){var I=Date.now(),u=t(I);if(d.current=[].slice.call(arguments),o.current=a,l.current=I,u){if(!r.current&&m.current)return s.current=l.current,i(C,n),p?e(l.current):c.current;if(y)return i(C,n),e(l.current)}return r.current||i(C,n),c.current}};return h.cancel=function(){r.current&&(u?cancelAnimationFrame(r.current):clearTimeout(r.current)),s.current=0,d.current=l.current=o.current=r.current=null},h.isPending=function(){return!!r.current},h.flush=function(){return r.current?Z(Date.now()):c.current},h}),[p,y,n,P,b,u,g,w]);return Z}((()=>{const e=[{name:"action",value:"get_data_for_payment_form"}];window.ECP.order_id>0&&e.push({name:"order_id",value:window.ECP.order_id}),window.jQuery.ajax({type:"POST",url:window.ECP.ajax_url+"?"+window.location.href.split("?")[1],data:e,dataType:"json",success:function(e){window.ECP={...window.ECP,isEmbeddedMode:!0,paramsForEmbeddedPP:{...e,onExit:u,onDestroy:u,onLoaded:g,onEnterKeyPressed:i.onSubmit,onPaymentSent:r,onSubmitClarificationForm:r,onEmbeddedModeRedirect3dsParentPage:p}},window.EPayWidget.run(window.ECP.paramsForEmbeddedPP,"POST")},error:function(e,i,n){console.error(e,i,n)}})}),2e3);return(0,n.useEffect)((()=>{const e=i.eventRegistration.onPaymentSetup((async()=>{if(!c)return{type:i.emitResponse.responseTypes.SUCCESS,meta:{paymentMethodData:{payment_id:window.ECP.paramsForEmbeddedPP.payment_id}}};window.postMessage(JSON.stringify({message:"epframe.embedded_mode.submit",fields:{},from_another_domain:!0}))}),0),n=i.eventRegistration.onCheckoutSuccess((async e=>{window.ECP.order_id=e.orderId;const n=JSON.parse(e.processingResponse.paymentDetails.optionsJson),t=n.payment_amount,a=i.billing.currency.minorUnit-(["BIF","CLP","DJF","GNF","ISK","JPY","KMF","KRW","PYG","RWF","UGX","UYI","VND","VUV","XAF","XOF","XPF"].includes(i.billing.currency.code)?0:2),l=t===Math.round(i.billing.cartTotal.value/Math.pow(10,a)),s=i.billing.currency.code===n.payment_currency;return l&&s?await y(n):{type:i.emitResponse.responseTypes.ERROR,messageContext:i.emitResponse.noticeContexts.CHECKOUT,message:"Cart amount has changed, please refresh the page and try again"}}),0);return()=>{e(),n()}}),[i.eventRegistration.onCheckoutSuccess]),(0,n.useEffect)((()=>{w()}),[i.billing.appliedCoupons,i.billing.billingAddress.address_1,i.billing.billingAddress.address_2,i.billing.billingAddress.city,i.billing.billingAddress.company,i.billing.billingAddress.country,i.billing.billingAddress.email,i.billing.billingAddress.first_name,i.billing.billingAddress.last_name,i.billing.billingAddress.phone,i.billing.billingAddress.postcode,i.billing.billingAddress.state,i.billing.billingData.address_1,i.billing.billingData.address_2,i.billing.billingData.city,i.billing.billingData.company,i.billing.billingData.country,i.billing.billingData.email,i.billing.billingData.first_name,i.billing.billingData.last_name,i.billing.billingData.phone,i.billing.billingData.postcode,i.billing.billingData.state,i.billing.cartTotal.label,i.billing.cartTotal.value,i.billing.cartTotalItems,i.billing.currency.code,i.billing.currency.decimalSeparator,i.billing.currency.minorUnit,i.billing.currency.prefix,i.billing.currency.suffix,i.billing.currency.symbol,i.billing.currency.thousandSeparator,i.billing.customerId,i.billing.displayPricesIncludingTax,i.shippingData.isSelectingRate,i.shippingData.needsShipping,i.shippingData.selectedRates,i.shippingData.shippingAddress.address_1,i.shippingData.shippingAddress.address_2,i.shippingData.shippingAddress.city,i.shippingData.shippingAddress.company,i.shippingData.shippingAddress.country,i.shippingData.shippingAddress.first_name,i.shippingData.shippingAddress.last_name,i.shippingData.shippingAddress.phone,i.shippingData.shippingAddress.postcode,i.shippingData.shippingAddress.state,i.shippingData.shippingRates,i.shippingData.shippingRatesLoading,i.cartData.cartFees,i.cartData.cartItems,i.cartData.extensions,i.shouldSavePayment]),(0,n.useEffect)((()=>(window.ECP.listeners={},window.addEventListener("message",b),()=>{window.removeEventListener("message",b),window.ECP.listeners={}})),[b]),(0,e.createElement)(e.Fragment,null,m&&"Loading...",(0,e.createElement)("div",{id:"ecommpay-iframe-embedded",style:{height:m?"0":"auto"}}),(0,e.createElement)(d,{show:t}))},c=function(e){const{back:i}=l(),t=(0,n.useCallback)((n=>new Promise((t=>{window.EPayWidget.run({...n,onPaymentSuccess:()=>{t({type:e.emitResponse.responseTypes.SUCCESS,redirectUrl:""})},onPaymentFail:()=>{t({type:e.emitResponse.responseTypes.ERROR,messageContext:e.emitResponse.noticeContexts.PAYMENTS,message:"Payment failed",retry:!0})},onExit:()=>{i(),t({type:e.emitResponse.responseTypes.ERROR,messageContext:e.emitResponse.noticeContexts.CHECKOUT_ACTIONS,message:"Payment cancelled",retry:!0})},onDestroy:()=>{i(),t({type:e.emitResponse.responseTypes.ERROR,messageContext:e.emitResponse.noticeContexts.CHECKOUT_ACTIONS,message:"Payment cancelled",retry:!0})}},"POST")}))),[i]);return(0,n.useEffect)((()=>{const i=e.eventRegistration.onCheckoutSuccess((async e=>{window.ECP.order_id=e.orderId;const i=JSON.parse(e.processingResponse.paymentDetails.optionsJson);return await t(i)}),0);return()=>{i()}}),[e.eventRegistration.onCheckoutSuccess,t]),e.children},I=function(t){const a=(0,n.useMemo)((()=>(0,i.decodeEntities)(t.data.description)),[t.data.description]);return(0,n.useMemo)((()=>"embedded"===t.data.pp_mode&&"ecommpay-card"===t.activePaymentMethod?(0,e.createElement)(o,{...t}):"popup"===t.data.pp_mode?(0,e.createElement)(c,{...t},a):a),[t])},m=function(n){return(0,e.createElement)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"10px"}},(0,i.decodeEntities)(n.data.title),n.data.icon&&(0,e.createElement)("img",{src:n.data.icon,alt:""}))},{getSetting:g}=window.wc.wcSettings,{registerPaymentMethod:u}=window.wc.wcBlocksRegistry,p=n=>{const t=g(`${n}_data`,null);if(!t)return;const a={name:n,label:(0,e.createElement)(m,{data:t}),content:(0,e.createElement)(I,{data:t}),edit:(0,e.createElement)(I,{data:t}),canMakePayment:()=>"ecommpay-apple-pay"!==n||Object.prototype.hasOwnProperty.call(window,"ApplePaySession")&&ApplePaySession.canMakePayments(),placeOrderButtonLabel:t.checkout_button_text,ariaLabel:(0,i.decodeEntities)(t.title),supports:{showSavedCards:!1,showSaveOption:!1,features:t.supports}};u(a)};for(const e of window.ECP.gateways)p(e)})();
     1(()=>{"use strict";const e=window.React,i=window.wp.htmlEntities,n=window.wp.element;const t=["billing_address","billing_city","billing_country","billing_postal","customer_first_name","customer_last_name","customer_phone","customer_zip","customer_address","customer_city","customer_country","customer_email"],a=function(e){const i={};return Object.keys(e).forEach((n=>{let a;a=t.includes(n)?"BillingInfo["+n+"]":n,"billing_country"===n?i["BillingInfo[country]"]=e[n]:i[a]=e[n]})),i},l=()=>({back:(0,n.useCallback)((()=>{const e=[];e.push({name:"action",value:"ecommpay_break"}),window.ECP.order_id>0&&e.push({name:"order_id",value:window.ECP.order_id}),window.jQuery.ajax({type:"POST",url:window.ECP.ajax_url+"?"+window.location.href.split("?")[1],data:e,dataType:"json",success:function(e){console.log(e)},error:function(e,i,n){console.error(e,i,n)}})}),[])}),s=function(e){const[i,t]=(0,n.useState)(e);return{value:i,setTrue:(0,n.useCallback)((()=>{t(!0)}),[]),setFalse:(0,n.useCallback)((()=>{t(!1)}),[]),toggle:(0,n.useCallback)((()=>{t((e=>!e))}),[])}},r=function(i){const{darkMode:n}=i;return(0,e.createElement)("img",{style:{display:"block"},src:n?"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBzdHlsZT0ibWFyZ2luOiBhdXRvOyBkaXNwbGF5OiBibG9jazsgc2hhcGUtcmVuZGVyaW5nOiBhdXRvOyIgd2lkdGg9IjM0cHgiIGhlaWdodD0iMzRweCIgdmlld0JveD0iMCAwIDEwMCAxMDAiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj4KPGcgdHJhbnNmb3JtPSJyb3RhdGUoMCA1MCA1MCkiPgogIDxyZWN0IHg9IjQ4LjUiIHk9IjYiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjYiIGhlaWdodD0iMjUiIGZpbGw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SA1MCA1MCkiPgogIDxyZWN0IHg9IjQ4LjUiIHk9IjYiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjYiIGhlaWdodD0iMjUiIGZpbGw9IiMwMDU3OWUiPgogICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIxOzAiIGtleVRpbWVzPSIwOzEiIGR1cj0iMXMiIGJlZ2luPSIwcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiPjwvYW5pbWF0ZT4KICA8L3JlY3Q+CjwvZz4KPCEtLSBbbGRpb10gZ2VuZXJhdGVkIGJ5IGh0dHBzOi8vbG9hZGluZy5pby8gLS0+PC9zdmc+",alt:"Loading...",width:34,height:34})},d=function(i){const{show:t}=i,a=function(e,i){const[t,a]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{let n;return e&&!t?a(!0):!e&&t&&(n=setTimeout((()=>a(!1)),i)),()=>clearTimeout(n)}),[e,i,t]),t}(t,300),l=(0,n.useMemo)((()=>{var e;return null!==(e=window.ECP.darkMode)&&void 0!==e?e:window.matchMedia("(prefers-color-scheme: dark)").matches}),[]);return(0,n.useEffect)((()=>(document.body.style.overflow=t?"hidden":"auto",()=>{document.body.style.overflow="auto"})),[t]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)("style",null,"\n          @keyframes fade-in {\n            from {\n              opacity: 0;\n            }\n            to {\n              opacity: 1;\n            }\n          }\n        "),a&&(0,e.createElement)("div",{id:"ecommpay-loader-embedded",style:{display:"flex",position:"fixed",top:0,left:0,width:"100%",height:"100%",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"10px",backgroundColor:l?"rgba(0, 0, 0, 0.9)":"rgba(255, 255, 255, 0.9)",opacity:t?1:0,animation:"fade-in 300ms",transition:"opacity 500ms",zIndex:9999}},(0,e.createElement)(r,{darkMode:l})))},o=function(i){const{value:t,setTrue:r,setFalse:o}=s(!1),{value:c,setTrue:I}=s(!1),{value:m,setFalse:g}=s(!0),{back:u}=l(),p=(0,n.useCallback)((e=>{const i=document.createElement("form");i.setAttribute("method",e.method),i.setAttribute("action",e.url),i.setAttribute("style","display:none;"),i.setAttribute("name","3dsForm");for(let n in e.body){const t=document.createElement("input");t.name=n,t.value=e.body[n],i.appendChild(t)}document.body.appendChild(i),i.submit()}),[]),b=(0,n.useCallback)((e=>{if(e.origin!==window.ECP.origin_url)return;const i=JSON.parse(e.data);switch(i.message){case"epframe.show_clarification_page":return window.ECP.listeners.onShowClarificationPage();case"epframe.embedded_mode.check_validation_response":return window.ECP.listeners.onEmbeddedModeCheckValidationResponse(i);case"epframe.payment.success":case"epframe.card.verify.success":return window.ECP.listeners.onSuccess();case"epframe.payment.fail":case"epframe.card.verify.fail":return window.ECP.listeners.onFail()}}),[]),y=(0,n.useCallback)((e=>new Promise((n=>{window.ECP.listeners={onShowClarificationPage:()=>{I(),o(),n({type:i.emitResponse.responseTypes.ERROR,messageContext:i.emitResponse.noticeContexts.PAYMENTS,message:"Clarification required"})},onEmbeddedModeCheckValidationResponse:t=>{if(l='[for="radio-control-wc-payment-method-options-ecommpay-card"]',document.querySelector(l)?.scrollIntoView({behavior:"smooth"}),0===Object.keys(t.data).length)window.postMessage(JSON.stringify({message:"epframe.embedded_mode.submit",fields:a(e),from_another_domain:!0}));else{const e=Array.from(new Set(Object.values(t.data)));n({type:i.emitResponse.responseTypes.ERROR,messageContext:i.emitResponse.noticeContexts.PAYMENTS,message:"<b>Validation failed:</b> <ul><li>"+e.join("</li><li>")+"</li></ul>",retry:!0})}var l},onSuccess:()=>{o(),n({type:i.emitResponse.responseTypes.SUCCESS,redirectUrl:e.redirect_success_url})},onFail:()=>{o(),w(),n({type:i.emitResponse.responseTypes.FAIL,messageContext:i.emitResponse.noticeContexts.PAYMENTS,message:"Payment failed"})}},setTimeout((()=>{window.postMessage(JSON.stringify({message:"epframe.embedded_mode.check_validation",from_another_domain:!0}))}),2e3)}))),[]),w=function(i,n,t){var a=this,l=(0,e.useRef)(null),s=(0,e.useRef)(0),r=(0,e.useRef)(null),d=(0,e.useRef)([]),o=(0,e.useRef)(),c=(0,e.useRef)(),I=(0,e.useRef)(i),m=(0,e.useRef)(!0);I.current=i;var g="undefined"!=typeof window,u=!n&&0!==n&&g;if("function"!=typeof i)throw new TypeError("Expected a function");n=+n||0;var p=!!(t=t||{}).leading,b=!("trailing"in t)||!!t.trailing,y="maxWait"in t,w="debounceOnServer"in t&&!!t.debounceOnServer,P=y?Math.max(+t.maxWait||0,n):null;(0,e.useEffect)((function(){return m.current=!0,function(){m.current=!1}}),[]);var Z=(0,e.useMemo)((function(){var e=function(e){var i=d.current,n=o.current;return d.current=o.current=null,s.current=e,c.current=I.current.apply(n,i)},i=function(e,i){u&&cancelAnimationFrame(r.current),r.current=u?requestAnimationFrame(e):setTimeout(e,i)},t=function(e){if(!m.current)return!1;var i=e-l.current;return!l.current||i>=n||i<0||y&&e-s.current>=P},Z=function(i){return r.current=null,b&&d.current?e(i):(d.current=o.current=null,c.current)},C=function e(){var a=Date.now();if(t(a))return Z(a);if(m.current){var r=n-(a-l.current),d=y?Math.min(r,P-(a-s.current)):r;i(e,d)}},h=function(){if(g||w){var I=Date.now(),u=t(I);if(d.current=[].slice.call(arguments),o.current=a,l.current=I,u){if(!r.current&&m.current)return s.current=l.current,i(C,n),p?e(l.current):c.current;if(y)return i(C,n),e(l.current)}return r.current||i(C,n),c.current}};return h.cancel=function(){r.current&&(u?cancelAnimationFrame(r.current):clearTimeout(r.current)),s.current=0,d.current=l.current=o.current=r.current=null},h.isPending=function(){return!!r.current},h.flush=function(){return r.current?Z(Date.now()):c.current},h}),[p,y,n,P,b,u,g,w]);return Z}((()=>{const e=[{name:"action",value:"get_data_for_payment_form"}];window.ECP.order_id>0&&e.push({name:"order_id",value:window.ECP.order_id}),window.jQuery.ajax({type:"POST",url:window.ECP.ajax_url+"?"+window.location.href.split("?")[1],data:e,dataType:"json",success:function(e){window.ECP={...window.ECP,isEmbeddedMode:!0,paramsForEmbeddedPP:{...e,onExit:u,onDestroy:u,onLoaded:g,onEnterKeyPressed:i.onSubmit,onPaymentSent:r,onSubmitClarificationForm:r,onEmbeddedModeRedirect3dsParentPage:p}},window.EPayWidget.run(window.ECP.paramsForEmbeddedPP,"POST")},error:function(e,i,n){console.error(e,i,n)}})}),2e3);return(0,n.useEffect)((()=>{const e=i.eventRegistration.onPaymentSetup((async()=>{if(!c)return{type:i.emitResponse.responseTypes.SUCCESS,meta:{paymentMethodData:{payment_id:window.ECP.paramsForEmbeddedPP.payment_id}}};window.postMessage(JSON.stringify({message:"epframe.embedded_mode.submit",fields:{},from_another_domain:!0}))}),0),n=i.eventRegistration.onCheckoutSuccess((async e=>{window.ECP.order_id=e.orderId;const n=JSON.parse(e.processingResponse.paymentDetails.optionsJson),t=n.payment_amount,a=i.billing.currency.minorUnit-(["BIF","CLP","DJF","GNF","ISK","JPY","KMF","KRW","PYG","RWF","UGX","UYI","VND","VUV","XAF","XOF","XPF"].includes(i.billing.currency.code)?0:2),l=t===Math.round(i.billing.cartTotal.value/Math.pow(10,a)),s=i.billing.currency.code===n.payment_currency;return l&&s?await y(n):{type:i.emitResponse.responseTypes.ERROR,messageContext:i.emitResponse.noticeContexts.CHECKOUT,message:"Cart amount has changed, please refresh the page and try again"}}),0);return()=>{e(),n()}}),[i.eventRegistration.onCheckoutSuccess]),(0,n.useEffect)((()=>{w()}),[i.billing.appliedCoupons,i.billing.billingAddress.address_1,i.billing.billingAddress.address_2,i.billing.billingAddress.city,i.billing.billingAddress.company,i.billing.billingAddress.country,i.billing.billingAddress.email,i.billing.billingAddress.first_name,i.billing.billingAddress.last_name,i.billing.billingAddress.phone,i.billing.billingAddress.postcode,i.billing.billingAddress.state,i.billing.billingData.address_1,i.billing.billingData.address_2,i.billing.billingData.city,i.billing.billingData.company,i.billing.billingData.country,i.billing.billingData.email,i.billing.billingData.first_name,i.billing.billingData.last_name,i.billing.billingData.phone,i.billing.billingData.postcode,i.billing.billingData.state,i.billing.cartTotal.label,i.billing.cartTotal.value,i.billing.cartTotalItems,i.billing.currency.code,i.billing.currency.decimalSeparator,i.billing.currency.minorUnit,i.billing.currency.prefix,i.billing.currency.suffix,i.billing.currency.symbol,i.billing.currency.thousandSeparator,i.billing.customerId,i.billing.displayPricesIncludingTax,i.shippingData.isSelectingRate,i.shippingData.needsShipping,i.shippingData.selectedRates,i.shippingData.shippingAddress.address_1,i.shippingData.shippingAddress.address_2,i.shippingData.shippingAddress.city,i.shippingData.shippingAddress.company,i.shippingData.shippingAddress.country,i.shippingData.shippingAddress.first_name,i.shippingData.shippingAddress.last_name,i.shippingData.shippingAddress.phone,i.shippingData.shippingAddress.postcode,i.shippingData.shippingAddress.state,i.shippingData.shippingRates,i.shippingData.shippingRatesLoading,i.cartData.cartFees,i.cartData.cartItems,i.cartData.extensions,i.shouldSavePayment]),(0,n.useEffect)((()=>(window.ECP.listeners={},window.addEventListener("message",b),()=>{window.removeEventListener("message",b),window.ECP.listeners={}})),[b]),(0,e.createElement)(e.Fragment,null,m&&"Loading...",(0,e.createElement)("div",{id:"ecommpay-iframe-embedded",style:{height:m?"0":"auto"}}),(0,e.createElement)(d,{show:t}))},c=function(e){const{back:i}=l(),t=(0,n.useCallback)((n=>new Promise((t=>{window.EPayWidget.run({...n,onPaymentSuccess:()=>{t({type:e.emitResponse.responseTypes.SUCCESS,redirectUrl:""})},onPaymentFail:()=>{t({type:e.emitResponse.responseTypes.ERROR,messageContext:e.emitResponse.noticeContexts.PAYMENTS,message:"Payment was declined. You can try another payment method.",retry:!0})},onExit:()=>{i(),t({type:e.emitResponse.responseTypes.ERROR,messageContext:e.emitResponse.noticeContexts.CHECKOUT_ACTIONS,message:"Payment cancelled",retry:!0})},onDestroy:()=>{i(),t({type:e.emitResponse.responseTypes.ERROR,messageContext:e.emitResponse.noticeContexts.CHECKOUT_ACTIONS,message:"Payment cancelled",retry:!0})}},"POST")}))),[i]);return(0,n.useEffect)((()=>{const i=e.eventRegistration.onCheckoutSuccess((async e=>{window.ECP.order_id=e.orderId;const i=JSON.parse(e.processingResponse.paymentDetails.optionsJson);return await t(i)}),0);return()=>{i()}}),[e.eventRegistration.onCheckoutSuccess,t]),e.children},I=function(t){const a=(0,n.useMemo)((()=>(0,i.decodeEntities)(t.data.description)),[t.data.description]);return(0,n.useMemo)((()=>"embedded"===t.data.pp_mode&&"ecommpay-card"===t.activePaymentMethod?(0,e.createElement)(o,{...t}):"popup"===t.data.pp_mode?(0,e.createElement)(c,{...t},a):a),[t])},m=function(n){return(0,e.createElement)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"10px"}},(0,i.decodeEntities)(n.data.title),n.data.icon&&(0,e.createElement)("img",{src:n.data.icon,alt:""}))},{getSetting:g}=window.wc.wcSettings,{registerPaymentMethod:u}=window.wc.wcBlocksRegistry,p=n=>{const t=g(`${n}_data`,null);if(!t)return;const a={name:n,label:(0,e.createElement)(m,{data:t}),content:(0,e.createElement)(I,{data:t}),edit:(0,e.createElement)(I,{data:t}),canMakePayment:()=>"ecommpay-apple-pay"!==n||Object.prototype.hasOwnProperty.call(window,"ApplePaySession")&&ApplePaySession.canMakePayments(),placeOrderButtonLabel:t.checkout_button_text,ariaLabel:(0,i.decodeEntities)(t.title),supports:{showSavedCards:!1,showSaveOption:!1,features:t.supports}};u(a)};for(const e of window.ECP.gateways)p(e)})();
  • ecommpay-payments/trunk/common/EcpCore.php

    r3245713 r3267715  
    6363     * @since 2.0.0
    6464     */
    65     public const WC_ECP_VERSION = '4.0.4';
     65    public const WC_ECP_VERSION = '4.1.0';
    6666
    6767    public const ECOMMPAY_PAYMENT_METHOD = 'ecommpay';
     
    160160
    161161        add_filter(
    162             includes\filters\EcpFiltersList::FILTER_ACTION_LINKS,
     162            includes\filters\EcpFilters::FILTER_ACTION_LINKS,
    163163            [ $this, 'add_action_links' ]
    164164        );
  • ecommpay-payments/trunk/common/api/EcpGatewayAPIPayment.php

    r3218798 r3267715  
    77use common\includes\EcpGatewayOrder;
    88use common\includes\EcpGatewayRefund;
    9 use common\includes\filters\EcpAppendsFilterList;
     9use common\includes\filters\EcpAppendsFilters;
    1010use common\models\EcpGatewayInfoResponse;
    1111use common\models\EcpGatewayInfoStatus;
     
    6565            $this->post(
    6666                self::STATUS_API_ENDPOINT,
    67                 apply_filters( EcpAppendsFilterList::ECP_APPEND_SIGNATURE, $this->create_status_request_form_data( $order ) )
     67                apply_filters( EcpAppendsFilters::ECP_APPEND_SIGNATURE, $this->create_status_request_form_data( $order ) )
    6868            )
    6969        );
     
    126126                'refund'
    127127            ),
    128             apply_filters( EcpAppendsFilterList::ECP_APPEND_SIGNATURE, $data )
     128            apply_filters( EcpAppendsFilters::ECP_APPEND_SIGNATURE, $data )
    129129        );
    130130
     
    150150            apply_filters(
    151151                'ecp_append_merchant_callback_url',
    152                 apply_filters( 'ecp_create_payment_data', $order )
     152                apply_filters( 'ecp_create_payment_data', $refund )
    153153            )
    154154        );
     
    163163        $data     = $this->create_general_request_form_data( $order );
    164164        $url = $this->getMethodEndpoint( $order->get_payment_method(), EcpGatewayAPI::CANCEL_ENDPOINT );
    165         $response = $this->post( $url, apply_filters( EcpAppendsFilterList::ECP_APPEND_SIGNATURE, $data ) );
     165        $response = $this->post( $url, apply_filters( EcpAppendsFilters::ECP_APPEND_SIGNATURE, $data ) );
    166166        $response = new EcpGatewayInfoResponse( $response );
    167167        $order->set_transaction_order_id( $response->get_request_id(), EcpGatewayOperationType::CANCEL );
     
    207207        $data     = $this->create_general_request_form_data( $order );
    208208        $url = $this->getMethodEndpoint( $order->get_payment_method(), EcpGatewayAPI::CAPTURE_ENDPOINT );
    209         $response = $this->post( $url, apply_filters( EcpAppendsFilterList::ECP_APPEND_SIGNATURE, $data ) );
     209        $response = $this->post( $url, apply_filters( EcpAppendsFilters::ECP_APPEND_SIGNATURE, $data ) );
    210210        $response = new EcpGatewayInfoResponse( $response );
    211211        $order->set_transaction_order_id( $response->get_request_id(), self::CAPTURE_OPERATION );
  • ecommpay-payments/trunk/common/api/EcpGatewayAPISubscription.php

    r3218798 r3267715  
    66use common\helpers\EcpGatewayPaymentMethods;
    77use common\includes\EcpGatewayOrder;
    8 use common\includes\filters\EcpApiFilterList;
    9 use common\includes\filters\EcpAppendsFilterList;
    10 use common\includes\filters\EcpFiltersList;
     8use common\includes\filters\EcpApiFilters;
     9use common\includes\filters\EcpAppendsFilters;
     10use common\includes\filters\EcpFilters;
    1111use common\models\EcpGatewayInfoResponse;
    1212use WC_Subscriptions_Order;
     
    7878
    7979        // Create form data
    80         $data = apply_filters( EcpApiFilterList::ECP_API_RECURRING_FORM_DATA, $subscription_id, $order );
     80        $data = apply_filters( EcpApiFilters::ECP_API_RECURRING_FORM_DATA, $subscription_id, $order );
    8181
    8282        // Run request
     
    8484            $this->post(
    8585                sprintf( '%s/%s', $payment_method, 'recurring' ),
    86                 apply_filters( EcpAppendsFilterList::ECP_APPEND_SIGNATURE, $data )
     86                apply_filters( EcpAppendsFilters::ECP_APPEND_SIGNATURE, $data )
    8787            )
    8888        );
     
    106106
    107107        // Create form data
    108         $data = apply_filters( EcpFiltersList::ECP_CREATE_GENERAL_DATA, $request_id );
     108        $data = apply_filters( EcpFilters::ECP_CREATE_GENERAL_DATA, $request_id );
    109109
    110110        // Run request
     
    112112            $this->post(
    113113                'status/request',
    114                 apply_filters( EcpAppendsFilterList::ECP_APPEND_SIGNATURE, $data )
     114                apply_filters( EcpAppendsFilters::ECP_APPEND_SIGNATURE, $data )
    115115            )
    116116        );
     
    153153        $data = $this->create_general_section(
    154154            apply_filters(
    155                 EcpAppendsFilterList::ECP_APPEND_MERCHANT_CALLBACK_URL,
    156                 apply_filters( EcpFiltersList::ECP_CREATE_GENERAL_DATA, $order )
    157             )
    158         );
    159         $data = apply_filters( EcpApiFilterList::ECP_API_APPEND_RECURRING_DATA, $data, $subscription_id );
    160         $data = apply_filters( EcpAppendsFilterList::ECP_APPEND_PAYMENT_SECTION, $data, $order );
     155                EcpAppendsFilters::ECP_APPEND_MERCHANT_CALLBACK_URL,
     156                apply_filters( EcpFilters::ECP_CREATE_GENERAL_DATA, $order )
     157            )
     158        );
     159        $data = apply_filters( EcpApiFilters::ECP_API_APPEND_RECURRING_DATA, $data, $subscription_id );
     160        $data = apply_filters( EcpAppendsFilters::ECP_APPEND_PAYMENT_SECTION, $data, $order );
    161161
    162162        $ip_address       = $order->get_ecp_meta( '_customer_ip_address' );
     
    166166        ];
    167167
    168         return apply_filters( EcpAppendsFilterList::ECP_APPEND_INTERFACE_TYPE, $data );
     168        return apply_filters( EcpAppendsFilters::ECP_APPEND_INTERFACE_TYPE, $data );
    169169    }
    170170
     
    182182
    183183        return apply_filters(
    184             EcpAppendsFilterList::ECP_APPEND_INTERFACE_TYPE,
     184            EcpAppendsFilters::ECP_APPEND_INTERFACE_TYPE,
    185185            $this->create_general_section(
    186186                apply_filters(
    187                     EcpApiFilterList::ECP_API_APPEND_RECURRING_DATA,
     187                    EcpApiFilters::ECP_API_APPEND_RECURRING_DATA,
    188188                    apply_filters(
    189                         EcpAppendsFilterList::ECP_APPEND_MERCHANT_CALLBACK_URL,
    190                         apply_filters( EcpFiltersList::ECP_CREATE_GENERAL_DATA, $order )
     189                        EcpAppendsFilters::ECP_APPEND_MERCHANT_CALLBACK_URL,
     190                        apply_filters( EcpFilters::ECP_CREATE_GENERAL_DATA, $order )
    191191                    ),
    192192                    $subscription_id
     
    220220        parent::hooks();
    221221
    222         add_filter( EcpApiFilterList::ECP_API_RECURRING_FORM_DATA, [
     222        add_filter( EcpApiFilters::ECP_API_RECURRING_FORM_DATA, [
    223223            $this,
    224224            'create_recurring_request_form_data'
    225225        ], 10, 2 );
    226         add_filter( EcpApiFilterList::ECP_API_APPEND_RECURRING_DATA, [ $this, 'append_recurring_data' ], 10, 2 );
    227         add_filter( EcpApiFilterList::ECP_API_RECURRING_CANCEL_FORM_DATA, [
     226        add_filter( EcpApiFilters::ECP_API_APPEND_RECURRING_DATA, [ $this, 'append_recurring_data' ], 10, 2 );
     227        add_filter( EcpApiFilters::ECP_API_RECURRING_CANCEL_FORM_DATA, [
    228228            $this,
    229229            'create_cancel_request_form_data'
  • ecommpay-payments/trunk/common/gateways/EcpApplepay.php

    r3218798 r3267715  
    44
    55use common\helpers\EcpGatewayPaymentMethods;
    6 use common\includes\filters\EcpAppendsFilterList;
     6use common\includes\filters\EcpAppendsFilters;
    77use common\modules\EcpModuleRefund;
    88use common\settings\EcpSettingsApplepay;
     
    6363        $amount = ecp_price_multiply( $order->get_total(), $order->get_currency() );
    6464
    65         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_OPERATION_MODE, $values, $amount > 0 ? self::MODE_PURCHASE : self::MODE_CARD_VERIFY );
    66         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
    67         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_RECURRING, $values, $order );
     65        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_OPERATION_MODE, $values, $amount > 0 ? self::MODE_PURCHASE : self::MODE_CARD_VERIFY );
     66        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
     67        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_RECURRING, $values, $order );
    6868
    6969        return parent::apply_payment_args( $values, $order );
  • ecommpay-payments/trunk/common/gateways/EcpBlik.php

    r3218798 r3267715  
    33namespace common\gateways;
    44
    5 use common\includes\filters\EcpAppendsFilterList;
     5use common\includes\filters\EcpAppendsFilters;
    66use common\modules\EcpModuleRefund;
    77use common\settings\EcpSettingsBlik;
     
    5252     */
    5353    public function apply_payment_args( $values, $order ): array {
    54         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
     54        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
    5555
    5656        return parent::apply_payment_args( $values, $order );
  • ecommpay-payments/trunk/common/gateways/EcpBrazilOnlineBanks.php

    r3218798 r3267715  
    33namespace common\gateways;
    44
    5 use common\includes\filters\EcpAppendsFilterList;
     5use common\includes\filters\EcpAppendsFilters;
    66use common\modules\EcpModuleRefund;
    77use common\settings\EcpSettingsBrazilOnline_Banks;
     
    5252     */
    5353    public function apply_payment_args( $values, $order ): array {
    54         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
     54        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
    5555
    5656        return parent::apply_payment_args( $values, $order );
  • ecommpay-payments/trunk/common/gateways/EcpCard.php

    r3218798 r3267715  
    55use common\exceptions\EcpGatewayErrorException;
    66use common\helpers\EcpGatewayPaymentMethods;
    7 use common\includes\filters\EcpAppendsFilterList;
     7use common\includes\filters\EcpAppendsFilters;
    88use common\modules\EcpModuleRefund;
    99use common\settings\EcpSettings;
     
    6969        $display_mode = $this->get_option( EcpSettings::OPTION_MODE, EcpSettings::MODE_REDIRECT );
    7070
    71         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CARD_OPERATION_TYPE, $values, $order );
     71        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CARD_OPERATION_TYPE, $values, $order );
    7272        // Setup Payment Page Operation Mode
    73         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_OPERATION_MODE, $values, $amount > 0 ? self::MODE_PURCHASE : self::MODE_CARD_VERIFY );
     73        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_OPERATION_MODE, $values, $amount > 0 ? self::MODE_PURCHASE : self::MODE_CARD_VERIFY );
    7474        // Setup Payment Page Force Mode
    75         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
     75        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
    7676        // Setup Payment Page Display Mode
    7777        $values = apply_filters(
     
    8282        );
    8383        // Setup Recurring (Subscriptions)
    84         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_RECURRING, $values, $order );
     84        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_RECURRING, $values, $order );
    8585
    8686        return parent::apply_payment_args( $values, $order );
  • ecommpay-payments/trunk/common/gateways/EcpDirectDebitBACS.php

    r3239955 r3267715  
    44
    55use common\helpers\EcpGatewayPaymentMethods;
    6 use common\includes\filters\EcpAppendsFilterList;
     6use common\includes\filters\EcpAppendsFilters;
    77use common\modules\EcpModuleRefund;
    88use common\settings\EcpSettingsDirectDebitBACS;
     
    6262        $amount = ecp_price_multiply( $order->get_total(), $order->get_currency() );
    6363
    64         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CARD_OPERATION_TYPE, $values, $order );
     64        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CARD_OPERATION_TYPE, $values, $order );
    6565        // Setup Payment Page Operation Mode
    66         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_OPERATION_MODE, $values, $amount > 0 ? self::MODE_PURCHASE : self::MODE_CARD_VERIFY );
     66        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_OPERATION_MODE, $values, $amount > 0 ? self::MODE_PURCHASE : self::MODE_CARD_VERIFY );
    6767        // Setup Payment Page Force Mode
    68         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
     68        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
    6969        // Setup Recurring (Subscriptions)
    70         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_RECURRING, $values, $order );
     70        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_RECURRING, $values, $order );
    7171
    7272        return parent::apply_payment_args( $values, $order );
  • ecommpay-payments/trunk/common/gateways/EcpDirectDebitSEPA.php

    r3239955 r3267715  
    44
    55use common\helpers\EcpGatewayPaymentMethods;
    6 use common\includes\filters\EcpAppendsFilterList;
     6use common\includes\filters\EcpAppendsFilters;
    77use common\modules\EcpModuleRefund;
    88use common\settings\EcpSettingsDirectDebitSEPA;
     
    6262        $amount = ecp_price_multiply( $order->get_total(), $order->get_currency() );
    6363
    64         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CARD_OPERATION_TYPE, $values, $order );
     64        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CARD_OPERATION_TYPE, $values, $order );
    6565        // Setup Payment Page Operation Mode
    66         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_OPERATION_MODE, $values, $amount > 0 ? self::MODE_PURCHASE : self::MODE_CARD_VERIFY );
     66        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_OPERATION_MODE, $values, $amount > 0 ? self::MODE_PURCHASE : self::MODE_CARD_VERIFY );
    6767        // Setup Payment Page Force Mode
    68         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
     68        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
    6969        // Setup Recurring (Subscriptions)
    70         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_RECURRING, $values, $order );
     70        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_RECURRING, $values, $order );
    7171
    7272        return parent::apply_payment_args( $values, $order );
  • ecommpay-payments/trunk/common/gateways/EcpGateway.php

    r3227972 r3267715  
    44
    55use common\includes\EcpGatewayOrder;
    6 use common\includes\filters\EcpApiFilterList;
    7 use common\includes\filters\EcpAppendsFilterList;
    8 use common\includes\filters\EcpWCFilterList;
     6use common\includes\filters\EcpApiFilters;
     7use common\includes\filters\EcpAppendsFilters;
     8use common\includes\filters\EcpWCFilters;
    99use common\modules\EcpModuleSubscription;
    1010use common\settings\EcpSettings;
     
    6969        }
    7070
    71         add_action( EcpWCFilterList::WOOCOMMERCE_UPDATE_OPTIONS_PAYMENT_GATEWAYS . $this->id, [
     71        add_action( EcpWCFilters::WOOCOMMERCE_UPDATE_OPTIONS_PAYMENT_GATEWAYS . $this->id, [
    7272            EcpForm::get_instance(),
    7373            'save'
    7474        ] );
    75         add_filter( EcpAppendsFilterList::ECP_APPEND_GATEWAY_ARGUMENTS . $this->id, [
     75        add_filter( EcpAppendsFilters::ECP_APPEND_GATEWAY_ARGUMENTS . $this->id, [
    7676            $this,
    7777            'apply_payment_args'
    7878        ], 10, 2 );
    79         add_filter( EcpApiFilterList::ECP_API_REFUND_ENDPOINT . $this->id, [ $this, 'get_refund_endpoint' ] );
     79        add_filter( EcpApiFilters::ECP_API_REFUND_ENDPOINT_PREFIX . $this->id, [ $this, 'get_refund_endpoint' ] );
    8080    }
    8181
  • ecommpay-payments/trunk/common/gateways/EcpGiropay.php

    r3218798 r3267715  
    33namespace common\gateways;
    44
    5 use common\includes\filters\EcpAppendsFilterList;
     5use common\includes\filters\EcpAppendsFilters;
    66use common\modules\EcpModuleRefund;
    77use common\settings\EcpSettingsGiropay;
     
    5151     */
    5252    public function apply_payment_args( $values, $order ): array {
    53         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
     53        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
    5454
    5555        return parent::apply_payment_args( $values, $order );
  • ecommpay-payments/trunk/common/gateways/EcpGooglepay.php

    r3218798 r3267715  
    44
    55use common\helpers\EcpGatewayPaymentMethods;
    6 use common\includes\filters\EcpAppendsFilterList;
     6use common\includes\filters\EcpAppendsFilters;
    77use common\modules\EcpModuleRefund;
    88use common\settings\EcpSettingsGooglepay;
     
    6262        $amount = ecp_price_multiply( $order->get_total(), $order->get_currency() );
    6363
    64         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_OPERATION_MODE, $values, $amount > 0 ? self::MODE_PURCHASE : self::MODE_CARD_VERIFY );
    65         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
    66         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_RECURRING, $values, $order );
     64        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_OPERATION_MODE, $values, $amount > 0 ? self::MODE_PURCHASE : self::MODE_CARD_VERIFY );
     65        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
     66        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_RECURRING, $values, $order );
    6767
    6868        return parent::apply_payment_args( $values, $order );
  • ecommpay-payments/trunk/common/gateways/EcpIdeal.php

    r3218798 r3267715  
    33namespace common\gateways;
    44
    5 use common\includes\filters\EcpAppendsFilterList;
     5use common\includes\filters\EcpAppendsFilters;
    66use common\modules\EcpModuleRefund;
    77use common\settings\EcpSettingsIdeal;
     
    5151     */
    5252    public function apply_payment_args( $values, $order ): array {
    53         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
     53        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
    5454
    5555        return parent::apply_payment_args( $values, $order );
  • ecommpay-payments/trunk/common/gateways/EcpKlarna.php

    r3218798 r3267715  
    33namespace common\gateways;
    44
    5 use common\includes\filters\EcpAppendsFilterList;
     5use common\includes\filters\EcpAppendsFilters;
    66use common\modules\EcpModuleRefund;
    77use common\settings\EcpSettingsKlarna;
     
    5555        $values = apply_filters( 'ecp_append_billing_country', $values, $order );
    5656        $values = apply_filters( 'ecp_append_receipt_data', $values, $order, true );
    57         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
     57        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
    5858
    5959        return parent::apply_payment_args( $values, $order );
  • ecommpay-payments/trunk/common/gateways/EcpMore.php

    r3218798 r3267715  
    33namespace common\gateways;
    44
    5 use common\includes\filters\EcpAppendsFilterList;
     5use common\includes\filters\EcpAppendsFilters;
    66use common\settings\EcpSettings;
    77use common\settings\EcpSettingsMore;
     
    6060
    6161        if ( $force !== null && $force !== '' ) {
    62             $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, $force );
     62            $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, $force );
    6363        }
    6464
  • ecommpay-payments/trunk/common/gateways/EcpPayPal.php

    r3218798 r3267715  
    33namespace common\gateways;
    44
    5 use common\includes\filters\EcpAppendsFilterList;
     5use common\includes\filters\EcpAppendsFilters;
    66use common\modules\EcpModuleRefund;
    77use common\settings\EcpSettingsPayPal;
     
    5151     */
    5252    public function apply_payment_args( $values, $order ): array {
    53         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
     53        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
    5454
    5555        return parent::apply_payment_args( $values, $order );
  • ecommpay-payments/trunk/common/gateways/EcpPayPalPayLater.php

    r3218798 r3267715  
    44
    55use common\includes\EcpGatewayOrder;
    6 use common\includes\filters\EcpAppendsFilterList;
     6use common\includes\filters\EcpAppendsFilters;
    77use common\modules\EcpModuleRefund;
    88use common\settings\EcpSettingsPayPalPayLater;
     
    4949     */
    5050    public function apply_payment_args( array $values, EcpGatewayOrder $order ): array {
    51         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
     51        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, $values, self::PAYMENT_METHOD );
    5252        $values['payment_methods_options'] = '{"submethod_code": "paylater"}';
    5353
  • ecommpay-payments/trunk/common/helpers/EcpGatewayAPIProtocol.php

    r3227972 r3267715  
    77use common\includes\EcpGatewayOrder;
    88use common\includes\EcpGatewayRefund;
    9 use common\includes\filters\EcpAppendsFilterList;
    10 use common\includes\filters\EcpFiltersList;
     9use common\includes\filters\EcpAppendsFilters;
     10use common\includes\filters\EcpFilters;
    1111use common\modules\EcpModuleCapture;
    1212use common\settings\EcpSettings;
     
    143143        ecp_get_log()->info( __( 'Append customer data to the form data.', 'woo-ecommpay' ) );
    144144
    145         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_COUNTRY, $values, $order );
    146         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_STATE, $values, $order );
    147         $values = apply_filters( EcpFiltersList::ECP_APPEND_CUSTOMER_CITY, $values, $order );
    148         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_ADDRESS, $values, $order );
    149 
    150         return apply_filters( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_ZIP, $values, $order );
     145        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CUSTOMER_COUNTRY, $values, $order );
     146        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CUSTOMER_STATE, $values, $order );
     147        $values = apply_filters( EcpFilters::ECP_APPEND_CUSTOMER_CITY, $values, $order );
     148        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CUSTOMER_ADDRESS, $values, $order );
     149
     150        return apply_filters( EcpAppendsFilters::ECP_APPEND_CUSTOMER_ZIP, $values, $order );
    151151    }
    152152
     
    355355     */
    356356    public function append_billing_data( array $values, EcpGatewayOrder $order ): array {
    357         $values = apply_filters( EcpFiltersList::ECP_APPEND_BILLING_ADDRESS, $values, $order );
    358         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_BILLING_CITY, $values, $order );
    359         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_BILLING_COUNTRY, $values, $order );
    360 
    361         return apply_filters( EcpAppendsFilterList::ECP_APPEND_BILLING_POSTAL, $values, $order );
     357        $values = apply_filters( EcpFilters::ECP_APPEND_BILLING_ADDRESS, $values, $order );
     358        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_BILLING_CITY, $values, $order );
     359        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_BILLING_COUNTRY, $values, $order );
     360
     361        return apply_filters( EcpAppendsFilters::ECP_APPEND_BILLING_POSTAL, $values, $order );
    362362    }
    363363
     
    504504    /**
    505505     * @param array $values
     506     * @param string|null $value
     507     *
     508     * @return array
     509     */
     510    public function append_redirect_return_url( array $values, ?string $value ): array {
     511        $this->append_argument( 'redirect_return_url', $value, $values );
     512
     513        return $values;
     514    }
     515
     516    /**
     517     * @param array $values
    506518     * @param $url
    507519     *
    508520     * @return array
    509521     */
    510     public function append_redirect_url( array $values, $url ): array {
     522    public function append_redirect_success_url( array $values, string $url ): array {
    511523        $this->append_argument( 'redirect_success_enabled', 2, $values );
    512524        $this->append_argument( 'redirect_success_mode', 'parent_page', $values );
    513525        $this->append_argument( 'redirect_success_url', $url, $values );
     526        return $values;
     527    }
     528
     529    /**
     530     * @param array $values
     531     * @param $url
     532     *
     533     * @return array
     534     */
     535    public function append_redirect_fail_url( array $values, string $url ): array {
    514536        $this->append_argument( 'redirect_fail_enabled', 2, $values );
    515537        $this->append_argument( 'redirect_fail_mode', 'parent_page', $values );
    516538        $this->append_argument( 'redirect_fail_url', $url, $values );
    517 
    518539        return $values;
    519540    }
     
    612633     */
    613634    public function append_custom_variables( $values, EcpGatewayOrder $order ): array {
    614         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_ID, $values, $order );
    615 
    616         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_PHONE, $values, $order );
    617         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_EMAIL, $values, $order );
    618         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_FIRST_NAME, $values, $order );
    619         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_LAST_NAME, $values, $order );
    620         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_DATA, $values, $order );
    621         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_BILLING_DATA, $values, $order );
    622         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_RECEIPT_DATA, $values, $order, true );
    623         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_AVS_POST_CODE, $values, $order );
    624 
    625         return apply_filters( EcpAppendsFilterList::ECP_APPEND_AVS_STREET_ADDRESS, $values, $order );
     635        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CUSTOMER_ID, $values, $order );
     636
     637        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CUSTOMER_PHONE, $values, $order );
     638        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CUSTOMER_EMAIL, $values, $order );
     639        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CUSTOMER_FIRST_NAME, $values, $order );
     640        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CUSTOMER_LAST_NAME, $values, $order );
     641        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CUSTOMER_DATA, $values, $order );
     642        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_BILLING_DATA, $values, $order );
     643        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_RECEIPT_DATA, $values, $order, true );
     644        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_AVS_POST_CODE, $values, $order );
     645
     646        return apply_filters( EcpAppendsFilters::ECP_APPEND_AVS_STREET_ADDRESS, $values, $order );
    626647    }
    627648
     
    724745        $data = $this->receipt_data( $order );
    725746
    726         apply_filters( EcpFiltersList::ECP_PAYMENT_PAGE_CLEAN_PARAMETERS, $data );
     747        apply_filters( EcpFilters::ECP_PAYMENT_PAGE_CLEAN_PARAMETERS, $data );
    727748
    728749        if ( count( $data ) <= 0 ) {
     
    869890        ];
    870891
    871         apply_filters( EcpFiltersList::ECP_PAYMENT_PAGE_CLEAN_PARAMETERS, $shipping_args );
     892        apply_filters( EcpFilters::ECP_PAYMENT_PAGE_CLEAN_PARAMETERS, $shipping_args );
    872893
    873894        if ( count( $shipping_args ) <= 0 ) {
     
    889910     */
    890911    protected function init(): void {
    891         add_filter( EcpFiltersList::ECP_CREATE_GENERAL_DATA_FILTER, [ $this, 'create_general_info' ] );
    892         add_filter( EcpFiltersList::ECP_CREATE_PAYMENT_DATA, [ $this, 'create_payment_data' ] );
    893         add_filter( EcpFiltersList::ECP_CREATE_PAYMENT_INFO, [ $this, 'create_payment_info' ] );
     912        add_filter( EcpFilters::ECP_CREATE_GENERAL_DATA_FILTER, [ $this, 'create_general_info' ] );
     913        add_filter( EcpFilters::ECP_CREATE_PAYMENT_DATA, [ $this, 'create_payment_data' ] );
     914        add_filter( EcpFilters::ECP_CREATE_PAYMENT_INFO, [ $this, 'create_payment_info' ] );
    894915
    895916        // register filters for appending payment arguments
    896         add_filter( EcpAppendsFilterList::ECP_APPEND_PROJECT_ID, [ $this, 'append_project_id' ] );
    897         add_filter( EcpAppendsFilterList::ECP_APPEND_INTERFACE_TYPE, [ $this, 'append_interface_type' ], 10, 2 );
    898         add_filter( EcpAppendsFilterList::ECP_APPEND_CARD_OPERATION_TYPE, [
     917        add_filter( EcpAppendsFilters::ECP_APPEND_PROJECT_ID, [ $this, 'append_project_id' ] );
     918        add_filter( EcpAppendsFilters::ECP_APPEND_INTERFACE_TYPE, [ $this, 'append_interface_type' ], 10, 2 );
     919        add_filter( EcpAppendsFilters::ECP_APPEND_CARD_OPERATION_TYPE, [
    899920            $this,
    900921            'append_card_operation_type'
    901922        ], 10, 2 );
    902         add_filter( EcpAppendsFilterList::ECP_APPEND_OPERATION_MODE, [ $this, 'append_operation_mode' ], 10, 2 );
    903         add_filter( EcpAppendsFilterList::ECP_APPEND_FORCE_MODE, [ $this, 'append_force_mode' ], 10, 2 );
    904         add_filter( EcpAppendsFilterList::ECP_APPEND_DISPLAY_MODE, [ $this, 'append_display_mode' ], 10, 3 );
    905         add_filter( EcpAppendsFilterList::ECP_APPEND_PAYMENT_SECTION, [ $this, 'append_payment_section' ], 10, 2 );
    906         add_filter( EcpAppendsFilterList::ECP_APPEND_LANGUAGE_CODE, [ $this, 'append_language' ] );
    907         add_filter( EcpAppendsFilterList::ECP_APPEND_MERCHANT_SUCCESS_URL, [
     923        add_filter( EcpAppendsFilters::ECP_APPEND_OPERATION_MODE, [ $this, 'append_operation_mode' ], 10, 2 );
     924        add_filter( EcpAppendsFilters::ECP_APPEND_FORCE_MODE, [ $this, 'append_force_mode' ], 10, 2 );
     925        add_filter( EcpAppendsFilters::ECP_APPEND_DISPLAY_MODE, [ $this, 'append_display_mode' ], 10, 3 );
     926        add_filter( EcpAppendsFilters::ECP_APPEND_PAYMENT_SECTION, [ $this, 'append_payment_section' ], 10, 2 );
     927        add_filter( EcpAppendsFilters::ECP_APPEND_LANGUAGE_CODE, [ $this, 'append_language' ] );
     928        add_filter( EcpAppendsFilters::ECP_APPEND_MERCHANT_SUCCESS_URL, [
    908929            $this,
    909930            'append_merchant_success_url'
    910931        ], 10, 2 );
    911         add_filter( EcpAppendsFilterList::ECP_APPEND_MERCHANT_FAIL_URL, [ $this, 'append_merchant_fail_url' ], 10, 2 );
    912         add_filter( EcpAppendsFilterList::ECP_APPEND_MERCHANT_RETURN_URL, [
     932        add_filter( EcpAppendsFilters::ECP_APPEND_MERCHANT_FAIL_URL, [ $this, 'append_merchant_fail_url' ], 10, 2 );
     933        add_filter( EcpAppendsFilters::ECP_APPEND_REDIRECT_RETURN_URL, [
     934            $this,
     935            'append_redirect_return_url'
     936        ], 10, 2 );
     937        add_filter( EcpAppendsFilters::ECP_APPEND_MERCHANT_RETURN_URL, [
    913938            $this,
    914939            'append_merchant_return_url'
    915940        ], 10, 2 );
    916         add_filter( EcpAppendsFilterList::ECP_APPEND_REDIRECT_URL, [ $this, 'append_redirect_url' ], 10, 2 );
    917         add_filter( EcpAppendsFilterList::ECP_APPEND_MERCHANT_CALLBACK_URL, [ $this, 'append_merchant_callback_url' ] );
    918         add_filter( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_DATA, [ $this, 'append_customer_data' ], 10, 2 );
    919         add_filter( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_ID, [ $this, 'append_customer_id' ], 10, 2 );
    920         add_filter( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_PHONE, [ $this, 'append_customer_phone' ], 10, 2 );
    921         add_filter( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_EMAIL, [ $this, 'append_customer_email' ], 10, 2 );
    922         add_filter( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_LAST_NAME, [
     941        add_filter( EcpAppendsFilters::ECP_APPEND_REDIRECT_SUCCESS_URL, [ $this, 'append_redirect_success_url' ], 10, 2 );
     942        add_filter( EcpAppendsFilters::ECP_APPEND_REDIRECT_FAIL_URL, [ $this, 'append_redirect_fail_url' ], 10, 2 );
     943        add_filter( EcpAppendsFilters::ECP_APPEND_MERCHANT_CALLBACK_URL, [ $this, 'append_merchant_callback_url' ] );
     944        add_filter( EcpAppendsFilters::ECP_APPEND_CUSTOMER_DATA, [ $this, 'append_customer_data' ], 10, 2 );
     945        add_filter( EcpAppendsFilters::ECP_APPEND_CUSTOMER_ID, [ $this, 'append_customer_id' ], 10, 2 );
     946        add_filter( EcpAppendsFilters::ECP_APPEND_CUSTOMER_PHONE, [ $this, 'append_customer_phone' ], 10, 2 );
     947        add_filter( EcpAppendsFilters::ECP_APPEND_CUSTOMER_EMAIL, [ $this, 'append_customer_email' ], 10, 2 );
     948        add_filter( EcpAppendsFilters::ECP_APPEND_CUSTOMER_LAST_NAME, [
    923949            $this,
    924950            'append_customer_last_name'
    925951        ], 10, 2 );
    926         add_filter( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_FIRST_NAME, [
     952        add_filter( EcpAppendsFilters::ECP_APPEND_CUSTOMER_FIRST_NAME, [
    927953            $this,
    928954            'append_customer_first_name'
    929955        ], 10, 2 );
    930         add_filter( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_COUNTRY, [ $this, 'append_customer_country' ], 10, 2 );
    931         add_filter( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_STATE, [ $this, 'append_customer_state' ], 10, 2 );
    932         add_filter( EcpFiltersList::ECP_APPEND_CUSTOMER_CITY, [ $this, 'append_customer_city' ], 10, 2 );
    933         add_filter( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_ADDRESS, [ $this, 'append_customer_address' ], 10, 2 );
    934         add_filter( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_ZIP, [ $this, 'append_customer_zip' ], 10, 2 );
    935         add_filter( EcpAppendsFilterList::ECP_APPEND_AVS_POST_CODE, [ $this, 'append_avs_post_code' ], 10, 2 );
    936         add_filter( EcpAppendsFilterList::ECP_APPEND_AVS_STREET_ADDRESS, [
     956        add_filter( EcpAppendsFilters::ECP_APPEND_CUSTOMER_COUNTRY, [ $this, 'append_customer_country' ], 10, 2 );
     957        add_filter( EcpAppendsFilters::ECP_APPEND_CUSTOMER_STATE, [ $this, 'append_customer_state' ], 10, 2 );
     958        add_filter( EcpFilters::ECP_APPEND_CUSTOMER_CITY, [ $this, 'append_customer_city' ], 10, 2 );
     959        add_filter( EcpAppendsFilters::ECP_APPEND_CUSTOMER_ADDRESS, [ $this, 'append_customer_address' ], 10, 2 );
     960        add_filter( EcpAppendsFilters::ECP_APPEND_CUSTOMER_ZIP, [ $this, 'append_customer_zip' ], 10, 2 );
     961        add_filter( EcpAppendsFilters::ECP_APPEND_AVS_POST_CODE, [ $this, 'append_avs_post_code' ], 10, 2 );
     962        add_filter( EcpAppendsFilters::ECP_APPEND_AVS_STREET_ADDRESS, [
    937963            $this,
    938964            'append_avs_street_address'
    939965        ], 10, 2 );
    940         add_filter( EcpAppendsFilterList::ECP_APPEND_BILLING_DATA, [ $this, 'append_billing_data' ], 10, 2 );
    941         add_filter( EcpFiltersList::ECP_APPEND_BILLING_ADDRESS, [ $this, 'append_billing_address' ], 10, 2 );
    942         add_filter( EcpAppendsFilterList::ECP_APPEND_BILLING_CITY, [ $this, 'append_billing_city' ], 10, 2 );
    943         add_filter( EcpAppendsFilterList::ECP_APPEND_BILLING_COUNTRY, [ $this, 'append_billing_country' ], 10, 2 );
    944         add_filter( EcpAppendsFilterList::ECP_APPEND_BILLING_POSTAL, [ $this, 'append_billing_postal' ], 10, 2 );
    945         add_filter( EcpAppendsFilterList::ECP_APPEND_BILLING_REGION, [ $this, 'append_billing_region' ], 10, 2 );
    946         add_filter( EcpAppendsFilterList::ECP_APPEND_BILLING_REGION_CODE, [
     966        add_filter( EcpAppendsFilters::ECP_APPEND_BILLING_DATA, [ $this, 'append_billing_data' ], 10, 2 );
     967        add_filter( EcpFilters::ECP_APPEND_BILLING_ADDRESS, [ $this, 'append_billing_address' ], 10, 2 );
     968        add_filter( EcpAppendsFilters::ECP_APPEND_BILLING_CITY, [ $this, 'append_billing_city' ], 10, 2 );
     969        add_filter( EcpAppendsFilters::ECP_APPEND_BILLING_COUNTRY, [ $this, 'append_billing_country' ], 10, 2 );
     970        add_filter( EcpAppendsFilters::ECP_APPEND_BILLING_POSTAL, [ $this, 'append_billing_postal' ], 10, 2 );
     971        add_filter( EcpAppendsFilters::ECP_APPEND_BILLING_REGION, [ $this, 'append_billing_region' ], 10, 2 );
     972        add_filter( EcpAppendsFilters::ECP_APPEND_BILLING_REGION_CODE, [
    947973            $this,
    948974            'append_billing_region_code'
    949975        ], 10, 2 );
    950         add_filter( EcpAppendsFilterList::ECP_APPEND_ADDITIONAL_VARIABLES, [
     976        add_filter( EcpAppendsFilters::ECP_APPEND_ADDITIONAL_VARIABLES, [
    951977            $this,
    952978            'append_custom_variables'
    953979        ], 10, 2 );
    954         add_filter( EcpFiltersList::ECP_PAYMENT_PAGE_CLEAN_PARAMETERS, [ $this, 'filter_clean' ] );
    955         add_filter( EcpAppendsFilterList::ECP_APPEND_RECURRING, [ $this, 'append_recurring' ], 10, 2 );
    956         add_filter( EcpAppendsFilterList::ECP_APPEND_SHIPPING_DATA, [ $this, 'filter_shipping_data' ], 10, 2 );
    957         add_filter( EcpAppendsFilterList::ECP_APPEND_RECEIPT_DATA, [ $this, 'filter_receipt_data' ], 10, 3 );
    958         add_filter( EcpAppendsFilterList::ECP_APPEND_CASH_VOUCHER_DATA, [ $this, 'filter_cash_voucher_data' ], 10, 2 );
    959         add_filter( EcpAppendsFilterList::ECP_APPEND_VERSIONS, [ $this, 'append_versions' ] );
    960         add_filter( EcpAppendsFilterList::ECP_APPEND_SIGNATURE, [ $this, 'append_signature' ] );
     980        add_filter( EcpFilters::ECP_PAYMENT_PAGE_CLEAN_PARAMETERS, [ $this, 'filter_clean' ] );
     981        add_filter( EcpAppendsFilters::ECP_APPEND_RECURRING, [ $this, 'append_recurring' ], 10, 2 );
     982        add_filter( EcpAppendsFilters::ECP_APPEND_SHIPPING_DATA, [ $this, 'filter_shipping_data' ], 10, 2 );
     983        add_filter( EcpAppendsFilters::ECP_APPEND_RECEIPT_DATA, [ $this, 'filter_receipt_data' ], 10, 3 );
     984        add_filter( EcpAppendsFilters::ECP_APPEND_CASH_VOUCHER_DATA, [ $this, 'filter_cash_voucher_data' ], 10, 2 );
     985        add_filter( EcpAppendsFilters::ECP_APPEND_VERSIONS, [ $this, 'append_versions' ] );
     986        add_filter( EcpAppendsFilters::ECP_APPEND_SIGNATURE, [ $this, 'append_signature' ] );
    961987    }
    962988
  • ecommpay-payments/trunk/common/includes/EcpCallbacksHandler.php

    r3218798 r3267715  
    130130     */
    131131    private function get_order( EcpGatewayInfoCallback $info ): EcpGatewayOrder {
    132         // Fetch order number;
     132        $payment_id = $info->get_payment()->get_id() ?? $_GET['payment_id'];
     133
    133134        $order_number = EcpGatewayOrder::get_order_id_from_callback( $info );
    134135        $order        = ecp_get_order( $order_number );
     136
     137        $last_payment_id = $order->get_payment_id();
     138
     139        if ( $payment_id !== $last_payment_id ) {
     140            $message =  sprintf('Order with payment id %s found but it already has a new payment id %s', $payment_id, $last_payment_id);
     141            ecp_get_log()->info( __( $message, 'woo-ecommpay' ) );
     142            http_response_code( 200 );
     143            die ( $message );
     144        }
    135145
    136146        if ( ! $order ) {
     
    168178        do_action( 'ecp_accepted_callback_before_processing', $order, $callback );
    169179        do_action( 'ecp_accepted_callback_before_processing_' . $callback->get_operation()->get_type(), $order, $callback );
    170 
    171         // Clear card - payment is not initial.
    172         WC()->cart->empty_cart();
    173180
    174181        if ( array_key_exists( $callback->get_operation()->get_type(), $this->operations ) ) {
  • ecommpay-payments/trunk/common/includes/EcpGatewayOrder.php

    r3227972 r3267715  
    4747    private const META_PAYMENT_METHOD_CHANGE_COUNT = '_ecommpay_payment_method_change_count';
    4848
     49    private const ORDER_PAY_ECOMMPAY_ACTION_NAME = 'ecommpay_process';
     50
    4951    /**
    5052     * @var ?EcpGatewayPayment
     
    104106     */
    105107    public function create_payment_id(): string {
    106         $_payment_id = $this->get_ecp_meta( '_payment_id' );
    107         if ( $_payment_id != '' & ( $_REQUEST['action'] != 'ecommpay_process' ) ) {
    108             $id = $_payment_id;
    109         } else if ( ! empty ( $_REQUEST['payment_id'] ) ) {
    110             $id = $_REQUEST['payment_id'];
    111         } else {
    112             $id = $this->get_id() . '_' . ( $this->get_failed_ecommpay_payment_count() + 1 );
    113         }
    114 
    115         $this->set_payment_id( $id );
     108        $embeddedModePaymentId = $this->getEmbeddedModePaymentId();
     109        $paymentId = $embeddedModePaymentId ? : generateNewPaymentId($this);
     110
     111        $this->set_payment_id( $paymentId );
    116112        $this->set_ecp_payment_status( EcpGatewayPaymentStatus::INITIAL );
    117113        $this->save_meta_data();
    118114
    119         ecp_get_log()->debug( __( 'New payment identifier created:', 'woo-ecommpay' ), $id );
    120 
    121         return $id;
     115        ecp_get_log()->debug( __( 'New payment identifier created:', 'woo-ecommpay' ), $paymentId );
     116
     117        return $paymentId;
     118    }
     119
     120    private function getEmbeddedModePaymentId(): ?string {
     121        return $_POST['payment_id'] ?? null;
    122122    }
    123123
  • ecommpay-payments/trunk/common/includes/EcpGatewayOrderExtension.php

    r3227972 r3267715  
    1919                $this->add_order_note( __( 'New payment id is ' . $value, 'woocommerce' ) );
    2020            }
    21             $this->set_ecp_meta( '_payment_id', $value );
     21            $this->set_ecp_meta( '_payment_id', $value, false );
    2222        }
    2323    }
     
    2929     */
    3030    public function get_payment_id(): string {
    31         return $this->get_ecp_meta( '_payment_id' );
     31        $meta_data = $this->get_ecp_meta( '_payment_id', false );
     32        $meta_object = end( $meta_data );
     33        if ( is_object( $meta_object )) {
     34            return $meta_object->value;
     35        }
     36        return $meta_object;
    3237    }
    3338
     
    3641     *
    3742     * @param $key
    38      * @param bool $single
     43     * @param bool $single Return type, array if false
    3944     * @param string $context
    4045     *
    41      * @return string
    42      */
    43     public function get_ecp_meta( $key, bool $single = true, string $context = 'view' ): string {
     46     * @return string|array|WC_Meta_Data[]
     47     */
     48    public function get_ecp_meta( $key, bool $single = true, string $context = 'view' ) {
    4449        $meta = $this->get_meta( $key, $single, $context );
    4550
  • ecommpay-payments/trunk/common/includes/EcpOrderManager.php

    r3218798 r3267715  
    151151        ecp_get_log()->debug( __( 'Run success process.', 'woo-ecommpay' ), $order->get_id() );
    152152        $order->payment_complete( $callback->get_operation()->get_request_id() );
     153        WC()->cart->empty_cart();
    153154        ecp_get_log()->debug( __( 'Success process completed.', 'woo-ecommpay' ), $order->get_id() );
    154155
  • ecommpay-payments/trunk/common/modules/EcpModuleAuth.php

    r3218798 r3267715  
    66
    77use common\helpers\EcpGatewayRegistry;
    8 use common\includes\filters\EcpWCFilterList;
     8use common\includes\filters\EcpWCFilters;
    99use common\settings\EcpSettingsApplepay;
    1010use common\settings\EcpSettingsCard;
     
    4141
    4242    protected function init(): void {
    43         add_filter( EcpWCFilterList::WOOCOMMERCE_AVAILABLE_PAYMENT_GATEWAYS, [
     43        add_filter( EcpWCFilters::WOOCOMMERCE_AVAILABLE_PAYMENT_GATEWAYS, [
    4444            $this,
    4545            'filterPaymentMethodsAuthOnly'
  • ecommpay-payments/trunk/common/modules/EcpModulePaymentPage.php

    r3245713 r3267715  
    1010use common\includes\EcpGatewayFormHandler;
    1111use common\includes\EcpGatewayOrder;
    12 use common\includes\filters\EcpApiFilterList;
    13 use common\includes\filters\EcpAppendsFilterList;
    14 use common\includes\filters\EcpFiltersList;
    15 use common\includes\filters\EcpWCFilterList;
     12use common\includes\filters\EcpApiFilters;
     13use common\includes\filters\EcpAppendsFilters;
     14use common\includes\filters\EcpFilters;
     15use common\includes\filters\EcpWCFilters;
     16use common\includes\filters\EcpWPFilters;
    1617use Exception;
    1718use WC_Payment_Gateways;
     
    4950    private const HOST = 'paymentpage.ecommpay.com';
    5051
     52    private const FAILED_URI = '/checkout?payment_failed=1';
    5153
    5254    /**
     
    118120     */
    119121    private function get_data_for_payment_form() {
    120         if ( wc_get_var( $_GET['pay_for_order'], '' ) != "" && wc_get_var( $_GET['key'], '' ) != "" ) {
    121             $order_key        = wc_get_var( $_GET['key'], '' );
    122             $order_id         = wc_get_order_id_by_order_key( $order_key );
    123             $order            = ecp_get_order( $order_id );
     122        if ( $order = $this->hasOrderOnOrderPayPage() ) {
    124123            $payment_currency = $order->get_currency();
    125124            $payment_amount   = ecp_price_multiply( $order->get_total(), $order->get_currency() );
     
    129128            $payment_amount   = ecp_price_multiply( WC()->cart->total, $payment_currency );
    130129        }
    131 
     130        $payment_id = generateNewPaymentId($order ? : $this->getCreatedOrderForRePayment());
    132131        $data = [
    133132            'mode' => $payment_amount > 0 ? self::MODE_PURCHASE : self::MODE_CARD_VERIFY,
     
    135134            'payment_currency'        => $payment_currency,
    136135            'project_id'              => ecommpay()->get_project_id(),
    137             'payment_id'              => uniqid( 'wp_' ),
     136            'payment_id'              => $payment_id,
    138137            'force_payment_method'    => 'card',
    139138            'target_element'          => 'ecommpay-iframe-embedded',
     
    143142        ];
    144143
    145         $data = apply_filters( EcpAppendsFilterList::ECP_APPEND_INTERFACE_TYPE, $data, true );
     144        $data = apply_filters( EcpAppendsFilters::ECP_APPEND_INTERFACE_TYPE, $data, true );
    146145
    147146        $data = $this->append_recurring_total_form_cart( $data );
    148147
    149148        if ( isset ( $order ) ) {
    150             $data = apply_filters( EcpAppendsFilterList::ECP_APPEND_CARD_OPERATION_TYPE, $data, $order );
    151             $data = apply_filters( EcpAppendsFilterList::ECP_APPEND_RECEIPT_DATA, $data, $order, true );
    152             $data = apply_filters( EcpAppendsFilterList::ECP_APPEND_CUSTOMER_ID, $data, $order );
     149            $data = apply_filters( EcpAppendsFilters::ECP_APPEND_CARD_OPERATION_TYPE, $data, $order );
     150            $data = apply_filters( EcpAppendsFilters::ECP_APPEND_RECEIPT_DATA, $data, $order, true );
     151            $data = apply_filters( EcpAppendsFilters::ECP_APPEND_CUSTOMER_ID, $data, $order );
    153152        } else {
    154             $data = apply_filters( EcpAppendsFilterList::ECP_APPEND_CARD_OPERATION_TYPE, $data );
     153            $data = apply_filters( EcpAppendsFilters::ECP_APPEND_CARD_OPERATION_TYPE, $data );
    155154            $data = $this->append_receipt_data_from_cart( $data );
    156155            if ( WC()->cart->get_customer()->id ) {
     
    159158        }
    160159
    161         $data = apply_filters( EcpAppendsFilterList::ECP_APPEND_LANGUAGE_CODE, $data );
     160        $data = apply_filters( EcpAppendsFilters::ECP_APPEND_LANGUAGE_CODE, $data );
    162161
    163162        ecp_debug( 'Payment page data: ', $data );
     
    165164        $data = EcpSigner::get_instance()->sign( $data );
    166165        wp_send_json( $data );
     166    }
     167
     168    private function hasOrderOnOrderPayPage(): ?EcpGatewayOrder {
     169        $order_key = wc_get_var( $_GET['key'], '' );
     170        $pay_for_order = wc_get_var( $_GET['pay_for_order'], '' );
     171        if ( $pay_for_order === "" || $order_key === "" ) {
     172            return null;
     173        }
     174        $order_id = wc_get_order_id_by_order_key( $order_key );
     175        return ecp_get_order( $order_id );
     176    }
     177
     178    private function getCreatedOrderForRePayment(): ?EcpGatewayOrder  {
     179        if ( ! WC()->session->has_session() ) {
     180            return null;
     181        }
     182        $orderId = WC()->session->get( 'order_awaiting_payment' );
     183        if ( ! $orderId ) {
     184            return null;
     185        }
     186        return ecp_get_order( $orderId );
    167187    }
    168188
     
    389409     */
    390410    public function get_request_url( EcpGatewayOrder $order, $gateway ): array {
    391         return apply_filters( EcpAppendsFilterList::ECP_APPEND_SIGNATURE, $this->get_form_data( $order, $gateway ) );
     411        return apply_filters( EcpAppendsFilters::ECP_APPEND_SIGNATURE, $this->get_form_data( $order, $gateway ) );
    392412    }
    393413
     
    402422     */
    403423    private function get_form_data( EcpGatewayOrder $order, EcpGateway $gateway ): array {
    404         $return_url = esc_url_raw( add_query_arg( 'utm_nooverride', '1', $gateway->get_return_url( $order ) ) );
    405         $info = apply_filters( EcpFiltersList::ECP_CREATE_PAYMENT_INFO, $order );
    406 
    407424        // General options
    408         $values = apply_filters( EcpFiltersList::ECP_CREATE_PAYMENT_DATA, $order );
     425        $values = apply_filters( EcpFilters::ECP_CREATE_PAYMENT_DATA, $order );
    409426        $values['baseUrl'] = $this->endpoint;
    410427
    411428        // Set payment information
     429        $info   = apply_filters( EcpFilters::ECP_CREATE_PAYMENT_INFO, $order );
    412430        foreach ( $info as $key => $value ) {
    413431            $values[ 'payment_' . $key ] = $value;
    414432        }
    415433
    416         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_LANGUAGE_CODE, $values );
    417         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_ADDITIONAL_VARIABLES, $values, $order );
    418         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_MERCHANT_SUCCESS_URL, $values, $return_url );
    419         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_MERCHANT_FAIL_URL, $values, $return_url );
    420         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_MERCHANT_RETURN_URL, $values, esc_url_raw( $order->get_checkout_payment_url() ) );
    421         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_MERCHANT_CALLBACK_URL, $values );
    422         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_REDIRECT_URL, $values, $return_url );
    423         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_GATEWAY_ARGUMENTS . $gateway->id, $values, $order );
    424         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_VERSIONS, $values );
    425         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_INTERFACE_TYPE, $values, true );
    426         $values = apply_filters( EcpAppendsFilterList::ECP_APPEND_CARD_OPERATION_TYPE, $values, $order );
     434        $return_url = esc_url_raw( add_query_arg( 'utm_nooverride', '1', $gateway->get_return_url( $order ) ) );
     435        $fail_url = home_url( self::FAILED_URI );
     436        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_LANGUAGE_CODE, $values );
     437        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_ADDITIONAL_VARIABLES, $values, $order );
     438        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_MERCHANT_SUCCESS_URL, $values, $return_url );
     439        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_MERCHANT_FAIL_URL, $values, $fail_url );
     440        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_REDIRECT_RETURN_URL, $values, home_url( '/checkout' ) );
     441        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_MERCHANT_RETURN_URL, $values, esc_url_raw( $order->get_checkout_payment_url() ) );
     442        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_MERCHANT_CALLBACK_URL, $values );
     443        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_REDIRECT_SUCCESS_URL, $values, $return_url );
     444        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_REDIRECT_FAIL_URL, $values, $fail_url );
     445        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_GATEWAY_ARGUMENTS . $gateway->id, $values, $order );
     446        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_VERSIONS, $values );
     447        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_INTERFACE_TYPE, $values, true );
     448        $values = apply_filters( EcpAppendsFilters::ECP_APPEND_CARD_OPERATION_TYPE, $values, $order );
    427449
    428450        // Clean arguments and return
    429         return apply_filters( EcpFiltersList::ECP_PAYMENT_PAGE_CLEAN_PARAMETERS, $values );
     451        return apply_filters( EcpFilters::ECP_PAYMENT_PAGE_CLEAN_PARAMETERS, $values );
    430452    }
    431453
     
    440462            $order_id  = wc_get_order_id_by_order_key( $order_key );
    441463            $order     = ecp_get_order( $order_id );
     464            if ( ! $order->is_ecp() ) {
     465                return;
     466            }
    442467
    443468            ?>
     
    445470                // order-receive page status (ty page or failed)
    446471                const order_is_failed = <?= ( $order->get_status() == 'failed' ) ? 'true' : 'false' ?>;
     472
     473                jQuery(document).ready(() => {
     474                    jQuery(document.body).append(
     475                        '<div id="ecommpay-overlay-loader" class="blockUI blockOverlay ecommpay-loader-overlay" style="display: none;"></div>'
     476                    )
     477                })
     478                function showOverlayLoader() {
     479                    jQuery('#ecommpay-overlay-loader').show()
     480                }
     481                function hideOverlayLoader() {
     482                    jQuery('#ecommpay-overlay-loader').hide()
     483                }
    447484
    448485                let result = {}
     
    465502                            location.reload()
    466503                        } else {
    467                             let loader = jQuery('.blockUI')
    468                             if (loader.length > 0) {
    469                                 loader[0].remove()
    470                             }
     504                            hideOverlayLoader();
    471505                            return
    472506                        }
    473                     } else if ((jQuery('.blockUI').length < 1) && (document.getElementsByTagName('body').length > 0)) {
    474                         document.getElementsByTagName('body')[0].innerHTML += '<div class="blockUI blockOverlay ecommpay-loader-overlay"></div>'
     507                    } else {
     508                        showOverlayLoader();
    475509                    }
    476510                    setTimeout(get_status, 400)
     
    493527
    494528        // register hooks for AJAX requests
    495         add_action( EcpApiFilterList::WP_AJAX_ECOMMPAY_PROCESS, [ $this, 'ajax_process' ] ); // Authorised user
    496         add_action( EcpApiFilterList::WP_AJAX_ECOMMPAY_BREAK, [ $this, 'ajax_process' ] ); // Authorised user
    497         add_action( EcpApiFilterList::WP_AJAX_NOPRIV_ECOMMPAY_PROCESS, [
     529        add_action( EcpApiFilters::WP_AJAX_ECOMMPAY_PROCESS, [ $this, 'ajax_process' ] ); // Authorised user
     530        add_action( EcpApiFilters::WP_AJAX_ECOMMPAY_BREAK, [ $this, 'ajax_process' ] ); // Authorised user
     531        add_action( EcpApiFilters::WP_AJAX_NOPRIV_ECOMMPAY_PROCESS, [
    498532            $this,
    499533            'ajax_process'
    500534        ] ); // Non-authorised user: Guest access
    501         add_action( EcpApiFilterList::WP_AJAX_NOPRIV_ECOMMPAY_BREAK, [
     535        add_action( EcpApiFilters::WP_AJAX_NOPRIV_ECOMMPAY_BREAK, [
    502536            $this,
    503537            'ajax_process'
    504538        ] ); // Non-authorised user: Guest access
    505         add_action( EcpApiFilterList::WP_AJAX_GET_DATA_FOR_PAYMENT_FORM, [ $this, 'ajax_process' ] ); // Authorised user
    506         add_action( EcpApiFilterList::WP_AJAX_NOPRIV_GET_DATA_FOR_PAYMENT_FORM, [
     539        add_action( EcpApiFilters::WP_AJAX_GET_DATA_FOR_PAYMENT_FORM, [ $this, 'ajax_process' ] ); // Authorised user
     540        add_action( EcpApiFilters::WP_AJAX_NOPRIV_GET_DATA_FOR_PAYMENT_FORM, [
    507541            $this,
    508542            'ajax_process'
    509543        ] ); // Non-authorised user: Guest access
    510         add_action( EcpApiFilterList::WP_AJAX_GET_PAYMENT_STATUS, [ $this, 'ajax_process' ] ); // Authorised user
    511         add_action( EcpApiFilterList::WP_AJAX_NOPRIV_GET_PAYMENT_STATUS, [
     544        add_action( EcpApiFilters::WP_AJAX_GET_PAYMENT_STATUS, [ $this, 'ajax_process' ] ); // Authorised user
     545        add_action( EcpApiFilters::WP_AJAX_NOPRIV_GET_PAYMENT_STATUS, [
    512546            $this,
    513547            'ajax_process'
    514548        ] ); // Non-authorised user: Guest access
    515         add_action( EcpApiFilterList::WP_AJAX_CHECK_CART_AMOUNT, [ $this, 'ajax_process' ] ); // Authorised user
    516         add_action( EcpApiFilterList::WP_AJAX_NOPRIV_CHECK_CART_AMOUNT, [
     549        add_action( EcpApiFilters::WP_AJAX_CHECK_CART_AMOUNT, [ $this, 'ajax_process' ] ); // Authorised user
     550        add_action( EcpApiFilters::WP_AJAX_NOPRIV_CHECK_CART_AMOUNT, [
    517551            $this,
    518552            'ajax_process'
    519553        ] ); // Non-authorised user: Guest access
    520         add_action( EcpApiFilterList::WP_AJAX_ADD_PAYMENT_ID_TO_ORDER, [ $this, 'ajax_process' ] ); // Authorised user
    521         add_action( EcpApiFilterList::WP_AJAX_NOPRIV_ADD_PAYMENT_ID_TO_ORDER, [
     554        add_action( EcpApiFilters::WP_AJAX_ADD_PAYMENT_ID_TO_ORDER, [ $this, 'ajax_process' ] ); // Authorised user
     555        add_action( EcpApiFilters::WP_AJAX_NOPRIV_ADD_PAYMENT_ID_TO_ORDER, [
    522556            $this,
    523557            'ajax_process'
     
    526560
    527561        // register hooks for display payment form on block-based checkout page
    528         add_action( EcpWCFilterList::WOOCOMMERCE_BLOCKS_ENQUEUE_CHECKOUT_BLOCK_SCRIPTS_BEFORE, [
     562        add_action( EcpWCFilters::WOOCOMMERCE_BLOCKS_ENQUEUE_CHECKOUT_BLOCK_SCRIPTS_BEFORE, [
    529563            $this,
    530564            'include_new_checkout_scripts'
    531565        ] );
    532         add_action( EcpFiltersList::ENQUEUE_BLOCK_EDITOR_ASSETS, [ $this, 'include_new_checkout_scripts' ] );
     566        add_action( EcpWPFilters::ENQUEUE_BLOCK_EDITOR_ASSETS, [ $this, 'include_new_checkout_scripts' ] );
    533567
    534568        // register hooks for additional container on checkout pages
    535         add_filter( EcpFiltersList::THE_CONTENT, [ $this, 'append_iframe_container' ] );
    536 
    537         add_action( EcpFiltersList::WP_HEAD, [ $this, 'wc_custom_redirect_after_purchase' ] );
     569        add_filter( EcpWPFilters::THE_CONTENT, [ $this, 'append_iframe_container' ] );
     570
     571        add_action( EcpWPFilters::WP_HEAD, [ $this, 'wc_custom_redirect_after_purchase' ] );
     572
     573        add_action( EcpWPFilters::TEMPLATE_REDIRECT, [ $this, 'payment_fail_notice' ] );
     574    }
     575
     576    /**
     577     * @return void
     578     */
     579    public function payment_fail_notice() {
     580        if ( is_checkout() && isset( $_GET['payment_failed'] ) ) {
     581            wc_add_notice( __( 'Payment was declined. You can try another payment method.', 'woo-ecommpay' ), 'error' );
     582        }
    538583    }
    539584
  • ecommpay-payments/trunk/common/settings/EcpSettings.php

    r3239955 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    148148     */
    149149    public function get_settings(): array {
    150         return apply_filters( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [] );
     150        return apply_filters( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [] );
    151151    }
    152152
  • ecommpay-payments/trunk/common/settings/EcpSettingsApplepay.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    4040        parent::__construct();
    4141
    42         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_apple_pay_methods' ] );
     42        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_apple_pay_methods' ] );
    4343    }
    4444
  • ecommpay-payments/trunk/common/settings/EcpSettingsBanks.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    4040        parent::__construct();
    4141
    42         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_banks_methods' ] );
     42        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_banks_methods' ] );
    4343    }
    4444
  • ecommpay-payments/trunk/common/settings/EcpSettingsBlik.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    4040        parent::__construct();
    4141
    42         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_blik_methods' ] );
     42        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_blik_methods' ] );
    4343    }
    4444
  • ecommpay-payments/trunk/common/settings/EcpSettingsBrazilOnline_Banks.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    4040        parent::__construct();
    4141
    42         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_brazil_methods' ] );
     42        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_brazil_methods' ] );
    4343    }
    4444
  • ecommpay-payments/trunk/common/settings/EcpSettingsCard.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    3838        parent::__construct();
    3939
    40         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_card' ] );
     40        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_card' ] );
    4141    }
    4242
  • ecommpay-payments/trunk/common/settings/EcpSettingsDirectDebitBACS.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    4040        parent::__construct();
    4141
    42         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_directdebit_bacs' ] );
     42        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_directdebit_bacs' ] );
    4343    }
    4444
  • ecommpay-payments/trunk/common/settings/EcpSettingsDirectDebitSEPA.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    4040        parent::__construct();
    4141
    42         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_directdebit_sepa' ] );
     42        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_directdebit_sepa' ] );
    4343    }
    4444
  • ecommpay-payments/trunk/common/settings/EcpSettingsGeneral.php

    r3239955 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66use WC_Log_Levels;
    77
     
    7777
    7878        add_filter( 'ecp_' . $this->id . '_settings', [ $this, 'add_uninstall_setting' ] );
    79         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_general' ] );
     79        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_general' ] );
    8080    }
    8181
  • ecommpay-payments/trunk/common/settings/EcpSettingsGiropay.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    4040        parent::__construct();
    4141
    42         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_giropay_methods' ] );
     42        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_giropay_methods' ] );
    4343    }
    4444
  • ecommpay-payments/trunk/common/settings/EcpSettingsGooglepay.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    4040        parent::__construct();
    4141
    42         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_google_pay_methods' ] );
     42        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_google_pay_methods' ] );
    4343    }
    4444
  • ecommpay-payments/trunk/common/settings/EcpSettingsIdeal.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    4040        parent::__construct();
    4141
    42         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_ideal_methods' ] );
     42        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_ideal_methods' ] );
    4343    }
    4444
  • ecommpay-payments/trunk/common/settings/EcpSettingsKlarna.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    4040        parent::__construct();
    4141
    42         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_klarna_methods' ] );
     42        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_klarna_methods' ] );
    4343    }
    4444
  • ecommpay-payments/trunk/common/settings/EcpSettingsMore.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    3939        parent::__construct();
    4040
    41         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_more_methods' ] );
     41        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_more_methods' ] );
    4242    }
    4343
  • ecommpay-payments/trunk/common/settings/EcpSettingsPayPal.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    4040        parent::__construct();
    4141
    42         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_paypal_methods' ] );
     42        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_paypal_methods' ] );
    4343    }
    4444
  • ecommpay-payments/trunk/common/settings/EcpSettingsPayPalPayLater.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    3434        parent::__construct();
    3535
    36         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [
     36        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [
    3737            $this,
    3838            'get_settings_paypal_paylater_methods'
  • ecommpay-payments/trunk/common/settings/EcpSettingsProducts.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    3030        $this->context = self::CONTEXT;
    3131
    32         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_products' ] );
     32        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_products' ] );
    3333
    3434        parent::__construct();
  • ecommpay-payments/trunk/common/settings/EcpSettingsSofort.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    4040        parent::__construct();
    4141
    42         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_sofort_methods' ] );
     42        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_sofort_methods' ] );
    4343    }
    4444
  • ecommpay-payments/trunk/common/settings/EcpSettingsSubscriptions.php

    r3218798 r3267715  
    33namespace common\settings;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66
    77defined( 'ABSPATH' ) || exit;
     
    3131        $this->context = self::CONTEXT;
    3232
    33         add_filter( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_subscriptions' ] );
     33        add_filter( EcpFilters::ECP_PREFIX_GET_SETTINGS . $this->id, [ $this, 'get_settings_subscriptions' ] );
    3434
    3535        parent::__construct();
  • ecommpay-payments/trunk/common/settings/forms/EcpForm.php

    r3239955 r3267715  
    44
    55use common\helpers\EcpGatewayRegistry;
    6 use common\includes\filters\EcpFiltersList;
    7 use common\includes\filters\EcpHtmlFilterList;
     6use common\includes\filters\EcpFilters;
     7use common\includes\filters\EcpHtmlFilters;
     8use common\includes\filters\EcpWPFilters;
    89use common\settings\EcpSettings;
    910use common\settings\EcpSettingsGeneral;
     
    102103            }
    103104
    104             $value = apply_filters( EcpFiltersList::ECP_FIELD_NORMALISATION, $value );
     105            $value = apply_filters( EcpFilters::ECP_FIELD_NORMALISATION, $value );
    105106            do_action(
    106107                'ecp_html_render_field_' . $value['type'],
     
    271272                        $this,
    272273                        'set_defaults'
    273                     ], apply_filters( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $tab->get_id(), [] ) )
     274                    ], apply_filters( EcpFilters::ECP_PREFIX_GET_SETTINGS . $tab->get_id(), [] ) )
    274275                )
    275276            );
     
    295296                $this,
    296297                'set_defaults'
    297             ], apply_filters( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $current_tab, [] ) )
     298            ], apply_filters( EcpFilters::ECP_PREFIX_GET_SETTINGS . $current_tab, [] ) )
    298299        );
    299300    }
     
    434435     */
    435436    protected function init(): void {
    436         add_filter( EcpFiltersList::ECP_FIELD_NORMALISATION, [ $this, 'normalize_field' ] );
    437 
    438         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_SECTION_START, [ $this, 'render_fieldset_start' ] );
    439         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_SECTION_END, [ $this, 'render_fieldset_end' ] );
    440         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_SECTION_DESCRIPTION, [
     437        add_filter( EcpFilters::ECP_FIELD_NORMALISATION, [ $this, 'normalize_field' ] );
     438
     439        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_SECTION_START, [ $this, 'render_fieldset_start' ] );
     440        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_SECTION_END, [ $this, 'render_fieldset_end' ] );
     441        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_SECTION_DESCRIPTION, [
    441442            $this,
    442443            'render_field_description'
    443444        ] );
    444445
    445         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_TOGGLE_START, [ $this, 'render_toggle_start' ] );
    446         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_TOGGLE_END, [ $this, 'render_toggle_end' ] );
    447         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_TEXT, [ $this, 'render_field_input' ] );
    448         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_PASSWORD, [ $this, 'render_field_input' ] );
    449         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_DATETIME, [ $this, 'render_field_input' ] );
    450         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_DATETIME_LOCAL, [ $this, 'render_field_input' ] );
    451         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_DATE, [ $this, 'render_field_input' ] );
    452         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_MONTH, [ $this, 'render_field_input' ] );
    453         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_TIME, [ $this, 'render_field_input' ] );
    454         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_WEEK, [ $this, 'render_field_input' ] );
    455         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_NUMBER, [ $this, 'render_field_input' ] );
    456         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_EMAIL, [ $this, 'render_field_input' ] );
    457         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_URL, [ $this, 'render_field_input' ] );
    458         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_TEL, [ $this, 'render_field_input' ] );
    459         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_COLOR, [ $this, 'render_field_color' ] );
    460         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_TEXTAREA, [ $this, 'render_field_text' ] );
    461         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_SELECT, [ $this, 'render_field_select' ] );
    462         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_MULTISELECT, [ $this, 'render_field_select' ] );
    463         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_RADIO, [ $this, 'render_field_radio' ] );
    464         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_CHECKBOX, [ $this, 'render_field_checkbox' ] );
    465         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_SINGLE_SELECT_PAGE, [
     446        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_TOGGLE_START, [ $this, 'render_toggle_start' ] );
     447        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_TOGGLE_END, [ $this, 'render_toggle_end' ] );
     448        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_TEXT, [ $this, 'render_field_input' ] );
     449        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_PASSWORD, [ $this, 'render_field_input' ] );
     450        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_DATETIME, [ $this, 'render_field_input' ] );
     451        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_DATETIME_LOCAL, [ $this, 'render_field_input' ] );
     452        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_DATE, [ $this, 'render_field_input' ] );
     453        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_MONTH, [ $this, 'render_field_input' ] );
     454        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_TIME, [ $this, 'render_field_input' ] );
     455        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_WEEK, [ $this, 'render_field_input' ] );
     456        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_NUMBER, [ $this, 'render_field_input' ] );
     457        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_EMAIL, [ $this, 'render_field_input' ] );
     458        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_URL, [ $this, 'render_field_input' ] );
     459        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_TEL, [ $this, 'render_field_input' ] );
     460        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_COLOR, [ $this, 'render_field_color' ] );
     461        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_TEXTAREA, [ $this, 'render_field_text' ] );
     462        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_SELECT, [ $this, 'render_field_select' ] );
     463        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_MULTISELECT, [ $this, 'render_field_select' ] );
     464        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_RADIO, [ $this, 'render_field_radio' ] );
     465        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_CHECKBOX, [ $this, 'render_field_checkbox' ] );
     466        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_SINGLE_SELECT_PAGE, [
    466467            $this,
    467468            'render_field_single_select_page'
    468469        ] );
    469         add_action( EcpHtmlFilterList::ECP_HTML_RENDER_FIELD_SINGLE_SELECT_COUNTRY, [
     470        add_action( EcpHtmlFilters::ECP_HTML_RENDER_FIELD_SINGLE_SELECT_COUNTRY, [
    470471            $this,
    471472            'render_field_single_select_country'
    472473        ] );
    473         add_action( EcpFiltersList::WP_ADMIN_NOTICES_FILTER, [ $this, 'admin_notice_settings' ] );
     474        add_action( EcpWPFilters::WP_ADMIN_NOTICES_FILTER, [ $this, 'admin_notice_settings' ] );
    474475
    475476        $this->ecp_tab_manager->init_tabs();
  • ecommpay-payments/trunk/common/settings/forms/EcpSettingsManager.php

    r3227972 r3267715  
    33namespace common\settings\forms;
    44
    5 use common\includes\filters\EcpFiltersList;
     5use common\includes\filters\EcpFilters;
    66use common\install\EcpGatewayInstall;
    77use common\settings\EcpSettings;
     
    8989                apply_filters( 'woocommerce_settings_api_form_fields_' . $tab->get_id(),
    9090                    array_map( [ $this->ecp_form, 'set_defaults' ],
    91                         apply_filters( EcpFiltersList::ECP_PREFIX_GET_SETTINGS . $tab->get_id(), [] ) ) ) as $value
     91                        apply_filters( EcpFilters::ECP_PREFIX_GET_SETTINGS . $tab->get_id(), [] ) ) ) as $value
    9292            ) {
    9393                $default = $this->get_field_default( $value );
  • ecommpay-payments/trunk/common/settings/forms/EcpTabManager.php

    r3218798 r3267715  
    33namespace common\settings\forms;
    44
    5 use common\includes\filters\EcpHtmlFilterList;
     5use common\includes\filters\EcpHtmlFilters;
    66use common\settings\EcpSettings;
    77use common\settings\EcpSettingsApplepay;
     
    6363            ];
    6464
    65             $this->tabs = apply_filters( EcpHtmlFilterList::ECP_GET_SETTINGS_PAGES, $tabs );
     65            $this->tabs = apply_filters( EcpHtmlFilters::ECP_GET_SETTINGS_PAGES, $tabs );
    6666        }
    6767    }
  • ecommpay-payments/trunk/gateway-ecommpay.php

    r3245713 r3267715  
    55 * GitHub Plugin URI:
    66 * Description:       Easy payment from WooCommerce by different methods in single Payment Page.
    7  * Version:           4.0.4
     7 * Version:           4.1.0
    88 * License:           GPL2
    99 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
  • ecommpay-payments/trunk/helpers/ecp-order.php

    r3218798 r3267715  
    88use common\includes\EcpGatewayRefund;
    99use common\includes\EcpGatewaySubscription;
    10 use common\includes\filters\EcpWCFilterList;
     10use common\includes\filters\EcpWCFilters;
    1111
    1212const NON_DECIMAL_CURRENCIES = [
     
    139139    }
    140140
    141     $args = apply_filters( EcpWCFilterList::WOOCOMMERCE_ECOMMPAY_CALLBACK_ARGS, $args, $post_id );
     141    $args = apply_filters( EcpWCFilters::WOOCOMMERCE_ECOMMPAY_CALLBACK_ARGS, $args, $post_id );
    142142
    143143    // For testing purposes
    144144    $callback_url = getenv( 'WORDPRESS_CALLBACK_URL' ) ?: home_url( '/' );
    145145
    146     return apply_filters( EcpWCFilterList::WOOCOMMERCE_ECOMMPAY_CALLBACK_URL, add_query_arg( $args, $callback_url ), $args, $post_id );
     146    return apply_filters( EcpWCFilters::WOOCOMMERCE_ECOMMPAY_CALLBACK_URL, add_query_arg( $args, $callback_url ), $args, $post_id );
    147147}
    148148
  • ecommpay-payments/trunk/helpers/ecp-payment.php

    r3218798 r3267715  
    66use common\helpers\EcpGatewayOperationType;
    77use common\helpers\EcpGatewayPaymentStatus;
    8 use common\includes\filters\EcpFiltersList;
     8use common\includes\filters\EcpFilters;
    99
    1010/**
     
    1818    $payment_statuses = EcpGatewayPaymentStatus::get_status_names();
    1919
    20     return apply_filters( EcpFiltersList::ECP_PAYMENT_STATUSES, $payment_statuses );
     20    return apply_filters( EcpFilters::ECP_PAYMENT_STATUSES, $payment_statuses );
    2121}
    2222
     
    5656    return EcpGatewayOperationType::get_status_name( $status );
    5757}
     58
     59function generateNewPaymentId( ?WC_Order $order ): string {
     60    $paymentId = uniqid( 'wp_' );
     61    if ( $orderId = $order ? $order->get_id() : null ) {
     62        $paymentId = $paymentId . '_' . (string)($orderId);
     63    }
     64    return $paymentId;
     65}
  • ecommpay-payments/trunk/helpers/ecp-subscription.php

    r3218798 r3267715  
    55
    66use common\includes\EcpGatewayOrder;
    7 use common\includes\filters\EcpWCFilterList;
    87use common\includes\EcpGatewaySubscription;
     8use common\includes\filters\EcpWCFilters;
    99
    1010/**
     
    5555 *
    5656 * @return EcpGatewaySubscription|EcpGatewaySubscription[]
    57  * @noinspection PhpUndefinedClassInspection
    5857 */
    5958function ecp_get_subscriptions_for_renewal_order( $order, bool $single = false ) {
    6059    if ( function_exists( 'wcs_get_subscriptions_for_renewal_order' ) ) {
    6160        add_filter(
    62             EcpWCFilterList::WOOCOMMERCE_ORDER_CLASS,
     61            EcpWCFilters::WOOCOMMERCE_ORDER_CLASS,
    6362            [ ecommpay(), 'type_wrapper' ],
    6463            101,
     
    6968
    7069        remove_filter(
    71             EcpWCFilterList::WOOCOMMERCE_ORDER_CLASS,
     70            EcpWCFilters::WOOCOMMERCE_ORDER_CLASS,
    7271            [ ecommpay(), 'type_wrapper' ],
    7372            101
     
    9594 *
    9695 * @return false|WC_Subscription|WC_Subscription[]
    97  * @noinspection PhpUndefinedClassInspection
    9896 */
    9997function ecp_get_subscriptions_for_resubscribe_order( $order, bool $single = false ) {
    10098    if ( function_exists( 'wcs_get_subscriptions_for_resubscribe_order' ) ) {
    10199        add_filter(
    102             EcpWCFilterList::WOOCOMMERCE_ORDER_CLASS,
     100            EcpWCFilters::WOOCOMMERCE_ORDER_CLASS,
    103101            [ ecommpay(), 'type_wrapper' ],
    104102            101,
     
    109107
    110108        remove_filter(
    111             EcpWCFilterList::WOOCOMMERCE_ORDER_CLASS,
     109            EcpWCFilters::WOOCOMMERCE_ORDER_CLASS,
    112110            [ ecommpay(), 'type_wrapper' ],
    113111            101
     
    134132 *
    135133 * @return WC_Subscription[]
    136  * @noinspection PhpUndefinedClassInspection
    137134 */
    138135function ecp_get_subscriptions_for_order( $order ): array {
  • ecommpay-payments/trunk/helpers/notices.php

    r3218798 r3267715  
    55
    66use common\exceptions\EcpGatewayErrorException;
    7 use common\includes\filters\EcpFiltersList;
     7use common\includes\filters\EcpWPFilters;
    88
    99/**
     
    109109}
    110110
    111 add_action( EcpFiltersList::WP_ADMIN_NOTICES_FILTER, 'woocommerce_ecommpay_display_admin_notices', 100 );
     111add_action( EcpWPFilters::WP_ADMIN_NOTICES_FILTER, 'woocommerce_ecommpay_display_admin_notices', 100 );
    112112
    113113/**
     
    132132}
    133133
    134 add_action( EcpFiltersList::WP_ADMIN_NOTICES_FILTER, 'woocommerce_ecommpay_display_dismissible_admin_notices', 100 );
     134add_action( EcpWPFilters::WP_ADMIN_NOTICES_FILTER, 'woocommerce_ecommpay_display_dismissible_admin_notices', 100 );
    135135
    136136/**
     
    164164             || version_compare( PHP_VERSION, $required_php_version, '<' )
    165165             || version_compare( WC_VERSION, $required_wc_version, '<' ) ) {
    166             add_action( EcpFiltersList::WP_ADMIN_NOTICES_FILTER, function () use ( $required_wp_version, $required_php_version, $required_wc_version ) {
     166            add_action( EcpWPFilters::WP_ADMIN_NOTICES_FILTER, function () use ( $required_wp_version, $required_php_version, $required_wc_version ) {
    167167                $ecommpay_domain = 'woo-ecommpay';
    168168                $woo_website     = 'https://woocommerce.com/document/update-php-wordpress/';
  • ecommpay-payments/trunk/helpers/permissions.php

    r3218798 r3267715  
    11<?php
    22
    3 use common\includes\filters\EcpWCFilterList;
     3use common\includes\filters\EcpWCFilters;
    44
    55defined( 'ABSPATH' ) || exit;
     
    1010     */
    1111    function woocommerce_ecommpay_can_user_empty_logs() {
    12         return apply_filters( EcpWCFilterList::WOOCOMMERCE_ECOMMPAY_CAN_USER_EMPTY_LOGS, current_user_can( 'administrator' ) );
     12        return apply_filters( EcpWCFilters::WOOCOMMERCE_ECOMMPAY_CAN_USER_EMPTY_LOGS, current_user_can( 'administrator' ) );
    1313    }
    1414}
     
    1919     */
    2020    function woocommerce_ecommpay_can_user_flush_cache() {
    21         return apply_filters( EcpWCFilterList::WOOCOMMERCE_ECOMMPAY_CAN_USER_FLUSH_CACHE, current_user_can( 'administrator' ) );
     21        return apply_filters( EcpWCFilters::WOOCOMMERCE_ECOMMPAY_CAN_USER_FLUSH_CACHE, current_user_can( 'administrator' ) );
    2222    }
    2323}
     
    3232        $default_cap = current_user_can( 'manage_woocommerce' );
    3333
    34         $cap = apply_filters( EcpWCFilterList::WOOCOMMERCE_ECOMMPAY_CAN_USER_MANAGE_PAYMENT, $default_cap );
     34        $cap = apply_filters( EcpWCFilters::WOOCOMMERCE_ECOMMPAY_CAN_USER_MANAGE_PAYMENT, $default_cap );
    3535
    3636        if ( ! empty ( $action ) ) {
    37             $cap = apply_filters( EcpWCFilterList::WOOCOMMERCE_ECOMMPAY_CAN_USER_MANAGE_PAYMENT_PREFIX . $action, $default_cap );
     37            $cap = apply_filters( EcpWCFilters::WOOCOMMERCE_ECOMMPAY_CAN_USER_MANAGE_PAYMENT_PREFIX . $action, $default_cap );
    3838        }
    3939
  • ecommpay-payments/trunk/readme.txt

    r3245713 r3267715  
    44Requires at least: 6.2
    55Tested up to: 6.7
    6 Stable tag: 4.0.4
     6Stable tag: 4.1.0
    77License: GPLv2
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6262
    6363== Changelog ==
     64= 4.1.0 =
     65* Added a convenient option to make a repeat payment
     66
    6467= 4.0.1 =
    6568* Dev: Code reformatting
  • ecommpay-payments/trunk/src/components/WidgetEmbedded.tsx

    r3218798 r3267715  
    100100        onFail: () => {
    101101          hideOverlayLoader()
     102          runIframe()
    102103          resolve({
    103104            type: props.emitResponse.responseTypes.FAIL,
  • ecommpay-payments/trunk/src/components/WidgetPopup.tsx

    r3218798 r3267715  
    2626                type: props.emitResponse.responseTypes.ERROR,
    2727                messageContext: props.emitResponse.noticeContexts.PAYMENTS,
    28                 message: 'Payment failed',
     28                message: 'Payment was declined. You can try another payment method.',
    2929                retry: true,
    3030              })
Note: See TracChangeset for help on using the changeset viewer.