-
Notifications
You must be signed in to change notification settings - Fork 222
Expand file tree
/
Copy pathPaymentMethodUtil.php
More file actions
141 lines (135 loc) · 3.29 KB
/
PaymentMethodUtil.php
File metadata and controls
141 lines (135 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php
/**
*
* Adyen Payment Module
*
* Copyright (c) 2023 Adyen N.V.
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Helper\Util;
class PaymentMethodUtil
{
const MANUAL_CAPTURE_SUPPORTED_PAYMENT_METHODS = [
'cup',
'cartebancaire',
'visa',
'visadankort',
'mc',
'uatp',
'amex',
'maestro',
'maestrouk',
'diners',
'discover',
'jcb',
'laser',
'paypal',
'sepadirectdebit',
'ach',
'dankort',
'elo',
'hipercard',
'mc_applepay',
'visa_applepay',
'amex_applepay',
'discover_applepay',
'maestro_applepay',
'cartebancaire_applepay',
'paywithgoogle',
'mc_googlepay',
'visa_googlepay',
'amex_googlepay',
'discover_googlepay',
'maestro_googlepay',
'svs',
'givex',
'valuelink',
'twint',
'carnet',
'pix',
'oney',
'affirm',
'bright',
'amazonpay',
'applepay',
'googlepay',
'mobilepay',
'vipps',
'mc_clicktopay',
'visa_clicktopay',
'visa_amazonpay',
'mc_amazonpay',
'amex_amazonpay',
'discover_amazonpay',
'maestro_amazonpay',
'elo_amazonpay',
'jcb_amazonpay',
'bcmc',
'bcmc_mobile',
'afterpay',
'afterpay_b2b',
'afterpay_default',
'afterpay_directdebit',
'afterpaytouch',
'afterpaytouch_AU',
'afterpaytouch_CA',
'afterpaytouch_NZ',
'afterpaytouch_US',
'clearpay',
'facilypay',
'facilypay_10x',
'facilypay_10x_merchant_pays',
'facilypay_10x_withfees',
'facilypay_12x',
'facilypay_12x_merchant_pays',
'facilypay_12x_withfees',
'facilypay_3x',
'facilypay_3x_merchant_pays',
'facilypay_3x_withfees',
'facilypay_4x',
'facilypay_4x_merchant_pays',
'facilypay_4x_withfees',
'facilypay_6x',
'facilypay_6x_merchant_pays',
'facilypay_6x_withfees',
'facilypay_fr',
'klarna',
'klarna_b2b',
'klarna_paynow',
'klarna_account',
'ratepay',
'ratepay_directdebit',
'walley',
'walley_b2b',
'girocard',
'girocard_applepay',
'scalapay_3x',
'scalapay_4x',
'star',
'nyce',
'carnet',
'accel',
'pulse'
];
/**
* @param string $paymentMethod
* @return bool
*/
public static function isManualCaptureSupported(string $paymentMethod): bool
{
// Check for payment methods with no variants
if (in_array($paymentMethod, self::MANUAL_CAPTURE_SUPPORTED_PAYMENT_METHODS)) {
return true;
}
//Regex pattern for payment methods with variants
$paymentMethodsWithVariants = '/^afterpay|^boleto|^clearpay|^ratepay|^zip/';
//Check the payment methods with variants
if (preg_match($paymentMethodsWithVariants, $paymentMethod)) {
return true;
}
return false;
}
}