Skip to content

Commit

Permalink
#14 refactor to be more clear from what param created
Browse files Browse the repository at this point in the history
  • Loading branch information
skoro committed Sep 9, 2024
1 parent 3df0dbc commit ddd95f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Api/V1/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ public function getPaymentStatus(
$event = $this->eventDispatcher->dispatch(new PaymentStatusEvent($order, $statusResponse));
$statusResponse = $event->paymentStatusResponse;

return $this->json(PaymentStatusDto::makeFromResponse($paymentGateway->getId(), $statusResponse));
return $this->json(PaymentStatusDto::makeFromPaymentGatewayResponse($paymentGateway->getId(), $statusResponse));
}
}
2 changes: 1 addition & 1 deletion src/Dto/PaymentStatusDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct(
) {
}

public static function makeFromResponse(
public static function makeFromPaymentGatewayResponse(
string $paymentGatewayId,
ResponseInterface $response,
): self {
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/Dto/PaymentStatusDtoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testCastToStringPaymentResponseValues(): void
$response->method('getCode')->willReturn(null);
$response->method('getRawData')->willReturn(false);

$dto = PaymentStatusDto::makeFromResponse('123', $response);
$dto = PaymentStatusDto::makeFromPaymentGatewayResponse('123', $response);

$this->assertEquals('123', $dto->paymentGatewayId);
$this->assertEquals('', $dto->message);
Expand All @@ -40,7 +40,7 @@ public function testPaymentStatusDataAlwaysCastToArray(mixed $data, $expected):
$response->method('getCode')->willReturn(null);
$response->method('getRawData')->willReturn($data);

$dto = PaymentStatusDto::makeFromResponse('123', $response);
$dto = PaymentStatusDto::makeFromPaymentGatewayResponse('123', $response);

$this->assertEquals($expected, $dto->data);
}
Expand Down

0 comments on commit ddd95f9

Please sign in to comment.