Skip to content

Commit e07327d

Browse files
authored
refactor: payment method definition capability duplication (#11148)
1 parent eb1b9ca commit e07327d

16 files changed

+216
-570
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: update
3+
4+
refactor: update payment method definition classes to delegate capabilities to PaymentMethodUtils

includes/payment-methods/Configs/Definitions/AffirmDefinition.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -77,42 +77,6 @@ public static function get_description( ?string $account_country = null ): strin
7777
return __( 'Allow customers to pay over time with Affirm.', 'woocommerce-payments' );
7878
}
7979

80-
/**
81-
* Is the payment method a BNPL (Buy Now Pay Later) payment method?
82-
*
83-
* @return boolean
84-
*/
85-
public static function is_bnpl(): bool {
86-
return PaymentMethodUtils::is_bnpl( self::get_capabilities() );
87-
}
88-
89-
/**
90-
* Is the payment method a reusable payment method?
91-
*
92-
* @return boolean
93-
*/
94-
public static function is_reusable(): bool {
95-
return PaymentMethodUtils::is_reusable( self::get_capabilities() );
96-
}
97-
98-
/**
99-
* Does the payment method accept only domestic payments?
100-
*
101-
* @return boolean
102-
*/
103-
public static function accepts_only_domestic_payments(): bool {
104-
return PaymentMethodUtils::accepts_only_domestic_payments( self::get_capabilities() );
105-
}
106-
107-
/**
108-
* Does the payment method allow manual capture?
109-
*
110-
* @return boolean
111-
*/
112-
public static function allows_manual_capture(): bool {
113-
return PaymentMethodUtils::allows_manual_capture( self::get_capabilities() );
114-
}
115-
11680
/**
11781
* Get the list of supported currencies
11882
*
@@ -227,15 +191,6 @@ public static function is_available_for( string $currency, string $account_count
227191
return PaymentMethodUtils::is_available_for( self::get_supported_currencies(), self::get_supported_countries(), $currency, $account_country );
228192
}
229193

230-
/**
231-
* Whether this payment method should be enabled by default
232-
*
233-
* @return bool
234-
*/
235-
public static function is_enabled_by_default(): bool {
236-
return false;
237-
}
238-
239194
/**
240195
* Get the minimum amount for this payment method for a given currency and country
241196
*

includes/payment-methods/Configs/Definitions/AlipayDefinition.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -77,42 +77,6 @@ public static function get_description( ?string $account_country = null ): strin
7777
return __( 'Alipay is a popular wallet in China, operated by Ant Financial Services Group, a financial services provider affiliated with Alibaba.', 'woocommerce-payments' );
7878
}
7979

80-
/**
81-
* Is the payment method a BNPL (Buy Now Pay Later) payment method?
82-
*
83-
* @return boolean
84-
*/
85-
public static function is_bnpl(): bool {
86-
return PaymentMethodUtils::is_bnpl( self::get_capabilities() );
87-
}
88-
89-
/**
90-
* Is the payment method a reusable payment method?
91-
*
92-
* @return boolean
93-
*/
94-
public static function is_reusable(): bool {
95-
return PaymentMethodUtils::is_reusable( self::get_capabilities() );
96-
}
97-
98-
/**
99-
* Does the payment method accept only domestic payments?
100-
*
101-
* @return boolean
102-
*/
103-
public static function accepts_only_domestic_payments(): bool {
104-
return PaymentMethodUtils::accepts_only_domestic_payments( self::get_capabilities() );
105-
}
106-
107-
/**
108-
* Does the payment method allow manual capture?
109-
*
110-
* @return boolean
111-
*/
112-
public static function allows_manual_capture(): bool {
113-
return PaymentMethodUtils::allows_manual_capture( self::get_capabilities() );
114-
}
115-
11680
/**
11781
* Get the list of supported currencies
11882
*
@@ -283,15 +247,6 @@ public static function is_available_for( string $currency, string $account_count
283247
return PaymentMethodUtils::is_available_for( self::get_supported_currencies(), self::get_supported_countries(), $currency, $account_country );
284248
}
285249

286-
/**
287-
* Whether this payment method should be enabled by default
288-
*
289-
* @return bool
290-
*/
291-
public static function is_enabled_by_default(): bool {
292-
return false;
293-
}
294-
295250
/**
296251
* Get the minimum amount for this payment method for a given currency and country
297252
*

includes/payment-methods/Configs/Definitions/BancontactDefinition.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -77,42 +77,6 @@ public static function get_description( ?string $account_country = null ): strin
7777
return __( 'Bancontact is a bank redirect payment method offered by more than 80% of online businesses in Belgium.', 'woocommerce-payments' );
7878
}
7979

80-
/**
81-
* Is the payment method a BNPL (Buy Now Pay Later) payment method?
82-
*
83-
* @return boolean
84-
*/
85-
public static function is_bnpl(): bool {
86-
return PaymentMethodUtils::is_bnpl( self::get_capabilities() );
87-
}
88-
89-
/**
90-
* Is the payment method a reusable payment method?
91-
*
92-
* @return boolean
93-
*/
94-
public static function is_reusable(): bool {
95-
return PaymentMethodUtils::is_reusable( self::get_capabilities() );
96-
}
97-
98-
/**
99-
* Does the payment method accept only domestic payments?
100-
*
101-
* @return boolean
102-
*/
103-
public static function accepts_only_domestic_payments(): bool {
104-
return PaymentMethodUtils::accepts_only_domestic_payments( self::get_capabilities() );
105-
}
106-
107-
/**
108-
* Does the payment method allow manual capture?
109-
*
110-
* @return boolean
111-
*/
112-
public static function allows_manual_capture(): bool {
113-
return PaymentMethodUtils::allows_manual_capture( self::get_capabilities() );
114-
}
115-
11680
/**
11781
* Get the list of supported currencies
11882
*
@@ -206,15 +170,6 @@ public static function is_available_for( string $currency, string $account_count
206170
return PaymentMethodUtils::is_available_for( self::get_supported_currencies(), self::get_supported_countries(), $currency, $account_country );
207171
}
208172

209-
/**
210-
* Whether this payment method should be enabled by default
211-
*
212-
* @return bool
213-
*/
214-
public static function is_enabled_by_default(): bool {
215-
return false;
216-
}
217-
218173
/**
219174
* Get the minimum amount for this payment method for a given currency and country
220175
*

includes/payment-methods/Configs/Definitions/EpsDefinition.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -77,42 +77,6 @@ public static function get_description( ?string $account_country = null ): strin
7777
return __( 'Accept your payment with EPS — a common payment method in Austria.', 'woocommerce-payments' );
7878
}
7979

80-
/**
81-
* Is the payment method a BNPL (Buy Now Pay Later) payment method?
82-
*
83-
* @return boolean
84-
*/
85-
public static function is_bnpl(): bool {
86-
return PaymentMethodUtils::is_bnpl( self::get_capabilities() );
87-
}
88-
89-
/**
90-
* Is the payment method a reusable payment method?
91-
*
92-
* @return boolean
93-
*/
94-
public static function is_reusable(): bool {
95-
return PaymentMethodUtils::is_reusable( self::get_capabilities() );
96-
}
97-
98-
/**
99-
* Does the payment method accept only domestic payments?
100-
*
101-
* @return boolean
102-
*/
103-
public static function accepts_only_domestic_payments(): bool {
104-
return PaymentMethodUtils::accepts_only_domestic_payments( self::get_capabilities() );
105-
}
106-
107-
/**
108-
* Does the payment method allow manual capture?
109-
*
110-
* @return boolean
111-
*/
112-
public static function allows_manual_capture(): bool {
113-
return PaymentMethodUtils::allows_manual_capture( self::get_capabilities() );
114-
}
115-
11680
/**
11781
* Get the list of supported currencies
11882
*
@@ -206,15 +170,6 @@ public static function is_available_for( string $currency, string $account_count
206170
return PaymentMethodUtils::is_available_for( self::get_supported_currencies(), self::get_supported_countries(), $currency, $account_country );
207171
}
208172

209-
/**
210-
* Whether this payment method should be enabled by default
211-
*
212-
* @return bool
213-
*/
214-
public static function is_enabled_by_default(): bool {
215-
return false;
216-
}
217-
218173
/**
219174
* Get the minimum amount for this payment method for a given currency and country
220175
*

includes/payment-methods/Configs/Definitions/GiropayDefinition.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -77,42 +77,6 @@ public static function get_description( ?string $account_country = null ): strin
7777
return __( 'Expand your business with giropay — Germany\'s second most popular payment system.', 'woocommerce-payments' );
7878
}
7979

80-
/**
81-
* Is the payment method a BNPL (Buy Now Pay Later) payment method?
82-
*
83-
* @return boolean
84-
*/
85-
public static function is_bnpl(): bool {
86-
return PaymentMethodUtils::is_bnpl( self::get_capabilities() );
87-
}
88-
89-
/**
90-
* Is the payment method a reusable payment method?
91-
*
92-
* @return boolean
93-
*/
94-
public static function is_reusable(): bool {
95-
return PaymentMethodUtils::is_reusable( self::get_capabilities() );
96-
}
97-
98-
/**
99-
* Does the payment method accept only domestic payments?
100-
*
101-
* @return boolean
102-
*/
103-
public static function accepts_only_domestic_payments(): bool {
104-
return PaymentMethodUtils::accepts_only_domestic_payments( self::get_capabilities() );
105-
}
106-
107-
/**
108-
* Does the payment method allow manual capture?
109-
*
110-
* @return boolean
111-
*/
112-
public static function allows_manual_capture(): bool {
113-
return PaymentMethodUtils::allows_manual_capture( self::get_capabilities() );
114-
}
115-
11680
/**
11781
* Get the list of supported currencies
11882
*
@@ -207,15 +171,6 @@ public static function is_available_for( string $currency, string $account_count
207171
return PaymentMethodUtils::is_available_for( self::get_supported_currencies(), self::get_supported_countries(), $currency, $account_country );
208172
}
209173

210-
/**
211-
* Whether this payment method should be enabled by default
212-
*
213-
* @return bool
214-
*/
215-
public static function is_enabled_by_default(): bool {
216-
return false;
217-
}
218-
219174
/**
220175
* Get the minimum amount for this payment method for a given currency and country
221176
*

includes/payment-methods/Configs/Definitions/IdealDefinition.php

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -77,42 +77,6 @@ public static function get_description( ?string $account_country = null ): strin
7777
return __( 'Expand your business with iDEAL — Netherlands\'s most popular payment method.', 'woocommerce-payments' );
7878
}
7979

80-
/**
81-
* Is the payment method a BNPL (Buy Now Pay Later) payment method?
82-
*
83-
* @return boolean
84-
*/
85-
public static function is_bnpl(): bool {
86-
return PaymentMethodUtils::is_bnpl( self::get_capabilities() );
87-
}
88-
89-
/**
90-
* Is the payment method a reusable payment method?
91-
*
92-
* @return boolean
93-
*/
94-
public static function is_reusable(): bool {
95-
return PaymentMethodUtils::is_reusable( self::get_capabilities() );
96-
}
97-
98-
/**
99-
* Does the payment method accept only domestic payments?
100-
*
101-
* @return boolean
102-
*/
103-
public static function accepts_only_domestic_payments(): bool {
104-
return PaymentMethodUtils::accepts_only_domestic_payments( self::get_capabilities() );
105-
}
106-
107-
/**
108-
* Does the payment method allow manual capture?
109-
*
110-
* @return boolean
111-
*/
112-
public static function allows_manual_capture(): bool {
113-
return PaymentMethodUtils::allows_manual_capture( self::get_capabilities() );
114-
}
115-
11680
/**
11781
* Get the list of supported currencies
11882
*
@@ -207,15 +171,6 @@ public static function is_available_for( string $currency, string $account_count
207171
return PaymentMethodUtils::is_available_for( self::get_supported_currencies(), self::get_supported_countries(), $currency, $account_country );
208172
}
209173

210-
/**
211-
* Whether this payment method should be enabled by default
212-
*
213-
* @return bool
214-
*/
215-
public static function is_enabled_by_default(): bool {
216-
return false;
217-
}
218-
219174
/**
220175
* Get the minimum amount for this payment method for a given currency and country
221176
*

0 commit comments

Comments
 (0)