From 15e8a88e3f28e8da450391587d589aff236a8077 Mon Sep 17 00:00:00 2001 From: Eric Jinks <3147296+Jinksi@users.noreply.github.com> Date: Tue, 30 Apr 2024 07:53:55 +1000 Subject: [PATCH] Use correct currency in Payment Activity Card (#8701) Co-authored-by: Shendy <73803630+shendy-a8c@users.noreply.github.com> --- ...ent-activity-card-default-account-currency | 5 +++ .../payment-activity-data.tsx | 12 +++---- .../payment-activity/payment-data-tile.tsx | 8 ++--- .../test/__snapshots__/index.test.tsx.snap | 35 +++++++++++-------- .../payment-data-tile.test.tsx.snap | 5 +-- .../payment-activity/test/index.test.tsx | 17 +++++++-- .../test/payment-data-tile.test.tsx | 15 ++++---- client/data/payment-activity/resolvers.ts | 4 +-- client/data/payment-activity/selectors.ts | 6 ++-- .../data/payment-activity/test/hooks.test.ts | 1 + .../payment-activity/test/reducer.test.ts | 5 +++ client/data/payment-activity/types.d.ts | 33 +++++++++++------ 12 files changed, 95 insertions(+), 51 deletions(-) create mode 100644 changelog/fix-8700-payment-activity-card-default-account-currency diff --git a/changelog/fix-8700-payment-activity-card-default-account-currency b/changelog/fix-8700-payment-activity-card-default-account-currency new file mode 100644 index 00000000000..73671f1477b --- /dev/null +++ b/changelog/fix-8700-payment-activity-card-default-account-currency @@ -0,0 +1,5 @@ +Significance: patch +Type: fix +Comment: Update Payment Activity Card to use correct currency for rendering amounts. + + diff --git a/client/components/payment-activity/payment-activity-data.tsx b/client/components/payment-activity/payment-activity-data.tsx index 5816c6fc540..2596079ceba 100644 --- a/client/components/payment-activity/payment-activity-data.tsx +++ b/client/components/payment-activity/payment-activity-data.tsx @@ -41,14 +41,14 @@ const PaymentActivityData: React.FC = () => { const fees = paymentActivityData?.fees ?? 0; const disputes = paymentActivityData?.disputes ?? 0; const refunds = paymentActivityData?.refunds ?? 0; - const { storeCurrency } = wcpaySettings; + const currency = paymentActivityData?.currency; return (
- { label } + { label } { ! isLoading && tooltip }
- + Total payment volume
- + Charges
- + Refunds
@@ -158,7 +161,7 @@ exports[`PaymentActivity component should render 1`] = ` aria-labelledby="wcpay-payment-data-highlights__refunds" class="wcpay-payment-data-highlights__item__wrapper__amount" > - $44.44 + €44,44- + Disputes
@@ -186,7 +190,7 @@ exports[`PaymentActivity component should render 1`] = ` aria-labelledby="wcpay-payment-data-highlights__disputes" class="wcpay-payment-data-highlights__item__wrapper__amount" > - $55.55 + €55,55- + Fees
- + Total payment volume
diff --git a/client/components/payment-activity/test/index.test.tsx b/client/components/payment-activity/test/index.test.tsx index 49e8726c02e..cfd35de8451 100644 --- a/client/components/payment-activity/test/index.test.tsx +++ b/client/components/payment-activity/test/index.test.tsx @@ -38,11 +38,16 @@ const mockUsePaymentActivityData = usePaymentActivityData as jest.MockedFunction mockUsePaymentActivityData.mockReturnValue( { paymentActivityData: { + currency: 'eur', total_payment_volume: 123456, charges: 9876, fees: 1234, disputes: 5555, refunds: 4444, + date_start: '2024-01-01', + date_end: '2024-01-31', + timezone: 'UTC', + interval: 'daily', }, isLoading: false, } ); @@ -83,10 +88,10 @@ describe( 'PaymentActivity component', () => { }, }, }, - accountDefaultCurrency: 'USD', + accountDefaultCurrency: 'eur', zeroDecimalCurrencies: [], connect: { - country: 'US', + country: 'DE', }, currencyData: { US: { @@ -117,11 +122,17 @@ describe( 'PaymentActivity component', () => { } ); it( 'should render', () => { - const { container, getByText } = render(