Skip to content

Commit 528921d

Browse files
authored
Merge pull request #3761 from woocommerce/PCP-5441
Disable cross-browser AppSwitch query parameters (5441)
2 parents cff539d + 27560f4 commit 528921d

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,7 @@ 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+
return $this->wc_url_from_context( $context, $request_data );
3529
}
3630

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

tests/PHPUnit/ApiClient/Factory/ReturnUrlFactoryTest.php

Lines changed: 5 additions & 14 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,18 +119,9 @@ 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

125-
public function testFromContextReturnsCartUrlWithCustomArgs()
126-
{
127-
when('wc_get_cart_url')->justReturn('https://example.com/cart');
128-
129-
$result = $this->testee->from_context('cart', [], ['session' => '123']);
130-
131-
$this->assertEquals('https://example.com/cart?pcp-return=button&session=123', $result);
132-
}
133-
134125
public function cartContextProvider(): array
135126
{
136127
return [

0 commit comments

Comments
 (0)