Skip to content

Commit 6bcc283

Browse files
committed
Remove payment method definitions - will be re-added in individual PRs later.
1 parent b55bca5 commit 6bcc283

13 files changed

+129
-994
lines changed

client/payment-methods-map.tsx

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import classNames from 'classnames';
1111

1212
import {
1313
AlipayIcon,
14+
AffirmIcon,
15+
AfterpayIcon,
16+
ClearpayIcon,
1417
BancontactIcon,
1518
BankDebitIcon,
1619
CreditCardIcon,
@@ -26,6 +29,8 @@ import {
2629
WeChatPayIcon,
2730
} from 'wcpay/payment-methods-icons';
2831

32+
const accountCountry = window.wcpaySettings?.accountStatus?.country || 'US';
33+
2934
import type { PaymentMethodMapEntry } from './types/payment-methods';
3035

3136
// Get any payment method definitions from the client.
@@ -204,6 +209,43 @@ const PaymentMethodInformationObject: Record<
204209
allows_pay_later: false,
205210
accepts_only_domestic_payment: false,
206211
},
212+
affirm: {
213+
id: 'affirm',
214+
label: __( 'Affirm', 'woocommerce-payments' ),
215+
description: __(
216+
'Allow customers to pay over time with Affirm.',
217+
'woocommerce-payments'
218+
),
219+
icon: AffirmIcon,
220+
currencies: [ 'USD', 'CAD' ],
221+
stripe_key: 'affirm_payments',
222+
allows_manual_capture: false,
223+
allows_pay_later: true,
224+
accepts_only_domestic_payment: true,
225+
},
226+
afterpay_clearpay: {
227+
id: 'afterpay_clearpay',
228+
label:
229+
'GB' === accountCountry
230+
? __( 'Clearpay', 'woocommerce-payments' )
231+
: __( 'Afterpay', 'woocommerce-payments' ),
232+
description:
233+
'GB' === accountCountry
234+
? __(
235+
'Allow customers to pay over time with Clearpay.',
236+
'woocommerce-payments'
237+
)
238+
: __(
239+
'Allow customers to pay over time with Afterpay.',
240+
'woocommerce-payments'
241+
),
242+
icon: 'GB' === accountCountry ? ClearpayIcon : AfterpayIcon,
243+
currencies: [ 'USD', 'AUD', 'CAD', 'NZD', 'GBP' ],
244+
stripe_key: 'afterpay_clearpay_payments',
245+
allows_manual_capture: false,
246+
allows_pay_later: true,
247+
accepts_only_domestic_payment: true,
248+
},
207249
jcb: {
208250
id: 'jcb',
209251
label: __( 'JCB', 'woocommerce-payments' ),

includes/class-duplicates-detection-service.php

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

1414
use WC_Payments;
15+
use WCPay\Payment_Methods\Affirm_Payment_Method;
16+
use WCPay\Payment_Methods\Afterpay_Payment_Method;
1517
use WCPay\Payment_Methods\Alipay_Payment_Method;
1618
use WCPay\Payment_Methods\Bancontact_Payment_Method;
1719
use WCPay\Payment_Methods\Becs_Payment_Method;
1820
use WCPay\Payment_Methods\CC_Payment_Method;
1921
use WCPay\Payment_Methods\Eps_Payment_Method;
2022
use WCPay\Payment_Methods\Ideal_Payment_Method;
23+
use WCPay\Payment_Methods\Klarna_Payment_Method;
2124
use WCPay\Payment_Methods\P24_Payment_Method;
2225
use WCPay\Payment_Methods\Sepa_Payment_Method;
2326
use WCPay\Payment_Methods\Grabpay_Payment_Method;
@@ -103,6 +106,10 @@ private function search_for_additional_payment_methods() {
103106
'ideal' => Ideal_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
104107
'becs' => Becs_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
105108
'eps' => Eps_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
109+
'affirm' => Affirm_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
110+
'afterpay' => Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
111+
'clearpay' => Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
112+
'klarna' => Klarna_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
106113
'grabpay' => Grabpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
107114
'wechatpay' => Wechatpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
108115
];

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,15 @@
5555
use WCPay\Tracker;
5656
use WCPay\Internal\Service\Level3Service;
5757
use WCPay\Internal\Service\OrderService;
58+
use WCPay\Payment_Methods\Affirm_Payment_Method;
59+
use WCPay\Payment_Methods\Afterpay_Payment_Method;
5860
use WCPay\Payment_Methods\Bancontact_Payment_Method;
5961
use WCPay\Payment_Methods\Becs_Payment_Method;
6062
use WCPay\Payment_Methods\CC_Payment_Method;
6163
use WCPay\Payment_Methods\Eps_Payment_Method;
6264
use WCPay\Payment_Methods\Alipay_Payment_Method;
6365
use WCPay\Payment_Methods\Ideal_Payment_Method;
66+
use WCPay\Payment_Methods\Klarna_Payment_Method;
6467
use WCPay\Payment_Methods\P24_Payment_Method;
6568
use WCPay\Payment_Methods\Sepa_Payment_Method;
6669
use WCPay\Payment_Methods\UPE_Payment_Method;
@@ -602,8 +605,7 @@ public function init_hooks() {
602605
* @return void
603606
*/
604607
public function maybe_update_properties_with_country(): void {
605-
// TODO: This used to call get_stripe_id() on the payment method class. That method used to just return 'afterpay_clearpay'. There are other places in the code that "stripe ID" refers to "afterpay_clearpay_payments".
606-
if ( AfterpayDefinition::get_id() !== $this->stripe_id ) {
608+
if ( Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID !== $this->stripe_id ) {
607609
return;
608610
}
609611
$account_country = $this->get_account_country();
@@ -3982,6 +3984,9 @@ public function get_upe_available_payment_methods() {
39823984
$available_methods[] = Sepa_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
39833985
$available_methods[] = P24_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
39843986
$available_methods[] = Link_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
3987+
$available_methods[] = Affirm_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
3988+
$available_methods[] = Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
3989+
$available_methods[] = Klarna_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
39853990
$available_methods[] = Grabpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
39863991
$available_methods[] = Wechatpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
39873992

includes/class-wc-payments.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use WCPay\Payment_Methods\Bancontact_Payment_Method;
1818
use WCPay\Payment_Methods\Becs_Payment_Method;
1919
use WCPay\Payment_Methods\Giropay_Payment_Method;
20+
use WCPay\Payment_Methods\Klarna_Payment_Method;
2021
use WCPay\Payment_Methods\P24_Payment_Method;
2122
use WCPay\Payment_Methods\Sepa_Payment_Method;
2223
use WCPay\Payment_Methods\Sofort_Payment_Method;
@@ -28,6 +29,8 @@
2829
use WCPay\WooPay\WooPay_Utilities;
2930
use WCPay\WooPay\WooPay_Order_Status_Sync;
3031
use WCPay\Payment_Methods\Link_Payment_Method;
32+
use WCPay\Payment_Methods\Affirm_Payment_Method;
33+
use WCPay\Payment_Methods\Afterpay_Payment_Method;
3134
use WCPay\Session_Rate_Limiter;
3235
use WCPay\Database_Cache;
3336
use WCPay\WC_Payments_Checkout;
@@ -576,6 +579,9 @@ public static function init() {
576579
Becs_Payment_Method::class,
577580
Eps_Payment_Method::class,
578581
Link_Payment_Method::class,
582+
Affirm_Payment_Method::class,
583+
Afterpay_Payment_Method::class,
584+
Klarna_Payment_Method::class,
579585
Grabpay_Payment_Method::class,
580586
Wechatpay_Payment_Method::class,
581587
];

0 commit comments

Comments
 (0)