Skip to content

Commit

Permalink
Merge branch 'develop' into tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
Timur Karimov committed Dec 12, 2023
2 parents f09e566 + ef7a13c commit 0cd63ab
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions changelog/add-thank-you-page-tracks
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Thank you page Tracks event
5 changes: 5 additions & 0 deletions changelog/dev-fix-multi-currency-e2e-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: Fix multi-currency e2e tests.


17 changes: 17 additions & 0 deletions includes/class-woopay-tracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ] );
}

/**
Expand Down Expand Up @@ -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.
*
Expand Down
3 changes: 3 additions & 0 deletions tests/e2e/config/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();
Expand Down

0 comments on commit 0cd63ab

Please sign in to comment.