Skip to content

Commit

Permalink
Remove payment method definitions - will be re-added in individual PR…
Browse files Browse the repository at this point in the history
…s later.
  • Loading branch information
brettshumaker committed Feb 26, 2025
1 parent b55bca5 commit 6bcc283
Show file tree
Hide file tree
Showing 13 changed files with 129 additions and 994 deletions.
42 changes: 42 additions & 0 deletions client/payment-methods-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import classNames from 'classnames';

import {
AlipayIcon,
AffirmIcon,
AfterpayIcon,
ClearpayIcon,
BancontactIcon,
BankDebitIcon,
CreditCardIcon,
Expand All @@ -26,6 +29,8 @@ import {
WeChatPayIcon,
} from 'wcpay/payment-methods-icons';

const accountCountry = window.wcpaySettings?.accountStatus?.country || 'US';

import type { PaymentMethodMapEntry } from './types/payment-methods';

// Get any payment method definitions from the client.
Expand Down Expand Up @@ -204,6 +209,43 @@ const PaymentMethodInformationObject: Record<
allows_pay_later: false,
accepts_only_domestic_payment: false,
},
affirm: {
id: 'affirm',
label: __( 'Affirm', 'woocommerce-payments' ),
description: __(
'Allow customers to pay over time with Affirm.',
'woocommerce-payments'
),
icon: AffirmIcon,
currencies: [ 'USD', 'CAD' ],
stripe_key: 'affirm_payments',
allows_manual_capture: false,
allows_pay_later: true,
accepts_only_domestic_payment: true,
},
afterpay_clearpay: {
id: 'afterpay_clearpay',
label:
'GB' === accountCountry
? __( 'Clearpay', 'woocommerce-payments' )
: __( 'Afterpay', 'woocommerce-payments' ),
description:
'GB' === accountCountry
? __(
'Allow customers to pay over time with Clearpay.',
'woocommerce-payments'
)
: __(
'Allow customers to pay over time with Afterpay.',
'woocommerce-payments'
),
icon: 'GB' === accountCountry ? ClearpayIcon : AfterpayIcon,
currencies: [ 'USD', 'AUD', 'CAD', 'NZD', 'GBP' ],
stripe_key: 'afterpay_clearpay_payments',
allows_manual_capture: false,
allows_pay_later: true,
accepts_only_domestic_payment: true,
},
jcb: {
id: 'jcb',
label: __( 'JCB', 'woocommerce-payments' ),
Expand Down
7 changes: 7 additions & 0 deletions includes/class-duplicates-detection-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
}

use WC_Payments;
use WCPay\Payment_Methods\Affirm_Payment_Method;
use WCPay\Payment_Methods\Afterpay_Payment_Method;
use WCPay\Payment_Methods\Alipay_Payment_Method;
use WCPay\Payment_Methods\Bancontact_Payment_Method;
use WCPay\Payment_Methods\Becs_Payment_Method;
use WCPay\Payment_Methods\CC_Payment_Method;
use WCPay\Payment_Methods\Eps_Payment_Method;
use WCPay\Payment_Methods\Ideal_Payment_Method;
use WCPay\Payment_Methods\Klarna_Payment_Method;
use WCPay\Payment_Methods\P24_Payment_Method;
use WCPay\Payment_Methods\Sepa_Payment_Method;
use WCPay\Payment_Methods\Grabpay_Payment_Method;
Expand Down Expand Up @@ -103,6 +106,10 @@ private function search_for_additional_payment_methods() {
'ideal' => Ideal_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
'becs' => Becs_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
'eps' => Eps_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
'affirm' => Affirm_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
'afterpay' => Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
'clearpay' => Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
'klarna' => Klarna_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
'grabpay' => Grabpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
'wechatpay' => Wechatpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID,
];
Expand Down
9 changes: 7 additions & 2 deletions includes/class-wc-payment-gateway-wcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@
use WCPay\Tracker;
use WCPay\Internal\Service\Level3Service;
use WCPay\Internal\Service\OrderService;
use WCPay\Payment_Methods\Affirm_Payment_Method;
use WCPay\Payment_Methods\Afterpay_Payment_Method;
use WCPay\Payment_Methods\Bancontact_Payment_Method;
use WCPay\Payment_Methods\Becs_Payment_Method;
use WCPay\Payment_Methods\CC_Payment_Method;
use WCPay\Payment_Methods\Eps_Payment_Method;
use WCPay\Payment_Methods\Alipay_Payment_Method;
use WCPay\Payment_Methods\Ideal_Payment_Method;
use WCPay\Payment_Methods\Klarna_Payment_Method;
use WCPay\Payment_Methods\P24_Payment_Method;
use WCPay\Payment_Methods\Sepa_Payment_Method;
use WCPay\Payment_Methods\UPE_Payment_Method;
Expand Down Expand Up @@ -602,8 +605,7 @@ public function init_hooks() {
* @return void
*/
public function maybe_update_properties_with_country(): void {
// 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".
if ( AfterpayDefinition::get_id() !== $this->stripe_id ) {
if ( Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID !== $this->stripe_id ) {
return;
}
$account_country = $this->get_account_country();
Expand Down Expand Up @@ -3982,6 +3984,9 @@ public function get_upe_available_payment_methods() {
$available_methods[] = Sepa_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
$available_methods[] = P24_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
$available_methods[] = Link_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
$available_methods[] = Affirm_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
$available_methods[] = Afterpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
$available_methods[] = Klarna_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
$available_methods[] = Grabpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID;
$available_methods[] = Wechatpay_Payment_Method::PAYMENT_METHOD_STRIPE_ID;

Expand Down
6 changes: 6 additions & 0 deletions includes/class-wc-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use WCPay\Payment_Methods\Bancontact_Payment_Method;
use WCPay\Payment_Methods\Becs_Payment_Method;
use WCPay\Payment_Methods\Giropay_Payment_Method;
use WCPay\Payment_Methods\Klarna_Payment_Method;
use WCPay\Payment_Methods\P24_Payment_Method;
use WCPay\Payment_Methods\Sepa_Payment_Method;
use WCPay\Payment_Methods\Sofort_Payment_Method;
Expand All @@ -28,6 +29,8 @@
use WCPay\WooPay\WooPay_Utilities;
use WCPay\WooPay\WooPay_Order_Status_Sync;
use WCPay\Payment_Methods\Link_Payment_Method;
use WCPay\Payment_Methods\Affirm_Payment_Method;
use WCPay\Payment_Methods\Afterpay_Payment_Method;
use WCPay\Session_Rate_Limiter;
use WCPay\Database_Cache;
use WCPay\WC_Payments_Checkout;
Expand Down Expand Up @@ -576,6 +579,9 @@ public static function init() {
Becs_Payment_Method::class,
Eps_Payment_Method::class,
Link_Payment_Method::class,
Affirm_Payment_Method::class,
Afterpay_Payment_Method::class,
Klarna_Payment_Method::class,
Grabpay_Payment_Method::class,
Wechatpay_Payment_Method::class,
];
Expand Down
Loading

0 comments on commit 6bcc283

Please sign in to comment.