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rc.2 3.1.0 6.2.1 3.1.1 6.2.2 3.1.2 6.2.3 3.2.0 6.3.0 3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / src / Admin / Features / PaymentGatewaySuggestions / DefaultPaymentGateways.php
woocommerce / src / Admin / Features / PaymentGatewaySuggestions Last commit date
DefaultPaymentGateways.php 1 year ago EvaluateSuggestion.php 1 year ago Init.php 1 year ago PaymentGatewaySuggestionsDataSourcePoller.php 1 year ago PaymentGatewaysController.php 4 years ago
DefaultPaymentGateways.php
1544 lines
1 <?php
2 /**
3 * Gets a list of fallback methods if remote fetching is disabled.
4 */
5
6 namespace Automattic\WooCommerce\Admin\Features\PaymentGatewaySuggestions;
7
8 defined( 'ABSPATH' ) || exit;
9
10 use WC_Gateway_BACS;
11 use WC_Gateway_COD;
12
13 /**
14 * Default Payment Gateways
15 */
16 class DefaultPaymentGateways {
17 /**
18 * This is the default priority for countries that are not in the $recommendation_priority_map.
19 * Priority is used to determine which payment gateway to recommend first.
20 * The lower the number, the higher the priority.
21 *
22 * @var array
23 */
24 private static $recommendation_priority = array(
25 'woocommerce_payments' => 1,
26 'woocommerce_payments:with-in-person-payments' => 1,
27 'woocommerce_payments:without-in-person-payments' => 1,
28 'stripe' => 2,
29 'woo-mercado-pago-custom' => 3,
30 // PayPal Payments.
31 'ppcp-gateway' => 4,
32 'mollie_wc_gateway_banktransfer' => 5,
33 'razorpay' => 5,
34 'payfast' => 5,
35 'payubiz' => 6,
36 'square_credit_card' => 6,
37 'klarna_payments' => 6,
38 // Klarna Checkout.
39 'kco' => 6,
40 'paystack' => 6,
41 'eway' => 7,
42 'amazon_payments_advanced' => 7,
43 'affirm' => 8,
44 'afterpay' => 9,
45 'zipmoney' => 10,
46 'payoneer-checkout' => 11,
47 );
48
49 /**
50 * Get default specs.
51 *
52 * @return array Default specs.
53 */
54 public static function get_all() {
55 $payment_gateways = array(
56 array(
57 'id' => 'affirm',
58 'title' => __( 'Affirm', 'woocommerce' ),
59 'content' => __( 'Affirm’s tailored Buy Now Pay Later programs remove price as a barrier, turning browsers into buyers, increasing average order value, and expanding your customer base.', 'woocommerce' ),
60 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/affirm.png',
61 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/affirm.png',
62 'plugins' => array(),
63 'external_link' => 'https://woocommerce.com/products/woocommerce-gateway-affirm',
64 'is_visible' => array(
65 self::get_rules_for_countries(
66 array(
67 'US',
68 'CA',
69 )
70 ),
71 (object) array(
72 'type' => 'or',
73 'operands' => array(
74 self::get_rules_for_wcpay_activated( false ),
75 self::get_rules_for_wcpay_connected( false ),
76 ),
77 ),
78 ),
79 'category_other' => array(),
80 'category_additional' => array(
81 'US',
82 'CA',
83 ),
84 ),
85 array(
86 'id' => 'afterpay',
87 'title' => __( 'Afterpay', 'woocommerce' ),
88 'content' => __( 'Afterpay allows customers to receive products immediately and pay for purchases over four installments, always interest-free.', 'woocommerce' ),
89 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/afterpay.png',
90 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/afterpay.png',
91 'plugins' => array( 'afterpay-gateway-for-woocommerce' ),
92 'is_visible' => array(
93 self::get_rules_for_countries(
94 array(
95 'US',
96 'CA',
97 'AU',
98 )
99 ),
100 (object) array(
101 'type' => 'or',
102 'operands' => array(
103 self::get_rules_for_wcpay_activated( false ),
104 self::get_rules_for_wcpay_connected( false ),
105 ),
106 ),
107 ),
108 'category_other' => array(),
109 'category_additional' => array(
110 'US',
111 'CA',
112 'AU',
113 ),
114 ),
115 array(
116 'id' => 'airwallex_main',
117 'title' => __( 'Airwallex Payments', 'woocommerce' ),
118 'content' => __( 'Boost international sales and save on FX fees. Accept 60+ local payment methods including Apple Pay and Google Pay.', 'woocommerce' ),
119 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/airwallex.png',
120 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/airwallex.png',
121 'plugins' => array( 'airwallex-online-payments-gateway' ),
122 'is_visible' => array(
123 self::get_rules_for_countries( array( 'GB', 'AT', 'BE', 'EE', 'FR', 'DE', 'GR', 'IE', 'IT', 'NL', 'PL', 'PT', 'AU', 'NZ', 'HK', 'SG', 'CN' ) ),
124 ),
125 'category_other' => array( 'GB', 'AT', 'BE', 'EE', 'FR', 'DE', 'GR', 'IE', 'IT', 'NL', 'PL', 'PT', 'AU', 'NZ', 'HK', 'SG', 'CN' ),
126 'category_additional' => array(),
127 ),
128 array(
129 'id' => 'amazon_payments_advanced',
130 'title' => __( 'Amazon Pay', 'woocommerce' ),
131 'content' => __( 'Enable a familiar, fast checkout for hundreds of millions of active Amazon customers globally.', 'woocommerce' ),
132 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/amazonpay.png',
133 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/amazonpay.png',
134 'plugins' => array( 'woocommerce-gateway-amazon-payments-advanced' ),
135 'is_visible' => array(
136 self::get_rules_for_countries(
137 array(
138 'US',
139 'AT',
140 'BE',
141 'CY',
142 'DK',
143 'ES',
144 'FR',
145 'DE',
146 'GB',
147 'HU',
148 'IE',
149 'IT',
150 'LU',
151 'NL',
152 'PT',
153 'SL',
154 'SE',
155 'JP',
156 )
157 ),
158 ),
159 'category_other' => array(),
160 'category_additional' => array(
161 'US',
162 'AT',
163 'BE',
164 'CY',
165 'DK',
166 'ES',
167 'FR',
168 'DE',
169 'GB',
170 'HU',
171 'IE',
172 'IT',
173 'LU',
174 'NL',
175 'PT',
176 'SL',
177 'SE',
178 'JP',
179 ),
180 ),
181 array(
182 'id' => WC_Gateway_BACS::ID,
183 'title' => __( 'Direct bank transfer', 'woocommerce' ),
184 'content' => __( 'Take payments via bank transfer.', 'woocommerce' ),
185 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/bacs.svg',
186 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/bacs.png',
187 'is_visible' => array(
188 self::get_rules_for_cbd( false ),
189 ),
190 'is_offline' => true,
191 ),
192 array(
193 'id' => WC_Gateway_COD::ID,
194 'title' => __( 'Cash on delivery', 'woocommerce' ),
195 'content' => __( 'Take payments in cash upon delivery.', 'woocommerce' ),
196 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/cod.svg',
197 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/cod.png',
198 'is_visible' => array(
199 self::get_rules_for_cbd( false ),
200 ),
201 'is_offline' => true,
202 ),
203 array(
204 'id' => 'eway',
205 'title' => __( 'Eway', 'woocommerce' ),
206 'content' => __( 'The Eway extension for WooCommerce allows you to take credit card payments directly on your store without redirecting your customers to a third party site to make payment.', 'woocommerce' ),
207 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/eway.png',
208 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/eway.png',
209 'plugins' => array( 'woocommerce-gateway-eway' ),
210 'is_visible' => false,
211 'category_other' => array(),
212 'category_additional' => array(),
213 ),
214 array(
215 'id' => 'kco',
216 'title' => __( 'Klarna Checkout', 'woocommerce' ),
217 'content' => __( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries.', 'woocommerce' ),
218 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/klarna-black.png',
219 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/klarna.png',
220 'plugins' => array( 'klarna-checkout-for-woocommerce' ),
221 'is_visible' => array(
222 self::get_rules_for_countries(
223 array(
224 'NO',
225 'SE',
226 'FI',
227 )
228 ),
229 self::get_rules_for_cbd( false ),
230 ),
231 'category_other' => array(
232 'NO',
233 'SE',
234 'FI',
235 ),
236 'category_additional' => array(),
237 ),
238 array(
239 'id' => 'klarna_payments',
240 'title' => __( 'Klarna Payments', 'woocommerce' ),
241 'content' => __( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries.', 'woocommerce' ),
242 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/klarna-black.png',
243 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/klarna.png',
244 'plugins' => array( 'klarna-payments-for-woocommerce' ),
245 'is_visible' => array(
246 self::get_rules_for_countries(
247 array(
248 'MX',
249 'US',
250 'CA',
251 'AT',
252 'BE',
253 'CH',
254 'DK',
255 'ES',
256 'FI',
257 'FR',
258 'DE',
259 'GB',
260 'IT',
261 'NL',
262 'NO',
263 'PL',
264 'SE',
265 'NZ',
266 'AU',
267 )
268 ),
269 self::get_rules_for_cbd( false ),
270 (object) array(
271 'type' => 'or',
272 'operands' => array(
273 (object) array(
274 'type' => 'not',
275 'operand' => array(
276 self::get_rules_for_countries( self::get_wcpay_countries() ),
277 ),
278 ),
279 self::get_rules_for_wcpay_activated( false ),
280 self::get_rules_for_wcpay_connected( false ),
281 ),
282 ),
283 ),
284 'category_other' => array(),
285 'category_additional' => array(
286 'MX',
287 'US',
288 'CA',
289 'AT',
290 'BE',
291 'CH',
292 'DK',
293 'ES',
294 'FI',
295 'FR',
296 'DE',
297 'GB',
298 'IT',
299 'NL',
300 'NO',
301 'PL',
302 'SE',
303 'NZ',
304 'AU',
305 ),
306 ),
307 array(
308 'id' => 'mollie_wc_gateway_banktransfer',
309 'title' => __( 'Mollie', 'woocommerce' ),
310 'content' => __( 'Effortless payments by Mollie: Offer global and local payment methods, get onboarded in minutes, and supported in your language.', 'woocommerce' ),
311 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/mollie.svg',
312 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/mollie.png',
313 'plugins' => array( 'mollie-payments-for-woocommerce' ),
314 'is_visible' => array(
315 self::get_rules_for_countries(
316 array(
317 'AT',
318 'BE',
319 'CH',
320 'ES',
321 'FI',
322 'FR',
323 'DE',
324 'GB',
325 'IT',
326 'NL',
327 'PL',
328 )
329 ),
330 ),
331 'category_other' => array(
332 'AT',
333 'BE',
334 'CH',
335 'ES',
336 'FI',
337 'FR',
338 'DE',
339 'GB',
340 'IT',
341 'NL',
342 'PL',
343 ),
344 'category_additional' => array(),
345 ),
346 array(
347 'id' => 'payfast',
348 'title' => __( 'Payfast', 'woocommerce' ),
349 'content' => __( 'The Payfast extension for WooCommerce enables you to accept payments by Credit Card and EFT via one of South Africa’s most popular payment gateways. No setup fees or monthly subscription costs. Selecting this extension will configure your store to use South African rands as the selected currency.', 'woocommerce' ),
350 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/payfast.png',
351 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/payfast.png',
352 'plugins' => array( 'woocommerce-payfast-gateway' ),
353 'is_visible' => array(
354 self::get_rules_for_countries( array( 'ZA' ) ),
355 self::get_rules_for_cbd( false ),
356 ),
357 'category_other' => array( 'ZA' ),
358 'category_additional' => array(),
359 ),
360 array(
361 'id' => 'payoneer-checkout',
362 'title' => __( 'Payoneer Checkout', 'woocommerce' ),
363 'content' => __( 'Payoneer Checkout is the next generation of payment processing platforms, giving merchants around the world the solutions and direction they need to succeed in today’s hyper-competitive global market.', 'woocommerce' ),
364 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/payoneer.png',
365 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/payoneer.png',
366 'plugins' => array( 'payoneer-checkout' ),
367 'is_visible' => array(
368 self::get_rules_for_countries(
369 array(
370 'HK',
371 'CN',
372 )
373 ),
374 ),
375 'category_other' => array(),
376 'category_additional' => array(
377 'HK',
378 'CN',
379 ),
380 ),
381 array(
382 'id' => 'paystack',
383 'title' => __( 'Paystack', 'woocommerce' ),
384 'content' => __( 'Paystack helps African merchants accept one-time and recurring payments online with a modern, safe, and secure payment gateway.', 'woocommerce' ),
385 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/paystack.png',
386 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/paystack.png',
387 'plugins' => array( 'woo-paystack' ),
388 'is_visible' => array(
389 self::get_rules_for_countries( array( 'ZA', 'GH', 'NG' ) ),
390 self::get_rules_for_cbd( false ),
391 ),
392 'category_other' => array( 'ZA', 'GH', 'NG' ),
393 'category_additional' => array(),
394 ),
395 array(
396 'id' => 'payubiz',
397 'title' => __( 'PayU for WooCommerce', 'woocommerce' ),
398 'content' => __( 'Enable PayU’s exclusive plugin for WooCommerce to start accepting payments in 100+ payment methods available in India including credit cards, debit cards, UPI, & more!', 'woocommerce' ),
399 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/payu.svg',
400 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/payu.png',
401 'plugins' => array( 'payu-india' ),
402 'is_visible' => array(
403 (object) array(
404 'type' => 'base_location_country',
405 'value' => 'IN',
406 'operation' => '=',
407 ),
408 self::get_rules_for_cbd( false ),
409 ),
410 'category_other' => array( 'IN' ),
411 'category_additional' => array(),
412 ),
413 array(
414 'id' => 'ppcp-gateway',
415 'title' => __( 'PayPal Payments', 'woocommerce' ),
416 'content' => __( "Safe and secure payments using credit cards or your customer's PayPal account.", 'woocommerce' ),
417 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/paypal.png',
418 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/paypal.png',
419 'plugins' => array( 'woocommerce-paypal-payments' ),
420 'is_visible' => array(
421 self::get_rules_for_countries(
422 array(
423 'US',
424 'CA',
425 'MX',
426 'BR',
427 'AR',
428 'CL',
429 'CO',
430 'EC',
431 'PE',
432 'UY',
433 'VE',
434 'AT',
435 'BE',
436 'BG',
437 'HR',
438 'CH',
439 'CY',
440 'CZ',
441 'DK',
442 'EE',
443 'ES',
444 'FI',
445 'FR',
446 'DE',
447 'GB',
448 'GR',
449 'HU',
450 'IE',
451 'IT',
452 'LV',
453 'LT',
454 'LU',
455 'MT',
456 'NL',
457 'NO',
458 'PL',
459 'PT',
460 'RO',
461 'SK',
462 'SL',
463 'SE',
464 'AU',
465 'NZ',
466 'HK',
467 'JP',
468 'SG',
469 'CN',
470 'ID',
471 'IN',
472 )
473 ),
474 self::get_rules_for_cbd( false ),
475 ),
476 'category_other' => array(
477 'US',
478 'CA',
479 'MX',
480 'BR',
481 'AR',
482 'CL',
483 'CO',
484 'EC',
485 'PE',
486 'UY',
487 'VE',
488 'AT',
489 'BE',
490 'BG',
491 'HR',
492 'CH',
493 'CY',
494 'CZ',
495 'DK',
496 'EE',
497 'ES',
498 'FI',
499 'FR',
500 'DE',
501 'GB',
502 'GR',
503 'HU',
504 'IE',
505 'IT',
506 'LV',
507 'LT',
508 'LU',
509 'MT',
510 'NL',
511 'NO',
512 'PL',
513 'PT',
514 'RO',
515 'SK',
516 'SL',
517 'SE',
518 'AU',
519 'NZ',
520 'HK',
521 'JP',
522 'SG',
523 'CN',
524 'ID',
525 ),
526 'category_additional' => array(
527 'US',
528 'CA',
529 'ZA',
530 'NG',
531 'GH',
532 'EC',
533 'VE',
534 'AR',
535 'CL',
536 'CO',
537 'PE',
538 'UY',
539 'MX',
540 'BR',
541 'AT',
542 'BE',
543 'BG',
544 'HR',
545 'CH',
546 'CY',
547 'CZ',
548 'DK',
549 'EE',
550 'ES',
551 'FI',
552 'FR',
553 'DE',
554 'GB',
555 'GR',
556 'HU',
557 'IE',
558 'IT',
559 'LV',
560 'LT',
561 'LU',
562 'MT',
563 'NL',
564 'NO',
565 'PL',
566 'PT',
567 'RO',
568 'SK',
569 'SL',
570 'SE',
571 'AU',
572 'NZ',
573 'HK',
574 'JP',
575 'SG',
576 'CN',
577 'ID',
578 'IN',
579 ),
580 ),
581 array(
582 'id' => 'razorpay',
583 'title' => __( 'Razorpay', 'woocommerce' ),
584 'content' => __( 'The official Razorpay extension for WooCommerce allows you to accept credit cards, debit cards, netbanking, wallet, and UPI payments.', 'woocommerce' ),
585 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/razorpay.svg',
586 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/razorpay.png',
587 'plugins' => array( 'woo-razorpay' ),
588 'is_visible' => array(
589 (object) array(
590 'type' => 'base_location_country',
591 'value' => 'IN',
592 'operation' => '=',
593 ),
594 self::get_rules_for_cbd( false ),
595 ),
596 'category_other' => array( 'IN' ),
597 'category_additional' => array(),
598 ),
599 array(
600 'id' => 'square_credit_card',
601 'title' => __( 'Square', 'woocommerce' ),
602 'content' => __( 'Securely accept credit and debit cards with one low rate, no surprise fees (custom rates available). Sell online and in store and track sales and inventory in one place.', 'woocommerce' ),
603 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/square-black.png',
604 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/square.png',
605 'plugins' => array( 'woocommerce-square' ),
606 'is_visible' => array(
607 (object) array(
608 'type' => 'or',
609 'operands' => (object) array(
610 array(
611 self::get_rules_for_countries( array( 'US' ) ),
612 self::get_rules_for_cbd( true ),
613 ),
614 array(
615 self::get_rules_for_countries(
616 array(
617 'US',
618 'CA',
619 'IE',
620 'ES',
621 'FR',
622 'GB',
623 'AU',
624 'JP',
625 )
626 ),
627 (object) array(
628 'type' => 'or',
629 'operands' => (object) array(
630 self::get_rules_for_selling_venues( array( 'brick-mortar', 'brick-mortar-other' ) ),
631 self::get_rules_selling_offline(),
632 ),
633 ),
634 ),
635 ),
636 ),
637 ),
638 'category_other' => array(
639 'US',
640 'CA',
641 'IE',
642 'ES',
643 'FR',
644 'GB',
645 'AU',
646 'JP',
647 ),
648 'category_additional' => array(),
649 ),
650 array(
651 'id' => 'stripe',
652 'title' => __( ' Stripe', 'woocommerce' ),
653 'content' => __( 'Accept debit and credit cards in 135+ currencies, methods such as Alipay, and one-touch checkout with Apple Pay.', 'woocommerce' ),
654 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/stripe.png',
655 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/stripe.png',
656 'plugins' => array( 'woocommerce-gateway-stripe' ),
657 'is_visible' => array(
658 // https://stripe.com/global.
659 self::get_rules_for_countries(
660 array(
661 'US',
662 'CA',
663 'MX',
664 'BR',
665 'AT',
666 'BE',
667 'BG',
668 'CH',
669 'CY',
670 'CZ',
671 'DK',
672 'EE',
673 'ES',
674 'FI',
675 'FR',
676 'DE',
677 'GB',
678 'GR',
679 'HU',
680 'IE',
681 'IT',
682 'LV',
683 'LT',
684 'LU',
685 'MT',
686 'NL',
687 'NO',
688 'PL',
689 'PT',
690 'RO',
691 'SK',
692 'SL',
693 'SE',
694 'AU',
695 'NZ',
696 'HK',
697 'JP',
698 'SG',
699 'ID',
700 'IN',
701 )
702 ),
703 self::get_rules_for_cbd( false ),
704 ),
705 'category_other' => array(
706 'US',
707 'CA',
708 'MX',
709 'BR',
710 'AT',
711 'BE',
712 'BG',
713 'CH',
714 'CY',
715 'CZ',
716 'DK',
717 'EE',
718 'ES',
719 'FI',
720 'FR',
721 'DE',
722 'GB',
723 'GR',
724 'HU',
725 'IE',
726 'IT',
727 'LV',
728 'LT',
729 'LU',
730 'MT',
731 'NL',
732 'NO',
733 'PL',
734 'PT',
735 'RO',
736 'SK',
737 'SL',
738 'SE',
739 'AU',
740 'NZ',
741 'HK',
742 'JP',
743 'SG',
744 'ID',
745 'IN',
746 ),
747 'category_additional' => array(),
748 ),
749 array(
750 'id' => 'woo-mercado-pago-custom',
751 'title' => __( 'Mercado Pago', 'woocommerce' ),
752 'content' => __( 'Set up your payment methods and accept credit and debit cards, cash, bank transfers and money from your Mercado Pago account. Offer safe and secure payments with Latin America’s leading processor.', 'woocommerce' ),
753 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/mercadopago.png',
754 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/mercadopago.png',
755 'plugins' => array( 'woocommerce-mercadopago' ),
756 'is_visible' => array(
757 self::get_rules_for_countries(
758 array(
759 'AR',
760 'CL',
761 'CO',
762 'EC',
763 'PE',
764 'UY',
765 'MX',
766 'BR',
767 )
768 ),
769 ),
770 'is_local_partner' => true,
771 'category_other' => array(
772 'AR',
773 'CL',
774 'CO',
775 'EC',
776 'PE',
777 'UY',
778 'MX',
779 'BR',
780 ),
781 'category_additional' => array(),
782 ),
783 // This is for backwards compatibility only (WC < 5.10.0-dev or WCA < 2.9.0-dev).
784 array(
785 'id' => 'woocommerce_payments',
786 'title' => __( 'WooPayments', 'woocommerce' ),
787 'content' => __(
788 'Manage transactions without leaving your WordPress Dashboard. Only with WooPayments.',
789 'woocommerce'
790 ),
791 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay.svg',
792 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay.svg',
793 'plugins' => array( 'woocommerce-payments' ),
794 'description' => __( 'With WooPayments, you can securely accept major cards, Apple Pay, and payments in over 100 currencies. Track cash flow and manage recurring revenue directly from your store’s dashboard - with no setup costs or monthly fees.', 'woocommerce' ),
795 'is_visible' => array(
796 self::get_rules_for_cbd( false ),
797 self::get_rules_for_countries( self::get_wcpay_countries() ),
798 (object) array(
799 'type' => 'plugin_version',
800 'plugin' => 'woocommerce',
801 'version' => '5.10.0-dev',
802 'operator' => '<',
803 ),
804 (object) array(
805 'type' => 'or',
806 'operands' => (object) array(
807 (object) array(
808 'type' => 'not',
809 'operand' => array(
810 (object) array(
811 'type' => 'plugins_activated',
812 'plugins' => array( 'woocommerce-admin' ),
813 ),
814 ),
815 ),
816 (object) array(
817 'type' => 'plugin_version',
818 'plugin' => 'woocommerce-admin',
819 'version' => '2.9.0-dev',
820 'operator' => '<',
821 ),
822 ),
823 ),
824 ),
825 ),
826 array(
827 'id' => 'woocommerce_payments:without-in-person-payments',
828 'title' => __( 'WooPayments', 'woocommerce' ),
829 'content' => __(
830 'Manage transactions without leaving your WordPress Dashboard. Only with WooPayments.',
831 'woocommerce'
832 ),
833 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay.svg',
834 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay.svg',
835 'plugins' => array( 'woocommerce-payments' ),
836 'description' => __( 'With WooPayments, you can securely accept major cards, Apple Pay, and payments in over 100 currencies. Track cash flow and manage recurring revenue directly from your store’s dashboard - with no setup costs or monthly fees.', 'woocommerce' ),
837 'is_visible' => array(
838 self::get_rules_for_cbd( false ),
839 self::get_rules_for_countries( array_diff( self::get_wcpay_countries(), array( 'US', 'CA' ) ) ),
840 (object) array(
841 'type' => 'or',
842 // Older versions of WooCommerce Admin require the ID to be `woocommerce-payments` to show the suggestion card.
843 'operands' => (object) array(
844 (object) array(
845 'type' => 'plugin_version',
846 'plugin' => 'woocommerce-admin',
847 'version' => '2.9.0-dev',
848 'operator' => '>=',
849 ),
850 (object) array(
851 'type' => 'plugin_version',
852 'plugin' => 'woocommerce',
853 'version' => '5.10.0-dev',
854 'operator' => '>=',
855 ),
856 ),
857 ),
858 ),
859 ),
860 // This is the same as the above, but with a different description for countries that support in-person payments such as US and CA.
861 array(
862 'id' => 'woocommerce_payments:with-in-person-payments',
863 'title' => __( 'WooPayments', 'woocommerce' ),
864 'content' => __(
865 'Manage transactions without leaving your WordPress Dashboard. Only with WooPayments.',
866 'woocommerce'
867 ),
868 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay.svg',
869 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay.svg',
870 'plugins' => array( 'woocommerce-payments' ),
871 'description' => __( 'With WooPayments, you can securely accept major cards, Apple Pay, and payments in over 100 currencies – with no setup costs or monthly fees – and you can now accept in-person payments with the Woo mobile app.', 'woocommerce' ),
872 'is_visible' => array(
873 self::get_rules_for_cbd( false ),
874 self::get_rules_for_countries( array( 'US', 'CA' ) ),
875 (object) array(
876 'type' => 'or',
877 // Older versions of WooCommerce Admin require the ID to be `woocommerce-payments` to show the suggestion card.
878 'operands' => (object) array(
879 (object) array(
880 'type' => 'plugin_version',
881 'plugin' => 'woocommerce-admin',
882 'version' => '2.9.0-dev',
883 'operator' => '>=',
884 ),
885 (object) array(
886 'type' => 'plugin_version',
887 'plugin' => 'woocommerce',
888 'version' => '5.10.0-dev',
889 'operator' => '>=',
890 ),
891 ),
892 ),
893 ),
894 ),
895 array(
896 'id' => 'woocommerce_payments:bnpl',
897 'title' => __( 'Activate BNPL instantly on WooPayments', 'woocommerce' ),
898 'content' => __(
899 'The world’s favorite buy now, pay later options and many more are right at your fingertips with WooPayments — all from one dashboard, without needing multiple extensions and logins.',
900 'woocommerce'
901 ),
902 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay-bnpl.svg',
903 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/wcpay-bnpl.svg',
904 'plugins' => array( 'woocommerce-payments' ),
905 'is_visible' => array(
906 self::get_rules_for_countries(
907 array_intersect(
908 array(
909 'US',
910 'CA',
911 'AU',
912 'AT',
913 'BE',
914 'CH',
915 'DK',
916 'ES',
917 'FI',
918 'FR',
919 'DE',
920 'GB',
921 'IT',
922 'NL',
923 'NO',
924 'PL',
925 'SE',
926 'NZ',
927 ),
928 self::get_wcpay_countries()
929 ),
930 ),
931 self::get_rules_for_cbd( false ),
932 self::get_rules_for_wcpay_activated( true ),
933 self::get_rules_for_wcpay_connected( true ),
934 ),
935 ),
936 array(
937 'id' => 'zipmoney',
938 'title' => __( 'Zip Co - Buy Now, Pay Later', 'woocommerce' ),
939 'content' => __( 'Give your customers the power to pay later, interest free and watch your sales grow.', 'woocommerce' ),
940 'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/zipco.png',
941 'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/zipco.png',
942 'plugins' => array( 'zipmoney-payments-woocommerce' ),
943 'is_visible' => false,
944 'category_other' => array(),
945 'category_additional' => array(),
946 ),
947 );
948
949 $base_location = wc_get_base_location();
950 $country = $base_location['country'];
951 foreach ( $payment_gateways as $index => $payment_gateway ) {
952 $payment_gateways[ $index ]['recommendation_priority'] = self::get_recommendation_priority( $payment_gateway['id'], $country );
953 }
954
955 return $payment_gateways;
956 }
957
958 /**
959 * Get array of countries supported by WCPay depending on feature flag.
960 *
961 * @return array Array of countries.
962 */
963 public static function get_wcpay_countries() {
964 return array( 'US', 'PR', 'AU', 'CA', 'CY', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'IE', 'IT', 'LU', 'LT', 'LV', 'NO', 'NZ', 'MT', 'AT', 'BE', 'NL', 'PL', 'PT', 'CH', 'HK', 'SI', 'SK', 'SG', 'BG', 'CZ', 'HR', 'HU', 'RO', 'SE', 'JP', 'AE' );
965 }
966
967 /**
968 * Get rules that match the store base location to one of the provided countries.
969 *
970 * @param array $countries Array of countries to match.
971 * @return object Rules to match.
972 */
973 public static function get_rules_for_countries( $countries ) {
974 $rules = array();
975
976 foreach ( $countries as $country ) {
977 $rules[] = (object) array(
978 'type' => 'base_location_country',
979 'value' => $country,
980 'operation' => '=',
981 );
982 }
983
984 return (object) array(
985 'type' => 'or',
986 'operands' => $rules,
987 );
988 }
989
990 /**
991 * Get rules that match the store's selling venues.
992 *
993 * @param array $selling_venues Array of venues to match.
994 * @return object Rules to match.
995 */
996 public static function get_rules_for_selling_venues( $selling_venues ) {
997 $rules = array();
998
999 foreach ( $selling_venues as $venue ) {
1000 $rules[] = (object) array(
1001 'type' => 'option',
1002 'transformers' => array(
1003 (object) array(
1004 'use' => 'dot_notation',
1005 'arguments' => (object) array(
1006 'path' => 'selling_venues',
1007 ),
1008 ),
1009 ),
1010 'option_name' => 'woocommerce_onboarding_profile',
1011 'operation' => '=',
1012 'value' => $venue,
1013 'default' => array(),
1014 );
1015 }
1016
1017 return (object) array(
1018 'type' => 'or',
1019 'operands' => $rules,
1020 );
1021 }
1022
1023 /**
1024 * Get rules for when selling offline for core profiler.
1025 *
1026 * @return object Rules to match.
1027 */
1028 public static function get_rules_selling_offline() {
1029 return (object) array(
1030 'type' => 'option',
1031 'transformers' => array(
1032 (object) array(
1033 'use' => 'dot_notation',
1034 'arguments' => (object) array(
1035 'path' => 'selling_online_answer',
1036 ),
1037 ),
1038 ),
1039 'option_name' => 'woocommerce_onboarding_profile',
1040 'operation' => 'in',
1041 'value' => array( 'no_im_selling_offline', 'im_selling_both_online_and_offline' ),
1042 'default' => '',
1043 );
1044 }
1045
1046 /**
1047 * Get default rules for CBD based on given argument.
1048 *
1049 * @param bool $should_have Whether or not the store should have CBD as an industry (true) or not (false).
1050 * @return object Rules to match.
1051 */
1052 public static function get_rules_for_cbd( $should_have ) {
1053 return (object) array(
1054 'type' => 'option',
1055 'transformers' => array(
1056 (object) array(
1057 'use' => 'dot_notation',
1058 'arguments' => (object) array(
1059 'path' => 'industry',
1060 ),
1061 ),
1062 (object) array(
1063 'use' => 'array_column',
1064 'arguments' => (object) array(
1065 'key' => 'slug',
1066 ),
1067 ),
1068 ),
1069 'option_name' => 'woocommerce_onboarding_profile',
1070 'operation' => $should_have ? 'contains' : '!contains',
1071 'value' => 'cbd-other-hemp-derived-products',
1072 'default' => array(),
1073 );
1074 }
1075
1076 /**
1077 * Get default rules for the WooPayments plugin being installed and activated.
1078 *
1079 * @param bool $should_be Whether WooPayments should be activated.
1080 *
1081 * @return object Rules to match.
1082 */
1083 public static function get_rules_for_wcpay_activated( $should_be ) {
1084 $active_rule = (object) array(
1085 'type' => 'plugins_activated',
1086 'plugins' => array( 'woocommerce-payments' ),
1087 );
1088
1089 if ( $should_be ) {
1090 return $active_rule;
1091 }
1092
1093 return (object) array(
1094 'type' => 'not',
1095 'operand' => array( $active_rule ),
1096 );
1097 }
1098
1099 /**
1100 * Get default rules for WooPayments being connected or not.
1101 *
1102 * This does not include the check for the WooPayments plugin to be active.
1103 *
1104 * @param bool $should_be Whether WooPayments should be connected.
1105 *
1106 * @return object Rules to match.
1107 */
1108 public static function get_rules_for_wcpay_connected( $should_be ) {
1109 return (object) array(
1110 'type' => 'option',
1111 'transformers' => array(
1112 // Extract only the 'data' key from the option.
1113 (object) array(
1114 'use' => 'dot_notation',
1115 'arguments' => (object) array(
1116 'path' => 'data',
1117 ),
1118 ),
1119 // Extract the keys from the data array.
1120 (object) array(
1121 'use' => 'array_keys',
1122 ),
1123 ),
1124 'option_name' => 'wcpay_account_data',
1125 // The rule will be look for the 'account_id' key in the account data array.
1126 'operation' => $should_be ? 'contains' : '!contains',
1127 'value' => 'account_id',
1128 'default' => array(),
1129 );
1130 }
1131
1132 /**
1133 * Get recommendation priority for a given payment gateway by id and country.
1134 * If country is not supported, return null.
1135 *
1136 * @param string $gateway_id Payment gateway id.
1137 * @param string $country_code Store country code.
1138 * @return int|null Priority. Priority is 0-indexed, so 0 is the highest priority.
1139 */
1140 private static function get_recommendation_priority( $gateway_id, $country_code ) {
1141 $recommendation_priority_map = array(
1142 'US' => array(
1143 'woocommerce_payments:with-in-person-payments',
1144 'woocommerce_payments:without-in-person-payments',
1145 'woocommerce_payments',
1146 'stripe',
1147 'ppcp-gateway',
1148 'square_credit_card',
1149 'amazon_payments_advanced',
1150 'affirm',
1151 'afterpay',
1152 'klarna_payments',
1153 ),
1154 'CA' => array(
1155 'woocommerce_payments:with-in-person-payments',
1156 'woocommerce_payments:without-in-person-payments',
1157 'woocommerce_payments',
1158 'stripe',
1159 'ppcp-gateway',
1160 'square_credit_card',
1161 'affirm',
1162 'afterpay',
1163 'klarna_payments',
1164 ),
1165 'AT' => array(
1166 'woocommerce_payments:with-in-person-payments',
1167 'woocommerce_payments:without-in-person-payments',
1168 'woocommerce_payments',
1169 'stripe',
1170 'ppcp-gateway',
1171 'airwallex_main',
1172 'mollie_wc_gateway_banktransfer',
1173 'klarna_payments',
1174 'amazon_payments_advanced',
1175 ),
1176 'BE' => array(
1177 'woocommerce_payments:with-in-person-payments',
1178 'woocommerce_payments:without-in-person-payments',
1179 'woocommerce_payments',
1180 'stripe',
1181 'ppcp-gateway',
1182 'airwallex_main',
1183 'mollie_wc_gateway_banktransfer',
1184 'klarna_payments',
1185 'amazon_payments_advanced',
1186 ),
1187 'BG' => array(
1188 'woocommerce_payments:with-in-person-payments',
1189 'woocommerce_payments:without-in-person-payments',
1190 'woocommerce_payments',
1191 'stripe',
1192 'ppcp-gateway',
1193 ),
1194 'HR' => array(
1195 'woocommerce_payments:with-in-person-payments',
1196 'woocommerce_payments:without-in-person-payments',
1197 'woocommerce_payments',
1198 'ppcp-gateway',
1199 ),
1200 'CH' => array(
1201 'woocommerce_payments:with-in-person-payments',
1202 'woocommerce_payments:without-in-person-payments',
1203 'woocommerce_payments',
1204 'stripe',
1205 'ppcp-gateway',
1206 'mollie_wc_gateway_banktransfer',
1207 'klarna_payments',
1208 ),
1209 'CY' => array(
1210 'woocommerce_payments:with-in-person-payments',
1211 'woocommerce_payments:without-in-person-payments',
1212 'woocommerce_payments',
1213 'stripe',
1214 'ppcp-gateway',
1215 'amazon_payments_advanced',
1216 ),
1217 'CZ' => array(
1218 'woocommerce_payments:with-in-person-payments',
1219 'woocommerce_payments:without-in-person-payments',
1220 'woocommerce_payments',
1221 'stripe',
1222 'ppcp-gateway',
1223 ),
1224 'DK' => array(
1225 'woocommerce_payments:with-in-person-payments',
1226 'woocommerce_payments:without-in-person-payments',
1227 'woocommerce_payments',
1228 'stripe',
1229 'ppcp-gateway',
1230 'klarna_payments',
1231 'amazon_payments_advanced',
1232 ),
1233 'EE' => array(
1234 'woocommerce_payments:with-in-person-payments',
1235 'woocommerce_payments:without-in-person-payments',
1236 'woocommerce_payments',
1237 'stripe',
1238 'ppcp-gateway',
1239 'airwallex_main',
1240 ),
1241 'ES' => array(
1242 'woocommerce_payments:with-in-person-payments',
1243 'woocommerce_payments:without-in-person-payments',
1244 'woocommerce_payments',
1245 'stripe',
1246 'ppcp-gateway',
1247 'mollie_wc_gateway_banktransfer',
1248 'square_credit_card',
1249 'klarna_payments',
1250 'amazon_payments_advanced',
1251 ),
1252 'FI' => array(
1253 'woocommerce_payments:with-in-person-payments',
1254 'woocommerce_payments:without-in-person-payments',
1255 'woocommerce_payments',
1256 'stripe',
1257 'ppcp-gateway',
1258 'mollie_wc_gateway_banktransfer',
1259 'kco',
1260 'klarna_payments',
1261 ),
1262 'FR' => array(
1263 'woocommerce_payments:with-in-person-payments',
1264 'woocommerce_payments:without-in-person-payments',
1265 'woocommerce_payments',
1266 'stripe',
1267 'ppcp-gateway',
1268 'airwallex_main',
1269 'mollie_wc_gateway_banktransfer',
1270 'square_credit_card',
1271 'klarna_payments',
1272 'amazon_payments_advanced',
1273 ),
1274 'DE' => array(
1275 'woocommerce_payments:with-in-person-payments',
1276 'woocommerce_payments:without-in-person-payments',
1277 'woocommerce_payments',
1278 'stripe',
1279 'ppcp-gateway',
1280 'airwallex_main',
1281 'mollie_wc_gateway_banktransfer',
1282 'klarna_payments',
1283 'amazon_payments_advanced',
1284 ),
1285 'GB' => array(
1286 'woocommerce_payments:with-in-person-payments',
1287 'woocommerce_payments:without-in-person-payments',
1288 'woocommerce_payments',
1289 'stripe',
1290 'ppcp-gateway',
1291 'airwallex_main',
1292 'mollie_wc_gateway_banktransfer',
1293 'square_credit_card',
1294 'klarna_payments',
1295 'amazon_payments_advanced',
1296 ),
1297 'GR' => array(
1298 'woocommerce_payments:with-in-person-payments',
1299 'woocommerce_payments:without-in-person-payments',
1300 'woocommerce_payments',
1301 'stripe',
1302 'ppcp-gateway',
1303 'airwallex_main',
1304 ),
1305 'HU' => array(
1306 'woocommerce_payments:with-in-person-payments',
1307 'woocommerce_payments:without-in-person-payments',
1308 'woocommerce_payments',
1309 'stripe',
1310 'ppcp-gateway',
1311 'amazon_payments_advanced',
1312 ),
1313 'IE' => array(
1314 'woocommerce_payments:with-in-person-payments',
1315 'woocommerce_payments:without-in-person-payments',
1316 'woocommerce_payments',
1317 'stripe',
1318 'ppcp-gateway',
1319 'airwallex_main',
1320 'square_credit_card',
1321 'amazon_payments_advanced',
1322 ),
1323 'IT' => array(
1324 'woocommerce_payments:with-in-person-payments',
1325 'woocommerce_payments:without-in-person-payments',
1326 'woocommerce_payments',
1327 'stripe',
1328 'ppcp-gateway',
1329 'airwallex_main',
1330 'mollie_wc_gateway_banktransfer',
1331 'klarna_payments',
1332 'amazon_payments_advanced',
1333 ),
1334 'LV' => array(
1335 'woocommerce_payments:with-in-person-payments',
1336 'woocommerce_payments:without-in-person-payments',
1337 'woocommerce_payments',
1338 'stripe',
1339 'ppcp-gateway',
1340 ),
1341 'LT' => array(
1342 'woocommerce_payments:with-in-person-payments',
1343 'woocommerce_payments:without-in-person-payments',
1344 'woocommerce_payments',
1345 'stripe',
1346 'ppcp-gateway',
1347 ),
1348 'LU' => array(
1349 'woocommerce_payments:with-in-person-payments',
1350 'woocommerce_payments:without-in-person-payments',
1351 'woocommerce_payments',
1352 'stripe',
1353 'ppcp-gateway',
1354 'amazon_payments_advanced',
1355 ),
1356 'MT' => array(
1357 'woocommerce_payments:with-in-person-payments',
1358 'woocommerce_payments:without-in-person-payments',
1359 'woocommerce_payments',
1360 'stripe',
1361 'ppcp-gateway',
1362 ),
1363 'NL' => array(
1364 'woocommerce_payments:with-in-person-payments',
1365 'woocommerce_payments:without-in-person-payments',
1366 'woocommerce_payments',
1367 'stripe',
1368 'ppcp-gateway',
1369 'airwallex_main',
1370 'mollie_wc_gateway_banktransfer',
1371 'klarna_payments',
1372 'amazon_payments_advanced',
1373 ),
1374 'NO' => array(
1375 'woocommerce_payments:with-in-person-payments',
1376 'woocommerce_payments:without-in-person-payments',
1377 'woocommerce_payments',
1378 'stripe',
1379 'ppcp-gateway',
1380 'kco',
1381 'klarna_payments',
1382 ),
1383 'PL' => array(
1384 'woocommerce_payments:with-in-person-payments',
1385 'woocommerce_payments:without-in-person-payments',
1386 'woocommerce_payments',
1387 'stripe',
1388 'ppcp-gateway',
1389 'airwallex_main',
1390 'mollie_wc_gateway_banktransfer',
1391 'klarna_payments',
1392 ),
1393 'PT' => array(
1394 'woocommerce_payments:with-in-person-payments',
1395 'woocommerce_payments:without-in-person-payments',
1396 'woocommerce_payments',
1397 'stripe',
1398 'ppcp-gateway',
1399 'airwallex_main',
1400 'amazon_payments_advanced',
1401 ),
1402 'RO' => array(
1403 'woocommerce_payments:with-in-person-payments',
1404 'woocommerce_payments:without-in-person-payments',
1405 'woocommerce_payments',
1406 'stripe',
1407 'ppcp-gateway',
1408 ),
1409 'SK' => array(
1410 'woocommerce_payments:with-in-person-payments',
1411 'woocommerce_payments:without-in-person-payments',
1412 'woocommerce_payments',
1413 'stripe',
1414 'ppcp-gateway',
1415 ),
1416 'SL' => array(
1417 'woocommerce_payments:with-in-person-payments',
1418 'woocommerce_payments:without-in-person-payments',
1419 'woocommerce_payments',
1420 'stripe',
1421 'ppcp-gateway',
1422 'amazon_payments_advanced',
1423 ),
1424 'SE' => array(
1425 'woocommerce_payments:with-in-person-payments',
1426 'woocommerce_payments:without-in-person-payments',
1427 'woocommerce_payments',
1428 'stripe',
1429 'ppcp-gateway',
1430 'kco',
1431 'klarna_payments',
1432 'amazon_payments_advanced',
1433 ),
1434 'MX' => array(
1435 'stripe',
1436 'woo-mercado-pago-custom',
1437 'ppcp-gateway',
1438 'klarna_payments',
1439 ),
1440 'BR' => array( 'stripe', 'woo-mercado-pago-custom', 'ppcp-gateway' ),
1441 'AR' => array( 'woo-mercado-pago-custom', 'ppcp-gateway' ),
1442 'BO' => array(),
1443 'CL' => array( 'woo-mercado-pago-custom', 'ppcp-gateway' ),
1444 'CO' => array( 'woo-mercado-pago-custom', 'ppcp-gateway' ),
1445 'EC' => array( 'woo-mercado-pago-custom', 'ppcp-gateway' ),
1446 'FK' => array(),
1447 'GF' => array(),
1448 'GY' => array(),
1449 'PY' => array(),
1450 'PE' => array( 'woo-mercado-pago-custom', 'ppcp-gateway' ),
1451 'SR' => array(),
1452 'UY' => array( 'woo-mercado-pago-custom', 'ppcp-gateway' ),
1453 'VE' => array( 'ppcp-gateway' ),
1454 'AU' => array(
1455 'woocommerce_payments:with-in-person-payments',
1456 'woocommerce_payments:without-in-person-payments',
1457 'woocommerce_payments',
1458 'stripe',
1459 'airwallex_main',
1460 'ppcp-gateway',
1461 'square_credit_card',
1462 'afterpay',
1463 'klarna_payments',
1464 ),
1465 'NZ' => array(
1466 'woocommerce_payments:with-in-person-payments',
1467 'woocommerce_payments:without-in-person-payments',
1468 'woocommerce_payments',
1469 'stripe',
1470 'airwallex_main',
1471 'ppcp-gateway',
1472 'klarna_payments',
1473 ),
1474 'HK' => array(
1475 'woocommerce_payments:with-in-person-payments',
1476 'woocommerce_payments:without-in-person-payments',
1477 'woocommerce_payments',
1478 'stripe',
1479 'airwallex_main',
1480 'ppcp-gateway',
1481 'payoneer-checkout',
1482 ),
1483 'JP' => array(
1484 'woocommerce_payments:with-in-person-payments',
1485 'woocommerce_payments:without-in-person-payments',
1486 'woocommerce_payments',
1487 'stripe',
1488 'ppcp-gateway',
1489 'square_credit_card',
1490 'amazon_payments_advanced',
1491 ),
1492 'SG' => array(
1493 'woocommerce_payments:with-in-person-payments',
1494 'woocommerce_payments:without-in-person-payments',
1495 'woocommerce_payments',
1496 'stripe',
1497 'airwallex_main',
1498 'ppcp-gateway',
1499 ),
1500 'CN' => array( 'airwallex_main', 'ppcp-gateway', 'payoneer-checkout' ),
1501 'FJ' => array(),
1502 'GU' => array(),
1503 'ID' => array( 'stripe', 'ppcp-gateway' ),
1504 'IN' => array( 'stripe', 'razorpay', 'payubiz', 'ppcp-gateway' ),
1505 'ZA' => array( 'payfast', 'paystack' ),
1506 'NG' => array( 'paystack' ),
1507 'GH' => array( 'paystack' ),
1508 'AE' => array(
1509 'woocommerce_payments:with-in-person-payments',
1510 'woocommerce_payments:without-in-person-payments',
1511 'woocommerce_payments',
1512 ),
1513 );
1514
1515 // If the country code is not in the list, return default priority.
1516 if ( ! isset( $recommendation_priority_map[ $country_code ] ) ) {
1517 return self::get_default_recommendation_priority( $gateway_id );
1518 }
1519
1520 $index = array_search( $gateway_id, $recommendation_priority_map[ $country_code ], true );
1521
1522 // If the gateway is not in the list, return the last index + 1.
1523 if ( false === $index ) {
1524 return count( $recommendation_priority_map[ $country_code ] );
1525 }
1526
1527 return $index;
1528 }
1529
1530 /**
1531 * Get the default recommendation priority for a payment gateway.
1532 * This is used when a country is not in the $recommendation_priority_map array.
1533 *
1534 * @param string $id Payment gateway id.
1535 * @return int Priority.
1536 */
1537 private static function get_default_recommendation_priority( $id ) {
1538 if ( ! $id || ! array_key_exists( $id, self::$recommendation_priority ) ) {
1539 return null;
1540 }
1541 return self::$recommendation_priority[ $id ];
1542 }
1543 }
1544