Skip to content

Commit b0b3455

Browse files
committed
fix: bc
1 parent 54c15ca commit b0b3455

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/Response/PaymentResponse.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,19 @@ public static function createStatusResponse(string $status, string $message = ''
9898
}
9999

100100
/**
101-
* @param self::ACTION_*|'' $status
101+
* @deprecated tag:v5.0.0 - Will be removed and is replaced by {@see self::redirectUrl}
102102
*/
103-
public static function redirect(string $url, string $status = ''): ResponseInterface
103+
public static function redirect(string $url): ResponseInterface
104104
{
105-
return self::createResponse(array_filter(['redirectUrl' => $url, 'status' => $status]));
105+
return self::createResponse(['redirectUrl' => $url]);
106+
}
107+
108+
/**
109+
* @param self::ACTION_* $status
110+
*/
111+
public static function redirectUrl(string $status, string $url): ResponseInterface
112+
{
113+
return self::createResponse(array_filter(['status' => $status, 'redirectUrl' => $url]));
106114
}
107115

108116
/**

tests/Response/PaymentResponseTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ public function testValidateError(): void
123123
static::assertSame('{"message":"error"}', $response->getBody()->getContents());
124124
}
125125

126+
/**
127+
* @deprecated tag:v5.0.0 - Will be removed
128+
*/
126129
public function testRedirect(): void
127130
{
128131
$response = PaymentResponse::redirect('https://example.com');
@@ -131,11 +134,11 @@ public function testRedirect(): void
131134
static::assertSame('{"redirectUrl":"https:\/\/example.com"}', $response->getBody()->getContents());
132135
}
133136

134-
public function testRedirectWithStatus(): void
137+
public function testRedirectUrl(): void
135138
{
136-
$response = PaymentResponse::redirect('https://example.com', PaymentResponse::ACTION_PROCESS);
139+
$response = PaymentResponse::redirectUrl(PaymentResponse::ACTION_PROCESS, 'https://example.com');
137140

138141
static::assertSame(200, $response->getStatusCode());
139-
static::assertSame('{"redirectUrl":"https:\/\/example.com","status":"process"}', $response->getBody()->getContents());
142+
static::assertSame('{"status":"process","redirectUrl":"https:\/\/example.com"}', $response->getBody()->getContents());
140143
}
141144
}

0 commit comments

Comments
 (0)