From 0dd1804f2568c7c6093a37e112bb222b8ecaea4c Mon Sep 17 00:00:00 2001 From: Fernando Date: Tue, 2 Jul 2024 17:57:14 -0400 Subject: [PATCH] refactor: add null type in webpay plus responses files --- .../MallTransactionStatusResponse.php | 40 +++++++-------- .../Responses/TransactionCaptureResponse.php | 24 ++++----- .../Responses/TransactionCreateResponse.php | 4 +- .../Responses/TransactionDetail.php | 50 +++++++++---------- .../Responses/TransactionRefundResponse.php | 20 ++++---- .../Responses/TransactionStatusResponse.php | 6 +-- 6 files changed, 72 insertions(+), 72 deletions(-) diff --git a/src/Webpay/WebpayPlus/Responses/MallTransactionStatusResponse.php b/src/Webpay/WebpayPlus/Responses/MallTransactionStatusResponse.php index 33371ac5..f49d0f28 100644 --- a/src/Webpay/WebpayPlus/Responses/MallTransactionStatusResponse.php +++ b/src/Webpay/WebpayPlus/Responses/MallTransactionStatusResponse.php @@ -9,15 +9,15 @@ */ class MallTransactionStatusResponse { - public string $vci; - public string $buyOrder; - public string $sessionId; - public string $cardNumber; - public array $cardDetail; + public ?string $vci; + public ?string $buyOrder; + public ?string $sessionId; + public ?string $cardNumber; + public ?array $cardDetail; public ?string $expirationDate; - public string $accountingDate; - public string $transactionDate; - public array $details; + public ?string $accountingDate; + public ?string $transactionDate; + public ?array $details; /** * @var TransactionDetail[] @@ -62,25 +62,25 @@ public function isApproved(): bool } /** - * @return string + * @return ?string */ - public function getBuyOrder(): string + public function getBuyOrder(): ?string { return $this->buyOrder; } /** - * @return string + * @return ?string */ - public function getSessionId(): string + public function getSessionId(): ?string { return $this->sessionId; } /** - * @return string + * @return ?string */ - public function getCardNumber(): string + public function getCardNumber(): ?string { return $this->cardNumber; } @@ -94,17 +94,17 @@ public function getExpirationDate(): ?string } /** - * @return string + * @return ?string */ - public function getAccountingDate(): string + public function getAccountingDate(): ?string { return $this->accountingDate; } /** - * @return string + * @return ?string */ - public function getTransactionDate(): string + public function getTransactionDate(): ?string { return $this->transactionDate; } @@ -118,9 +118,9 @@ public function getDetails(): ?array } /** - * @return string + * @return ?string */ - public function getVci(): string + public function getVci(): ?string { return $this->vci; } diff --git a/src/Webpay/WebpayPlus/Responses/TransactionCaptureResponse.php b/src/Webpay/WebpayPlus/Responses/TransactionCaptureResponse.php index 2fb9c9fd..d666e767 100644 --- a/src/Webpay/WebpayPlus/Responses/TransactionCaptureResponse.php +++ b/src/Webpay/WebpayPlus/Responses/TransactionCaptureResponse.php @@ -12,10 +12,10 @@ class TransactionCaptureResponse * * @param array $json */ - public string $authorizationCode; - public string $authorizationDate; - public float $capturedAmount; - public int $responseCode; + public ?string $authorizationCode; + public ?string $authorizationDate; + public ?float $capturedAmount; + public ?int $responseCode; public function __construct(array $json) { @@ -34,33 +34,33 @@ public function isApproved(): bool } /** - * @return string + * @return ?string */ - public function getAuthorizationCode(): string + public function getAuthorizationCode(): ?string { return $this->authorizationCode; } /** - * @return string + * @return ?string */ - public function getAuthorizationDate(): string + public function getAuthorizationDate(): ?string { return $this->authorizationDate; } /** - * @return float + * @return ?float */ - public function getCapturedAmount(): float + public function getCapturedAmount(): ?float { return $this->capturedAmount; } /** - * @return int + * @return ?int */ - public function getResponseCode(): int + public function getResponseCode(): ?int { return $this->responseCode; } diff --git a/src/Webpay/WebpayPlus/Responses/TransactionCreateResponse.php b/src/Webpay/WebpayPlus/Responses/TransactionCreateResponse.php index 55072933..bbf61bb8 100644 --- a/src/Webpay/WebpayPlus/Responses/TransactionCreateResponse.php +++ b/src/Webpay/WebpayPlus/Responses/TransactionCreateResponse.php @@ -9,12 +9,12 @@ class TransactionCreateResponse /** * @var ?string */ - public $token; + public ?string $token; /** * @var ?string */ - public $url; + public ?string $url; /** * TransactionCreateResponse constructor. diff --git a/src/Webpay/WebpayPlus/Responses/TransactionDetail.php b/src/Webpay/WebpayPlus/Responses/TransactionDetail.php index f3983c75..9ce240fa 100644 --- a/src/Webpay/WebpayPlus/Responses/TransactionDetail.php +++ b/src/Webpay/WebpayPlus/Responses/TransactionDetail.php @@ -8,15 +8,15 @@ class TransactionDetail { - public float $amount; - public string $status; - public string $authorizationCode; - public string $paymentTypeCode; - public int $responseCode; - public int $installmentsNumber; + public ?float $amount; + public ?string $status; + public ?string $authorizationCode; + public ?string $paymentTypeCode; + public ?int $responseCode; + public ?int $installmentsNumber; public ?float $installmentsAmount; public ?string $commerceCode; - public string $buyOrder; + public ?string $buyOrder; public ?float $balance; public static function createFromArray(array $array) @@ -58,65 +58,65 @@ public function isApproved(): bool } /** - * @return float + * @return ?float */ - public function getAmount(): float + public function getAmount(): ?float { return $this->amount; } /** - * @return string + * @return ?string */ - public function getStatus(): string + public function getStatus(): ?string { return $this->status; } /** - * @return string + * @return ?string */ - public function getAuthorizationCode(): string + public function getAuthorizationCode(): ?string { return $this->authorizationCode; } /** - * @return string + * @return ?string */ - public function getPaymentTypeCode(): string + public function getPaymentTypeCode(): ?string { return $this->paymentTypeCode; } /** - * @return int + * @return ?int */ - public function getResponseCode(): int + public function getResponseCode(): ?int { return $this->responseCode; } /** - * @return int + * @return ?int */ - public function getInstallmentsNumber(): int + public function getInstallmentsNumber(): ?int { return $this->installmentsNumber; } /** - * @return int + * @return ?int */ - public function getCommerceCode(): string + public function getCommerceCode(): ?string { return $this->commerceCode; } /** - * @return string + * @return ?string */ - public function getBuyOrder(): string + public function getBuyOrder(): ?string { return $this->buyOrder; } @@ -130,9 +130,9 @@ public function getInstallmentsAmount(): ?float } /** - * @return float + * @return ?float */ - public function getBalance(): float + public function getBalance(): ?float { return $this->balance; } diff --git a/src/Webpay/WebpayPlus/Responses/TransactionRefundResponse.php b/src/Webpay/WebpayPlus/Responses/TransactionRefundResponse.php index 98fc75e7..f9ede336 100644 --- a/src/Webpay/WebpayPlus/Responses/TransactionRefundResponse.php +++ b/src/Webpay/WebpayPlus/Responses/TransactionRefundResponse.php @@ -10,27 +10,27 @@ class TransactionRefundResponse /** * @var string */ - public $type; + public ?string $type; /** * @var ?string */ - public $authorizationCode; + public ?string $authorizationCode; /** * @var ?string */ - public $authorizationDate; + public ?string $authorizationDate; /** * @var ?float */ - public $nullifiedAmount; + public ?float $nullifiedAmount; /** * @var ?float */ - public $balance; + public ?float $balance; /** * @var ?int */ - public $responseCode; + public ?int $responseCode; /** * TransactionRefundResponse constructor. @@ -75,15 +75,15 @@ public function getBalance(): ?float /** * @return ?int */ - public function getResponseCode(): int + public function getResponseCode(): ?int { return $this->responseCode; } /** - * @return string + * @return ?string */ - public function getType(): string + public function getType(): ?string { return $this->type; } @@ -99,7 +99,7 @@ public function getAuthorizationCode(): ?string /** * @return ?string */ - public function getAuthorizationDate(): string + public function getAuthorizationDate(): ?string { return $this->authorizationDate; } diff --git a/src/Webpay/WebpayPlus/Responses/TransactionStatusResponse.php b/src/Webpay/WebpayPlus/Responses/TransactionStatusResponse.php index 89960170..d2d979c9 100644 --- a/src/Webpay/WebpayPlus/Responses/TransactionStatusResponse.php +++ b/src/Webpay/WebpayPlus/Responses/TransactionStatusResponse.php @@ -10,7 +10,7 @@ class TransactionStatusResponse { use HasTransactionStatus; - public string $vci; + public ?string $vci; public function __construct(array $json) { @@ -42,9 +42,9 @@ public function isApproved(): bool } /** - * @return string + * @return ?string */ - public function getVci(): string + public function getVci(): ?string { return $this->vci; }