From ff082d43bb299dc4cf6890d2d38a43b5cffd4faf Mon Sep 17 00:00:00 2001 From: Adeildo Amorim Date: Wed, 27 Mar 2024 16:08:33 -0300 Subject: [PATCH] [Feature] Added new rules for celcoin billets --- src/Clients/CelcoinBAASBillet.php | 7 ++++++- src/Rules/BAAS/Billet.php | 2 +- src/Types/BAAS/Billet.php | 2 +- tests/Integration/BAAS/CelcoinBASSBilletTest.php | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Clients/CelcoinBAASBillet.php b/src/Clients/CelcoinBAASBillet.php index eb46d8b..61e2b0c 100644 --- a/src/Clients/CelcoinBAASBillet.php +++ b/src/Clients/CelcoinBAASBillet.php @@ -10,7 +10,7 @@ class CelcoinBAASBillet extends CelcoinBaseApi { - const BILLET_URL = '/api-integration-baas-webservice/v1/charge'; + const BILLET_URL = '/baas/v2/Charge'; /** @@ -41,4 +41,9 @@ public function cancelBillet($transactionId) { return $this->delete(sprintf('%s/%s', self::BILLET_URL, $transactionId)); } + + public function printBillet(string $billetId) + { + return $this->get(sprintf('%s/pdf/%s', self::BILLET_URL, $billetId)); + } } \ No newline at end of file diff --git a/src/Rules/BAAS/Billet.php b/src/Rules/BAAS/Billet.php index 7085aac..ccc64c9 100644 --- a/src/Rules/BAAS/Billet.php +++ b/src/Rules/BAAS/Billet.php @@ -10,7 +10,7 @@ public static function rules(): array 'externalId' => ['required'], 'merchantCategoryCode' => ['sometimes', 'required'], 'expirationAfterPayment' => ['required', 'numeric', 'min:1'], - 'duedate' => ['required', 'date'], + 'dueDate' => ['required', 'date', 'after:yesterday'], 'amount' => ['required', 'decimal:0,2'], 'key' => ['required'], 'debtor' => ['required', 'array'], diff --git a/src/Types/BAAS/Billet.php b/src/Types/BAAS/Billet.php index 1b6f920..de145e9 100644 --- a/src/Types/BAAS/Billet.php +++ b/src/Types/BAAS/Billet.php @@ -9,7 +9,7 @@ class Billet extends Data public string $externalId; public ?string $merchantCategoryCode; public int $expirationAfterPayment; - public string $duedate; + public string $dueDate; public float $amount; public ?string $key; /** diff --git a/tests/Integration/BAAS/CelcoinBASSBilletTest.php b/tests/Integration/BAAS/CelcoinBASSBilletTest.php index 41e6f48..6c5def4 100644 --- a/tests/Integration/BAAS/CelcoinBASSBilletTest.php +++ b/tests/Integration/BAAS/CelcoinBASSBilletTest.php @@ -47,7 +47,7 @@ public static function billetBodyRequest(): Billet "externalId" => "externalId1", "expirationAfterPayment" => 1, "merchantCatagoryCode" => "0000", - "duedate" => "2023-12-30T00:00:00.0000000", + "dueDate" => now()->format('Y-m-d'), "amount" => 12.5, "key" => "testepix@celcoin.com.br", "debtor" => new BilletDebtor([