|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Pronamic\WordPress\Pay\Gateways\Buckaroo; |
|
4
|
|
|
|
|
5
|
|
|
use Pronamic\WordPress\Pay\Core\PaymentMethods as Core_PaymentMethods; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Title: Buckaroo payment methods constants |
|
9
|
|
|
* Description: |
|
10
|
|
|
* Copyright: 2005-2022 Pronamic |
|
11
|
|
|
* Company: Pronamic |
|
12
|
|
|
* |
|
13
|
|
|
* @author Remco Tolsma |
|
14
|
|
|
* @version 3.0.2 |
|
15
|
|
|
* @since 1.0.0 |
|
16
|
|
|
*/ |
|
17
|
|
|
class PaymentMethods { |
|
18
|
|
|
/** |
|
19
|
|
|
* Indicator for the 'Achteraf Betalen' payment method |
|
20
|
|
|
* |
|
21
|
|
|
* @var string |
|
22
|
|
|
*/ |
|
23
|
|
|
const PAYMENT_GUARANTEE = 'paymentguarantee'; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Indicator for the 'American Express' payment method |
|
27
|
|
|
* |
|
28
|
|
|
* @var string |
|
29
|
|
|
*/ |
|
30
|
|
|
const AMERICAN_EXPRESS = 'amex'; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Indicator for the 'Bancontact / Mr Cash' payment method |
|
34
|
|
|
* |
|
35
|
|
|
* @var string |
|
36
|
|
|
*/ |
|
37
|
|
|
const BANCONTACT_MISTER_CASH = 'bancontactmrcash'; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Indicator for the 'èM! Payment' payment method |
|
41
|
|
|
* |
|
42
|
|
|
* @var string |
|
43
|
|
|
*/ |
|
44
|
|
|
const EM_PAYMENT = 'empayment'; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Indicator for the 'Giropay' payment method |
|
48
|
|
|
* |
|
49
|
|
|
* @var string |
|
50
|
|
|
*/ |
|
51
|
|
|
const GIROPAY = 'giropay'; |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Indicator for the 'iDEAL' payment method |
|
55
|
|
|
* |
|
56
|
|
|
* @var string |
|
57
|
|
|
*/ |
|
58
|
|
|
const IDEAL = 'ideal'; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Indicator for the 'Maestro' payment method |
|
62
|
|
|
* |
|
63
|
|
|
* @var string |
|
64
|
|
|
*/ |
|
65
|
|
|
const MAESTRO = 'maestro'; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Indicator for the 'MasterCard' payment method |
|
69
|
|
|
* |
|
70
|
|
|
* @var string |
|
71
|
|
|
*/ |
|
72
|
|
|
const MASTERCARD = 'mastercard'; |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* Indicator for the 'Overschrijving' payment method |
|
76
|
|
|
* |
|
77
|
|
|
* @var string |
|
78
|
|
|
*/ |
|
79
|
|
|
const TRANSFER = 'transfer'; |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* Indicator for the 'PayPal' payment method |
|
83
|
|
|
* |
|
84
|
|
|
* @var string |
|
85
|
|
|
*/ |
|
86
|
|
|
const PAYPAL = 'paypal'; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Indicator for the 'paysafecard' payment method |
|
90
|
|
|
* |
|
91
|
|
|
* @var string |
|
92
|
|
|
*/ |
|
93
|
|
|
const PAYSAFECARD = 'paysafecard'; |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* Indicator for the 'Sofortüberweisung' payment method |
|
97
|
|
|
* |
|
98
|
|
|
* @var string |
|
99
|
|
|
*/ |
|
100
|
|
|
const SOFORTUEBERWEISING = 'sofortueberweisung'; |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Indicator for the 'Ukash' payment method |
|
104
|
|
|
* |
|
105
|
|
|
* @var string |
|
106
|
|
|
*/ |
|
107
|
|
|
const UKASH = 'Ukash'; |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* Indicator for the 'Visa' payment method |
|
111
|
|
|
* |
|
112
|
|
|
* @var string |
|
113
|
|
|
*/ |
|
114
|
|
|
const VISA = 'visa'; |
|
115
|
|
|
|
|
116
|
|
|
/** |
|
117
|
|
|
* Indicator for the 'V PAY' payment method. |
|
118
|
|
|
* |
|
119
|
|
|
* @var string |
|
120
|
|
|
*/ |
|
121
|
|
|
const V_PAY = 'vpay'; |
|
122
|
|
|
|
|
123
|
|
|
/** |
|
124
|
|
|
* Payments methods map. |
|
125
|
|
|
* |
|
126
|
|
|
* @var array<string, string> |
|
127
|
|
|
*/ |
|
128
|
|
|
private static $map = array( |
|
129
|
|
|
Core_PaymentMethods::AMERICAN_EXPRESS => self::AMERICAN_EXPRESS, |
|
130
|
|
|
Core_PaymentMethods::BANK_TRANSFER => self::TRANSFER, |
|
131
|
|
|
Core_PaymentMethods::BANCONTACT => self::BANCONTACT_MISTER_CASH, |
|
132
|
|
|
Core_PaymentMethods::MISTER_CASH => self::BANCONTACT_MISTER_CASH, |
|
133
|
|
|
Core_PaymentMethods::GIROPAY => self::GIROPAY, |
|
134
|
|
|
Core_PaymentMethods::IDEAL => self::IDEAL, |
|
135
|
|
|
Core_PaymentMethods::MAESTRO => self::MAESTRO, |
|
136
|
|
|
Core_PaymentMethods::MASTERCARD => self::MASTERCARD, |
|
137
|
|
|
Core_PaymentMethods::PAYPAL => self::PAYPAL, |
|
138
|
|
|
Core_PaymentMethods::SOFORT => self::SOFORTUEBERWEISING, |
|
139
|
|
|
Core_PaymentMethods::V_PAY => self::V_PAY, |
|
140
|
|
|
Core_PaymentMethods::VISA => self::VISA, |
|
141
|
|
|
); |
|
142
|
|
|
|
|
143
|
|
|
/** |
|
144
|
|
|
* Transform WordPress payment method to Buckaroo method. |
|
145
|
|
|
* |
|
146
|
|
|
* @since 1.1.6 |
|
147
|
|
|
* |
|
148
|
|
|
* @param string $payment_method WordPress payment method to transform to Buckaroo method. |
|
149
|
|
|
* @param null|string $default Default payment method. |
|
150
|
|
|
* |
|
151
|
|
|
* @return string|null |
|
152
|
|
|
*/ |
|
153
|
|
|
public static function transform( $payment_method, $default = null ) { |
|
154
|
|
|
if ( ! is_scalar( $payment_method ) ) { |
|
|
|
|
|
|
155
|
|
|
return null; |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
if ( isset( self::$map[ $payment_method ] ) ) { |
|
159
|
|
|
return self::$map[ $payment_method ]; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
return $default; |
|
163
|
|
|
} |
|
164
|
|
|
} |
|
165
|
|
|
|