Skip to content

Commit 8ad13be

Browse files
committed
Remove cross-browser AppSwitch query params
1 parent 0f661b7 commit 8ad13be

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

modules/ppcp-api-client/src/Factory/ReturnUrlFactory.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ public function from_context(
2525
array $request_data = array(),
2626
array $custom_query_args = array()
2727
): string {
28-
return add_query_arg(
29-
array_merge(
30-
array( self::PCP_QUERY_ARG => 'button' ),
31-
$custom_query_args
32-
),
33-
$this->wc_url_from_context( $context, $request_data )
34-
);
28+
// TODO: Temporarily disabled cross-browser appswitch query params.
29+
// This logic will be migrated to the frontend using hash params instead of query params
30+
// return add_query_arg(
31+
// array_merge(
32+
// array( self::PCP_QUERY_ARG => 'button' ),
33+
// $custom_query_args
34+
// ),
35+
// $this->wc_url_from_context( $context, $request_data )
36+
// );
37+
return $this->wc_url_from_context( $context, $request_data );
3538
}
3639

3740
protected function wc_url_from_context( string $context, array $request_data = array() ): string {

tests/PHPUnit/ApiClient/Factory/ReturnUrlFactoryTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testFromContextReturnsCartUrl(string $context)
3737

3838
$result = $this->testee->from_context($context);
3939

40-
$this->assertEquals('https://example.com/cart?pcp-return=button', $result);
40+
$this->assertEquals('https://example.com/cart', $result);
4141
}
4242

4343
public function testFromContextProductReturnsProductUrl()
@@ -56,7 +56,7 @@ public function testFromContextProductReturnsProductUrl()
5656

5757
$result = $this->testee->from_context('product', $request_data);
5858

59-
$this->assertEquals('https://example.com/product/123?pcp-return=button', $result);
59+
$this->assertEquals('https://example.com/product/123', $result);
6060
}
6161

6262
public function testFromContextProductThrowsExceptionWhenNoUrl()
@@ -90,7 +90,7 @@ public function testFromContextPayNowReturnsOrderPaymentUrl()
9090

9191
$result = $this->testee->from_context('pay-now', $request_data);
9292

93-
$this->assertEquals('https://example.com/checkout/pay/123?key=abc&pcp-return=button', $result);
93+
$this->assertEquals('https://example.com/checkout/pay/123?key=abc', $result);
9494
}
9595

9696
public function testFromContextPayNowThrowsExceptionWhenOrderNotFound()
@@ -110,7 +110,7 @@ public function testFromContextCheckoutReturnsCheckoutUrl()
110110

111111
$result = $this->testee->from_context('checkout');
112112

113-
$this->assertEquals('https://example.com/checkout?pcp-return=button', $result);
113+
$this->assertEquals('https://example.com/checkout', $result);
114114
}
115115

116116
public function testFromContextDefaultReturnsCheckoutUrl()
@@ -119,7 +119,7 @@ public function testFromContextDefaultReturnsCheckoutUrl()
119119

120120
$result = $this->testee->from_context('unknown-context');
121121

122-
$this->assertEquals('https://example.com/checkout?pcp-return=button', $result);
122+
$this->assertEquals('https://example.com/checkout', $result);
123123
}
124124

125125
public function testFromContextReturnsCartUrlWithCustomArgs()
@@ -128,7 +128,7 @@ public function testFromContextReturnsCartUrlWithCustomArgs()
128128

129129
$result = $this->testee->from_context('cart', [], ['session' => '123']);
130130

131-
$this->assertEquals('https://example.com/cart?pcp-return=button&session=123', $result);
131+
$this->assertEquals('https://example.com/cart', $result);
132132
}
133133

134134
public function cartContextProvider(): array

0 commit comments

Comments
 (0)