From 88711f283486643ac4fc5a09091f3bd37124ca9c Mon Sep 17 00:00:00 2001 From: Francesco Date: Tue, 12 Dec 2023 00:16:07 -0800 Subject: [PATCH 01/19] fix: account currency hook return value (#7872) --- changelog/fix-account-currency-hook | 4 ++++ client/payment-methods/index.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelog/fix-account-currency-hook diff --git a/changelog/fix-account-currency-hook b/changelog/fix-account-currency-hook new file mode 100644 index 00000000000..23d9628b19f --- /dev/null +++ b/changelog/fix-account-currency-hook @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +fix: account currency hook return value diff --git a/client/payment-methods/index.js b/client/payment-methods/index.js index 950610e6fba..7efb306b0da 100644 --- a/client/payment-methods/index.js +++ b/client/payment-methods/index.js @@ -92,7 +92,7 @@ const PaymentMethods = () => { const [ , updateSelectedPaymentMethod ] = useSelectedPaymentMethod(); - const [ stripeAccountDomesticCurrency ] = useAccountDomesticCurrency(); + const stripeAccountDomesticCurrency = useAccountDomesticCurrency(); const completeActivation = ( itemId ) => { updateSelectedPaymentMethod( itemId ); From d04bda8dfbfd2a05ac7e73e9f588c0deab8bc82a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C4=81rlis=20Janisels?= Date: Tue, 12 Dec 2023 11:12:01 +0200 Subject: [PATCH 02/19] Include discount in fees brakedown tooltip (#7787) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kārlis Janisels Co-authored-by: Vladimir Reznichenko --- .../fix-7750-include-discount-in-tooltip | 4 ++ client/utils/account-fees.tsx | 59 +++++++++++------ .../test/__snapshots__/account-fees.tsx.snap | 65 ++----------------- client/utils/test/account-fees.tsx | 29 --------- 4 files changed, 48 insertions(+), 109 deletions(-) create mode 100644 changelog/fix-7750-include-discount-in-tooltip diff --git a/changelog/fix-7750-include-discount-in-tooltip b/changelog/fix-7750-include-discount-in-tooltip new file mode 100644 index 00000000000..b600a611e92 --- /dev/null +++ b/changelog/fix-7750-include-discount-in-tooltip @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Include discount fee in fees tooltip diff --git a/client/utils/account-fees.tsx b/client/utils/account-fees.tsx index 6ba2674de6d..c2b3214c1b5 100644 --- a/client/utils/account-fees.tsx +++ b/client/utils/account-fees.tsx @@ -74,24 +74,31 @@ const getStripeFeeSectionUrl = ( country: string ): string => { ); }; -const getFeeDescriptionString = ( fee: BaseFee ): string => { +const getFeeDescriptionString = ( + fee: BaseFee, + discountBasedMultiplier: number +): string => { if ( fee.fixed_rate && fee.percentage_rate ) { return sprintf( '%1$f%% + %2$s', - formatFee( fee.percentage_rate ), - formatCurrency( fee.fixed_rate, fee.currency ) + formatFee( fee.percentage_rate * discountBasedMultiplier ), + formatCurrency( + fee.fixed_rate * discountBasedMultiplier, + fee.currency + ) ); } else if ( fee.fixed_rate ) { return sprintf( - '%2$s', - formatFee( fee.percentage_rate ), - formatCurrency( fee.fixed_rate, fee.currency ) + '%1$s', + formatCurrency( + fee.fixed_rate * discountBasedMultiplier, + fee.currency + ) ); } else if ( fee.percentage_rate ) { return sprintf( '%1$f%%', - formatFee( fee.percentage_rate ), - formatCurrency( fee.fixed_rate, fee.currency ) + formatFee( fee.percentage_rate * discountBasedMultiplier ) ); } return ''; @@ -109,19 +116,19 @@ export const formatMethodFeesTooltip = ( accountFees: FeeStructure ): JSX.Element => { if ( ! accountFees ) return <>; - const currentBaseFee = getCurrentBaseFee( accountFees ); - // If the current fee doesn't have a fixed or percentage rate, use the base fee's rate. Eg. when there is a promotional discount fee applied. Use this to calculate the total fee too. - const currentFeeWithBaseFallBack = currentBaseFee.percentage_rate - ? currentBaseFee - : accountFees.base; + + const discountAdjustedFeeRate: number = + accountFees.discount.length && accountFees.discount[ 0 ].discount + ? 1 - accountFees.discount[ 0 ].discount + : 1; const total = { percentage_rate: - currentFeeWithBaseFallBack.percentage_rate + + accountFees.base.percentage_rate + accountFees.additional.percentage_rate + accountFees.fx.percentage_rate, fixed_rate: - currentFeeWithBaseFallBack.fixed_rate + + accountFees.base.fixed_rate + accountFees.additional.fixed_rate + accountFees.fx.fixed_rate, currency: accountFees.base.currency, @@ -136,14 +143,20 @@ export const formatMethodFeesTooltip = (
Base fee
- { getFeeDescriptionString( currentFeeWithBaseFallBack ) } + { getFeeDescriptionString( + accountFees.base, + discountAdjustedFeeRate + ) }
{ hasFees( accountFees.additional ) ? (
International payment method fee
- { getFeeDescriptionString( accountFees.additional ) } + { getFeeDescriptionString( + accountFees.additional, + discountAdjustedFeeRate + ) }
) : ( @@ -152,7 +165,12 @@ export const formatMethodFeesTooltip = ( { hasFees( accountFees.fx ) ? (
Foreign exchange fee
-
{ getFeeDescriptionString( accountFees.fx ) }
+
+ { getFeeDescriptionString( + accountFees.fx, + discountAdjustedFeeRate + ) } +
) : ( '' @@ -160,7 +178,10 @@ export const formatMethodFeesTooltip = (
Total per transaction
- { getFeeDescriptionString( total ) } + { getFeeDescriptionString( + total, + discountAdjustedFeeRate + ) }
{ wcpaySettings && diff --git a/client/utils/test/__snapshots__/account-fees.tsx.snap b/client/utils/test/__snapshots__/account-fees.tsx.snap index 5ec2897e12b..5388a2b344d 100644 --- a/client/utils/test/__snapshots__/account-fees.tsx.snap +++ b/client/utils/test/__snapshots__/account-fees.tsx.snap @@ -10,7 +10,7 @@ exports[`Account fees utility functions formatMethodFeesTooltip() displays base Base fee
- 12.3% + $4.57 + 9.84% + $3.65
@@ -18,7 +18,7 @@ exports[`Account fees utility functions formatMethodFeesTooltip() displays base International payment method fee
- 1% + 0.8%
@@ -26,7 +26,7 @@ exports[`Account fees utility functions formatMethodFeesTooltip() displays base Foreign exchange fee
- 1% + 0.8%
@@ -36,7 +36,7 @@ exports[`Account fees utility functions formatMethodFeesTooltip() displays base
- 14.3% + $4.57 + 11.44% + $3.65
`; - -exports[`Account fees utility functions formatMethodFeesTooltip() displays custom fee details, when applicable 1`] = ` -
-
-
-
- Base fee -
-
- 10.1% + $4.01 -
-
-
-
- International payment method fee -
-
- 1% -
-
-
-
- Foreign exchange fee -
-
- 1% -
-
-
-
- Total per transaction -
-
- 12.1% + $4.01 -
-
-
- - - Learn more - - about WooPayments Fees in your country - -
-
-
-`; diff --git a/client/utils/test/account-fees.tsx b/client/utils/test/account-fees.tsx index 72cf891067b..c1b181ac160 100644 --- a/client/utils/test/account-fees.tsx +++ b/client/utils/test/account-fees.tsx @@ -310,35 +310,6 @@ describe( 'Account fees utility functions', () => { expect( container ).toMatchSnapshot(); } ); - it( 'displays custom fee details, when applicable', () => { - const methodFees = mockAccountFees( - { - percentage_rate: 0.123, - fixed_rate: 456.78, - currency: 'USD', - }, - [ { percentage_rate: 0.101, fixed_rate: 400.78 } ] - ); - - methodFees.additional = { - percentage_rate: 0.01, - fixed_rate: 0, - currency: 'USD', - }; - - methodFees.fx = { - percentage_rate: 0.01, - fixed_rate: 0, - currency: 'USD', - }; - - const { container } = render( - formatMethodFeesTooltip( methodFees ) - ); - - expect( container ).toMatchSnapshot(); - } ); - it( 'displays base fee, when only promo discount without percentage or fixed', () => { const methodFees = mockAccountFees( { From 3d373d68fe0f8cee425bac3aa9b0b37f9fa4f092 Mon Sep 17 00:00:00 2001 From: Jesse Pearson Date: Tue, 12 Dec 2023 07:41:22 -0400 Subject: [PATCH 03/19] Update Qualitative Feedback note to have more efficient sql query (#7825) --- changelog/fix-3693-qualitative-feedback-note | 4 ++++ ...wc-payments-notes-qualitative-feedback.php | 23 +++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 changelog/fix-3693-qualitative-feedback-note diff --git a/changelog/fix-3693-qualitative-feedback-note b/changelog/fix-3693-qualitative-feedback-note new file mode 100644 index 00000000000..8862cc0c961 --- /dev/null +++ b/changelog/fix-3693-qualitative-feedback-note @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Update Qualitative Feedback note to have more efficient sql query. diff --git a/includes/notes/class-wc-payments-notes-qualitative-feedback.php b/includes/notes/class-wc-payments-notes-qualitative-feedback.php index 266e1dd70f1..031fbd6b473 100644 --- a/includes/notes/class-wc-payments-notes-qualitative-feedback.php +++ b/includes/notes/class-wc-payments-notes-qualitative-feedback.php @@ -38,8 +38,27 @@ public static function get_note() { } // We should have at least one transaction. - $token_count = $wpdb->get_var( "select count(*) from {$wpdb->prefix}woocommerce_payment_tokens" ); - if ( 0 === (int) $token_count ) { + if ( WC_Payments_Utils::is_hpos_tables_usage_enabled() ) { + $result = $wpdb->get_var( + "SELECT EXISTS( + SELECT 1 + FROM {$wpdb->prefix}wc_orders_meta + WHERE meta_key = '_wcpay_transaction_fee' + LIMIT 1) + AS count;" + ); + } else { + $result = $wpdb->get_var( + "SELECT EXISTS( + SELECT 1 + FROM {$wpdb->postmeta} + WHERE meta_key = '_wcpay_transaction_fee' + LIMIT 1) + AS count;" + ); + } + + if ( 1 !== intval( $result ) ) { return; } From a30b28c1c6493291e391287b77a42034751c2753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Costa?= <10233985+cesarcosta99@users.noreply.github.com> Date: Tue, 12 Dec 2023 09:52:51 -0500 Subject: [PATCH 04/19] Fix multi-currency e2e tests (#7870) --- changelog/dev-fix-multi-currency-e2e-tests | 5 +++++ tests/e2e/config/jest.setup.js | 3 +++ .../wcpay/shopper/shopper-multi-currency-widget.spec.js | 2 ++ 3 files changed, 10 insertions(+) create mode 100644 changelog/dev-fix-multi-currency-e2e-tests diff --git a/changelog/dev-fix-multi-currency-e2e-tests b/changelog/dev-fix-multi-currency-e2e-tests new file mode 100644 index 00000000000..45ac7deccc1 --- /dev/null +++ b/changelog/dev-fix-multi-currency-e2e-tests @@ -0,0 +1,5 @@ +Significance: patch +Type: dev +Comment: Fix multi-currency e2e tests. + + diff --git a/tests/e2e/config/jest.setup.js b/tests/e2e/config/jest.setup.js index 00f41b376ad..a29f5138fcb 100644 --- a/tests/e2e/config/jest.setup.js +++ b/tests/e2e/config/jest.setup.js @@ -24,6 +24,9 @@ const ERROR_MESSAGES_TO_IGNORE = [ 'Scripts that have a dependency on', 'was preloaded using link preload but not used within a few seconds', 'No UI will be shown. CanMakePayment and hasEnrolledInstrument', + 'Failed to load resource: the server responded with a status of 404 (Not Found)', + 'Store "wc/payments" is already registered.', + 'Preflight request for request with keepalive specified is currently not supported', ]; ERROR_MESSAGES_TO_IGNORE.forEach( ( errorMessage ) => { diff --git a/tests/e2e/specs/wcpay/shopper/shopper-multi-currency-widget.spec.js b/tests/e2e/specs/wcpay/shopper/shopper-multi-currency-widget.spec.js index 182802a62ba..23aec018d59 100644 --- a/tests/e2e/specs/wcpay/shopper/shopper-multi-currency-widget.spec.js +++ b/tests/e2e/specs/wcpay/shopper/shopper-multi-currency-widget.spec.js @@ -64,6 +64,7 @@ describe( 'Shopper Multi-Currency widget', () => { it( 'should display currency switcher widget if multi-currency is enabled', async () => { await merchantWCP.addMulticurrencyWidget(); + await merchant.logout(); await shopper.goToShop(); await page.waitForSelector( '.widget select[name=currency]', { visible: true, @@ -72,6 +73,7 @@ describe( 'Shopper Multi-Currency widget', () => { } ); it( 'should not display currency switcher widget if multi-currency is disabled', async () => { + await merchant.login(); await merchantWCP.openWCPSettings(); await merchantWCP.deactivateMulticurrency(); await shopper.goToShop(); From ef7a13cea29e43d9333a99a2eb054ba817b43a5c Mon Sep 17 00:00:00 2001 From: Malith Senaweera <6216000+malithsen@users.noreply.github.com> Date: Tue, 12 Dec 2023 09:50:17 -0600 Subject: [PATCH 05/19] Record a Tracks event when viewing the order success page (#7859) --- changelog/add-thank-you-page-tracks | 4 ++++ includes/class-woopay-tracker.php | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 changelog/add-thank-you-page-tracks diff --git a/changelog/add-thank-you-page-tracks b/changelog/add-thank-you-page-tracks new file mode 100644 index 00000000000..31888d5d917 --- /dev/null +++ b/changelog/add-thank-you-page-tracks @@ -0,0 +1,4 @@ +Significance: minor +Type: dev + +Thank you page Tracks event diff --git a/includes/class-woopay-tracker.php b/includes/class-woopay-tracker.php index 123ec606a7b..672e8251b11 100644 --- a/includes/class-woopay-tracker.php +++ b/includes/class-woopay-tracker.php @@ -71,6 +71,7 @@ public function __construct( $http ) { add_action( 'woocommerce_blocks_checkout_order_processed', [ $this, 'checkout_order_processed' ] ); add_action( 'woocommerce_payments_save_user_in_woopay', [ $this, 'must_save_payment_method_to_platform' ] ); add_action( 'before_woocommerce_pay_form', [ $this, 'pay_for_order_page_view' ] ); + add_action( 'woocommerce_thankyou', [ $this, 'thank_you_page_view' ] ); } /** @@ -460,6 +461,22 @@ public function must_save_payment_method_to_platform() { ); } + /** + * Record a Tracks event that Thank you page was viewed for a WCPay order. + * + * @param int $order_id The ID of the order. + * @return void + */ + public function thank_you_page_view($order_id) { + $order = wc_get_order( $order_id ); + + if ( ! $order || 'woocommerce_payments' !== $order->get_payment_method() ) { + return; + } + + $this->maybe_record_wcpay_shopper_event( 'order_success_page_view' ); + } + /** * Record a Tracks event that the WooPay express button locations has been updated. * From 56863b221dbdfd9121189fb22303855f16d866d2 Mon Sep 17 00:00:00 2001 From: Ricardo Metring Date: Tue, 12 Dec 2023 15:40:49 -0300 Subject: [PATCH 06/19] Do not expect 3D Secure authentication for declined 3DS card (#7844) --- changelog/dev-test-ci-without-3ds1 | 4 ++++ .../e2e/specs/wcpay/shopper/shopper-checkout-failures.spec.js | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelog/dev-test-ci-without-3ds1 diff --git a/changelog/dev-test-ci-without-3ds1 b/changelog/dev-test-ci-without-3ds1 new file mode 100644 index 00000000000..f2d4b778788 --- /dev/null +++ b/changelog/dev-test-ci-without-3ds1 @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Comment: Fix declined 3DS card E2E test. diff --git a/tests/e2e/specs/wcpay/shopper/shopper-checkout-failures.spec.js b/tests/e2e/specs/wcpay/shopper/shopper-checkout-failures.spec.js index 9c14db6bdbf..715732b40f9 100644 --- a/tests/e2e/specs/wcpay/shopper/shopper-checkout-failures.spec.js +++ b/tests/e2e/specs/wcpay/shopper/shopper-checkout-failures.spec.js @@ -9,7 +9,6 @@ import { shopperWCP } from '../../../utils'; import { clearCardDetails, - confirmCardAuthentication, fillCardDetails, setupProductCheckout, } from '../../../utils/payments'; @@ -145,7 +144,6 @@ describe( 'Shopper > Checkout > Failures with various cards', () => { const declinedCard = config.get( 'cards.declined-3ds' ); await fillCardDetails( page, declinedCard ); await expect( page ).toClick( '#place_order' ); - await confirmCardAuthentication( page, '3DS' ); await page.waitForSelector( 'ul.woocommerce-error' ); const declined3dsCardError = await page.$eval( 'div.woocommerce-NoticeGroup > ul.woocommerce-error', From 2581e51c6523edd8370e498ca40e053fee870535 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 00:16:40 +0000 Subject: [PATCH 07/19] Update version and add changelog entries for release 6.9.2 --- changelog.txt | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- readme.txt | 5 ++++- woocommerce-payments.php | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/changelog.txt b/changelog.txt index 18c98319d74..67743c9648d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,7 @@ *** WooPayments Changelog *** += 6.9.2 - 2023-12-14 = + = 6.9.1 - 2023-12-07 = * Fix - Display Klarna & Afterpay on the checkout for UK based stores diff --git a/package-lock.json b/package-lock.json index ff4e80d88e2..a6d52f964c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "woocommerce-payments", - "version": "6.9.1", + "version": "6.9.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "woocommerce-payments", - "version": "6.9.1", + "version": "6.9.2", "hasInstallScript": true, "license": "GPL-3.0-or-later", "dependencies": { diff --git a/package.json b/package.json index 905e6bbbe01..d80cfbe4bd0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "woocommerce-payments", - "version": "6.9.1", + "version": "6.9.2", "main": "webpack.config.js", "author": "Automattic", "license": "GPL-3.0-or-later", diff --git a/readme.txt b/readme.txt index e7f21908b84..e4fbfff8edc 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: woocommerce payments, apple pay, credit card, google pay, payment, payment Requires at least: 6.0 Tested up to: 6.4 Requires PHP: 7.3 -Stable tag: 6.9.1 +Stable tag: 6.9.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -94,6 +94,9 @@ Please note that our support for the checkout block is still experimental and th == Changelog == += 6.9.2 - 2023-12-14 = + + = 6.9.1 - 2023-12-07 = * Fix - Display Klarna & Afterpay on the checkout for UK based stores diff --git a/woocommerce-payments.php b/woocommerce-payments.php index e135eef1a56..df1a348ec90 100644 --- a/woocommerce-payments.php +++ b/woocommerce-payments.php @@ -12,7 +12,7 @@ * WC tested up to: 8.3.1 * Requires at least: 6.0 * Requires PHP: 7.3 - * Version: 6.9.1 + * Version: 6.9.2 * * @package WooCommerce\Payments */ From c0e6cf5c3536c628184c99f4ceec1598ccb1eb33 Mon Sep 17 00:00:00 2001 From: Eric Jinks <3147296+Jinksi@users.noreply.github.com> Date: Wed, 13 Dec 2023 15:21:45 +1000 Subject: [PATCH 08/19] Show deposit schedule message if account's deposits are unrestricted (#7875) Co-authored-by: Shendy <73803630+shendy-a8c@users.noreply.github.com> --- ...posit-schedule-when-zero-available-balance | 4 ++ .../deposits-overview/deposit-schedule.tsx | 36 ++++++++---- client/components/deposits-overview/index.tsx | 16 +++--- .../test/__snapshots__/index.tsx.snap | 56 ++++++++++++++++++- .../deposits-overview/test/index.tsx | 2 + client/globals.d.ts | 4 ++ 6 files changed, 96 insertions(+), 22 deletions(-) create mode 100644 changelog/fix-7874-show-deposit-schedule-when-zero-available-balance diff --git a/changelog/fix-7874-show-deposit-schedule-when-zero-available-balance b/changelog/fix-7874-show-deposit-schedule-when-zero-available-balance new file mode 100644 index 00000000000..bbc503c7a72 --- /dev/null +++ b/changelog/fix-7874-show-deposit-schedule-when-zero-available-balance @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Show deposit schedule message when deposits are unrestricted diff --git a/client/components/deposits-overview/deposit-schedule.tsx b/client/components/deposits-overview/deposit-schedule.tsx index c7eae7bca78..8ae6546655c 100644 --- a/client/components/deposits-overview/deposit-schedule.tsx +++ b/client/components/deposits-overview/deposit-schedule.tsx @@ -17,6 +17,7 @@ import type * as AccountOverview from 'wcpay/types/account-overview'; interface DepositScheduleProps { depositsSchedule: AccountOverview.Account[ 'deposits_schedule' ]; + showNextDepositDate?: boolean; } /** * Renders the Deposit Schedule details component. @@ -25,19 +26,30 @@ interface DepositScheduleProps { */ const DepositSchedule: React.FC< DepositScheduleProps > = ( { depositsSchedule, + showNextDepositDate, } ) => { const nextDepositDate = getNextDepositDate( depositsSchedule ); + const nextDepositDateString = showNextDepositDate + ? sprintf( + /** translators: %s: is the date of the next deposit, e.g. "January 1st, 2023". */ + __( + ' – your next deposit is scheduled for {{strong}}%s{{/strong}}', + 'woocommerce-payments' + ), + nextDepositDate + ) + : ''; switch ( depositsSchedule.interval ) { case 'daily': return interpolateComponents( { mixedString: sprintf( - /** translators: {{strong}}: placeholders are opening and closing strong tags. %s: is the date of the next deposit, e.g. "January 1st, 2023". */ + /** translators: {{strong}}: placeholders are opening and closing strong tags. %s: is an optional next deposit date message. */ __( - 'Available funds are automatically dispatched {{strong}}every day{{/strong}} – your next deposit is scheduled for {{strong}}%s{{/strong}}.', + 'Available funds are automatically dispatched {{strong}}every day{{/strong}}%s.', 'woocommerce-payments' ), - nextDepositDate + nextDepositDateString ), components: { strong: , @@ -52,13 +64,13 @@ const DepositSchedule: React.FC< DepositScheduleProps > = ( { return interpolateComponents( { mixedString: sprintf( - /** translators: %1$s: is the day of the week. eg "Friday". %2$s: is the date of the next deposit, e.g. "January 1st, 2023". {{strong}}: placeholders are opening and closing strong tags. */ + /** translators: %1$s: is the day of the week. eg "Friday". %2$s: is an optional next deposit date message. {{strong}}: placeholders are opening and closing strong tags. */ __( - 'Available funds are automatically dispatched {{strong}}every %1$s{{/strong}} – your next deposit is scheduled for {{strong}}%2$s{{/strong}}.', + 'Available funds are automatically dispatched {{strong}}every %1$s{{/strong}}%2$s.', 'woocommerce-payments' ), dayOfWeek, - nextDepositDate + nextDepositDateString ), components: { strong: , @@ -71,12 +83,12 @@ const DepositSchedule: React.FC< DepositScheduleProps > = ( { if ( monthlyAnchor === 31 ) { return interpolateComponents( { mixedString: sprintf( - /** translators: {{strong}}: placeholders are opening and closing strong tags. %s: is the date of the next deposit, e.g. "January 1st, 2023". */ + /** translators: {{strong}}: placeholders are opening and closing strong tags. %s: is an optional next deposit date message. */ __( - 'Available funds are automatically dispatched {{strong}}on the last day of every month{{/strong}} – your next deposit is scheduled for {{strong}}%s{{/strong}}.', + 'Available funds are automatically dispatched {{strong}}on the last day of every month{{/strong}}%s.', 'woocommerce-payments' ), - nextDepositDate + nextDepositDateString ), components: { strong: , @@ -86,16 +98,16 @@ const DepositSchedule: React.FC< DepositScheduleProps > = ( { return interpolateComponents( { mixedString: sprintf( - /** translators: {{strong}}: placeholders are opening and closing strong tags. %1$s: is the day of the month. eg "31st". %2$s: is the date of the next deposit, e.g. "January 1st, 2023". */ + /** translators: {{strong}}: placeholders are opening and closing strong tags. %1$s: is the day of the month. eg "31st". %2$s: is an optional next deposit date message. */ __( - 'Available funds are automatically dispatched {{strong}}on the %1$s of every month{{/strong}} – your next deposit is scheduled for {{strong}}%2$s{{/strong}}.', + 'Available funds are automatically dispatched {{strong}}on the %1$s of every month{{/strong}}%2$s.', 'woocommerce-payments' ), getDepositMonthlyAnchorLabel( { monthlyAnchor: monthlyAnchor, capitalize: false, } ), - nextDepositDate + nextDepositDateString ), components: { strong: , diff --git a/client/components/deposits-overview/index.tsx b/client/components/deposits-overview/index.tsx index 27c754c0640..f7c318126fb 100644 --- a/client/components/deposits-overview/index.tsx +++ b/client/components/deposits-overview/index.tsx @@ -35,6 +35,9 @@ const DepositsOverview: React.FC = () => { overview, isLoading: isLoadingOverview, } = useSelectedCurrencyOverview(); + const isDepositsUnrestricted = + wcpaySettings.accountStatus.deposits?.restrictions === + 'deposits_unrestricted'; const selectedCurrency = overview?.currency || wcpaySettings.accountDefaultCurrency; const { isLoading: isLoadingDeposits, deposits } = useRecentDeposits( @@ -45,19 +48,13 @@ const DepositsOverview: React.FC = () => { const availableFunds = overview?.available?.amount ?? 0; - // If the account has deposits blocked, there is no available balance or it is negative, there is no future deposit expected. - const isNextDepositExpected = - ! account?.deposits_blocked && availableFunds > 0; // If the available balance is negative, deposits may be paused. const isNegativeBalanceDepositsPaused = availableFunds < 0; const hasCompletedWaitingPeriod = wcpaySettings.accountStatus.deposits?.completed_waiting_period; // Only show the deposit history section if the page is finished loading and there are deposits. */ } const showRecentDeposits = - ! isLoading && - deposits?.length > 0 && - !! account && - ! account?.deposits_blocked; + ! isLoading && deposits?.length > 0 && !! account; // Show a loading state if the page is still loading. if ( isLoading ) { @@ -98,10 +95,11 @@ const DepositsOverview: React.FC = () => { { /* Deposit schedule message */ } - { isNextDepositExpected && !! account && ( + { isDepositsUnrestricted && !! account && ( 0 } /> ) } @@ -112,7 +110,7 @@ const DepositsOverview: React.FC = () => { ) : ( <> - { isNextDepositExpected && ( + { isDepositsUnrestricted && ( ) } { ! hasCompletedWaitingPeriod && ( diff --git a/client/components/deposits-overview/test/__snapshots__/index.tsx.snap b/client/components/deposits-overview/test/__snapshots__/index.tsx.snap index 9dcdb85548d..6b4db19d73c 100644 --- a/client/components/deposits-overview/test/__snapshots__/index.tsx.snap +++ b/client/components/deposits-overview/test/__snapshots__/index.tsx.snap @@ -17,11 +17,65 @@ exports[`Deposits Overview information Component Renders 1`] = ` > Deposits +
+ Available funds are automatically dispatched + + every Monday + + . +
+ > +
+
+
+
+ +
+
+ It may take 1-3 business days for deposits to reach your bank account. +
+
+
+
+
+
{ global.wcpaySettings = { accountStatus: { deposits: { + restrictions: 'deposits_unrestricted', completed_waiting_period: true, }, }, diff --git a/client/globals.d.ts b/client/globals.d.ts index eaffe24b8b6..3d85e8d5918 100644 --- a/client/globals.d.ts +++ b/client/globals.d.ts @@ -31,6 +31,10 @@ declare global { paymentsEnabled?: boolean; deposits?: { status: string; + restrictions: + | 'deposits_unrestricted' + | 'deposits_blocked' + | 'schedule_restricted'; interval: string; weekly_anchor: string; monthly_anchor: null | number; From a81f3689e871dd915f2dae8c3ac19bc10c7b34b1 Mon Sep 17 00:00:00 2001 From: Eric Jinks <3147296+Jinksi@users.noreply.github.com> Date: Wed, 13 Dec 2023 15:49:13 +1000 Subject: [PATCH 09/19] Transactions List - indicate when a transaction is expected to be included in a future deposit (#7878) --- changelog/add-transaction-list-future-deposit | 4 + client/transactions/list/deposit.tsx | 38 ++- client/transactions/list/index.tsx | 21 +- client/transactions/list/style.scss | 5 + .../list/test/__snapshots__/deposit.tsx.snap | 101 +++++- .../list/test/__snapshots__/index.tsx.snap | 310 +++++++++++++++++- client/transactions/list/test/deposit.tsx | 10 - 7 files changed, 449 insertions(+), 40 deletions(-) create mode 100644 changelog/add-transaction-list-future-deposit diff --git a/changelog/add-transaction-list-future-deposit b/changelog/add-transaction-list-future-deposit new file mode 100644 index 00000000000..1f657c0b7af --- /dev/null +++ b/changelog/add-transaction-list-future-deposit @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Transactions List - indicate when a transaction is expected to be included in a future deposit diff --git a/client/transactions/list/deposit.tsx b/client/transactions/list/deposit.tsx index c0604f0b097..09ceb108ca9 100644 --- a/client/transactions/list/deposit.tsx +++ b/client/transactions/list/deposit.tsx @@ -3,18 +3,27 @@ /** * External dependencies */ -import { dateI18n } from '@wordpress/date'; +import React from 'react'; import moment from 'moment'; +import { dateI18n } from '@wordpress/date'; +import { __ } from '@wordpress/i18n'; +import interpolateComponents from '@automattic/interpolate-components'; +import { ExternalLink } from '@wordpress/components'; import { Link } from '@woocommerce/components'; -import React from 'react'; -import { getAdminUrl } from 'wcpay/utils'; +import InfoOutlineIcon from 'gridicons/dist/info-outline'; + +/** + * Internal dependencies + */ +import { getAdminUrl } from 'utils'; +import { ClickTooltip } from 'components/tooltip'; interface DepositProps { depositId?: string; dateAvailable?: string; } -const Deposit = ( { depositId, dateAvailable }: DepositProps ): JSX.Element => { +const Deposit: React.FC< DepositProps > = ( { depositId, dateAvailable } ) => { if ( depositId && dateAvailable && @@ -35,7 +44,26 @@ const Deposit = ( { depositId, dateAvailable }: DepositProps ): JSX.Element => { return { formattedDateAvailable }; } - return <>; + // Show an icon with a tooltip to communicate that the deposit will be available in the future. + return ( + <> + { __( 'Future deposit', 'woocommerce-payments' ) } + + ), + }, + } ) } + buttonIcon={ } + /> + + ); }; export default Deposit; diff --git a/client/transactions/list/index.tsx b/client/transactions/list/index.tsx index df9d360b11d..47b893fa22e 100644 --- a/client/transactions/list/index.tsx +++ b/client/transactions/list/index.tsx @@ -329,12 +329,6 @@ export const TransactionsList = ( txn.customer_email ); - const deposit = ( - - ); const currency = txn.currency.toUpperCase(); const dataType = txn.metadata ? txn.metadata.charge_type : txn.type; @@ -372,14 +366,21 @@ export const TransactionsList = ( }; }; - const depositStatus = txn.deposit_status - ? displayDepositStatus[ txn.deposit_status ] - : ''; - const isFinancingType = -1 !== [ 'financing_payout', 'financing_paydown' ].indexOf( txn.type ); + const deposit = ! isFinancingType && ( + + ); + + const depositStatus = txn.deposit_status + ? displayDepositStatus[ txn.deposit_status ] + : ''; + // Map transaction into table row. const data = { transaction_id: { diff --git a/client/transactions/list/style.scss b/client/transactions/list/style.scss index e33b7755e91..3c876b115c3 100644 --- a/client/transactions/list/style.scss +++ b/client/transactions/list/style.scss @@ -46,6 +46,11 @@ $space-header-item: 12px; top: 3px; left: 8px; } + .woocommerce-table__item { + .wcpay-tooltip__content-wrapper { + white-space: normal; + } + } } /** diff --git a/client/transactions/list/test/__snapshots__/deposit.tsx.snap b/client/transactions/list/test/__snapshots__/deposit.tsx.snap index ff5e2f4fb9d..5aae20de2e7 100644 --- a/client/transactions/list/test/__snapshots__/deposit.tsx.snap +++ b/client/transactions/list/test/__snapshots__/deposit.tsx.snap @@ -11,10 +11,101 @@ exports[`Deposit renders with date and deposit available 1`] = `
`; -exports[`Deposit renders with date available but no deposit 1`] = `
`; - -exports[`Deposit renders with deposit but no date available 1`] = `
`; +exports[`Deposit renders with date available but no deposit 1`] = ` +
+ Future deposit + +
+`; -exports[`Deposit renders with estimated date and deposit available 1`] = `
`; +exports[`Deposit renders with deposit but no date available 1`] = ` +
+ Future deposit + +
+`; -exports[`Deposit renders with no date or deposit available 1`] = `
`; +exports[`Deposit renders with no date or deposit available 1`] = ` +
+ Future deposit + +
+`; diff --git a/client/transactions/list/test/__snapshots__/index.tsx.snap b/client/transactions/list/test/__snapshots__/index.tsx.snap index 2f460c0f997..35b86a155f7 100644 --- a/client/transactions/list/test/__snapshots__/index.tsx.snap +++ b/client/transactions/list/test/__snapshots__/index.tsx.snap @@ -610,7 +610,36 @@ exports[`Transactions list renders correctly when can filter by several currenci + > + Future deposit + + + > + Future deposit + + @@ -1541,7 +1599,36 @@ exports[`Transactions list renders correctly when filtered by currency 1`] = ` + > + Future deposit + + + > + Future deposit + + @@ -3172,7 +3288,36 @@ exports[`Transactions list subscription column renders correctly 1`] = ` + > + Future deposit + + + > + Future deposit + + @@ -4151,7 +4325,36 @@ exports[`Transactions list when not filtered by deposit renders correctly 1`] = + > + Future deposit + + + > + Future deposit + + @@ -5124,7 +5356,36 @@ exports[`Transactions list when not filtered by deposit renders table summary on + > + Future deposit + + + > + Future deposit + + diff --git a/client/transactions/list/test/deposit.tsx b/client/transactions/list/test/deposit.tsx index 478baa171a6..2cb87b0b248 100644 --- a/client/transactions/list/test/deposit.tsx +++ b/client/transactions/list/test/deposit.tsx @@ -19,16 +19,6 @@ describe( 'Deposit', () => { expect( link ).toMatchSnapshot(); } ); - test( 'renders with estimated date and deposit available', () => { - const { container: link } = render( - - ); - expect( link ).toMatchSnapshot(); - } ); - test( 'renders with date available but no deposit', () => { const { container: link } = render( From 25b58e9aa8107875563b04d6fcd5d233ce9dec42 Mon Sep 17 00:00:00 2001 From: Eric Jinks <3147296+Jinksi@users.noreply.github.com> Date: Wed, 13 Dec 2023 15:50:23 +1000 Subject: [PATCH 10/19] Show a deposit schedule notice on the deposits list page (#7883) Co-authored-by: Shendy <73803630+shendy-a8c@users.noreply.github.com> --- .../add-7877-deposit-list-next-deposit-notice | 4 ++ client/deposits/index.tsx | 59 ++++++++++++++++++- client/globals.d.ts | 3 +- includes/admin/class-wc-payments-admin.php | 1 + ...s-wc-rest-payments-settings-controller.php | 5 ++ includes/class-wc-payments-features.php | 9 +++ includes/class-wc-payments.php | 1 + 7 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 changelog/add-7877-deposit-list-next-deposit-notice diff --git a/changelog/add-7877-deposit-list-next-deposit-notice b/changelog/add-7877-deposit-list-next-deposit-notice new file mode 100644 index 00000000000..e3f43480f64 --- /dev/null +++ b/changelog/add-7877-deposit-list-next-deposit-notice @@ -0,0 +1,4 @@ +Significance: patch +Type: add + +Show a deposit schedule notice on the deposits list page to indicate that future deposits can be expected. diff --git a/client/deposits/index.tsx b/client/deposits/index.tsx index ae5ba238679..9864ed11976 100644 --- a/client/deposits/index.tsx +++ b/client/deposits/index.tsx @@ -3,19 +3,76 @@ /** * External dependencies */ -import React from 'react'; +import React, { useState } from 'react'; +import { useDispatch } from '@wordpress/data'; /** * Internal dependencies. */ import Page from 'components/page'; import { TestModeNotice } from 'components/test-mode-notice'; +import BannerNotice from 'components/banner-notice'; +import DepositSchedule from 'components/deposits-overview/deposit-schedule'; +import { useAllDepositsOverviews } from 'data'; import DepositsList from './list'; +const useNextDepositNoticeState = () => { + const { updateOptions } = useDispatch( 'wc/admin/options' ); + const [ isDismissed, setIsDismissed ] = useState( + wcpaySettings.isNextDepositNoticeDismissed + ); + + const setNextDepositNoticeDismissed = () => { + setIsDismissed( true ); + wcpaySettings.isNextDepositNoticeDismissed = true; + updateOptions( { + wcpay_next_deposit_notice_dismissed: true, + } ); + }; + + return { + isNextDepositNoticeDismissed: isDismissed, + handleDismissNextDepositNotice: setNextDepositNoticeDismissed, + }; +}; + +const NextDepositNotice: React.FC = () => { + const { + overviews: { account }, + } = useAllDepositsOverviews(); + const { + isNextDepositNoticeDismissed, + handleDismissNextDepositNotice, + } = useNextDepositNoticeState(); + + const isDepositsUnrestricted = + wcpaySettings.accountStatus.deposits?.restrictions === + 'deposits_unrestricted'; + + if ( + ! isDepositsUnrestricted || + ! account || + isNextDepositNoticeDismissed + ) { + return null; + } + + return ( + + + + ); +}; + const DepositsPage: React.FC = () => { return ( + ); diff --git a/client/globals.d.ts b/client/globals.d.ts index 3d85e8d5918..4f791a70795 100644 --- a/client/globals.d.ts +++ b/client/globals.d.ts @@ -1,7 +1,7 @@ /** * Internal dependencies */ -import { +import type { MccsDisplayTreeItem, Country, OnboardingFields, @@ -120,6 +120,7 @@ declare global { isStripeBillingEligible: boolean; capabilityRequestNotices: Record< string, boolean >; storeName: string; + isNextDepositNoticeDismissed: boolean; }; const wcTracks: any; diff --git a/includes/admin/class-wc-payments-admin.php b/includes/admin/class-wc-payments-admin.php index c44adb42ac8..cdf18c31a34 100644 --- a/includes/admin/class-wc-payments-admin.php +++ b/includes/admin/class-wc-payments-admin.php @@ -881,6 +881,7 @@ private function get_js_settings(): array { 'isStripeBillingEligible' => WC_Payments_Features::is_stripe_billing_eligible(), 'capabilityRequestNotices' => get_option( 'wcpay_capability_request_dismissed_notices ', [] ), 'storeName' => get_bloginfo( 'name' ), + 'isNextDepositNoticeDismissed' => WC_Payments_Features::is_next_deposit_notice_dismissed(), ]; return apply_filters( 'wcpay_js_settings', $this->wcpay_js_settings ); diff --git a/includes/admin/class-wc-rest-payments-settings-controller.php b/includes/admin/class-wc-rest-payments-settings-controller.php index 1025c697990..057af86e3f5 100644 --- a/includes/admin/class-wc-rest-payments-settings-controller.php +++ b/includes/admin/class-wc-rest-payments-settings-controller.php @@ -773,6 +773,11 @@ private function update_account( WP_REST_Request $request ) { $updated_fields['deposit_schedule_interval'] = $this->wcpay_gateway->get_option( 'deposit_schedule_interval' ); } + // If we are updating any deposit schedule values, we should invalidate the next deposit notice dismissed notice option. + if ( preg_grep( '/^deposit_schedule_/', array_keys( $updated_fields ) ) ) { + delete_option( 'wcpay_next_deposit_notice_dismissed' ); + } + return $this->wcpay_gateway->update_account_settings( $updated_fields ); } diff --git a/includes/class-wc-payments-features.php b/includes/class-wc-payments-features.php index ef9ae19c263..a0895511833 100644 --- a/includes/class-wc-payments-features.php +++ b/includes/class-wc-payments-features.php @@ -390,6 +390,15 @@ public static function is_dispute_issuer_evidence_enabled(): bool { return '1' === get_option( self::DISPUTE_ISSUER_EVIDENCE, '0' ); } + /** + * Checks whether the next deposit notice on the deposits list screen has been dismissed. + * + * @return bool + */ + public static function is_next_deposit_notice_dismissed(): bool { + return '1' === get_option( 'wcpay_next_deposit_notice_dismissed', '0' ); + } + /** * Returns feature flags as an array suitable for display on the front-end. * diff --git a/includes/class-wc-payments.php b/includes/class-wc-payments.php index 28775dc9599..1522a64a034 100644 --- a/includes/class-wc-payments.php +++ b/includes/class-wc-payments.php @@ -1663,6 +1663,7 @@ public static function add_wcpay_options_to_woocommerce_permissions_list( $permi 'wcpay_fraud_protection_welcome_tour_dismissed', 'wcpay_capability_request_dismissed_notices', 'wcpay_onboarding_eligibility_modal_dismissed', + 'wcpay_next_deposit_notice_dismissed', ], true ); From 744df5fe7df7e2c1294855afd93080bf58de572f Mon Sep 17 00:00:00 2001 From: bruce aldridge Date: Wed, 13 Dec 2023 19:03:57 +1300 Subject: [PATCH 11/19] Show notice when no funds ready for deposit (#7882) Co-authored-by: Eric Jinks <3147296+Jinksi@users.noreply.github.com> Co-authored-by: Shendy <73803630+shendy-a8c@users.noreply.github.com> --- ...how-notice-when-no-funds-ready-for-deposit | 4 +++ .../deposits-overview/deposit-notices.tsx | 25 +++++++++++++++++++ client/components/deposits-overview/index.tsx | 17 ++++++++++--- 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 changelog/fix-7879-show-notice-when-no-funds-ready-for-deposit diff --git a/changelog/fix-7879-show-notice-when-no-funds-ready-for-deposit b/changelog/fix-7879-show-notice-when-no-funds-ready-for-deposit new file mode 100644 index 00000000000..479c913c081 --- /dev/null +++ b/changelog/fix-7879-show-notice-when-no-funds-ready-for-deposit @@ -0,0 +1,4 @@ +Significance: patch +Type: add + +Notice is added when merchant has funds that are not yet available for deposit. diff --git a/client/components/deposits-overview/deposit-notices.tsx b/client/components/deposits-overview/deposit-notices.tsx index 7a38783a33b..86f0de918a0 100644 --- a/client/components/deposits-overview/deposit-notices.tsx +++ b/client/components/deposits-overview/deposit-notices.tsx @@ -150,3 +150,28 @@ export const NegativeBalanceDepositsPausedNotice: React.FC = () => ( } ) } ); + +/** + * Renders a notice informing the user that deposits only occur when there are funds available. + */ +export const NoFundsAvailableForDepositNotice: React.FC = () => ( + + { interpolateComponents( { + mixedString: __( + 'You have no funds available to deposit. {{whyLink}}Why?{{/whyLink}}', + 'woocommerce-payments' + ), + components: { + whyLink: ( + // Link content is in the format string above. Consider disabling jsx-a11y/anchor-has-content. + // eslint-disable-next-line jsx-a11y/anchor-has-content + + ), + }, + } ) } + +); diff --git a/client/components/deposits-overview/index.tsx b/client/components/deposits-overview/index.tsx index f7c318126fb..b3605bdda8f 100644 --- a/client/components/deposits-overview/index.tsx +++ b/client/components/deposits-overview/index.tsx @@ -24,6 +24,7 @@ import { DepositTransitDaysNotice, NegativeBalanceDepositsPausedNotice, NewAccountWaitingPeriodNotice, + NoFundsAvailableForDepositNotice, SuspendedDepositNotice, } from './deposit-notices'; import useRecentDeposits from './hooks'; @@ -47,9 +48,13 @@ const DepositsOverview: React.FC = () => { const isLoading = isLoadingOverview || isLoadingDeposits; const availableFunds = overview?.available?.amount ?? 0; + const pendingFunds = overview?.pending?.amount ?? 0; // If the available balance is negative, deposits may be paused. const isNegativeBalanceDepositsPaused = availableFunds < 0; + // When there are funds pending but no available funds, deposits are paused. + const isDepositAwaitingPendingFunds = + availableFunds === 0 && pendingFunds > 0; const hasCompletedWaitingPeriod = wcpaySettings.accountStatus.deposits?.completed_waiting_period; // Only show the deposit history section if the page is finished loading and there are deposits. */ } @@ -84,7 +89,7 @@ const DepositsOverview: React.FC = () => { } // This card isn't shown if there are no deposits, so we can bail early. - if ( ! isLoading && availableFunds === 0 && deposits.length === 0 ) { + if ( ! isLoading && deposits.length === 0 ) { return null; } @@ -110,12 +115,16 @@ const DepositsOverview: React.FC = () => { ) : ( <> - { isDepositsUnrestricted && ( - - ) } + { isDepositsUnrestricted && + ! isDepositAwaitingPendingFunds && ( + + ) } { ! hasCompletedWaitingPeriod && ( ) } + { isDepositAwaitingPendingFunds && ( + + ) } { isNegativeBalanceDepositsPaused && ( ) } From 5655329f8237fe68207d80dc07a4760a913b6f15 Mon Sep 17 00:00:00 2001 From: botwoo Date: Wed, 13 Dec 2023 06:07:08 +0000 Subject: [PATCH 12/19] Amend changelog entries for release 6.9.2 --- changelog.txt | 4 ++++ changelog/add-7877-deposit-list-next-deposit-notice | 4 ---- changelog/add-transaction-list-future-deposit | 4 ---- ...fix-7874-show-deposit-schedule-when-zero-available-balance | 4 ---- .../fix-7879-show-notice-when-no-funds-ready-for-deposit | 4 ---- readme.txt | 4 ++++ 6 files changed, 8 insertions(+), 16 deletions(-) delete mode 100644 changelog/add-7877-deposit-list-next-deposit-notice delete mode 100644 changelog/add-transaction-list-future-deposit delete mode 100644 changelog/fix-7874-show-deposit-schedule-when-zero-available-balance delete mode 100644 changelog/fix-7879-show-notice-when-no-funds-ready-for-deposit diff --git a/changelog.txt b/changelog.txt index 67743c9648d..73e649d188e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,10 @@ *** WooPayments Changelog *** = 6.9.2 - 2023-12-14 = +* Add - Notice is added when merchant has funds that are not yet available for deposit. +* Add - Show a deposit schedule notice on the deposits list page to indicate that future deposits can be expected. +* Fix - Show deposit schedule message when deposits are unrestricted +* Fix - Transactions List - indicate when a transaction is expected to be included in a future deposit = 6.9.1 - 2023-12-07 = * Fix - Display Klarna & Afterpay on the checkout for UK based stores diff --git a/changelog/add-7877-deposit-list-next-deposit-notice b/changelog/add-7877-deposit-list-next-deposit-notice deleted file mode 100644 index e3f43480f64..00000000000 --- a/changelog/add-7877-deposit-list-next-deposit-notice +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: add - -Show a deposit schedule notice on the deposits list page to indicate that future deposits can be expected. diff --git a/changelog/add-transaction-list-future-deposit b/changelog/add-transaction-list-future-deposit deleted file mode 100644 index 1f657c0b7af..00000000000 --- a/changelog/add-transaction-list-future-deposit +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fix - -Transactions List - indicate when a transaction is expected to be included in a future deposit diff --git a/changelog/fix-7874-show-deposit-schedule-when-zero-available-balance b/changelog/fix-7874-show-deposit-schedule-when-zero-available-balance deleted file mode 100644 index bbc503c7a72..00000000000 --- a/changelog/fix-7874-show-deposit-schedule-when-zero-available-balance +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: fix - -Show deposit schedule message when deposits are unrestricted diff --git a/changelog/fix-7879-show-notice-when-no-funds-ready-for-deposit b/changelog/fix-7879-show-notice-when-no-funds-ready-for-deposit deleted file mode 100644 index 479c913c081..00000000000 --- a/changelog/fix-7879-show-notice-when-no-funds-ready-for-deposit +++ /dev/null @@ -1,4 +0,0 @@ -Significance: patch -Type: add - -Notice is added when merchant has funds that are not yet available for deposit. diff --git a/readme.txt b/readme.txt index e4fbfff8edc..8a57aead24b 100644 --- a/readme.txt +++ b/readme.txt @@ -95,6 +95,10 @@ Please note that our support for the checkout block is still experimental and th == Changelog == = 6.9.2 - 2023-12-14 = +* Add - Notice is added when merchant has funds that are not yet available for deposit. +* Add - Show a deposit schedule notice on the deposits list page to indicate that future deposits can be expected. +* Fix - Show deposit schedule message when deposits are unrestricted +* Fix - Transactions List - indicate when a transaction is expected to be included in a future deposit = 6.9.1 - 2023-12-07 = From e5bca8df8ccbb61b1707cbd947f413b1bacb9f27 Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Wed, 13 Dec 2023 14:43:10 -0500 Subject: [PATCH 13/19] Improve E2E checkout tests (#7664) Co-authored-by: Timur Karimov Co-authored-by: Timur Karimov --- changelog/deferred-intent | 4 ++ ...ferred-intent-creation-upe-enabled.spec.js | 54 ++++++++++++++++--- tests/e2e/utils/flows.js | 8 +++ 3 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 changelog/deferred-intent diff --git a/changelog/deferred-intent b/changelog/deferred-intent new file mode 100644 index 00000000000..ef5442b5f17 --- /dev/null +++ b/changelog/deferred-intent @@ -0,0 +1,4 @@ +Significance: minor +Type: dev + +Improve E2E checkout tests diff --git a/tests/e2e/specs/upe-split/shopper/shopper-deferred-intent-creation-upe-enabled.spec.js b/tests/e2e/specs/upe-split/shopper/shopper-deferred-intent-creation-upe-enabled.spec.js index 1e9a6a27956..e1062f6d1ca 100644 --- a/tests/e2e/specs/upe-split/shopper/shopper-deferred-intent-creation-upe-enabled.spec.js +++ b/tests/e2e/specs/upe-split/shopper/shopper-deferred-intent-creation-upe-enabled.spec.js @@ -18,13 +18,10 @@ import { uiUnblocked } from '@woocommerce/e2e-utils/build/page-utils'; const { shopper, merchant } = require( '@woocommerce/e2e-utils' ); const UPE_METHOD_CHECKBOXES = [ - '#inspector-checkbox-control-5', // bancontact - '#inspector-checkbox-control-6', // eps '#inspector-checkbox-control-7', // giropay - '#inspector-checkbox-control-8', // ideal - '#inspector-checkbox-control-9', // sofort ]; const card = config.get( 'cards.basic' ); +const card2 = config.get( 'cards.basic2' ); const MIN_WAIT_TIME_BETWEEN_PAYMENT_METHODS = 20000; describe( 'Enabled UPE with deferred intent creation', () => { @@ -33,11 +30,9 @@ describe( 'Enabled UPE with deferred intent creation', () => { await merchantWCP.enablePaymentMethod( UPE_METHOD_CHECKBOXES ); await merchant.logout(); await shopper.login(); - await shopperWCP.changeAccountCurrencyTo( 'EUR' ); } ); afterAll( async () => { - await shopperWCP.changeAccountCurrencyTo( 'USD' ); await shopperWCP.logout(); await merchant.login(); await merchantWCP.disablePaymentMethod( UPE_METHOD_CHECKBOXES ); @@ -46,6 +41,7 @@ describe( 'Enabled UPE with deferred intent creation', () => { describe( 'Enabled UPE with deferred intent creation', () => { it( 'should successfully place order with Giropay', async () => { + await shopperWCP.goToShopWithCurrency( 'EUR' ); await setupProductCheckout( config.get( 'addresses.customer.billing' ) ); @@ -115,10 +111,23 @@ describe( 'Enabled UPE with deferred intent creation', () => { await shopperWCP.deleteSavedPaymentMethod( card.label ); await expect( page ).toMatch( 'Payment method deleted' ); } ); + + it( 'should not allow guest user to save the card', async () => { + await shopperWCP.logout(); + await setupProductCheckout( + config.get( 'addresses.customer.billing' ) + ); + + await expect( page ).not.toMatchElement( + 'input#wc-woocommerce_payments-new-payment-method' + ); + await shopper.login(); + } ); } ); describe( 'My Account', () => { let timeAdded; + it( 'should add the card as a new payment method', async () => { await shopperWCP.goToPaymentMethods(); await shopperWCP.addNewPaymentMethod( 'basic', card ); @@ -134,14 +143,43 @@ describe( 'Enabled UPE with deferred intent creation', () => { await expect( page ).toMatch( `${ card.expires.month }/${ card.expires.year }` ); + await waitTwentySecondsSinceLastCardAdded(); + } ); + + it( 'should be able to set payment method as default', async () => { + await shopperWCP.goToPaymentMethods(); + await shopperWCP.addNewPaymentMethod( 'basic2', card2 ); + // Take note of the time when we added this card + timeAdded = Date.now(); + + // Verify that the card was added + await expect( page ).not.toMatch( + 'You cannot add a new payment method so soon after the previous one. Please wait for 20 seconds.' + ); + await expect( page ).toMatch( 'Payment method successfully added' ); + await expect( page ).toMatch( + `${ card2.expires.month }/${ card2.expires.year }` + ); + await shopperWCP.setDefaultPaymentMethod( card2.label ); + // Verify that the card was set as default + await expect( page ).toMatch( + 'This payment method was successfully set as your default.' + ); } ); - it( 'should be able to delete the card', async () => { + it( 'should be able to delete cards', async () => { await shopperWCP.deleteSavedPaymentMethod( card.label ); await expect( page ).toMatch( 'Payment method deleted.' ); + + await shopperWCP.deleteSavedPaymentMethod( card2.label ); + await expect( page ).toMatch( 'Payment method deleted.' ); } ); afterAll( async () => { + await waitTwentySecondsSinceLastCardAdded(); + } ); + + async function waitTwentySecondsSinceLastCardAdded() { // Make sure that at least 20s had already elapsed since the last card was added. // Otherwise, you will get the error message, // "You cannot add a new payment method so soon after the previous one." @@ -153,6 +191,6 @@ describe( 'Enabled UPE with deferred intent creation', () => { : 0; await new Promise( ( r ) => setTimeout( r, remainingWaitTime ) ); - } ); + } } ); } ); diff --git a/tests/e2e/utils/flows.js b/tests/e2e/utils/flows.js index 0a2d8a8e7f8..aa18cd328a7 100644 --- a/tests/e2e/utils/flows.js +++ b/tests/e2e/utils/flows.js @@ -129,6 +129,14 @@ export const shopperWCP = { await expect( page ).toClick( 'label', { text: label } ); }, + setDefaultPaymentMethod: async ( label ) => { + const [ paymentMethodRow ] = await page.$x( + `//tr[contains(., '${ label }')]` + ); + await expect( paymentMethodRow ).toClick( '.button.default' ); + await page.waitForNavigation( { waitUntil: 'networkidle0' } ); + }, + toggleCreateAccount: async () => { await expect( page ).toClick( '#createaccount' ); }, From 7cb7a1b11271971b8222c30f2009703f3b2fe45d Mon Sep 17 00:00:00 2001 From: bruce aldridge Date: Thu, 14 Dec 2023 13:10:08 +1300 Subject: [PATCH 14/19] Deposits: Remove unnecessary notice when account is in new account waiting period (#7902) --- changelog/fix-7901-excess-deposit-notices | 5 +++++ client/components/deposits-overview/index.tsx | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 changelog/fix-7901-excess-deposit-notices diff --git a/changelog/fix-7901-excess-deposit-notices b/changelog/fix-7901-excess-deposit-notices new file mode 100644 index 00000000000..b11ea063c57 --- /dev/null +++ b/changelog/fix-7901-excess-deposit-notices @@ -0,0 +1,5 @@ +Significance: patch +Type: dev +Comment: Removing unneccessary notice when merchant is in new account waiting period. + + diff --git a/client/components/deposits-overview/index.tsx b/client/components/deposits-overview/index.tsx index b3605bdda8f..8ab797f4977 100644 --- a/client/components/deposits-overview/index.tsx +++ b/client/components/deposits-overview/index.tsx @@ -122,9 +122,10 @@ const DepositsOverview: React.FC = () => { { ! hasCompletedWaitingPeriod && ( ) } - { isDepositAwaitingPendingFunds && ( - - ) } + { hasCompletedWaitingPeriod && + isDepositAwaitingPendingFunds && ( + + ) } { isNegativeBalanceDepositsPaused && ( ) } From 62c5bf9ebfe99c80cc0a48a6f0b6fbb61373f4d9 Mon Sep 17 00:00:00 2001 From: Eric Jinks <3147296+Jinksi@users.noreply.github.com> Date: Thu, 14 Dec 2023 10:36:31 +1000 Subject: [PATCH 15/19] Deposits List - Hide the next deposit notice if account witin the new account waiting period (#7906) Co-authored-by: Shendy <73803630+shendy-a8c@users.noreply.github.com> --- .../fix-7904-hide-next-deposit-notice-within-waiting-period | 3 +++ client/deposits/index.tsx | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 changelog/fix-7904-hide-next-deposit-notice-within-waiting-period diff --git a/changelog/fix-7904-hide-next-deposit-notice-within-waiting-period b/changelog/fix-7904-hide-next-deposit-notice-within-waiting-period new file mode 100644 index 00000000000..181c017182d --- /dev/null +++ b/changelog/fix-7904-hide-next-deposit-notice-within-waiting-period @@ -0,0 +1,3 @@ +Significance: patch +Type: fix +Comment: No changelog for this change, part of previous changelog entry adding the next deposit notice diff --git a/client/deposits/index.tsx b/client/deposits/index.tsx index 9864ed11976..7f6e5c30f14 100644 --- a/client/deposits/index.tsx +++ b/client/deposits/index.tsx @@ -49,8 +49,12 @@ const NextDepositNotice: React.FC = () => { wcpaySettings.accountStatus.deposits?.restrictions === 'deposits_unrestricted'; + const hasCompletedWaitingPeriod = + wcpaySettings.accountStatus.deposits?.completed_waiting_period; + if ( ! isDepositsUnrestricted || + ! hasCompletedWaitingPeriod || ! account || isNextDepositNoticeDismissed ) { From cb92c0708ab914e61705aaa916b344cf8cba014d Mon Sep 17 00:00:00 2001 From: Eric Jinks <3147296+Jinksi@users.noreply.github.com> Date: Thu, 14 Dec 2023 11:12:27 +1000 Subject: [PATCH 16/19] Improve consistency of tooltip text style (#7908) Co-authored-by: Shendy <73803630+shendy-a8c@users.noreply.github.com> --- changelog/fix-7905-transactions-list-tooltip-styles | 5 +++++ client/components/tooltip/style.scss | 3 +++ client/transactions/list/style.scss | 5 ----- 3 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 changelog/fix-7905-transactions-list-tooltip-styles diff --git a/changelog/fix-7905-transactions-list-tooltip-styles b/changelog/fix-7905-transactions-list-tooltip-styles new file mode 100644 index 00000000000..ddc92781df8 --- /dev/null +++ b/changelog/fix-7905-transactions-list-tooltip-styles @@ -0,0 +1,5 @@ +Significance: patch +Type: fix +Comment: Improving consitency of tooltip styles, part of previous PR adding transaction list tooltip + + diff --git a/client/components/tooltip/style.scss b/client/components/tooltip/style.scss index aa0cfe52062..26730944226 100644 --- a/client/components/tooltip/style.scss +++ b/client/components/tooltip/style.scss @@ -37,6 +37,9 @@ z-index: 100010; // Initial left position is set to 0 to fix a positioning bug in mobile Safari. left: 0; + white-space: normal; + font-size: 12px; + font-weight: 400; &.is-hiding { opacity: 0 !important; diff --git a/client/transactions/list/style.scss b/client/transactions/list/style.scss index 3c876b115c3..e33b7755e91 100644 --- a/client/transactions/list/style.scss +++ b/client/transactions/list/style.scss @@ -46,11 +46,6 @@ $space-header-item: 12px; top: 3px; left: 8px; } - .woocommerce-table__item { - .wcpay-tooltip__content-wrapper { - white-space: normal; - } - } } /** From 7343bb2b0f39958fab005102cba86a31bcf5b32b Mon Sep 17 00:00:00 2001 From: botwoo Date: Thu, 14 Dec 2023 03:34:15 +0000 Subject: [PATCH 17/19] Amend changelog entries for release 6.9.2 --- changelog/fix-7901-excess-deposit-notices | 5 ----- .../fix-7904-hide-next-deposit-notice-within-waiting-period | 3 --- changelog/fix-7905-transactions-list-tooltip-styles | 5 ----- 3 files changed, 13 deletions(-) delete mode 100644 changelog/fix-7901-excess-deposit-notices delete mode 100644 changelog/fix-7904-hide-next-deposit-notice-within-waiting-period delete mode 100644 changelog/fix-7905-transactions-list-tooltip-styles diff --git a/changelog/fix-7901-excess-deposit-notices b/changelog/fix-7901-excess-deposit-notices deleted file mode 100644 index b11ea063c57..00000000000 --- a/changelog/fix-7901-excess-deposit-notices +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: dev -Comment: Removing unneccessary notice when merchant is in new account waiting period. - - diff --git a/changelog/fix-7904-hide-next-deposit-notice-within-waiting-period b/changelog/fix-7904-hide-next-deposit-notice-within-waiting-period deleted file mode 100644 index 181c017182d..00000000000 --- a/changelog/fix-7904-hide-next-deposit-notice-within-waiting-period +++ /dev/null @@ -1,3 +0,0 @@ -Significance: patch -Type: fix -Comment: No changelog for this change, part of previous changelog entry adding the next deposit notice diff --git a/changelog/fix-7905-transactions-list-tooltip-styles b/changelog/fix-7905-transactions-list-tooltip-styles deleted file mode 100644 index ddc92781df8..00000000000 --- a/changelog/fix-7905-transactions-list-tooltip-styles +++ /dev/null @@ -1,5 +0,0 @@ -Significance: patch -Type: fix -Comment: Improving consitency of tooltip styles, part of previous PR adding transaction list tooltip - - From 85e191afad8cadfe87f4854b8e39cfebf08af838 Mon Sep 17 00:00:00 2001 From: Timur Karimov Date: Thu, 14 Dec 2023 09:57:31 +0100 Subject: [PATCH 18/19] Cleanup the removed scripts rollout (#7911) Co-authored-by: Timur Karimov --- changelog/cleanup-redundant-script-enqueueing | 4 +++ ...yments-upe-split-blocks-payment-method.php | 26 ------------------- includes/class-wc-payments.php | 3 +-- 3 files changed, 5 insertions(+), 28 deletions(-) create mode 100644 changelog/cleanup-redundant-script-enqueueing delete mode 100644 includes/class-wc-payments-upe-split-blocks-payment-method.php diff --git a/changelog/cleanup-redundant-script-enqueueing b/changelog/cleanup-redundant-script-enqueueing new file mode 100644 index 00000000000..20c952d459e --- /dev/null +++ b/changelog/cleanup-redundant-script-enqueueing @@ -0,0 +1,4 @@ +Significance: minor +Type: dev + +Cleanup enqueueing of the scripts which were removed diff --git a/includes/class-wc-payments-upe-split-blocks-payment-method.php b/includes/class-wc-payments-upe-split-blocks-payment-method.php deleted file mode 100644 index 2f1188611ea..00000000000 --- a/includes/class-wc-payments-upe-split-blocks-payment-method.php +++ /dev/null @@ -1,26 +0,0 @@ -register( new WC_Payments_UPE_Split_Blocks_Payment_Method() ); + $payment_method_registry->register( new WC_Payments_Blocks_Payment_Method() ); } /** From 7a7a05e87888422d12b6f40b64e7bb616f27048a Mon Sep 17 00:00:00 2001 From: Cvetan Cvetanov Date: Thu, 14 Dec 2023 11:32:46 +0200 Subject: [PATCH 19/19] Introduce additional columns to the Transaction list UI (#7813) --- changelog/add-7591-missing-columns-export-csv | 4 + client/transactions/list/index.tsx | 76 +++++++++++++++-- .../list/test/__snapshots__/index.tsx.snap | 84 +++++++++---------- client/transactions/list/test/index.tsx | 26 +++--- 4 files changed, 132 insertions(+), 58 deletions(-) create mode 100644 changelog/add-7591-missing-columns-export-csv diff --git a/changelog/add-7591-missing-columns-export-csv b/changelog/add-7591-missing-columns-export-csv new file mode 100644 index 00000000000..668644d2cfc --- /dev/null +++ b/changelog/add-7591-missing-columns-export-csv @@ -0,0 +1,4 @@ +Significance: minor +Type: add + +Introduce Customer currency, Deposit currency, Amount in Customer Currency and Deposit ID columns to the Transaction list UI and CSV export diff --git a/client/transactions/list/index.tsx b/client/transactions/list/index.tsx index 8b66096a60c..931712821a9 100644 --- a/client/transactions/list/index.tsx +++ b/client/transactions/list/index.tsx @@ -144,8 +144,11 @@ const getColumns = ( }, { key: 'date', - label: __( 'Date / Time', 'woocommerce-payments' ), - screenReaderLabel: __( 'Date and time', 'woocommerce-payments' ), + label: __( 'Date / Time (UTC)', 'woocommerce-payments' ), + screenReaderLabel: __( + 'Date and time in UTC', + 'woocommerce-payments' + ), required: true, isLeftAligned: true, defaultOrder: 'desc', @@ -167,10 +170,41 @@ const getColumns = ( required: true, isLeftAligned: true, }, + { + key: 'customer_currency', + label: __( 'Paid Currency', 'woocommerce-payments' ), + screenReaderLabel: __( + 'Customer Currency', + 'woocommerce-payments' + ), + isSortable: true, + visible: false, + }, + { + key: 'customer_amount', + label: __( 'Amount Paid', 'woocommerce-payments' ), + screenReaderLabel: __( + 'Amount in Customer Currency', + 'woocommerce-payments' + ), + isNumeric: true, + isSortable: true, + visible: false, + }, + { + key: 'deposit_currency', + label: __( 'Deposit Currency', 'woocommerce-payments' ), + screenReaderLabel: __( 'Deposit Currency', 'woocommerce-payments' ), + isSortable: true, + visible: false, + }, { key: 'amount', label: __( 'Amount', 'woocommerce-payments' ), - screenReaderLabel: __( 'Amount', 'woocommerce-payments' ), + screenReaderLabel: __( + 'Amount in Deposit Curency', + 'woocommerce-payments' + ), isNumeric: true, isSortable: true, }, @@ -205,8 +239,8 @@ const getColumns = ( }, { key: 'source', - label: __( 'Source', 'woocommerce-payments' ), - screenReaderLabel: __( 'Source', 'woocommerce-payments' ), + label: __( 'Payment Method', 'woocommerce-payments' ), + screenReaderLabel: __( 'Payment Method', 'woocommerce-payments' ), cellClassName: 'is-center-aligned', }, { @@ -236,6 +270,14 @@ const getColumns = ( visible: false, isLeftAligned: true, }, + includeDeposit && { + key: 'deposit_id', + label: __( 'Deposit ID', 'woocommerce-payments' ), + screenReaderLabel: __( 'Deposit ID', 'woocommerce-payments' ), + cellClassName: 'deposit', + isLeftAligned: true, + visible: false, + }, includeDeposit && { key: 'deposit', label: __( 'Deposit date', 'woocommerce-payments' ), @@ -371,6 +413,17 @@ export const TransactionsList = ( ), }; }; + const formatCustomerAmount = () => { + return { + value: formatExportAmount( + txn.customer_amount, + txn.customer_currency + ), + display: clickable( + formatCurrency( txn.customer_amount, txn.customer_currency ) + ), + }; + }; const isFinancingType = -1 !== @@ -464,6 +517,15 @@ export const TransactionsList = ( value: txn.customer_country, display: clickable( txn.customer_country ), }, + customer_currency: { + value: txn.customer_currency.toUpperCase(), + display: clickable( txn.customer_currency.toUpperCase() ), + }, + customer_amount: formatCustomerAmount(), + deposit_currency: { + value: txn.currency.toUpperCase(), + display: clickable( txn.currency.toUpperCase() ), + }, amount: formatAmount(), // fees should display as negative. The format $-9.99 is determined by WC-Admin fees: formatFees(), @@ -477,6 +539,10 @@ export const TransactionsList = ( value: calculateRiskMapping( txn.risk_level ), display: clickable( riskLevel ), }, + deposit_id: { + value: txn.deposit_id, + display: txn.deposit_id, + }, deposit: { value: txn.available_on, display: deposit }, deposit_status: { value: depositStatus, diff --git a/client/transactions/list/test/__snapshots__/index.tsx.snap b/client/transactions/list/test/__snapshots__/index.tsx.snap index 35b86a155f7..c7bfca77b45 100644 --- a/client/transactions/list/test/__snapshots__/index.tsx.snap +++ b/client/transactions/list/test/__snapshots__/index.tsx.snap @@ -248,19 +248,19 @@ exports[`Transactions list renders correctly when can filter by several currenci - Date and time + Date and time in UTC - Sort by Date and time in ascending order + Sort by Date and time in UTC in ascending order - Amount + Amount in Deposit Curency - Sort by Amount in descending order + Sort by Amount in Deposit Curency in descending order - Source + Payment Method - Source + Payment Method - Date / Time + Date / Time (UTC) - Date and time + Date and time in UTC - Sort by Date and time in ascending order + Sort by Date and time in UTC in ascending order - Amount + Amount in Deposit Curency - Sort by Amount in descending order + Sort by Amount in Deposit Curency in descending order - Source + Payment Method - Source + Payment Method - Date / Time + Date / Time (UTC) - Date and time + Date and time in UTC - Sort by Date and time in ascending order + Sort by Date and time in UTC in ascending order - Amount + Amount in Deposit Curency - Sort by Amount in descending order + Sort by Amount in Deposit Curency in descending order - Source + Payment Method - Source + Payment Method - Date / Time + Date / Time (UTC) - Date and time + Date and time in UTC - Sort by Date and time in ascending order + Sort by Date and time in UTC in ascending order - Amount + Amount in Deposit Curency - Sort by Amount in descending order + Sort by Amount in Deposit Curency in descending order - Source + Payment Method - Source + Payment Method - Date / Time + Date / Time (UTC) - Date and time + Date and time in UTC - Sort by Date and time in ascending order + Sort by Date and time in UTC in ascending order - Amount + Amount in Deposit Curency - Sort by Amount in descending order + Sort by Amount in Deposit Curency in descending order - Source + Payment Method - Source + Payment Method - Date / Time + Date / Time (UTC) - Date and time + Date and time in UTC - Sort by Date and time in ascending order + Sort by Date and time in UTC in ascending order - Amount + Amount in Deposit Curency - Sort by Amount in descending order + Sort by Amount in Deposit Curency in descending order - Source + Payment Method - Source + Payment Method { } ); test( 'sorts by default field date', () => { - sortBy( 'Date and time' ); + sortBy( 'Date and time in UTC' ); expectSortingToBe( 'date', 'asc' ); - sortBy( 'Date and time' ); + sortBy( 'Date and time in UTC' ); expectSortingToBe( 'date', 'desc' ); } ); test( 'sorts by amount', () => { - sortBy( 'Amount' ); + sortBy( 'Amount in Deposit Curency' ); expectSortingToBe( 'amount', 'desc' ); - sortBy( 'Amount' ); + sortBy( 'Amount in Deposit Curency' ); expectSortingToBe( 'amount', 'asc' ); } ); @@ -609,18 +609,22 @@ describe( 'Transactions list', () => { const expected = [ '"Transaction Id"', - '"Date / Time"', + '"Date / Time (UTC)"', 'Type', 'Channel', + '"Paid Currency"', + '"Amount Paid"', + '"Deposit Currency"', 'Amount', 'Fees', 'Net', '"Order #"', - 'Source', + '"Payment Method"', 'Customer', 'Email', 'Country', '"Risk level"', + '"Deposit ID"', '"Deposit date"', '"Deposit status"', ]; @@ -675,26 +679,26 @@ describe( 'Transactions list', () => { ); // channel expect( getUnformattedAmount( displayFirstTransaction[ 3 ] ).indexOf( - csvFirstTransaction[ 4 ] + csvFirstTransaction[ 7 ] ) ).not.toBe( -1 ); // amount expect( -Number( getUnformattedAmount( displayFirstTransaction[ 4 ] ) ) ).toEqual( Number( - csvFirstTransaction[ 5 ].replace( /['"]+/g, '' ) // strip extra quotes + csvFirstTransaction[ 8 ].replace( /['"]+/g, '' ) // strip extra quotes ) ); // fees expect( getUnformattedAmount( displayFirstTransaction[ 5 ] ).indexOf( - csvFirstTransaction[ 6 ] + csvFirstTransaction[ 9 ] ) ).not.toBe( -1 ); // net expect( displayFirstTransaction[ 6 ] ).toBe( - csvFirstTransaction[ 7 ] + csvFirstTransaction[ 10 ] ); // order number expect( displayFirstTransaction[ 8 ] ).toBe( - csvFirstTransaction[ 9 ].replace( /['"]+/g, '' ) // strip extra quotes + csvFirstTransaction[ 12 ].replace( /['"]+/g, '' ) // strip extra quotes ); // customer } ); } );