Skip to content

Commit a473903

Browse files
authored
refactor: EZ payment methods to payment definitions (#11138)
1 parent 5cfe938 commit a473903

29 files changed

Lines changed: 1956 additions & 590 deletions
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: dev
3+
4+
refactor: updating some payment methods to use payment definitions instead

includes/class-duplicates-detection-service.php

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@
1212
}
1313

1414
use WC_Payments;
15-
use WCPay\Payment_Methods\Affirm_Payment_Method;
1615
use WCPay\Payment_Methods\Afterpay_Payment_Method;
17-
use WCPay\Payment_Methods\Bancontact_Payment_Method;
1816
use WCPay\Payment_Methods\Becs_Payment_Method;
1917
use WCPay\Payment_Methods\CC_Payment_Method;
20-
use WCPay\Payment_Methods\Eps_Payment_Method;
21-
use WCPay\Payment_Methods\Ideal_Payment_Method;
2218
use WCPay\Payment_Methods\Klarna_Payment_Method;
23-
use WCPay\Payment_Methods\P24_Payment_Method;
2419
use WCPay\Payment_Methods\Sepa_Payment_Method;
2520
use WCPay\Payment_Methods\Grabpay_Payment_Method;
2621
use WCPay\PaymentMethods\Configs\Registry\PaymentMethodDefinitionRegistry;
@@ -98,18 +93,12 @@ private function search_for_additional_payment_methods() {
9893
* As payment methods are converted to use definitions, they need to be removed from the list below.
9994
*/
10095
$keywords = [
101-
'bancontact' => Bancontact_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
102-
'sepa' => Sepa_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
103-
'p24' => P24_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
104-
'przelewy24' => P24_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
105-
'ideal' => Ideal_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
106-
'becs' => Becs_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
107-
'eps' => Eps_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
108-
'affirm' => Affirm_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
109-
'afterpay' => Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
110-
'clearpay' => Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
111-
'klarna' => Klarna_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
112-
'grabpay' => Grabpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
96+
'sepa' => Sepa_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
97+
'becs' => Becs_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
98+
'afterpay' => Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
99+
'clearpay' => Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
100+
'klarna' => Klarna_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
101+
'grabpay' => Grabpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
113102
];
114103

115104
// Get all payment method definitions.

includes/class-wc-payment-gateway-wcpay.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
use WCPay\Core\Server\Request\Capture_Intention;
3838
use WCPay\Core\Server\Request\Create_And_Confirm_Intention;
3939
use WCPay\Core\Server\Request\Create_And_Confirm_Setup_Intention;
40-
use WCPay\Core\Server\Request\Create_Intention;
4140
use WCPay\Core\Server\Request\Get_Charge;
4241
use WCPay\Core\Server\Request\Get_Intention;
4342
use WCPay\Core\Server\Request\Get_Setup_Intention;
@@ -52,20 +51,14 @@
5251
use WCPay\Payment_Methods\Link_Payment_Method;
5352
use WCPay\WooPay\WooPay_Order_Status_Sync;
5453
use WCPay\WooPay\WooPay_Utilities;
55-
use WCPay\WooPay\WooPay_Session;
5654
use WCPay\Session_Rate_Limiter;
5755
use WCPay\Tracker;
5856
use WCPay\Internal\Service\Level3Service;
5957
use WCPay\Internal\Service\OrderService;
60-
use WCPay\Payment_Methods\Affirm_Payment_Method;
6158
use WCPay\Payment_Methods\Afterpay_Payment_Method;
62-
use WCPay\Payment_Methods\Bancontact_Payment_Method;
6359
use WCPay\Payment_Methods\Becs_Payment_Method;
6460
use WCPay\Payment_Methods\CC_Payment_Method;
65-
use WCPay\Payment_Methods\Eps_Payment_Method;
66-
use WCPay\Payment_Methods\Ideal_Payment_Method;
6761
use WCPay\Payment_Methods\Klarna_Payment_Method;
68-
use WCPay\Payment_Methods\P24_Payment_Method;
6962
use WCPay\Payment_Methods\Sepa_Payment_Method;
7063
use WCPay\Payment_Methods\UPE_Payment_Method;
7164
use WCPay\Payment_Methods\Multibanco_Payment_Method;
@@ -4088,13 +4081,8 @@ public function get_upe_available_payment_methods() {
40884081
* As payment methods are converted to use definitions, they need to be removed from the list below.
40894082
*/
40904083
$available_methods[] = Becs_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
4091-
$available_methods[] = Bancontact_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
4092-
$available_methods[] = Eps_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
4093-
$available_methods[] = Ideal_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
40944084
$available_methods[] = Sepa_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
4095-
$available_methods[] = P24_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
40964085
$available_methods[] = Link_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
4097-
$available_methods[] = Affirm_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
40984086
$available_methods[] = Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
40994087
$available_methods[] = Klarna_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
41004088
$available_methods[] = Multibanco_Payment_Method::PAYMENT_METHOD_STRIPE_ID;

includes/class-wc-payments.php

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,17 @@
1313
use WCPay\Core\Server\Request;
1414
use WCPay\Migrations\Allowed_Payment_Request_Button_Types_Update;
1515
use WCPay\Payment_Methods\CC_Payment_Method;
16-
use WCPay\Payment_Methods\Bancontact_Payment_Method;
1716
use WCPay\Payment_Methods\Becs_Payment_Method;
18-
use WCPay\Payment_Methods\Giropay_Payment_Method;
1917
use WCPay\Payment_Methods\Klarna_Payment_Method;
20-
use WCPay\Payment_Methods\P24_Payment_Method;
2118
use WCPay\Payment_Methods\Sepa_Payment_Method;
22-
use WCPay\Payment_Methods\Sofort_Payment_Method;
23-
use WCPay\Payment_Methods\Ideal_Payment_Method;
24-
use WCPay\Payment_Methods\Eps_Payment_Method;
2519
use WCPay\Payment_Methods\UPE_Payment_Method;
2620
use WCPay\Payment_Methods\Multibanco_Payment_Method;
21+
use WCPay\PaymentMethods\Configs\Definitions\GiropayDefinition;
22+
use WCPay\PaymentMethods\Configs\Definitions\SofortDefinition;
2723
use WCPay\WooPay_Tracker;
2824
use WCPay\WooPay\WooPay_Utilities;
2925
use WCPay\WooPay\WooPay_Order_Status_Sync;
3026
use WCPay\Payment_Methods\Link_Payment_Method;
31-
use WCPay\Payment_Methods\Affirm_Payment_Method;
3227
use WCPay\Payment_Methods\Afterpay_Payment_Method;
3328
use WCPay\Session_Rate_Limiter;
3429
use WCPay\Database_Cache;
@@ -434,16 +429,9 @@ public static function init() {
434429
include_once __DIR__ . '/payment-methods/class-cc-payment-gateway.php';
435430
include_once __DIR__ . '/payment-methods/class-upe-payment-method.php';
436431
include_once __DIR__ . '/payment-methods/class-cc-payment-method.php';
437-
include_once __DIR__ . '/payment-methods/class-bancontact-payment-method.php';
438432
include_once __DIR__ . '/payment-methods/class-sepa-payment-method.php';
439-
include_once __DIR__ . '/payment-methods/class-giropay-payment-method.php';
440-
include_once __DIR__ . '/payment-methods/class-p24-payment-method.php';
441-
include_once __DIR__ . '/payment-methods/class-sofort-payment-method.php';
442-
include_once __DIR__ . '/payment-methods/class-ideal-payment-method.php';
443433
include_once __DIR__ . '/payment-methods/class-becs-payment-method.php';
444-
include_once __DIR__ . '/payment-methods/class-eps-payment-method.php';
445434
include_once __DIR__ . '/payment-methods/class-link-payment-method.php';
446-
include_once __DIR__ . '/payment-methods/class-affirm-payment-method.php';
447435
include_once __DIR__ . '/payment-methods/class-afterpay-payment-method.php';
448436
include_once __DIR__ . '/payment-methods/class-klarna-payment-method.php';
449437
include_once __DIR__ . '/payment-methods/class-multibanco-payment-method.php';
@@ -583,16 +571,9 @@ public static function init() {
583571
*/
584572
$payment_method_classes = [
585573
CC_Payment_Method::class,
586-
Bancontact_Payment_Method::class,
587574
Sepa_Payment_Method::class,
588-
Giropay_Payment_Method::class,
589-
Sofort_Payment_Method::class,
590-
P24_Payment_Method::class,
591-
Ideal_Payment_Method::class,
592575
Becs_Payment_Method::class,
593-
Eps_Payment_Method::class,
594576
Link_Payment_Method::class,
595-
Affirm_Payment_Method::class,
596577
Afterpay_Payment_Method::class,
597578
Klarna_Payment_Method::class,
598579
Multibanco_Payment_Method::class,
@@ -719,8 +700,8 @@ function () {
719700
add_action( 'woocommerce_woocommerce_payments_updated', [ new \WCPay\Migrations\Link_WooPay_Mutual_Exclusion_Handler( self::get_gateway() ), 'maybe_migrate' ] );
720701
add_action( 'woocommerce_woocommerce_payments_updated', [ new \WCPay\Migrations\Gateway_Settings_Sync( self::get_gateway(), self::get_payment_gateway_map() ), 'maybe_sync' ] );
721702
add_action( 'woocommerce_woocommerce_payments_updated', [ '\WCPay\Migrations\Delete_Active_WooPay_Webhook', 'maybe_delete' ] );
722-
add_action( 'woocommerce_woocommerce_payments_updated', [ new \WCPay\Migrations\Payment_Method_Deprecation_Settings_Update( self::get_gateway(), self::get_payment_gateway_map(), Giropay_Payment_Method::PAYMENT_METHOD_STRIPE_ID, '7.9.0' ), 'maybe_migrate' ] );
723-
add_action( 'woocommerce_woocommerce_payments_updated', [ new \WCPay\Migrations\Payment_Method_Deprecation_Settings_Update( self::get_gateway(), self::get_payment_gateway_map(), Sofort_Payment_Method::PAYMENT_METHOD_STRIPE_ID, '8.9.0' ), 'maybe_migrate' ] );
703+
add_action( 'woocommerce_woocommerce_payments_updated', [ new \WCPay\Migrations\Payment_Method_Deprecation_Settings_Update( self::get_gateway(), self::get_payment_gateway_map(), GiropayDefinition::get_stripe_id(), '7.9.0' ), 'maybe_migrate' ] );
704+
add_action( 'woocommerce_woocommerce_payments_updated', [ new \WCPay\Migrations\Payment_Method_Deprecation_Settings_Update( self::get_gateway(), self::get_payment_gateway_map(), SofortDefinition::get_stripe_id(), '8.9.0' ), 'maybe_migrate' ] );
724705
add_action( 'woocommerce_woocommerce_payments_updated', [ new \WCPay\Migrations\Erase_Bnpl_Announcement_Meta(), 'maybe_migrate' ] );
725706
add_action( 'woocommerce_woocommerce_payments_updated', [ new \WCPay\Migrations\Erase_Deprecated_Flags_And_Options(), 'maybe_migrate' ] );
726707
add_action( 'woocommerce_woocommerce_payments_updated', [ new \WCPay\Migrations\Manual_Capture_Payment_Method_Settings_Update( self::get_gateway(), self::get_payment_gateway_map() ), 'maybe_migrate' ] );

0 commit comments

Comments
 (0)