1+ /**
2+ * Represents the configuration for a payment method
3+ */
4+ export interface PaymentMethod {
5+ id : string ;
6+ name : string ;
7+ className : string ; // CSS class used to identify the method
8+ isApplicableToSubscription : boolean ;
9+ paymentProcessFunction : string ; // Name of the function to process this payment
10+ isHostedPayment : boolean ; // Whether payment happens on external page
11+ countriesSupported : string [ ] ; // ISO country codes where this method is available
12+ selector : {
13+ classic : string ;
14+ block : string ;
15+ } ;
16+ presetCredentials : string ;
17+ }
18+
19+ /**
20+ * Available payment methods in the MONEI gateway
21+ */
22+ export const PAYMENT_METHODS : Record < string , PaymentMethod > = {
23+ // Credit Card (with Component)
24+ CREDIT_CARD_SUCCESS : {
25+ id : 'monei' ,
26+ name : 'Credit Card' ,
27+ className : 'wc-monei-credit-card-payment-method' ,
28+ isApplicableToSubscription : true ,
29+ paymentProcessFunction : 'processCreditCardPayment' ,
30+ isHostedPayment : false ,
31+ countriesSupported : [ 'ES' , 'PT' , 'FR' , 'DE' , 'IT' , 'UK' ] , // Example countries
32+ selector : {
33+ classic : 'input[name="payment_method"][value="monei"]' ,
34+ block : '.wc-block-components-radio-control__input[value="monei"]'
35+ } ,
36+ presetCredentials : 'success'
37+ } ,
38+
39+ // Credit Card (with Redirect/Hosted)
40+ CREDIT_CARD_HOSTED : {
41+ id : 'monei' ,
42+ name : 'Credit Card (Hosted)' ,
43+ className : 'wc-monei-credit-card-hosted-payment-method' ,
44+ isApplicableToSubscription : true ,
45+ paymentProcessFunction : 'processCreditCardHostedPayment' ,
46+ isHostedPayment : true ,
47+ countriesSupported : [ 'ES' , 'PT' , 'FR' , 'DE' , 'IT' , 'UK' ] , // Example countries
48+ selector : {
49+ classic : 'input[name="payment_method"][value="monei"]' ,
50+ block : '.wc-block-components-radio-control__input[value="monei"]'
51+ } ,
52+ presetCredentials : 'success'
53+ } ,
54+
55+ // Bizum
56+ BIZUM : {
57+ id : 'monei_bizum' ,
58+ name : 'Bizum' ,
59+ className : 'wc-monei-bizum-payment-method' ,
60+ isApplicableToSubscription : false ,
61+ paymentProcessFunction : 'processBizumPayment' ,
62+ isHostedPayment : true ,
63+ countriesSupported : [ 'ES' ] ,
64+ selector : {
65+ classic : 'input[name="payment_method"][value="monei_bizum"]' ,
66+ block : '.wc-block-components-radio-control__input[value="monei_bizum"]'
67+ } ,
68+ presetCredentials : 'success'
69+ } ,
70+
71+ // PayPal
72+ PAYPAL : {
73+ id : 'monei_paypal' ,
74+ name : 'PayPal' ,
75+ className : 'wc-monei-paypal-payment-method' ,
76+ isApplicableToSubscription : true ,
77+ paymentProcessFunction : 'processPayPalPayment' ,
78+ isHostedPayment : true ,
79+ countriesSupported : [ 'ES' , 'PT' , 'FR' , 'DE' , 'IT' , 'UK' , 'US' ] , // Example countries
80+ selector : {
81+ classic : 'input[name="payment_method"][value="monei_paypal"]' ,
82+ block : '.wc-block-components-radio-control__input[value="monei_paypal"]'
83+ } ,
84+ presetCredentials : 'success'
85+ } ,
86+
87+ // Apple Pay
88+ APPLE_PAY : {
89+ id : 'monei_apple_pay' ,
90+ name : 'Apple Pay' ,
91+ className : 'wc-monei-apple-pay-payment-method' ,
92+ isApplicableToSubscription : true ,
93+ paymentProcessFunction : 'processApplePayPayment' ,
94+ isHostedPayment : false ,
95+ countriesSupported : [ 'ES' , 'PT' , 'FR' , 'DE' , 'IT' , 'UK' , 'US' ] , // Example countries
96+ selector : {
97+ classic : 'input[name="payment_method"][value="monei_apple_pay"]' ,
98+ block : '.wc-block-components-radio-control__input[value="monei_apple_pay"]'
99+ } ,
100+ presetCredentials : 'success'
101+ } ,
102+
103+ // Google Pay
104+ GOOGLE_PAY : {
105+ id : 'monei_google_pay' ,
106+ name : 'Google Pay' ,
107+ className : 'wc-monei-google-pay-payment-method' ,
108+ isApplicableToSubscription : true ,
109+ paymentProcessFunction : 'processGooglePayPayment' ,
110+ isHostedPayment : false ,
111+ countriesSupported : [ 'ES' , 'PT' , 'FR' , 'DE' , 'IT' , 'UK' , 'US' ] , // Example countries
112+ selector : {
113+ classic : 'input[name="payment_method"][value="monei_google_pay"]' ,
114+ block : '.wc-block-components-radio-control__input[value="monei_google_pay"]'
115+ } ,
116+ presetCredentials : 'success'
117+ } ,
118+
119+ // Multibanco
120+ MULTIBANCO : {
121+ id : 'monei_multibanco' ,
122+ name : 'Multibanco' ,
123+ className : 'wc-monei-multibanco-payment-method' ,
124+ isApplicableToSubscription : false ,
125+ paymentProcessFunction : 'processMultibancoPayment' ,
126+ isHostedPayment : true ,
127+ countriesSupported : [ 'PT' ] ,
128+ selector : {
129+ classic : 'input[name="payment_method"][value="monei_multibanco"]' ,
130+ block : '.wc-block-components-radio-control__input[value="monei_multibanco"]'
131+ } ,
132+ presetCredentials : 'success'
133+ } ,
134+
135+ // MBWay
136+ MBWAY : {
137+ id : 'monei_mbway' ,
138+ name : 'MBWay' ,
139+ className : 'wc-monei-mbway-payment-method' ,
140+ isApplicableToSubscription : false ,
141+ paymentProcessFunction : 'processMBWayPayment' ,
142+ isHostedPayment : true ,
143+ countriesSupported : [ 'PT' ] ,
144+ selector : {
145+ classic : 'input[name="payment_method"][value="monei_mbway"]' ,
146+ block : '.wc-block-components-radio-control__input[value="monei_mbway"]'
147+ } ,
148+ presetCredentials : 'success'
149+ } ,
150+ } ;
0 commit comments