Skip to content

Commit

Permalink
Displaying Clearpay instead of Afterpay for UK based stores in wp-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
gpressutto5 committed Jan 8, 2024
1 parent 897a83f commit 707e45f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
1 change: 1 addition & 0 deletions client/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ declare global {
capabilityRequestNotices: Record< string, boolean >;
storeName: string;
isNextDepositNoticeDismissed: boolean;
accountCountry: string;
};

const wcTracks: any;
Expand Down
5 changes: 5 additions & 0 deletions client/payment-methods-icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import IdealAsset from 'assets/images/payment-methods/ideal.svg?asset';
import BankDebitAsset from 'assets/images/payment-methods/bank-debit.svg?asset';
import AffirmAsset from 'assets/images/payment-methods/affirm.svg?asset';
import AfterpayAsset from 'assets/images/payment-methods/afterpay.svg?asset';
import ClearpayAsset from 'assets/images/payment-methods/clearpay.svg?asset';
import JCBAsset from 'assets/images/payment-methods/jcb.svg?asset';
import KlarnaAsset from 'assets/images/payment-methods/klarna.svg?asset';
import VisaAsset from 'assets/images/cards/visa.svg?asset';
Expand Down Expand Up @@ -57,6 +58,10 @@ export const AfterpayIcon = iconComponent(
AfterpayAsset,
__( 'Afterpay', 'woocommerce-payments' )
);
export const ClearpayIcon = iconComponent(
ClearpayAsset,
__( 'Clearpay', 'woocommerce-payments' )
);
export const AmericanExpressIcon = iconComponent(
AmexAsset,
__( 'American Express', 'woocommerce-payments' )
Expand Down
43 changes: 33 additions & 10 deletions client/payment-methods-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { __ } from '@wordpress/i18n';
import {
AffirmIcon,
AfterpayIcon,
ClearpayIcon,
BancontactIcon,
BankDebitIcon,
CreditCardIcon,
Expand Down Expand Up @@ -208,16 +209,38 @@ const PaymentMethodInformationObject: Record<
},
afterpay_clearpay: {
id: 'afterpay_clearpay',
label: __( 'Afterpay', 'woocommerce-payments' ),
brandTitles: {
afterpay_clearpay: __( 'Afterpay', 'woocommerce-payments' ),
},
description: __(
// translators: %s is the store currency.
'Allow customers to pay over time with Afterpay. Available to all customers paying in %s.',
'woocommerce-payments'
),
icon: AfterpayIcon,
label:
'GB' === wcpaySettings.accountCountry
? __( 'Clearpay', 'woocommerce-payments' )
: __( 'Afterpay', 'woocommerce-payments' ),
brandTitles:
'GB' === wcpaySettings.accountCountry
? {
afterpay_clearpay: __(
'Clearpay',
'woocommerce-payments'
),
}
: {
afterpay_clearpay: __(
'Afterpay',
'woocommerce-payments'
),
},
description:
'GB' === wcpaySettings.accountCountry
? __(
// translators: %s is the store currency.
'Allow customers to pay over time with Clearpay. Available to all customers paying in %s.',
'woocommerce-payments'
)
: __(
// translators: %s is the store currency.
'Allow customers to pay over time with Afterpay. Available to all customers paying in %s.',
'woocommerce-payments'
),
icon:
'GB' === wcpaySettings.accountCountry ? ClearpayIcon : AfterpayIcon,
currencies: [ 'USD', 'AUD', 'CAD', 'NZD', 'GBP', 'EUR' ],
stripe_key: 'afterpay_clearpay_payments',
allows_manual_capture: false,
Expand Down
1 change: 1 addition & 0 deletions includes/admin/class-wc-payments-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@ private function get_js_settings(): array {
'storeCurrency' => get_option( 'woocommerce_currency' ),
'isBnplAffirmAfterpayEnabled' => WC_Payments_Features::is_bnpl_affirm_afterpay_enabled(),
'isWooPayStoreCountryAvailable' => WooPay_Utilities::is_store_country_available(),
'accountCountry' => $this->account->get_account_country(),
'woopayLastDisableDate' => $this->wcpay_gateway->get_option( 'platform_checkout_last_disable_date' ),
'isStripeBillingEnabled' => WC_Payments_Features::is_stripe_billing_enabled(),
'isStripeBillingEligible' => WC_Payments_Features::is_stripe_billing_eligible(),
Expand Down

0 comments on commit 707e45f

Please sign in to comment.