From 6cf5ef860d59bb78b6f1d863780ad2d4682121a6 Mon Sep 17 00:00:00 2001 From: Michael de Oliveira Ferreira Date: Thu, 11 Apr 2024 01:22:07 -0300 Subject: [PATCH 1/8] feature: pix claim, bump orchestra testbench to 8.x(laravel 10.x) --- src/Clients/CelcoinPIXDICT.php | 54 +++++++- src/Enums/ClaimAnswerReasonEnum.php | 12 ++ src/Enums/ClaimKeyTypeEnum.php | 12 ++ src/Enums/ClaimTypeEnum.php | 10 ++ src/Rules/PIX/ClaimAnswer.php | 18 +++ src/Rules/PIX/ClaimCreate.php | 25 ++++ src/Types/PIX/Claim.php | 24 ++++ src/Types/PIX/ClaimAnswer.php | 19 +++ .../PIX/DICT/PixKeyCancelConfirmTest.php | 110 +++++++++++++++ .../PIX/DICT/PixKeyClaimConfirmTest.php | 111 +++++++++++++++ .../PIX/DICT/PixKeyClaimConsultTest.php | 127 ++++++++++++++++++ .../Integration/PIX/DICT/PixKeyClaimTest.php | 119 ++++++++++++++++ 12 files changed, 640 insertions(+), 1 deletion(-) create mode 100644 src/Enums/ClaimAnswerReasonEnum.php create mode 100644 src/Enums/ClaimKeyTypeEnum.php create mode 100644 src/Enums/ClaimTypeEnum.php create mode 100644 src/Rules/PIX/ClaimAnswer.php create mode 100644 src/Rules/PIX/ClaimCreate.php create mode 100644 src/Types/PIX/Claim.php create mode 100644 src/Types/PIX/ClaimAnswer.php create mode 100644 tests/Integration/PIX/DICT/PixKeyCancelConfirmTest.php create mode 100644 tests/Integration/PIX/DICT/PixKeyClaimConfirmTest.php create mode 100644 tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php create mode 100644 tests/Integration/PIX/DICT/PixKeyClaimTest.php diff --git a/src/Clients/CelcoinPIXDICT.php b/src/Clients/CelcoinPIXDICT.php index 65d1034..6edae82 100644 --- a/src/Clients/CelcoinPIXDICT.php +++ b/src/Clients/CelcoinPIXDICT.php @@ -5,16 +5,23 @@ use Illuminate\Http\Client\RequestException; use Illuminate\Support\Facades\Validator; use WeDevBr\Celcoin\Common\CelcoinBaseApi; +use WeDevBr\Celcoin\Rules\PIX\ClaimAnswer as ClaimAnswerRule; +use WeDevBr\Celcoin\Rules\PIX\ClaimCreate; use WeDevBr\Celcoin\Rules\PIX\DICTSearch; use WeDevBr\Celcoin\Rules\PIX\DICTVerify; +use WeDevBr\Celcoin\Types\PIX\Claim; +use WeDevBr\Celcoin\Types\PIX\ClaimAnswer; use WeDevBr\Celcoin\Types\PIX\DICT; class CelcoinPIXDICT extends CelcoinBaseApi { const POST_SEARCH_DICT = '/pix/v1/dict/v2/key'; const POST_VERIFY_DICT = '/pix/v1/dict/keychecker'; + const CLAIM_DICT = '/pix/v1/dict/claim'; + const CLAIM_CONFIRM = '/pix/v1/dict/claim/confirm'; + const CLAIM_CANCEL = '/pix/v1/dict/claim/cancel'; - /** + /** * @param DICT $dict * @return array|null * @throws RequestException @@ -41,4 +48,49 @@ public function verifyDICT(DICT $dict): ?array $body ); } + + /** + * @throws RequestException + */ + public function claim(Claim $claim): ?array + { + $body = Validator::validate($claim->toArray(), ClaimCreate::rules()); + return $this->post( + self::CLAIM_DICT, + $body + ); + } + + public function claimConfirm(ClaimAnswer $claim): ?array + { + $body = Validator::validate($claim->toArray(), ClaimAnswerRule::rules()); + return $this->post( + self::CLAIM_CONFIRM, + $body + ); + } + + /** + * @throws RequestException + */ + public function claimCancel(ClaimAnswer $claim): ?array + { + $body = Validator::validate($claim->toArray(), ClaimAnswerRule::rules()); + return $this->post( + self::CLAIM_CANCEL, + $body + ); + } + + /** + * @throws RequestException + */ + public function claimConsult(string $claimId): ?array + { + $body = Validator::validate(['claimId' => $claimId], ['claimId' => ['string', 'uuid']]); + return $this->get( + self::CLAIM_CANCEL.'/'.$claimId, + $body + ); + } } \ No newline at end of file diff --git a/src/Enums/ClaimAnswerReasonEnum.php b/src/Enums/ClaimAnswerReasonEnum.php new file mode 100644 index 0000000..d045ac5 --- /dev/null +++ b/src/Enums/ClaimAnswerReasonEnum.php @@ -0,0 +1,12 @@ + ['required', 'uuid'], + 'reason' => ['required', Rule::enum(ClaimAnswerReasonEnum::class)], + ]; + } + +} \ No newline at end of file diff --git a/src/Rules/PIX/ClaimCreate.php b/src/Rules/PIX/ClaimCreate.php new file mode 100644 index 0000000..9bf663c --- /dev/null +++ b/src/Rules/PIX/ClaimCreate.php @@ -0,0 +1,25 @@ + ['required'], + 'keyType' => ['required', Rule::enum(ClaimKeyTypeEnum::class)->when( + ClaimTypeEnum::OWNERSHIP, + fn($rule) => $rule->only([ClaimKeyTypeEnum::PHONE, ClaimKeyTypeEnum::EMAIL]), + fn($rule) => $rule, + )], + 'account' => ['required'], + 'claimType' => ['required', Rule::enum(ClaimTypeEnum::class)], + ]; + } + +} \ No newline at end of file diff --git a/src/Types/PIX/Claim.php b/src/Types/PIX/Claim.php new file mode 100644 index 0000000..0e18c68 --- /dev/null +++ b/src/Types/PIX/Claim.php @@ -0,0 +1,24 @@ +claimType = ClaimTypeEnum::from($data['claimType']); + } + + +} \ No newline at end of file diff --git a/src/Types/PIX/ClaimAnswer.php b/src/Types/PIX/ClaimAnswer.php new file mode 100644 index 0000000..dffd5db --- /dev/null +++ b/src/Types/PIX/ClaimAnswer.php @@ -0,0 +1,19 @@ +reason = ClaimAnswerReasonEnum::from($data['reason']); + } + +} \ No newline at end of file diff --git a/tests/Integration/PIX/DICT/PixKeyCancelConfirmTest.php b/tests/Integration/PIX/DICT/PixKeyCancelConfirmTest.php new file mode 100644 index 0000000..828e196 --- /dev/null +++ b/tests/Integration/PIX/DICT/PixKeyCancelConfirmTest.php @@ -0,0 +1,110 @@ + GlobalStubs::loginResponse(), + CelcoinPIXDICT::CLAIM_CANCEL => self::stubSuccess(), + ], + ); + + $pixDict = new CelcoinPIXDICT(); + $result = $pixDict->claimCancel($this->fakeClaimCancelBody()); + + assertEquals('CANCELED', $result['status']); + } + + private static function stubSuccess(): PromiseInterface + { + return Http::response( + [ + "version" => "1.0.0", + "status" => "CANCELED", + "body" => [ + "id" => "8bbc0ba5-2aee-44a0-a3c9-b897802a9f66", + "claimType" => "OWNERSHIP", + "key" => "fulanodetal@gmail.com", + "keyType" => "EMAIL", + "claimerAccount" => [ + "participant" => "30306294", + "branch" => "0001", + "account" => "30053913742139", + "accountType" => "TRAN" + ], + "claimer" => [ + "personType" => "NATURAL_PERSON", + "taxId" => "34335125070", + "name" => "João da Silva Juniors" + ], + "donorParticipant" => "30306294", + "createTimestamp" => "2023-05-01T13:05:09", + "completionPeriodEnd" => "2023-05-01T13:05:09", + "resolutionPeriodEnd" => "2023-08-10T17", + "lastModified" => "2023-08-11T17:11:33", + "cancelledBy" => "CLAIMER", + "cancelReason" => "FRAUD" + ] + ], + Response::HTTP_OK, + ); + } + + private function fakeClaimCancelBody(): ClaimAnswer + { + return new ClaimAnswer([ + 'id' => $this->faker()->uuid, + 'reason' => 'USER_REQUESTED', + ]); + } + + public function testClaimCancelBadRequest() + { + Http::fake( + [ + config('celcoin.login_url') => GlobalStubs::loginResponse(), + CelcoinPIXDICT::CLAIM_CANCEL => self::stubBadRequest(), + ], + ); + + $this->expectException(RequestException::class); + + $pixDict = new CelcoinPIXDICT(); + $result = $pixDict->claimCancel($this->fakeClaimCancelBody()); + assertEquals('ERROR', $result['status']); + assertEquals('CBE307', $result['error']['errorCode']); + } + + private static function stubBadRequest(): PromiseInterface + { + return Http::response([ + "version" => "1.0.0", + "status" => "ERROR", + "error" => [ + "errorCode" => "CBE307", + "message" => "Não foi possível cancelar essa Claim, pois a mesma não está mais pendente." + ] + ], Response::HTTP_BAD_REQUEST); + } +} \ No newline at end of file diff --git a/tests/Integration/PIX/DICT/PixKeyClaimConfirmTest.php b/tests/Integration/PIX/DICT/PixKeyClaimConfirmTest.php new file mode 100644 index 0000000..e568b98 --- /dev/null +++ b/tests/Integration/PIX/DICT/PixKeyClaimConfirmTest.php @@ -0,0 +1,111 @@ + GlobalStubs::loginResponse(), + CelcoinPIXDICT::CLAIM_CONFIRM => self::stubSuccess(), + ], + ); + + $pixDict = new CelcoinPIXDICT(); + $result = $pixDict->claimConfirm($this->fakeClaimConfirmBody()); + + assertEquals('CONFIRMED', $result['status']); + } + + private static function stubSuccess(): PromiseInterface + { + return Http::response( + [ + "version" => "1.0.0", + "status" => "CONFIRMED", + "body" => [ + "id" => "8bbc0ba5-2aee-44a0-a3c9-b897802a9f66", + "claimType" => "OWNERSHIP", + "key" => "fulanodetal@gmail.com", + "keyType" => "EMAIL", + "claimerAccount" => [ + "participant" => "30306294", + "branch" => "0001", + "account" => "30053913742139", + "accountType" => "TRAN" + ], + "claimer" => [ + "personType" => "NATURAL_PERSON", + "taxId" => "34335125070", + "name" => "João da Silva Junior" + ], + "donorParticipant" => "30306294", + "createTimestamp" => "2023-05-01T13:05:09", + "completionPeriodEnd" => "2023-05-01T13:05:09", + "resolutionPeriodEnd" => "2023-08-10T17", + "lastModified" => "2023-08-11T17:11:33" + ] + ], + Response::HTTP_OK, + ); + } + + private function fakeClaimConfirmBody(): ClaimAnswer + { + return new ClaimAnswer([ + 'id' => $this->faker()->uuid, + 'reason' => 'USER_REQUESTED', + ]); + } + + public function testClaimBadRequest() + { + Http::fake( + [ + config('celcoin.login_url') => GlobalStubs::loginResponse(), + CelcoinPIXDICT::CLAIM_CONFIRM => self::stubBadRequest(), + ], + ); + + $this->expectException(RequestException::class); + + $pixDict = new CelcoinPIXDICT(); + $result = $pixDict->claimConfirm($this->fakeClaimConfirmBody()); + assertEquals('ERROR', $result['status']); + assertEquals('CBE307', $result['error']['errorCode']); + } + + private static function stubBadRequest(): PromiseInterface + { + return Http::response([ + "version" => "1.0.0", + "status" => "ERROR", + "error" => [ + "errorCode" => "CBE307", + "message" => "Não foi possível cancelar essa Claim, pois a mesma não está mais pendente." + ] + ], Response::HTTP_BAD_REQUEST); + } +} \ No newline at end of file diff --git a/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php b/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php new file mode 100644 index 0000000..c8297b8 --- /dev/null +++ b/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php @@ -0,0 +1,127 @@ +uuid = '8bbc0ba5-2aee-44a0-a3c9-b897802a9f66'; + } + + public function testClaimConsult() + { + Http::fake( + [ + config('celcoin.login_url') => GlobalStubs::loginResponse(), + CelcoinPIXDICT::CLAIM_DICT.'/*' => self::stubSuccess(), + ], + ); + + $pixDict = new CelcoinPIXDICT(); + $result = $pixDict->claimConsult($this->uuid); + + assertEquals('SUCCESS', $result['status']); + assertEquals($this->uuid, $result['body']['id']); + } + + private static function stubSuccess(): PromiseInterface + { + return Http::response( + [ + "version" => "1.0.0", + "status" => "SUCCESS", + "body" => [ + "id" => "8bbc0ba5-2aee-44a0-a3c9-b897802a9f66", + "claimType" => "OWNERSHIP", + "key" => "fulanodetal@gmail.com", + "keyType" => "EMAIL", + "claimerAccount" => [ + "participant" => "30306294", + "branch" => "0001", + "account" => "30053913742139", + "accountType" => "TRAN" + ], + "claimer" => [ + "personType" => "NATURAL_PERSON", + "taxId" => "34335125070", + "name" => "João da Silva Junior" + ], + "donorParticipant" => "30306294", + "createTimestamp" => "2023-05-01T13:05:09", + "completionPeriodEnd" => "2023-05-01T13:05:09", + "resolutionPeriodEnd" => "2023-05-01T13:05:09", + "lastModified" => "2023-05-01T13:05:09", + "confirmReason" => "USER_REQUESTED", + "cancelReason" => "FRAUD", + "cancelledBy" => "DONOR", + "donorAccount" => [ + "account" => "30053913742139", + "branch" => "0001", + "taxId" => "34335125070", + "name" => "João da Silva" + ] + ] + ], + Response::HTTP_OK, + ); + } + + private function fakeClaimBody(): Claim + { + return new Claim([ + 'key' => 'key@email.com', + 'keyType' => 'EMAIL', + 'account' => '3005913742139', + 'claimType' => 'PORTABILITY' + ]); + } + + public function testClaimBadRequest() + { + Http::fake( + [ + config('celcoin.login_url') => GlobalStubs::loginResponse(), + CelcoinPIXDICT::POST_VERIFY_DICT.'/*' => self::stubBadRequest(), + ], + ); + + $this->expectException(RequestException::class); + + $pixDict = new CelcoinPIXDICT(); + $result = $pixDict->claim($this->fakeClaimBody()); + assertEquals('ERROR', $result['status']); + assertEquals('CBE320', $result['error']['errorCode']); + } + + private static function stubBadRequest(): PromiseInterface + { + return Http::response([ + "version" => "1.0.0", + "status" => "ERROR", + "error" => [ + "errorCode" => "CBE320", + "message" => "Claim não encontrada." + ] + ], Response::HTTP_BAD_REQUEST); + } +} \ No newline at end of file diff --git a/tests/Integration/PIX/DICT/PixKeyClaimTest.php b/tests/Integration/PIX/DICT/PixKeyClaimTest.php new file mode 100644 index 0000000..d636255 --- /dev/null +++ b/tests/Integration/PIX/DICT/PixKeyClaimTest.php @@ -0,0 +1,119 @@ + GlobalStubs::loginResponse(), + CelcoinPIXDICT::CLAIM_DICT => self::stubSuccess(), + ], + ); + + $pixDict = new CelcoinPIXDICT(); + $result = $pixDict->claim($this->fakeClaimBody()); + + assertEquals('OPEN', $result['status']); + } + + private static function stubSuccess(): PromiseInterface + { + return Http::response( + [ + "version" => "1.0.0", + "status" => "OPEN", + "body" => [ + "id" => "8bbc0ba5-2aee-44a0-a3c9-b897802a9f66", + "claimType" => "OWNERSHIP", + "key" => "fulanodetal@gmail.com", + "keyType" => "EMAIL", + "claimerAccount" => [ + "participant" => "30306294", + "branch" => "0001", + "account" => "30053913742139", + "accountType" => "TRAN" + ], + "claimer" => [ + "personType" => "NATURAL_PERSON", + "taxId" => "34335125070", + "name" => "João da Silva Junior" + ], + "donorParticipant" => "30306294", + "createTimestamp" => "2023-05-01T13:05:09", + "completionPeriodEnd" => "2023-05-01T13:05:09", + "resolutionPeriodEnd" => "2023-05-01T13:05:09", + "lastModified" => "2023-05-01T13:05:09", + "confirmReason" => "USER_REQUESTED", + "cancelReason" => "FRAUD", + "cancelledBy" => "DONOR", + "donorAccount" => [ + "account" => "30053913742139", + "branch" => "0001", + "taxId" => "34335125070", + "name" => "João da Silva" + ] + ] + ], + Response::HTTP_OK, + ); + } + + private function fakeClaimBody(): Claim + { + return new Claim([ + 'key' => 'key@email.com', + 'keyType' => 'EMAIL', + 'account' => '3005913742139', + 'claimType' => 'PORTABILITY' + ]); + } + + public function testClaimBadRequest() + { + Http::fake( + [ + config('celcoin.login_url') => GlobalStubs::loginResponse(), + CelcoinPIXDICT::POST_VERIFY_DICT => self::stubBadRequest(), + ], + ); + + $this->expectException(RequestException::class); + + $pixDict = new CelcoinPIXDICT(); + $result = $pixDict->claim($this->fakeClaimBody()); + assertEquals('ERROR', $result['status']); + assertEquals('CBE039', $result['error']['errorCode']); + } + + private static function stubBadRequest(): PromiseInterface + { + return Http::response([ + "version" => "1.0.0", + "status" => "ERROR", + "error" => [ + "errorCode" => "CBE039", + "message" => "Account invalido.." + ] + ], Response::HTTP_BAD_REQUEST); + } +} \ No newline at end of file From 5e4311c8adf85bbc42af6f17c1f520fea2bd04a6 Mon Sep 17 00:00:00 2001 From: Michael de Oliveira Ferreira Date: Thu, 11 Apr 2024 01:23:30 -0300 Subject: [PATCH 2/8] feature: pix claim, bump orchestra testbench to 8.x(laravel 10.x) --- .../Integration/PIX/DICT/PixKeyClaimConsultTest.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php b/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php index c8297b8..e108547 100644 --- a/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php +++ b/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php @@ -86,16 +86,6 @@ private static function stubSuccess(): PromiseInterface ); } - private function fakeClaimBody(): Claim - { - return new Claim([ - 'key' => 'key@email.com', - 'keyType' => 'EMAIL', - 'account' => '3005913742139', - 'claimType' => 'PORTABILITY' - ]); - } - public function testClaimBadRequest() { Http::fake( @@ -108,7 +98,7 @@ public function testClaimBadRequest() $this->expectException(RequestException::class); $pixDict = new CelcoinPIXDICT(); - $result = $pixDict->claim($this->fakeClaimBody()); + $result = $pixDict->claimConsult($this->uuid); assertEquals('ERROR', $result['status']); assertEquals('CBE320', $result['error']['errorCode']); } From 72478b884969ebb8e6ad90f5fec102f1b5c76dca Mon Sep 17 00:00:00 2001 From: Michael de Oliveira Ferreira Date: Thu, 11 Apr 2024 21:18:42 -0300 Subject: [PATCH 3/8] feature: pix claim, bump orchestra testbench to 8.x(laravel 10.x), install laravel pint --- composer.json | 3 +- config/laradumps.php | 32 +- src/Auth/Auth.php | 59 +-- src/Celcoin.php | 86 +---- src/CelcoinServiceProvider.php | 4 +- src/Clients/CelcoinAssistant.php | 31 +- src/Clients/CelcoinBAAS.php | 57 ++- src/Clients/CelcoinBAASBillPayment.php | 6 +- src/Clients/CelcoinBAASBillet.php | 7 +- src/Clients/CelcoinBAASPIX.php | 29 +- src/Clients/CelcoinBAASTED.php | 17 +- src/Clients/CelcoinBAASWebhooks.php | 16 +- src/Clients/CelcoinBankTransfer.php | 9 +- src/Clients/CelcoinBillPayment.php | 28 +- src/Clients/CelcoinDDAInvoice.php | 4 +- src/Clients/CelcoinDDAUser.php | 7 +- src/Clients/CelcoinDDAWebhooks.php | 6 +- src/Clients/CelcoinElectronicTransactions.php | 20 +- src/Clients/CelcoinInternationalTopups.php | 21 +- src/Clients/CelcoinKyc.php | 2 +- src/Clients/CelcoinPIXCOB.php | 32 +- src/Clients/CelcoinPIXCOBV.php | 24 +- src/Clients/CelcoinPIXDICT.php | 118 +++--- src/Clients/CelcoinPIXDynamic.php | 31 +- src/Clients/CelcoinPIXParticipants.php | 3 +- src/Clients/CelcoinPIXPayment.php | 18 +- src/Clients/CelcoinPIXQR.php | 15 +- src/Clients/CelcoinPIXReceivement.php | 6 +- src/Clients/CelcoinPIXReverse.php | 7 +- src/Clients/CelcoinPixStaticPayment.php | 20 +- src/Clients/CelcoinPixWebhooks.php | 28 +- src/Clients/CelcoinReport.php | 9 +- src/Clients/CelcoinTopups.php | 23 +- src/Common/CelcoinBaseApi.php | 20 +- src/Enums/AccountOnboardingTypeEnum.php | 4 +- src/Enums/AccountTypeEnum.php | 2 +- src/Enums/ClaimAnswerReasonEnum.php | 11 +- src/Enums/ClaimKeyTypeEnum.php | 11 +- src/Enums/ClaimTypeEnum.php | 7 +- src/Enums/HealthCheckPeriodEnum.php | 8 +- src/Enums/HealthCheckTypeEnum.php | 6 +- src/Enums/InstitutionsTypeEnum.php | 4 +- src/Enums/TopupProvidersTypeEnum.php | 6 +- src/Events/CelcoinAuthenticatedEvent.php | 6 - src/Facades/CelcoinFacade.php | 3 - src/Interfaces/Attachable.php | 2 +- src/Rules/BAAS/AccountBusiness.php | 72 ++-- src/Rules/BAAS/AccountManagerBusiness.php | 62 ++-- .../BAAS/AccountManagerNaturalPerson.php | 28 +- src/Rules/BAAS/AccountNaturalPerson.php | 40 +- src/Rules/BAAS/AccountRelease.php | 8 +- src/Rules/BAAS/BAASGetTEFTransfer.php | 2 +- src/Rules/BAAS/BAASTEFTransfer.php | 6 +- src/Rules/BAAS/BillPaymentRule.php | 10 +- src/Rules/BAAS/Billet.php | 10 +- src/Rules/BAAS/EditWebhooks.php | 14 +- src/Rules/BAAS/GetPaymentStatusRule.php | 2 +- src/Rules/BAAS/PixCashOut.php | 7 +- src/Rules/BAAS/RegisterPixKey.php | 6 +- src/Rules/BAAS/RegisterWebhooks.php | 12 +- src/Rules/BAAS/TEDTransfer.php | 2 +- src/Rules/BankTransfer/Create.php | 22 +- src/Rules/BillPayments/Authorize.php | 12 +- src/Rules/BillPayments/Cancel.php | 4 +- src/Rules/BillPayments/Confirm.php | 4 +- src/Rules/BillPayments/Create.php | 37 +- src/Rules/DDA/RegisterInvoice.php | 2 +- src/Rules/DDA/RegisterUser.php | 6 +- src/Rules/DDA/RegisterWebhooks.php | 30 +- src/Rules/DDA/RemoveUser.php | 4 +- src/Rules/KYC/CreateKycRule.php | 4 +- src/Rules/PIX/COBVCreate.php | 2 +- src/Rules/PIX/COBVPayload.php | 2 +- src/Rules/PIX/ClaimAnswer.php | 17 +- src/Rules/PIX/ClaimCreate.php | 29 +- src/Rules/PIX/DICTSearch.php | 2 +- src/Rules/PIX/DICTVerify.php | 2 +- src/Rules/PIX/PaymentEmvRules.php | 2 +- src/Rules/PIX/PaymentEndToEndRules.php | 2 +- src/Rules/PIX/PaymentInitRules.php | 8 +- src/Rules/PIX/PixReverseGetStatus.php | 1 - src/Rules/PIX/QRStaticPaymentCreate.php | 2 - src/Rules/PIX/WebhookGetList.php | 1 - src/Rules/Topups/Create.php | 2 +- src/Rules/Topups/Providers.php | 6 +- src/Rules/Topups/ProvidersValues.php | 4 +- src/Types/BAAS/Account.php | 2 +- src/Types/BAAS/AccountBusiness.php | 10 +- src/Types/BAAS/AccountManagerBusiness.php | 5 +- .../BAAS/AccountManagerNaturalPerson.php | 5 +- src/Types/BAAS/AccountNaturalPerson.php | 12 +- src/Types/BAAS/AccountRelease.php | 3 + src/Types/BAAS/Address.php | 9 +- src/Types/BAAS/Auth.php | 2 + src/Types/BAAS/BillPayment.php | 4 +- src/Types/BAAS/Billet.php | 19 +- src/Types/BAAS/BilletDebtor.php | 10 +- src/Types/BAAS/BilletDiscount.php | 3 +- src/Types/BAAS/BilletInstruction.php | 3 +- src/Types/BAAS/BilletReceiver.php | 3 +- src/Types/BAAS/BilletSplit.php | 5 +- src/Types/BAAS/CreditParty.php | 7 +- src/Types/BAAS/DebitParty.php | 1 - src/Types/BAAS/EditWebhooks.php | 3 + src/Types/BAAS/GetPaymentStatusRequest.php | 5 +- src/Types/BAAS/Owner.php | 9 +- src/Types/BAAS/PixCashOut.php | 10 + src/Types/BAAS/RefundPix.php | 5 + src/Types/BAAS/RegisterPixKey.php | 2 + src/Types/BAAS/RegisterWebhooks.php | 2 + src/Types/BAAS/TEDCreditParty.php | 7 +- src/Types/BAAS/TEDTransfer.php | 5 + src/Types/BAAS/TEFTransfer.php | 2 +- src/Types/BAAS/Tag.php | 2 +- src/Types/BankTransfer/Create.php | 12 +- src/Types/BillPayments/Authorize.php | 3 + src/Types/BillPayments/BarCode.php | 2 + src/Types/BillPayments/BillData.php | 3 + src/Types/BillPayments/Cancel.php | 1 + src/Types/BillPayments/Confirm.php | 1 + src/Types/BillPayments/Create.php | 11 +- src/Types/BillPayments/InfoBearer.php | 2 + src/Types/DDA/BasicAuthentication.php | 1 + src/Types/DDA/OAuthTwo.php | 8 + src/Types/DDA/RegisterUser.php | 2 + src/Types/DDA/RegisterWebhooks.php | 3 + src/Types/DDA/RemoveUser.php | 1 + src/Types/Data.php | 15 +- src/Types/ElectronicTransactions/Deposit.php | 9 +- .../SecondAuthenticationData.php | 2 + .../ElectronicTransactions/ServicesPoints.php | 5 + src/Types/ElectronicTransactions/Withdraw.php | 8 + .../ElectronicTransactions/WithdrawToken.php | 4 + src/Types/InternationalTopups/Cancel.php | 1 + src/Types/InternationalTopups/Confirm.php | 1 + src/Types/InternationalTopups/Create.php | 5 + src/Types/InternationalTopups/Phone.php | 2 + src/Types/KYC/CreateKyc.php | 1 - src/Types/KYC/KycDocument.php | 4 +- src/Types/PIX/AdditionalInformation.php | 1 + src/Types/PIX/Amount.php | 4 +- src/Types/PIX/AmountAbatement.php | 5 +- src/Types/PIX/AmountDicount.php | 6 +- src/Types/PIX/AmountFine.php | 2 + src/Types/PIX/AmountInterest.php | 2 + src/Types/PIX/COB.php | 7 + src/Types/PIX/COBGet.php | 2 + src/Types/PIX/COBV.php | 9 +- src/Types/PIX/Calendar.php | 3 +- src/Types/PIX/Claim.php | 22 +- src/Types/PIX/ClaimAnswer.php | 16 +- src/Types/PIX/CreditPartyObject.php | 3 - src/Types/PIX/DICT.php | 5 +- src/Types/PIX/DebitPartyObject.php | 9 +- src/Types/PIX/Debtor.php | 10 +- src/Types/PIX/DiscountDateFixed.php | 4 +- src/Types/PIX/DynamicQRCreate.php | 8 + src/Types/PIX/DynamicQRUpdate.php | 7 + src/Types/PIX/Merchant.php | 6 +- src/Types/PIX/PaymentEmv.php | 3 - src/Types/PIX/PaymentEndToEnd.php | 4 - src/Types/PIX/PaymentInit.php | 18 +- src/Types/PIX/PaymentStatus.php | 5 +- ...xReactivateAndResendAllPendingMessages.php | 1 + src/Types/PIX/PixReceivementStatus.php | 2 + src/Types/PIX/PixReverseCreate.php | 6 +- src/Types/PIX/PixReverseGetStatus.php | 2 + src/Types/PIX/PixWebhookGetList.php | 4 + src/Types/PIX/QRLocation.php | 5 +- src/Types/PIX/QRStaticPayment.php | 9 +- src/Types/PIX/Receiver.php | 10 +- src/Types/Topups/Cancel.php | 1 + src/Types/Topups/Confirm.php | 1 + src/Types/Topups/Create.php | 6 + src/Types/Topups/Phone.php | 2 + src/Types/Topups/Providers.php | 2 + src/Types/Topups/ProvidersValues.php | 1 + tests/Feature/CelcoinAuthEventFiredTest.php | 1 - tests/Feature/CelcoinClientInstancesTest.php | 1 - tests/Feature/CelcoinFacadeTest.php | 1 - tests/Feature/ClassDataGetSetIssetTest.php | 191 +++++----- tests/Feature/EnumFromStringTest.php | 1 - tests/GlobalStubs.php | 5 +- tests/Integration/Assistant/BanksTest.php | 16 +- .../Assistant/FindInstitutionsTest.php | 24 +- .../Integration/Assistant/GetBalanceTest.php | 18 +- .../Integration/Assistant/GetReceiptTest.php | 36 +- .../Integration/Assistant/HealthCheckTest.php | 28 +- .../Integration/Assistant/PendenciesTest.php | 24 +- .../Assistant/StatusConsultTest.php | 26 +- tests/Integration/BAAS/ActiveAccountTest.php | 9 +- tests/Integration/BAAS/BillPaymentTest.php | 57 ++- .../BAAS/CelcoinBASSBilletTest.php | 181 ++++----- tests/Integration/BAAS/CheckAccountTest.php | 27 +- .../BAAS/CreateAccountBusinessTest.php | 85 +++-- .../BAAS/CreateAccountNaturalPersonTest.php | 51 ++- tests/Integration/BAAS/CreateReleaseTest.php | 21 +- tests/Integration/BAAS/DeleteAccountTest.php | 7 +- tests/Integration/BAAS/DisableAccountTest.php | 7 +- .../BAAS/GetInfoAccountBusinessTest.php | 55 ++- .../BAAS/GetInfoAccountNaturalPersonTest.php | 55 ++- .../BAAS/GetListInfoAccountBusinessTest.php | 107 +++--- .../GetListInfoAccountNaturalPersonTest.php | 107 +++--- .../Integration/BAAS/GetWalletBalanceTest.php | 11 +- .../BAAS/GetWalletMovementTest.php | 43 ++- tests/Integration/BAAS/IncomeReportTest.php | 48 +-- .../BAAS/PIXKey/BAASPIXDeletePixKeyTest.php | 7 +- .../BAAS/PIXKey/BAASPIXRegisterPixKeyTest.php | 33 +- .../BAAS/PIXKey/BAASPIXSearchPixKeyTest.php | 35 +- .../BAAS/PIXRefund/BAASPIXRefundTest.php | 37 +- .../PIXRefund/BAASPIXStatusRefundTest.php | 25 +- .../BAAS/PixCashOut/BAASPIXCashOutTest.php | 93 +++-- .../BAASPIXGetExternalPixKeyTest.php | 35 +- .../PixCashOut/BAASPIXGetParticipantTest.php | 13 +- .../BAAS/PixCashOut/BAASPIXStatusTest.php | 55 ++- .../BAAS/TED/BAASInternalTransferTest.php | 60 +-- .../BAAS/TED/BAASTEDGetStatusTransferTest.php | 58 ++- .../BAAS/TED/BAASTEDTransferTest.php | 75 ++-- .../BAAS/UpdateAccountBusinessTest.php | 71 ++-- .../BAAS/UpdateAccountNaturalPersonTest.php | 37 +- .../BAAS/Webhook/EditWebhooksTest.php | 21 +- .../BAAS/Webhook/GetWebhooksTest.php | 25 +- .../BAAS/Webhook/RegisterWebhooksTest.php | 23 +- .../BAAS/Webhook/RemoveWebhooksTest.php | 7 +- tests/Integration/BankTransfer/CreateTest.php | 77 ++-- .../BankTransfer/GetStatusTransferTest.php | 25 +- .../Integration/BillPayments/AutorizeTest.php | 81 ++-- tests/Integration/BillPayments/CancelTest.php | 13 +- .../Integration/BillPayments/ConfirmTest.php | 13 +- tests/Integration/BillPayments/CreateTest.php | 65 ++-- .../BillPayments/OcurrencyTest.php | 21 +- .../Integration/BillPayments/ReverseTest.php | 9 +- .../Integration/DDA/Invoice/RegisterTest.php | 21 +- tests/Integration/DDA/User/RegisterTest.php | 23 +- tests/Integration/DDA/User/RemoveTest.php | 21 +- tests/Integration/DDA/Webhook/ListTest.php | 19 +- .../Integration/DDA/Webhook/RegisterTest.php | 29 +- .../ElectronicTransactions/DepositTest.php | 41 +- .../GenerateWithdrawTokenTest.php | 29 +- .../GetServicesPointsTest.php | 349 +++++++++--------- .../ElectronicTransactions/PartnersTest.php | 37 +- .../ElectronicTransactions/WithdrawTest.php | 53 ++- tests/Integration/KYC/CelcoinSendKycTest.php | 17 +- tests/Integration/PIX/COB/COBCreateTest.php | 34 +- tests/Integration/PIX/COB/COBDeteleTest.php | 9 +- tests/Integration/PIX/COB/COBFetchTest.php | 6 +- tests/Integration/PIX/COB/COBGetTest.php | 4 +- tests/Integration/PIX/COB/COBPayloadTest.php | 6 +- tests/Integration/PIX/COB/COBUnlinkTest.php | 7 - tests/Integration/PIX/COB/COBUpdateTest.php | 9 +- tests/Integration/PIX/COBV/COBVCreateTest.php | 102 ++--- tests/Integration/PIX/COBV/COBVDeleteTest.php | 1 - tests/Integration/PIX/COBV/COBVGetTest.php | 8 +- .../Integration/PIX/COBV/COBVPayloadTest.php | 6 +- tests/Integration/PIX/COBV/COBVUnlinkTest.php | 5 +- tests/Integration/PIX/COBV/COBVUpdateTest.php | 9 +- .../PIX/DICT/PixDICTSearchTest.php | 173 +++++---- .../PIX/DICT/PixDICTVerifyTest.php | 31 +- .../PIX/DICT/PixKeyCancelConfirmTest.php | 81 ++-- .../PIX/DICT/PixKeyClaimConfirmTest.php | 77 ++-- .../PIX/DICT/PixKeyClaimConsultTest.php | 109 +++--- .../Integration/PIX/DICT/PixKeyClaimTest.php | 97 +++-- .../PIX/DYNAMIC/PixDynamicCreateTest.php | 19 +- .../PIX/DYNAMIC/PixDynamicDeleteTest.php | 3 - .../PIX/DYNAMIC/PixDynamicImageTest.php | 11 +- .../PIX/DYNAMIC/PixDynamicPayloadTest.php | 1 - .../PIX/DYNAMIC/PixDynamicUpdateTest.php | 21 +- .../Participants/PixParticipantsListTest.php | 21 +- .../PIX/Payments/PixPaymentStatusTest.php | 7 +- .../PIX/QRLocation/PixCreateLocationTest.php | 31 +- .../PIX/QRLocation/PixGetLocationTest.php | 28 +- .../PIX/QRLocation/PixGetQRTest.php | 29 +- .../PixGetStaticPaymentDataTest.php | 35 +- .../Receivement/PixReceivementStatusTest.php | 3 +- .../PIX/Reverse/PixReverseCreateTest.php | 2 - .../PIX/Reverse/PixReverseGetStatusTest.php | 13 +- .../PixCreateStaticPaymentTest.php | 17 +- .../PixGetStaticPaymentQRTest.php | 29 +- .../PixGetStaticPaymentTransactionTest.php | 41 +- .../Webhooks/GenericWebhookErrorsTrait.php | 21 +- ...ctivateAndResendAllPendingMessagesTest.php | 14 +- ...ntAndResendSpecifiedMessagesInListTest.php | 10 +- .../PIX/Webhooks/PixWebhookLisGetListTest.php | 13 +- .../Report/ConciliationFileTest.php | 61 ++- .../Report/ConciliationFileTypesTest.php | 63 ++-- .../Report/ConsolidatedStatementTest.php | 169 +++++---- tests/Integration/Topups/CancelTest.php | 13 +- tests/Integration/Topups/ConfirmTest.php | 13 +- tests/Integration/Topups/CreateTest.php | 57 ++- .../Integration/Topups/FindProvidersTest.php | 13 +- .../Topups/GetProviderValueTest.php | 77 ++-- tests/Integration/Topups/GetProvidersTest.php | 39 +- .../TopupsInternational/CancelTest.php | 13 +- .../TopupsInternational/ConfirmTest.php | 13 +- .../TopupsInternational/CreateTest.php | 45 ++- .../TopupsInternational/GetCountriesTest.php | 17 +- .../TopupsInternational/GetValuesTest.php | 39 +- tests/TestCase.php | 5 +- 298 files changed, 3228 insertions(+), 3279 deletions(-) diff --git a/composer.json b/composer.json index 118d6b9..01b0ef5 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "require-dev": { "orchestra/testbench": "^7.24.|^8.0", "phpunit/phpunit": "^9.0|^10.0|^11.0", - "phpstan/phpstan": "^1.10" + "phpstan/phpstan": "^1.10", + "laravel/pint": "^1.15" }, "extra": { "laravel": { diff --git a/config/laradumps.php b/config/laradumps.php index 5f0bd9a..c26ee35 100644 --- a/config/laradumps.php +++ b/config/laradumps.php @@ -208,7 +208,7 @@ 'send_livewire_failed_validation' => [ 'enabled' => env('DS_SEND_LIVEWIRE_FAILED_VALIDATION', false), - 'sleep' => env('DS_SEND_LIVEWIRE_FAILED_VALIDATION_SLEEP', 400), + 'sleep' => env('DS_SEND_LIVEWIRE_FAILED_VALIDATION_SLEEP', 400), ], /* @@ -271,27 +271,27 @@ 'ide_handlers' => [ 'atom' => [ - 'handler' => 'atom://core/open/file?filename=', + 'handler' => 'atom://core/open/file?filename=', 'line_separator' => '&line=', ], 'phpstorm' => [ - 'handler' => 'phpstorm://open?file=', + 'handler' => 'phpstorm://open?file=', 'line_separator' => '&line=', ], 'sublime' => [ - 'handler' => 'subl://open?url=file://', + 'handler' => 'subl://open?url=file://', 'line_separator' => '&line=', ], 'vscode' => [ - 'handler' => 'vscode://file/', + 'handler' => 'vscode://file/', 'line_separator' => ':', ], 'vscode_remote' => [ - 'handler' => 'vscode://vscode-remote/', + 'handler' => 'vscode://vscode-remote/', 'line_separator' => ':', - 'local_path' => 'wsl+' . env('DS_PREFERRED_WSL_DISTRO', 'Ubuntu20.04LTS'), - 'remote_path' => env('DS_REMOTE_PATH', null), - 'work_dir' => env('DS_WORKDIR', '/var/www/html'), + 'local_path' => 'wsl+'.env('DS_PREFERRED_WSL_DISTRO', 'Ubuntu20.04LTS'), + 'remote_path' => env('DS_REMOTE_PATH', null), + 'work_dir' => env('DS_WORKDIR', '/var/www/html'), ], ], @@ -404,13 +404,13 @@ */ 'level_log_colors_map' => [ - 'error' => env('DS_LOG_COLOR_ERROR', 'border-red-600'), - 'critical' => env('DS_LOG_COLOR_CRITICAL', 'border-red-900'), - 'alert' => env('DS_LOG_COLOR_ALERT', 'border-red-500'), + 'error' => env('DS_LOG_COLOR_ERROR', 'border-red-600'), + 'critical' => env('DS_LOG_COLOR_CRITICAL', 'border-red-900'), + 'alert' => env('DS_LOG_COLOR_ALERT', 'border-red-500'), 'emergency' => env('DS_LOG_COLOR_EMERGENCY', 'border-red-600'), - 'warning' => env('DS_LOG_COLOR_WARNING', 'border-orange-300'), - 'notice' => env('DS_LOG_COLOR_NOTICE', 'border-green-300'), - 'info' => env('DS_LOG_COLOR_INFO', 'border-blue-300'), - 'debug' => env('DS_LOG_COLOR_INFO', 'border-black'), + 'warning' => env('DS_LOG_COLOR_WARNING', 'border-orange-300'), + 'notice' => env('DS_LOG_COLOR_NOTICE', 'border-green-300'), + 'info' => env('DS_LOG_COLOR_INFO', 'border-blue-300'), + 'debug' => env('DS_LOG_COLOR_INFO', 'border-black'), ], ]; diff --git a/src/Auth/Auth.php b/src/Auth/Auth.php index 4a04c0d..728cc3c 100644 --- a/src/Auth/Auth.php +++ b/src/Auth/Auth.php @@ -8,8 +8,6 @@ /** * Class Auth - * - * @package WeDevBr\Celcoin */ class Auth { @@ -33,17 +31,18 @@ class Auth /** @var ?string */ protected ?string $tokenExpiry = null; + /** * @var ?string */ protected ?string $mtlsPassphrase = null; + protected ?string $mtlsCert = null; + protected ?string $mtlsKey = null; /** * Returns the instance of this class - * - * @return self */ public static function login(): self { @@ -56,104 +55,95 @@ public static function login(): self return self::$login; } - /** - * @return self - */ public function setClientCredentials(): self { $this->clientId = $this->clientId ?? config('celcoin')['client_id']; $this->clientSecret = $this->clientSecret ?? config('celcoin')['client_secret']; $this->mtlsPassphrase = $this->mtlsPassphrase ?? config('celcoin.mtls_passphrase'); + return $this; } /** - * @param null|string $clientId + * @param null|string $clientId * @return self */ public function setClientId($clientId) { $this->clientId = $clientId; + return $this; } /** - * @param null|string $clientSecret + * @param null|string $clientSecret * @return self */ public function setClientSecret($clientSecret) { $this->clientSecret = $clientSecret; + return $this; } /** - * @param string $grantType * @return self */ public function setGrantType(string $grantType) { $this->grantType = $grantType; + return $this; } /** - * @param string $passPhrase * @return $this */ public function setPassphrase(string $passPhrase): self { $this->mtlsPassphrase = $passPhrase; + return $this; } - /** - * @param string $token - * @return self - */ public function setToken(string $token): self { $this->token = $token; + return $this; } /** * Reset token for new request - * - * @return self */ public function resetToken(): self { $this->token = null; + return $this; } /** * @return ?string + * * @throws RequestException */ public function getToken(): ?string { - if (now()->unix() > $this->tokenExpiry || !$this->token) { + if (now()->unix() > $this->tokenExpiry || ! $this->token) { $this->auth(); } return $this->token; } - /** - * @param string $tokenExpiry - * @return self - */ public function setTokenExpiry(string $tokenExpiry): self { $this->tokenExpiry = $tokenExpiry; + return $this; } - /** - * @return mixed - */ public function getTokenExpiry(): mixed { return $this->tokenExpiry; @@ -162,48 +152,36 @@ public function getTokenExpiry(): mixed public function setCertPath(string $path): self { $this->mtlsCert = $path; + return $this; } /** * Set the cert.pem file path - * @param string $path - * @return self */ public function setKeyPath(string $path): self { $this->mtlsKey = $path; + return $this; } - - /** - * @return string|null - */ public function getMtlsKeyPath(): ?string { return $this->mtlsKey; } - /** - * @return string|null - */ public function getMtlsPassphrase(): ?string { return $this->mtlsPassphrase; } - - /** - * @return string|null - */ public function getMtlsCertPath(): ?string { return $this->mtlsCert; } /** - * @return void * @throws RequestException */ private function auth(): void @@ -213,7 +191,7 @@ private function auth(): void $body = [ 'grant_type' => $this->grantType, 'client_secret' => $this->clientSecret, - 'client_id' => $this->clientId + 'client_id' => $this->clientId, ]; $request = Http::asForm(); @@ -244,5 +222,4 @@ private function auth(): void event(new CelcoinAuthenticatedEvent($this->token, $this->tokenExpiry)); } - } diff --git a/src/Celcoin.php b/src/Celcoin.php index f26f362..7f3e7d4 100644 --- a/src/Celcoin.php +++ b/src/Celcoin.php @@ -4,8 +4,8 @@ use WeDevBr\Celcoin\Clients\CelcoinAssistant; use WeDevBr\Celcoin\Clients\CelcoinBAAS; -use WeDevBr\Celcoin\Clients\CelcoinBAASBillPayment; use WeDevBr\Celcoin\Clients\CelcoinBAASBillet; +use WeDevBr\Celcoin\Clients\CelcoinBAASBillPayment; use WeDevBr\Celcoin\Clients\CelcoinBAASPIX; use WeDevBr\Celcoin\Clients\CelcoinBAASTED; use WeDevBr\Celcoin\Clients\CelcoinBAASWebhooks; @@ -32,223 +32,139 @@ /** * Class Celcoin - * - * @package WeDevBr\Celcoin */ class Celcoin { - - /** - * @return CelcoinAssistant - */ public static function clientAssistant(): CelcoinAssistant { return new CelcoinAssistant(); } - /** - * @return CelcoinBankTransfer - */ public static function clientBankTransfer(): CelcoinBankTransfer { return new CelcoinBankTransfer(); } - /** - * @return CelcoinBillPayment - */ public static function clientBillPayment(): CelcoinBillPayment { return new CelcoinBillPayment(); } - /** - * @return CelcoinDDAInvoice - */ public static function clientDDAInvoice(): CelcoinDDAInvoice { return new CelcoinDDAInvoice(); } - /** - * @return CelcoinDDAUser - */ public static function clientDDAUser(): CelcoinDDAUser { return new CelcoinDDAUser(); } - /** - * @return CelcoinDDAWebhooks - */ public static function clientDDAWebhooks(): CelcoinDDAWebhooks { return new CelcoinDDAWebhooks(); } - /** - * @return CelcoinReport - */ public static function clientCelcoinReport(): CelcoinReport { return new CelcoinReport(); } - /** - * @return CelcoinElectronicTransactions - */ public static function clientElectronicTransactions(): CelcoinElectronicTransactions { return new CelcoinElectronicTransactions(); } - /** - * @return CelcoinTopups - */ public static function clientTopups(): CelcoinTopups { return new CelcoinTopups(); } - /** - * @return CelcoinPIXQR - */ public static function clientPIXQR(): CelcoinPIXQR { return new CelcoinPIXQR(); } - /** - * @return CelcoinPIXParticipants - */ public static function clientPIXParticipants(): CelcoinPIXParticipants { return new CelcoinPIXParticipants(); } - /** - * @return CelcoinPIXDICT - */ public static function clientPIXDICT(): CelcoinPIXDICT { return new CelcoinPIXDICT(); } - /** - * @return CelcoinPixStaticPayment - */ public static function clientPixStaticPayment(): CelcoinPixStaticPayment { return new CelcoinPixStaticPayment(); } - /** - * @return CelcoinPIXCOBV - */ public static function clientPixCOBV(): CelcoinPIXCOBV { return new CelcoinPIXCOBV(); } - /** - * @return CelcoinPIXCOB - */ public static function clientPixCOB(): CelcoinPIXCOB { return new CelcoinPIXCOB(); } - /** - * @return CelcoinBAAS - */ public static function clientBAAS(): CelcoinBAAS { return new CelcoinBAAS(); } - /** - * @return CelcoinBAASPIX - */ public static function clientBAASPIX(): CelcoinBAASPIX { return new CelcoinBAASPIX(); } - /** - * @return CelcoinBAASTED - */ public static function clientBAASTED(): CelcoinBAASTED { return new CelcoinBAASTED(); } - /** - * @return CelcoinBAASWebhooks - */ public static function clientBAASWebhooks(): CelcoinBAASWebhooks { return new CelcoinBAASWebhooks(); } - /** - * @return CelcoinPIXDynamic - */ public static function clientPIXDynamic(): CelcoinPIXDynamic { return new CelcoinPIXDynamic(); } - /** - * @return CelcoinPIXPayment - */ public static function clientPIXPayment(): CelcoinPIXPayment { return new CelcoinPIXPayment(); } - /** - * @return CelcoinPIXReceivement - */ public static function clientPIXReceivement(): CelcoinPIXReceivement { return new CelcoinPIXReceivement(); } - /** - * @return CelcoinPIXReverse - */ public static function clientPIXReverse(): CelcoinPIXReverse { return new CelcoinPIXReverse(); } - /** - * @return CelcoinPixWebhooks - */ public static function clientPixWebhooks(): CelcoinPixWebhooks { return new CelcoinPixWebhooks(); } - /** - * @return CelcoinKyc - */ public static function clientKyc(): CelcoinKyc { return new CelcoinKyc(); } - /** - * @return CelcoinBAASBillPayment - */ public static function clientBAASBillPayment(): CelcoinBAASBillPayment { return new CelcoinBAASBillPayment(); } - /** - * @return CelcoinBAASBillet - */ public static function clientBAASBillet(): CelcoinBAASBillet { return new CelcoinBAASBillet(); diff --git a/src/CelcoinServiceProvider.php b/src/CelcoinServiceProvider.php index 80a9338..e610329 100644 --- a/src/CelcoinServiceProvider.php +++ b/src/CelcoinServiceProvider.php @@ -13,7 +13,7 @@ public function boot() { if ($this->app->runningInConsole()) { $this->publishes([ - __DIR__ . '/../config/config.php' => config_path('celcoin.php'), + __DIR__.'/../config/config.php' => config_path('celcoin.php'), ], 'config'); } } @@ -24,7 +24,7 @@ public function boot() public function register() { // Automatically apply the package configuration - $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'celcoin'); + $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'celcoin'); // Register the card management class to use with the facade $this->app->singleton('celcoin', function () { diff --git a/src/Clients/CelcoinAssistant.php b/src/Clients/CelcoinAssistant.php index 262f978..23899b1 100644 --- a/src/Clients/CelcoinAssistant.php +++ b/src/Clients/CelcoinAssistant.php @@ -11,17 +11,22 @@ /** * Class CelcoinAssistant * A API de Recargas Nacionais disponibiliza aos seus usuários a possibilidade de realizar recargas de telefonia e conteúdos digitais listados abaixo: - * @package WeDevBr\Celcoin */ class CelcoinAssistant extends CelcoinBaseApi { - const GET_BALANCE_ENDPOINT = '/v5/merchant/balance'; - const STATUS_CONSULT_ENDPOINT = '/v5/transactions/status-consult'; - const GET_RECEIPT_ENDPOINT = '/v5/transactions/receipt/%s'; - const FIND_INSTITUTIONS_ENDPOINT = '/v5/transactions/institutions'; - const HEALTH_CHECK_ENDPOINT = '/v5/transactions/healthcheck'; - const GET_BANKS_ENDPOINT = '/v5/transactions/banks'; - const GET_PENDENCIES_LIST_ENDPOINT = '/v5/transactions/pendency'; + public const GET_BALANCE_ENDPOINT = '/v5/merchant/balance'; + + public const STATUS_CONSULT_ENDPOINT = '/v5/transactions/status-consult'; + + public const GET_RECEIPT_ENDPOINT = '/v5/transactions/receipt/%s'; + + public const FIND_INSTITUTIONS_ENDPOINT = '/v5/transactions/institutions'; + + public const HEALTH_CHECK_ENDPOINT = '/v5/transactions/healthcheck'; + + public const GET_BANKS_ENDPOINT = '/v5/transactions/banks'; + + public const GET_PENDENCIES_LIST_ENDPOINT = '/v5/transactions/pendency'; public function getBalance() { @@ -40,7 +45,7 @@ public function statusConsult( 'transactionId' => $transactionId, 'externalNSU' => $externalNSU, 'externalTerminal' => $externalTerminal, - 'operationDate' => !empty($operationDate) ? $operationDate->format("Y-m-d") : null, + 'operationDate' => ! empty($operationDate) ? $operationDate->format('Y-m-d') : null, ] ); } @@ -53,16 +58,16 @@ public function getReceipt(string $transactionId) public function findInstitutions(?InstitutionsTypeEnum $type = null, ?array $uf = null) { return $this->get(self::FIND_INSTITUTIONS_ENDPOINT, [ - "Type" => $type?->value, - "UF" => $uf, + 'Type' => $type?->value, + 'UF' => $uf, ]); } public function healthCheck(?HealthCheckTypeEnum $type = null, ?HealthCheckPeriodEnum $period = null) { return $this->get(self::HEALTH_CHECK_ENDPOINT, [ - "type" => $type?->value, - "period" => $period?->value, + 'type' => $type?->value, + 'period' => $period?->value, ]); } diff --git a/src/Clients/CelcoinBAAS.php b/src/Clients/CelcoinBAAS.php index 540d5fd..7e7e883 100644 --- a/src/Clients/CelcoinBAAS.php +++ b/src/Clients/CelcoinBAAS.php @@ -20,32 +20,45 @@ /** * Class CelcoinBAAS * Banking as a Service, ou BaaS, é uma tecnologia cujo objetivo é permitir que qualquer empresa – independentemente do seu ramo de atuação – comece a oferecer produtos financeiros sem a necessidade de ser um banco ou instituição financeira. - * @package WeDevBr\Celcoin */ class CelcoinBAAS extends CelcoinBaseApi { + public const CREATE_ACCOUNT_NATURAL_PERSON = '/baas-onboarding/v1/account/natural-person/create'; - const CREATE_ACCOUNT_NATURAL_PERSON = '/baas-onboarding/v1/account/natural-person/create'; - const UPDATE_ACCOUNT_NATURAL_PERSON = '/baas-accountmanager/v1/account/natural-person?Account=%s&DocumentNumber=%s'; - const GET_INFO_ACCOUNT_NATURAL_PERSON = '/baas-accountmanager/v1/account/fetch'; - const GET_LIST_INFO_ACCOUNT_NATURAL_PERSON = '/baas-accountmanager/v1/account/fetch-all'; - const CREATE_ACCOUNT_BUSINESS = '/baas-onboarding/v1/account/business/create'; - const UPDATE_ACCOUNT_BUSINESS = '/baas-accountmanager/v1/account/business?Account=%s&DocumentNumber=%s'; - const GET_INFO_ACCOUNT_BUSINESS = '/baas-accountmanager/v1/account/fetch-business'; - const GET_LIST_INFO_ACCOUNT_BUSINESS = '/baas-accountmanager/v1/account/fetch-all-business'; - const ACCOUNT_CHECK = '/baas-onboarding/v1/account/check'; - const DISABLE_ACCOUNT = '/baas-accountmanager/v1/account/status?Account=%s&DocumentNumber=%s'; - const ACTIVE_ACCOUNT = '/baas-accountmanager/v1/account/status?Account=%s&DocumentNumber=%s'; - const DELETE_ACCOUNT = '/baas-accountmanager/v1/account/close?%s'; - const GET_WALLET_BALANCE = '/baas-walletreports/v1/wallet/balance?Account=%s&DocumentNumber=%s'; - const GET_WALLET_MOVEMENT = '/baas-walletreports/v1/wallet/movement'; - const CREATE_RELEASE = '/baas-wallet-transactions-webservice/v1/wallet/entry/%s'; - - const INCOME_REPORT = '/baas-accountmanager/v1/account/income-report?Account=%s&CalendarYear=%s'; + public const UPDATE_ACCOUNT_NATURAL_PERSON = '/baas-accountmanager/v1/account/natural-person?Account=%s&DocumentNumber=%s'; + + public const GET_INFO_ACCOUNT_NATURAL_PERSON = '/baas-accountmanager/v1/account/fetch'; + + public const GET_LIST_INFO_ACCOUNT_NATURAL_PERSON = '/baas-accountmanager/v1/account/fetch-all'; + + public const CREATE_ACCOUNT_BUSINESS = '/baas-onboarding/v1/account/business/create'; + + public const UPDATE_ACCOUNT_BUSINESS = '/baas-accountmanager/v1/account/business?Account=%s&DocumentNumber=%s'; + + public const GET_INFO_ACCOUNT_BUSINESS = '/baas-accountmanager/v1/account/fetch-business'; + + public const GET_LIST_INFO_ACCOUNT_BUSINESS = '/baas-accountmanager/v1/account/fetch-all-business'; + + public const ACCOUNT_CHECK = '/baas-onboarding/v1/account/check'; + + public const DISABLE_ACCOUNT = '/baas-accountmanager/v1/account/status?Account=%s&DocumentNumber=%s'; + + public const ACTIVE_ACCOUNT = '/baas-accountmanager/v1/account/status?Account=%s&DocumentNumber=%s'; + + public const DELETE_ACCOUNT = '/baas-accountmanager/v1/account/close?%s'; + + public const GET_WALLET_BALANCE = '/baas-walletreports/v1/wallet/balance?Account=%s&DocumentNumber=%s'; + + public const GET_WALLET_MOVEMENT = '/baas-walletreports/v1/wallet/movement'; + + public const CREATE_RELEASE = '/baas-wallet-transactions-webservice/v1/wallet/entry/%s'; + + public const INCOME_REPORT = '/baas-accountmanager/v1/account/income-report?Account=%s&CalendarYear=%s'; public function createAccountNaturalPerson(AccountNaturalPerson $data) { $body = Validator::validate($data->toArray(), BAASAccountNaturalPerson::rules()); + return $this->post( self::CREATE_ACCOUNT_NATURAL_PERSON, $body @@ -55,6 +68,7 @@ public function createAccountNaturalPerson(AccountNaturalPerson $data) public function updateAccountNaturalPerson(string $account, string $documentNumber, AccountManagerNaturalPerson $data) { $body = Validator::validate($data->toArray(), BAASAccountManagerNaturalPerson::rules()); + return $this->put( sprintf(self::UPDATE_ACCOUNT_NATURAL_PERSON, $account, $documentNumber), $body @@ -80,6 +94,7 @@ public function getListInfoAccountNaturalPerson(Carbon $dateFrom, Carbon $dateTo public function createAccountBusiness(AccountBusiness $data) { $body = Validator::validate($data->toArray(), BAASAccountBusiness::rules()); + return $this->post( self::CREATE_ACCOUNT_BUSINESS, $body @@ -89,6 +104,7 @@ public function createAccountBusiness(AccountBusiness $data) public function updateAccountBusiness(string $account, string $documentNumber, AccountManagerBusiness $data) { $body = Validator::validate($data->toArray(), BAASAccountManagerBusiness::rules()); + return $this->put( sprintf(self::UPDATE_ACCOUNT_BUSINESS, $account, $documentNumber), $body @@ -144,6 +160,7 @@ public function deleteAccount(string $reason, ?string $account = null, ?string $ 'Reason' => $reason, ] ); + return $this->delete( sprintf(self::DELETE_ACCOUNT, $params), ); @@ -166,18 +183,20 @@ public function getWalletMovement(string $account, ?string $documentNumber, Carb 'DateFrom' => $dateFrom->format('Y-m-d'), 'DateTo' => $dateTo->format('Y-m-d'), 'Page' => $page, - 'Limite' => $limit + 'Limite' => $limit, ] ); } /** * @return array|mixed + * * @throws RequestException */ public function createRelease(string $account, AccountRelease $data) { $body = Validator::validate($data->toArray(), BAASAccountRelease::rules()); + return $this->post( sprintf(self::CREATE_RELEASE, $account), $body diff --git a/src/Clients/CelcoinBAASBillPayment.php b/src/Clients/CelcoinBAASBillPayment.php index 16ccb6b..b119ca3 100644 --- a/src/Clients/CelcoinBAASBillPayment.php +++ b/src/Clients/CelcoinBAASBillPayment.php @@ -14,13 +14,12 @@ * Class CelcoinBAASBillPayment * Essa funcionalidade permite realizar pagamentos das mais diversas modalidades, incluindo contas de água, luz, gás, * telefone, internet, multas, tributos e boletos de contas BAAS. - * @package WeDevBr\Celcoin */ class CelcoinBAASBillPayment extends CelcoinBaseApi { + public const MAKE_PAYMENT_ENDPOINT = '/baas/v2/billpayment'; - const MAKE_PAYMENT_ENDPOINT = '/baas/v2/billpayment'; - const GET_PAYMENT_STATUS = self::MAKE_PAYMENT_ENDPOINT . '/status'; + public const GET_PAYMENT_STATUS = self::MAKE_PAYMENT_ENDPOINT.'/status'; /** * @throws RequestException @@ -28,6 +27,7 @@ class CelcoinBAASBillPayment extends CelcoinBaseApi public function makePayment(BillPayment $data): mixed { $body = Validator::validate($data->toArray(), BillPaymentRule::rules()); + return $this->post( self::MAKE_PAYMENT_ENDPOINT, $body diff --git a/src/Clients/CelcoinBAASBillet.php b/src/Clients/CelcoinBAASBillet.php index eb46d8b..4125dcc 100644 --- a/src/Clients/CelcoinBAASBillet.php +++ b/src/Clients/CelcoinBAASBillet.php @@ -10,8 +10,7 @@ class CelcoinBAASBillet extends CelcoinBaseApi { - const BILLET_URL = '/api-integration-baas-webservice/v1/charge'; - + public const BILLET_URL = '/api-integration-baas-webservice/v1/charge'; /** * @throws RequestException @@ -19,6 +18,7 @@ class CelcoinBAASBillet extends CelcoinBaseApi public function createBillet(Billet $billet) { $data = Validator::validate($billet->toArray(), BilletRules::rules()); + return $this->post(self::BILLET_URL, $data); } @@ -31,6 +31,7 @@ public function getBillet($transaction_id = null, $external_id = null) 'transactionId' => $transaction_id, 'externalId' => $external_id, ])->filter()->toArray(); + return $this->get(self::BILLET_URL, $body); } @@ -41,4 +42,4 @@ public function cancelBillet($transactionId) { return $this->delete(sprintf('%s/%s', self::BILLET_URL, $transactionId)); } -} \ No newline at end of file +} diff --git a/src/Clients/CelcoinBAASPIX.php b/src/Clients/CelcoinBAASPIX.php index 8b6f8dd..0bd5dd6 100644 --- a/src/Clients/CelcoinBAASPIX.php +++ b/src/Clients/CelcoinBAASPIX.php @@ -15,20 +15,26 @@ /** * Class CelcoinBAASPIX * API de Pix do BaaS possui o modulo de Pix Cash-out, através desse modulo você consegue realizar as seguintes operações: - * @package WeDevBr\Celcoin */ class CelcoinBAASPIX extends CelcoinBaseApi { + public const CASH_OUT_ENDPOINT = '/baas-wallet-transactions-webservice/v1/pix/payment'; - const CASH_OUT_ENDPOINT = '/baas-wallet-transactions-webservice/v1/pix/payment'; - const GET_PARTICIPANT_ENDPOINT = '/baas-wallet-transactions-webservice/v1/pix/participant'; - const GET_EXTERNAL_KEY_ENDPOINT = '/celcoin-baas-pix-dict-webservice/v1/pix/dict/entry/external/%s'; - const STATUS_PIX_ENDPOINT = '/baas-wallet-transactions-webservice/v1/pix/payment/status'; - const REGISTER_PIX_KEY_ENDPOINT = '/celcoin-baas-pix-dict-webservice/v1/pix/dict/entry'; - const SEARCH_PIX_KEY_ENDPOINT = '/celcoin-baas-pix-dict-webservice/v1/pix/dict/entry/%s'; - const DELETE_PIX_KEY_ENDPOINT = '/celcoin-baas-pix-dict-webservice/v1/pix/dict/entry/%s'; - const REFUND_PIX_ENDPOINT = '/baas-wallet-transactions-webservice/v1/pix/reverse'; - const STATUS_REFUND_PIX_ENDPOINT = '/baas-wallet-transactions-webservice/v1/pix/reverse/status'; + public const GET_PARTICIPANT_ENDPOINT = '/baas-wallet-transactions-webservice/v1/pix/participant'; + + public const GET_EXTERNAL_KEY_ENDPOINT = '/celcoin-baas-pix-dict-webservice/v1/pix/dict/entry/external/%s'; + + public const STATUS_PIX_ENDPOINT = '/baas-wallet-transactions-webservice/v1/pix/payment/status'; + + public const REGISTER_PIX_KEY_ENDPOINT = '/celcoin-baas-pix-dict-webservice/v1/pix/dict/entry'; + + public const SEARCH_PIX_KEY_ENDPOINT = '/celcoin-baas-pix-dict-webservice/v1/pix/dict/entry/%s'; + + public const DELETE_PIX_KEY_ENDPOINT = '/celcoin-baas-pix-dict-webservice/v1/pix/dict/entry/%s'; + + public const REFUND_PIX_ENDPOINT = '/baas-wallet-transactions-webservice/v1/pix/reverse'; + + public const STATUS_REFUND_PIX_ENDPOINT = '/baas-wallet-transactions-webservice/v1/pix/reverse/status'; /** * @throws RequestException @@ -36,6 +42,7 @@ class CelcoinBAASPIX extends CelcoinBaseApi public function cashOut(PixCashOut $data) { $body = Validator::validate($data->toArray(), BAASPixCashOut::rules($data->initiationType->value)); + return $this->post( self::CASH_OUT_ENDPOINT, $body @@ -78,6 +85,7 @@ public function statusPix(?string $id = null, ?string $clientCode = null, ?strin public function registerPixKey(RegisterPixKey $data) { $body = Validator::validate($data->toArray(), BAASRegisterPixKey::rules()); + return $this->post( self::REGISTER_PIX_KEY_ENDPOINT, $body @@ -104,6 +112,7 @@ public function deletePixKey(string $account, string $key) public function refundPix(RefundPix $data) { $body = Validator::validate($data->toArray(), BAASRefundPix::rules()); + return $this->post( self::REFUND_PIX_ENDPOINT, $body diff --git a/src/Clients/CelcoinBAASTED.php b/src/Clients/CelcoinBAASTED.php index 6730025..8b35321 100644 --- a/src/Clients/CelcoinBAASTED.php +++ b/src/Clients/CelcoinBAASTED.php @@ -6,24 +6,24 @@ use Illuminate\Support\Facades\Validator; use WeDevBr\Celcoin\Common\CelcoinBaseApi; use WeDevBr\Celcoin\Rules\BAAS\BAASGetTEFTransfer; -use WeDevBr\Celcoin\Rules\BAAS\TEDTransfer as BAASTEDTransfer; use WeDevBr\Celcoin\Rules\BAAS\BAASTEFTransfer; +use WeDevBr\Celcoin\Rules\BAAS\TEDTransfer as BAASTEDTransfer; use WeDevBr\Celcoin\Types\BAAS\TEDTransfer; use WeDevBr\Celcoin\Types\BAAS\TEFTransfer; /** * Class CelcoinBAASTED * API de BaaS possui o modulo de TED, esse modulo contempla os seguintes serviços Transferência via TED e Consultar Status de uma Transferência TED - * @package WeDevBr\Celcoin */ class CelcoinBAASTED extends CelcoinBaseApi { - const TRANSFER_ENDPOINT = '/baas-wallet-transactions-webservice/v1/spb/transfer'; - const GET_STATUS_TRANSFER_ENDPOINT = '/baas-wallet-transactions-webservice/v1/spb/transfer/status'; + public const TRANSFER_ENDPOINT = '/baas-wallet-transactions-webservice/v1/spb/transfer'; + + public const GET_STATUS_TRANSFER_ENDPOINT = '/baas-wallet-transactions-webservice/v1/spb/transfer/status'; - const INTERNAL_TRANSFER_ENDPOINT = '/baas-wallet-transactions-webservice/v1/wallet/internal/transfer'; + public const INTERNAL_TRANSFER_ENDPOINT = '/baas-wallet-transactions-webservice/v1/wallet/internal/transfer'; - const GET_STATUS_INTERNAL_TRANSFER_ENDPOINT = '/baas-wallet-transactions-webservice/v1/wallet/internal/transfer/status'; + public const GET_STATUS_INTERNAL_TRANSFER_ENDPOINT = '/baas-wallet-transactions-webservice/v1/wallet/internal/transfer/status'; /** * @throws RequestException @@ -31,6 +31,7 @@ class CelcoinBAASTED extends CelcoinBaseApi public function transfer(TEDTransfer $data): mixed { $body = Validator::validate($data->toArray(), BAASTEDTransfer::rules()); + return $this->post( self::TRANSFER_ENDPOINT, $body @@ -76,7 +77,9 @@ public function getStatusInternalTransfer( 'ClientRequestId' => $clientRequestId, 'EndToEndId' => $endToEndId, ] - ), BAASGetTEFTransfer::rules()); + ), + BAASGetTEFTransfer::rules() + ); return $this->get( self::GET_STATUS_INTERNAL_TRANSFER_ENDPOINT, diff --git a/src/Clients/CelcoinBAASWebhooks.php b/src/Clients/CelcoinBAASWebhooks.php index 72f0748..1652716 100644 --- a/src/Clients/CelcoinBAASWebhooks.php +++ b/src/Clients/CelcoinBAASWebhooks.php @@ -13,18 +13,21 @@ /** * Class CelcoinWebhooks * API de BaaS possui o modulo de Gerenciamento de Webhook, com esses serviços você consegue administrar suas rotas de Webhook sem precisar acionar o time da Celcoin - * @package WeDevBr\Celcoin */ class CelcoinBAASWebhooks extends CelcoinBaseApi { - const REGISTER_ENDPOINT = '/baas-webhookmanager/v1/webhook/subscription'; - const GET_ENDPOINT = '/baas-webhookmanager/v1/webhook/subscription'; - const EDIT_ENDPOINT = 'baas-webhookmanager/v1/webhook/subscription/%s'; - const REMOVE_ENDPOINT = 'baas-webhookmanager/v1/webhook/subscription/%s'; + public const REGISTER_ENDPOINT = '/baas-webhookmanager/v1/webhook/subscription'; + + public const GET_ENDPOINT = '/baas-webhookmanager/v1/webhook/subscription'; + + public const EDIT_ENDPOINT = 'baas-webhookmanager/v1/webhook/subscription/%s'; + + public const REMOVE_ENDPOINT = 'baas-webhookmanager/v1/webhook/subscription/%s'; public function register(RegisterWebhooks $data) { $body = Validator::validate($data->toArray(), BAASRegisterWebhooks::rules()); + return $this->post( self::REGISTER_ENDPOINT, $body @@ -35,13 +38,14 @@ public function getWebhook(EntityWebhookBAASEnum $entity, bool $active) { return $this->get(self::GET_ENDPOINT, [ 'Entity' => $entity->value, - 'Active' => $active ? 'true' : 'false' + 'Active' => $active ? 'true' : 'false', ]); } public function edit(EditWebhooks $data, EntityWebhookBAASEnum $entity) { $body = Validator::validate($data->toArray(), BAASEditWebhooks::rules()); + return $this->put( sprintf(self::EDIT_ENDPOINT, $entity->value), $body diff --git a/src/Clients/CelcoinBankTransfer.php b/src/Clients/CelcoinBankTransfer.php index f6a816c..4db23d1 100644 --- a/src/Clients/CelcoinBankTransfer.php +++ b/src/Clients/CelcoinBankTransfer.php @@ -11,16 +11,17 @@ /** * Class BankTransfer * Essa funcionalidade permite realizar transferências de forma online, fazendo com que o envio junto ao banco destino seja realizado imediatamente e o cliente receba o status desta transferência no mesmo instante. - * @package WeDevBr\Celcoin */ class CelcoinBankTransfer extends CelcoinBaseApi { - const CREATE_ENDPOINT = '/v5/transactions/banktransfer'; - const GET_STATUS_TRANSFER_ENDPOINT = '/v5/transactions/banktransfer/status-transfer/%d'; + public const CREATE_ENDPOINT = '/v5/transactions/banktransfer'; + + public const GET_STATUS_TRANSFER_ENDPOINT = '/v5/transactions/banktransfer/status-transfer/%d'; public function create(Create $data) { $body = Validator::validate($data->toArray(), BankTransferCreate::rules()); + return $this->post( self::CREATE_ENDPOINT, $body @@ -34,7 +35,7 @@ public function getStatusTransfer(int $transactionId, ?int $nsuExterno = null, ? [ 'nsuExterno' => $nsuExterno, 'terminalIdExterno' => $terminalIdExterno, - 'dataOperacao' => !empty($dataOperacao) ? $dataOperacao->format('Y-m-d') : null, + 'dataOperacao' => ! empty($dataOperacao) ? $dataOperacao->format('Y-m-d') : null, ] ); } diff --git a/src/Clients/CelcoinBillPayment.php b/src/Clients/CelcoinBillPayment.php index d6a2fea..b1d3eab 100644 --- a/src/Clients/CelcoinBillPayment.php +++ b/src/Clients/CelcoinBillPayment.php @@ -7,9 +7,9 @@ use Illuminate\Support\Facades\Validator; use WeDevBr\Celcoin\Common\CelcoinBaseApi; use WeDevBr\Celcoin\Rules\BillPayments\Authorize as BillPaymentsAuthorize; -use WeDevBr\Celcoin\Rules\BillPayments\Create as BillPaymentsCreate; use WeDevBr\Celcoin\Rules\BillPayments\Cancel as BillPaymentsCancel; use WeDevBr\Celcoin\Rules\BillPayments\Confirm as BillPaymentsConfirm; +use WeDevBr\Celcoin\Rules\BillPayments\Create as BillPaymentsCreate; use WeDevBr\Celcoin\Types\BillPayments\Authorize; use WeDevBr\Celcoin\Types\BillPayments\Cancel; use WeDevBr\Celcoin\Types\BillPayments\Confirm; @@ -18,21 +18,25 @@ /** * Class CelcoinBillPayment * Essa funcionalidade permite realizar pagamentos das mais diversas modalidades, incluindo contas de água, luz, gás, telefone, internet, multas, tributos e boletos. - * @package WeDevBr\Celcoin */ class CelcoinBillPayment extends CelcoinBaseApi { + public const AUTHORIZE_ENDPOINT = '/v5/transactions/billpayments/authorize'; + + public const CREATE_ENDPOINT = '/v5/transactions/billpayments'; + + public const CONFIRM_ENDPOINT = '/v5/transactions/billpayments/%d/capture'; + + public const CANCEL_ENDPOINT = '/v5/transactions/billpayments/%d/void'; - const AUTHORIZE_ENDPOINT = '/v5/transactions/billpayments/authorize'; - const CREATE_ENDPOINT = '/v5/transactions/billpayments'; - const CONFIRM_ENDPOINT = '/v5/transactions/billpayments/%d/capture'; - const CANCEL_ENDPOINT = '/v5/transactions/billpayments/%d/void'; - const REVERSE_ENDPOINT = '/v5/transactions/billpayments/%d/reverse'; - const GET_OCCURRENCES_ENDPOINT = '/v5/transactions/occurrency'; + public const REVERSE_ENDPOINT = '/v5/transactions/billpayments/%d/reverse'; + + public const GET_OCCURRENCES_ENDPOINT = '/v5/transactions/occurrency'; public function authorize(Authorize $data): mixed { $body = Validator::validate($data->toArray(), BillPaymentsAuthorize::rules()); + return $this->post( self::AUTHORIZE_ENDPOINT, $body @@ -41,11 +45,13 @@ public function authorize(Authorize $data): mixed /** * @return array|mixed + * * @throws RequestException */ public function create(Create $data): mixed { $body = Validator::validate($data->toArray(), BillPaymentsCreate::rules()); + return $this->post( self::CREATE_ENDPOINT, $body @@ -55,6 +61,7 @@ public function create(Create $data): mixed public function confirm(int $transactionId, Confirm $data): mixed { $body = Validator::validate($data->toArray(), BillPaymentsConfirm::rules()); + return $this->put( sprintf(self::CONFIRM_ENDPOINT, $transactionId), $body @@ -64,6 +71,7 @@ public function confirm(int $transactionId, Confirm $data): mixed public function cancel(int $transactionId, Cancel $data): mixed { $body = Validator::validate($data->toArray(), BillPaymentsCancel::rules()); + return $this->delete( sprintf(self::CANCEL_ENDPOINT, $transactionId), $body @@ -82,8 +90,8 @@ public function getOccurrences(?Carbon $dateStart = null, ?Carbon $dateEnd = nul return $this->get( self::GET_OCCURRENCES_ENDPOINT, [ - 'DataInicio' => !empty($dateStart) ? $dateStart->format("Y-m-d") : null, - 'DataFim' => !empty($dateEnd) ? $dateEnd->format("Y-m-d") : null, + 'DataInicio' => ! empty($dateStart) ? $dateStart->format('Y-m-d') : null, + 'DataFim' => ! empty($dateEnd) ? $dateEnd->format('Y-m-d') : null, ] ); } diff --git a/src/Clients/CelcoinDDAInvoice.php b/src/Clients/CelcoinDDAInvoice.php index 0778108..3d88497 100644 --- a/src/Clients/CelcoinDDAInvoice.php +++ b/src/Clients/CelcoinDDAInvoice.php @@ -10,15 +10,15 @@ /** * Class CelcoinWebhooks * Essa API permite gerar boletos para um usuário cadastrado no DDA - * @package WeDevBr\Celcoin */ class CelcoinDDAInvoice extends CelcoinBaseApi { - const REGISTER_ENDPOINT = '/dda-serviceinvoice-webservice/v1/invoice/register'; + public const REGISTER_ENDPOINT = '/dda-serviceinvoice-webservice/v1/invoice/register'; public function register(RegisterInvoice $data) { $body = Validator::validate($data->toArray(), DDARegisterInvoice::rules()); + return $this->post( self::REGISTER_ENDPOINT, $body diff --git a/src/Clients/CelcoinDDAUser.php b/src/Clients/CelcoinDDAUser.php index 6a7f16b..ba9793f 100644 --- a/src/Clients/CelcoinDDAUser.php +++ b/src/Clients/CelcoinDDAUser.php @@ -12,17 +12,17 @@ /** * Class CelcoinDDAUser * A API de subscription permite acesso de forma eletrônica aos boletos emitidos em um determinado CPF ou CNPJ. - * @package WeDevBr\Celcoin */ class CelcoinDDAUser extends CelcoinBaseApi { + public const REGISTER_ENDPOINT = '/dda-subscription-webservice/v1/subscription/Register'; - const REGISTER_ENDPOINT = '/dda-subscription-webservice/v1/subscription/Register'; - const REMOVE_ENDPOINT = 'dda-subscription-webservice/v1/subscription/Register'; + public const REMOVE_ENDPOINT = 'dda-subscription-webservice/v1/subscription/Register'; public function register(RegisterUser $data) { $body = Validator::validate($data->toArray(), DDARegisterUser::rules()); + return $this->post( self::REGISTER_ENDPOINT, $body @@ -32,6 +32,7 @@ public function register(RegisterUser $data) public function remove(RemoveUser $data) { $body = Validator::validate($data->toArray(), DDARemoveUser::rules()); + return $this->delete( self::REMOVE_ENDPOINT, $body diff --git a/src/Clients/CelcoinDDAWebhooks.php b/src/Clients/CelcoinDDAWebhooks.php index b1d833e..c113ff8 100644 --- a/src/Clients/CelcoinDDAWebhooks.php +++ b/src/Clients/CelcoinDDAWebhooks.php @@ -10,17 +10,17 @@ /** * Class CelcoinWebhooks * Depois que uma solicitação é enviada, ela passa por vários status. Toda vez que essa alteração ocorre, um webhook é acionado para que o originador possa manter o controle do processo de originação. - * @package WeDevBr\Celcoin */ class CelcoinDDAWebhooks extends CelcoinBaseApi { + public const REGISTER_ENDPOINT = '/dda-servicewebhook-webservice/v1/webhook/register'; - const REGISTER_ENDPOINT = '/dda-servicewebhook-webservice/v1/webhook/register'; - const LIST_ENDPOINT = '/dda-servicewebhook-webservice/v1/webhook/routes'; + public const LIST_ENDPOINT = '/dda-servicewebhook-webservice/v1/webhook/routes'; public function register(RegisterWebhooks $data) { $body = Validator::validate($data->toArray(), DDARegisterWebhooks::rules()); + return $this->post( self::REGISTER_ENDPOINT, $body diff --git a/src/Clients/CelcoinElectronicTransactions.php b/src/Clients/CelcoinElectronicTransactions.php index 96bbc99..a13b2e9 100644 --- a/src/Clients/CelcoinElectronicTransactions.php +++ b/src/Clients/CelcoinElectronicTransactions.php @@ -2,7 +2,6 @@ namespace WeDevBr\Celcoin\Clients; -use Carbon\Carbon; use Illuminate\Http\Client\RequestException; use Illuminate\Support\Facades\Validator; use WeDevBr\Celcoin\Common\CelcoinBaseApi; @@ -18,16 +17,18 @@ /** * Class CelcoinElectronicTransactions * Essa funcionalidade permite que sejam realizados depósitos, ou saques através de um Qrcode, ou token nos caixas 24 horas disponibilizados em mercados e postos de gasolina pela TechBan. - * @package WeDevBr\Celcoin */ class CelcoinElectronicTransactions extends CelcoinBaseApi { + public const GET_PARTNERS_ENDPOINT = '/v5/transactions/electronictransactions/consult-partners'; - const GET_PARTNERS_ENDPOINT = '/v5/transactions/electronictransactions/consult-partners'; - const GET_SERVICES_POINTS_ENDPOINT = '/v5/transactions/electronictransactions/consult-servicespoints'; - const DEPOSIT_ENDPOINT = '/v5/transactions/electronictransactions/electronic-payment'; - const WITHDRAW_ENDPOINT = '/v5/transactions/electronictransactions/electronic-receipt'; - const GENERATE_WITHDRAW_TOKEN_ENDPOINT = '/v5/transactions/electronictransactions/withdraw-thirdparty'; + public const GET_SERVICES_POINTS_ENDPOINT = '/v5/transactions/electronictransactions/consult-servicespoints'; + + public const DEPOSIT_ENDPOINT = '/v5/transactions/electronictransactions/electronic-payment'; + + public const WITHDRAW_ENDPOINT = '/v5/transactions/electronictransactions/electronic-receipt'; + + public const GENERATE_WITHDRAW_TOKEN_ENDPOINT = '/v5/transactions/electronictransactions/withdraw-thirdparty'; public function getPartners() { @@ -36,11 +37,13 @@ public function getPartners() /** * @return array|mixed + * * @throws RequestException */ public function getServicesPoints(ServicesPoints $data) { $body = Validator::validate($data->toArray(), ElectronicTransactionsServicesPoints::rules()); + return $this->post( self::GET_SERVICES_POINTS_ENDPOINT, $body @@ -50,6 +53,7 @@ public function getServicesPoints(ServicesPoints $data) public function deposit(Deposit $data) { $body = Validator::validate($data->toArray(), ElectronicTransactionsDeposit::rules()); + return $this->post( self::DEPOSIT_ENDPOINT, $body @@ -59,6 +63,7 @@ public function deposit(Deposit $data) public function withdraw(Withdraw $data) { $body = Validator::validate($data->toArray(), ElectronicTransactionsWithdraw::rules()); + return $this->post( self::WITHDRAW_ENDPOINT, $body @@ -68,6 +73,7 @@ public function withdraw(Withdraw $data) public function generateWithdrawToken(WithdrawToken $data) { $body = Validator::validate($data->toArray(), ElectronicTransactionsWithdrawToken::rules()); + return $this->post( self::GENERATE_WITHDRAW_TOKEN_ENDPOINT, $body diff --git a/src/Clients/CelcoinInternationalTopups.php b/src/Clients/CelcoinInternationalTopups.php index 8dc1f08..95fbf5f 100644 --- a/src/Clients/CelcoinInternationalTopups.php +++ b/src/Clients/CelcoinInternationalTopups.php @@ -15,15 +15,18 @@ /** * Class CelcoinInternationalTopups * Essa funcionalidade é usada para disponibilizar aos seus usuários a possibilidade de realizar recargas de celulares internacionais. - * @package WeDevBr\Celcoin */ class CelcoinInternationalTopups extends CelcoinBaseApi { - const GET_COUNTRIES_ENDPOINT = '/v5/transactions/internationaltopups/countrys'; - const GET_VALUES_ENDPOINT = '/v5/transactions/internationaltopups/values'; - const CREATE_ENDPOINT = '/v5/transactions/internationaltopups'; - const CONFIRM_ENDPOINT = '/v5/transactions/internationaltopups/%d/capture'; - const CANCEL_ENDPOINT = '/v5/transactions/internationaltopups/%d/void'; + public const GET_COUNTRIES_ENDPOINT = '/v5/transactions/internationaltopups/countrys'; + + public const GET_VALUES_ENDPOINT = '/v5/transactions/internationaltopups/values'; + + public const CREATE_ENDPOINT = '/v5/transactions/internationaltopups'; + + public const CONFIRM_ENDPOINT = '/v5/transactions/internationaltopups/%d/capture'; + + public const CANCEL_ENDPOINT = '/v5/transactions/internationaltopups/%d/void'; public function getCountries(int $page = 1, int $size = 50): mixed { @@ -36,7 +39,7 @@ public function getCountries(int $page = 1, int $size = 50): mixed ); } - public function getValues(?string $countryCode = null, string $phoneNumber = null): mixed + public function getValues(?string $countryCode = null, ?string $phoneNumber = null): mixed { return $this->get( self::GET_VALUES_ENDPOINT, @@ -49,11 +52,13 @@ public function getValues(?string $countryCode = null, string $phoneNumber = nul /** * @return array|mixed + * * @throws RequestException */ public function create(Create $data): mixed { $body = Validator::validate($data->toArray(), InternationalTopupsCreate::rules()); + return $this->post( self::CREATE_ENDPOINT, $body @@ -63,6 +68,7 @@ public function create(Create $data): mixed public function confirm(int $transactionId, Confirm $data): mixed { $body = Validator::validate($data->toArray(), InternationalTopupsConfirm::rules()); + return $this->put( sprintf(self::CONFIRM_ENDPOINT, $transactionId), $body @@ -72,6 +78,7 @@ public function confirm(int $transactionId, Confirm $data): mixed public function cancel(int $transactionId, Cancel $data): mixed { $body = Validator::validate($data->toArray(), InternationalTopupsCancel::rules()); + return $this->delete( sprintf(self::CANCEL_ENDPOINT, $transactionId), $body diff --git a/src/Clients/CelcoinKyc.php b/src/Clients/CelcoinKyc.php index 37d1f3e..8aacd88 100644 --- a/src/Clients/CelcoinKyc.php +++ b/src/Clients/CelcoinKyc.php @@ -16,7 +16,7 @@ class CelcoinKyc extends CelcoinBaseApi /** * @throws RequestException */ - public function createKyc(CreateKyc $data, Attachable $attachable = null): array + public function createKyc(CreateKyc $data, ?Attachable $attachable = null): array { $body = Validator::validate($data->toArray(), CreateKycRule::rules()); diff --git a/src/Clients/CelcoinPIXCOB.php b/src/Clients/CelcoinPIXCOB.php index 932890a..05bfd1e 100644 --- a/src/Clients/CelcoinPIXCOB.php +++ b/src/Clients/CelcoinPIXCOB.php @@ -13,13 +13,19 @@ class CelcoinPIXCOB extends CelcoinBaseApi { - const CREATE_COB_PIX_URL = '/pix/v1/collection/immediate'; - const UPDATE_COB_PIX_URL = '/pix/v1/collection/immediate/%d'; - const DELETE_COB_PIX_URL = '/pix/v1/collection/immediate/%d'; - const GET_COB_PIX_URL = '/pix/v1/collection/pi/immediate'; - const UNLINK_COB_PIX_URL = '/pix/v1/collection/pi/immediate/%d/unlink'; - const FETCH_COB_PIX_URL = '/pix/v1/collection/immediate/%d'; - const PAYLOAD_COB_PIX_URL = '/pix/v1/collection/immediate/payload/%s'; + public const CREATE_COB_PIX_URL = '/pix/v1/collection/immediate'; + + public const UPDATE_COB_PIX_URL = '/pix/v1/collection/immediate/%d'; + + public const DELETE_COB_PIX_URL = '/pix/v1/collection/immediate/%d'; + + public const GET_COB_PIX_URL = '/pix/v1/collection/pi/immediate'; + + public const UNLINK_COB_PIX_URL = '/pix/v1/collection/pi/immediate/%d/unlink'; + + public const FETCH_COB_PIX_URL = '/pix/v1/collection/immediate/%d'; + + public const PAYLOAD_COB_PIX_URL = '/pix/v1/collection/immediate/payload/%s'; /** * @throws RequestException @@ -27,6 +33,7 @@ class CelcoinPIXCOB extends CelcoinBaseApi final public function createCOBPIX(COB $cob): array { $body = Validator::validate($cob->toArray(), COBCreate::rules()); + return $this->post( self::CREATE_COB_PIX_URL, $body @@ -39,6 +46,7 @@ final public function createCOBPIX(COB $cob): array final public function updateCOBPIX(int $transactionId, COB $cob): array { $body = Validator::validate($cob->toArray(), COBUpdate::rules()); + return $this->put( sprintf(self::UPDATE_COB_PIX_URL, $transactionId), $body @@ -51,8 +59,10 @@ final public function updateCOBPIX(int $transactionId, COB $cob): array final public function getCOBPIX(COBGetInput $data): array { $params = Validator::validate($data->toArray(), COBGet::rules()); + return $this->get( - sprintf('%s?%s', + sprintf( + '%s?%s', self::GET_COB_PIX_URL, http_build_query($params) ) @@ -70,8 +80,6 @@ final public function deleteCOBPIX(int $transactionId): array } /** - * @param int $transactionId - * @return array * @throws RequestException */ final public function unlinkCOBPIX(int $transactionId): array @@ -82,8 +90,6 @@ final public function unlinkCOBPIX(int $transactionId): array } /** - * @param int $transactionId - * @return array * @throws RequestException */ final public function fetchCOBPIX(int $transactionId): array @@ -94,8 +100,6 @@ final public function fetchCOBPIX(int $transactionId): array } /** - * @param string $url - * @return array * @throws RequestException */ final public function payloadCOBPIX(string $url): array diff --git a/src/Clients/CelcoinPIXCOBV.php b/src/Clients/CelcoinPIXCOBV.php index d4d2d5a..d9f0c7b 100644 --- a/src/Clients/CelcoinPIXCOBV.php +++ b/src/Clients/CelcoinPIXCOBV.php @@ -13,12 +13,17 @@ class CelcoinPIXCOBV extends CelcoinBaseApi { - const CREATE_COBV_PIX = '/pix/v1/collection/duedate'; - const GET_COBV_PIX = '/pix/v1/collection/duedate'; - const PAYLOAD_COBV_PIX = '/pix/v1/collection/duedate/payload/%s'; - const UPDATE_COBV_PIX = '/pix/v1/collection/duedate/%d'; - const DELETE_COB_PIX_URL = '/pix/v1/collection/duedate/%d'; - const UNLINK_COB_PIX_URL = '/pix/v1/collection/duedate/%d/unlink'; + public const CREATE_COBV_PIX = '/pix/v1/collection/duedate'; + + public const GET_COBV_PIX = '/pix/v1/collection/duedate'; + + public const PAYLOAD_COBV_PIX = '/pix/v1/collection/duedate/payload/%s'; + + public const UPDATE_COBV_PIX = '/pix/v1/collection/duedate/%d'; + + public const DELETE_COB_PIX_URL = '/pix/v1/collection/duedate/%d'; + + public const UNLINK_COB_PIX_URL = '/pix/v1/collection/duedate/%d/unlink'; /** * @throws RequestException @@ -26,6 +31,7 @@ class CelcoinPIXCOBV extends CelcoinBaseApi final public function createCOBVPIX(COBV $cobv): ?array { $body = Validator::validate($cobv->toArray(), COBVCreate::rules()); + return $this->post( self::CREATE_COBV_PIX, $body @@ -38,6 +44,7 @@ final public function createCOBVPIX(COBV $cobv): ?array final public function getCOBVPIX(array $data): ?array { $params = Validator::validate($data, COBVGet::rules()); + return $this->get( sprintf( '%s?%s', @@ -53,20 +60,19 @@ final public function getCOBVPIX(array $data): ?array final public function payloadCOBVPIX(string $url): ?array { Validator::validate(compact('url'), COBVPayload::rules()); + return $this->get( sprintf(self::PAYLOAD_COBV_PIX, urlencode($url)) ); } /** - * @param int $transactionId - * @param array $body - * @return array|null * @throws RequestException */ final public function updateCOBVPIX(int $transactionId, array $body): ?array { $params = Validator::validate($body, COBVUpdateRules::rules()); + return $this->put( sprintf(self::UPDATE_COBV_PIX, $transactionId), $params diff --git a/src/Clients/CelcoinPIXDICT.php b/src/Clients/CelcoinPIXDICT.php index 6edae82..2537f3c 100644 --- a/src/Clients/CelcoinPIXDICT.php +++ b/src/Clients/CelcoinPIXDICT.php @@ -15,20 +15,23 @@ class CelcoinPIXDICT extends CelcoinBaseApi { - const POST_SEARCH_DICT = '/pix/v1/dict/v2/key'; - const POST_VERIFY_DICT = '/pix/v1/dict/keychecker'; - const CLAIM_DICT = '/pix/v1/dict/claim'; - const CLAIM_CONFIRM = '/pix/v1/dict/claim/confirm'; - const CLAIM_CANCEL = '/pix/v1/dict/claim/cancel'; - - /** - * @param DICT $dict - * @return array|null + public const POST_SEARCH_DICT = '/pix/v1/dict/v2/key'; + + public const POST_VERIFY_DICT = '/pix/v1/dict/keychecker'; + + public const CLAIM_DICT = '/pix/v1/dict/claim'; + + public const CLAIM_CONFIRM = '/pix/v1/dict/claim/confirm'; + + public const CLAIM_CANCEL = '/pix/v1/dict/claim/cancel'; + + /** * @throws RequestException */ public function searchDICT(DICT $dict): ?array { $body = Validator::validate($dict->toArray(), DICTSearch::rules()); + return $this->post( self::POST_SEARCH_DICT, $body @@ -36,61 +39,64 @@ public function searchDICT(DICT $dict): ?array } /** - * @param DICT $dict - * @return array|null * @throws RequestException */ public function verifyDICT(DICT $dict): ?array { $body = Validator::validate($dict->toArray(), DICTVerify::rules()); + return $this->post( self::POST_VERIFY_DICT, $body ); } - /** - * @throws RequestException - */ - public function claim(Claim $claim): ?array - { - $body = Validator::validate($claim->toArray(), ClaimCreate::rules()); - return $this->post( - self::CLAIM_DICT, - $body - ); - } - - public function claimConfirm(ClaimAnswer $claim): ?array - { - $body = Validator::validate($claim->toArray(), ClaimAnswerRule::rules()); - return $this->post( - self::CLAIM_CONFIRM, - $body - ); - } - - /** - * @throws RequestException - */ - public function claimCancel(ClaimAnswer $claim): ?array - { - $body = Validator::validate($claim->toArray(), ClaimAnswerRule::rules()); - return $this->post( - self::CLAIM_CANCEL, - $body - ); - } - - /** - * @throws RequestException - */ - public function claimConsult(string $claimId): ?array - { - $body = Validator::validate(['claimId' => $claimId], ['claimId' => ['string', 'uuid']]); - return $this->get( - self::CLAIM_CANCEL.'/'.$claimId, - $body - ); - } -} \ No newline at end of file + /** + * @throws RequestException + */ + public function claim(Claim $claim): ?array + { + $body = Validator::validate($claim->toArray(), ClaimCreate::rules()); + + return $this->post( + self::CLAIM_DICT, + $body + ); + } + + public function claimConfirm(ClaimAnswer $claim): ?array + { + $body = Validator::validate($claim->toArray(), ClaimAnswerRule::rules()); + + return $this->post( + self::CLAIM_CONFIRM, + $body + ); + } + + /** + * @throws RequestException + */ + public function claimCancel(ClaimAnswer $claim): ?array + { + $body = Validator::validate($claim->toArray(), ClaimAnswerRule::rules()); + + return $this->post( + self::CLAIM_CANCEL, + $body + ); + } + + /** + * @throws RequestException + */ + public function claimConsult(string $claimId): ?array + { + $body = Validator::validate(['claimId' => $claimId], ['claimId' => ['string', 'uuid']]); + + return $this->get( + self::CLAIM_CANCEL.'/'.$claimId, + $body + ); + } +} diff --git a/src/Clients/CelcoinPIXDynamic.php b/src/Clients/CelcoinPIXDynamic.php index 46de747..eeb76c2 100644 --- a/src/Clients/CelcoinPIXDynamic.php +++ b/src/Clients/CelcoinPIXDynamic.php @@ -13,15 +13,17 @@ class CelcoinPIXDynamic extends CelcoinBaseApi { - const GET_DYNAMIC_BASE64_ENDPOINT = '/pix/v1/brcode/dynamic/%d/base64'; - const CREATE_DYNAMIC_QRCODE_ENDPOINT = '/pix/v1/brcode/dynamic'; - const UPDATE_DYNAMIC_QRCODE_ENDPOINT = '/pix/v1/brcode/dynamic/%d'; - const DELETE_DYNAMIC_QRCODE_ENDPOINT = '/pix/v1/brcode/dynamic/%d'; - const PAYLOAD_DYNAMIC_QRCODE_ENDPOINT = '/pix/v1/brcode/dynamic/payload'; + public const GET_DYNAMIC_BASE64_ENDPOINT = '/pix/v1/brcode/dynamic/%d/base64'; + + public const CREATE_DYNAMIC_QRCODE_ENDPOINT = '/pix/v1/brcode/dynamic'; + + public const UPDATE_DYNAMIC_QRCODE_ENDPOINT = '/pix/v1/brcode/dynamic/%d'; + + public const DELETE_DYNAMIC_QRCODE_ENDPOINT = '/pix/v1/brcode/dynamic/%d'; + + public const PAYLOAD_DYNAMIC_QRCODE_ENDPOINT = '/pix/v1/brcode/dynamic/payload'; /** - * @param int $transactionId - * @return array|null * @throws RequestException */ final public function getDynamicImage(int $transactionId): ?array @@ -32,33 +34,29 @@ final public function getDynamicImage(int $transactionId): ?array } /** - * @param DynamicQRCreate $data - * @return array|null * @throws RequestException */ final public function createDynamicQRCode(DynamicQRCreate $data): ?array { $body = Validator::validate($data->toArray(), DynamicQRCreateRule::rules()); + return $this->post(self::CREATE_DYNAMIC_QRCODE_ENDPOINT, $body); } /** - * @param int $transactionId - * @param DynamicQRUpdate $data - * @return array|null * @throws RequestException */ final public function updateDynamicQRCode(int $transactionId, DynamicQRUpdate $data): ?array { $body = Validator::validate($data->toArray(), DynamicQRUpdateRule::rules()); + return $this->put( - sprintf(self::UPDATE_DYNAMIC_QRCODE_ENDPOINT, $transactionId), $body + sprintf(self::UPDATE_DYNAMIC_QRCODE_ENDPOINT, $transactionId), + $body ); } /** - * @param int $transactionId - * @return array|null * @throws RequestException */ final public function deleteDynamicQRCode(int $transactionId): ?array @@ -69,13 +67,12 @@ final public function deleteDynamicQRCode(int $transactionId): ?array } /** - * @param string $url - * @return array|null * @throws RequestException */ final public function payload(string $url): ?array { Validator::validate(compact('url'), DynamicQRPayloadRule::rules()); + return $this->post( sprintf( '%s?%s', diff --git a/src/Clients/CelcoinPIXParticipants.php b/src/Clients/CelcoinPIXParticipants.php index dbd5c6f..70ca6bc 100644 --- a/src/Clients/CelcoinPIXParticipants.php +++ b/src/Clients/CelcoinPIXParticipants.php @@ -7,10 +7,9 @@ class CelcoinPIXParticipants extends CelcoinBaseApi { - const GET_PARTICIPANTS_ENDPOINT = '/pix/v1/participants'; + public const GET_PARTICIPANTS_ENDPOINT = '/pix/v1/participants'; /** - * @return array|null * @throws RequestException */ final public function getParticipants(): ?array diff --git a/src/Clients/CelcoinPIXPayment.php b/src/Clients/CelcoinPIXPayment.php index 67d405a..4be4840 100644 --- a/src/Clients/CelcoinPIXPayment.php +++ b/src/Clients/CelcoinPIXPayment.php @@ -16,20 +16,21 @@ class CelcoinPIXPayment extends CelcoinBaseApi { - const END_TO_END_PAYMENT_ENDPOINT = '/pix/v1/payment/endToEnd'; - const EMV_PAYMENT_ENDPOINT = '/pix/v1/emv'; - const STATUS_PAYMENT_ENDPOINT = '/pix/v1/payment/pi/status'; - const INIT_PAYMENT_ENDPOINT = '/pix/v1/payment'; + public const END_TO_END_PAYMENT_ENDPOINT = '/pix/v1/payment/endToEnd'; + + public const EMV_PAYMENT_ENDPOINT = '/pix/v1/emv'; + + public const STATUS_PAYMENT_ENDPOINT = '/pix/v1/payment/pi/status'; + + public const INIT_PAYMENT_ENDPOINT = '/pix/v1/payment'; /** - * @param PaymentEndToEnd $params - * @return array|null * @throws RequestException */ final public function endToEndPayment(PaymentEndToEnd $params): ?array { $body = Validator::validate($params->toArray(), PaymentEndToEndRules::rules()); - + return $this->post( self::END_TO_END_PAYMENT_ENDPOINT, $body @@ -42,6 +43,7 @@ final public function endToEndPayment(PaymentEndToEnd $params): ?array final public function emvPayment(PaymentEmv $params): ?array { $body = Validator::validate($params->toArray(), PaymentEmvRules::rules()); + return $this->post( self::EMV_PAYMENT_ENDPOINT, $body @@ -54,6 +56,7 @@ final public function emvPayment(PaymentEmv $params): ?array final public function statusPayment(PaymentStatus $params): ?array { $params = Validator::validate($params->toArray(), PaymentStatusRules::rules()); + return $this->get( sprintf( '%s?%s', @@ -69,6 +72,7 @@ final public function statusPayment(PaymentStatus $params): ?array final public function initPayment(PaymentInit $params): ?array { $body = Validator::validate($params->toArray(), PaymentInitRules::rules()); + return $this->post( self::INIT_PAYMENT_ENDPOINT, $body diff --git a/src/Clients/CelcoinPIXQR.php b/src/Clients/CelcoinPIXQR.php index b148bc4..dca1cca 100644 --- a/src/Clients/CelcoinPIXQR.php +++ b/src/Clients/CelcoinPIXQR.php @@ -10,18 +10,19 @@ class CelcoinPIXQR extends CelcoinBaseApi { - const CREATE_LOCATION_ENDPOINT = '/pix/v1/location'; - const GET_LOCATION_ENDPOINT = '/pix/v1/location/%d'; - const GET_QR_LOCATION_ENDPOINT = '/pix/v1/location/%d/base64'; + public const CREATE_LOCATION_ENDPOINT = '/pix/v1/location'; + + public const GET_LOCATION_ENDPOINT = '/pix/v1/location/%d'; + + public const GET_QR_LOCATION_ENDPOINT = '/pix/v1/location/%d/base64'; /** - * @param QRLocation $merchant - * @return array|null * @throws RequestException */ final public function createLocation(QRLocation $merchant): ?array { $body = Validator::validate($merchant->toArray(), QRLocationCreate::rules()); + return $this->post( self::CREATE_LOCATION_ENDPOINT, $body @@ -29,8 +30,6 @@ final public function createLocation(QRLocation $merchant): ?array } /** - * @param int $locationId - * @return array|null * @throws RequestException */ final public function getLocation(int $locationId): ?array @@ -41,8 +40,6 @@ final public function getLocation(int $locationId): ?array } /** - * @param int $locationId - * @return array|null * @throws RequestException */ final public function getQR(int $locationId): ?array diff --git a/src/Clients/CelcoinPIXReceivement.php b/src/Clients/CelcoinPIXReceivement.php index 9de0fb8..f8c3459 100644 --- a/src/Clients/CelcoinPIXReceivement.php +++ b/src/Clients/CelcoinPIXReceivement.php @@ -10,7 +10,7 @@ class CelcoinPIXReceivement extends CelcoinBaseApi { - const PIX_RECEIVEMENT_STATUS_ENDPOINT = '/pix/v1/receivement/status'; + public const PIX_RECEIVEMENT_STATUS_ENDPOINT = '/pix/v1/receivement/status'; /** * @throws RequestException @@ -18,8 +18,10 @@ class CelcoinPIXReceivement extends CelcoinBaseApi final public function getStatus(PixReceivementStatus $pixReceivementStatus): ?array { $params = Validator::validate($pixReceivementStatus->toArray(), PixReceivementStatusGet::rules()); + return $this->get( - sprintf('%s?%s', + sprintf( + '%s?%s', self::PIX_RECEIVEMENT_STATUS_ENDPOINT, http_build_query($params) ) diff --git a/src/Clients/CelcoinPIXReverse.php b/src/Clients/CelcoinPIXReverse.php index 989b02e..c97f83b 100644 --- a/src/Clients/CelcoinPIXReverse.php +++ b/src/Clients/CelcoinPIXReverse.php @@ -10,8 +10,9 @@ class CelcoinPIXReverse extends CelcoinBaseApi { - const PIX_REVERSE_CREATE_ENDPOINT = '/pix/v2/reverse/pi/%s'; - const PIX_REVERSE_GET_STATUS_ENDPOINT = '/pix/v2/reverse/pi/status'; + public const PIX_REVERSE_CREATE_ENDPOINT = '/pix/v2/reverse/pi/%s'; + + public const PIX_REVERSE_GET_STATUS_ENDPOINT = '/pix/v2/reverse/pi/status'; /** * @throws RequestException @@ -19,6 +20,7 @@ class CelcoinPIXReverse extends CelcoinBaseApi final public function create(string $transactionId, Types\PixReverseCreate $reverseCreate): ?array { $params = Validator::validate($reverseCreate->toArray(), Rules\PixReverseCreate::rules()); + return $this->post( sprintf(self::PIX_REVERSE_CREATE_ENDPOINT, $transactionId), $params @@ -31,6 +33,7 @@ final public function create(string $transactionId, Types\PixReverseCreate $reve final public function getStatus(Types\PixReverseGetStatus $getStatus): ?array { $params = Validator::validate($getStatus->toArray(), Rules\PixReverseGetStatus::rules()); + return $this->get( sprintf( '%s?%s', diff --git a/src/Clients/CelcoinPixStaticPayment.php b/src/Clients/CelcoinPixStaticPayment.php index d027556..495af1e 100644 --- a/src/Clients/CelcoinPixStaticPayment.php +++ b/src/Clients/CelcoinPixStaticPayment.php @@ -12,10 +12,13 @@ class CelcoinPixStaticPayment extends CelcoinBaseApi { - const CREATE_STATIC_PAYMENT_ENDPOINT = '/pix/v1/brcode/static'; - const GET_STATIC_PAYMENT_ENDPOINT = '/pix/v1/brcode/static/%d'; - const GET_STATIC_PAYMENT_QR_ENDPOINT = '/pix/v1/brcode/static/%d/base64'; - const GET_STATIC_PAYMENT_DATA_ENDPOINT = '/pix/v1/brcode/static'; + public const CREATE_STATIC_PAYMENT_ENDPOINT = '/pix/v1/brcode/static'; + + public const GET_STATIC_PAYMENT_ENDPOINT = '/pix/v1/brcode/static/%d'; + + public const GET_STATIC_PAYMENT_QR_ENDPOINT = '/pix/v1/brcode/static/%d/base64'; + + public const GET_STATIC_PAYMENT_DATA_ENDPOINT = '/pix/v1/brcode/static'; /** * @throws RequestException @@ -23,6 +26,7 @@ class CelcoinPixStaticPayment extends CelcoinBaseApi final public function create(QRStaticPayment $payment): ?array { $body = Validator::validate($payment->toArray(), QRStaticPaymentCreate::rules()); + return $this->post( self::CREATE_STATIC_PAYMENT_ENDPOINT, $body @@ -30,8 +34,6 @@ final public function create(QRStaticPayment $payment): ?array } /** - * @param int $transactionId - * @return array|null * @throws RequestException */ final public function getStaticPix(int $transactionId): ?array @@ -42,9 +44,6 @@ final public function getStaticPix(int $transactionId): ?array } /** - * @param int $transactionId - * @param array $params - * @return array|null * @throws RequestException */ final public function getStaticPaymentQR(int $transactionId, array $params = []): ?array @@ -52,14 +51,13 @@ final public function getStaticPaymentQR(int $transactionId, array $params = []) $params = Validator::validate($params, QRStaticPaymentGetQR::rules()); $url = sprintf(self::GET_STATIC_PAYMENT_QR_ENDPOINT, $transactionId); + return $this->get( sprintf('%s?%s', $url, http_build_query($params)) ); } /** - * @param array $params - * @return array|null * @throws RequestException */ final public function getStaticPaymentData(array $params): ?array diff --git a/src/Clients/CelcoinPixWebhooks.php b/src/Clients/CelcoinPixWebhooks.php index 455ebaa..d7a5032 100644 --- a/src/Clients/CelcoinPixWebhooks.php +++ b/src/Clients/CelcoinPixWebhooks.php @@ -11,24 +11,25 @@ class CelcoinPixWebhooks extends CelcoinBaseApi { - const PIX_WEBHOOK_GET_LIST_ENDPOINT = '/webhook-manager-webservice/v1/webhook/%s'; - const PIX_REACTIVATE_RESEND_PENDING_ENDPOINT = '/webhook-manager-webservice/v1/webhook/resend/%s'; - const RESEND_TRANSACTION_LIST_WEBHOOK = '/webhook-manager-webservice/v1/webhook/resendTransactionList/%s'; + public const PIX_WEBHOOK_GET_LIST_ENDPOINT = '/webhook-manager-webservice/v1/webhook/%s'; + + public const PIX_REACTIVATE_RESEND_PENDING_ENDPOINT = '/webhook-manager-webservice/v1/webhook/resend/%s'; + + public const RESEND_TRANSACTION_LIST_WEBHOOK = '/webhook-manager-webservice/v1/webhook/resendTransactionList/%s'; /** * @throws RequestException */ final public function getList( - WebhookEventEnum $webhookEvent, + WebhookEventEnum $webhookEvent, Types\PixWebhookGetList $webhookGetList - ): ?array - { + ): ?array { $params = Validator::validate($webhookGetList->toArray(), Rules\WebhookGetList::rules()); $url = sprintf(self::PIX_WEBHOOK_GET_LIST_ENDPOINT, $webhookEvent->value); if ($params) { - $url .= '?' . http_build_query($params); + $url .= '?'.http_build_query($params); } return $this->get( @@ -40,10 +41,9 @@ final public function getList( * @throws RequestException */ final public function reactivateAndResendAllPendingMessages( - WebhookEventEnum $webhookEvent, + WebhookEventEnum $webhookEvent, Types\PixReactivateAndResendAllPendingMessages $allPendingMessages - ): ?array - { + ): ?array { $params = Validator::validate( $allPendingMessages->toArray(), Rules\PixReactivateAndResendAllPendingMessages::rules() @@ -52,7 +52,7 @@ final public function reactivateAndResendAllPendingMessages( $url = sprintf(self::PIX_REACTIVATE_RESEND_PENDING_ENDPOINT, $webhookEvent->value); if ($params) { - $url .= '?' . http_build_query($params); + $url .= '?'.http_build_query($params); } return $this->post( @@ -65,10 +65,9 @@ final public function reactivateAndResendAllPendingMessages( * @throws RequestException */ final public function reactivateEventAndResendSpecifiedMessagesInList( - WebhookEventEnum $webhookEvent, + WebhookEventEnum $webhookEvent, Types\PixReactivateEventAndResendSpecifiedMessagesInList $resendSpecifiedMessagesInList - ): ?array - { + ): ?array { $params = Validator::validate( $resendSpecifiedMessagesInList->toArray(), Rules\PixReactivateEventAndResendSpecifiedMessagesInList::rules() @@ -81,5 +80,4 @@ final public function reactivateEventAndResendSpecifiedMessagesInList( $params ); } - } diff --git a/src/Clients/CelcoinReport.php b/src/Clients/CelcoinReport.php index 9a73f9a..18bfe1a 100644 --- a/src/Clients/CelcoinReport.php +++ b/src/Clients/CelcoinReport.php @@ -8,13 +8,14 @@ /** * Class CelcoinReport * Essa API possibilita que seja realizada a consulta de tipos de arquivos de conciliação e consulta de extrato consolidado.. - * @package WeDevBr\Celcoin */ class CelcoinReport extends CelcoinBaseApi { - const GET_CONCILIATION_FILE_TYPES_ENDPOINT = '/tools-conciliation/v1/exportfile/types'; - const CONCILIATION_FILE_ENDPOINT = '/tools-conciliation/v1/exportfile'; - const CONSOLIDATED_STATEMENT_ENDPOINT = '/tools-conciliation/v1/ConsolidatedStatement'; + public const GET_CONCILIATION_FILE_TYPES_ENDPOINT = '/tools-conciliation/v1/exportfile/types'; + + public const CONCILIATION_FILE_ENDPOINT = '/tools-conciliation/v1/exportfile'; + + public const CONSOLIDATED_STATEMENT_ENDPOINT = '/tools-conciliation/v1/ConsolidatedStatement'; public function getConciliationFileTypes() { diff --git a/src/Clients/CelcoinTopups.php b/src/Clients/CelcoinTopups.php index eb53434..6698d17 100644 --- a/src/Clients/CelcoinTopups.php +++ b/src/Clients/CelcoinTopups.php @@ -18,20 +18,25 @@ /** * Class CelcoinTopups * A API de Recargas Nacionais disponibiliza aos seus usuários a possibilidade de realizar recargas de telefonia e conteúdos digitais listados abaixo: - * @package WeDevBr\Celcoin */ class CelcoinTopups extends CelcoinBaseApi { - const GET_PROVIDERS_ENDPOINT = '/v5/transactions/topups/providers'; - const GET_PROVIDER_VALUES_ENDPOINT = '/v5/transactions/topups/provider-values'; - const CREATE_ENDPOINT = '/v5/transactions/topups'; - const CONFIRM_ENDPOINT = '/v5/transactions/topups/%d/capture'; - const CANCEL_ENDPOINT = '/v5/transactions/topups/%d/void'; - const FIND_PROVIDERS_ENDPOINT = '/v5/transactions/topups/find-providers'; + public const GET_PROVIDERS_ENDPOINT = '/v5/transactions/topups/providers'; + + public const GET_PROVIDER_VALUES_ENDPOINT = '/v5/transactions/topups/provider-values'; + + public const CREATE_ENDPOINT = '/v5/transactions/topups'; + + public const CONFIRM_ENDPOINT = '/v5/transactions/topups/%d/capture'; + + public const CANCEL_ENDPOINT = '/v5/transactions/topups/%d/void'; + + public const FIND_PROVIDERS_ENDPOINT = '/v5/transactions/topups/find-providers'; public function getProviders(Providers $data): mixed { $body = Validator::validate($data->toArray(), TopupsProviders::rules()); + return $this->get( self::GET_PROVIDERS_ENDPOINT, $body @@ -41,6 +46,7 @@ public function getProviders(Providers $data): mixed public function getProviderValues(ProvidersValues $data): mixed { $body = Validator::validate($data->toArray(), TopupsProvidersValues::rules()); + return $this->get( self::GET_PROVIDER_VALUES_ENDPOINT, $body @@ -50,6 +56,7 @@ public function getProviderValues(ProvidersValues $data): mixed public function create(Create $data): mixed { $body = Validator::validate($data->toArray(), TopupsCreate::rules()); + return $this->post( self::CREATE_ENDPOINT, $body @@ -59,6 +66,7 @@ public function create(Create $data): mixed public function confirm(int $transactionId, Confirm $data): mixed { $body = Validator::validate($data->toArray(), TopupsConfirm::rules()); + return $this->put( sprintf(self::CONFIRM_ENDPOINT, $transactionId), $body @@ -68,6 +76,7 @@ public function confirm(int $transactionId, Confirm $data): mixed public function cancel(int $transactionId, Cancel $data): mixed { $body = Validator::validate($data->toArray(), TopupsCancel::rules()); + return $this->delete( sprintf(self::CANCEL_ENDPOINT, $transactionId), $body diff --git a/src/Common/CelcoinBaseApi.php b/src/Common/CelcoinBaseApi.php index 5fcc9d7..5c461f9 100644 --- a/src/Common/CelcoinBaseApi.php +++ b/src/Common/CelcoinBaseApi.php @@ -14,7 +14,6 @@ class CelcoinBaseApi { public const CACHE_NAME = 'celcoin_login_token'; - /** @var Cache */ public Cache $cache; /** @var ?string */ @@ -61,12 +60,14 @@ public function getToken(): ?string $this->token = $this->auth->getToken(); Cache::put($this::CACHE_NAME, $this->token, 2400); } + return $this->token; } public function setPassphrase(string $passPhrase): self { $this->mtlsPassphrase = $passPhrase; + return $this; } @@ -95,13 +96,13 @@ public function get(string $endpoint, array|string|null $query = null, $response /** * @throws RequestException */ - public function post(string $endpoint, array $body = [], Attachable $attachment = null) + public function post(string $endpoint, array $body = [], ?Attachable $attachment = null) { $token = $this->getToken() ?? $this->auth->getToken(); $request = Http::withToken($token) ->withHeaders([ 'accept' => 'application/json', - 'content-type' => 'application/json' + 'content-type' => 'application/json', ]); if ($this->mtlsCert && $this->mtlsKey && $this->mtlsPassphrase) { @@ -129,8 +130,7 @@ public function post(string $endpoint, array $body = [], Attachable $attachment public function put( string $endpoint, ?array $body = null, - ): mixed - { + ): mixed { $token = $this->getToken() ?? $this->auth->getToken(); $request = Http::withToken($token) ->withHeaders([ @@ -154,8 +154,7 @@ public function patch( string $endpoint, ?array $body = null, bool $asJson = false - ): mixed - { + ): mixed { $body_format = $asJson ? 'json' : 'form_params'; $token = $this->getToken() ?? $this->auth->getToken(); $request = Http::withToken($token) @@ -191,9 +190,6 @@ public function delete(string $endpoint, ?array $body = null): mixed ->json(); } - /** - * @return PendingRequest - */ public function setRequestMtls(PendingRequest $request): PendingRequest { $options = []; @@ -215,12 +211,14 @@ public function setRequestMtls(PendingRequest $request): PendingRequest if ($options) { $request = $request->withOptions($options); } + return $request; } public function getFinalUrl(string $endpoint): string { $characters = " \t\n\r\0\x0B/"; - return rtrim($this->api_url, $characters) . "/" . ltrim($endpoint, $characters); + + return rtrim($this->api_url, $characters).'/'.ltrim($endpoint, $characters); } } diff --git a/src/Enums/AccountOnboardingTypeEnum.php b/src/Enums/AccountOnboardingTypeEnum.php index 568f2e2..9648d43 100644 --- a/src/Enums/AccountOnboardingTypeEnum.php +++ b/src/Enums/AccountOnboardingTypeEnum.php @@ -4,6 +4,6 @@ enum AccountOnboardingTypeEnum: string { - case BANK_ACCOUNT = "BANKACCOUNT"; - case GRAPHIC_ACCOUNT = "GRAPHICACCOUNT"; + case BANK_ACCOUNT = 'BANKACCOUNT'; + case GRAPHIC_ACCOUNT = 'GRAPHICACCOUNT'; } diff --git a/src/Enums/AccountTypeEnum.php b/src/Enums/AccountTypeEnum.php index efb0c97..9256de4 100644 --- a/src/Enums/AccountTypeEnum.php +++ b/src/Enums/AccountTypeEnum.php @@ -4,5 +4,5 @@ enum AccountTypeEnum: string { - case CHECKING_ACCOUNT = "CC"; + case CHECKING_ACCOUNT = 'CC'; } diff --git a/src/Enums/ClaimAnswerReasonEnum.php b/src/Enums/ClaimAnswerReasonEnum.php index d045ac5..5b676de 100644 --- a/src/Enums/ClaimAnswerReasonEnum.php +++ b/src/Enums/ClaimAnswerReasonEnum.php @@ -4,9 +4,8 @@ enum ClaimAnswerReasonEnum: string { - - case USER_REQUESTED = 'USER_REQUESTED'; - case ACCOUNT_CLOSURE = 'ACCOUNT_CLOSURE'; - case FRAUD = 'FRAUD'; - case DEFAULT_OPERATION = 'DEFAULT_OPERATION'; -} \ No newline at end of file + case USER_REQUESTED = 'USER_REQUESTED'; + case ACCOUNT_CLOSURE = 'ACCOUNT_CLOSURE'; + case FRAUD = 'FRAUD'; + case DEFAULT_OPERATION = 'DEFAULT_OPERATION'; +} diff --git a/src/Enums/ClaimKeyTypeEnum.php b/src/Enums/ClaimKeyTypeEnum.php index b4502ee..c222824 100644 --- a/src/Enums/ClaimKeyTypeEnum.php +++ b/src/Enums/ClaimKeyTypeEnum.php @@ -4,9 +4,8 @@ enum ClaimKeyTypeEnum: string { - - case CPF = 'CPF'; - case CNPJ = 'CNPJ'; - case EMAIL = 'EMAIL'; - case PHONE = 'PHONE'; -} \ No newline at end of file + case CPF = 'CPF'; + case CNPJ = 'CNPJ'; + case EMAIL = 'EMAIL'; + case PHONE = 'PHONE'; +} diff --git a/src/Enums/ClaimTypeEnum.php b/src/Enums/ClaimTypeEnum.php index b1bdde6..0ad5842 100644 --- a/src/Enums/ClaimTypeEnum.php +++ b/src/Enums/ClaimTypeEnum.php @@ -4,7 +4,6 @@ enum ClaimTypeEnum: string { - - case PORTABILITY = 'PORTABILITY'; - case OWNERSHIP = 'OWNERSHIP'; -} \ No newline at end of file + case PORTABILITY = 'PORTABILITY'; + case OWNERSHIP = 'OWNERSHIP'; +} diff --git a/src/Enums/HealthCheckPeriodEnum.php b/src/Enums/HealthCheckPeriodEnum.php index c273859..db8a189 100644 --- a/src/Enums/HealthCheckPeriodEnum.php +++ b/src/Enums/HealthCheckPeriodEnum.php @@ -4,8 +4,8 @@ enum HealthCheckPeriodEnum: string { - case LAST_10_MINUTE = "0"; - case LAST_HOUR = "1"; - case LAST_2_HOURS = "2"; - case LAST_24_HOURS = "3"; + case LAST_10_MINUTE = '0'; + case LAST_HOUR = '1'; + case LAST_2_HOURS = '2'; + case LAST_24_HOURS = '3'; } diff --git a/src/Enums/HealthCheckTypeEnum.php b/src/Enums/HealthCheckTypeEnum.php index 0530099..1ea3bda 100644 --- a/src/Enums/HealthCheckTypeEnum.php +++ b/src/Enums/HealthCheckTypeEnum.php @@ -4,7 +4,7 @@ enum HealthCheckTypeEnum: string { - case ACCOUNT_DATA_QUERY = "CONSULTADADOSCONTA"; - case RECEIVE_BILL = "RECEBERCONTA"; - case RECHARGE = "RECARGA"; + case ACCOUNT_DATA_QUERY = 'CONSULTADADOSCONTA'; + case RECEIVE_BILL = 'RECEBERCONTA'; + case RECHARGE = 'RECARGA'; } diff --git a/src/Enums/InstitutionsTypeEnum.php b/src/Enums/InstitutionsTypeEnum.php index 845b78a..ca62574 100644 --- a/src/Enums/InstitutionsTypeEnum.php +++ b/src/Enums/InstitutionsTypeEnum.php @@ -4,6 +4,6 @@ enum InstitutionsTypeEnum: string { - case NATIONAL = "NACIONAL"; - case STATE = "ESTADUAL"; + case NATIONAL = 'NACIONAL'; + case STATE = 'ESTADUAL'; } diff --git a/src/Enums/TopupProvidersTypeEnum.php b/src/Enums/TopupProvidersTypeEnum.php index 967d9bf..1423bac 100644 --- a/src/Enums/TopupProvidersTypeEnum.php +++ b/src/Enums/TopupProvidersTypeEnum.php @@ -4,7 +4,7 @@ enum TopupProvidersTypeEnum: string { - case ALL = "0"; - case PIN = "1"; - case ONLINE = "2"; + case ALL = '0'; + case PIN = '1'; + case ONLINE = '2'; } diff --git a/src/Events/CelcoinAuthenticatedEvent.php b/src/Events/CelcoinAuthenticatedEvent.php index 6605e58..9d3e277 100644 --- a/src/Events/CelcoinAuthenticatedEvent.php +++ b/src/Events/CelcoinAuthenticatedEvent.php @@ -4,14 +4,8 @@ class CelcoinAuthenticatedEvent { - /** - * @var string - */ public string $token; - /** - * @var string - */ public string $tokenExpiry; /** diff --git a/src/Facades/CelcoinFacade.php b/src/Facades/CelcoinFacade.php index 71b13dd..cae4eeb 100644 --- a/src/Facades/CelcoinFacade.php +++ b/src/Facades/CelcoinFacade.php @@ -31,14 +31,11 @@ * @uses Celcoin::clientPIXReverse * @uses Celcoin::clientPixWebhooks * @uses Celcoin::clientKyc - * */ class CelcoinFacade extends Facade { /** * Get the registered name of the component. - * - * @return string */ protected static function getFacadeAccessor(): string { diff --git a/src/Interfaces/Attachable.php b/src/Interfaces/Attachable.php index 8abb0f0..2be6cff 100644 --- a/src/Interfaces/Attachable.php +++ b/src/Interfaces/Attachable.php @@ -9,4 +9,4 @@ public function getField(): string; public function getContents(); public function getFileName(); -} \ No newline at end of file +} diff --git a/src/Rules/BAAS/AccountBusiness.php b/src/Rules/BAAS/AccountBusiness.php index f60648a..1acc657 100644 --- a/src/Rules/BAAS/AccountBusiness.php +++ b/src/Rules/BAAS/AccountBusiness.php @@ -10,42 +10,42 @@ class AccountBusiness public static function rules() { return [ - "clientCode" => ['required', 'string'], - "accountOnboardingType" => ['required', Rule::in(array_column(AccountOnboardingTypeEnum::cases(), 'value'))], - "documentNumber" => ['required', 'max_digits:14'], - "contactNumber" => ['required', 'starts_with:+', 'regex:/(\+55)\d{10,11}/'], - "businessEmail" => ['required', 'email'], - "businessName" => ['required', 'string'], - "tradingName" => ['required', 'string'], - "owner" => ['nullable', 'array'], - "owner.*.documentNumber" => ['required', 'max_digits:11'], - "owner.*.fullName" => ['required', 'string'], - "owner.*.phoneNumber" => ['required', 'starts_with:+', 'regex:/(\+55)\d{10,11}/'], - "owner.*.email" => ['required', 'email'], - "owner.*.motherName" => ['required', 'string'], - "owner.*.socialName" => ['nullable', 'string'], - "owner.*.birthDate" => ['required', 'date_format:d-m-Y'], - "owner.*.address" => ['nullable', 'array'], - "owner.*.address.postalCode" => ['required', 'digits:8'], - "owner.*.address.street" => ['required', 'string'], - "owner.*.address.number" => ['nullable', 'string'], - "owner.*.address.addressComplement" => ['nullable', 'string'], - "owner.*.address.neighborhood" => ['required', 'string'], - "owner.*.address.city" => ['required', 'string'], - "owner.*.address.state" => ['required', 'string'], - "owner.*.address.longitude" => ['nullable', 'string'], - "owner.*.address.latitude" => ['nullable', 'string'], - "owner.*.isPoliticallyExposedPerson" => ['required', 'boolean'], - "businessAddress" => ['nullable', 'array'], - "businessAddress.postalCode" => ['required', 'digits:8'], - "businessAddress.street" => ['required', 'string'], - "businessAddress.number" => ['nullable', 'string'], - "businessAddress.addressComplement" => ['nullable', 'string'], - "businessAddress.neighborhood" => ['required', 'string'], - "businessAddress.city" => ['required', 'string'], - "businessAddress.state" => ['required', 'string'], - "businessAddress.longitude" => ['nullable', 'string'], - "businessAddress.latitude" => ['nullable', 'string'], + 'clientCode' => ['required', 'string'], + 'accountOnboardingType' => ['required', Rule::in(array_column(AccountOnboardingTypeEnum::cases(), 'value'))], + 'documentNumber' => ['required', 'max_digits:14'], + 'contactNumber' => ['required', 'starts_with:+', 'regex:/(\+55)\d{10,11}/'], + 'businessEmail' => ['required', 'email'], + 'businessName' => ['required', 'string'], + 'tradingName' => ['required', 'string'], + 'owner' => ['nullable', 'array'], + 'owner.*.documentNumber' => ['required', 'max_digits:11'], + 'owner.*.fullName' => ['required', 'string'], + 'owner.*.phoneNumber' => ['required', 'starts_with:+', 'regex:/(\+55)\d{10,11}/'], + 'owner.*.email' => ['required', 'email'], + 'owner.*.motherName' => ['required', 'string'], + 'owner.*.socialName' => ['nullable', 'string'], + 'owner.*.birthDate' => ['required', 'date_format:d-m-Y'], + 'owner.*.address' => ['nullable', 'array'], + 'owner.*.address.postalCode' => ['required', 'digits:8'], + 'owner.*.address.street' => ['required', 'string'], + 'owner.*.address.number' => ['nullable', 'string'], + 'owner.*.address.addressComplement' => ['nullable', 'string'], + 'owner.*.address.neighborhood' => ['required', 'string'], + 'owner.*.address.city' => ['required', 'string'], + 'owner.*.address.state' => ['required', 'string'], + 'owner.*.address.longitude' => ['nullable', 'string'], + 'owner.*.address.latitude' => ['nullable', 'string'], + 'owner.*.isPoliticallyExposedPerson' => ['required', 'boolean'], + 'businessAddress' => ['nullable', 'array'], + 'businessAddress.postalCode' => ['required', 'digits:8'], + 'businessAddress.street' => ['required', 'string'], + 'businessAddress.number' => ['nullable', 'string'], + 'businessAddress.addressComplement' => ['nullable', 'string'], + 'businessAddress.neighborhood' => ['required', 'string'], + 'businessAddress.city' => ['required', 'string'], + 'businessAddress.state' => ['required', 'string'], + 'businessAddress.longitude' => ['nullable', 'string'], + 'businessAddress.latitude' => ['nullable', 'string'], ]; } } diff --git a/src/Rules/BAAS/AccountManagerBusiness.php b/src/Rules/BAAS/AccountManagerBusiness.php index 1c2d202..1967188 100644 --- a/src/Rules/BAAS/AccountManagerBusiness.php +++ b/src/Rules/BAAS/AccountManagerBusiness.php @@ -7,37 +7,37 @@ class AccountManagerBusiness public static function rules() { return [ - "businessEmail" => ['required', 'email'], - "contactNumber" => ['required', 'starts_with:+', 'regex:/(\+55)\d{10,11}/'], - "owners" => ['nullable', 'array'], - "owners.*.documentNumber" => ['required', 'max_digits:11'], - "owners.*.fullName" => ['required', 'string'], - "owners.*.phoneNumber" => ['required', 'starts_with:+', 'regex:/(\+55)\d{10,11}/'], - "owners.*.email" => ['required', 'email'], - "owners.*.motherName" => ['required', 'string'], - "owners.*.socialName" => ['nullable', 'string'], - "owners.*.birthDate" => ['required', 'date_format:d-m-Y'], - "owners.*.address" => ['nullable', 'array'], - "owners.*.address.postalCode" => ['required', 'digits:8'], - "owners.*.address.street" => ['required', 'string'], - "owners.*.address.number" => ['nullable', 'string'], - "owners.*.address.addressComplement" => ['nullable', 'string'], - "owners.*.address.neighborhood" => ['required', 'string'], - "owners.*.address.city" => ['required', 'string'], - "owners.*.address.state" => ['required', 'string'], - "owners.*.address.longitude" => ['nullable', 'string'], - "owners.*.address.latitude" => ['nullable', 'string'], - "owners.*.isPoliticallyExposedPerson" => ['required', 'boolean'], - "businessAddress" => ['nullable', 'array'], - "businessAddress.postalCode" => ['required', 'digits:8'], - "businessAddress.street" => ['required', 'string'], - "businessAddress.number" => ['nullable', 'string'], - "businessAddress.addressComplement" => ['nullable', 'string'], - "businessAddress.neighborhood" => ['required', 'string'], - "businessAddress.city" => ['required', 'string'], - "businessAddress.state" => ['required', 'string'], - "businessAddress.longitude" => ['nullable', 'string'], - "businessAddress.latitude" => ['nullable', 'string'], + 'businessEmail' => ['required', 'email'], + 'contactNumber' => ['required', 'starts_with:+', 'regex:/(\+55)\d{10,11}/'], + 'owners' => ['nullable', 'array'], + 'owners.*.documentNumber' => ['required', 'max_digits:11'], + 'owners.*.fullName' => ['required', 'string'], + 'owners.*.phoneNumber' => ['required', 'starts_with:+', 'regex:/(\+55)\d{10,11}/'], + 'owners.*.email' => ['required', 'email'], + 'owners.*.motherName' => ['required', 'string'], + 'owners.*.socialName' => ['nullable', 'string'], + 'owners.*.birthDate' => ['required', 'date_format:d-m-Y'], + 'owners.*.address' => ['nullable', 'array'], + 'owners.*.address.postalCode' => ['required', 'digits:8'], + 'owners.*.address.street' => ['required', 'string'], + 'owners.*.address.number' => ['nullable', 'string'], + 'owners.*.address.addressComplement' => ['nullable', 'string'], + 'owners.*.address.neighborhood' => ['required', 'string'], + 'owners.*.address.city' => ['required', 'string'], + 'owners.*.address.state' => ['required', 'string'], + 'owners.*.address.longitude' => ['nullable', 'string'], + 'owners.*.address.latitude' => ['nullable', 'string'], + 'owners.*.isPoliticallyExposedPerson' => ['required', 'boolean'], + 'businessAddress' => ['nullable', 'array'], + 'businessAddress.postalCode' => ['required', 'digits:8'], + 'businessAddress.street' => ['required', 'string'], + 'businessAddress.number' => ['nullable', 'string'], + 'businessAddress.addressComplement' => ['nullable', 'string'], + 'businessAddress.neighborhood' => ['required', 'string'], + 'businessAddress.city' => ['required', 'string'], + 'businessAddress.state' => ['required', 'string'], + 'businessAddress.longitude' => ['nullable', 'string'], + 'businessAddress.latitude' => ['nullable', 'string'], ]; } } diff --git a/src/Rules/BAAS/AccountManagerNaturalPerson.php b/src/Rules/BAAS/AccountManagerNaturalPerson.php index 9c0f794..bb8788f 100644 --- a/src/Rules/BAAS/AccountManagerNaturalPerson.php +++ b/src/Rules/BAAS/AccountManagerNaturalPerson.php @@ -7,20 +7,20 @@ class AccountManagerNaturalPerson public static function rules() { return [ - "phoneNumber" => ['required', 'starts_with:+', 'regex:/(\+55)\d{10,11}/'], - "email" => ['required', 'string'], - "socialName" => ['required', 'string'], - "address" => ['required', 'array'], - "address.postalCode" => ['required', 'digits:8'], - "address.street" => ['required', 'string'], - "address.number" => ['nullable', 'string'], - "address.addressComplement" => ['nullable', 'string'], - "address.neighborhood" => ['required', 'string'], - "address.city" => ['required', 'string'], - "address.state" => ['required', 'string'], - "address.longitude" => ['nullable', 'string'], - "address.latitude" => ['nullable', 'string'], - "isPoliticallyExposedPerson" => ['required', 'boolean'] + 'phoneNumber' => ['required', 'starts_with:+', 'regex:/(\+55)\d{10,11}/'], + 'email' => ['required', 'string'], + 'socialName' => ['required', 'string'], + 'address' => ['required', 'array'], + 'address.postalCode' => ['required', 'digits:8'], + 'address.street' => ['required', 'string'], + 'address.number' => ['nullable', 'string'], + 'address.addressComplement' => ['nullable', 'string'], + 'address.neighborhood' => ['required', 'string'], + 'address.city' => ['required', 'string'], + 'address.state' => ['required', 'string'], + 'address.longitude' => ['nullable', 'string'], + 'address.latitude' => ['nullable', 'string'], + 'isPoliticallyExposedPerson' => ['required', 'boolean'], ]; } } diff --git a/src/Rules/BAAS/AccountNaturalPerson.php b/src/Rules/BAAS/AccountNaturalPerson.php index d5c527f..a9206f1 100644 --- a/src/Rules/BAAS/AccountNaturalPerson.php +++ b/src/Rules/BAAS/AccountNaturalPerson.php @@ -10,26 +10,26 @@ class AccountNaturalPerson public static function rules() { return [ - "clientCode" => ['required', 'string'], - "accountOnboardingType" => ['required', Rule::in(array_column(AccountOnboardingTypeEnum::cases(), 'value'))], - "documentNumber" => ['required', 'max_digits:11'], - "phoneNumber" => ['required', 'starts_with:+', 'regex:/(\+55)\d{10,11}/'], - "email" => ['required', 'email'], - "motherName" => ['required', 'string'], - "fullName" => ['required', 'string'], - "socialName" => ['required', 'string'], - "birthDate" => ['required', 'date_format:d-m-Y'], - "address" => ['required', 'array'], - "address.postalCode" => ['required', 'digits:8'], - "address.street" => ['required', 'string'], - "address.number" => ['nullable', 'string'], - "address.addressComplement" => ['nullable', 'string'], - "address.neighborhood" => ['required', 'string'], - "address.city" => ['required', 'string'], - "address.state" => ['required', 'string'], - "address.longitude" => ['nullable', 'string'], - "address.latitude" => ['nullable', 'string'], - "isPoliticallyExposedPerson" => ['required', 'boolean'] + 'clientCode' => ['required', 'string'], + 'accountOnboardingType' => ['required', Rule::in(array_column(AccountOnboardingTypeEnum::cases(), 'value'))], + 'documentNumber' => ['required', 'max_digits:11'], + 'phoneNumber' => ['required', 'starts_with:+', 'regex:/(\+55)\d{10,11}/'], + 'email' => ['required', 'email'], + 'motherName' => ['required', 'string'], + 'fullName' => ['required', 'string'], + 'socialName' => ['required', 'string'], + 'birthDate' => ['required', 'date_format:d-m-Y'], + 'address' => ['required', 'array'], + 'address.postalCode' => ['required', 'digits:8'], + 'address.street' => ['required', 'string'], + 'address.number' => ['nullable', 'string'], + 'address.addressComplement' => ['nullable', 'string'], + 'address.neighborhood' => ['required', 'string'], + 'address.city' => ['required', 'string'], + 'address.state' => ['required', 'string'], + 'address.longitude' => ['nullable', 'string'], + 'address.latitude' => ['nullable', 'string'], + 'isPoliticallyExposedPerson' => ['required', 'boolean'], ]; } } diff --git a/src/Rules/BAAS/AccountRelease.php b/src/Rules/BAAS/AccountRelease.php index cdcb79e..c8ab112 100644 --- a/src/Rules/BAAS/AccountRelease.php +++ b/src/Rules/BAAS/AccountRelease.php @@ -10,10 +10,10 @@ class AccountRelease public static function rules() { return [ - "clientCode" => ['nullable', 'string'], - "amount" => ['nullable', 'decimal:0,2'], - "type" => ['nullable', Rule::in(array_column(TypeReleaseEnum::cases(), 'value'))], - "description" => ['nullable', 'string', 'max:250'], + 'clientCode' => ['nullable', 'string'], + 'amount' => ['nullable', 'decimal:0,2'], + 'type' => ['nullable', Rule::in(array_column(TypeReleaseEnum::cases(), 'value'))], + 'description' => ['nullable', 'string', 'max:250'], ]; } } diff --git a/src/Rules/BAAS/BAASGetTEFTransfer.php b/src/Rules/BAAS/BAASGetTEFTransfer.php index 83af133..73b0ccb 100644 --- a/src/Rules/BAAS/BAASGetTEFTransfer.php +++ b/src/Rules/BAAS/BAASGetTEFTransfer.php @@ -12,4 +12,4 @@ public static function rules(): array 'EndToEndId' => ['sometimes', 'string', 'required_without_all:ClientRequestId,Id'], ]; } -} \ No newline at end of file +} diff --git a/src/Rules/BAAS/BAASTEFTransfer.php b/src/Rules/BAAS/BAASTEFTransfer.php index 9e2dde5..0a0826c 100644 --- a/src/Rules/BAAS/BAASTEFTransfer.php +++ b/src/Rules/BAAS/BAASTEFTransfer.php @@ -10,10 +10,10 @@ public static function rules(): array 'amount' => ['required', 'decimal:0,2', 'min:0.01'], 'clientRequestId' => ['required', 'string', 'max:200'], 'debitParty' => ['required', 'array'], - 'debitParty.account' => ['required', 'string',], + 'debitParty.account' => ['required', 'string'], 'creditParty' => ['required', 'array'], - 'creditParty.account' => ['required', 'string', 'different:debitParty.account',], + 'creditParty.account' => ['required', 'string', 'different:debitParty.account'], 'description' => ['sometimes', 'string'], ]; } -} \ No newline at end of file +} diff --git a/src/Rules/BAAS/BillPaymentRule.php b/src/Rules/BAAS/BillPaymentRule.php index 3e150d2..9995976 100644 --- a/src/Rules/BAAS/BillPaymentRule.php +++ b/src/Rules/BAAS/BillPaymentRule.php @@ -17,10 +17,10 @@ public static function rules(): array 'tags' => ['sometimes', 'nullable', 'array'], 'tags.*.key' => ['required_if:tags', 'string'], 'tags.*.value' => ['required_if:tags', 'string'], - "barCodeInfo" => ['required', 'array'], - "barCodeInfo.type" => ['required', Rule::in(array_column(BarCodeTypeEnum::cases(), 'value'))], - "barCodeInfo.digitable" => ['nullable', 'string'], - "barCodeInfo.barCode" => ['nullable', 'string'], + 'barCodeInfo' => ['required', 'array'], + 'barCodeInfo.type' => ['required', Rule::in(array_column(BarCodeTypeEnum::cases(), 'value'))], + 'barCodeInfo.digitable' => ['nullable', 'string'], + 'barCodeInfo.barCode' => ['nullable', 'string'], ]; } -} \ No newline at end of file +} diff --git a/src/Rules/BAAS/Billet.php b/src/Rules/BAAS/Billet.php index 7085aac..9a51aee 100644 --- a/src/Rules/BAAS/Billet.php +++ b/src/Rules/BAAS/Billet.php @@ -24,14 +24,14 @@ public static function rules(): array 'debtor.city' => ['required'], 'debtor.state' => ['required'], 'receiver.document' => ['required'], - 'receiver.account' => ['required','numeric'], + 'receiver.account' => ['required', 'numeric'], 'instructions' => ['sometimes', 'array', 'nullable'], - 'instructions.discount' => ['required_with:instructions','array'], - 'instructions.discount.amount' => ['required_with:discount','decimal:0,2'], + 'instructions.discount' => ['required_with:instructions', 'array'], + 'instructions.discount.amount' => ['required_with:discount', 'decimal:0,2'], 'instructions.discount.modality' => ['required_with:discount'], 'instructions.discount.limitDate' => ['required_with:discount', 'date'], - 'instructions.fine' => ['nullable','decimal:0,2'], - 'instructions.interest' => ['nullable','decimal:0,2'], + 'instructions.fine' => ['nullable', 'decimal:0,2'], + 'instructions.interest' => ['nullable', 'decimal:0,2'], 'split' => ['sometimes', 'array'], 'split.*.account' => ['nullable', 'numeric'], 'split.*.document' => ['nullable'], diff --git a/src/Rules/BAAS/EditWebhooks.php b/src/Rules/BAAS/EditWebhooks.php index dfecfc3..321816c 100644 --- a/src/Rules/BAAS/EditWebhooks.php +++ b/src/Rules/BAAS/EditWebhooks.php @@ -10,13 +10,13 @@ class EditWebhooks public static function rules() { return [ - "entity" => ['required', Rule::in(array_column(EntityWebhookBAASEnum::cases(), 'value'))], - "webhookUrl" => ['required', 'string'], - "auth" => ['nullable', 'array'], - "auth.login" => ['nullable', 'string'], - "auth.pwd" => ['nullable', 'string'], - "auth.type" => ['nullable', 'string'], - "active" => ['nullable', 'boolean'], + 'entity' => ['required', Rule::in(array_column(EntityWebhookBAASEnum::cases(), 'value'))], + 'webhookUrl' => ['required', 'string'], + 'auth' => ['nullable', 'array'], + 'auth.login' => ['nullable', 'string'], + 'auth.pwd' => ['nullable', 'string'], + 'auth.type' => ['nullable', 'string'], + 'active' => ['nullable', 'boolean'], ]; } } diff --git a/src/Rules/BAAS/GetPaymentStatusRule.php b/src/Rules/BAAS/GetPaymentStatusRule.php index 6e79037..1c47255 100644 --- a/src/Rules/BAAS/GetPaymentStatusRule.php +++ b/src/Rules/BAAS/GetPaymentStatusRule.php @@ -11,4 +11,4 @@ public static function rules(): array 'Id' => ['sometimes', 'nullable', 'string'], ]; } -} \ No newline at end of file +} diff --git a/src/Rules/BAAS/PixCashOut.php b/src/Rules/BAAS/PixCashOut.php index 49fdb72..3fc1263 100644 --- a/src/Rules/BAAS/PixCashOut.php +++ b/src/Rules/BAAS/PixCashOut.php @@ -14,8 +14,6 @@ class PixCashOut /** * @see https://developers.celcoin.com.br/docs/realizar-um-pix-cash-out-por-chaves-pix * @see https://developers.celcoin.com.br/docs/realizar-um-pix-cash-out - * @param string $initiationTypeEnum - * @return array */ public static function rules(string $initiationTypeEnum): array { @@ -64,8 +62,9 @@ private static function defaultRules(): array 'creditParty.name' => ['sometimes', 'string'], 'creditParty.accountType' => [ 'sometimes', - Rule::in(array_column(CreditPartyAccountTypeEnum::cases(), 'value') - ) + Rule::in( + array_column(CreditPartyAccountTypeEnum::cases(), 'value') + ), ], ]; } diff --git a/src/Rules/BAAS/RegisterPixKey.php b/src/Rules/BAAS/RegisterPixKey.php index 8402071..5cecdc4 100644 --- a/src/Rules/BAAS/RegisterPixKey.php +++ b/src/Rules/BAAS/RegisterPixKey.php @@ -11,9 +11,9 @@ class RegisterPixKey extends Data public static function rules() { return [ - "account" => ['required', 'string'], - "keyType" => ['required', Rule::enum(PixKeyTypeEnum::class)], - "key" => ['required_unless:keyType,EVP', 'string'], + 'account' => ['required', 'string'], + 'keyType' => ['required', Rule::enum(PixKeyTypeEnum::class)], + 'key' => ['required_unless:keyType,EVP', 'string'], ]; } } diff --git a/src/Rules/BAAS/RegisterWebhooks.php b/src/Rules/BAAS/RegisterWebhooks.php index b5ce41f..4d2de21 100644 --- a/src/Rules/BAAS/RegisterWebhooks.php +++ b/src/Rules/BAAS/RegisterWebhooks.php @@ -10,12 +10,12 @@ class RegisterWebhooks public static function rules() { return [ - "entity" => ['required', Rule::in(array_column(EntityWebhookBAASEnum::cases(), 'value'))], - "webhookUrl" => ['required', 'string'], - "auth" => ['nullable', 'array'], - "auth.login" => ['nullable', 'string'], - "auth.pwd" => ['nullable', 'string'], - "auth.type" => ['nullable', 'string'], + 'entity' => ['required', Rule::in(array_column(EntityWebhookBAASEnum::cases(), 'value'))], + 'webhookUrl' => ['required', 'string'], + 'auth' => ['nullable', 'array'], + 'auth.login' => ['nullable', 'string'], + 'auth.pwd' => ['nullable', 'string'], + 'auth.type' => ['nullable', 'string'], ]; } } diff --git a/src/Rules/BAAS/TEDTransfer.php b/src/Rules/BAAS/TEDTransfer.php index 19a14c6..f6a298f 100644 --- a/src/Rules/BAAS/TEDTransfer.php +++ b/src/Rules/BAAS/TEDTransfer.php @@ -22,7 +22,7 @@ public static function rules() 'creditParty.accountType' => ['required', 'string'], 'creditParty.personType' => ['required', 'string'], 'clientFinality' => ['required', 'string'], - 'description' => ['some', 'required_if:clientFinality,' . ClientFinalityEnum::OTHERS->value, 'string'], + 'description' => ['some', 'required_if:clientFinality,'.ClientFinalityEnum::OTHERS->value, 'string'], ]; } } diff --git a/src/Rules/BankTransfer/Create.php b/src/Rules/BankTransfer/Create.php index c60644c..6c61c83 100644 --- a/src/Rules/BankTransfer/Create.php +++ b/src/Rules/BankTransfer/Create.php @@ -10,17 +10,17 @@ class Create public static function rules() { return [ - "document" => ['required', 'string'], - "externalTerminal" => ['required', 'string'], - "externalNSU" => ['nullable', 'integer'], - "accountCode" => ['required', 'string'], - "digitCode" => ['nullable', 'string'], - "branchCode" => ['required', 'string'], - "institutionCode" => ['nullable', 'integer'], - "name" => ['nullable', 'string'], - "value" => ['required', 'decimal:0,2'], - "bankAccountType" => ['nullable', Rule::in(array_column(AccountTypeEnum::cases(), 'value'))], - "institutionIspb" => ['nullable', 'string'] + 'document' => ['required', 'string'], + 'externalTerminal' => ['required', 'string'], + 'externalNSU' => ['nullable', 'integer'], + 'accountCode' => ['required', 'string'], + 'digitCode' => ['nullable', 'string'], + 'branchCode' => ['required', 'string'], + 'institutionCode' => ['nullable', 'integer'], + 'name' => ['nullable', 'string'], + 'value' => ['required', 'decimal:0,2'], + 'bankAccountType' => ['nullable', Rule::in(array_column(AccountTypeEnum::cases(), 'value'))], + 'institutionIspb' => ['nullable', 'string'], ]; } } diff --git a/src/Rules/BillPayments/Authorize.php b/src/Rules/BillPayments/Authorize.php index d5ecdd2..51685c2 100644 --- a/src/Rules/BillPayments/Authorize.php +++ b/src/Rules/BillPayments/Authorize.php @@ -10,12 +10,12 @@ class Authorize public static function rules() { return [ - "externalTerminal" => ['nullable', 'string'], - "externalNSU" => ['nullable', 'numeric'], - "barCode" => ['required', 'array'], - "barCode.type" => ['required', Rule::in(array_column(BarCodeTypeEnum::cases(), 'value'))], - "barCode.digitable" => ['required_without:barCode.barCode', 'string'], - "barCode.barCode" => ['required_without:barCode.digitable', 'string'] + 'externalTerminal' => ['nullable', 'string'], + 'externalNSU' => ['nullable', 'numeric'], + 'barCode' => ['required', 'array'], + 'barCode.type' => ['required', Rule::in(array_column(BarCodeTypeEnum::cases(), 'value'))], + 'barCode.digitable' => ['required_without:barCode.barCode', 'string'], + 'barCode.barCode' => ['required_without:barCode.digitable', 'string'], ]; } } diff --git a/src/Rules/BillPayments/Cancel.php b/src/Rules/BillPayments/Cancel.php index 2f29e31..b28838a 100644 --- a/src/Rules/BillPayments/Cancel.php +++ b/src/Rules/BillPayments/Cancel.php @@ -7,8 +7,8 @@ class Cancel public static function rules() { return [ - "externalNSU" => ['required', 'numeric'], - "externalTerminal" => ['required', 'string'], + 'externalNSU' => ['required', 'numeric'], + 'externalTerminal' => ['required', 'string'], ]; } } diff --git a/src/Rules/BillPayments/Confirm.php b/src/Rules/BillPayments/Confirm.php index e943f1e..a15ee97 100644 --- a/src/Rules/BillPayments/Confirm.php +++ b/src/Rules/BillPayments/Confirm.php @@ -7,8 +7,8 @@ class Confirm public static function rules() { return [ - "externalNSU" => ['nullable', 'numeric'], - "externalTerminal" => ['nullable', 'string'], + 'externalNSU' => ['nullable', 'numeric'], + 'externalTerminal' => ['nullable', 'string'], ]; } } diff --git a/src/Rules/BillPayments/Create.php b/src/Rules/BillPayments/Create.php index 02e8fd6..ab939d1 100644 --- a/src/Rules/BillPayments/Create.php +++ b/src/Rules/BillPayments/Create.php @@ -8,28 +8,27 @@ class Create { - public static function rules() { return [ - "externalNSU" => ['nullable', 'integer'], - "externalTerminal" => ['nullable', 'string'], - "cpfcnpj" => ['required', 'string'], - "billData" => ['required', 'array'], - "billData.value" => ['nullable', 'decimal:0,2'], - "billData.originalValue" => ['required', 'decimal:0,2'], - "billData.valueWithDiscount" => ['required', 'decimal:0,2'], - "billData.valueWithAdditional" => ['required', 'decimal:0,2'], - "infoBearer" => ['nullable', 'array'], - "infoBearer.nameBearer" => ['nullable', 'string'], - "infoBearer.documentBearer" => ['nullable', 'string'], - "infoBearer.methodPaymentCode" => ['nullable', Rule::in(array_column(MethodPaymentCodeEnum::cases(), 'value'))], - "barCode" => ['required', 'array'], - "barCode.type" => ['required', Rule::in(array_column(BarCodeTypeEnum::cases(), 'value'))], - "barCode.digitable" => ['nullable', 'string'], - "barCode.barCode" => ['nullable', 'string'], - "dueDate" => ['nullable', 'date_format:Y-m-d'], - "transactionIdAuthorize" => ['nullable', 'integer'] + 'externalNSU' => ['nullable', 'integer'], + 'externalTerminal' => ['nullable', 'string'], + 'cpfcnpj' => ['required', 'string'], + 'billData' => ['required', 'array'], + 'billData.value' => ['nullable', 'decimal:0,2'], + 'billData.originalValue' => ['required', 'decimal:0,2'], + 'billData.valueWithDiscount' => ['required', 'decimal:0,2'], + 'billData.valueWithAdditional' => ['required', 'decimal:0,2'], + 'infoBearer' => ['nullable', 'array'], + 'infoBearer.nameBearer' => ['nullable', 'string'], + 'infoBearer.documentBearer' => ['nullable', 'string'], + 'infoBearer.methodPaymentCode' => ['nullable', Rule::in(array_column(MethodPaymentCodeEnum::cases(), 'value'))], + 'barCode' => ['required', 'array'], + 'barCode.type' => ['required', Rule::in(array_column(BarCodeTypeEnum::cases(), 'value'))], + 'barCode.digitable' => ['nullable', 'string'], + 'barCode.barCode' => ['nullable', 'string'], + 'dueDate' => ['nullable', 'date_format:Y-m-d'], + 'transactionIdAuthorize' => ['nullable', 'integer'], ]; } } diff --git a/src/Rules/DDA/RegisterInvoice.php b/src/Rules/DDA/RegisterInvoice.php index 9381ab3..c55a924 100644 --- a/src/Rules/DDA/RegisterInvoice.php +++ b/src/Rules/DDA/RegisterInvoice.php @@ -7,7 +7,7 @@ class RegisterInvoice public static function rules() { return [ - "document" => ['required', 'array'], + 'document' => ['required', 'array'], ]; } } diff --git a/src/Rules/DDA/RegisterUser.php b/src/Rules/DDA/RegisterUser.php index 013f3c7..5667460 100644 --- a/src/Rules/DDA/RegisterUser.php +++ b/src/Rules/DDA/RegisterUser.php @@ -7,9 +7,9 @@ class RegisterUser public static function rules() { return [ - "document" => ['required', 'string'], - "clientName" => ['required', 'string'], - "clientRequestId" => ['nullable', 'string'], + 'document' => ['required', 'string'], + 'clientName' => ['required', 'string'], + 'clientRequestId' => ['nullable', 'string'], ]; } } diff --git a/src/Rules/DDA/RegisterWebhooks.php b/src/Rules/DDA/RegisterWebhooks.php index 4d86e77..702db81 100644 --- a/src/Rules/DDA/RegisterWebhooks.php +++ b/src/Rules/DDA/RegisterWebhooks.php @@ -10,21 +10,21 @@ class RegisterWebhooks public static function rules() { return [ - "typeEventWebhook" => ['required', Rule::in(array_column(DDAWebhooksTypeEventEnum::cases(), 'value'))], - "url" => ['required', 'string'], - "basicAuthentication" => ['nullable', 'array'], - "basicAuthentication.identification" => ['nullable', 'string'], - "basicAuthentication.password" => ['nullable', 'string'], - "oAuthTwo" => ['nullable', 'array'], - "oAuthTwo.endpoint" => ['nullable', 'string'], - "oAuthTwo.grantType" => ['nullable', 'string'], - "oAuthTwo.clientId" => ['nullable', 'string'], - "oAuthTwo.clientSecret" => ['nullable', 'string'], - "oAuthTwo.scope" => ['nullable', 'string'], - "oAuthTwo.state" => ['nullable', 'string'], - "oAuthTwo.code" => ['nullable', 'string'], - "oAuthTwo.refreshToken" => ['nullable', 'string'], - "oAuthTwo.contentType" => ['nullable', 'string'], + 'typeEventWebhook' => ['required', Rule::in(array_column(DDAWebhooksTypeEventEnum::cases(), 'value'))], + 'url' => ['required', 'string'], + 'basicAuthentication' => ['nullable', 'array'], + 'basicAuthentication.identification' => ['nullable', 'string'], + 'basicAuthentication.password' => ['nullable', 'string'], + 'oAuthTwo' => ['nullable', 'array'], + 'oAuthTwo.endpoint' => ['nullable', 'string'], + 'oAuthTwo.grantType' => ['nullable', 'string'], + 'oAuthTwo.clientId' => ['nullable', 'string'], + 'oAuthTwo.clientSecret' => ['nullable', 'string'], + 'oAuthTwo.scope' => ['nullable', 'string'], + 'oAuthTwo.state' => ['nullable', 'string'], + 'oAuthTwo.code' => ['nullable', 'string'], + 'oAuthTwo.refreshToken' => ['nullable', 'string'], + 'oAuthTwo.contentType' => ['nullable', 'string'], ]; } } diff --git a/src/Rules/DDA/RemoveUser.php b/src/Rules/DDA/RemoveUser.php index f0699ee..8ee41b2 100644 --- a/src/Rules/DDA/RemoveUser.php +++ b/src/Rules/DDA/RemoveUser.php @@ -7,8 +7,8 @@ class RemoveUser public static function rules() { return [ - "document" => ['required', 'string'], - "clientRequestId" => ['nullable', 'string'], + 'document' => ['required', 'string'], + 'clientRequestId' => ['nullable', 'string'], ]; } } diff --git a/src/Rules/KYC/CreateKycRule.php b/src/Rules/KYC/CreateKycRule.php index b7a00fe..5630198 100644 --- a/src/Rules/KYC/CreateKycRule.php +++ b/src/Rules/KYC/CreateKycRule.php @@ -12,8 +12,8 @@ public static function rules(): array return [ 'documentnumber' => ['required', 'digits:11,14'], 'filetype' => ['required', Rule::enum(KycDocumentEnum::class)], - 'front' => ['sometimes',], - 'verse' => ['sometimes',], + 'front' => ['sometimes'], + 'verse' => ['sometimes'], 'cnpj' => ['sometimes', 'digits:11,14'], ]; } diff --git a/src/Rules/PIX/COBVCreate.php b/src/Rules/PIX/COBVCreate.php index 710e61a..4fef4a1 100644 --- a/src/Rules/PIX/COBVCreate.php +++ b/src/Rules/PIX/COBVCreate.php @@ -41,4 +41,4 @@ public static function rules(): array 'key' => ['required'], ]; } -} \ No newline at end of file +} diff --git a/src/Rules/PIX/COBVPayload.php b/src/Rules/PIX/COBVPayload.php index f651900..19fabf1 100644 --- a/src/Rules/PIX/COBVPayload.php +++ b/src/Rules/PIX/COBVPayload.php @@ -7,7 +7,7 @@ class COBVPayload final public static function rules(): array { return [ - 'url' => ['required', 'url'] + 'url' => ['required', 'url'], ]; } } diff --git a/src/Rules/PIX/ClaimAnswer.php b/src/Rules/PIX/ClaimAnswer.php index 5f6f3b0..2ae1e02 100644 --- a/src/Rules/PIX/ClaimAnswer.php +++ b/src/Rules/PIX/ClaimAnswer.php @@ -7,12 +7,11 @@ class ClaimAnswer { - public static function rules(): array - { - return [ - 'id' => ['required', 'uuid'], - 'reason' => ['required', Rule::enum(ClaimAnswerReasonEnum::class)], - ]; - } - -} \ No newline at end of file + public static function rules(): array + { + return [ + 'id' => ['required', 'uuid'], + 'reason' => ['required', Rule::enum(ClaimAnswerReasonEnum::class)], + ]; + } +} diff --git a/src/Rules/PIX/ClaimCreate.php b/src/Rules/PIX/ClaimCreate.php index 9bf663c..35baff8 100644 --- a/src/Rules/PIX/ClaimCreate.php +++ b/src/Rules/PIX/ClaimCreate.php @@ -8,18 +8,17 @@ class ClaimCreate { - public static function rules(): array - { - return [ - 'key' => ['required'], - 'keyType' => ['required', Rule::enum(ClaimKeyTypeEnum::class)->when( - ClaimTypeEnum::OWNERSHIP, - fn($rule) => $rule->only([ClaimKeyTypeEnum::PHONE, ClaimKeyTypeEnum::EMAIL]), - fn($rule) => $rule, - )], - 'account' => ['required'], - 'claimType' => ['required', Rule::enum(ClaimTypeEnum::class)], - ]; - } - -} \ No newline at end of file + public static function rules(): array + { + return [ + 'key' => ['required'], + 'keyType' => ['required', Rule::enum(ClaimKeyTypeEnum::class)->when( + ClaimTypeEnum::OWNERSHIP, + fn ($rule) => $rule->only([ClaimKeyTypeEnum::PHONE, ClaimKeyTypeEnum::EMAIL]), + fn ($rule) => $rule, + )], + 'account' => ['required'], + 'claimType' => ['required', Rule::enum(ClaimTypeEnum::class)], + ]; + } +} diff --git a/src/Rules/PIX/DICTSearch.php b/src/Rules/PIX/DICTSearch.php index 8731d5b..2c39356 100644 --- a/src/Rules/PIX/DICTSearch.php +++ b/src/Rules/PIX/DICTSearch.php @@ -14,4 +14,4 @@ public static function rules(): array 'key' => ['required'], ]; } -} \ No newline at end of file +} diff --git a/src/Rules/PIX/DICTVerify.php b/src/Rules/PIX/DICTVerify.php index b537f1e..d616d82 100644 --- a/src/Rules/PIX/DICTVerify.php +++ b/src/Rules/PIX/DICTVerify.php @@ -14,4 +14,4 @@ public static function rules(): array 'keys.*.key' => ['required'], ]; } -} \ No newline at end of file +} diff --git a/src/Rules/PIX/PaymentEmvRules.php b/src/Rules/PIX/PaymentEmvRules.php index 3c364c0..e7eb1b4 100644 --- a/src/Rules/PIX/PaymentEmvRules.php +++ b/src/Rules/PIX/PaymentEmvRules.php @@ -10,7 +10,7 @@ class PaymentEmvRules public static function rules(): array { return [ - 'emv' => ['required', 'string'] + 'emv' => ['required', 'string'], ]; } } diff --git a/src/Rules/PIX/PaymentEndToEndRules.php b/src/Rules/PIX/PaymentEndToEndRules.php index a6231a6..c8c18db 100644 --- a/src/Rules/PIX/PaymentEndToEndRules.php +++ b/src/Rules/PIX/PaymentEndToEndRules.php @@ -10,7 +10,7 @@ class PaymentEndToEndRules public static function rules(): array { return [ - 'dpp' => ['required', 'date'] + 'dpp' => ['required', 'date'], ]; } } diff --git a/src/Rules/PIX/PaymentInitRules.php b/src/Rules/PIX/PaymentInitRules.php index 23d9a80..bcd42cc 100644 --- a/src/Rules/PIX/PaymentInitRules.php +++ b/src/Rules/PIX/PaymentInitRules.php @@ -12,20 +12,20 @@ public static function rules(): array return [ 'amount' => [ 'required', - 'decimal:2' + 'decimal:2', ], 'vlcpAmount' => [ 'decimal:2', - 'required_if:transactionType,CHANGE' + 'required_if:transactionType,CHANGE', ], 'vldnAmount' => [ 'decimal:2', 'required_if:transactionType,WITHDRAWAL', - 'required_if:transactionType,CHANGE' + 'required_if:transactionType,CHANGE', ], 'withdrawalServiceProvider' => [ 'string', - 'required_if:transactionType,WITHDRAWAL' + 'required_if:transactionType,WITHDRAWAL', ], 'withdrawalAgentMode' => [ 'in:AGTEC,AGTOT,AGPSS', diff --git a/src/Rules/PIX/PixReverseGetStatus.php b/src/Rules/PIX/PixReverseGetStatus.php index fba2af1..24926aa 100644 --- a/src/Rules/PIX/PixReverseGetStatus.php +++ b/src/Rules/PIX/PixReverseGetStatus.php @@ -4,7 +4,6 @@ class PixReverseGetStatus { - public static function rules(): array { return [ diff --git a/src/Rules/PIX/QRStaticPaymentCreate.php b/src/Rules/PIX/QRStaticPaymentCreate.php index 06a5dff..371706d 100644 --- a/src/Rules/PIX/QRStaticPaymentCreate.php +++ b/src/Rules/PIX/QRStaticPaymentCreate.php @@ -2,8 +2,6 @@ namespace WeDevBr\Celcoin\Rules\PIX; -use Illuminate\Validation\Rule; - class QRStaticPaymentCreate { /** diff --git a/src/Rules/PIX/WebhookGetList.php b/src/Rules/PIX/WebhookGetList.php index bd58696..1331757 100644 --- a/src/Rules/PIX/WebhookGetList.php +++ b/src/Rules/PIX/WebhookGetList.php @@ -4,7 +4,6 @@ class WebhookGetList { - public static function rules(): array { return [ diff --git a/src/Rules/Topups/Create.php b/src/Rules/Topups/Create.php index c883deb..4070820 100644 --- a/src/Rules/Topups/Create.php +++ b/src/Rules/Topups/Create.php @@ -17,7 +17,7 @@ public static function rules() 'phone' => ['required', 'array'], 'phone.stateCode' => ['required', 'numeric'], 'phone.countryCode' => ['required', 'numeric'], - 'phone.number' => ['required', 'string'] + 'phone.number' => ['required', 'string'], ]; } } diff --git a/src/Rules/Topups/Providers.php b/src/Rules/Topups/Providers.php index 442c498..6a61b7a 100644 --- a/src/Rules/Topups/Providers.php +++ b/src/Rules/Topups/Providers.php @@ -11,9 +11,9 @@ class Providers public static function rules() { return [ - "stateCode" => ['required', 'integer'], - "type" => ['required', Rule::in(array_column(TopupProvidersTypeEnum::cases(), 'value'))], - "category" => ['required', Rule::in(array_column(TopupProvidersCategoryEnum::cases(), 'value'))], + 'stateCode' => ['required', 'integer'], + 'type' => ['required', Rule::in(array_column(TopupProvidersTypeEnum::cases(), 'value'))], + 'category' => ['required', Rule::in(array_column(TopupProvidersCategoryEnum::cases(), 'value'))], ]; } } diff --git a/src/Rules/Topups/ProvidersValues.php b/src/Rules/Topups/ProvidersValues.php index 6548b64..970778f 100644 --- a/src/Rules/Topups/ProvidersValues.php +++ b/src/Rules/Topups/ProvidersValues.php @@ -7,8 +7,8 @@ class ProvidersValues public static function rules() { return [ - "stateCode" => ['required', 'integer'], - "providerId" => ['required', 'string'], + 'stateCode' => ['required', 'integer'], + 'providerId' => ['required', 'string'], ]; } } diff --git a/src/Types/BAAS/Account.php b/src/Types/BAAS/Account.php index 924cc0b..eb30e20 100644 --- a/src/Types/BAAS/Account.php +++ b/src/Types/BAAS/Account.php @@ -12,4 +12,4 @@ public function __construct(array $data = []) { parent::__construct($data); } -} \ No newline at end of file +} diff --git a/src/Types/BAAS/AccountBusiness.php b/src/Types/BAAS/AccountBusiness.php index 807a2eb..4012d96 100644 --- a/src/Types/BAAS/AccountBusiness.php +++ b/src/Types/BAAS/AccountBusiness.php @@ -7,18 +7,24 @@ class AccountBusiness extends Data { - public string $clientCode; + public AccountOnboardingTypeEnum $accountOnboardingType; + public string $documentNumber; + public string $contactNumber; + public string $businessEmail; + public string $businessName; + public string $tradingName; + // /** @var Owner[] */ public ?array $owner; - public ?Address $businessAddress; + public ?Address $businessAddress; public function __construct(array $data = []) { diff --git a/src/Types/BAAS/AccountManagerBusiness.php b/src/Types/BAAS/AccountManagerBusiness.php index 259d3d8..5cc9dc9 100644 --- a/src/Types/BAAS/AccountManagerBusiness.php +++ b/src/Types/BAAS/AccountManagerBusiness.php @@ -6,12 +6,15 @@ class AccountManagerBusiness extends Data { - public string $contactNumber; + public string $businessEmail; + public string $teste; + /** @var Owner[] */ public array $owners; + public Address $businessAddress; public function __construct(array $data = []) diff --git a/src/Types/BAAS/AccountManagerNaturalPerson.php b/src/Types/BAAS/AccountManagerNaturalPerson.php index 3c1a5f8..35c7387 100644 --- a/src/Types/BAAS/AccountManagerNaturalPerson.php +++ b/src/Types/BAAS/AccountManagerNaturalPerson.php @@ -6,11 +6,14 @@ class AccountManagerNaturalPerson extends Data { - public string $phoneNumber; + public string $email; + public string $socialName; + public Address $address; + public bool $isPoliticallyExposedPerson; public function __construct(array $data = []) diff --git a/src/Types/BAAS/AccountNaturalPerson.php b/src/Types/BAAS/AccountNaturalPerson.php index f0b1bbb..4cd9243 100644 --- a/src/Types/BAAS/AccountNaturalPerson.php +++ b/src/Types/BAAS/AccountNaturalPerson.php @@ -7,19 +7,27 @@ class AccountNaturalPerson extends Data { - public string $clientCode; + public AccountOnboardingTypeEnum $accountOnboardingType; + public string $documentNumber; + public string $phoneNumber; + public string $email; + public string $motherName; + public string $fullName; + public string $socialName; + public string $birthDate; + public Address $address; - public bool $isPoliticallyExposedPerson; + public bool $isPoliticallyExposedPerson; public function __construct(array $data = []) { diff --git a/src/Types/BAAS/AccountRelease.php b/src/Types/BAAS/AccountRelease.php index d74a05d..b5da37e 100644 --- a/src/Types/BAAS/AccountRelease.php +++ b/src/Types/BAAS/AccountRelease.php @@ -8,8 +8,11 @@ class AccountRelease extends Data { public string $clientCode; + public float $amount; + public TypeReleaseEnum $type; + public ?string $description; public function __construct(array $data = []) diff --git a/src/Types/BAAS/Address.php b/src/Types/BAAS/Address.php index b1bde17..5211499 100644 --- a/src/Types/BAAS/Address.php +++ b/src/Types/BAAS/Address.php @@ -6,15 +6,22 @@ class Address extends Data { - public string $postalCode; + public string $street; + public ?string $number; + public ?string $addressComplement; + public string $neighborhood; + public string $city; + public string $state; + public ?string $longitude; + public ?string $latitude; public function __construct(array $data = []) diff --git a/src/Types/BAAS/Auth.php b/src/Types/BAAS/Auth.php index efd7de3..bd84639 100644 --- a/src/Types/BAAS/Auth.php +++ b/src/Types/BAAS/Auth.php @@ -7,7 +7,9 @@ class Auth extends Data { public ?string $login; + public ?string $pwd; + public ?string $type; public function __construct(array $data = []) diff --git a/src/Types/BAAS/BillPayment.php b/src/Types/BAAS/BillPayment.php index aff4574..43ee250 100644 --- a/src/Types/BAAS/BillPayment.php +++ b/src/Types/BAAS/BillPayment.php @@ -25,8 +25,8 @@ class BillPayment extends Data public function __construct(array $data = []) { $data['barCodeInfo'] = new BarCode($data['barCodeInfo'] ?? []); - $data['tags'] = collect($data['tags'] ?? [])->each(fn($tag) => new Tag($tag))->toArray(); + $data['tags'] = collect($data['tags'] ?? [])->each(fn ($tag) => new Tag($tag))->toArray(); parent::__construct($data); } -} \ No newline at end of file +} diff --git a/src/Types/BAAS/Billet.php b/src/Types/BAAS/Billet.php index 1b6f920..8159240 100644 --- a/src/Types/BAAS/Billet.php +++ b/src/Types/BAAS/Billet.php @@ -7,29 +7,28 @@ class Billet extends Data { public string $externalId; + public ?string $merchantCategoryCode; + public int $expirationAfterPayment; + public string $duedate; + public float $amount; + public ?string $key; - /** - * @var BilletDebtor - */ + public BilletDebtor $debtor; - /** - * @var BilletReceiver - */ + public BilletReceiver $receiver; - /** - * @var BilletInstruction | null - */ + public ?BilletInstruction $instructions; + /** * @var array */ public ?array $split; - public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/BAAS/BilletDebtor.php b/src/Types/BAAS/BilletDebtor.php index 153f0d0..ef1531e 100644 --- a/src/Types/BAAS/BilletDebtor.php +++ b/src/Types/BAAS/BilletDebtor.php @@ -2,20 +2,26 @@ namespace WeDevBr\Celcoin\Types\BAAS; -use WeDevBr\Celcoin\Enums\ClientFinalityEnum; use WeDevBr\Celcoin\Types\Data; -use WeDevBr\Celcoin\Types\PIX\Debtor; class BilletDebtor extends Data { public string $name; + public string $document; + public string $postalCode; + public string $publicArea; + public string $number; + public ?string $complement; + public string $neighborhood; + public string $city; + public string $state; public function __construct(array $data = []) diff --git a/src/Types/BAAS/BilletDiscount.php b/src/Types/BAAS/BilletDiscount.php index ab7895b..778c0c1 100644 --- a/src/Types/BAAS/BilletDiscount.php +++ b/src/Types/BAAS/BilletDiscount.php @@ -6,9 +6,10 @@ class BilletDiscount extends Data { - public float $amount; + public string $modality; + public string $limitDate; public function __construct(array $data = []) diff --git a/src/Types/BAAS/BilletInstruction.php b/src/Types/BAAS/BilletInstruction.php index 0ce17ed..3138d8c 100644 --- a/src/Types/BAAS/BilletInstruction.php +++ b/src/Types/BAAS/BilletInstruction.php @@ -6,9 +6,10 @@ class BilletInstruction extends Data { - public ?float $fine; + public ?float $interest; + public ?BilletDiscount $discount; public function __construct(array $data = []) diff --git a/src/Types/BAAS/BilletReceiver.php b/src/Types/BAAS/BilletReceiver.php index 397e57e..3249b35 100644 --- a/src/Types/BAAS/BilletReceiver.php +++ b/src/Types/BAAS/BilletReceiver.php @@ -2,13 +2,12 @@ namespace WeDevBr\Celcoin\Types\BAAS; -use WeDevBr\Celcoin\Enums\ClientFinalityEnum; use WeDevBr\Celcoin\Types\Data; -use WeDevBr\Celcoin\Types\PIX\Debtor; class BilletReceiver extends Data { public string $document; + public string $account; public function __construct(array $data = []) diff --git a/src/Types/BAAS/BilletSplit.php b/src/Types/BAAS/BilletSplit.php index 8f51318..15c1020 100644 --- a/src/Types/BAAS/BilletSplit.php +++ b/src/Types/BAAS/BilletSplit.php @@ -6,11 +6,14 @@ class BilletSplit extends Data { - public string $account; + public string $document; + public ?float $percent; + public ?float $amount; + public bool $aggregatePayment = false; public function __construct(array $data = []) diff --git a/src/Types/BAAS/CreditParty.php b/src/Types/BAAS/CreditParty.php index 79b57db..6764d21 100644 --- a/src/Types/BAAS/CreditParty.php +++ b/src/Types/BAAS/CreditParty.php @@ -7,13 +7,18 @@ class CreditParty extends Data { - public string $bank; + public ?string $key; + public string $account; + public string $branch; + public string $taxId; + public string $name; + public CreditPartyAccountTypeEnum $accountType; public function __construct(array $data = []) diff --git a/src/Types/BAAS/DebitParty.php b/src/Types/BAAS/DebitParty.php index b52ddd0..a6f9b9d 100644 --- a/src/Types/BAAS/DebitParty.php +++ b/src/Types/BAAS/DebitParty.php @@ -6,7 +6,6 @@ class DebitParty extends Data { - public string $account; public function __construct(array $data = []) diff --git a/src/Types/BAAS/EditWebhooks.php b/src/Types/BAAS/EditWebhooks.php index 5ed00e9..012bf52 100644 --- a/src/Types/BAAS/EditWebhooks.php +++ b/src/Types/BAAS/EditWebhooks.php @@ -8,8 +8,11 @@ class EditWebhooks extends Data { public EntityWebhookBAASEnum $entity; + public string $webhookUrl; + public ?Auth $auth; + public ?bool $active; public function __construct(array $data = []) diff --git a/src/Types/BAAS/GetPaymentStatusRequest.php b/src/Types/BAAS/GetPaymentStatusRequest.php index ddcfdb4..f25ba48 100644 --- a/src/Types/BAAS/GetPaymentStatusRequest.php +++ b/src/Types/BAAS/GetPaymentStatusRequest.php @@ -9,7 +9,9 @@ class GetPaymentStatusRequest extends Data public ?string $clientRequestId = null; public ?string $id = null; + private ?string $ClientRequestId = null; + private ?string $Id = null; public function __construct(array $data = []) @@ -21,6 +23,7 @@ public function toArray(): array { $this->Id = $this?->id; $this->ClientRequestId = $this?->clientRequestId; + return collect(parent::toArray())->only(['Id', 'ClientRequestId'])->toArray(); // TODO: Change the autogenerated stub } -} \ No newline at end of file +} diff --git a/src/Types/BAAS/Owner.php b/src/Types/BAAS/Owner.php index c3d7148..3d7b6d1 100644 --- a/src/Types/BAAS/Owner.php +++ b/src/Types/BAAS/Owner.php @@ -6,15 +6,22 @@ class Owner extends Data { - public string $documentNumber; + public string $fullName; + public string $phoneNumber; + public string $email; + public string $motherName; + public ?string $socialName; + public string $birthDate; + public ?Address $address; + public bool $isPoliticallyExposedPerson; public function __construct(array $data = []) diff --git a/src/Types/BAAS/PixCashOut.php b/src/Types/BAAS/PixCashOut.php index e484aef..07115a2 100644 --- a/src/Types/BAAS/PixCashOut.php +++ b/src/Types/BAAS/PixCashOut.php @@ -11,15 +11,25 @@ class PixCashOut extends Data { public float $amount; + public string $clientCode; + public ?string $transactionIdentification; + public ?string $endToEndId; + public InitiationTypeEnum $initiationType; + public PaymentTypeEnum $paymentType; + public UrgencyEnum $urgency; + public TransactionTypeEnum $transactionType; + public DebitParty $debitParty; + public CreditParty $creditParty; + public ?string $remittanceInformation; public function __construct(array $data = []) diff --git a/src/Types/BAAS/RefundPix.php b/src/Types/BAAS/RefundPix.php index b85cbc6..f224e2a 100644 --- a/src/Types/BAAS/RefundPix.php +++ b/src/Types/BAAS/RefundPix.php @@ -8,10 +8,15 @@ class RefundPix extends Data { public ?string $id; + public ?string $endToEndId; + public string $clientCode; + public float $amount; + public ReasonRefundPixEnum $reason; + public ?string $reversalDescription; public function __construct(array $data = []) diff --git a/src/Types/BAAS/RegisterPixKey.php b/src/Types/BAAS/RegisterPixKey.php index b60ac9b..40100b4 100644 --- a/src/Types/BAAS/RegisterPixKey.php +++ b/src/Types/BAAS/RegisterPixKey.php @@ -8,7 +8,9 @@ class RegisterPixKey extends Data { public string $account; + public PixKeyTypeEnum $keyType; + public ?string $key; public function __construct(array $data = []) diff --git a/src/Types/BAAS/RegisterWebhooks.php b/src/Types/BAAS/RegisterWebhooks.php index cf908db..cd45c3e 100644 --- a/src/Types/BAAS/RegisterWebhooks.php +++ b/src/Types/BAAS/RegisterWebhooks.php @@ -8,7 +8,9 @@ class RegisterWebhooks extends Data { public EntityWebhookBAASEnum $entity; + public string $webhookUrl; + public ?Auth $auth; public function __construct(array $data = []) diff --git a/src/Types/BAAS/TEDCreditParty.php b/src/Types/BAAS/TEDCreditParty.php index c98bdbb..9a987f6 100644 --- a/src/Types/BAAS/TEDCreditParty.php +++ b/src/Types/BAAS/TEDCreditParty.php @@ -8,13 +8,18 @@ class TEDCreditParty extends Data { - public string $bank; + public string $account; + public string $branch; + public string $taxId; + public string $name; + public AccountTypeEnum $accountType; + public PersonTypeEnum $personType; public function __construct(array $data = []) diff --git a/src/Types/BAAS/TEDTransfer.php b/src/Types/BAAS/TEDTransfer.php index a3479ba..f36f68d 100644 --- a/src/Types/BAAS/TEDTransfer.php +++ b/src/Types/BAAS/TEDTransfer.php @@ -8,10 +8,15 @@ class TEDTransfer extends Data { public float $amount; + public string $clientCode; + public DebitParty $debitParty; + public TEDCreditParty $creditParty; + public ClientFinalityEnum $clientFinality; + public ?string $description; public function __construct(array $data = []) diff --git a/src/Types/BAAS/TEFTransfer.php b/src/Types/BAAS/TEFTransfer.php index 96aed87..273bec7 100644 --- a/src/Types/BAAS/TEFTransfer.php +++ b/src/Types/BAAS/TEFTransfer.php @@ -22,4 +22,4 @@ public function __construct(array $data = []) $data['creditParty'] = new Account($data['creditParty'] ?? []); parent::__construct($data); } -} \ No newline at end of file +} diff --git a/src/Types/BAAS/Tag.php b/src/Types/BAAS/Tag.php index 0049ec9..539a38d 100644 --- a/src/Types/BAAS/Tag.php +++ b/src/Types/BAAS/Tag.php @@ -14,4 +14,4 @@ public function __construct(array $data = []) { parent::__construct($data); } -} \ No newline at end of file +} diff --git a/src/Types/BankTransfer/Create.php b/src/Types/BankTransfer/Create.php index 255f3c9..3c39bb8 100644 --- a/src/Types/BankTransfer/Create.php +++ b/src/Types/BankTransfer/Create.php @@ -1,6 +1,6 @@ getType()->getName(), 'from'], $val); } $this->$key = $val; + continue; } @@ -33,8 +33,6 @@ public function __construct(array $data = []) /** * Set a value - * @param string $key - * @param mixed $value */ public function __set(string $key, mixed $value) { @@ -43,7 +41,7 @@ public function __set(string $key, mixed $value) /** * Get a value - * @param string $key + * * @return mixed */ public function __get(string $key) @@ -53,7 +51,7 @@ public function __get(string $key) /** * Check if a key is set - * @param string $key + * * @return bool */ public function __isset(string $key) @@ -61,9 +59,6 @@ public function __isset(string $key) return isset($this->attributes[$key]); } - /** - * @return array - */ public function toArray(): array { $vars = get_object_vars($this); @@ -72,13 +67,13 @@ public function toArray(): array foreach ($vars as $key => $value) { if ($value instanceof self) { $value = $value->toArray(); - } else if (is_array($value) && $key != 'attributes') { + } elseif (is_array($value) && $key != 'attributes') { foreach ($value as &$valueVal) { if ($valueVal instanceof self) { $valueVal = $valueVal->toArray(); } } - } else if ($value instanceof UnitEnum) { + } elseif ($value instanceof UnitEnum) { $value = $value->value; } $array[$key] = $value; diff --git a/src/Types/ElectronicTransactions/Deposit.php b/src/Types/ElectronicTransactions/Deposit.php index 7421c4a..9a0e9e7 100644 --- a/src/Types/ElectronicTransactions/Deposit.php +++ b/src/Types/ElectronicTransactions/Deposit.php @@ -7,17 +7,24 @@ class Deposit extends Data { public ?int $externalNSU; + public ?string $externalTerminal; + public string $payerContact; + public string $payerDocument; + public string $transactionIdentifier; + public string $payerName; + public string $namePartner = 'TECBAN_BANCO24H'; + public string $value; public function __construct(array $data = []) { - $data['namePartner'] = $data[''] ?? 'TECBAN_BANCO24H'; + $data['namePartner'] = $data[''] ?? 'TECBAN_BANCO24H'; parent::__construct($data); } } diff --git a/src/Types/ElectronicTransactions/SecondAuthenticationData.php b/src/Types/ElectronicTransactions/SecondAuthenticationData.php index 8d0e47a..8b18f63 100644 --- a/src/Types/ElectronicTransactions/SecondAuthenticationData.php +++ b/src/Types/ElectronicTransactions/SecondAuthenticationData.php @@ -7,7 +7,9 @@ class SecondAuthenticationData extends Data { public ?string $dataForSecondAuthentication; + public ?string $textForSecondIdentification; + public ?bool $useSecondAuthentication; public function __construct(array $data = []) diff --git a/src/Types/ElectronicTransactions/ServicesPoints.php b/src/Types/ElectronicTransactions/ServicesPoints.php index df87014..a6364b9 100644 --- a/src/Types/ElectronicTransactions/ServicesPoints.php +++ b/src/Types/ElectronicTransactions/ServicesPoints.php @@ -7,10 +7,15 @@ class ServicesPoints extends Data { public float $latitude; + public float $longitude; + public string $namePartner; + public float $radius; + public int $page; + public int $size; public function __construct(array $data = []) diff --git a/src/Types/ElectronicTransactions/Withdraw.php b/src/Types/ElectronicTransactions/Withdraw.php index fda6dc1..e7a7d47 100644 --- a/src/Types/ElectronicTransactions/Withdraw.php +++ b/src/Types/ElectronicTransactions/Withdraw.php @@ -7,13 +7,21 @@ class Withdraw extends Data { public ?int $externalNSU; + public ?string $externalTerminal; + public string $receivingContact; + public string $receivingDocument; + public string $transactionIdentifier; + public string $receivingName; + public string $namePartner; + public string $value; + public ?SecondAuthenticationData $secondAuthentication; public function __construct(array $data = []) diff --git a/src/Types/ElectronicTransactions/WithdrawToken.php b/src/Types/ElectronicTransactions/WithdrawToken.php index 7f81f14..eb4b422 100644 --- a/src/Types/ElectronicTransactions/WithdrawToken.php +++ b/src/Types/ElectronicTransactions/WithdrawToken.php @@ -7,9 +7,13 @@ class WithdrawToken extends Data { public ?int $externalNSU; + public ?string $externalTerminal; + public string $receivingDocument; + public string $receivingName; + public string $value; public function __construct(array $data = []) diff --git a/src/Types/InternationalTopups/Cancel.php b/src/Types/InternationalTopups/Cancel.php index 8c636ce..cfc1f2e 100644 --- a/src/Types/InternationalTopups/Cancel.php +++ b/src/Types/InternationalTopups/Cancel.php @@ -7,6 +7,7 @@ class Cancel extends Data { public ?int $externalNsu; + public ?string $externalTerminal; public function __construct(array $data = []) diff --git a/src/Types/InternationalTopups/Confirm.php b/src/Types/InternationalTopups/Confirm.php index 2d32310..864f71e 100644 --- a/src/Types/InternationalTopups/Confirm.php +++ b/src/Types/InternationalTopups/Confirm.php @@ -7,6 +7,7 @@ class Confirm extends Data { public int $externalNSU; + public string $externalTerminal; public function __construct(array $data = []) diff --git a/src/Types/InternationalTopups/Create.php b/src/Types/InternationalTopups/Create.php index b55766f..4eb4f02 100644 --- a/src/Types/InternationalTopups/Create.php +++ b/src/Types/InternationalTopups/Create.php @@ -7,10 +7,15 @@ class Create extends Data { public string $externalTerminal; + public int $externalNsu; + public string $cpfCnpj; + public Phone $phone; + public string $value; + public string $topupProductId; public function __construct(array $data = []) diff --git a/src/Types/InternationalTopups/Phone.php b/src/Types/InternationalTopups/Phone.php index 702d8a9..869f301 100644 --- a/src/Types/InternationalTopups/Phone.php +++ b/src/Types/InternationalTopups/Phone.php @@ -7,7 +7,9 @@ class Phone extends Data { public string $number; + public ?int $countryCode; + public ?int $stateCode; public function __construct(array $data = []) diff --git a/src/Types/KYC/CreateKyc.php b/src/Types/KYC/CreateKyc.php index e56f7f9..957d21d 100644 --- a/src/Types/KYC/CreateKyc.php +++ b/src/Types/KYC/CreateKyc.php @@ -3,7 +3,6 @@ namespace WeDevBr\Celcoin\Types\KYC; use WeDevBr\Celcoin\Enums\KycDocumentEnum; -use WeDevBr\Celcoin\Interfaces\Attachable; use WeDevBr\Celcoin\Types\Data; class CreateKyc extends Data diff --git a/src/Types/KYC/KycDocument.php b/src/Types/KYC/KycDocument.php index 3a0c000..8754ad2 100644 --- a/src/Types/KYC/KycDocument.php +++ b/src/Types/KYC/KycDocument.php @@ -9,7 +9,9 @@ class KycDocument extends Data implements Attachable { public string $fileName; + public string $contents; + public ?File $file; public string $field; @@ -17,7 +19,7 @@ class KycDocument extends Data implements Attachable public function __construct(?File $file, string $field) { $data = []; - if (!empty($file)) { + if (! empty($file)) { $data['contents'] = $file->getContent(); $data['fileName'] = $file->getFilename(); $data['field'] = $field; diff --git a/src/Types/PIX/AdditionalInformation.php b/src/Types/PIX/AdditionalInformation.php index a217bbe..24dab1d 100644 --- a/src/Types/PIX/AdditionalInformation.php +++ b/src/Types/PIX/AdditionalInformation.php @@ -7,6 +7,7 @@ class AdditionalInformation extends Data { public string $key; + public string $value; public function __construct(array $data = []) diff --git a/src/Types/PIX/Amount.php b/src/Types/PIX/Amount.php index d195083..c389095 100644 --- a/src/Types/PIX/Amount.php +++ b/src/Types/PIX/Amount.php @@ -7,11 +7,9 @@ class Amount extends Data { public float $original; + public int $changeType; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/AmountAbatement.php b/src/Types/PIX/AmountAbatement.php index 1515abf..d1d235b 100644 --- a/src/Types/PIX/AmountAbatement.php +++ b/src/Types/PIX/AmountAbatement.php @@ -7,12 +7,11 @@ class AmountAbatement extends Data { public bool $hasAbatement; + public string $amountPerc; + public string $modality; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/AmountDicount.php b/src/Types/PIX/AmountDicount.php index d4d2f00..aa33d27 100644 --- a/src/Types/PIX/AmountDicount.php +++ b/src/Types/PIX/AmountDicount.php @@ -7,13 +7,13 @@ class AmountDicount extends Data { public array $discountDateFixed; + public bool $hasDicount; + public string $modality; + public string $amountPerc; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/AmountFine.php b/src/Types/PIX/AmountFine.php index 5a0042f..24abc8e 100644 --- a/src/Types/PIX/AmountFine.php +++ b/src/Types/PIX/AmountFine.php @@ -7,6 +7,8 @@ class AmountFine extends Data { public bool $hasAbatement; + public string $amountPerc; + public string $modality; } diff --git a/src/Types/PIX/AmountInterest.php b/src/Types/PIX/AmountInterest.php index 1743b79..ebb5ca9 100644 --- a/src/Types/PIX/AmountInterest.php +++ b/src/Types/PIX/AmountInterest.php @@ -7,6 +7,8 @@ class AmountInterest extends Data { public bool $hasInterest; + public string $amountPerc; + public string $modality; } diff --git a/src/Types/PIX/COB.php b/src/Types/PIX/COB.php index b76d088..61cc823 100644 --- a/src/Types/PIX/COB.php +++ b/src/Types/PIX/COB.php @@ -7,12 +7,19 @@ class COB extends Data { public string $clientRequestId; + public string $payerQuestion; + public string $key; + public string $locationId; + public Debtor $debtor; + public Amount|float $amount; + public Calendar $calendar; + /** * @var AdditionalInformation[] */ diff --git a/src/Types/PIX/COBGet.php b/src/Types/PIX/COBGet.php index 54f1ff2..68f0cf6 100644 --- a/src/Types/PIX/COBGet.php +++ b/src/Types/PIX/COBGet.php @@ -7,7 +7,9 @@ class COBGet extends Data { public string $transactionId; + public string $transactionIdentification; + public string $clientRequestId; public function __construct(array $data = []) diff --git a/src/Types/PIX/COBV.php b/src/Types/PIX/COBV.php index f3dc8e1..be316f8 100644 --- a/src/Types/PIX/COBV.php +++ b/src/Types/PIX/COBV.php @@ -5,16 +5,19 @@ class COBV extends COB { public int $expirationAfterPayment; + public string $duedate; + public AmountDicount $amountDicount; + public AmountAbatement $amountAbatement; + public AmountFine $amountFine; + public AmountInterest $amountInterest; + public Receiver $receiver; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/Calendar.php b/src/Types/PIX/Calendar.php index d684e53..29d2a68 100644 --- a/src/Types/PIX/Calendar.php +++ b/src/Types/PIX/Calendar.php @@ -7,12 +7,13 @@ class Calendar extends Data { public string $key; + public string $value; + public int $expiration; public function __construct(array $data = []) { parent::__construct($data); } - } diff --git a/src/Types/PIX/Claim.php b/src/Types/PIX/Claim.php index 0e18c68..87f8b8e 100644 --- a/src/Types/PIX/Claim.php +++ b/src/Types/PIX/Claim.php @@ -2,23 +2,23 @@ namespace WeDevBr\Celcoin\Types\PIX; -use WeDevBr\Celcoin\Enums\ClaimAnswerReasonEnum; use WeDevBr\Celcoin\Enums\ClaimKeyTypeEnum; use WeDevBr\Celcoin\Enums\ClaimTypeEnum; use WeDevBr\Celcoin\Types\Data; class Claim extends Data { - public string $key; - public ClaimKeyTypeEnum $keyType; - public string $account; - public ClaimTypeEnum $claimType; + public string $key; - public function __construct(array $data) - { - parent::__construct($data); - $this->claimType = ClaimTypeEnum::from($data['claimType']); - } + public ClaimKeyTypeEnum $keyType; + public string $account; -} \ No newline at end of file + public ClaimTypeEnum $claimType; + + public function __construct(array $data) + { + parent::__construct($data); + $this->claimType = ClaimTypeEnum::from($data['claimType']); + } +} diff --git a/src/Types/PIX/ClaimAnswer.php b/src/Types/PIX/ClaimAnswer.php index dffd5db..31d6401 100644 --- a/src/Types/PIX/ClaimAnswer.php +++ b/src/Types/PIX/ClaimAnswer.php @@ -7,13 +7,13 @@ class ClaimAnswer extends Data { - public string $id; - public ClaimAnswerReasonEnum $reason; + public string $id; - public function __construct(array $data) - { - parent::__construct($data); - $this->reason = ClaimAnswerReasonEnum::from($data['reason']); - } + public ClaimAnswerReasonEnum $reason; -} \ No newline at end of file + public function __construct(array $data) + { + parent::__construct($data); + $this->reason = ClaimAnswerReasonEnum::from($data['reason']); + } +} diff --git a/src/Types/PIX/CreditPartyObject.php b/src/Types/PIX/CreditPartyObject.php index 9fa811d..9e3c419 100644 --- a/src/Types/PIX/CreditPartyObject.php +++ b/src/Types/PIX/CreditPartyObject.php @@ -6,9 +6,6 @@ class CreditPartyObject extends DebitPartyObject { public string $Key; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/DICT.php b/src/Types/PIX/DICT.php index 03e5892..62adffa 100644 --- a/src/Types/PIX/DICT.php +++ b/src/Types/PIX/DICT.php @@ -7,12 +7,11 @@ class DICT extends Data { public string $payerId; + public string $key; + public array $keys; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/DebitPartyObject.php b/src/Types/PIX/DebitPartyObject.php index ff3ce6c..086b358 100644 --- a/src/Types/PIX/DebitPartyObject.php +++ b/src/Types/PIX/DebitPartyObject.php @@ -7,16 +7,19 @@ class DebitPartyObject extends Data { public string $Account; + public string $Bank; + public string $Branch; + public string $PersonType; + public string $TaxId; + public string $AccountType; + public string $Name; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/Debtor.php b/src/Types/PIX/Debtor.php index 597048b..fd6e3cf 100644 --- a/src/Types/PIX/Debtor.php +++ b/src/Types/PIX/Debtor.php @@ -7,17 +7,23 @@ class Debtor extends Data { public string $name; + public string $cpf; + public string $cnpj; + public string $city; + public string $publicArea; + public string $state; + public string $postalCode; + public string $email; public function __construct(array $data = []) { parent::__construct($data); } - -} \ No newline at end of file +} diff --git a/src/Types/PIX/DiscountDateFixed.php b/src/Types/PIX/DiscountDateFixed.php index 4741346..8db8274 100644 --- a/src/Types/PIX/DiscountDateFixed.php +++ b/src/Types/PIX/DiscountDateFixed.php @@ -7,11 +7,9 @@ class DiscountDateFixed extends Data { public string $date; + public string $amountPerc; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/DynamicQRCreate.php b/src/Types/PIX/DynamicQRCreate.php index c736455..1d28cc0 100644 --- a/src/Types/PIX/DynamicQRCreate.php +++ b/src/Types/PIX/DynamicQRCreate.php @@ -7,18 +7,26 @@ class DynamicQRCreate extends Data { public string $clientRequestId; + public string $key; + public string $amount; + public Merchant $merchant; + public string $payerCpf; + public string $payerCnpj; + public string $payerQuestion; + public string $payerName; /** * @var AdditionalInformation[] */ public array $additionalInformation; + public int $expiration; public function __construct(array $data = []) diff --git a/src/Types/PIX/DynamicQRUpdate.php b/src/Types/PIX/DynamicQRUpdate.php index 8dbfad6..e4943f9 100644 --- a/src/Types/PIX/DynamicQRUpdate.php +++ b/src/Types/PIX/DynamicQRUpdate.php @@ -7,17 +7,24 @@ class DynamicQRUpdate extends Data { public string $key; + public string $amount; + public Merchant $merchant; + public string $payerCpf; + public string $payerCnpj; + public string $payerQuestion; + public string $payerName; /** * @var AdditionalInformation[] */ public array $additionalInformation; + public int $expiration; public function __construct(array $data = []) diff --git a/src/Types/PIX/Merchant.php b/src/Types/PIX/Merchant.php index 5b5b8cc..a899d5a 100644 --- a/src/Types/PIX/Merchant.php +++ b/src/Types/PIX/Merchant.php @@ -7,13 +7,13 @@ class Merchant extends Data { public string $name; + public string $city; + public string $postalCode; + public string $merchantCategoryCode; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/PaymentEmv.php b/src/Types/PIX/PaymentEmv.php index d24e5ff..cbbe677 100644 --- a/src/Types/PIX/PaymentEmv.php +++ b/src/Types/PIX/PaymentEmv.php @@ -8,9 +8,6 @@ class PaymentEmv extends Data { public string $emv; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/PaymentEndToEnd.php b/src/Types/PIX/PaymentEndToEnd.php index b6fe8dc..433f186 100644 --- a/src/Types/PIX/PaymentEndToEnd.php +++ b/src/Types/PIX/PaymentEndToEnd.php @@ -8,10 +8,6 @@ class PaymentEndToEnd extends Data { public string $dpp; - - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/PaymentInit.php b/src/Types/PIX/PaymentInit.php index 0e307a4..c8cd38e 100644 --- a/src/Types/PIX/PaymentInit.php +++ b/src/Types/PIX/PaymentInit.php @@ -7,25 +7,37 @@ class PaymentInit extends Data { public float $amount; + public float $vlcpAmount; + public float $vldnAmount; + public string $withdrawalServiceProvider; + public string $withdrawalAgentMode; + public string $clientCode; + public string $transactionIdentification; + public string $endToEndId; + public DebitPartyObject $debitParty; + public CreditPartyObject $creditParty; + public string $initiationType; + public string $taxIdPaymentInitiator; + public string $remittanceInformation; + public string $paymentType; + public string $urgency; + public string $transactionType; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/PaymentStatus.php b/src/Types/PIX/PaymentStatus.php index 17f6ed2..cc5b62e 100644 --- a/src/Types/PIX/PaymentStatus.php +++ b/src/Types/PIX/PaymentStatus.php @@ -7,12 +7,11 @@ class PaymentStatus extends Data { public string $transactionId; + public string $endtoendId; + public string $clientCode; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/PixReactivateAndResendAllPendingMessages.php b/src/Types/PIX/PixReactivateAndResendAllPendingMessages.php index fa16d4e..2215bbe 100644 --- a/src/Types/PIX/PixReactivateAndResendAllPendingMessages.php +++ b/src/Types/PIX/PixReactivateAndResendAllPendingMessages.php @@ -7,6 +7,7 @@ class PixReactivateAndResendAllPendingMessages extends Data { public string $dateFrom; + public int $dateTo; public function __construct(array $data = []) diff --git a/src/Types/PIX/PixReceivementStatus.php b/src/Types/PIX/PixReceivementStatus.php index bac9452..64afa03 100644 --- a/src/Types/PIX/PixReceivementStatus.php +++ b/src/Types/PIX/PixReceivementStatus.php @@ -7,7 +7,9 @@ class PixReceivementStatus extends Data { public string $endtoEndId; + public int $transactionId; + public int $transactionIdBrCode; public function __construct(array $data = []) diff --git a/src/Types/PIX/PixReverseCreate.php b/src/Types/PIX/PixReverseCreate.php index 066c660..6024385 100644 --- a/src/Types/PIX/PixReverseCreate.php +++ b/src/Types/PIX/PixReverseCreate.php @@ -6,16 +6,18 @@ class PixReverseCreate extends Data { - public string $clientCode; + public float $amount; + public string $reason; + public string $additionalInformation; + public string $reversalDescription; public function __construct(array $data = []) { parent::__construct($data); } - } diff --git a/src/Types/PIX/PixReverseGetStatus.php b/src/Types/PIX/PixReverseGetStatus.php index f996d69..f573e7d 100644 --- a/src/Types/PIX/PixReverseGetStatus.php +++ b/src/Types/PIX/PixReverseGetStatus.php @@ -7,7 +7,9 @@ class PixReverseGetStatus extends Data { public string $returnIdentification; + public int $transactionId; + public string $clientCode; public function __construct(array $data = []) diff --git a/src/Types/PIX/PixWebhookGetList.php b/src/Types/PIX/PixWebhookGetList.php index 2bdbc93..02a47da 100644 --- a/src/Types/PIX/PixWebhookGetList.php +++ b/src/Types/PIX/PixWebhookGetList.php @@ -7,9 +7,13 @@ class PixWebhookGetList extends Data { public string $dateFrom; + public string $dateTo; + public int $limit; + public int $start; + public bool $onlyPending; public function __construct(array $data = []) diff --git a/src/Types/PIX/QRLocation.php b/src/Types/PIX/QRLocation.php index 66c04b3..ba47ae8 100644 --- a/src/Types/PIX/QRLocation.php +++ b/src/Types/PIX/QRLocation.php @@ -7,12 +7,11 @@ class QRLocation extends Data { public string $clientRequestId; + public string $type; + public Merchant $merchant; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/PIX/QRStaticPayment.php b/src/Types/PIX/QRStaticPayment.php index cf54305..8dcc70f 100644 --- a/src/Types/PIX/QRStaticPayment.php +++ b/src/Types/PIX/QRStaticPayment.php @@ -7,22 +7,23 @@ class QRStaticPayment extends Data { public string $key; + public string $transactionIdentification; + public string $additionalInformation; public ?string $amount; + /** * @var array */ public array $tags; + public Merchant $merchant; - /** - * @param array $data - */ public function __construct(array $data = []) { - if (!empty($data['amount'])) { + if (! empty($data['amount'])) { $data['amount'] = number_format($data['amount'], 2, '.', ''); } parent::__construct($data); diff --git a/src/Types/PIX/Receiver.php b/src/Types/PIX/Receiver.php index f8f1fef..4370575 100644 --- a/src/Types/PIX/Receiver.php +++ b/src/Types/PIX/Receiver.php @@ -7,17 +7,21 @@ class Receiver extends Data { public string $name; + public string $cpf; + public string $cnpj; + public string $postalCode; + public string $city; + public string $publicArea; + public string $state; + public string $fantasyName; - /** - * @param array $data - */ public function __construct(array $data = []) { parent::__construct($data); diff --git a/src/Types/Topups/Cancel.php b/src/Types/Topups/Cancel.php index d42fca5..7d1641f 100644 --- a/src/Types/Topups/Cancel.php +++ b/src/Types/Topups/Cancel.php @@ -7,6 +7,7 @@ class Cancel extends Data { public int $externalNSU; + public string $externalTerminal; public function __construct(array $data = []) diff --git a/src/Types/Topups/Confirm.php b/src/Types/Topups/Confirm.php index 0402ee4..a8f1413 100644 --- a/src/Types/Topups/Confirm.php +++ b/src/Types/Topups/Confirm.php @@ -7,6 +7,7 @@ class Confirm extends Data { public int $externalNSU; + public string $externalTerminal; public function __construct(array $data = []) diff --git a/src/Types/Topups/Create.php b/src/Types/Topups/Create.php index 98d9a9b..fcfbc4d 100644 --- a/src/Types/Topups/Create.php +++ b/src/Types/Topups/Create.php @@ -7,11 +7,17 @@ class Create extends Data { public string $externalTerminal; + public int $externalNsu; + public TopupData $topupData; + public string $cpfCnpj; + public ?string $signerCode; + public int $providerId; + public Phone $phone; public function __construct(array $data = []) diff --git a/src/Types/Topups/Phone.php b/src/Types/Topups/Phone.php index 1b2b9d6..ce76dc5 100644 --- a/src/Types/Topups/Phone.php +++ b/src/Types/Topups/Phone.php @@ -7,7 +7,9 @@ class Phone extends Data { public int $stateCode; + public int $countryCode; + public string $number; public function __construct(array $data = []) diff --git a/src/Types/Topups/Providers.php b/src/Types/Topups/Providers.php index bbc3a3e..05a8198 100644 --- a/src/Types/Topups/Providers.php +++ b/src/Types/Topups/Providers.php @@ -9,7 +9,9 @@ class Providers extends Data { public int $stateCode; + public TopupProvidersTypeEnum $type; + public TopupProvidersCategoryEnum $category; public function __construct(array $data = []) diff --git a/src/Types/Topups/ProvidersValues.php b/src/Types/Topups/ProvidersValues.php index cd64727..0eddab9 100644 --- a/src/Types/Topups/ProvidersValues.php +++ b/src/Types/Topups/ProvidersValues.php @@ -7,6 +7,7 @@ class ProvidersValues extends Data { public int $stateCode; + public string $providerId; public function __construct(array $data = []) diff --git a/tests/Feature/CelcoinAuthEventFiredTest.php b/tests/Feature/CelcoinAuthEventFiredTest.php index 5a069e7..b0dd4dc 100644 --- a/tests/Feature/CelcoinAuthEventFiredTest.php +++ b/tests/Feature/CelcoinAuthEventFiredTest.php @@ -11,7 +11,6 @@ class CelcoinAuthEventFiredTest extends TestCase { - public function testSuccess() { Event::fake(); diff --git a/tests/Feature/CelcoinClientInstancesTest.php b/tests/Feature/CelcoinClientInstancesTest.php index c58e6c1..64d2025 100644 --- a/tests/Feature/CelcoinClientInstancesTest.php +++ b/tests/Feature/CelcoinClientInstancesTest.php @@ -29,7 +29,6 @@ class CelcoinClientInstancesTest extends TestCase { - public function testSuccessCreateInstanceAssistant() { $instance = Celcoin::clientAssistant(); diff --git a/tests/Feature/CelcoinFacadeTest.php b/tests/Feature/CelcoinFacadeTest.php index bdc45ff..43b8d85 100644 --- a/tests/Feature/CelcoinFacadeTest.php +++ b/tests/Feature/CelcoinFacadeTest.php @@ -8,7 +8,6 @@ class CelcoinFacadeTest extends TestCase { - public function testSuccess() { $instance = App::make('celcoin'); diff --git a/tests/Feature/ClassDataGetSetIssetTest.php b/tests/Feature/ClassDataGetSetIssetTest.php index 4f0d8b3..8fabbd3 100644 --- a/tests/Feature/ClassDataGetSetIssetTest.php +++ b/tests/Feature/ClassDataGetSetIssetTest.php @@ -9,7 +9,6 @@ class ClassDataGetSetIssetTest extends TestCase { - public function testSuccessGetSetData() { $data = new RegisterWebhooks([ @@ -45,132 +44,132 @@ public function testSuccessToArrayWithEnum() 'login' => 'login_teste', 'pwd' => 'pwd_teste', 'type' => 'type_teste', - "attributes" => [], + 'attributes' => [], ], - "attributes" => [], + 'attributes' => [], ], $data->toArray()); } public function testSuccessToArrayWithNullableProperty() { $data = new AccountManagerBusiness([ - "contactNumber" => 'a', - "businessEmail" => 'b', - "businessAddress" => [ - "postalCode" => 's', - "street" => 't', - "number" => 'u', - "addressComplement" => "v", - "neighborhood" => 'x', - "city" => 'z', - "state" => '1', - "longitude" => '2', - "latitude" => '3', + 'contactNumber' => 'a', + 'businessEmail' => 'b', + 'businessAddress' => [ + 'postalCode' => 's', + 'street' => 't', + 'number' => 'u', + 'addressComplement' => 'v', + 'neighborhood' => 'x', + 'city' => 'z', + 'state' => '1', + 'longitude' => '2', + 'latitude' => '3', ], ]); $this->assertEquals([ - "contactNumber" => 'a', - "businessEmail" => 'b', - "owners" => [], - "businessAddress" => [ - "postalCode" => 's', - "street" => 't', - "number" => 'u', - "addressComplement" => "v", - "neighborhood" => 'x', - "city" => 'z', - "state" => '1', - "longitude" => '2', - "latitude" => '3', - "attributes" => [], + 'contactNumber' => 'a', + 'businessEmail' => 'b', + 'owners' => [], + 'businessAddress' => [ + 'postalCode' => 's', + 'street' => 't', + 'number' => 'u', + 'addressComplement' => 'v', + 'neighborhood' => 'x', + 'city' => 'z', + 'state' => '1', + 'longitude' => '2', + 'latitude' => '3', + 'attributes' => [], ], - "attributes" => [], + 'attributes' => [], ], $data->toArray()); } public function testSuccessToArray() { $data = new AccountManagerBusiness([ - "contactNumber" => 'a', - "businessEmail" => 'b', - "owners" => [ + 'contactNumber' => 'a', + 'businessEmail' => 'b', + 'owners' => [ [ - "documentNumber" => 'c', - "phoneNumber" => 'd', - "email" => 'e', - "fullName" => 'f', - "socialName" => 'g', - "birthDate" => 'h', - "motherName" => 'i', - "address" => [ - "postalCode" => 'j', - "street" => 'k', - "number" => 'l', - "addressComplement" => "m", - "neighborhood" => 'n', - "city" => 'o', - "state" => 'p', - "longitude" => 'q', - "latitude" => 'r', + 'documentNumber' => 'c', + 'phoneNumber' => 'd', + 'email' => 'e', + 'fullName' => 'f', + 'socialName' => 'g', + 'birthDate' => 'h', + 'motherName' => 'i', + 'address' => [ + 'postalCode' => 'j', + 'street' => 'k', + 'number' => 'l', + 'addressComplement' => 'm', + 'neighborhood' => 'n', + 'city' => 'o', + 'state' => 'p', + 'longitude' => 'q', + 'latitude' => 'r', ], - "isPoliticallyExposedPerson" => false, + 'isPoliticallyExposedPerson' => false, ], ], - "businessAddress" => [ - "postalCode" => 's', - "street" => 't', - "number" => 'u', - "addressComplement" => "v", - "neighborhood" => 'x', - "city" => 'z', - "state" => '1', - "longitude" => '2', - "latitude" => '3', + 'businessAddress' => [ + 'postalCode' => 's', + 'street' => 't', + 'number' => 'u', + 'addressComplement' => 'v', + 'neighborhood' => 'x', + 'city' => 'z', + 'state' => '1', + 'longitude' => '2', + 'latitude' => '3', ], ]); $this->assertEquals([ - "contactNumber" => 'a', - "businessEmail" => 'b', - "owners" => [ + 'contactNumber' => 'a', + 'businessEmail' => 'b', + 'owners' => [ [ - "documentNumber" => 'c', - "phoneNumber" => 'd', - "email" => 'e', - "fullName" => 'f', - "socialName" => 'g', - "birthDate" => 'h', - "motherName" => 'i', - "address" => [ - "postalCode" => 'j', - "street" => 'k', - "number" => 'l', - "addressComplement" => "m", - "neighborhood" => 'n', - "city" => 'o', - "state" => 'p', - "longitude" => 'q', - "latitude" => 'r', - "attributes" => [], + 'documentNumber' => 'c', + 'phoneNumber' => 'd', + 'email' => 'e', + 'fullName' => 'f', + 'socialName' => 'g', + 'birthDate' => 'h', + 'motherName' => 'i', + 'address' => [ + 'postalCode' => 'j', + 'street' => 'k', + 'number' => 'l', + 'addressComplement' => 'm', + 'neighborhood' => 'n', + 'city' => 'o', + 'state' => 'p', + 'longitude' => 'q', + 'latitude' => 'r', + 'attributes' => [], ], - "isPoliticallyExposedPerson" => false, - "attributes" => [], + 'isPoliticallyExposedPerson' => false, + 'attributes' => [], ], ], - "businessAddress" => [ - "postalCode" => 's', - "street" => 't', - "number" => 'u', - "addressComplement" => "v", - "neighborhood" => 'x', - "city" => 'z', - "state" => '1', - "longitude" => '2', - "latitude" => '3', - "attributes" => [], + 'businessAddress' => [ + 'postalCode' => 's', + 'street' => 't', + 'number' => 'u', + 'addressComplement' => 'v', + 'neighborhood' => 'x', + 'city' => 'z', + 'state' => '1', + 'longitude' => '2', + 'latitude' => '3', + 'attributes' => [], ], - "attributes" => [], + 'attributes' => [], ], $data->toArray()); } diff --git a/tests/Feature/EnumFromStringTest.php b/tests/Feature/EnumFromStringTest.php index 9b00cd0..03e32ee 100644 --- a/tests/Feature/EnumFromStringTest.php +++ b/tests/Feature/EnumFromStringTest.php @@ -8,7 +8,6 @@ class EnumFromStringTest extends TestCase { - /** * @return void */ diff --git a/tests/GlobalStubs.php b/tests/GlobalStubs.php index d16390b..75cd36e 100644 --- a/tests/GlobalStubs.php +++ b/tests/GlobalStubs.php @@ -8,10 +8,7 @@ class GlobalStubs { - /** - * @return PromiseInterface - */ - final static public function loginResponse(): PromiseInterface + final public static function loginResponse(): PromiseInterface { return Http::response( [ diff --git a/tests/Integration/Assistant/BanksTest.php b/tests/Integration/Assistant/BanksTest.php index 9bc2791..abab19c 100644 --- a/tests/Integration/Assistant/BanksTest.php +++ b/tests/Integration/Assistant/BanksTest.php @@ -32,20 +32,20 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "banks" => [ + 'banks' => [ [ - "institutionCode" => 604, - "description" => "604 - 604 - BANCO INDUSTRIAL DO BRASIL S. A.", - "institutionName" => "604 - BANCO INDUSTRIAL DO BRASIL S. A.", + 'institutionCode' => 604, + 'description' => '604 - 604 - BANCO INDUSTRIAL DO BRASIL S. A.', + 'institutionName' => '604 - BANCO INDUSTRIAL DO BRASIL S. A.', ], ], - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/Assistant/FindInstitutionsTest.php b/tests/Integration/Assistant/FindInstitutionsTest.php index 5d1b3f6..3a215a8 100644 --- a/tests/Integration/Assistant/FindInstitutionsTest.php +++ b/tests/Integration/Assistant/FindInstitutionsTest.php @@ -32,25 +32,25 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "convenants" => [ + 'convenants' => [ [ - "timeLimit" => "12:00", - "mask" => "99______________9999____________________________", - "nomeconvenant" => "EXEMPLO 1", - "type" => "ESTADUAL", - "UF" => [ - "SP", - "RJ", + 'timeLimit' => '12:00', + 'mask' => '99______________9999____________________________', + 'nomeconvenant' => 'EXEMPLO 1', + 'type' => 'ESTADUAL', + 'UF' => [ + 'SP', + 'RJ', ], ], ], - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/Assistant/GetBalanceTest.php b/tests/Integration/Assistant/GetBalanceTest.php index b0a564f..bb03b56 100644 --- a/tests/Integration/Assistant/GetBalanceTest.php +++ b/tests/Integration/Assistant/GetBalanceTest.php @@ -32,18 +32,18 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "anticipated" => 0, - "reconcileExecuting" => "N", - "consumed" => 0, - "credit" => 0.01, - "balance" => 999999999.01, - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'anticipated' => 0, + 'reconcileExecuting' => 'N', + 'consumed' => 0, + 'credit' => 0.01, + 'balance' => 999999999.01, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/Assistant/GetReceiptTest.php b/tests/Integration/Assistant/GetReceiptTest.php index bae4d51..dd5e8cf 100644 --- a/tests/Integration/Assistant/GetReceiptTest.php +++ b/tests/Integration/Assistant/GetReceiptTest.php @@ -32,29 +32,29 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "isExpired" => true, - "convenant" => "CELCOIN", - "authentication" => 3470, - "receipt" => [ - "receiptData" => "", - "receiptformatted" => " PROTOCOLO 0007098104\r\n1 24/06/2021 17:49\r\nTERM 228005 AGENTE 228005 AUTE 06153\r\n----------------------------------------\r\nAUTO 919755 PAGAMENTO\r\n \r\n GENERICA CC\r\n 82610000000-7 30700022001-1 \r\n 06104045000-1 03202180003-5\r\n----------------------------------------\r\nDATA DE LIQUIDACAO 24/06/2021\r\nVALOR COBRADO 30,70\r\n\r\n VALIDO COMO RECIBO DE PAGAMENTO\r\n----------------------------------------\r\n AUTENTICACAO\r\n 2D.46.A6.46.99.A4.22.2D\r\n 86.32.67.47.DC.B8.B8.E1\r\n----------------------------------------\r\n \r\nCONSULTE A AUTENTICA??O EM:\r\nCELCOIN.COM.BR/AUTENTICACAO\r\n\r\n", + 'isExpired' => true, + 'convenant' => 'CELCOIN', + 'authentication' => 3470, + 'receipt' => [ + 'receiptData' => '', + 'receiptformatted' => " PROTOCOLO 0007098104\r\n1 24/06/2021 17:49\r\nTERM 228005 AGENTE 228005 AUTE 06153\r\n----------------------------------------\r\nAUTO 919755 PAGAMENTO\r\n \r\n GENERICA CC\r\n 82610000000-7 30700022001-1 \r\n 06104045000-1 03202180003-5\r\n----------------------------------------\r\nDATA DE LIQUIDACAO 24/06/2021\r\nVALOR COBRADO 30,70\r\n\r\n VALIDO COMO RECIBO DE PAGAMENTO\r\n----------------------------------------\r\n AUTENTICACAO\r\n 2D.46.A6.46.99.A4.22.2D\r\n 86.32.67.47.DC.B8.B8.E1\r\n----------------------------------------\r\n \r\nCONSULTE A AUTENTICA??O EM:\r\nCELCOIN.COM.BR/AUTENTICACAO\r\n\r\n", ], - "authenticationAPI" => [ - "bloco1" => "CC.D7.0F.AF.BF.76.8B.D8", - "bloco2" => "E3.30.DC.BF.C5.FB.5F.54", - "blocoCompleto" => "CC.D7.0F.AF.BF.76.8B.D8.E3.30.DC.BF.C5.FB.5F.54", + 'authenticationAPI' => [ + 'bloco1' => 'CC.D7.0F.AF.BF.76.8B.D8', + 'bloco2' => 'E3.30.DC.BF.C5.FB.5F.54', + 'blocoCompleto' => 'CC.D7.0F.AF.BF.76.8B.D8.E3.30.DC.BF.C5.FB.5F.54', ], - "settleDate" => "2021-06-24T00:00:00", - "createDate" => "2021-06-24T11:31:10", - "transactionId" => 7098104, - "urlreceipt" => "https://www.celcoin.com.br", - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'settleDate' => '2021-06-24T00:00:00', + 'createDate' => '2021-06-24T11:31:10', + 'transactionId' => 7098104, + 'urlreceipt' => 'https://www.celcoin.com.br', + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/Assistant/HealthCheckTest.php b/tests/Integration/Assistant/HealthCheckTest.php index bfb6694..f202ef9 100644 --- a/tests/Integration/Assistant/HealthCheckTest.php +++ b/tests/Integration/Assistant/HealthCheckTest.php @@ -33,26 +33,26 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "HealthCheck" => [ + 'HealthCheck' => [ [ - "kpiAvailability" => -1.0, - "statusKPIAvailability" => -1, - "statusAverageTime" => -1, - "averageTime" => -1.0, - "thresholdKPIAvailabilityDown" => 80.0, - "thresholdKPIAvailabilityUP" => 99.0, - "thresholdAverageTimeDown" => 12.0, - "thresholdAverageTimeUP" => 2.5, - "transaction" => "CONSULTADADOSCONTA", + 'kpiAvailability' => -1.0, + 'statusKPIAvailability' => -1, + 'statusAverageTime' => -1, + 'averageTime' => -1.0, + 'thresholdKPIAvailabilityDown' => 80.0, + 'thresholdKPIAvailabilityUP' => 99.0, + 'thresholdAverageTimeDown' => 12.0, + 'thresholdAverageTimeUP' => 2.5, + 'transaction' => 'CONSULTADADOSCONTA', ], ], - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/Assistant/PendenciesTest.php b/tests/Integration/Assistant/PendenciesTest.php index 2d81ac7..d4b602a 100644 --- a/tests/Integration/Assistant/PendenciesTest.php +++ b/tests/Integration/Assistant/PendenciesTest.php @@ -32,25 +32,25 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "pendings" => [ - "transactions" => [ + 'pendings' => [ + 'transactions' => [ [ - "authentication" => 3470, - "createDate" => "2021-06-24T11:31:10", - "externalNSU" => 1234, - "transactionId" => 7061967, - "status" => 4, - "externalTerminal" => "11122233344", + 'authentication' => 3470, + 'createDate' => '2021-06-24T11:31:10', + 'externalNSU' => 1234, + 'transactionId' => 7061967, + 'status' => 4, + 'externalTerminal' => '11122233344', ], ], ], - "errorCode" => "000", - "message" => "SUCESSO", - "status" => "0", + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => '0', ], Response::HTTP_OK, ); diff --git a/tests/Integration/Assistant/StatusConsultTest.php b/tests/Integration/Assistant/StatusConsultTest.php index ccdc829..ce4983f 100644 --- a/tests/Integration/Assistant/StatusConsultTest.php +++ b/tests/Integration/Assistant/StatusConsultTest.php @@ -32,23 +32,23 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "transaction" => [ - "authentication" => 0, - "errorCode" => "061", - "createDate" => "0001-01-01T00:00:00", - "message" => "Transacao nao encontrada", - "externalNSU" => 1234, - "transactionId" => 1, - "status" => 1, - "externalTerminal" => null, + 'transaction' => [ + 'authentication' => 0, + 'errorCode' => '061', + 'createDate' => '0001-01-01T00:00:00', + 'message' => 'Transacao nao encontrada', + 'externalNSU' => 1234, + 'transactionId' => 1, + 'status' => 1, + 'externalTerminal' => null, ], - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/BAAS/ActiveAccountTest.php b/tests/Integration/BAAS/ActiveAccountTest.php index f55a69b..9091db4 100644 --- a/tests/Integration/BAAS/ActiveAccountTest.php +++ b/tests/Integration/BAAS/ActiveAccountTest.php @@ -11,7 +11,6 @@ class ActiveAccountTest extends TestCase { - /** * @return void */ @@ -29,17 +28,17 @@ public function testSuccess() ); $baas = new CelcoinBAAS(); - $response = $baas->activeAccount('Ativando', '300541976902',); + $response = $baas->activeAccount('Ativando', '300541976902'); $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "SUCCESS", + 'version' => '1.0.0', + 'status' => 'SUCCESS', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BAAS/BillPaymentTest.php b/tests/Integration/BAAS/BillPaymentTest.php index 4fe704c..15582a2 100644 --- a/tests/Integration/BAAS/BillPaymentTest.php +++ b/tests/Integration/BAAS/BillPaymentTest.php @@ -45,7 +45,6 @@ public function testSuccess(): void $result = $client->makePayment($billet); - $this->assertEquals('PROCESSING', $result['status']); $this->assertEquals('ce9b8d9b-0617-42e1-b500-80bf9d8154cf', $result['body']['id']); } @@ -82,49 +81,49 @@ public function testGetBilletSuccess(): void public static function makePaymentStubSuccess(): PromiseInterface { return Http::response([ - "body" => [ - "id" => "ce9b8d9b-0617-42e1-b500-80bf9d8154cf", - "clientRequestId" => "5555", - "amount" => 59.9, - "transactionIdAuthorize" => 1234, - "tags" => [ + 'body' => [ + 'id' => 'ce9b8d9b-0617-42e1-b500-80bf9d8154cf', + 'clientRequestId' => '5555', + 'amount' => 59.9, + 'transactionIdAuthorize' => 1234, + 'tags' => [ [ - "key" => "PaymentType", - "value" => "Contas Internas", + 'key' => 'PaymentType', + 'value' => 'Contas Internas', ], ], - "barCodeInfo" => [ - "digitable" => "23793381286008301352856000063307789840000150000", + 'barCodeInfo' => [ + 'digitable' => '23793381286008301352856000063307789840000150000', ], ], - "status" => "PROCESSING", - "version" => "1.0.0", + 'status' => 'PROCESSING', + 'version' => '1.0.0', ], 200); } public static function getPaymentStubSuccess(): PromiseInterface { return Http::response([ - "body" => [ - "id" => "10a806a1-267g-5803-93e3-fc215a8b156f", - "clientRequestId" => "clientRequest01", - "account" => 321, - "amount" => 5, - "transactionIdAuthorize" => 123, - "hasOccurrence" => false, - "tags" => [ + 'body' => [ + 'id' => '10a806a1-267g-5803-93e3-fc215a8b156f', + 'clientRequestId' => 'clientRequest01', + 'account' => 321, + 'amount' => 5, + 'transactionIdAuthorize' => 123, + 'hasOccurrence' => false, + 'tags' => [ [ - "key" => "PaymentType", - "value" => "Contas Internas", + 'key' => 'PaymentType', + 'value' => 'Contas Internas', ], ], - "barCodeInfo" => [ - "digitable" => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + 'barCodeInfo' => [ + 'digitable' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', ], - "paymentDate" => "2023-09-01T00:00:00Z", + 'paymentDate' => '2023-09-01T00:00:00Z', ], - "status" => "CONFIRMED", - "version" => "1.1.0", + 'status' => 'CONFIRMED', + 'version' => '1.1.0', ], 200); } -} \ No newline at end of file +} diff --git a/tests/Integration/BAAS/CelcoinBASSBilletTest.php b/tests/Integration/BAAS/CelcoinBASSBilletTest.php index 41e6f48..b0772a2 100644 --- a/tests/Integration/BAAS/CelcoinBASSBilletTest.php +++ b/tests/Integration/BAAS/CelcoinBASSBilletTest.php @@ -17,6 +17,7 @@ class CelcoinBASSBilletTest extends TestCase { use WithFaker; + /** * @throws RequestException */ @@ -44,26 +45,26 @@ public function testCreateBillet() public static function billetBodyRequest(): Billet { return new Billet([ - "externalId" => "externalId1", - "expirationAfterPayment" => 1, - "merchantCatagoryCode" => "0000", - "duedate" => "2023-12-30T00:00:00.0000000", - "amount" => 12.5, - "key" => "testepix@celcoin.com.br", - "debtor" => new BilletDebtor([ - "name" => "João teste de teste", - "document" => "12345678910", - "postalCode" => "06463035", - "publicArea" => "Rua Mãe D'Água", - "complement" => null, - "number" => "1004", - "neighborhood" => "Jardim Mutinga", - "city" => "Barueri", - "state" => "SP" + 'externalId' => 'externalId1', + 'expirationAfterPayment' => 1, + 'merchantCatagoryCode' => '0000', + 'duedate' => '2023-12-30T00:00:00.0000000', + 'amount' => 12.5, + 'key' => 'testepix@celcoin.com.br', + 'debtor' => new BilletDebtor([ + 'name' => 'João teste de teste', + 'document' => '12345678910', + 'postalCode' => '06463035', + 'publicArea' => "Rua Mãe D'Água", + 'complement' => null, + 'number' => '1004', + 'neighborhood' => 'Jardim Mutinga', + 'city' => 'Barueri', + 'state' => 'SP', ]), - "receiver" => new BilletReceiver([ - "document" => "12345678910", - "account" => "30023646056263" + 'receiver' => new BilletReceiver([ + 'document' => '12345678910', + 'account' => '30023646056263', ]), ]); } @@ -71,11 +72,11 @@ public static function billetBodyRequest(): Billet public static function successCreateBilletStub(): PromiseInterface { return Http::response([ - "version" => "1.0.0", - "status" => "SUCCESS", - "body" => [ - "transactionId" => "ce9b8d9b-0617-42e1-b500-80bf9d8154cf" - ] + 'version' => '1.0.0', + 'status' => 'SUCCESS', + 'body' => [ + 'transactionId' => 'ce9b8d9b-0617-42e1-b500-80bf9d8154cf', + ], ]); } @@ -88,7 +89,7 @@ public function testGetBillet() sprintf( '%s%s', config('api_url'), - CelcoinBAASBillet::BILLET_URL . '*', + CelcoinBAASBillet::BILLET_URL.'*', ) => self::successGetBilletStub(), ], ); @@ -104,69 +105,69 @@ public function testGetBillet() public function successGetBilletStub(): PromiseInterface { return Http::response([ - "version" => "1.0.0", - "status" => "SUCCESS", - "body" => [ - "transactionId" => "ce9b8d9b-0617-42e1-b500-80bf9d8154cf", - "externalId" => "externalId1", - "amount" => 12.5, - "amountConfirmed" => 13, - "duedate" => "2023-12-30", - "status" => "CONFIRMED", - "debtor" => [ - "name" => $this->faker->name, - "document" => $this->faker->numerify('###########'), - "postalCode" => "06463035", - "publicArea" => "Rua Mãe D'Água", - "number" => "1004", - "complement" => "Apto 123", - "neighborhood" => "Jardim Mutinga", - "city" => "Barueri", - "state" => "SP" + 'version' => '1.0.0', + 'status' => 'SUCCESS', + 'body' => [ + 'transactionId' => 'ce9b8d9b-0617-42e1-b500-80bf9d8154cf', + 'externalId' => 'externalId1', + 'amount' => 12.5, + 'amountConfirmed' => 13, + 'duedate' => '2023-12-30', + 'status' => 'CONFIRMED', + 'debtor' => [ + 'name' => $this->faker->name, + 'document' => $this->faker->numerify('###########'), + 'postalCode' => '06463035', + 'publicArea' => "Rua Mãe D'Água", + 'number' => '1004', + 'complement' => 'Apto 123', + 'neighborhood' => 'Jardim Mutinga', + 'city' => 'Barueri', + 'state' => 'SP', ], - "receiver" => [ - "name" => "Emilly Malu Tereza Sales", - "document" => $this->faker->numerify('###########'), - "postalCode" => "06474070", - "publicArea" => "Alameda França", - "city" => "Barueri", - "state" => "SP", - "account" => "30023646056263" + 'receiver' => [ + 'name' => 'Emilly Malu Tereza Sales', + 'document' => $this->faker->numerify('###########'), + 'postalCode' => '06474070', + 'publicArea' => 'Alameda França', + 'city' => 'Barueri', + 'state' => 'SP', + 'account' => '30023646056263', ], - "instructions" => [ - "fine" => 10, - "interest" => 5, - "discount" => [ - "amount" => 1, - "modality" => "fixed", - "limitDate" => "2023-12-20T00:00:00.0000000" - ] + 'instructions' => [ + 'fine' => 10, + 'interest' => 5, + 'discount' => [ + 'amount' => 1, + 'modality' => 'fixed', + 'limitDate' => '2023-12-20T00:00:00.0000000', + ], ], - "boleto" => [ - "transactionId" => "32290", - "status" => "Pago", - "bankEmissor" => "santander", - "bankNumber" => "4000178961", - "bankAgency" => "1004", - "bankAccount" => "0220060", - "barCode" => "03392942700000009009022006000040001789610101", - "bankLine" => "03399022070600004000317896101015294270000000900", - "bankAssignor" => "CELCOIN INSTITUIÇÃO DE PAGAMENTO - SA" + 'boleto' => [ + 'transactionId' => '32290', + 'status' => 'Pago', + 'bankEmissor' => 'santander', + 'bankNumber' => '4000178961', + 'bankAgency' => '1004', + 'bankAccount' => '0220060', + 'barCode' => '03392942700000009009022006000040001789610101', + 'bankLine' => '03399022070600004000317896101015294270000000900', + 'bankAssignor' => 'CELCOIN INSTITUIÇÃO DE PAGAMENTO - SA', ], - "pix" => [ - "transactionId" => "817885753", - "transactionIdentification" => "817885753", - "status" => "Cancelado", - "key" => "teste@chavepix.com.br", - "emv" => "00020101021226980014br.gov.bcb.pix2576api-h.developer.btgpactual.com/pc/p/v2/cobv/303928a7b4034de09fddec6d1258c15d5204000053039865802BR5910Merle Yost6008Orinside61080863968162070503***6304D7D3" + 'pix' => [ + 'transactionId' => '817885753', + 'transactionIdentification' => '817885753', + 'status' => 'Cancelado', + 'key' => 'teste@chavepix.com.br', + 'emv' => '00020101021226980014br.gov.bcb.pix2576api-h.developer.btgpactual.com/pc/p/v2/cobv/303928a7b4034de09fddec6d1258c15d5204000053039865802BR5910Merle Yost6008Orinside61080863968162070503***6304D7D3', ], - "split" => [ + 'split' => [ [ - "amount" => 5, - "account" => "40655847871" - ] - ] - ] + 'amount' => 5, + 'account' => '40655847871', + ], + ], + ], ]); } @@ -181,7 +182,7 @@ public function testFailedCreateBillet() sprintf( '%s%s', config('api_url'), - CelcoinBAASBillet::BILLET_URL . '*', + CelcoinBAASBillet::BILLET_URL.'*', ) => self::failedBilletStub(), ], ); @@ -194,12 +195,12 @@ public function testFailedCreateBillet() public static function failedBilletStub(): PromiseInterface { return Http::response([ - "version" => "1.0.0", - "status" => "ERROR", - "error" => [ - "errorCode" => "CBE001", - "message" => "Ocorreu um erro interno durante a chamada da api." - ] + 'version' => '1.0.0', + 'status' => 'ERROR', + 'error' => [ + 'errorCode' => 'CBE001', + 'message' => 'Ocorreu um erro interno durante a chamada da api.', + ], ], 401); } @@ -214,7 +215,7 @@ public function testSuccessDeleteBillet() sprintf( '%s%s', config('api_url'), - CelcoinBAASBillet::BILLET_URL . '*', + CelcoinBAASBillet::BILLET_URL.'*', ) => self::successCreateBilletStub(), ], ); diff --git a/tests/Integration/BAAS/CheckAccountTest.php b/tests/Integration/BAAS/CheckAccountTest.php index 12e1cae..93be546 100644 --- a/tests/Integration/BAAS/CheckAccountTest.php +++ b/tests/Integration/BAAS/CheckAccountTest.php @@ -11,7 +11,6 @@ class CheckAccountTest extends TestCase { - /** * @return void */ @@ -35,22 +34,22 @@ public function testSuccess() $this->assertEquals('CONFIRMED', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "CONFIRMED", - "body" => [ - "onboardingId" => "39c8e322-9192-498d-947e-2daa4dfc749e", - "clientCode" => "123456", - "createDate" => "2022-12-31T00:00:00.0000000+00:00", - "entity" => "account-create", - "account" => [ - "branch" => "1234", - "account" => "123456", - "name" => "Fernanda Aparecida da Silva", - "documentNumber" => "47855748778", + 'version' => '1.0.0', + 'status' => 'CONFIRMED', + 'body' => [ + 'onboardingId' => '39c8e322-9192-498d-947e-2daa4dfc749e', + 'clientCode' => '123456', + 'createDate' => '2022-12-31T00:00:00.0000000+00:00', + 'entity' => 'account-create', + 'account' => [ + 'branch' => '1234', + 'account' => '123456', + 'name' => 'Fernanda Aparecida da Silva', + 'documentNumber' => '47855748778', ], ], ], diff --git a/tests/Integration/BAAS/CreateAccountBusinessTest.php b/tests/Integration/BAAS/CreateAccountBusinessTest.php index 14d78e1..c38efd1 100644 --- a/tests/Integration/BAAS/CreateAccountBusinessTest.php +++ b/tests/Integration/BAAS/CreateAccountBusinessTest.php @@ -13,7 +13,6 @@ class CreateAccountBusinessTest extends TestCase { - /** * @return void */ @@ -42,48 +41,48 @@ public function testSuccess() $response = $baas->createAccountBusiness( new AccountBusiness( [ - "clientCode" => $fake->uuid(), - "accountOnboardingType" => AccountOnboardingTypeEnum::BANK_ACCOUNT, - "documentNumber" => $fake->cnpj(false), - "contactNumber" => sprintf('+5511%s', $fake->cellphone(false)), - "businessEmail" => $fake->email(), - "businessName" => sprintf('%s %s LTDA', $firstBusinessName, $lastBusinessName), - "tradingName" => $firstBusinessName, - "owner" => [ + 'clientCode' => $fake->uuid(), + 'accountOnboardingType' => AccountOnboardingTypeEnum::BANK_ACCOUNT, + 'documentNumber' => $fake->cnpj(false), + 'contactNumber' => sprintf('+5511%s', $fake->cellphone(false)), + 'businessEmail' => $fake->email(), + 'businessName' => sprintf('%s %s LTDA', $firstBusinessName, $lastBusinessName), + 'tradingName' => $firstBusinessName, + 'owner' => [ [ - "documentNumber" => $fake->cpf(false), - "phoneNumber" => sprintf('+5511%s', $fake->cellphone(false)), - "email" => $fake->email(), - "motherName" => sprintf('%s %s', $fake->firstNameFemale(), $fake->lastName()), - "fullName" => sprintf('%s %s', $firstName, $lastName), - "socialName" => $firstName, - "birthDate" => '15-01-1981', - "address" => [ - "postalCode" => '01153000', - "street" => $fake->streetName(), - "number" => $fake->buildingNumber(), - "addressComplement" => "Em frente ao parque.", - "neighborhood" => 'Centro', - "city" => $fake->city(), - "state" => $fake->stateAbbr(), - "longitude" => $fake->longitude(-23, -24), - "latitude" => $fake->latitude(-46, -47), + 'documentNumber' => $fake->cpf(false), + 'phoneNumber' => sprintf('+5511%s', $fake->cellphone(false)), + 'email' => $fake->email(), + 'motherName' => sprintf('%s %s', $fake->firstNameFemale(), $fake->lastName()), + 'fullName' => sprintf('%s %s', $firstName, $lastName), + 'socialName' => $firstName, + 'birthDate' => '15-01-1981', + 'address' => [ + 'postalCode' => '01153000', + 'street' => $fake->streetName(), + 'number' => $fake->buildingNumber(), + 'addressComplement' => 'Em frente ao parque.', + 'neighborhood' => 'Centro', + 'city' => $fake->city(), + 'state' => $fake->stateAbbr(), + 'longitude' => $fake->longitude(-23, -24), + 'latitude' => $fake->latitude(-46, -47), ], - "isPoliticallyExposedPerson" => false, + 'isPoliticallyExposedPerson' => false, ], ], - "businessAddress" => [ - "postalCode" => '01153000', - "street" => $fake->streetName(), - "number" => $fake->buildingNumber(), - "addressComplement" => "Em frente ao parque.", - "neighborhood" => 'Centro', - "city" => $fake->city(), - "state" => $fake->stateAbbr(), - "longitude" => $fake->longitude(-23, -24), - "latitude" => $fake->latitude(-46, -47), + 'businessAddress' => [ + 'postalCode' => '01153000', + 'street' => $fake->streetName(), + 'number' => $fake->buildingNumber(), + 'addressComplement' => 'Em frente ao parque.', + 'neighborhood' => 'Centro', + 'city' => $fake->city(), + 'state' => $fake->stateAbbr(), + 'longitude' => $fake->longitude(-23, -24), + 'latitude' => $fake->latitude(-46, -47), ], - "cadastraChavePix" => false, + 'cadastraChavePix' => false, ], ), ); @@ -91,14 +90,14 @@ public function testSuccess() $this->assertEquals('PROCESSING', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "PROCESSING", - "body" => [ - "onBoardingId" => "39c8e322-9192-498d-947e-2daa4dfc749e", + 'version' => '1.0.0', + 'status' => 'PROCESSING', + 'body' => [ + 'onBoardingId' => '39c8e322-9192-498d-947e-2daa4dfc749e', ], ], Response::HTTP_OK, diff --git a/tests/Integration/BAAS/CreateAccountNaturalPersonTest.php b/tests/Integration/BAAS/CreateAccountNaturalPersonTest.php index 37e9acb..1787b7d 100644 --- a/tests/Integration/BAAS/CreateAccountNaturalPersonTest.php +++ b/tests/Integration/BAAS/CreateAccountNaturalPersonTest.php @@ -13,7 +13,6 @@ class CreateAccountNaturalPersonTest extends TestCase { - /** * @return void */ @@ -39,27 +38,27 @@ public function testSuccess() $response = $baas->createAccountNaturalPerson( new AccountNaturalPerson( [ - "clientCode" => $fake->uuid(), - "accountOnboardingType" => AccountOnboardingTypeEnum::BANK_ACCOUNT, - "documentNumber" => $fake->cpf(false), - "phoneNumber" => sprintf('+5511%s', $fake->cellphone(false)), - "email" => $fake->email(), - "motherName" => sprintf('%s %s', $fake->firstNameFemale(), $fake->lastName()), - "fullName" => sprintf('%s %s', $firstName, $lastName), - "socialName" => $firstName, - "birthDate" => '15-01-1981', - "address" => [ - "postalCode" => '01153000', - "street" => $fake->streetName(), - "number" => $fake->buildingNumber(), - "addressComplement" => "Em frente ao parque.", - "neighborhood" => 'Centro', - "city" => $fake->city(), - "state" => $fake->stateAbbr(), - "longitude" => $fake->longitude(-23, -24), - "latitude" => $fake->latitude(-46, -47), + 'clientCode' => $fake->uuid(), + 'accountOnboardingType' => AccountOnboardingTypeEnum::BANK_ACCOUNT, + 'documentNumber' => $fake->cpf(false), + 'phoneNumber' => sprintf('+5511%s', $fake->cellphone(false)), + 'email' => $fake->email(), + 'motherName' => sprintf('%s %s', $fake->firstNameFemale(), $fake->lastName()), + 'fullName' => sprintf('%s %s', $firstName, $lastName), + 'socialName' => $firstName, + 'birthDate' => '15-01-1981', + 'address' => [ + 'postalCode' => '01153000', + 'street' => $fake->streetName(), + 'number' => $fake->buildingNumber(), + 'addressComplement' => 'Em frente ao parque.', + 'neighborhood' => 'Centro', + 'city' => $fake->city(), + 'state' => $fake->stateAbbr(), + 'longitude' => $fake->longitude(-23, -24), + 'latitude' => $fake->latitude(-46, -47), ], - "isPoliticallyExposedPerson" => false, + 'isPoliticallyExposedPerson' => false, ], ), ); @@ -67,14 +66,14 @@ public function testSuccess() $this->assertEquals('PROCESSING', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "PROCESSING", - "body" => [ - "onBoardingId" => "39c8e322-9192-498d-947e-2daa4dfc749e", + 'version' => '1.0.0', + 'status' => 'PROCESSING', + 'body' => [ + 'onBoardingId' => '39c8e322-9192-498d-947e-2daa4dfc749e', ], ], Response::HTTP_OK, diff --git a/tests/Integration/BAAS/CreateReleaseTest.php b/tests/Integration/BAAS/CreateReleaseTest.php index dc15b54..0deee1a 100644 --- a/tests/Integration/BAAS/CreateReleaseTest.php +++ b/tests/Integration/BAAS/CreateReleaseTest.php @@ -12,7 +12,6 @@ class CreateReleaseTest extends TestCase { - /** * @return void */ @@ -32,25 +31,25 @@ public function testSuccess() $response = $baasWebhook->createRelease( '300541976902', new AccountRelease([ - "clientCode" => "f9b978a6-ab7e-4460-997d", - "amount" => 20, - "type" => "CREDIT", - "description" => "Deposito", + 'clientCode' => 'f9b978a6-ab7e-4460-997d', + 'amount' => 20, + 'type' => 'CREDIT', + 'description' => 'Deposito', ]), ); $this->assertEquals('CONFIRMED', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "CONFIRMED", - "version" => "1.0.0", - "body" => [ - "id" => "0cdf3a01-71c5-4428-9545-783667ccc289", - "clientCode" => "f9b978a6-ab7e-4460-997d", + 'status' => 'CONFIRMED', + 'version' => '1.0.0', + 'body' => [ + 'id' => '0cdf3a01-71c5-4428-9545-783667ccc289', + 'clientCode' => 'f9b978a6-ab7e-4460-997d', ], ], Response::HTTP_OK, diff --git a/tests/Integration/BAAS/DeleteAccountTest.php b/tests/Integration/BAAS/DeleteAccountTest.php index feb67d5..af9f50b 100644 --- a/tests/Integration/BAAS/DeleteAccountTest.php +++ b/tests/Integration/BAAS/DeleteAccountTest.php @@ -11,7 +11,6 @@ class DeleteAccountTest extends TestCase { - /** * @return void */ @@ -41,12 +40,12 @@ public function testSuccess() $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "SUCCESS", + 'version' => '1.0.0', + 'status' => 'SUCCESS', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BAAS/DisableAccountTest.php b/tests/Integration/BAAS/DisableAccountTest.php index a79ff3c..4c606bd 100644 --- a/tests/Integration/BAAS/DisableAccountTest.php +++ b/tests/Integration/BAAS/DisableAccountTest.php @@ -11,7 +11,6 @@ class DisableAccountTest extends TestCase { - /** * @return void */ @@ -34,12 +33,12 @@ public function testSuccess() $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "SUCCESS", + 'version' => '1.0.0', + 'status' => 'SUCCESS', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BAAS/GetInfoAccountBusinessTest.php b/tests/Integration/BAAS/GetInfoAccountBusinessTest.php index ef066ef..1172670 100644 --- a/tests/Integration/BAAS/GetInfoAccountBusinessTest.php +++ b/tests/Integration/BAAS/GetInfoAccountBusinessTest.php @@ -11,7 +11,6 @@ class GetInfoAccountBusinessTest extends TestCase { - /** * @return void */ @@ -35,38 +34,38 @@ public function testSuccess() $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "SUCCESS", - "body" => [ - "statusAccount" => "ATIVO", - "documentNumber" => "25400754015", - "phoneNumber" => "+5512981175704", - "email" => "email4@email.com", - "motherName" => "Nome Sobrenome", - "fullName" => "Nome Sobrenome", - "socialName" => "Nome", - "birthDate" => "31-12-1984", - "address" => [ - "postalCode" => "12211400", - "street" => "Av Paulista", - "number" => "313", - "addressComplement" => "Em frente ao parque.", - "neighborhood" => "Bairro", - "city" => "São Paulo", - "state" => "SP", - "longitude" => "-46.6488", - "latitude" => "-23.6288", + 'version' => '1.0.0', + 'status' => 'SUCCESS', + 'body' => [ + 'statusAccount' => 'ATIVO', + 'documentNumber' => '25400754015', + 'phoneNumber' => '+5512981175704', + 'email' => 'email4@email.com', + 'motherName' => 'Nome Sobrenome', + 'fullName' => 'Nome Sobrenome', + 'socialName' => 'Nome', + 'birthDate' => '31-12-1984', + 'address' => [ + 'postalCode' => '12211400', + 'street' => 'Av Paulista', + 'number' => '313', + 'addressComplement' => 'Em frente ao parque.', + 'neighborhood' => 'Bairro', + 'city' => 'São Paulo', + 'state' => 'SP', + 'longitude' => '-46.6488', + 'latitude' => '-23.6288', ], - "isPoliticallyExposedPerson" => false, - "account" => [ - "branch" => "0001", - "account" => "300539137798", + 'isPoliticallyExposedPerson' => false, + 'account' => [ + 'branch' => '0001', + 'account' => '300539137798', ], - "createDate" => "2022-10-28T13:50:55", + 'createDate' => '2022-10-28T13:50:55', ], ], Response::HTTP_OK, diff --git a/tests/Integration/BAAS/GetInfoAccountNaturalPersonTest.php b/tests/Integration/BAAS/GetInfoAccountNaturalPersonTest.php index 7c0caf5..61a69e7 100644 --- a/tests/Integration/BAAS/GetInfoAccountNaturalPersonTest.php +++ b/tests/Integration/BAAS/GetInfoAccountNaturalPersonTest.php @@ -11,7 +11,6 @@ class GetInfoAccountNaturalPersonTest extends TestCase { - /** * @return void */ @@ -35,38 +34,38 @@ public function testSuccess() $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "SUCCESS", - "body" => [ - "statusAccount" => "ATIVO", - "documentNumber" => "25400754015", - "phoneNumber" => "+5512981175704", - "email" => "email4@email.com", - "motherName" => "Nome Sobrenome", - "fullName" => "Nome Sobrenome", - "socialName" => "Nome", - "birthDate" => "31-12-1984", - "address" => [ - "postalCode" => "12211400", - "street" => "Av Paulista", - "number" => "313", - "addressComplement" => "Em frente ao parque.", - "neighborhood" => "Bairro", - "city" => "São Paulo", - "state" => "SP", - "longitude" => "-46.6488", - "latitude" => "-23.6288", + 'version' => '1.0.0', + 'status' => 'SUCCESS', + 'body' => [ + 'statusAccount' => 'ATIVO', + 'documentNumber' => '25400754015', + 'phoneNumber' => '+5512981175704', + 'email' => 'email4@email.com', + 'motherName' => 'Nome Sobrenome', + 'fullName' => 'Nome Sobrenome', + 'socialName' => 'Nome', + 'birthDate' => '31-12-1984', + 'address' => [ + 'postalCode' => '12211400', + 'street' => 'Av Paulista', + 'number' => '313', + 'addressComplement' => 'Em frente ao parque.', + 'neighborhood' => 'Bairro', + 'city' => 'São Paulo', + 'state' => 'SP', + 'longitude' => '-46.6488', + 'latitude' => '-23.6288', ], - "isPoliticallyExposedPerson" => false, - "account" => [ - "branch" => "0001", - "account" => "300539137798", + 'isPoliticallyExposedPerson' => false, + 'account' => [ + 'branch' => '0001', + 'account' => '300539137798', ], - "createDate" => "2022-10-28T13:50:55", + 'createDate' => '2022-10-28T13:50:55', ], ], Response::HTTP_OK, diff --git a/tests/Integration/BAAS/GetListInfoAccountBusinessTest.php b/tests/Integration/BAAS/GetListInfoAccountBusinessTest.php index 0a73dba..2c211aa 100644 --- a/tests/Integration/BAAS/GetListInfoAccountBusinessTest.php +++ b/tests/Integration/BAAS/GetListInfoAccountBusinessTest.php @@ -12,7 +12,6 @@ class GetListInfoAccountBusinessTest extends TestCase { - /** * @return void */ @@ -39,67 +38,67 @@ public function testSuccess() $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "SUCCESS", - "totalItems" => 3, - "currentPage" => 1, - "totalPages" => 1, - "dateFrom" => "22/10/2022 00:00:00", - "dateTo" => "28/10/2022 23:59:59", - "subAccounts" => [ + 'version' => '1.0.0', + 'status' => 'SUCCESS', + 'totalItems' => 3, + 'currentPage' => 1, + 'totalPages' => 1, + 'dateFrom' => '22/10/2022 00:00:00', + 'dateTo' => '28/10/2022 23:59:59', + 'subAccounts' => [ [ - "statusAccount" => "ATIVO", - "documentNumber" => "25400754015", - "phoneNumber" => "+5512981175704", - "email" => "email4@email.com", - "motherName" => "Nome Sobrenome", - "fullName" => "Nome Sobrenome", - "socialName" => "Nome", - "birthDate" => "31-12-1984", - "address" => [ - "postalCode" => "06455030", - "street" => "Rua das Andorinhas", - "number" => "343", - "addressComplement" => "proximo a lanchonete do zeca", - "neighborhood" => "Rua das Maravilhas", - "city" => "Sao Paulo", - "state" => "SP", - "longitude" => null, - "latitude" => null, + 'statusAccount' => 'ATIVO', + 'documentNumber' => '25400754015', + 'phoneNumber' => '+5512981175704', + 'email' => 'email4@email.com', + 'motherName' => 'Nome Sobrenome', + 'fullName' => 'Nome Sobrenome', + 'socialName' => 'Nome', + 'birthDate' => '31-12-1984', + 'address' => [ + 'postalCode' => '06455030', + 'street' => 'Rua das Andorinhas', + 'number' => '343', + 'addressComplement' => 'proximo a lanchonete do zeca', + 'neighborhood' => 'Rua das Maravilhas', + 'city' => 'Sao Paulo', + 'state' => 'SP', + 'longitude' => null, + 'latitude' => null, ], - "isPoliticallyExposedPerson" => false, - "createDate" => "2022-10-25T20:33:34", - "closeDate" => "2022-10-25T20:33:47", - "closeReason" => "Motivo X", + 'isPoliticallyExposedPerson' => false, + 'createDate' => '2022-10-25T20:33:34', + 'closeDate' => '2022-10-25T20:33:47', + 'closeReason' => 'Motivo X', ], [ - "statusAccount" => "ATIVO", - "documentNumber" => "25400754015", - "phoneNumber" => "+5512981175704", - "email" => "email4@email.com", - "motherName" => "Nome Sobrenome", - "fullName" => "Nome Sobrenome", - "socialName" => "Nome", - "birthDate" => "31-12-1984", - "address" => [ - "postalCode" => "06455030", - "street" => "Rua das Andorinhas", - "number" => "343", - "addressComplement" => "proximo a lanchonete do zeca", - "neighborhood" => "Rua das Maravilhas", - "city" => "Sao Paulo", - "state" => "SP", - "longitude" => null, - "latitude" => null, + 'statusAccount' => 'ATIVO', + 'documentNumber' => '25400754015', + 'phoneNumber' => '+5512981175704', + 'email' => 'email4@email.com', + 'motherName' => 'Nome Sobrenome', + 'fullName' => 'Nome Sobrenome', + 'socialName' => 'Nome', + 'birthDate' => '31-12-1984', + 'address' => [ + 'postalCode' => '06455030', + 'street' => 'Rua das Andorinhas', + 'number' => '343', + 'addressComplement' => 'proximo a lanchonete do zeca', + 'neighborhood' => 'Rua das Maravilhas', + 'city' => 'Sao Paulo', + 'state' => 'SP', + 'longitude' => null, + 'latitude' => null, ], - "isPoliticallyExposedPerson" => false, - "createDate" => "2022-10-25T20:33:54", - "closeDate" => "2022-10-25T20:34:06", - "closeReason" => "Desejo encerrar a conta...", + 'isPoliticallyExposedPerson' => false, + 'createDate' => '2022-10-25T20:33:54', + 'closeDate' => '2022-10-25T20:34:06', + 'closeReason' => 'Desejo encerrar a conta...', ], ], ], diff --git a/tests/Integration/BAAS/GetListInfoAccountNaturalPersonTest.php b/tests/Integration/BAAS/GetListInfoAccountNaturalPersonTest.php index a9e0e72..bb4e832 100644 --- a/tests/Integration/BAAS/GetListInfoAccountNaturalPersonTest.php +++ b/tests/Integration/BAAS/GetListInfoAccountNaturalPersonTest.php @@ -12,7 +12,6 @@ class GetListInfoAccountNaturalPersonTest extends TestCase { - /** * @return void */ @@ -39,67 +38,67 @@ public function testSuccess() $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "SUCCESS", - "totalItems" => 3, - "currentPage" => 1, - "totalPages" => 1, - "dateFrom" => "22/10/2022 00:00:00", - "dateTo" => "28/10/2022 23:59:59", - "subAccounts" => [ + 'version' => '1.0.0', + 'status' => 'SUCCESS', + 'totalItems' => 3, + 'currentPage' => 1, + 'totalPages' => 1, + 'dateFrom' => '22/10/2022 00:00:00', + 'dateTo' => '28/10/2022 23:59:59', + 'subAccounts' => [ [ - "statusAccount" => "ATIVO", - "documentNumber" => "25400754015", - "phoneNumber" => "+5512981175704", - "email" => "email4@email.com", - "motherName" => "Nome Sobrenome", - "fullName" => "Nome Sobrenome", - "socialName" => "Nome", - "birthDate" => "31-12-1984", - "address" => [ - "postalCode" => "06455030", - "street" => "Rua das Andorinhas", - "number" => "343", - "addressComplement" => "proximo a lanchonete do zeca", - "neighborhood" => "Rua das Maravilhas", - "city" => "Sao Paulo", - "state" => "SP", - "longitude" => null, - "latitude" => null, + 'statusAccount' => 'ATIVO', + 'documentNumber' => '25400754015', + 'phoneNumber' => '+5512981175704', + 'email' => 'email4@email.com', + 'motherName' => 'Nome Sobrenome', + 'fullName' => 'Nome Sobrenome', + 'socialName' => 'Nome', + 'birthDate' => '31-12-1984', + 'address' => [ + 'postalCode' => '06455030', + 'street' => 'Rua das Andorinhas', + 'number' => '343', + 'addressComplement' => 'proximo a lanchonete do zeca', + 'neighborhood' => 'Rua das Maravilhas', + 'city' => 'Sao Paulo', + 'state' => 'SP', + 'longitude' => null, + 'latitude' => null, ], - "isPoliticallyExposedPerson" => false, - "createDate" => "2022-10-25T20:33:34", - "closeDate" => "2022-10-25T20:33:47", - "closeReason" => "Motivo X", + 'isPoliticallyExposedPerson' => false, + 'createDate' => '2022-10-25T20:33:34', + 'closeDate' => '2022-10-25T20:33:47', + 'closeReason' => 'Motivo X', ], [ - "statusAccount" => "ATIVO", - "documentNumber" => "25400754015", - "phoneNumber" => "+5512981175704", - "email" => "email4@email.com", - "motherName" => "Nome Sobrenome", - "fullName" => "Nome Sobrenome", - "socialName" => "Nome", - "birthDate" => "31-12-1984", - "address" => [ - "postalCode" => "06455030", - "street" => "Rua das Andorinhas", - "number" => "343", - "addressComplement" => "proximo a lanchonete do zeca", - "neighborhood" => "Rua das Maravilhas", - "city" => "Sao Paulo", - "state" => "SP", - "longitude" => null, - "latitude" => null, + 'statusAccount' => 'ATIVO', + 'documentNumber' => '25400754015', + 'phoneNumber' => '+5512981175704', + 'email' => 'email4@email.com', + 'motherName' => 'Nome Sobrenome', + 'fullName' => 'Nome Sobrenome', + 'socialName' => 'Nome', + 'birthDate' => '31-12-1984', + 'address' => [ + 'postalCode' => '06455030', + 'street' => 'Rua das Andorinhas', + 'number' => '343', + 'addressComplement' => 'proximo a lanchonete do zeca', + 'neighborhood' => 'Rua das Maravilhas', + 'city' => 'Sao Paulo', + 'state' => 'SP', + 'longitude' => null, + 'latitude' => null, ], - "isPoliticallyExposedPerson" => false, - "createDate" => "2022-10-25T20:33:54", - "closeDate" => "2022-10-25T20:34:06", - "closeReason" => "Desejo encerrar a conta...", + 'isPoliticallyExposedPerson' => false, + 'createDate' => '2022-10-25T20:33:54', + 'closeDate' => '2022-10-25T20:34:06', + 'closeReason' => 'Desejo encerrar a conta...', ], ], ], diff --git a/tests/Integration/BAAS/GetWalletBalanceTest.php b/tests/Integration/BAAS/GetWalletBalanceTest.php index bd9d72c..5c5ddd0 100644 --- a/tests/Integration/BAAS/GetWalletBalanceTest.php +++ b/tests/Integration/BAAS/GetWalletBalanceTest.php @@ -11,7 +11,6 @@ class GetWalletBalanceTest extends TestCase { - /** * @return void */ @@ -33,14 +32,14 @@ public function testSuccess() $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "SUCCESS", - "version" => "1.0.0", - "body" => [ - "amount" => 1.1, + 'status' => 'SUCCESS', + 'version' => '1.0.0', + 'body' => [ + 'amount' => 1.1, ], ], Response::HTTP_OK, diff --git a/tests/Integration/BAAS/GetWalletMovementTest.php b/tests/Integration/BAAS/GetWalletMovementTest.php index 2b81885..0f3be6e 100644 --- a/tests/Integration/BAAS/GetWalletMovementTest.php +++ b/tests/Integration/BAAS/GetWalletMovementTest.php @@ -12,7 +12,6 @@ class GetWalletMovementTest extends TestCase { - /** * @return void */ @@ -39,31 +38,31 @@ public function testSuccess() $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "SUCCESS", - "version" => "1.0.0", - "totalItems" => 200, - "currentPage" => 1, - "totalPages" => 10, - "dateFrom" => "2022-01-01", - "dateTo" => "2022-01-02", - "body" => [ - "account" => "300151", - "documentNumber" => "34335125070", - "movements" => [ + 'status' => 'SUCCESS', + 'version' => '1.0.0', + 'totalItems' => 200, + 'currentPage' => 1, + 'totalPages' => 10, + 'dateFrom' => '2022-01-01', + 'dateTo' => '2022-01-02', + 'body' => [ + 'account' => '300151', + 'documentNumber' => '34335125070', + 'movements' => [ [ - "id" => "aa99877c-6205-45ce-8fd8-18173fdd782a", - "clientCode" => "7a2a4ea2-ee65-4b3d-8e1d-311dd45d3017", - "description" => "Recebimento Pix", - "createDate" => "2022-08-31T17:19:55", - "lastUpdateDate" => "2022-08-31T17:19:55", - "amount" => 10.12, - "status" => "Saldo Liberado", - "balanceType" => "CREDIT", - "movementType" => "PIXPAYMENTIN", + 'id' => 'aa99877c-6205-45ce-8fd8-18173fdd782a', + 'clientCode' => '7a2a4ea2-ee65-4b3d-8e1d-311dd45d3017', + 'description' => 'Recebimento Pix', + 'createDate' => '2022-08-31T17:19:55', + 'lastUpdateDate' => '2022-08-31T17:19:55', + 'amount' => 10.12, + 'status' => 'Saldo Liberado', + 'balanceType' => 'CREDIT', + 'movementType' => 'PIXPAYMENTIN', ], ], ], diff --git a/tests/Integration/BAAS/IncomeReportTest.php b/tests/Integration/BAAS/IncomeReportTest.php index e577831..34c6522 100644 --- a/tests/Integration/BAAS/IncomeReportTest.php +++ b/tests/Integration/BAAS/IncomeReportTest.php @@ -8,7 +8,7 @@ use WeDevBr\Celcoin\Tests\GlobalStubs; use WeDevBr\Celcoin\Tests\TestCase; -class IncomeReportTest extends TestCase +class IncomeReportTest extends TestCase { public function testSuccess() { @@ -32,34 +32,34 @@ public function testSuccess() public static function stubSuccess(): array { return [ - "version" => "1.0.0", - "status" => "SUCCESS", - "body" => [ - "payerSource" => [ - "name" => "Celcoin Teste S/A", - "documentNumber" => "123456" + 'version' => '1.0.0', + 'status' => 'SUCCESS', + 'body' => [ + 'payerSource' => [ + 'name' => 'Celcoin Teste S/A', + 'documentNumber' => '123456', ], - "owner" => [ - "documentNumber" => "01234567890", - "name" => "Nome Completo", - "type" => "NATURAL_PERSON", - "createDate" => "15-07-1986" + 'owner' => [ + 'documentNumber' => '01234567890', + 'name' => 'Nome Completo', + 'type' => 'NATURAL_PERSON', + 'createDate' => '15-07-1986', ], - "account" => [ - "branch" => "1234", - "account" => "123456" + 'account' => [ + 'branch' => '1234', + 'account' => '123456', ], - "balances" => [ + 'balances' => [ [ - "calendarYear" => "2025", - "amount" => 10.5, - "currency" => "BRL", - "type" => "SALDO" - ] + 'calendarYear' => '2025', + 'amount' => 10.5, + 'currency' => 'BRL', + 'type' => 'SALDO', + ], ], - "incomeFile" => "string", - "fileType" => "string" - ] + 'incomeFile' => 'string', + 'fileType' => 'string', + ], ]; } } diff --git a/tests/Integration/BAAS/PIXKey/BAASPIXDeletePixKeyTest.php b/tests/Integration/BAAS/PIXKey/BAASPIXDeletePixKeyTest.php index 3811361..b15c39a 100644 --- a/tests/Integration/BAAS/PIXKey/BAASPIXDeletePixKeyTest.php +++ b/tests/Integration/BAAS/PIXKey/BAASPIXDeletePixKeyTest.php @@ -11,7 +11,6 @@ class BAASPIXDeletePixKeyTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -31,12 +30,12 @@ final public function testSuccess(): void $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "SUCCESS", - "version" => "1.0.0", + 'status' => 'SUCCESS', + 'version' => '1.0.0', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BAAS/PIXKey/BAASPIXRegisterPixKeyTest.php b/tests/Integration/BAAS/PIXKey/BAASPIXRegisterPixKeyTest.php index a5c6b59..91b4520 100644 --- a/tests/Integration/BAAS/PIXKey/BAASPIXRegisterPixKeyTest.php +++ b/tests/Integration/BAAS/PIXKey/BAASPIXRegisterPixKeyTest.php @@ -12,7 +12,6 @@ class BAASPIXRegisterPixKeyTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -37,26 +36,26 @@ final public function testSuccess(): void $this->assertEquals('CONFIRMED', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "CONFIRMED", - "body" => [ - "keyType" => "EMAIL", - "key" => "testebaas@cecloin.com.br", - "account" => [ - "participant" => "30306294", - "branch" => "0001", - "account" => "10545584", - "accountType" => "TRAN", - "createDate" => "2020-11-03T06:30:00-03:00", + 'version' => '1.0.0', + 'status' => 'CONFIRMED', + 'body' => [ + 'keyType' => 'EMAIL', + 'key' => 'testebaas@cecloin.com.br', + 'account' => [ + 'participant' => '30306294', + 'branch' => '0001', + 'account' => '10545584', + 'accountType' => 'TRAN', + 'createDate' => '2020-11-03T06:30:00-03:00', ], - "owner" => [ - "type" => "NATURAL_PERSON", - "documentNumber" => "34335125070", - "name" => "Carlos Henrique da Silva", + 'owner' => [ + 'type' => 'NATURAL_PERSON', + 'documentNumber' => '34335125070', + 'name' => 'Carlos Henrique da Silva', ], ], ], diff --git a/tests/Integration/BAAS/PIXKey/BAASPIXSearchPixKeyTest.php b/tests/Integration/BAAS/PIXKey/BAASPIXSearchPixKeyTest.php index c1fdc20..4450f60 100644 --- a/tests/Integration/BAAS/PIXKey/BAASPIXSearchPixKeyTest.php +++ b/tests/Integration/BAAS/PIXKey/BAASPIXSearchPixKeyTest.php @@ -11,7 +11,6 @@ class BAASPIXSearchPixKeyTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -31,32 +30,32 @@ final public function testSuccess(): void $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "SUCCESS", - "body" => [ - "listKeys" => [ + 'status' => 'SUCCESS', + 'body' => [ + 'listKeys' => [ 0 => [ - "keyType" => "EVP", - "key" => "0a9d3572-eda9-48cb-a8a7-d31d52a82ea7", - "account" => [ - "participant" => "13935893", - "branch" => "0001", - "account" => "300541976902", - "accountType" => "TRAN", - "createDate" => "2023-07-19T21:31:59Z", + 'keyType' => 'EVP', + 'key' => '0a9d3572-eda9-48cb-a8a7-d31d52a82ea7', + 'account' => [ + 'participant' => '13935893', + 'branch' => '0001', + 'account' => '300541976902', + 'accountType' => 'TRAN', + 'createDate' => '2023-07-19T21:31:59Z', ], - "owner" => [ - "type" => "LEGAL_PERSON", - "documentNumber" => "17938715000192", - "name" => "Mateus", + 'owner' => [ + 'type' => 'LEGAL_PERSON', + 'documentNumber' => '17938715000192', + 'name' => 'Mateus', ], ], ], ], - "version" => "1.0.0", + 'version' => '1.0.0', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BAAS/PIXRefund/BAASPIXRefundTest.php b/tests/Integration/BAAS/PIXRefund/BAASPIXRefundTest.php index 93d14fd..5719624 100644 --- a/tests/Integration/BAAS/PIXRefund/BAASPIXRefundTest.php +++ b/tests/Integration/BAAS/PIXRefund/BAASPIXRefundTest.php @@ -12,7 +12,6 @@ class BAASPIXRefundTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -29,33 +28,33 @@ final public function testSuccess(): void $pix = new CelcoinBAASPIX(); $response = $pix->refundPix( new RefundPix([ - "id" => "34fee7bc-4d40-4605-9af8-398ed7d0d6b5", - "endToEndId" => "E3030629420200808185300887639654", - "clientCode" => "1458854", - "amount" => 150.54, - "reason" => "MD06", - "reversalDescription" => "Devolução do churrasco", + 'id' => '34fee7bc-4d40-4605-9af8-398ed7d0d6b5', + 'endToEndId' => 'E3030629420200808185300887639654', + 'clientCode' => '1458854', + 'amount' => 150.54, + 'reason' => 'MD06', + 'reversalDescription' => 'Devolução do churrasco', ]), ); $this->assertEquals('PROCESSING', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "PROCESSING", - "version" => "1.0.0", - "body" => [ - "id" => "34fee7bc-4d40-4605-9af8-398ed7d0d6b4", - "amount" => 25.55, - "clientCode" => "1458854", - "originalPaymentId" => "34fee7bc-4d40-4605-9af8-398ed7d0d6b5", - "endToEndId" => "E3030629420200808185300887639654", - "returnIdentification" => "D3030629420200808185300887639654", - "reason" => "MD06", - "reversalDescription" => "Devolução do churrasco", + 'status' => 'PROCESSING', + 'version' => '1.0.0', + 'body' => [ + 'id' => '34fee7bc-4d40-4605-9af8-398ed7d0d6b4', + 'amount' => 25.55, + 'clientCode' => '1458854', + 'originalPaymentId' => '34fee7bc-4d40-4605-9af8-398ed7d0d6b5', + 'endToEndId' => 'E3030629420200808185300887639654', + 'returnIdentification' => 'D3030629420200808185300887639654', + 'reason' => 'MD06', + 'reversalDescription' => 'Devolução do churrasco', ], ], Response::HTTP_OK, diff --git a/tests/Integration/BAAS/PIXRefund/BAASPIXStatusRefundTest.php b/tests/Integration/BAAS/PIXRefund/BAASPIXStatusRefundTest.php index 185e102..b82df5a 100644 --- a/tests/Integration/BAAS/PIXRefund/BAASPIXStatusRefundTest.php +++ b/tests/Integration/BAAS/PIXRefund/BAASPIXStatusRefundTest.php @@ -11,7 +11,6 @@ class BAASPIXStatusRefundTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -31,21 +30,21 @@ final public function testSuccess(): void $this->assertEquals('PROCESSING', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "PROCESSING", - "version" => "1.0.0", - "body" => [ - "id" => "34fee7bc-4d40-4605-9af8-398ed7d0d6b4", - "amount" => 25.55, - "clientCode" => "1458854", - "originalPaymentId" => "34fee7bc-4d40-4605-9af8-398ed7d0d6b5", - "endToEndId" => "E3030629420200808185300887639654", - "returnIdentification" => "D3030629420200808185300887639654", - "reason" => "MD06", - "reversalDescription" => "Devolução do churrasco", + 'status' => 'PROCESSING', + 'version' => '1.0.0', + 'body' => [ + 'id' => '34fee7bc-4d40-4605-9af8-398ed7d0d6b4', + 'amount' => 25.55, + 'clientCode' => '1458854', + 'originalPaymentId' => '34fee7bc-4d40-4605-9af8-398ed7d0d6b5', + 'endToEndId' => 'E3030629420200808185300887639654', + 'returnIdentification' => 'D3030629420200808185300887639654', + 'reason' => 'MD06', + 'reversalDescription' => 'Devolução do churrasco', ], ], Response::HTTP_OK, diff --git a/tests/Integration/BAAS/PixCashOut/BAASPIXCashOutTest.php b/tests/Integration/BAAS/PixCashOut/BAASPIXCashOutTest.php index 29b5683..9bee269 100644 --- a/tests/Integration/BAAS/PixCashOut/BAASPIXCashOutTest.php +++ b/tests/Integration/BAAS/PixCashOut/BAASPIXCashOutTest.php @@ -12,7 +12,6 @@ class BAASPIXCashOutTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -29,65 +28,65 @@ final public function testSuccess(): void $pix = new CelcoinBAASPIX(); $response = $pix->cashOut( new PixCashOut([ - "amount" => 5.55, - "clientCode" => "1234ab", - "endToEndId" => "E1393589320230724213001637810511", - "initiationType" => "DICT", - "paymentType" => "IMMEDIATE", - "urgency" => "HIGH", - "transactionType" => "TRANSFER", - "debitParty" => [ - "account" => "300541976902", + 'amount' => 5.55, + 'clientCode' => '1234ab', + 'endToEndId' => 'E1393589320230724213001637810511', + 'initiationType' => 'DICT', + 'paymentType' => 'IMMEDIATE', + 'urgency' => 'HIGH', + 'transactionType' => 'TRANSFER', + 'debitParty' => [ + 'account' => '300541976902', ], - "creditParty" => [ - "bank" => "30306294", - "key" => "845c16bf-1b02-4396-9112-623f3f7ab5f7", - "account" => "300541976910", - "branch" => "0001", - "taxId" => "00558856756", - "name" => "Noelí Valência", - "accountType" => "TRAN", + 'creditParty' => [ + 'bank' => '30306294', + 'key' => '845c16bf-1b02-4396-9112-623f3f7ab5f7', + 'account' => '300541976910', + 'branch' => '0001', + 'taxId' => '00558856756', + 'name' => 'Noelí Valência', + 'accountType' => 'TRAN', ], - "remittanceInformation" => "Texto de mensagem", + 'remittanceInformation' => 'Texto de mensagem', ]), ); $this->assertEquals('PROCESSING', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "PROCESSING", - "version" => "1.0.0", - "body" => [ - "id" => "fba1b37b-c0f3-440b-bcde-8228f31fd585", - "amount" => 5.55, - "clientCode" => "1234", - "transactionIdentification" => null, - "endToEndId" => "E1393589320230719213601039975372", - "initiationType" => "DICT", - "paymentType" => "IMMEDIATE", - "urgency" => "HIGH", - "transactionType" => "TRANSFER", - "debitParty" => [ - "account" => "300541976902", - "branch" => "0001", - "taxId" => "17938715000192", - "name" => "Mateus Chaves LTDA", - "accountType" => "TRAN", + 'status' => 'PROCESSING', + 'version' => '1.0.0', + 'body' => [ + 'id' => 'fba1b37b-c0f3-440b-bcde-8228f31fd585', + 'amount' => 5.55, + 'clientCode' => '1234', + 'transactionIdentification' => null, + 'endToEndId' => 'E1393589320230719213601039975372', + 'initiationType' => 'DICT', + 'paymentType' => 'IMMEDIATE', + 'urgency' => 'HIGH', + 'transactionType' => 'TRANSFER', + 'debitParty' => [ + 'account' => '300541976902', + 'branch' => '0001', + 'taxId' => '17938715000192', + 'name' => 'Mateus Chaves LTDA', + 'accountType' => 'TRAN', ], - "creditParty" => [ - "bank" => "30306294", - "key" => "845c16bf-1b02-4396-9112-623f3f7ab5f7", - "account" => "300541976910", - "branch" => "0001", - "taxId" => "00558856756", - "name" => "Noelí Valência", - "accountType" => "TRAN", + 'creditParty' => [ + 'bank' => '30306294', + 'key' => '845c16bf-1b02-4396-9112-623f3f7ab5f7', + 'account' => '300541976910', + 'branch' => '0001', + 'taxId' => '00558856756', + 'name' => 'Noelí Valência', + 'accountType' => 'TRAN', ], - "remittanceInformation" => "Texto de mensagem", + 'remittanceInformation' => 'Texto de mensagem', ], ], Response::HTTP_OK, diff --git a/tests/Integration/BAAS/PixCashOut/BAASPIXGetExternalPixKeyTest.php b/tests/Integration/BAAS/PixCashOut/BAASPIXGetExternalPixKeyTest.php index 97a84c2..05c72dc 100644 --- a/tests/Integration/BAAS/PixCashOut/BAASPIXGetExternalPixKeyTest.php +++ b/tests/Integration/BAAS/PixCashOut/BAASPIXGetExternalPixKeyTest.php @@ -11,7 +11,6 @@ class BAASPIXGetExternalPixKeyTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -31,29 +30,29 @@ final public function testSuccess(): void $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "SUCCESS", - "body" => [ - "keyType" => "EVP", - "key" => "0a9d3572-eda9-48cb-a8a7-d31d52a82ea7", - "account" => [ - "participant" => "13935893", - "branch" => "0001", - "account" => "300541976902", - "accountType" => "TRAN", - "createDate" => "2023-07-19T21:31:59Z", + 'status' => 'SUCCESS', + 'body' => [ + 'keyType' => 'EVP', + 'key' => '0a9d3572-eda9-48cb-a8a7-d31d52a82ea7', + 'account' => [ + 'participant' => '13935893', + 'branch' => '0001', + 'account' => '300541976902', + 'accountType' => 'TRAN', + 'createDate' => '2023-07-19T21:31:59Z', ], - "owner" => [ - "type" => "LEGAL_PERSON", - "documentNumber" => "17938715000192", - "name" => "Mateus", + 'owner' => [ + 'type' => 'LEGAL_PERSON', + 'documentNumber' => '17938715000192', + 'name' => 'Mateus', ], - "endtoEndId" => "E1393589320230719213601039975372", + 'endtoEndId' => 'E1393589320230719213601039975372', ], - "version" => "1.0.0", + 'version' => '1.0.0', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BAAS/PixCashOut/BAASPIXGetParticipantTest.php b/tests/Integration/BAAS/PixCashOut/BAASPIXGetParticipantTest.php index 0920112..2bdfabc 100644 --- a/tests/Integration/BAAS/PixCashOut/BAASPIXGetParticipantTest.php +++ b/tests/Integration/BAAS/PixCashOut/BAASPIXGetParticipantTest.php @@ -11,7 +11,6 @@ class BAASPIXGetParticipantTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -31,16 +30,16 @@ final public function testSuccess(): void $this->assertCount(1, $response); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ [ - "date" => "2022-03-23T00:00:00", - "type" => "IDRT", - "name" => "COOPERATIVA CENTRAL DE CRÉDITO DE MINAS GERAIS LTDA. - SICOOB CENTRAL CREDIMINAS", - "startOperationDatetime" => "2020-11-03T09:30:00+00:00", - "ispb" => "25683434", + 'date' => '2022-03-23T00:00:00', + 'type' => 'IDRT', + 'name' => 'COOPERATIVA CENTRAL DE CRÉDITO DE MINAS GERAIS LTDA. - SICOOB CENTRAL CREDIMINAS', + 'startOperationDatetime' => '2020-11-03T09:30:00+00:00', + 'ispb' => '25683434', ], ], Response::HTTP_OK, diff --git a/tests/Integration/BAAS/PixCashOut/BAASPIXStatusTest.php b/tests/Integration/BAAS/PixCashOut/BAASPIXStatusTest.php index 3842271..7c8f192 100644 --- a/tests/Integration/BAAS/PixCashOut/BAASPIXStatusTest.php +++ b/tests/Integration/BAAS/PixCashOut/BAASPIXStatusTest.php @@ -11,7 +11,6 @@ class BAASPIXStatusTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -31,38 +30,38 @@ final public function testSuccess(): void $this->assertEquals('CONFIRMED', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "CONFIRMED", - "version" => "1.0.0", - "body" => [ - "id" => "fba1b37b-c0f3-440b-bcde-8228f31fd585", - "amount" => 5.55, - "clientCode" => "1234", - "endToEndId" => "E1393589320230719213601039975372", - "initiationType" => "DICT", - "paymentType" => "IMMEDIATE", - "urgency" => "HIGH", - "transactionType" => "TRANSFER", - "debitParty" => [ - "account" => "300541976902", - "branch" => "0001", - "taxId" => "17938715000192", - "name" => "Mateus Chaves LTDA", - "accountType" => "TRAN", + 'status' => 'CONFIRMED', + 'version' => '1.0.0', + 'body' => [ + 'id' => 'fba1b37b-c0f3-440b-bcde-8228f31fd585', + 'amount' => 5.55, + 'clientCode' => '1234', + 'endToEndId' => 'E1393589320230719213601039975372', + 'initiationType' => 'DICT', + 'paymentType' => 'IMMEDIATE', + 'urgency' => 'HIGH', + 'transactionType' => 'TRANSFER', + 'debitParty' => [ + 'account' => '300541976902', + 'branch' => '0001', + 'taxId' => '17938715000192', + 'name' => 'Mateus Chaves LTDA', + 'accountType' => 'TRAN', ], - "creditParty" => [ - "bank" => "30306294", - "key" => "845c16bf-1b02-4396-9112-623f3f7ab5f7", - "account" => "300541976910", - "branch" => "0001", - "taxId" => "00558856756", - "name" => "Noelí Valência", - "accountType" => "TRAN", + 'creditParty' => [ + 'bank' => '30306294', + 'key' => '845c16bf-1b02-4396-9112-623f3f7ab5f7', + 'account' => '300541976910', + 'branch' => '0001', + 'taxId' => '00558856756', + 'name' => 'Noelí Valência', + 'accountType' => 'TRAN', ], - "remittanceInformation" => "Texto de mensagem", + 'remittanceInformation' => 'Texto de mensagem', ], ], Response::HTTP_OK, diff --git a/tests/Integration/BAAS/TED/BAASInternalTransferTest.php b/tests/Integration/BAAS/TED/BAASInternalTransferTest.php index a4b763b..50b7243 100644 --- a/tests/Integration/BAAS/TED/BAASInternalTransferTest.php +++ b/tests/Integration/BAAS/TED/BAASInternalTransferTest.php @@ -29,15 +29,15 @@ public function testSendSuccess() $response = $ted->internalTransfer( new TEFTransfer([ - "amount" => 4.00, - "clientRequestId" => "1234", - "debitParty" => [ - "account" => "300541976902", + 'amount' => 4.00, + 'clientRequestId' => '1234', + 'debitParty' => [ + 'account' => '300541976902', ], - "creditParty" => [ - "account" => "300541976910", + 'creditParty' => [ + 'account' => '300541976910', ], - "description" => "transferencia para o churrasco", + 'description' => 'transferencia para o churrasco', ]), ); @@ -52,7 +52,7 @@ public function testGetTransaction() sprintf( '%s%s', config('api_url'), - CelcoinBAASTED::GET_STATUS_INTERNAL_TRANSFER_ENDPOINT . '?Id=222dbad8-c309-4f52-af62-8bfbe945ca2d', + CelcoinBAASTED::GET_STATUS_INTERNAL_TRANSFER_ENDPOINT.'?Id=222dbad8-c309-4f52-af62-8bfbe945ca2d', ) => self::stubSuccess(), ], ); @@ -63,35 +63,35 @@ public function testGetTransaction() $this->assertEquals('222dbad8-c309-4f52-af62-8bfbe945ca2d', $response['body']['id']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "PROCESSING", - "version" => "1.0.0", - "body" => [ - "id" => "222dbad8-c309-4f52-af62-8bfbe945ca2d", - "amount" => 4, - "clientRequestId" => "1234", - "endToEndId" => "string", - "debitParty" => [ - "account" => "300541976902", - "branch" => "0001", - "taxId" => "09876543210", - "name" => "Mateus", - "bank" => "13935893", + 'status' => 'PROCESSING', + 'version' => '1.0.0', + 'body' => [ + 'id' => '222dbad8-c309-4f52-af62-8bfbe945ca2d', + 'amount' => 4, + 'clientRequestId' => '1234', + 'endToEndId' => 'string', + 'debitParty' => [ + 'account' => '300541976902', + 'branch' => '0001', + 'taxId' => '09876543210', + 'name' => 'Mateus', + 'bank' => '13935893', ], - "creditParty" => [ - "bank" => "30306294", - "account" => "300541976910", - "branch" => "0001", - "taxId" => "01234567890", - "name" => "Noelí Valência", + 'creditParty' => [ + 'bank' => '30306294', + 'account' => '300541976910', + 'branch' => '0001', + 'taxId' => '01234567890', + 'name' => 'Noelí Valência', ], - "description" => "transferencia para o churrasco", + 'description' => 'transferencia para o churrasco', ], ], Response::HTTP_OK, ); } -} \ No newline at end of file +} diff --git a/tests/Integration/BAAS/TED/BAASTEDGetStatusTransferTest.php b/tests/Integration/BAAS/TED/BAASTEDGetStatusTransferTest.php index 70b1725..200e8e0 100644 --- a/tests/Integration/BAAS/TED/BAASTEDGetStatusTransferTest.php +++ b/tests/Integration/BAAS/TED/BAASTEDGetStatusTransferTest.php @@ -11,7 +11,6 @@ class BAASTEDGetStatusTransferTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -26,44 +25,43 @@ final public function testSuccess(): void ); $ted = new CelcoinBAASTED(); - $response = $ted->getStatusTransfer('5e8e0e08-1628-4265-be6f-26cc23e265a4', "1234"); - + $response = $ted->getStatusTransfer('5e8e0e08-1628-4265-be6f-26cc23e265a4', '1234'); $this->assertEquals('CONFIRMED', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "CONFIRMED", - "version" => "1.0.0", - "body" => [ - "id" => "34fee7bc-4d40-4605-9af8-398ed7d0d6b5", - "amount" => 25.55, - "clientCode" => "1458854", - "debitParty" => [ - "account" => "444444", - "branch" => "1", - "taxId" => "11122233344", - "name" => "Celcoin", - "accountType" => "CACC", - "personType" => "F", - "bank" => "30306294", + 'status' => 'CONFIRMED', + 'version' => '1.0.0', + 'body' => [ + 'id' => '34fee7bc-4d40-4605-9af8-398ed7d0d6b5', + 'amount' => 25.55, + 'clientCode' => '1458854', + 'debitParty' => [ + 'account' => '444444', + 'branch' => '1', + 'taxId' => '11122233344', + 'name' => 'Celcoin', + 'accountType' => 'CACC', + 'personType' => 'F', + 'bank' => '30306294', ], - "creditParty" => [ - "bank" => "30306294", - "account" => "10545584", - "branch" => "1", - "taxId" => "11122233344", - "name" => "Celcoin", - "accountType" => "CC", - "personType" => "F", + 'creditParty' => [ + 'bank' => '30306294', + 'account' => '10545584', + 'branch' => '1', + 'taxId' => '11122233344', + 'name' => 'Celcoin', + 'accountType' => 'CC', + 'personType' => 'F', ], - "description" => "Texto de mensagem", - "error" => [ - "errorCode" => "CIE999", - "message" => "Ocorreu um erro interno durante a chamada da api.", + 'description' => 'Texto de mensagem', + 'error' => [ + 'errorCode' => 'CIE999', + 'message' => 'Ocorreu um erro interno durante a chamada da api.', ], ], ], diff --git a/tests/Integration/BAAS/TED/BAASTEDTransferTest.php b/tests/Integration/BAAS/TED/BAASTEDTransferTest.php index 46ee2ae..fcf986e 100644 --- a/tests/Integration/BAAS/TED/BAASTEDTransferTest.php +++ b/tests/Integration/BAAS/TED/BAASTEDTransferTest.php @@ -13,7 +13,6 @@ class BAASTEDTransferTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -30,55 +29,55 @@ final public function testSuccess(): void $ted = new CelcoinBAASTED(); $response = $ted->transfer( new TEDTransfer([ - "amount" => 4.00, - "clientCode" => "1234", - "debitParty" => [ - "account" => "300541976902", + 'amount' => 4.00, + 'clientCode' => '1234', + 'debitParty' => [ + 'account' => '300541976902', ], - "creditParty" => [ - "bank" => "30306294", - "account" => "300541976910", - "branch" => "0001", - "taxId" => "00558856756", - "name" => "Noelí Valência", - "accountType" => "CC", - "personType" => "J", + 'creditParty' => [ + 'bank' => '30306294', + 'account' => '300541976910', + 'branch' => '0001', + 'taxId' => '00558856756', + 'name' => 'Noelí Valência', + 'accountType' => 'CC', + 'personType' => 'J', ], - "clientFinality" => ClientFinalityEnum::ACCOUNT_CREDIT, - "description" => "", + 'clientFinality' => ClientFinalityEnum::ACCOUNT_CREDIT, + 'description' => '', ]), ); $this->assertEquals('PROCESSING', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "PROCESSING", - "version" => "1.0.0", - "body" => [ - "id" => "222dbad8-c309-4f52-af62-8bfbe945ca2d", - "amount" => 4, - "clientCode" => "1234", - "debitParty" => [ - "account" => "300541976902", - "branch" => "0001", - "taxId" => "17938715000192", - "name" => "Mateus", - "accountType" => "CC", - "personType" => "J", - "bank" => "13935893", + 'status' => 'PROCESSING', + 'version' => '1.0.0', + 'body' => [ + 'id' => '222dbad8-c309-4f52-af62-8bfbe945ca2d', + 'amount' => 4, + 'clientCode' => '1234', + 'debitParty' => [ + 'account' => '300541976902', + 'branch' => '0001', + 'taxId' => '17938715000192', + 'name' => 'Mateus', + 'accountType' => 'CC', + 'personType' => 'J', + 'bank' => '13935893', ], - "creditParty" => [ - "bank" => "30306294", - "account" => "300541976910", - "branch" => "0001", - "taxId" => "00558856756", - "name" => "Noelí Valência", - "accountType" => "CC", - "personType" => "J", + 'creditParty' => [ + 'bank' => '30306294', + 'account' => '300541976910', + 'branch' => '0001', + 'taxId' => '00558856756', + 'name' => 'Noelí Valência', + 'accountType' => 'CC', + 'personType' => 'J', ], ], ], diff --git a/tests/Integration/BAAS/UpdateAccountBusinessTest.php b/tests/Integration/BAAS/UpdateAccountBusinessTest.php index d25b5c6..a88bbf6 100644 --- a/tests/Integration/BAAS/UpdateAccountBusinessTest.php +++ b/tests/Integration/BAAS/UpdateAccountBusinessTest.php @@ -12,7 +12,6 @@ class UpdateAccountBusinessTest extends TestCase { - /** * @return void */ @@ -40,43 +39,43 @@ public function testSuccess() '12345', new AccountManagerBusiness( [ - "contactNumber" => sprintf('+5511%s', $fake->cellphone(false)), - "businessEmail" => $fake->email(), - "owners" => [ + 'contactNumber' => sprintf('+5511%s', $fake->cellphone(false)), + 'businessEmail' => $fake->email(), + 'owners' => [ [ - "documentNumber" => $fake->cpf(false), - "phoneNumber" => sprintf('+5511%s', $fake->cellphone(false)), - "email" => $fake->email(), - "fullName" => sprintf('%s %s', $firstName, $lastName), - "socialName" => $firstName, - "birthDate" => '15-01-1981', - "motherName" => sprintf('%s %s', $fake->firstNameFemale(), $fake->lastName()), - "address" => [ - "postalCode" => '01153000', - "street" => $fake->streetName(), - "number" => $fake->buildingNumber(), - "addressComplement" => "Em frente ao parque.", - "neighborhood" => 'Centro', - "city" => $fake->city(), - "state" => $fake->stateAbbr(), - "longitude" => $fake->longitude(-23, -24), - "latitude" => $fake->latitude(-46, -47), + 'documentNumber' => $fake->cpf(false), + 'phoneNumber' => sprintf('+5511%s', $fake->cellphone(false)), + 'email' => $fake->email(), + 'fullName' => sprintf('%s %s', $firstName, $lastName), + 'socialName' => $firstName, + 'birthDate' => '15-01-1981', + 'motherName' => sprintf('%s %s', $fake->firstNameFemale(), $fake->lastName()), + 'address' => [ + 'postalCode' => '01153000', + 'street' => $fake->streetName(), + 'number' => $fake->buildingNumber(), + 'addressComplement' => 'Em frente ao parque.', + 'neighborhood' => 'Centro', + 'city' => $fake->city(), + 'state' => $fake->stateAbbr(), + 'longitude' => $fake->longitude(-23, -24), + 'latitude' => $fake->latitude(-46, -47), ], - "isPoliticallyExposedPerson" => false, + 'isPoliticallyExposedPerson' => false, ], ], - "businessAddress" => [ - "postalCode" => '01153000', - "street" => $fake->streetName(), - "number" => $fake->buildingNumber(), - "addressComplement" => "Em frente ao parque.", - "neighborhood" => 'Centro', - "city" => $fake->city(), - "state" => $fake->stateAbbr(), - "longitude" => $fake->longitude(-23, -24), - "latitude" => $fake->latitude(-46, -47), + 'businessAddress' => [ + 'postalCode' => '01153000', + 'street' => $fake->streetName(), + 'number' => $fake->buildingNumber(), + 'addressComplement' => 'Em frente ao parque.', + 'neighborhood' => 'Centro', + 'city' => $fake->city(), + 'state' => $fake->stateAbbr(), + 'longitude' => $fake->longitude(-23, -24), + 'latitude' => $fake->latitude(-46, -47), ], - "cadastraChavePix" => false, + 'cadastraChavePix' => false, ], ), ); @@ -84,12 +83,12 @@ public function testSuccess() $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "SUCCESS", + 'version' => '1.0.0', + 'status' => 'SUCCESS', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BAAS/UpdateAccountNaturalPersonTest.php b/tests/Integration/BAAS/UpdateAccountNaturalPersonTest.php index 965e2ab..520d8a6 100644 --- a/tests/Integration/BAAS/UpdateAccountNaturalPersonTest.php +++ b/tests/Integration/BAAS/UpdateAccountNaturalPersonTest.php @@ -12,7 +12,6 @@ class UpdateAccountNaturalPersonTest extends TestCase { - /** * @return void */ @@ -39,22 +38,22 @@ public function testSuccess() '34335125070', new AccountManagerNaturalPerson( [ - "phoneNumber" => sprintf('+5511%s', $fake->cellphone(false)), - "email" => $fake->email(), - "socialName" => $firstName, - "birthDate" => '15-01-1981', - "address" => [ - "postalCode" => '01153000', - "street" => $fake->streetName(), - "number" => $fake->buildingNumber(), - "addressComplement" => "Em frente ao parque.", - "neighborhood" => 'Centro', - "city" => $fake->city(), - "state" => $fake->stateAbbr(), - "longitude" => $fake->longitude(-23, -24), - "latitude" => $fake->latitude(-46, -47), + 'phoneNumber' => sprintf('+5511%s', $fake->cellphone(false)), + 'email' => $fake->email(), + 'socialName' => $firstName, + 'birthDate' => '15-01-1981', + 'address' => [ + 'postalCode' => '01153000', + 'street' => $fake->streetName(), + 'number' => $fake->buildingNumber(), + 'addressComplement' => 'Em frente ao parque.', + 'neighborhood' => 'Centro', + 'city' => $fake->city(), + 'state' => $fake->stateAbbr(), + 'longitude' => $fake->longitude(-23, -24), + 'latitude' => $fake->latitude(-46, -47), ], - "isPoliticallyExposedPerson" => false, + 'isPoliticallyExposedPerson' => false, ], ), ); @@ -62,12 +61,12 @@ public function testSuccess() $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "SUCCESS", + 'version' => '1.0.0', + 'status' => 'SUCCESS', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BAAS/Webhook/EditWebhooksTest.php b/tests/Integration/BAAS/Webhook/EditWebhooksTest.php index 531972a..2b7e7df 100644 --- a/tests/Integration/BAAS/Webhook/EditWebhooksTest.php +++ b/tests/Integration/BAAS/Webhook/EditWebhooksTest.php @@ -13,7 +13,6 @@ class EditWebhooksTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -30,14 +29,14 @@ final public function testSuccess(): void $webhook = new CelcoinBAASWebhooks(); $response = $webhook->edit( new EditWebhooks([ - "entity" => EntityWebhookBAASEnum::SPB_REVERSAL_OUT_TED, - "webhookUrl" => "https://www.celcoin.com.br/baas", - "auth" => [ - "login" => "giovanni", - "pwd" => "string", - "type" => "basic", + 'entity' => EntityWebhookBAASEnum::SPB_REVERSAL_OUT_TED, + 'webhookUrl' => 'https://www.celcoin.com.br/baas', + 'auth' => [ + 'login' => 'giovanni', + 'pwd' => 'string', + 'type' => 'basic', ], - "active" => true, + 'active' => true, ]), EntityWebhookBAASEnum::SPB_TRANSFER_OUT_TED, ); @@ -45,12 +44,12 @@ final public function testSuccess(): void $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "SUCCESS", + 'version' => '1.0.0', + 'status' => 'SUCCESS', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BAAS/Webhook/GetWebhooksTest.php b/tests/Integration/BAAS/Webhook/GetWebhooksTest.php index c83fba9..0bb2311 100644 --- a/tests/Integration/BAAS/Webhook/GetWebhooksTest.php +++ b/tests/Integration/BAAS/Webhook/GetWebhooksTest.php @@ -12,7 +12,6 @@ class GetWebhooksTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -32,25 +31,25 @@ final public function testSuccess(): void $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "body" => [ - "subscriptions" => [ + 'body' => [ + 'subscriptions' => [ 0 => [ - "subscriptionId" => "64b13326a90a5b4a702dac3f", - "entity" => "pix-payment-out", - "webhookUrl" => "http://uoleti.io/transaction/webhook/LEKMZqMJUjBaVen1kyb9", - "active" => true, - "createDate" => "2023-07-14T08:36:06.292Z", - "lastUpdateDate" => null, - "auth" => null, + 'subscriptionId' => '64b13326a90a5b4a702dac3f', + 'entity' => 'pix-payment-out', + 'webhookUrl' => 'http://uoleti.io/transaction/webhook/LEKMZqMJUjBaVen1kyb9', + 'active' => true, + 'createDate' => '2023-07-14T08:36:06.292Z', + 'lastUpdateDate' => null, + 'auth' => null, ], ], ], - "status" => "SUCCESS", - "version" => "1.0.0", + 'status' => 'SUCCESS', + 'version' => '1.0.0', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BAAS/Webhook/RegisterWebhooksTest.php b/tests/Integration/BAAS/Webhook/RegisterWebhooksTest.php index eb495ad..4ab31a1 100644 --- a/tests/Integration/BAAS/Webhook/RegisterWebhooksTest.php +++ b/tests/Integration/BAAS/Webhook/RegisterWebhooksTest.php @@ -13,7 +13,6 @@ class RegisterWebhooksTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -30,12 +29,12 @@ final public function testSuccess(): void $webhook = new CelcoinBAASWebhooks(); $response = $webhook->register( new RegisterWebhooks([ - "entity" => EntityWebhookBAASEnum::SPB_TRANSFER_OUT_TED, - "webhookUrl" => "https://www.celcoin.com.br/baas", - "auth" => [ - "login" => "string", - "pwd" => "string", - "type" => "basic", + 'entity' => EntityWebhookBAASEnum::SPB_TRANSFER_OUT_TED, + 'webhookUrl' => 'https://www.celcoin.com.br/baas', + 'auth' => [ + 'login' => 'string', + 'pwd' => 'string', + 'type' => 'basic', ], ]), ); @@ -43,15 +42,15 @@ final public function testSuccess(): void $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "body" => [ - "subscriptionId" => "64bb0bef9065331bad7bf996", + 'body' => [ + 'subscriptionId' => '64bb0bef9065331bad7bf996', ], - "version" => "1.0.0", - "status" => "SUCCESS", + 'version' => '1.0.0', + 'status' => 'SUCCESS', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BAAS/Webhook/RemoveWebhooksTest.php b/tests/Integration/BAAS/Webhook/RemoveWebhooksTest.php index ecf65db..acd6646 100644 --- a/tests/Integration/BAAS/Webhook/RemoveWebhooksTest.php +++ b/tests/Integration/BAAS/Webhook/RemoveWebhooksTest.php @@ -12,7 +12,6 @@ class RemoveWebhooksTest extends TestCase { - final public function testSuccess(): void { Http::fake( @@ -32,12 +31,12 @@ final public function testSuccess(): void $this->assertEquals('SUCCESS', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "version" => "1.0.0", - "status" => "SUCCESS", + 'version' => '1.0.0', + 'status' => 'SUCCESS', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BankTransfer/CreateTest.php b/tests/Integration/BankTransfer/CreateTest.php index 6acaaf3..a0b4d43 100644 --- a/tests/Integration/BankTransfer/CreateTest.php +++ b/tests/Integration/BankTransfer/CreateTest.php @@ -13,7 +13,6 @@ class CreateTest extends TestCase { - /** * @return void */ @@ -33,55 +32,55 @@ public function testSuccess() $transfer = new CelcoinBankTransfer(); $response = $transfer->create( new Create([ - "document" => "35914746817", - "externalTerminal" => "teste2", - "externalNSU" => 1234, - "accountCode" => "379424", - "digitCode" => "5", - "branchCode" => "30", - "name" => "Fulano de tal", - "value" => 5, - "bankAccountType" => AccountTypeEnum::CHECKING_ACCOUNT, - "institutionIspb" => "30306294", + 'document' => '35914746817', + 'externalTerminal' => 'teste2', + 'externalNSU' => 1234, + 'accountCode' => '379424', + 'digitCode' => '5', + 'branchCode' => '30', + 'name' => 'Fulano de tal', + 'value' => 5, + 'bankAccountType' => AccountTypeEnum::CHECKING_ACCOUNT, + 'institutionIspb' => '30306294', ]), ); $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "authenticationAPI" => [ - "bloco1" => "8D.65.EE.39.C4.EA.2A.33", - "bloco2" => "DD.3F.15.C8.08.A5.6A.D6", - "blocoCompleto" => "8D.65.EE.39.C4.EA.2A.33.DD.3F.15.C8.08.A5.6A.D6", + 'authenticationAPI' => [ + 'bloco1' => '8D.65.EE.39.C4.EA.2A.33', + 'bloco2' => 'DD.3F.15.C8.08.A5.6A.D6', + 'blocoCompleto' => '8D.65.EE.39.C4.EA.2A.33.DD.3F.15.C8.08.A5.6A.D6', ], - "receipt" => [ - "receiptData" => null, - "receiptformatted" => "\n CELCOIN PAGAMENTOS \n \n IHOLD BANK CORRESPONDENTE BANCARIO LTDA\n PROTOCOLO 817877890 \n 05/07/2023 23:31 \n ---------------------------------------\n TRANSFERENCIA \n CODIGO BANCO: 30306294 \n AGENCIA: 30 \n CONTA: 3794245 \n NOME: FULANO DE TAL \n CPF / CNPJ: 35914746817 \n VALOR: 5,00 \n ENDTOEND: E139358932023070523310118522827\n \n ---------------------------------------\n \n AUTENTICACAO \n 8D.65.EE.39.C4.EA.2A.33 \n DD.3F.15.C8.08.A5.6A.D6 \n ", + 'receipt' => [ + 'receiptData' => null, + 'receiptformatted' => "\n CELCOIN PAGAMENTOS \n \n IHOLD BANK CORRESPONDENTE BANCARIO LTDA\n PROTOCOLO 817877890 \n 05/07/2023 23:31 \n ---------------------------------------\n TRANSFERENCIA \n CODIGO BANCO: 30306294 \n AGENCIA: 30 \n CONTA: 3794245 \n NOME: FULANO DE TAL \n CPF / CNPJ: 35914746817 \n VALOR: 5,00 \n ENDTOEND: E139358932023070523310118522827\n \n ---------------------------------------\n \n AUTENTICACAO \n 8D.65.EE.39.C4.EA.2A.33 \n DD.3F.15.C8.08.A5.6A.D6 \n ", ], - "destinationAccountData" => [ - "agency" => 30, - "institutionCode" => 30306294, - "account" => 379424, - "accountVerifierDigit" => "5", - "document" => "35914746817", - "institutionName" => null, - "fullName" => "Fulano de tal", - "bankAccountType" => 0, - "documentType" => "CPF", - "value" => 5.0, + 'destinationAccountData' => [ + 'agency' => 30, + 'institutionCode' => 30306294, + 'account' => 379424, + 'accountVerifierDigit' => '5', + 'document' => '35914746817', + 'institutionName' => null, + 'fullName' => 'Fulano de tal', + 'bankAccountType' => 0, + 'documentType' => 'CPF', + 'value' => 5.0, ], - "createDate" => "2023-07-05T23:31:27.5883691+00:00", - "dateNextLiquidation" => "", - "nextSettle" => false, - "transactionId" => 817877890, - "endToEnd" => "E1393589320230705233101185228273", - "urlreceipt" => "", - "errorCode" => "000", - "message" => "SUCESSO", - "status" => "0", + 'createDate' => '2023-07-05T23:31:27.5883691+00:00', + 'dateNextLiquidation' => '', + 'nextSettle' => false, + 'transactionId' => 817877890, + 'endToEnd' => 'E1393589320230705233101185228273', + 'urlreceipt' => '', + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => '0', ], Response::HTTP_OK, ); diff --git a/tests/Integration/BankTransfer/GetStatusTransferTest.php b/tests/Integration/BankTransfer/GetStatusTransferTest.php index 19d2118..7870c73 100644 --- a/tests/Integration/BankTransfer/GetStatusTransferTest.php +++ b/tests/Integration/BankTransfer/GetStatusTransferTest.php @@ -11,7 +11,6 @@ class GetStatusTransferTest extends TestCase { - /** * @return void */ @@ -33,21 +32,21 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "authentication" => 0, - "createDate" => "2023-07-14T18:15:24", - "refundReason" => "Value in Creditor Identifier is incorrect", - "externalNSU" => "1234", - "transactionId" => 817981763, - "stateCompensation" => "Processado com erro", - "externalTerminal" => "teste2", - "typeTransactions" => null, - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'authentication' => 0, + 'createDate' => '2023-07-14T18:15:24', + 'refundReason' => 'Value in Creditor Identifier is incorrect', + 'externalNSU' => '1234', + 'transactionId' => 817981763, + 'stateCompensation' => 'Processado com erro', + 'externalTerminal' => 'teste2', + 'typeTransactions' => null, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/BillPayments/AutorizeTest.php b/tests/Integration/BillPayments/AutorizeTest.php index 302af6b..522006f 100644 --- a/tests/Integration/BillPayments/AutorizeTest.php +++ b/tests/Integration/BillPayments/AutorizeTest.php @@ -12,7 +12,6 @@ class AutorizeTest extends TestCase { - /** * @return void */ @@ -32,56 +31,56 @@ public function testSuccess() $payment = new CelcoinBillPayment(); $response = $payment->authorize( new Authorize([ - "externalTerminal" => "teste2", - "externalNSU" => 1234, - "barCode" => [ - "type" => 2, - "digitable" => "34191090080025732445903616490003691150000020000", - "barCode" => "", + 'externalTerminal' => 'teste2', + 'externalNSU' => 1234, + 'barCode' => [ + 'type' => 2, + 'digitable' => '34191090080025732445903616490003691150000020000', + 'barCode' => '', ], ]), ); $this->assertArrayHasKey('registerData', $response); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "assignor" => "BANCO ITAU S.A.", - "registerData" => [ - "documentRecipient" => "13.935.893/0001-09", - "documentPayer" => "13.935.893/0001-09", - "payDueDate" => "2023-08-12T00:00:00", - "nextBusinessDay" => null, - "dueDateRegister" => "2023-07-14T00:00:00", - "allowChangeValue" => true, - "recipient" => "BENEFICIARIO AMBIENTE HOMOLOGACAO", - "payer" => "PAGADOR AMBIENTE DE HOMOLOGACAO", - "discountValue" => 0.0, - "interestValueCalculated" => 0.0, - "maxValue" => 1500.0, - "minValue" => 0.0, - "fineValueCalculated" => 0.0, - "originalValue" => 1500.0, - "totalUpdated" => 1500.0, - "totalWithDiscount" => 0.0, - "totalWithAdditional" => 0.0, + 'assignor' => 'BANCO ITAU S.A.', + 'registerData' => [ + 'documentRecipient' => '13.935.893/0001-09', + 'documentPayer' => '13.935.893/0001-09', + 'payDueDate' => '2023-08-12T00:00:00', + 'nextBusinessDay' => null, + 'dueDateRegister' => '2023-07-14T00:00:00', + 'allowChangeValue' => true, + 'recipient' => 'BENEFICIARIO AMBIENTE HOMOLOGACAO', + 'payer' => 'PAGADOR AMBIENTE DE HOMOLOGACAO', + 'discountValue' => 0.0, + 'interestValueCalculated' => 0.0, + 'maxValue' => 1500.0, + 'minValue' => 0.0, + 'fineValueCalculated' => 0.0, + 'originalValue' => 1500.0, + 'totalUpdated' => 1500.0, + 'totalWithDiscount' => 0.0, + 'totalWithAdditional' => 0.0, ], - "settleDate" => "13/07/2023", - "dueDate" => "2023-07-14T00:00:00Z", - "endHour" => "20:00", - "initeHour" => "07:00", - "nextSettle" => "N", - "digitable" => "34191090080025732445903616490003691150000020000", - "transactionId" => 817958431, - "type" => 2, - "value" => 200.0, - "maxValue" => null, - "minValue" => null, - "errorCode" => "000", - "message" => null, - "status" => 0, + 'settleDate' => '13/07/2023', + 'dueDate' => '2023-07-14T00:00:00Z', + 'endHour' => '20:00', + 'initeHour' => '07:00', + 'nextSettle' => 'N', + 'digitable' => '34191090080025732445903616490003691150000020000', + 'transactionId' => 817958431, + 'type' => 2, + 'value' => 200.0, + 'maxValue' => null, + 'minValue' => null, + 'errorCode' => '000', + 'message' => null, + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/BillPayments/CancelTest.php b/tests/Integration/BillPayments/CancelTest.php index 504ac41..d1c7f02 100644 --- a/tests/Integration/BillPayments/CancelTest.php +++ b/tests/Integration/BillPayments/CancelTest.php @@ -12,7 +12,6 @@ class CancelTest extends TestCase { - /** * @return void */ @@ -33,20 +32,20 @@ public function testSuccess() $response = $payment->cancel( 817958450, new Cancel([ - "externalNSU" => 1234, - "externalTerminal" => "teste2", + 'externalNSU' => 1234, + 'externalTerminal' => 'teste2', ]), ); $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/BillPayments/ConfirmTest.php b/tests/Integration/BillPayments/ConfirmTest.php index 7cb4d59..2fe7188 100644 --- a/tests/Integration/BillPayments/ConfirmTest.php +++ b/tests/Integration/BillPayments/ConfirmTest.php @@ -12,7 +12,6 @@ class ConfirmTest extends TestCase { - /** * @return void */ @@ -33,20 +32,20 @@ public function testSuccess() $response = $payment->confirm( 817958497, new Confirm([ - "externalNSU" => 1234, - "externalTerminal" => "teste2", + 'externalNSU' => 1234, + 'externalTerminal' => 'teste2', ]), ); $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/BillPayments/CreateTest.php b/tests/Integration/BillPayments/CreateTest.php index ad77ad7..97c73ee 100644 --- a/tests/Integration/BillPayments/CreateTest.php +++ b/tests/Integration/BillPayments/CreateTest.php @@ -12,7 +12,6 @@ class CreateTest extends TestCase { - /** * @return void */ @@ -32,50 +31,50 @@ public function testSuccess() $payment = new CelcoinBillPayment(); $response = $payment->create( new Create([ - "externalNSU" => 1234, - "externalTerminal" => "teste2", - "cpfcnpj" => "51680002000100", - "billData" => [ - "value" => 1500, - "originalValue" => 1500, - "valueWithDiscount" => 0, - "valueWithAdditional" => 0, + 'externalNSU' => 1234, + 'externalTerminal' => 'teste2', + 'cpfcnpj' => '51680002000100', + 'billData' => [ + 'value' => 1500, + 'originalValue' => 1500, + 'valueWithDiscount' => 0, + 'valueWithAdditional' => 0, ], - "barCode" => [ - "type" => 2, - "digitable" => "34191090080025732445903616490003691150000020000", - "barCode" => "", + 'barCode' => [ + 'type' => 2, + 'digitable' => '34191090080025732445903616490003691150000020000', + 'barCode' => '', ], - "dueDate" => "2023-07-14", - "transactionIdAuthorize" => 817958488, + 'dueDate' => '2023-07-14', + 'transactionIdAuthorize' => 817958488, ]), ); $this->assertArrayHasKey('authenticationAPI', $response); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "convenant" => "BANCO VOTORANTIM", - "isExpired" => false, - "authentication" => 7295, - "authenticationAPI" => [ - "Bloco1" => "F6.4E.2B.DD.C4.D9.5F.4D", - "Bloco2" => "4B.FB.E0.D9.1B.84.C8.EA", - "BlocoCompleto" => "F6.4E.2B.DD.C4.D9.5F.4D.4B.FB.E0.D9.1B.84.C8.EA", + 'convenant' => 'BANCO VOTORANTIM', + 'isExpired' => false, + 'authentication' => 7295, + 'authenticationAPI' => [ + 'Bloco1' => 'F6.4E.2B.DD.C4.D9.5F.4D', + 'Bloco2' => '4B.FB.E0.D9.1B.84.C8.EA', + 'BlocoCompleto' => 'F6.4E.2B.DD.C4.D9.5F.4D.4B.FB.E0.D9.1B.84.C8.EA', ], - "receipt" => [ - "receiptData" => "", - "receiptformatted" => "\nTESTE\n PROTOCOLO 0817957611\n 1 13/07/2023 18:08\n TERM 228001 AGENTE 228001 AUTE 07295\n ----------------------------------------\n AUTO 975550 RECEBIMENTO CONTA\n \n BANCO ITAU S.A.\n 34191.09008 00257.324459 \n 03616.490003 6 91150000020000\n \n BENEF: BENEFICIARIO AMBIENTE HOMOLOGA\n CPF/CNPJ: 13.935.893/0001-09\n PAGADOR: PAGADOR AMBIENTE DE HOMOLOGACA\n CPF/CNPJ: 13.935.893/0001-09\n ----------------------------------------\n DATA DE VENCIMENTO 14/07/2023\n DATA DO PAGAMENTO 13/07/2023\n DATA DE LIQUIDACAO 13/07/2023\n VALOR TITULO 1500,00\n VALOR COBRADO 1500,00\n \n VALIDO COMO RECIBO DE PAGAMENTO\n ----------------------------------------\n AUTENTICACAO\n F6.4E.2B.DD.C4.D9.5F.4D\n 4B.FB.E0.D9.1B.84.C8.EA\n ----------------------------------------\n \n ", + 'receipt' => [ + 'receiptData' => '', + 'receiptformatted' => "\nTESTE\n PROTOCOLO 0817957611\n 1 13/07/2023 18:08\n TERM 228001 AGENTE 228001 AUTE 07295\n ----------------------------------------\n AUTO 975550 RECEBIMENTO CONTA\n \n BANCO ITAU S.A.\n 34191.09008 00257.324459 \n 03616.490003 6 91150000020000\n \n BENEF: BENEFICIARIO AMBIENTE HOMOLOGA\n CPF/CNPJ: 13.935.893/0001-09\n PAGADOR: PAGADOR AMBIENTE DE HOMOLOGACA\n CPF/CNPJ: 13.935.893/0001-09\n ----------------------------------------\n DATA DE VENCIMENTO 14/07/2023\n DATA DO PAGAMENTO 13/07/2023\n DATA DE LIQUIDACAO 13/07/2023\n VALOR TITULO 1500,00\n VALOR COBRADO 1500,00\n \n VALIDO COMO RECIBO DE PAGAMENTO\n ----------------------------------------\n AUTENTICACAO\n F6.4E.2B.DD.C4.D9.5F.4D\n 4B.FB.E0.D9.1B.84.C8.EA\n ----------------------------------------\n \n ", ], - "settleDate" => "2023-07-13T00:00:00", - "createDate" => "2023-07-13T18:08:15", - "transactionId" => 817957611, - "Urlreceipt" => null, - "errorCode" => "000", - "message" => null, - "status" => 0, + 'settleDate' => '2023-07-13T00:00:00', + 'createDate' => '2023-07-13T18:08:15', + 'transactionId' => 817957611, + 'Urlreceipt' => null, + 'errorCode' => '000', + 'message' => null, + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/BillPayments/OcurrencyTest.php b/tests/Integration/BillPayments/OcurrencyTest.php index b817850..04db9a5 100644 --- a/tests/Integration/BillPayments/OcurrencyTest.php +++ b/tests/Integration/BillPayments/OcurrencyTest.php @@ -12,7 +12,6 @@ class OcurrencyTest extends TestCase { - /** * @return void */ @@ -36,19 +35,19 @@ public function testSuccess() $this->assertArrayHasKey('occurrences', $response); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "occurrences" => [ - "date" => "2021-06-24T19:03:43", - "createDate" => "2021-06-24T15:54:14", - "descriptionMotivo" => "Recusado pelo beneficiário", - "externalNSU" => 1234, - "transactionId" => 7061967, - "externalTerminal" => "11122233344", - "linhaDigitavel" => "34191090080012213037050059980008586260000065000 ", - "value" => "20", + 'occurrences' => [ + 'date' => '2021-06-24T19:03:43', + 'createDate' => '2021-06-24T15:54:14', + 'descriptionMotivo' => 'Recusado pelo beneficiário', + 'externalNSU' => 1234, + 'transactionId' => 7061967, + 'externalTerminal' => '11122233344', + 'linhaDigitavel' => '34191090080012213037050059980008586260000065000 ', + 'value' => '20', ], ], Response::HTTP_OK, diff --git a/tests/Integration/BillPayments/ReverseTest.php b/tests/Integration/BillPayments/ReverseTest.php index c5b1485..7d58cbc 100644 --- a/tests/Integration/BillPayments/ReverseTest.php +++ b/tests/Integration/BillPayments/ReverseTest.php @@ -11,7 +11,6 @@ class ReverseTest extends TestCase { - /** * @return void */ @@ -33,13 +32,13 @@ public function testSuccess() $this->assertEquals('0', $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "errorCode" => "000", - "message" => "Pedido de estorno registrado com sucesso.", - "status" => "0", + 'errorCode' => '000', + 'message' => 'Pedido de estorno registrado com sucesso.', + 'status' => '0', ], Response::HTTP_OK, ); diff --git a/tests/Integration/DDA/Invoice/RegisterTest.php b/tests/Integration/DDA/Invoice/RegisterTest.php index 39da780..c6451cb 100644 --- a/tests/Integration/DDA/Invoice/RegisterTest.php +++ b/tests/Integration/DDA/Invoice/RegisterTest.php @@ -12,7 +12,6 @@ class RegisterTest extends TestCase { - /** * @return void */ @@ -32,9 +31,9 @@ public function testSuccess() $dda = new CelcoinDDAInvoice(); $response = $dda->register( new RegisterInvoice([ - "document" => [ - "28935923095", - "85429850012", + 'document' => [ + '28935923095', + '85429850012', ], ]), ); @@ -42,19 +41,19 @@ public function testSuccess() $this->assertEquals(201, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => 201, - "body" => [ + 'status' => 201, + 'body' => [ [ - "document" => "28935923095", - "status" => "Success", + 'document' => '28935923095', + 'status' => 'Success', ], [ - "document" => "85429850012", - "status" => "Success", + 'document' => '85429850012', + 'status' => 'Success', ], ], ], diff --git a/tests/Integration/DDA/User/RegisterTest.php b/tests/Integration/DDA/User/RegisterTest.php index 61d61cc..5be08cb 100644 --- a/tests/Integration/DDA/User/RegisterTest.php +++ b/tests/Integration/DDA/User/RegisterTest.php @@ -12,7 +12,6 @@ class RegisterTest extends TestCase { - /** * @return void */ @@ -32,26 +31,26 @@ public function testSuccess() $dda = new CelcoinDDAUser(); $response = $dda->register( new RegisterUser([ - "document" => '71929784007', - "clientName" => "Customer Teste de Sucesso", - "clientRequestId" => "customer_sucess_teste", + 'document' => '71929784007', + 'clientName' => 'Customer Teste de Sucesso', + 'clientRequestId' => 'customer_sucess_teste', ]), ); $this->assertEquals(201, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => 201, - "body" => [ - "document" => "64834852393", - "clientRequestId" => "0001", - "responseDate" => "2023-07-17T20:53:09.3583614+00:00", - "status" => "PROCESSING", - "subscriptionId" => "058f3598-a2ad-464d-9bec-96a045cfde6a", + 'status' => 201, + 'body' => [ + 'document' => '64834852393', + 'clientRequestId' => '0001', + 'responseDate' => '2023-07-17T20:53:09.3583614+00:00', + 'status' => 'PROCESSING', + 'subscriptionId' => '058f3598-a2ad-464d-9bec-96a045cfde6a', ], ], Response::HTTP_OK, diff --git a/tests/Integration/DDA/User/RemoveTest.php b/tests/Integration/DDA/User/RemoveTest.php index c15664c..4e71eaa 100644 --- a/tests/Integration/DDA/User/RemoveTest.php +++ b/tests/Integration/DDA/User/RemoveTest.php @@ -12,7 +12,6 @@ class RemoveTest extends TestCase { - /** * @return void */ @@ -32,25 +31,25 @@ public function testSuccess() $dda = new CelcoinDDAUser(); $response = $dda->remove( new RemoveUser([ - "document" => "64834852393", - "clientRequestId" => "0001", + 'document' => '64834852393', + 'clientRequestId' => '0001', ]), ); $this->assertEquals(201, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => 201, - "body" => [ - "document" => "23155663049", - "clientRequestId" => "0001", - "responseDate" => "2023-01-18T19:54:16.6647364+00:00", - "status" => "PROCESSING", - "subscriptionId" => "37c571d7-a594-4a11-8629-2e993beecf5d", + 'status' => 201, + 'body' => [ + 'document' => '23155663049', + 'clientRequestId' => '0001', + 'responseDate' => '2023-01-18T19:54:16.6647364+00:00', + 'status' => 'PROCESSING', + 'subscriptionId' => '37c571d7-a594-4a11-8629-2e993beecf5d', ], ], Response::HTTP_OK, diff --git a/tests/Integration/DDA/Webhook/ListTest.php b/tests/Integration/DDA/Webhook/ListTest.php index 414fb1f..b5cde34 100644 --- a/tests/Integration/DDA/Webhook/ListTest.php +++ b/tests/Integration/DDA/Webhook/ListTest.php @@ -11,7 +11,6 @@ class ListTest extends TestCase { - /** * @return void */ @@ -34,23 +33,23 @@ public function testSuccess() $this->assertEquals(200, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => 200, - "body" => [ + 'status' => 200, + 'body' => [ [ - "typeEventWebhook" => "Invoice", - "url" => "https://webhook.site/adf0d812-3e2d-43cc-91be-3d84128d27ab", + 'typeEventWebhook' => 'Invoice', + 'url' => 'https://webhook.site/adf0d812-3e2d-43cc-91be-3d84128d27ab', ], [ - "typeEventWebhook" => "Deletion", - "url" => "https://webhook.site/adf0d812-3e2d-43cc-91be-3d84128d27ab", + 'typeEventWebhook' => 'Deletion', + 'url' => 'https://webhook.site/adf0d812-3e2d-43cc-91be-3d84128d27ab', ], [ - "typeEventWebhook" => "Subscription", - "url" => "https://webhook.site/adf0d812-3e2d-43cc-91be-3d84128d27ab", + 'typeEventWebhook' => 'Subscription', + 'url' => 'https://webhook.site/adf0d812-3e2d-43cc-91be-3d84128d27ab', ], ], ], diff --git a/tests/Integration/DDA/Webhook/RegisterTest.php b/tests/Integration/DDA/Webhook/RegisterTest.php index 03fab74..0a8d242 100644 --- a/tests/Integration/DDA/Webhook/RegisterTest.php +++ b/tests/Integration/DDA/Webhook/RegisterTest.php @@ -13,7 +13,6 @@ class RegisterTest extends TestCase { - /** * @return void */ @@ -33,11 +32,11 @@ public function testSuccess() $dda = new CelcoinDDAWebhooks(); $response = $dda->register( new RegisterWebhooks([ - "typeEventWebhook" => DDAWebhooksTypeEventEnum::INVOICE, - "url" => "https://webhook.site/d24aa98f-1837-4698-8825-688f94390cfe", - "basicAuthentication" => [ - "identification" => "João", - "password" => "Um@Pro7ec@o", + 'typeEventWebhook' => DDAWebhooksTypeEventEnum::INVOICE, + 'url' => 'https://webhook.site/d24aa98f-1837-4698-8825-688f94390cfe', + 'basicAuthentication' => [ + 'identification' => 'João', + 'password' => 'Um@Pro7ec@o', ], ]), ); @@ -45,19 +44,19 @@ public function testSuccess() $this->assertEquals(201, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => 201, - "body" => [ - "typeEventWebhook" => "Invoice", - "url" => "https://webhook.site/d24aa98f-1837-4698-8825-688f94390cfe", - "basicAuthentication" => [ - "identification" => "João", - "password" => "Um@Pro7ec@o", + 'status' => 201, + 'body' => [ + 'typeEventWebhook' => 'Invoice', + 'url' => 'https://webhook.site/d24aa98f-1837-4698-8825-688f94390cfe', + 'basicAuthentication' => [ + 'identification' => 'João', + 'password' => 'Um@Pro7ec@o', ], - "oAuthTwo" => null, + 'oAuthTwo' => null, ], ], Response::HTTP_OK, diff --git a/tests/Integration/ElectronicTransactions/DepositTest.php b/tests/Integration/ElectronicTransactions/DepositTest.php index b68a8c7..9ca6a86 100644 --- a/tests/Integration/ElectronicTransactions/DepositTest.php +++ b/tests/Integration/ElectronicTransactions/DepositTest.php @@ -12,7 +12,6 @@ class DepositTest extends TestCase { - /** * @return void */ @@ -32,35 +31,35 @@ public function testSuccess() $electronicTransaction = new CelcoinElectronicTransactions(); $response = $electronicTransaction->deposit( new Deposit([ - "externalNSU" => 1234, - "externalTerminal" => "teste2", - "payerContact" => "Fulano de tal", - "payerDocument" => "11122233344", - "transactionIdentifier" => "Banco24Horas/DepositoDigital/v1/a0a0d296-3754-454d-bc0c-b1c4d114467f/ea9dd655/1240004", - "payerName" => "Fulano de tal", - "namePartner" => "TECBAN_BANCO24H", - "value" => 10, + 'externalNSU' => 1234, + 'externalTerminal' => 'teste2', + 'payerContact' => 'Fulano de tal', + 'payerDocument' => '11122233344', + 'transactionIdentifier' => 'Banco24Horas/DepositoDigital/v1/a0a0d296-3754-454d-bc0c-b1c4d114467f/ea9dd655/1240004', + 'payerName' => 'Fulano de tal', + 'namePartner' => 'TECBAN_BANCO24H', + 'value' => 10, ]), ); $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "BarCodeBase64" => null, - "convenant" => "0720", - "orderNumber" => "a0a0d296-3754-454d-bc0c-b1c4d114467f", - "product" => null, - "transactionId" => 816055940, - "QRCodeBase64" => null, - "token" => null, - "value" => 150, - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'BarCodeBase64' => null, + 'convenant' => '0720', + 'orderNumber' => 'a0a0d296-3754-454d-bc0c-b1c4d114467f', + 'product' => null, + 'transactionId' => 816055940, + 'QRCodeBase64' => null, + 'token' => null, + 'value' => 150, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/ElectronicTransactions/GenerateWithdrawTokenTest.php b/tests/Integration/ElectronicTransactions/GenerateWithdrawTokenTest.php index e3ca92c..78b7c5c 100644 --- a/tests/Integration/ElectronicTransactions/GenerateWithdrawTokenTest.php +++ b/tests/Integration/ElectronicTransactions/GenerateWithdrawTokenTest.php @@ -12,7 +12,6 @@ class GenerateWithdrawTokenTest extends TestCase { - /** * @return void */ @@ -32,29 +31,29 @@ public function testSuccess() $electronicTransaction = new CelcoinElectronicTransactions(); $response = $electronicTransaction->generateWithdrawToken( new WithdrawToken([ - "externalNSU" => 1234, - "externalTerminal" => "teste2", - "receivingDocument" => "11122233344", - "receivingName" => "Fulano de tal", - "value" => 150, + 'externalNSU' => 1234, + 'externalTerminal' => 'teste2', + 'receivingDocument' => '11122233344', + 'receivingName' => 'Fulano de tal', + 'value' => 150, ]), ); $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "convenant" => "0720", - "transactionIdentifier" => "05e07b49-f57a-453c-b5e7-46ebe7bc5037", - "transactionId" => "816055940", - "token" => "string", - "value" => "150", - "erroCode" => "000", - "message" => "SUCCESS", - "status" => 0, + 'convenant' => '0720', + 'transactionIdentifier' => '05e07b49-f57a-453c-b5e7-46ebe7bc5037', + 'transactionId' => '816055940', + 'token' => 'string', + 'value' => '150', + 'erroCode' => '000', + 'message' => 'SUCCESS', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/ElectronicTransactions/GetServicesPointsTest.php b/tests/Integration/ElectronicTransactions/GetServicesPointsTest.php index c5980d4..16bb09e 100644 --- a/tests/Integration/ElectronicTransactions/GetServicesPointsTest.php +++ b/tests/Integration/ElectronicTransactions/GetServicesPointsTest.php @@ -12,7 +12,6 @@ class GetServicesPointsTest extends TestCase { - /** * @return void */ @@ -44,236 +43,236 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "stores" => [ + 'stores' => [ [ - "description" => null, - "Address" => [ - "district" => "VL BRANDINA", - "city" => "CAMPINAS", - "state" => "SP", - "number" => "777", - "Rua" => "AV IGUATEMI", + 'description' => null, + 'Address' => [ + 'district' => 'VL BRANDINA', + 'city' => 'CAMPINAS', + 'state' => 'SP', + 'number' => '777', + 'Rua' => 'AV IGUATEMI', ], - "location" => [ - "latitude" => -22.89369, - "longitude" => -47.025433, + 'location' => [ + 'latitude' => -22.89369, + 'longitude' => -47.025433, ], - "storeId" => "30187", - "name" => "SHOP IGUATEMI CPQ I", - "allowedTransactions" => null, + 'storeId' => '30187', + 'name' => 'SHOP IGUATEMI CPQ I', + 'allowedTransactions' => null, ], [ - "description" => null, - "Address" => [ - "district" => "VL BRANDINA", - "city" => "CAMPINAS", - "state" => "SP", - "number" => "777", - "Rua" => "AV IGUATEMI", + 'description' => null, + 'Address' => [ + 'district' => 'VL BRANDINA', + 'city' => 'CAMPINAS', + 'state' => 'SP', + 'number' => '777', + 'Rua' => 'AV IGUATEMI', ], - "location" => [ - "latitude" => -22.89369, - "longitude" => -47.025433, + 'location' => [ + 'latitude' => -22.89369, + 'longitude' => -47.025433, ], - "storeId" => "30204", - "name" => "SHOP IGUATEMI CPQ II", - "allowedTransactions" => null, + 'storeId' => '30204', + 'name' => 'SHOP IGUATEMI CPQ II', + 'allowedTransactions' => null, ], [ - "description" => null, - "Address" => [ - "district" => "VL BRANDINA", - "city" => "CAMPINAS", - "state" => "SP", - "number" => "777", - "Rua" => "AV IGUATEMI", + 'description' => null, + 'Address' => [ + 'district' => 'VL BRANDINA', + 'city' => 'CAMPINAS', + 'state' => 'SP', + 'number' => '777', + 'Rua' => 'AV IGUATEMI', ], - "location" => [ - "latitude" => -22.89369, - "longitude" => -47.025433, + 'location' => [ + 'latitude' => -22.89369, + 'longitude' => -47.025433, ], - "storeId" => "37153", - "name" => "SHOP IGUATEMI CPQ IV", - "allowedTransactions" => null, + 'storeId' => '37153', + 'name' => 'SHOP IGUATEMI CPQ IV', + 'allowedTransactions' => null, ], [ - "description" => null, - "Address" => [ - "district" => "TAQUARA", - "city" => "RIO DE JANEIRO", - "state" => "RJ", - "number" => "452", - "Rua" => "ESTRADA DA SOCA", + 'description' => null, + 'Address' => [ + 'district' => 'TAQUARA', + 'city' => 'RIO DE JANEIRO', + 'state' => 'RJ', + 'number' => '452', + 'Rua' => 'ESTRADA DA SOCA', ], - "location" => [ - "latitude" => -22.892096, - "longitude" => -47.02865, + 'location' => [ + 'latitude' => -22.892096, + 'longitude' => -47.02865, ], - "storeId" => "21438", - "name" => "PAD ZE DO PUDIM", - "allowedTransactions" => null, + 'storeId' => '21438', + 'name' => 'PAD ZE DO PUDIM', + 'allowedTransactions' => null, ], [ - "description" => null, - "Address" => [ - "district" => "JD FLAMBOYANT", - "city" => "CAMPINAS", - "state" => "SP", - "number" => "1237", - "Rua" => "AV JOSE BONIFACIO", + 'description' => null, + 'Address' => [ + 'district' => 'JD FLAMBOYANT', + 'city' => 'CAMPINAS', + 'state' => 'SP', + 'number' => '1237', + 'Rua' => 'AV JOSE BONIFACIO', ], - "location" => [ - "latitude" => -22.88778, - "longitude" => -47.03143, + 'location' => [ + 'latitude' => -22.88778, + 'longitude' => -47.03143, ], - "storeId" => "24143", - "name" => "POSTO AVENIDA", - "allowedTransactions" => null, + 'storeId' => '24143', + 'name' => 'POSTO AVENIDA', + 'allowedTransactions' => null, ], [ - "description" => null, - "Address" => [ - "district" => "JD FLAMBOYANT", - "city" => "CAMPINAS", - "state" => "SP", - "number" => "22", - "Rua" => "RUA CAJAMAR", + 'description' => null, + 'Address' => [ + 'district' => 'JD FLAMBOYANT', + 'city' => 'CAMPINAS', + 'state' => 'SP', + 'number' => '22', + 'Rua' => 'RUA CAJAMAR', ], - "location" => [ - "latitude" => -22.883777, - "longitude" => -47.036805, + 'location' => [ + 'latitude' => -22.883777, + 'longitude' => -47.036805, ], - "storeId" => "16388", - "name" => "AP FLAMBOYANT ", - "allowedTransactions" => null, + 'storeId' => '16388', + 'name' => 'AP FLAMBOYANT ', + 'allowedTransactions' => null, ], [ - "description" => null, - "Address" => [ - "district" => "CAMBUI", - "city" => "CAMPINAS", - "state" => "SP", - "number" => "2101", - "Rua" => "AV JOSE DE SOUZA CAMPOS", + 'description' => null, + 'Address' => [ + 'district' => 'CAMBUI', + 'city' => 'CAMPINAS', + 'state' => 'SP', + 'number' => '2101', + 'Rua' => 'AV JOSE DE SOUZA CAMPOS', ], - "location" => [ - "latitude" => -22.886957, - "longitude" => -47.044606, + 'location' => [ + 'latitude' => -22.886957, + 'longitude' => -47.044606, ], - "storeId" => "23810", - "name" => "POSTO ANDORINHAS CAMBUI ", - "allowedTransactions" => null, + 'storeId' => '23810', + 'name' => 'POSTO ANDORINHAS CAMBUI ', + 'allowedTransactions' => null, ], [ - "description" => null, - "Address" => [ - "district" => "JD BELA VISTA", - "city" => "CAMPINAS", - "state" => "SP", - "number" => "1270", - "Rua" => "AV NOSSA SENHORA DE FATIMA", + 'description' => null, + 'Address' => [ + 'district' => 'JD BELA VISTA', + 'city' => 'CAMPINAS', + 'state' => 'SP', + 'number' => '1270', + 'Rua' => 'AV NOSSA SENHORA DE FATIMA', ], - "location" => [ - "latitude" => -22.878524, - "longitude" => -47.044303, + 'location' => [ + 'latitude' => -22.878524, + 'longitude' => -47.044303, ], - "storeId" => "26802", - "name" => "SUP DALBEN II", - "allowedTransactions" => null, + 'storeId' => '26802', + 'name' => 'SUP DALBEN II', + 'allowedTransactions' => null, ], [ - "description" => null, - "Address" => [ - "district" => "JD BELA VISTA", - "city" => "CAMPINAS", - "state" => "SP", - "number" => "1270", - "Rua" => "AV NOSSA SENHORA DE FATIMA", + 'description' => null, + 'Address' => [ + 'district' => 'JD BELA VISTA', + 'city' => 'CAMPINAS', + 'state' => 'SP', + 'number' => '1270', + 'Rua' => 'AV NOSSA SENHORA DE FATIMA', ], - "location" => [ - "latitude" => -22.878524, - "longitude" => -47.044303, + 'location' => [ + 'latitude' => -22.878524, + 'longitude' => -47.044303, ], - "storeId" => "31357", - "name" => "SUP DALBEN II", - "allowedTransactions" => null, + 'storeId' => '31357', + 'name' => 'SUP DALBEN II', + 'allowedTransactions' => null, ], [ - "description" => null, - "Address" => [ - "district" => "JD BELA VISTA", - "city" => "CAMPINAS", - "state" => "SP", - "number" => "1270", - "Rua" => "AV NOSSA SENHORA DE FATIMA", + 'description' => null, + 'Address' => [ + 'district' => 'JD BELA VISTA', + 'city' => 'CAMPINAS', + 'state' => 'SP', + 'number' => '1270', + 'Rua' => 'AV NOSSA SENHORA DE FATIMA', ], - "location" => [ - "latitude" => -22.878524, - "longitude" => -47.044303, + 'location' => [ + 'latitude' => -22.878524, + 'longitude' => -47.044303, ], - "storeId" => "8045", - "name" => "SUP DALBEN I ", - "allowedTransactions" => null, + 'storeId' => '8045', + 'name' => 'SUP DALBEN I ', + 'allowedTransactions' => null, ], [ - "description" => null, - "Address" => [ - "district" => "CAMBUI", - "city" => "CAMPINAS", - "state" => "SP", - "number" => "616", - "Rua" => "RUA ALECRINS", + 'description' => null, + 'Address' => [ + 'district' => 'CAMBUI', + 'city' => 'CAMPINAS', + 'state' => 'SP', + 'number' => '616', + 'Rua' => 'RUA ALECRINS', ], - "location" => [ - "latitude" => -22.889135, - "longitude" => -47.049409, + 'location' => [ + 'latitude' => -22.889135, + 'longitude' => -47.049409, ], - "storeId" => "51584", - "name" => "P. ACUCAR ALECRINS", - "allowedTransactions" => null, + 'storeId' => '51584', + 'name' => 'P. ACUCAR ALECRINS', + 'allowedTransactions' => null, ], [ - "description" => null, - "Address" => [ - "district" => "JD BELA VISTA", - "city" => "CAMPINAS", - "state" => "SP", - "number" => "326", - "Rua" => "AV JULIO PRESTES", + 'description' => null, + 'Address' => [ + 'district' => 'JD BELA VISTA', + 'city' => 'CAMPINAS', + 'state' => 'SP', + 'number' => '326', + 'Rua' => 'AV JULIO PRESTES', ], - "location" => [ - "latitude" => -22.877243, - "longitude" => -47.044702, + 'location' => [ + 'latitude' => -22.877243, + 'longitude' => -47.044702, ], - "storeId" => "27286", - "name" => "AP ALFEMAR TAQUARAL", - "allowedTransactions" => null, + 'storeId' => '27286', + 'name' => 'AP ALFEMAR TAQUARAL', + 'allowedTransactions' => null, ], [ - "description" => null, - "Address" => [ - "district" => "JD PARAISO", - "city" => "CAMPINAS", - "state" => "SP", - "number" => "1802", - "Rua" => "AV PRINCESA D' OESTE", + 'description' => null, + 'Address' => [ + 'district' => 'JD PARAISO', + 'city' => 'CAMPINAS', + 'state' => 'SP', + 'number' => '1802', + 'Rua' => "AV PRINCESA D' OESTE", ], - "location" => [ - "latitude" => -22.90727, - "longitude" => -47.045195, + 'location' => [ + 'latitude' => -22.90727, + 'longitude' => -47.045195, ], - "storeId" => "38287", - "name" => "DIA PRINCESA D OESTE LJ 475 ", - "allowedTransactions" => null, + 'storeId' => '38287', + 'name' => 'DIA PRINCESA D OESTE LJ 475 ', + 'allowedTransactions' => null, ], ], - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/ElectronicTransactions/PartnersTest.php b/tests/Integration/ElectronicTransactions/PartnersTest.php index 2550d7e..08b36e9 100644 --- a/tests/Integration/ElectronicTransactions/PartnersTest.php +++ b/tests/Integration/ElectronicTransactions/PartnersTest.php @@ -11,7 +11,6 @@ class PartnersTest extends TestCase { - /** * @return void */ @@ -34,30 +33,30 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "ParceirosPecRec" => [ + 'ParceirosPecRec' => [ [ - "codeParceiro" => "0001", - "IndBarCodeDeposit" => "S", - "IndBarCodeWithdraw" => "S", - "IndQRCodeDeposit" => "S", - "IndQRCodeWithdraw" => "S", - "namePartner" => "BrinksPay", - "partnerPecRecRecId" => "1", - "partnerType" => "VAREJO", - "typeTransactionsCancelamento" => "SOLICITACANCELAMENTOPECREC", - "maxValueDeposito" => 2000.0, - "maxValueSaque" => 2000.0, - "minValueDeposito" => 0.0, - "minValueSaque" => 0.01, + 'codeParceiro' => '0001', + 'IndBarCodeDeposit' => 'S', + 'IndBarCodeWithdraw' => 'S', + 'IndQRCodeDeposit' => 'S', + 'IndQRCodeWithdraw' => 'S', + 'namePartner' => 'BrinksPay', + 'partnerPecRecRecId' => '1', + 'partnerType' => 'VAREJO', + 'typeTransactionsCancelamento' => 'SOLICITACANCELAMENTOPECREC', + 'maxValueDeposito' => 2000.0, + 'maxValueSaque' => 2000.0, + 'minValueDeposito' => 0.0, + 'minValueSaque' => 0.01, ], ], - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/ElectronicTransactions/WithdrawTest.php b/tests/Integration/ElectronicTransactions/WithdrawTest.php index ece6d9d..f9b56b3 100644 --- a/tests/Integration/ElectronicTransactions/WithdrawTest.php +++ b/tests/Integration/ElectronicTransactions/WithdrawTest.php @@ -12,7 +12,6 @@ class WithdrawTest extends TestCase { - /** * @return void */ @@ -32,18 +31,18 @@ public function testSuccess() $electronicTransaction = new CelcoinElectronicTransactions(); $response = $electronicTransaction->withdraw( new Withdraw([ - "externalNSU" => 1234, - "externalTerminal" => "teste2", - "receivingContact" => "944445555", - "receivingDocument" => "11122233344", - "transactionIdentifier" => "05e07b49-f57a-453c-b5e7-46ebe7bc5037", - "receivingName" => "Fulano de tal", - "namePartner" => "TECBAN_BANCO24H", - "value" => 150, - "secondAuthentication" => [ - "dataForSecondAuthentication" => 12345, - "textForSecondIdentification" => "ID do usuário", - "useSecondAuthentication" => false, + 'externalNSU' => 1234, + 'externalTerminal' => 'teste2', + 'receivingContact' => '944445555', + 'receivingDocument' => '11122233344', + 'transactionIdentifier' => '05e07b49-f57a-453c-b5e7-46ebe7bc5037', + 'receivingName' => 'Fulano de tal', + 'namePartner' => 'TECBAN_BANCO24H', + 'value' => 150, + 'secondAuthentication' => [ + 'dataForSecondAuthentication' => 12345, + 'textForSecondIdentification' => 'ID do usuário', + 'useSecondAuthentication' => false, ], ]), ); @@ -51,23 +50,23 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "BarCodeBase64" => null, - "convenant" => "0860", - "externalWithdrawIdentifier" => "", - "transactionIdentifier" => "05e07b49-f57a-453c-b5e7-46ebe7bc5037", - "orderNumber" => null, - "product" => null, - "transactionId" => 817981834, - "QRCodeBase64" => null, - "token" => null, - "value" => 150, - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'BarCodeBase64' => null, + 'convenant' => '0860', + 'externalWithdrawIdentifier' => '', + 'transactionIdentifier' => '05e07b49-f57a-453c-b5e7-46ebe7bc5037', + 'orderNumber' => null, + 'product' => null, + 'transactionId' => 817981834, + 'QRCodeBase64' => null, + 'token' => null, + 'value' => 150, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/KYC/CelcoinSendKycTest.php b/tests/Integration/KYC/CelcoinSendKycTest.php index 231a6bb..959b271 100644 --- a/tests/Integration/KYC/CelcoinSendKycTest.php +++ b/tests/Integration/KYC/CelcoinSendKycTest.php @@ -84,17 +84,16 @@ public function testSendKycFailedRequest() } public function getKycBody( - string $nifNumber = null, - KycDocumentEnum $fileType = null, - string $fileFront = null, - string $cnpj = null, + ?string $nifNumber = null, + ?KycDocumentEnum $fileType = null, + ?string $fileFront = null, + ?string $cnpj = null, bool $addVerse = true - ): array - { + ): array { $file = $this->front; $body = [ - 'documentnumber' => $nifNumber ?? "11122233344", + 'documentnumber' => $nifNumber ?? '11122233344', 'filetype' => $fileType ?? KycDocumentEnum::CONTRATO_SOCIAL, 'front' => $fileFront ?? $this->getFile($file->path()), ]; @@ -115,7 +114,7 @@ public static function successResponse(): PromiseInterface { return Http::response([ 'status' => 200, - 'message' => "Arquivo enviado com sucesso", + 'message' => 'Arquivo enviado com sucesso', ]); } @@ -135,7 +134,7 @@ public static function internalErrorResponse(): PromiseInterface ], 500); } - public function getFile(string $path = null): KycDocument + public function getFile(?string $path = null): KycDocument { return new KycDocument(new File($path), 'verse'); } diff --git a/tests/Integration/PIX/COB/COBCreateTest.php b/tests/Integration/PIX/COB/COBCreateTest.php index 2b2b25f..42cedf8 100644 --- a/tests/Integration/PIX/COB/COBCreateTest.php +++ b/tests/Integration/PIX/COB/COBCreateTest.php @@ -19,7 +19,6 @@ class COBCreateTest extends TestCase { - /** * @throws RequestException */ @@ -109,6 +108,7 @@ private function fakeCOBBody(): COB $cob->calendar = new Calendar([ 'expiration' => 84000, ]); + return $cob; } @@ -141,7 +141,8 @@ final public function testCreateCobWithCobvLocation(): void private static function stubCOBError(): PromiseInterface { - return Http::response([ + return Http::response( + [ 'message' => 'Can\'t create a new PixImmediateCollection when the location type is COB', 'errorCode' => 'PBE410', ], @@ -151,6 +152,7 @@ private static function stubCOBError(): PromiseInterface /** * @throws RequestException + * * @dataProvider createErrorDataProvider */ final public function testCreateCobWithoutField(string $unsetValue): void @@ -179,6 +181,7 @@ final public function testCreateCobWithoutField(string $unsetValue): void /** * @throws RequestException + * * @dataProvider statusErrorDataProvider */ final public function testCreateErrors( @@ -229,18 +232,18 @@ final public static function createErrorDataProvider(): array final public static function statusErrorDataProvider(): array { return [ - 'PBE318' => [fn() => self::locationInUseStub(), 'PBE318'], - 'CI002' => [fn() => self::locationNotReturned(), 'CI002'], - 'CI003' => [fn() => self::keyNotRegistered(), 'CI003'], - 'VLI001' => [fn() => self::originalAmountIsRequired(), 'VLI001'], - 'VLI002' => [fn() => self::prohibitSimultaneousSendChangeAndWithdrawal(), 'VLI002'], - 'VLI010' => [fn() => self::cashValueIsMandatory(), 'VLI010'], - 'VLI004' => [fn() => self::withdrawalAmountOriginalGreaterThanZero(), 'VLI004'], - 'VLI005' => [fn() => self::withdrawalAmountOriginalNotGreaterThanZero(), 'VLI005'], - 'VLI006' => [fn() => self::withdrawalIspbCodePattern(), 'VLI006'], - 'VLI007' => [fn() => self::withdrawalAgentModeRequired(), 'VLI007'], - 'VLI008' => [fn() => self::withdrawalAgentModeValidOptions(), 'VLI008'], - 'VLI009' => [fn() => self::withdrawalRequiredCashValue(), 'VLI009'], + 'PBE318' => [fn () => self::locationInUseStub(), 'PBE318'], + 'CI002' => [fn () => self::locationNotReturned(), 'CI002'], + 'CI003' => [fn () => self::keyNotRegistered(), 'CI003'], + 'VLI001' => [fn () => self::originalAmountIsRequired(), 'VLI001'], + 'VLI002' => [fn () => self::prohibitSimultaneousSendChangeAndWithdrawal(), 'VLI002'], + 'VLI010' => [fn () => self::cashValueIsMandatory(), 'VLI010'], + 'VLI004' => [fn () => self::withdrawalAmountOriginalGreaterThanZero(), 'VLI004'], + 'VLI005' => [fn () => self::withdrawalAmountOriginalNotGreaterThanZero(), 'VLI005'], + 'VLI006' => [fn () => self::withdrawalIspbCodePattern(), 'VLI006'], + 'VLI007' => [fn () => self::withdrawalAgentModeRequired(), 'VLI007'], + 'VLI008' => [fn () => self::withdrawalAgentModeValidOptions(), 'VLI008'], + 'VLI009' => [fn () => self::withdrawalRequiredCashValue(), 'VLI009'], ]; } @@ -377,5 +380,4 @@ public static function withdrawalRequiredCashValue(): PromiseInterface Response::HTTP_BAD_REQUEST, ); } - -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/COB/COBDeteleTest.php b/tests/Integration/PIX/COB/COBDeteleTest.php index 0874f47..83a1d8e 100644 --- a/tests/Integration/PIX/COB/COBDeteleTest.php +++ b/tests/Integration/PIX/COB/COBDeteleTest.php @@ -12,7 +12,6 @@ class COBDeteleTest extends TestCase { - /** * @throws RequestException */ @@ -32,7 +31,8 @@ final public function testDeleteCob(): void private function stubSuccess(): PromiseInterface { - return Http::response([ + return Http::response( + [ 'transactionId' => 817849688, 'status' => 200, 'message' => '200', @@ -69,11 +69,12 @@ final public function testDeleteCobNotFound(): void private function stubError(): PromiseInterface { - return Http::response([ + return Http::response( + [ 'statusCode' => 404, 'message' => 'Resource not found', ], Response::HTTP_NOT_FOUND, ); } -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/COB/COBFetchTest.php b/tests/Integration/PIX/COB/COBFetchTest.php index 779a834..ba3c5bd 100644 --- a/tests/Integration/PIX/COB/COBFetchTest.php +++ b/tests/Integration/PIX/COB/COBFetchTest.php @@ -99,12 +99,10 @@ final public function testFetchCobNotFound(): void } } - /** - * @return PromiseInterface - */ private static function stubNotFound(): PromiseInterface { - return Http::response([ + return Http::response( + [ 'message' => 'Não foi possível localizar a cobrança associada ao parâmetro informado.', 'errorCode' => 'VL002', ], diff --git a/tests/Integration/PIX/COB/COBGetTest.php b/tests/Integration/PIX/COB/COBGetTest.php index ac2f181..dd8bfc6 100644 --- a/tests/Integration/PIX/COB/COBGetTest.php +++ b/tests/Integration/PIX/COB/COBGetTest.php @@ -14,9 +14,9 @@ class COBGetTest extends TestCase { - /** * @throws RequestException + * * @dataProvider searchDataProvider */ final public function testGetCob(array $searchParam): void @@ -90,6 +90,7 @@ private static function stubSuccess(): PromiseInterface /** * @throws RequestException + * * @dataProvider searchDataProvider */ final public function testGetCobNotFound(array $searchParam): void @@ -128,6 +129,7 @@ private static function stubNotFound(): PromiseInterface /** * @throws RequestException + * * @dataProvider paramErrosDataProvider */ final public function testGetCobParamsError(string $key): void diff --git a/tests/Integration/PIX/COB/COBPayloadTest.php b/tests/Integration/PIX/COB/COBPayloadTest.php index 33eada1..4118db0 100644 --- a/tests/Integration/PIX/COB/COBPayloadTest.php +++ b/tests/Integration/PIX/COB/COBPayloadTest.php @@ -94,12 +94,10 @@ final public function testPayloadCobNotFound(): void } } - /** - * @return PromiseInterface - */ private static function stubNotFound(): PromiseInterface { - return Http::response([ + return Http::response( + [ 'message' => 'Não foi possível localizar a cobrança associada ao parâmetro informado.', 'errorCode' => 'VL002', ], diff --git a/tests/Integration/PIX/COB/COBUnlinkTest.php b/tests/Integration/PIX/COB/COBUnlinkTest.php index 7a51494..3c30f66 100644 --- a/tests/Integration/PIX/COB/COBUnlinkTest.php +++ b/tests/Integration/PIX/COB/COBUnlinkTest.php @@ -12,7 +12,6 @@ class COBUnlinkTest extends TestCase { - /** * @throws RequestException */ @@ -32,9 +31,6 @@ final public function testUnlinkBrcodeFromCobSuccess(): void $this->assertEquals(15.01, $result['amount']['original']); } - /** - * @return array - */ private static function stubSuccess(): array { return @@ -90,9 +86,6 @@ final public function testUnlinkBrcodeFromCobNotFoundError(): void } } - /** - * @return PromiseInterface - */ private static function stubNotFoundError(): PromiseInterface { return Http::response( diff --git a/tests/Integration/PIX/COB/COBUpdateTest.php b/tests/Integration/PIX/COB/COBUpdateTest.php index 02b0955..949bbea 100644 --- a/tests/Integration/PIX/COB/COBUpdateTest.php +++ b/tests/Integration/PIX/COB/COBUpdateTest.php @@ -18,7 +18,6 @@ class COBUpdateTest extends TestCase { - /** * @throws RequestException */ @@ -109,6 +108,7 @@ private function fakeCOBBody(): COB $cob->calendar = new Calendar([ 'expiration' => 84000, ]); + return $cob; } @@ -142,7 +142,8 @@ final public function testCreateCobWithCobLocation(): void private static function stubCOBError(): PromiseInterface { - return Http::response([ + return Http::response( + [ 'message' => 'Can\'t create a new Pix Collection when there is another Pix Collection active with the same location.', 'errorCode' => 'PBE318', ], @@ -169,9 +170,6 @@ final public function testUpdateCobDebtorRules(): void } } - /** - * @return array - */ final public function cobObjectUpdate(): array { $transactionId = 123456; @@ -184,6 +182,7 @@ final public function cobObjectUpdate(): array $pixCOB = new CelcoinPIXCOB(); $cob = self::fakeCOBBody(); + return [$transactionId, $pixCOB, $cob]; } diff --git a/tests/Integration/PIX/COBV/COBVCreateTest.php b/tests/Integration/PIX/COBV/COBVCreateTest.php index 0257ab4..d086002 100644 --- a/tests/Integration/PIX/COBV/COBVCreateTest.php +++ b/tests/Integration/PIX/COBV/COBVCreateTest.php @@ -38,59 +38,59 @@ final public function testCreateCobv(): void private static function stubSuccess(): PromiseInterface { return Http::response([ - "transactionIdentification" => "kk6g232xel65a0daee4dd13kk9189382", - "transactionId" => 9189382, - "clientRequestId" => "9b26edb7cf254db09f5449c94bf13abc", - "status" => "ACTIVE", - "lastUpdate" => "2022-03-21T14:27:58.2106288+00:00", - "payerQuestion" => null, - "additionalInformation" => null, - "debtor" => [ - "name" => "Fulano de Tal", - "cpf" => null, - "cnpj" => "61360961000100", + 'transactionIdentification' => 'kk6g232xel65a0daee4dd13kk9189382', + 'transactionId' => 9189382, + 'clientRequestId' => '9b26edb7cf254db09f5449c94bf13abc', + 'status' => 'ACTIVE', + 'lastUpdate' => '2022-03-21T14:27:58.2106288+00:00', + 'payerQuestion' => null, + 'additionalInformation' => null, + 'debtor' => [ + 'name' => 'Fulano de Tal', + 'cpf' => null, + 'cnpj' => '61360961000100', ], - "amount" => [ - "original" => 15.63, - "discount" => [ - "discountDateFixed" => [ + 'amount' => [ + 'original' => 15.63, + 'discount' => [ + 'discountDateFixed' => [ [ - "date" => "2022-03-21T00:00:00", - "amountPerc" => "1.00", + 'date' => '2022-03-21T00:00:00', + 'amountPerc' => '1.00', ], ], - "modality" => "FIXED_VALUE_UNTIL_THE_DATES_INFORMED", + 'modality' => 'FIXED_VALUE_UNTIL_THE_DATES_INFORMED', ], - "abatement" => null, - "fine" => null, - "interest" => null, + 'abatement' => null, + 'fine' => null, + 'interest' => null, ], - "location" => [ - "merchant" => [ - "postalCode" => "01201005", - "city" => "Barueri", - "merchantCategoryCode" => "0000", - "name" => "Celcoin Pagamentos", + 'location' => [ + 'merchant' => [ + 'postalCode' => '01201005', + 'city' => 'Barueri', + 'merchantCategoryCode' => '0000', + 'name' => 'Celcoin Pagamentos', ], - "url" => "api-h.developer.btgpactual.com/v1/p/v2/cobv/8767107ce1db49fdb1058224e00c4ab1", - "emv" => "00020101021226980014br.gov.bcb.pix2576api-h.developer.btgpactual.com/v1/p/v2/cobv/8767107ce1db49fdb1058224e00c4ab15204000053039865802BR5918Celcoin Pagamentos6007Barueri61080120100562070503***630411F9", - "type" => "COBV", - "locationId" => "55845", - "id" => null, + 'url' => 'api-h.developer.btgpactual.com/v1/p/v2/cobv/8767107ce1db49fdb1058224e00c4ab1', + 'emv' => '00020101021226980014br.gov.bcb.pix2576api-h.developer.btgpactual.com/v1/p/v2/cobv/8767107ce1db49fdb1058224e00c4ab15204000053039865802BR5918Celcoin Pagamentos6007Barueri61080120100562070503***630411F9', + 'type' => 'COBV', + 'locationId' => '55845', + 'id' => null, ], - "key" => "testepix@celcoin.com.br", - "receiver" => [ - "name" => "João da Silva", - "fantasyName" => "Nome de Comercial", - "cpf" => null, - "cnpj" => "60904237000129", + 'key' => 'testepix@celcoin.com.br', + 'receiver' => [ + 'name' => 'João da Silva', + 'fantasyName' => 'Nome de Comercial', + 'cpf' => null, + 'cnpj' => '60904237000129', ], - "calendar" => [ - "expirationAfterPayment" => "10", - "createdAt" => "0001-01-01T00:00:00", - "dueDate" => "2022-03-22T00:00:00", + 'calendar' => [ + 'expirationAfterPayment' => '10', + 'createdAt' => '0001-01-01T00:00:00', + 'dueDate' => '2022-03-22T00:00:00', ], - "createAt" => "2022-03-21T14:27:58.2106288+00:00", + 'createAt' => '2022-03-21T14:27:58.2106288+00:00', ], Response::HTTP_OK); } @@ -105,7 +105,7 @@ private function fakeCOBVBody(): COBV ]); $cobv->debtor = new Debtor([ 'name' => 'Fulano de Tal', - "cnpj" => "61360961000100", + 'cnpj' => '61360961000100', 'city' => 'Barueri', 'publicArea' => 'Avenida Brasil', 'state' => 'SP', @@ -119,7 +119,7 @@ private function fakeCOBVBody(): COBV 'city' => 'Barueri', 'publicArea' => 'Avenida Brasil', 'state' => 'SP', - 'fantasyName' => "Nome de Comercial", + 'fantasyName' => 'Nome de Comercial', ]); return $cobv; @@ -147,8 +147,8 @@ public function testDueDateLessCurrentDateError() private static function stubDueDateLessCurrentDate(): PromiseInterface { return Http::response([ - "message" => "The Calendar.DueDate field cannot be less than the current date.", - "errorCode" => "PCE003", + 'message' => 'The Calendar.DueDate field cannot be less than the current date.', + 'errorCode' => 'PCE003', ], Response::HTTP_BAD_REQUEST); } @@ -181,8 +181,8 @@ public function testDiscountDateFixedLessCurrentDateError() private static function stubDiscountDateFixedLessCurrentDate(): PromiseInterface { return Http::response([ - "message" => "The Discount.DiscountDateFixed.AmountPerc field cannot be less than the current date.", - "errorCode" => "PCE003", + 'message' => 'The Discount.DiscountDateFixed.AmountPerc field cannot be less than the current date.', + 'errorCode' => 'PCE003', ], Response::HTTP_BAD_REQUEST); } @@ -204,8 +204,8 @@ public function testPixCollectionForSameLocationError() private static function stubPixCollectionForSameLocation(): PromiseInterface { return Http::response([ - "message" => "Can't create a new PixCollectionDueDate when there is another Pix Collection active with the same location.", - "errorCode" => "PBE318", + 'message' => "Can't create a new PixCollectionDueDate when there is another Pix Collection active with the same location.", + 'errorCode' => 'PBE318', ], Response::HTTP_BAD_REQUEST); } } diff --git a/tests/Integration/PIX/COBV/COBVDeleteTest.php b/tests/Integration/PIX/COBV/COBVDeleteTest.php index b2a01ed..c594bde 100644 --- a/tests/Integration/PIX/COBV/COBVDeleteTest.php +++ b/tests/Integration/PIX/COBV/COBVDeleteTest.php @@ -12,7 +12,6 @@ class COBVDeleteTest extends TestCase { - /** * @throws RequestException */ diff --git a/tests/Integration/PIX/COBV/COBVGetTest.php b/tests/Integration/PIX/COBV/COBVGetTest.php index a01578e..6e1dfe2 100644 --- a/tests/Integration/PIX/COBV/COBVGetTest.php +++ b/tests/Integration/PIX/COBV/COBVGetTest.php @@ -15,6 +15,7 @@ class COBVGetTest extends TestCase { /** * @throws RequestException + * * @dataProvider getCobvSuccessProvider */ final public function testGetCobvSuccess(array $search): void @@ -135,9 +136,6 @@ final public function testGetCobvNotFoundError(): void } } - /** - * @return PromiseInterface - */ private static function stubNotFoundError(): PromiseInterface { return Http::response( @@ -151,6 +149,7 @@ private static function stubNotFoundError(): PromiseInterface /** * @throws RequestException + * * @dataProvider getCobvValidationKeysProvider */ final public function getCobvValidationError(string $key): void @@ -187,7 +186,6 @@ public static function getCobvValidationKeysProvider(): array ]; } - public static function getCobvSuccessProvider(): array { return [ @@ -208,4 +206,4 @@ public static function getCobvSuccessProvider(): array ], ]; } -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/COBV/COBVPayloadTest.php b/tests/Integration/PIX/COBV/COBVPayloadTest.php index 5577ba3..9d97c2e 100644 --- a/tests/Integration/PIX/COBV/COBVPayloadTest.php +++ b/tests/Integration/PIX/COBV/COBVPayloadTest.php @@ -121,12 +121,10 @@ final public function testPayloadCobvNotFound(): void } } - /** - * @return PromiseInterface - */ private static function stubNotFound(): PromiseInterface { - return Http::response([ + return Http::response( + [ 'message' => 'The BRCode is expired and can\'t be paid.', 'errorCode' => '400', ], diff --git a/tests/Integration/PIX/COBV/COBVUnlinkTest.php b/tests/Integration/PIX/COBV/COBVUnlinkTest.php index 0c2568a..6d854ca 100644 --- a/tests/Integration/PIX/COBV/COBVUnlinkTest.php +++ b/tests/Integration/PIX/COBV/COBVUnlinkTest.php @@ -12,7 +12,6 @@ class COBVUnlinkTest extends TestCase { - /** * @throws RequestException */ @@ -37,7 +36,7 @@ final public function testUnlinkCobvNotFoundError(): void } } - static private function stubNotFoundError(): PromiseInterface + private static function stubNotFoundError(): PromiseInterface { return Http::response( [ @@ -67,7 +66,7 @@ final public function testUnlinkCobvSuccess(): void $this->assertEquals(15.63, $result['body']['amount']['original']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ diff --git a/tests/Integration/PIX/COBV/COBVUpdateTest.php b/tests/Integration/PIX/COBV/COBVUpdateTest.php index c78abda..1b6e2f1 100644 --- a/tests/Integration/PIX/COBV/COBVUpdateTest.php +++ b/tests/Integration/PIX/COBV/COBVUpdateTest.php @@ -17,7 +17,6 @@ class COBVUpdateTest extends TestCase { - /** * @throws RequestException */ @@ -106,6 +105,7 @@ private function fakeCOBVBody(): COBV $cobv->calendar = new Calendar([ 'expiration' => 84000, ]); + return $cobv; } @@ -137,17 +137,17 @@ public static function updateCobvErrorDataProvider(): array { return [ 'wrong calendar due date' => [ - fn() => self::getCalendarDueDateErrorResponse(), + fn () => self::getCalendarDueDateErrorResponse(), 'PCE003', 'errorCode', ], 'wrong discount amount perc' => [ - fn() => self::getDiscountAmountPercErrorResponse(), + fn () => self::getDiscountAmountPercErrorResponse(), 'PCE003', 'errorCode', ], 'wrong pix collection error' => [ - fn() => self::getCanNotCreateNewPixCollectionDueDateErrorResponse(), + fn () => self::getCanNotCreateNewPixCollectionDueDateErrorResponse(), 'PBE318', 'errorCode', ], @@ -183,5 +183,4 @@ private static function getCanNotCreateNewPixCollectionDueDateErrorResponse(): P return Http::response($data, Response::HTTP_BAD_REQUEST); } - } diff --git a/tests/Integration/PIX/DICT/PixDICTSearchTest.php b/tests/Integration/PIX/DICT/PixDICTSearchTest.php index ec4f196..070ea1d 100644 --- a/tests/Integration/PIX/DICT/PixDICTSearchTest.php +++ b/tests/Integration/PIX/DICT/PixDICTSearchTest.php @@ -16,7 +16,6 @@ class PixDICTSearchTest extends TestCase { - public function testSearchDICT() { Http::fake( @@ -35,112 +34,112 @@ public function testSearchDICT() private static function stubSuccess(): PromiseInterface { return Http::response([ - "key" => "testepix@celcoin.com.br", - "keyType" => "EMAIL", - "account" => [ - "openingDate" => "2020-08-13T13:49:03Z", - "participant" => "30306294", - "branch" => 20, - "accountNumber" => "42161", - "accountType" => "CACC", + 'key' => 'testepix@celcoin.com.br', + 'keyType' => 'EMAIL', + 'account' => [ + 'openingDate' => '2020-08-13T13:49:03Z', + 'participant' => '30306294', + 'branch' => 20, + 'accountNumber' => '42161', + 'accountType' => 'CACC', ], - "owner" => [ - "taxIdNumber" => "12312312300", - "type" => "NATURAL_PERSON", - "name" => "Teste Celcoin", - "tradeName" => "", + 'owner' => [ + 'taxIdNumber' => '12312312300', + 'type' => 'NATURAL_PERSON', + 'name' => 'Teste Celcoin', + 'tradeName' => '', ], - "endtoendid" => "E1393589320220720205100627741380", - "creationDate" => "2021-02-24T20:58:27.376Z", - "keyOwnershipDate" => "2021-02-24T20:58:27.375Z", - "responseTime" => "2022-07-20T20:51:59.427Z", - "openClaimCreationDate" => null, - "statistics" => [ - "lastUpdated" => "2022-07-20T09:01:10.426Z", - "counters" => [ + 'endtoendid' => 'E1393589320220720205100627741380', + 'creationDate' => '2021-02-24T20:58:27.376Z', + 'keyOwnershipDate' => '2021-02-24T20:58:27.375Z', + 'responseTime' => '2022-07-20T20:51:59.427Z', + 'openClaimCreationDate' => null, + 'statistics' => [ + 'lastUpdated' => '2022-07-20T09:01:10.426Z', + 'counters' => [ [ - "type" => "SETTLEMENTS", - "by" => "KEY", - "d3" => "0", - "d30" => "0", - "m6" => "0", + 'type' => 'SETTLEMENTS', + 'by' => 'KEY', + 'd3' => '0', + 'd30' => '0', + 'm6' => '0', ], [ - "type" => "SETTLEMENTS", - "by" => "OWNER", - "d3" => "0", - "d30" => "2", - "m6" => "78", + 'type' => 'SETTLEMENTS', + 'by' => 'OWNER', + 'd3' => '0', + 'd30' => '2', + 'm6' => '78', ], [ - "type" => "SETTLEMENTS", - "by" => "ACCOUNT", - "d3" => "0", - "d30" => "2", - "m6" => "78", + 'type' => 'SETTLEMENTS', + 'by' => 'ACCOUNT', + 'd3' => '0', + 'd30' => '2', + 'm6' => '78', ], [ - "type" => "REPORTED_FRAUDS", - "by" => "KEY", - "d3" => "0", - "d30" => "0", - "m6" => "0", + 'type' => 'REPORTED_FRAUDS', + 'by' => 'KEY', + 'd3' => '0', + 'd30' => '0', + 'm6' => '0', ], [ - "type" => "REPORTED_FRAUDS", - "by" => "OWNER", - "d3" => "0", - "d30" => "0", - "m6" => "0", + 'type' => 'REPORTED_FRAUDS', + 'by' => 'OWNER', + 'd3' => '0', + 'd30' => '0', + 'm6' => '0', ], [ - "type" => "REPORTED_FRAUDS", - "by" => "ACCOUNT", - "d3" => "0", - "d30" => "0", - "m6" => "0", + 'type' => 'REPORTED_FRAUDS', + 'by' => 'ACCOUNT', + 'd3' => '0', + 'd30' => '0', + 'm6' => '0', ], [ - "type" => "CONFIRMED_FRAUDS", - "by" => "KEY", - "d3" => "0", - "d30" => "0", - "m6" => "0", + 'type' => 'CONFIRMED_FRAUDS', + 'by' => 'KEY', + 'd3' => '0', + 'd30' => '0', + 'm6' => '0', ], [ - "type" => "CONFIRMED_FRAUDS", - "by" => "OWNER", - "d3" => "0", - "d30" => "0", - "m6" => "0", + 'type' => 'CONFIRMED_FRAUDS', + 'by' => 'OWNER', + 'd3' => '0', + 'd30' => '0', + 'm6' => '0', ], [ - "type" => "CONFIRMED_FRAUDS", - "by" => "ACCOUNT", - "d3" => "0", - "d30" => "0", - "m6" => "0", + 'type' => 'CONFIRMED_FRAUDS', + 'by' => 'ACCOUNT', + 'd3' => '0', + 'd30' => '0', + 'm6' => '0', ], [ - "type" => "REJECTED", - "by" => "KEY", - "d3" => "0", - "d30" => "0", - "m6" => "0", + 'type' => 'REJECTED', + 'by' => 'KEY', + 'd3' => '0', + 'd30' => '0', + 'm6' => '0', ], [ - "type" => "REJECTED", - "by" => "OWNER", - "d3" => "0", - "d30" => "0", - "m6" => "0", + 'type' => 'REJECTED', + 'by' => 'OWNER', + 'd3' => '0', + 'd30' => '0', + 'm6' => '0', ], [ - "type" => "REJECTED", - "by" => "ACCOUNT", - "d3" => "0", - "d30" => "0", - "m6" => "0", + 'type' => 'REJECTED', + 'by' => 'ACCOUNT', + 'd3' => '0', + 'd30' => '0', + 'm6' => '0', ], ], ], @@ -174,8 +173,8 @@ public function testSearchDictNotFoundData() private static function stubNotFoundData(): PromiseInterface { return Http::response([ - "code" => "909", - "description" => "Não foram encontrados dados para a chave informada", + 'code' => '909', + 'description' => 'Não foram encontrados dados para a chave informada', ], Response::HTTP_BAD_REQUEST); } @@ -197,8 +196,8 @@ public function testSearchDictTechnicalProblem() private static function stubTechnicalProblem(): PromiseInterface { return Http::response([ - "code" => "513", - "description" => "Ocorreu um problema ao tentar comunicar o parceiro.", + 'code' => '513', + 'description' => 'Ocorreu um problema ao tentar comunicar o parceiro.', ], Response::HTTP_BAD_REQUEST); } @@ -234,4 +233,4 @@ public function testVerifyDictValidationError() $pixDict = new CelcoinPIXDICT(); $pixDict->verifyDICT(new DICT([])); } -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/DICT/PixDICTVerifyTest.php b/tests/Integration/PIX/DICT/PixDICTVerifyTest.php index 1c13410..bfffa7b 100644 --- a/tests/Integration/PIX/DICT/PixDICTVerifyTest.php +++ b/tests/Integration/PIX/DICT/PixDICTVerifyTest.php @@ -16,7 +16,6 @@ class PixDICTVerifyTest extends TestCase { - /** * @throws RequestException */ @@ -39,19 +38,19 @@ private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => "SUCCESS", - "keys" => [ + 'status' => 'SUCCESS', + 'keys' => [ [ - "key" => "+551199995555", - "hasEntry" => false, + 'key' => '+551199995555', + 'hasEntry' => false, ], [ - "key" => "key@email.com", - "hasEntry" => false, + 'key' => 'key@email.com', + 'hasEntry' => false, ], [ - "key" => "11000893000109", - "hasEntry" => true, + 'key' => '11000893000109', + 'hasEntry' => true, ], ], ], @@ -62,15 +61,15 @@ private static function stubSuccess(): PromiseInterface private function fakeDictBody(): DICT { return new DICT([ - "keys" => [ + 'keys' => [ [ - "key" => "+551199995555", + 'key' => '+551199995555', ], [ - "key" => "key@email.com", + 'key' => 'key@email.com', ], [ - "key" => "11000893000109", + 'key' => '11000893000109', ], ], ]); @@ -94,8 +93,8 @@ public function testVerifyDictNotFound() private static function StubNotFound(): PromiseInterface { return Http::response([ - "statusCode" => 404, - "message" => "Resource not found", + 'statusCode' => 404, + 'message' => 'Resource not found', ], Response::HTTP_NOT_FOUND); } @@ -131,4 +130,4 @@ public function testVerifyDictValidationError() $pixDict = new CelcoinPIXDICT(); $pixDict->verifyDICT(new DICT([])); } -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/DICT/PixKeyCancelConfirmTest.php b/tests/Integration/PIX/DICT/PixKeyCancelConfirmTest.php index 828e196..696a6c2 100644 --- a/tests/Integration/PIX/DICT/PixKeyCancelConfirmTest.php +++ b/tests/Integration/PIX/DICT/PixKeyCancelConfirmTest.php @@ -6,20 +6,17 @@ use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Http\Client\RequestException; use Illuminate\Support\Facades\Http; -use Illuminate\Validation\ValidationException; use Symfony\Component\HttpFoundation\Response; use WeDevBr\Celcoin\Clients\CelcoinPIXDICT; use WeDevBr\Celcoin\Tests\GlobalStubs; use WeDevBr\Celcoin\Tests\TestCase; -use WeDevBr\Celcoin\Types\PIX\Claim; use WeDevBr\Celcoin\Types\PIX\ClaimAnswer; -use WeDevBr\Celcoin\Types\PIX\DICT; use function PHPUnit\Framework\assertEquals; class PixKeyCancelConfirmTest extends TestCase { - use WithFaker; + use WithFaker; public function testClaimPixKey() { @@ -39,34 +36,34 @@ public function testClaimPixKey() private static function stubSuccess(): PromiseInterface { return Http::response( - [ - "version" => "1.0.0", - "status" => "CANCELED", - "body" => [ - "id" => "8bbc0ba5-2aee-44a0-a3c9-b897802a9f66", - "claimType" => "OWNERSHIP", - "key" => "fulanodetal@gmail.com", - "keyType" => "EMAIL", - "claimerAccount" => [ - "participant" => "30306294", - "branch" => "0001", - "account" => "30053913742139", - "accountType" => "TRAN" - ], - "claimer" => [ - "personType" => "NATURAL_PERSON", - "taxId" => "34335125070", - "name" => "João da Silva Juniors" - ], - "donorParticipant" => "30306294", - "createTimestamp" => "2023-05-01T13:05:09", - "completionPeriodEnd" => "2023-05-01T13:05:09", - "resolutionPeriodEnd" => "2023-08-10T17", - "lastModified" => "2023-08-11T17:11:33", - "cancelledBy" => "CLAIMER", - "cancelReason" => "FRAUD" - ] - ], + [ + 'version' => '1.0.0', + 'status' => 'CANCELED', + 'body' => [ + 'id' => '8bbc0ba5-2aee-44a0-a3c9-b897802a9f66', + 'claimType' => 'OWNERSHIP', + 'key' => 'fulanodetal@gmail.com', + 'keyType' => 'EMAIL', + 'claimerAccount' => [ + 'participant' => '30306294', + 'branch' => '0001', + 'account' => '30053913742139', + 'accountType' => 'TRAN', + ], + 'claimer' => [ + 'personType' => 'NATURAL_PERSON', + 'taxId' => '34335125070', + 'name' => 'João da Silva Juniors', + ], + 'donorParticipant' => '30306294', + 'createTimestamp' => '2023-05-01T13:05:09', + 'completionPeriodEnd' => '2023-05-01T13:05:09', + 'resolutionPeriodEnd' => '2023-08-10T17', + 'lastModified' => '2023-08-11T17:11:33', + 'cancelledBy' => 'CLAIMER', + 'cancelReason' => 'FRAUD', + ], + ], Response::HTTP_OK, ); } @@ -75,7 +72,7 @@ private function fakeClaimCancelBody(): ClaimAnswer { return new ClaimAnswer([ 'id' => $this->faker()->uuid, - 'reason' => 'USER_REQUESTED', + 'reason' => 'USER_REQUESTED', ]); } @@ -92,19 +89,19 @@ public function testClaimCancelBadRequest() $pixDict = new CelcoinPIXDICT(); $result = $pixDict->claimCancel($this->fakeClaimCancelBody()); - assertEquals('ERROR', $result['status']); - assertEquals('CBE307', $result['error']['errorCode']); + assertEquals('ERROR', $result['status']); + assertEquals('CBE307', $result['error']['errorCode']); } private static function stubBadRequest(): PromiseInterface { return Http::response([ - "version" => "1.0.0", - "status" => "ERROR", - "error" => [ - "errorCode" => "CBE307", - "message" => "Não foi possível cancelar essa Claim, pois a mesma não está mais pendente." - ] + 'version' => '1.0.0', + 'status' => 'ERROR', + 'error' => [ + 'errorCode' => 'CBE307', + 'message' => 'Não foi possível cancelar essa Claim, pois a mesma não está mais pendente.', + ], ], Response::HTTP_BAD_REQUEST); } -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/DICT/PixKeyClaimConfirmTest.php b/tests/Integration/PIX/DICT/PixKeyClaimConfirmTest.php index e568b98..3eace4c 100644 --- a/tests/Integration/PIX/DICT/PixKeyClaimConfirmTest.php +++ b/tests/Integration/PIX/DICT/PixKeyClaimConfirmTest.php @@ -6,20 +6,17 @@ use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Http\Client\RequestException; use Illuminate\Support\Facades\Http; -use Illuminate\Validation\ValidationException; use Symfony\Component\HttpFoundation\Response; use WeDevBr\Celcoin\Clients\CelcoinPIXDICT; use WeDevBr\Celcoin\Tests\GlobalStubs; use WeDevBr\Celcoin\Tests\TestCase; -use WeDevBr\Celcoin\Types\PIX\Claim; use WeDevBr\Celcoin\Types\PIX\ClaimAnswer; -use WeDevBr\Celcoin\Types\PIX\DICT; use function PHPUnit\Framework\assertEquals; class PixKeyClaimConfirmTest extends TestCase { - use WithFaker; + use WithFaker; /** * @throws RequestException @@ -42,32 +39,32 @@ public function testClaimPixKey() private static function stubSuccess(): PromiseInterface { return Http::response( - [ - "version" => "1.0.0", - "status" => "CONFIRMED", - "body" => [ - "id" => "8bbc0ba5-2aee-44a0-a3c9-b897802a9f66", - "claimType" => "OWNERSHIP", - "key" => "fulanodetal@gmail.com", - "keyType" => "EMAIL", - "claimerAccount" => [ - "participant" => "30306294", - "branch" => "0001", - "account" => "30053913742139", - "accountType" => "TRAN" - ], - "claimer" => [ - "personType" => "NATURAL_PERSON", - "taxId" => "34335125070", - "name" => "João da Silva Junior" - ], - "donorParticipant" => "30306294", - "createTimestamp" => "2023-05-01T13:05:09", - "completionPeriodEnd" => "2023-05-01T13:05:09", - "resolutionPeriodEnd" => "2023-08-10T17", - "lastModified" => "2023-08-11T17:11:33" - ] - ], + [ + 'version' => '1.0.0', + 'status' => 'CONFIRMED', + 'body' => [ + 'id' => '8bbc0ba5-2aee-44a0-a3c9-b897802a9f66', + 'claimType' => 'OWNERSHIP', + 'key' => 'fulanodetal@gmail.com', + 'keyType' => 'EMAIL', + 'claimerAccount' => [ + 'participant' => '30306294', + 'branch' => '0001', + 'account' => '30053913742139', + 'accountType' => 'TRAN', + ], + 'claimer' => [ + 'personType' => 'NATURAL_PERSON', + 'taxId' => '34335125070', + 'name' => 'João da Silva Junior', + ], + 'donorParticipant' => '30306294', + 'createTimestamp' => '2023-05-01T13:05:09', + 'completionPeriodEnd' => '2023-05-01T13:05:09', + 'resolutionPeriodEnd' => '2023-08-10T17', + 'lastModified' => '2023-08-11T17:11:33', + ], + ], Response::HTTP_OK, ); } @@ -76,7 +73,7 @@ private function fakeClaimConfirmBody(): ClaimAnswer { return new ClaimAnswer([ 'id' => $this->faker()->uuid, - 'reason' => 'USER_REQUESTED', + 'reason' => 'USER_REQUESTED', ]); } @@ -93,19 +90,19 @@ public function testClaimBadRequest() $pixDict = new CelcoinPIXDICT(); $result = $pixDict->claimConfirm($this->fakeClaimConfirmBody()); - assertEquals('ERROR', $result['status']); - assertEquals('CBE307', $result['error']['errorCode']); + assertEquals('ERROR', $result['status']); + assertEquals('CBE307', $result['error']['errorCode']); } private static function stubBadRequest(): PromiseInterface { return Http::response([ - "version" => "1.0.0", - "status" => "ERROR", - "error" => [ - "errorCode" => "CBE307", - "message" => "Não foi possível cancelar essa Claim, pois a mesma não está mais pendente." - ] + 'version' => '1.0.0', + 'status' => 'ERROR', + 'error' => [ + 'errorCode' => 'CBE307', + 'message' => 'Não foi possível cancelar essa Claim, pois a mesma não está mais pendente.', + ], ], Response::HTTP_BAD_REQUEST); } -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php b/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php index e108547..d77edbe 100644 --- a/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php +++ b/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php @@ -6,27 +6,24 @@ use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Http\Client\RequestException; use Illuminate\Support\Facades\Http; -use Illuminate\Validation\ValidationException; use Symfony\Component\HttpFoundation\Response; use WeDevBr\Celcoin\Clients\CelcoinPIXDICT; use WeDevBr\Celcoin\Tests\GlobalStubs; use WeDevBr\Celcoin\Tests\TestCase; -use WeDevBr\Celcoin\Types\PIX\Claim; -use WeDevBr\Celcoin\Types\PIX\DICT; use function PHPUnit\Framework\assertEquals; class PixKeyClaimConsultTest extends TestCase { - use WithFaker; + use WithFaker; - private string $uuid; + private string $uuid; - public function setUp(): void - { - parent::setUp(); - $this->uuid = '8bbc0ba5-2aee-44a0-a3c9-b897802a9f66'; - } + public function setUp(): void + { + parent::setUp(); + $this->uuid = '8bbc0ba5-2aee-44a0-a3c9-b897802a9f66'; + } public function testClaimConsult() { @@ -41,47 +38,47 @@ public function testClaimConsult() $result = $pixDict->claimConsult($this->uuid); assertEquals('SUCCESS', $result['status']); - assertEquals($this->uuid, $result['body']['id']); + assertEquals($this->uuid, $result['body']['id']); } private static function stubSuccess(): PromiseInterface { return Http::response( - [ - "version" => "1.0.0", - "status" => "SUCCESS", - "body" => [ - "id" => "8bbc0ba5-2aee-44a0-a3c9-b897802a9f66", - "claimType" => "OWNERSHIP", - "key" => "fulanodetal@gmail.com", - "keyType" => "EMAIL", - "claimerAccount" => [ - "participant" => "30306294", - "branch" => "0001", - "account" => "30053913742139", - "accountType" => "TRAN" - ], - "claimer" => [ - "personType" => "NATURAL_PERSON", - "taxId" => "34335125070", - "name" => "João da Silva Junior" - ], - "donorParticipant" => "30306294", - "createTimestamp" => "2023-05-01T13:05:09", - "completionPeriodEnd" => "2023-05-01T13:05:09", - "resolutionPeriodEnd" => "2023-05-01T13:05:09", - "lastModified" => "2023-05-01T13:05:09", - "confirmReason" => "USER_REQUESTED", - "cancelReason" => "FRAUD", - "cancelledBy" => "DONOR", - "donorAccount" => [ - "account" => "30053913742139", - "branch" => "0001", - "taxId" => "34335125070", - "name" => "João da Silva" - ] - ] - ], + [ + 'version' => '1.0.0', + 'status' => 'SUCCESS', + 'body' => [ + 'id' => '8bbc0ba5-2aee-44a0-a3c9-b897802a9f66', + 'claimType' => 'OWNERSHIP', + 'key' => 'fulanodetal@gmail.com', + 'keyType' => 'EMAIL', + 'claimerAccount' => [ + 'participant' => '30306294', + 'branch' => '0001', + 'account' => '30053913742139', + 'accountType' => 'TRAN', + ], + 'claimer' => [ + 'personType' => 'NATURAL_PERSON', + 'taxId' => '34335125070', + 'name' => 'João da Silva Junior', + ], + 'donorParticipant' => '30306294', + 'createTimestamp' => '2023-05-01T13:05:09', + 'completionPeriodEnd' => '2023-05-01T13:05:09', + 'resolutionPeriodEnd' => '2023-05-01T13:05:09', + 'lastModified' => '2023-05-01T13:05:09', + 'confirmReason' => 'USER_REQUESTED', + 'cancelReason' => 'FRAUD', + 'cancelledBy' => 'DONOR', + 'donorAccount' => [ + 'account' => '30053913742139', + 'branch' => '0001', + 'taxId' => '34335125070', + 'name' => 'João da Silva', + ], + ], + ], Response::HTTP_OK, ); } @@ -98,20 +95,20 @@ public function testClaimBadRequest() $this->expectException(RequestException::class); $pixDict = new CelcoinPIXDICT(); - $result = $pixDict->claimConsult($this->uuid); - assertEquals('ERROR', $result['status']); - assertEquals('CBE320', $result['error']['errorCode']); + $result = $pixDict->claimConsult($this->uuid); + assertEquals('ERROR', $result['status']); + assertEquals('CBE320', $result['error']['errorCode']); } private static function stubBadRequest(): PromiseInterface { return Http::response([ - "version" => "1.0.0", - "status" => "ERROR", - "error" => [ - "errorCode" => "CBE320", - "message" => "Claim não encontrada." - ] + 'version' => '1.0.0', + 'status' => 'ERROR', + 'error' => [ + 'errorCode' => 'CBE320', + 'message' => 'Claim não encontrada.', + ], ], Response::HTTP_BAD_REQUEST); } -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/DICT/PixKeyClaimTest.php b/tests/Integration/PIX/DICT/PixKeyClaimTest.php index d636255..50a3b2c 100644 --- a/tests/Integration/PIX/DICT/PixKeyClaimTest.php +++ b/tests/Integration/PIX/DICT/PixKeyClaimTest.php @@ -5,19 +5,16 @@ use GuzzleHttp\Promise\PromiseInterface; use Illuminate\Http\Client\RequestException; use Illuminate\Support\Facades\Http; -use Illuminate\Validation\ValidationException; use Symfony\Component\HttpFoundation\Response; use WeDevBr\Celcoin\Clients\CelcoinPIXDICT; use WeDevBr\Celcoin\Tests\GlobalStubs; use WeDevBr\Celcoin\Tests\TestCase; use WeDevBr\Celcoin\Types\PIX\Claim; -use WeDevBr\Celcoin\Types\PIX\DICT; use function PHPUnit\Framework\assertEquals; class PixKeyClaimTest extends TestCase { - /** * @throws RequestException */ @@ -39,41 +36,41 @@ public function testClaimPixKey() private static function stubSuccess(): PromiseInterface { return Http::response( - [ - "version" => "1.0.0", - "status" => "OPEN", - "body" => [ - "id" => "8bbc0ba5-2aee-44a0-a3c9-b897802a9f66", - "claimType" => "OWNERSHIP", - "key" => "fulanodetal@gmail.com", - "keyType" => "EMAIL", - "claimerAccount" => [ - "participant" => "30306294", - "branch" => "0001", - "account" => "30053913742139", - "accountType" => "TRAN" - ], - "claimer" => [ - "personType" => "NATURAL_PERSON", - "taxId" => "34335125070", - "name" => "João da Silva Junior" - ], - "donorParticipant" => "30306294", - "createTimestamp" => "2023-05-01T13:05:09", - "completionPeriodEnd" => "2023-05-01T13:05:09", - "resolutionPeriodEnd" => "2023-05-01T13:05:09", - "lastModified" => "2023-05-01T13:05:09", - "confirmReason" => "USER_REQUESTED", - "cancelReason" => "FRAUD", - "cancelledBy" => "DONOR", - "donorAccount" => [ - "account" => "30053913742139", - "branch" => "0001", - "taxId" => "34335125070", - "name" => "João da Silva" - ] - ] - ], + [ + 'version' => '1.0.0', + 'status' => 'OPEN', + 'body' => [ + 'id' => '8bbc0ba5-2aee-44a0-a3c9-b897802a9f66', + 'claimType' => 'OWNERSHIP', + 'key' => 'fulanodetal@gmail.com', + 'keyType' => 'EMAIL', + 'claimerAccount' => [ + 'participant' => '30306294', + 'branch' => '0001', + 'account' => '30053913742139', + 'accountType' => 'TRAN', + ], + 'claimer' => [ + 'personType' => 'NATURAL_PERSON', + 'taxId' => '34335125070', + 'name' => 'João da Silva Junior', + ], + 'donorParticipant' => '30306294', + 'createTimestamp' => '2023-05-01T13:05:09', + 'completionPeriodEnd' => '2023-05-01T13:05:09', + 'resolutionPeriodEnd' => '2023-05-01T13:05:09', + 'lastModified' => '2023-05-01T13:05:09', + 'confirmReason' => 'USER_REQUESTED', + 'cancelReason' => 'FRAUD', + 'cancelledBy' => 'DONOR', + 'donorAccount' => [ + 'account' => '30053913742139', + 'branch' => '0001', + 'taxId' => '34335125070', + 'name' => 'João da Silva', + ], + ], + ], Response::HTTP_OK, ); } @@ -82,9 +79,9 @@ private function fakeClaimBody(): Claim { return new Claim([ 'key' => 'key@email.com', - 'keyType' => 'EMAIL', - 'account' => '3005913742139', - 'claimType' => 'PORTABILITY' + 'keyType' => 'EMAIL', + 'account' => '3005913742139', + 'claimType' => 'PORTABILITY', ]); } @@ -101,19 +98,19 @@ public function testClaimBadRequest() $pixDict = new CelcoinPIXDICT(); $result = $pixDict->claim($this->fakeClaimBody()); - assertEquals('ERROR', $result['status']); - assertEquals('CBE039', $result['error']['errorCode']); + assertEquals('ERROR', $result['status']); + assertEquals('CBE039', $result['error']['errorCode']); } private static function stubBadRequest(): PromiseInterface { return Http::response([ - "version" => "1.0.0", - "status" => "ERROR", - "error" => [ - "errorCode" => "CBE039", - "message" => "Account invalido.." - ] + 'version' => '1.0.0', + 'status' => 'ERROR', + 'error' => [ + 'errorCode' => 'CBE039', + 'message' => 'Account invalido..', + ], ], Response::HTTP_BAD_REQUEST); } -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/DYNAMIC/PixDynamicCreateTest.php b/tests/Integration/PIX/DYNAMIC/PixDynamicCreateTest.php index ab5f5f2..bed051a 100644 --- a/tests/Integration/PIX/DYNAMIC/PixDynamicCreateTest.php +++ b/tests/Integration/PIX/DYNAMIC/PixDynamicCreateTest.php @@ -18,7 +18,6 @@ class PixDynamicCreateTest extends TestCase { // Todo: não tem erros esse endpoint? 404? 422? /** - * @return void * @throws RequestException */ final public function testCreateDynamicQRCodeInvalidKey(): void @@ -40,10 +39,7 @@ final public function testCreateDynamicQRCodeInvalidKey(): void } } - /** - * @return PromiseInterface - */ - static private function stubInvalidKey(): PromiseInterface + private static function stubInvalidKey(): PromiseInterface { return Http::response( [ @@ -54,10 +50,7 @@ static private function stubInvalidKey(): PromiseInterface ); } - /** - * @return DynamicQRCreate - */ - static public function fakeBody(): DynamicQRCreate + public static function fakeBody(): DynamicQRCreate { $dynamic = new DynamicQRCreate(); $dynamic->clientRequestId = '9b26edb7cf254db09f5449c94bf13abc'; @@ -117,10 +110,7 @@ final public function testCreateDynamicQRCodeWithoutPayerDocument(): void } } - /** - * @return PromiseInterface - */ - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ @@ -178,6 +168,7 @@ static private function stubSuccess(): PromiseInterface /** * @throws RequestException + * * @dataProvider createErrorDataProvider */ final public function testCreateDynamicQRCodeWithoutField(string $unsetValue): void @@ -218,7 +209,6 @@ final public static function createErrorDataProvider(): array } /** - * @return void * @throws RequestException */ final public function testCreateDynamicQRCodeSuccess(): void @@ -236,5 +226,4 @@ final public function testCreateDynamicQRCodeSuccess(): void $this->assertEquals(Response::HTTP_OK, $response['status']); $this->assertEquals('ACTIVE', $response['body']['status']); } - } diff --git a/tests/Integration/PIX/DYNAMIC/PixDynamicDeleteTest.php b/tests/Integration/PIX/DYNAMIC/PixDynamicDeleteTest.php index b31e971..9617410 100644 --- a/tests/Integration/PIX/DYNAMIC/PixDynamicDeleteTest.php +++ b/tests/Integration/PIX/DYNAMIC/PixDynamicDeleteTest.php @@ -12,9 +12,7 @@ class PixDynamicDeleteTest extends TestCase { - /** - * @return void * @throws RequestException */ final public function testDynamicPixDeleteSuccess(): void @@ -44,7 +42,6 @@ private static function stubSuccess(): PromiseInterface } /** - * @return void * @throws RequestException */ final public function testDynamicPixDeleteNotFoundError(): void diff --git a/tests/Integration/PIX/DYNAMIC/PixDynamicImageTest.php b/tests/Integration/PIX/DYNAMIC/PixDynamicImageTest.php index b2b52e8..612ef97 100644 --- a/tests/Integration/PIX/DYNAMIC/PixDynamicImageTest.php +++ b/tests/Integration/PIX/DYNAMIC/PixDynamicImageTest.php @@ -14,7 +14,6 @@ class PixDynamicImageTest extends TestCase { // Todo: não tem erros esse endpoint? 404? 422? /** - * @return void * @throws RequestException */ final public function testGetDynamicImageSuccess(): void @@ -39,18 +38,14 @@ final public function testGetDynamicImageSuccess(): void $this->assertArrayHasKey('base64image', $response); } - /** - * @return PromiseInterface - */ - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => 200, - "base64image" => "iVBORw0KGgoAAAANSUhEUgAAAJMAAACTAQMAAACwK7lWAAAABlBMVEX///8AAABVwtN+AAACA0lEQVRIieWWMY7jMAxFaahQJ19AgK6hTleSL+DYF7CvpE7XEKALOJ0LwZzvJLuzW41YjxAg8QtAiOTnp4l+2xmZF1IXOT4pBr4kzJDaQhm5MtfL41HCQl0CH6EZKrPnTcj2Uy1ecXaLnK25DEykyUjZK4/o2xws/Zfbzwz123z9fL5r2sVwhkzk3Zrc8t26LnZXPTnmNuTK2UYJG1KLGt/uCnYmSxJmgkLtDyoRqvFlFjHdpoxgNOX6zIUkjDzv7BaNPNDzYiTMeGt8vUIbklqzuiRsON3l1eYB7COVKGKpPRJzUpeua3prrZcRfp40ngU12KgeEjZwm061Z7d5PMkY+VvjMzWj8U/dJMxQG1G5ZAe2ht416Gb3TGC2bPQQDi8ShlmcMBm6UChGvzXezbTbdImh0A2KiOHuU7bT6fZkKbzr1828uzRDa1Mqs3Yihm4P530jKA4OOotYZqiMM0xX8dmMhCEYbkGBF/T8r+77GHz30BbBNn3fhSRsTM1glLFqEqOEUcIMkjgxl7f/PXMTMvs4Yfbw3bpyXWQMtoeeI1J78Ce3TvZKhZ+MvtFMH1/rZNgze0blUIP6x3d7GfbbCpXBBTUAHyKGnZwgtzvYg4sRMjhQvHVaRryGCNnO9QgQqftHa32M1M4wodfbhH6v1l527/Nw77cpq41alLDfdb4A8PuP9RyscmkAAAAASUVORK5CYII=", + 'status' => 200, + 'base64image' => 'iVBORw0KGgoAAAANSUhEUgAAAJMAAACTAQMAAACwK7lWAAAABlBMVEX///8AAABVwtN+AAACA0lEQVRIieWWMY7jMAxFaahQJ19AgK6hTleSL+DYF7CvpE7XEKALOJ0LwZzvJLuzW41YjxAg8QtAiOTnp4l+2xmZF1IXOT4pBr4kzJDaQhm5MtfL41HCQl0CH6EZKrPnTcj2Uy1ecXaLnK25DEykyUjZK4/o2xws/Zfbzwz123z9fL5r2sVwhkzk3Zrc8t26LnZXPTnmNuTK2UYJG1KLGt/uCnYmSxJmgkLtDyoRqvFlFjHdpoxgNOX6zIUkjDzv7BaNPNDzYiTMeGt8vUIbklqzuiRsON3l1eYB7COVKGKpPRJzUpeua3prrZcRfp40ngU12KgeEjZwm061Z7d5PMkY+VvjMzWj8U/dJMxQG1G5ZAe2ht416Gb3TGC2bPQQDi8ShlmcMBm6UChGvzXezbTbdImh0A2KiOHuU7bT6fZkKbzr1828uzRDa1Mqs3Yihm4P530jKA4OOotYZqiMM0xX8dmMhCEYbkGBF/T8r+77GHz30BbBNn3fhSRsTM1glLFqEqOEUcIMkjgxl7f/PXMTMvs4Yfbw3bpyXWQMtoeeI1J78Ce3TvZKhZ+MvtFMH1/rZNgze0blUIP6x3d7GfbbCpXBBTUAHyKGnZwgtzvYg4sRMjhQvHVaRryGCNnO9QgQqftHa32M1M4wodfbhH6v1l527/Nw77cpq41alLDfdb4A8PuP9RyscmkAAAAASUVORK5CYII=', ], Response::HTTP_OK, ); } - } diff --git a/tests/Integration/PIX/DYNAMIC/PixDynamicPayloadTest.php b/tests/Integration/PIX/DYNAMIC/PixDynamicPayloadTest.php index 17d2ae2..2ec7f4c 100644 --- a/tests/Integration/PIX/DYNAMIC/PixDynamicPayloadTest.php +++ b/tests/Integration/PIX/DYNAMIC/PixDynamicPayloadTest.php @@ -74,7 +74,6 @@ private static function stubSuccess(): PromiseInterface } /** - * @return void * @throws RequestException */ final public function testPixDynamicPayloadInvalidUrlParameter(): void diff --git a/tests/Integration/PIX/DYNAMIC/PixDynamicUpdateTest.php b/tests/Integration/PIX/DYNAMIC/PixDynamicUpdateTest.php index 773ff17..6314ed3 100644 --- a/tests/Integration/PIX/DYNAMIC/PixDynamicUpdateTest.php +++ b/tests/Integration/PIX/DYNAMIC/PixDynamicUpdateTest.php @@ -18,7 +18,6 @@ class PixDynamicUpdateTest extends TestCase { // Todo: não tem erros esse endpoint? 404? 422? /** - * @return void * @throws RequestException */ final public function testUpdateDynamicQRCodeInvalidKey(): void @@ -42,10 +41,7 @@ final public function testUpdateDynamicQRCodeInvalidKey(): void } } - /** - * @return PromiseInterface - */ - static private function stubInvalidKey(): PromiseInterface + private static function stubInvalidKey(): PromiseInterface { return Http::response( [ @@ -56,12 +52,9 @@ static private function stubInvalidKey(): PromiseInterface ); } - /** - * @return DynamicQRUpdate - */ - static private function fakeBody(): DynamicQRUpdate + private static function fakeBody(): DynamicQRUpdate { - $dynamic = new DynamicQRUpdate; + $dynamic = new DynamicQRUpdate(); $dynamic->key = 'testepix@celcoin.com.br'; $dynamic->amount = 15.63; @@ -90,6 +83,7 @@ static private function fakeBody(): DynamicQRUpdate /** * @throws RequestException + * * @dataProvider updateErrorDataProvider */ final public function testUpdateDynamicQRCodeWithoutField(string $unsetValue): void @@ -116,10 +110,7 @@ final public function testUpdateDynamicQRCodeWithoutField(string $unsetValue): v } } - /** - * @return PromiseInterface - */ - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ @@ -186,7 +177,6 @@ final public static function updateErrorDataProvider(): array } /** - * @return void * @throws RequestException */ final public function testUpdateDynamicQRCodeSuccess(): void @@ -205,5 +195,4 @@ final public function testUpdateDynamicQRCodeSuccess(): void $this->assertEquals(201, $response['status']); $this->assertEquals('ACTIVE', $response['body']['status']); } - } diff --git a/tests/Integration/PIX/Participants/PixParticipantsListTest.php b/tests/Integration/PIX/Participants/PixParticipantsListTest.php index 4ee236e..0fbe776 100644 --- a/tests/Integration/PIX/Participants/PixParticipantsListTest.php +++ b/tests/Integration/PIX/Participants/PixParticipantsListTest.php @@ -13,13 +13,7 @@ class PixParticipantsListTest extends TestCase { - - /** - * @param int $status - * - * @return PromiseInterface - */ - static private function stubGenericError(int $status): PromiseInterface + private static function stubGenericError(int $status): PromiseInterface { return Http::response( [ @@ -30,7 +24,6 @@ static private function stubGenericError(int $status): PromiseInterface } /** - * @return void * @throws RequestException */ final public function testSuccess(): void @@ -52,10 +45,7 @@ final public function testSuccess(): void $this->assertCount(3, $response); } - /** - * @return PromiseInterface - */ - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ @@ -86,11 +76,10 @@ static private function stubSuccess(): PromiseInterface } /** - * @param Closure $response - * @param string $status + * @param string $status * - * @return void * @dataProvider errorDataProvider + * * @throws RequestException */ final public function testErrors(Closure $response, mixed $status): void @@ -123,7 +112,7 @@ public static function errorDataProvider(): array { return [ 'status·code·500' => [ - fn() => Http::response([], Response::HTTP_INTERNAL_SERVER_ERROR), + fn () => Http::response([], Response::HTTP_INTERNAL_SERVER_ERROR), Response::HTTP_INTERNAL_SERVER_ERROR, ], ]; diff --git a/tests/Integration/PIX/Payments/PixPaymentStatusTest.php b/tests/Integration/PIX/Payments/PixPaymentStatusTest.php index 53b9260..92887f4 100644 --- a/tests/Integration/PIX/Payments/PixPaymentStatusTest.php +++ b/tests/Integration/PIX/Payments/PixPaymentStatusTest.php @@ -15,6 +15,7 @@ class PixPaymentStatusTest extends TestCase { /** * @throws RequestException + * * @dataProvider stubSuccessStatuses */ final public function testStatusSuccess(string $status, Closure $response): void @@ -51,9 +52,9 @@ final public function testStatusSuccess(string $status, Closure $response): void public static function stubSuccessStatuses(): array { return [ - 'PROCESSING' => ['PROCESSING', fn() => self::stubSuccess('PROCESSING')], - 'CONFIRMED' => ['CONFIRMED', fn() => self::stubSuccess('CONFIRMED')], - 'ERROR' => ['ERROR', fn() => self::stubSuccess('ERROR')], + 'PROCESSING' => ['PROCESSING', fn () => self::stubSuccess('PROCESSING')], + 'CONFIRMED' => ['CONFIRMED', fn () => self::stubSuccess('CONFIRMED')], + 'ERROR' => ['ERROR', fn () => self::stubSuccess('ERROR')], ]; } diff --git a/tests/Integration/PIX/QRLocation/PixCreateLocationTest.php b/tests/Integration/PIX/QRLocation/PixCreateLocationTest.php index 3ff4e3d..b8e9404 100644 --- a/tests/Integration/PIX/QRLocation/PixCreateLocationTest.php +++ b/tests/Integration/PIX/QRLocation/PixCreateLocationTest.php @@ -15,9 +15,7 @@ class PixCreateLocationTest extends TestCase { - /** - * @return void * @throws RequestException */ final public function testSuccess(): void @@ -40,10 +38,7 @@ final public function testSuccess(): void $this->assertEquals('CREATED', $response['status']); } - /** - * @return PromiseInterface - */ - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ @@ -64,9 +59,6 @@ static private function stubSuccess(): PromiseInterface ); } - /** - * @return QRLocation - */ private function fakeLocationBody(): QRLocation { $merchant = new Merchant(); @@ -79,15 +71,13 @@ private function fakeLocationBody(): QRLocation $location->merchant = $merchant; $location->type = 'COBV'; $location->clientRequestId = '9b26edb7cf254db09f5449c94bf13abc'; + return $location; } /** - * @param Closure $response - * @param string $errorCode - * - * @return void * @throws RequestException + * * @dataProvider errorDataProvider */ final public function testConvertingValueError(Closure $response, string $errorCode): void @@ -118,20 +108,18 @@ final public function testConvertingValueError(Closure $response, string $errorC /** * @uses https://developers.celcoin.com.br/reference/criar-um-qrcode-location + * * @return array[] */ public static function errorDataProvider(): array { return [ - 'status code 400' => [fn() => self::stubConvertingError(), '400'], - 'status code CR001' => [fn() => self::stubValueCannotBeNull(), 'CR001'], + 'status code 400' => [fn () => self::stubConvertingError(), '400'], + 'status code CR001' => [fn () => self::stubValueCannotBeNull(), 'CR001'], ]; } - /** - * @return PromiseInterface - */ - static private function stubConvertingError(): PromiseInterface + private static function stubConvertingError(): PromiseInterface { return Http::response( [ @@ -142,10 +130,7 @@ static private function stubConvertingError(): PromiseInterface ); } - /** - * @return PromiseInterface - */ - static private function stubValueCannotBeNull(): PromiseInterface + private static function stubValueCannotBeNull(): PromiseInterface { return Http::response( [ diff --git a/tests/Integration/PIX/QRLocation/PixGetLocationTest.php b/tests/Integration/PIX/QRLocation/PixGetLocationTest.php index 871db08..0700edf 100644 --- a/tests/Integration/PIX/QRLocation/PixGetLocationTest.php +++ b/tests/Integration/PIX/QRLocation/PixGetLocationTest.php @@ -13,9 +13,7 @@ class PixGetLocationTest extends TestCase { - /** - * @return void * @throws RequestException */ final public function testSuccess(): void @@ -40,10 +38,7 @@ final public function testSuccess(): void $this->assertEquals($locationId, $response['locationId']); } - /** - * @return PromiseInterface - */ - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ @@ -65,11 +60,10 @@ static private function stubSuccess(): PromiseInterface } /** - * @param Closure $response - * @param string $status + * @param string $status * - * @return void * @dataProvider errorDataProvider + * * @throws RequestException */ final public function testErrors(Closure $response, mixed $status): void @@ -101,23 +95,18 @@ public static function errorDataProvider(): array { return [ 'status code 400' => [ - fn() => self::stubGenericError(Response::HTTP_BAD_REQUEST), + fn () => self::stubGenericError(Response::HTTP_BAD_REQUEST), Response::HTTP_BAD_REQUEST, ], - 'status code 404' => [fn() => self::stubGenericError(Response::HTTP_NOT_FOUND), Response::HTTP_NOT_FOUND], + 'status code 404' => [fn () => self::stubGenericError(Response::HTTP_NOT_FOUND), Response::HTTP_NOT_FOUND], 'status code 500' => [ - fn() => self::stubGenericError(Response::HTTP_INTERNAL_SERVER_ERROR), + fn () => self::stubGenericError(Response::HTTP_INTERNAL_SERVER_ERROR), Response::HTTP_INTERNAL_SERVER_ERROR, ], ]; } - /** - * @param int $status - * - * @return PromiseInterface - */ - static private function stubGenericError(int $status): PromiseInterface + private static function stubGenericError(int $status): PromiseInterface { return Http::response( [ @@ -126,5 +115,4 @@ static private function stubGenericError(int $status): PromiseInterface ], ); } - -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/QRLocation/PixGetQRTest.php b/tests/Integration/PIX/QRLocation/PixGetQRTest.php index f9371ad..009b244 100644 --- a/tests/Integration/PIX/QRLocation/PixGetQRTest.php +++ b/tests/Integration/PIX/QRLocation/PixGetQRTest.php @@ -13,9 +13,7 @@ class PixGetQRTest extends TestCase { - /** - * @return void * @throws RequestException */ final public function testSuccess(): void @@ -40,26 +38,22 @@ final public function testSuccess(): void $this->assertArrayHasKey('base64image', $response); } - /** - * @return PromiseInterface - */ - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => 200, - "base64image" => "iVBORw0KGgoAAAANSUhEUgAAAJMAAACTAQMAAACwK7lWAAAABlBMVEX///8AAABVwtN+AAACA0lEQVRIieWWMY7jMAxFaahQJ19AgK6hTleSL+DYF7CvpE7XEKALOJ0LwZzvJLuzW41YjxAg8QtAiOTnp4l+2xmZF1IXOT4pBr4kzJDaQhm5MtfL41HCQl0CH6EZKrPnTcj2Uy1ecXaLnK25DEykyUjZK4/o2xws/Zfbzwz123z9fL5r2sVwhkzk3Zrc8t26LnZXPTnmNuTK2UYJG1KLGt/uCnYmSxJmgkLtDyoRqvFlFjHdpoxgNOX6zIUkjDzv7BaNPNDzYiTMeGt8vUIbklqzuiRsON3l1eYB7COVKGKpPRJzUpeua3prrZcRfp40ngU12KgeEjZwm061Z7d5PMkY+VvjMzWj8U/dJMxQG1G5ZAe2ht416Gb3TGC2bPQQDi8ShlmcMBm6UChGvzXezbTbdImh0A2KiOHuU7bT6fZkKbzr1828uzRDa1Mqs3Yihm4P530jKA4OOotYZqiMM0xX8dmMhCEYbkGBF/T8r+77GHz30BbBNn3fhSRsTM1glLFqEqOEUcIMkjgxl7f/PXMTMvs4Yfbw3bpyXWQMtoeeI1J78Ce3TvZKhZ+MvtFMH1/rZNgze0blUIP6x3d7GfbbCpXBBTUAHyKGnZwgtzvYg4sRMjhQvHVaRryGCNnO9QgQqftHa32M1M4wodfbhH6v1l527/Nw77cpq41alLDfdb4A8PuP9RyscmkAAAAASUVORK5CYII=", + 'status' => 200, + 'base64image' => 'iVBORw0KGgoAAAANSUhEUgAAAJMAAACTAQMAAACwK7lWAAAABlBMVEX///8AAABVwtN+AAACA0lEQVRIieWWMY7jMAxFaahQJ19AgK6hTleSL+DYF7CvpE7XEKALOJ0LwZzvJLuzW41YjxAg8QtAiOTnp4l+2xmZF1IXOT4pBr4kzJDaQhm5MtfL41HCQl0CH6EZKrPnTcj2Uy1ecXaLnK25DEykyUjZK4/o2xws/Zfbzwz123z9fL5r2sVwhkzk3Zrc8t26LnZXPTnmNuTK2UYJG1KLGt/uCnYmSxJmgkLtDyoRqvFlFjHdpoxgNOX6zIUkjDzv7BaNPNDzYiTMeGt8vUIbklqzuiRsON3l1eYB7COVKGKpPRJzUpeua3prrZcRfp40ngU12KgeEjZwm061Z7d5PMkY+VvjMzWj8U/dJMxQG1G5ZAe2ht416Gb3TGC2bPQQDi8ShlmcMBm6UChGvzXezbTbdImh0A2KiOHuU7bT6fZkKbzr1828uzRDa1Mqs3Yihm4P530jKA4OOotYZqiMM0xX8dmMhCEYbkGBF/T8r+77GHz30BbBNn3fhSRsTM1glLFqEqOEUcIMkjgxl7f/PXMTMvs4Yfbw3bpyXWQMtoeeI1J78Ce3TvZKhZ+MvtFMH1/rZNgze0blUIP6x3d7GfbbCpXBBTUAHyKGnZwgtzvYg4sRMjhQvHVaRryGCNnO9QgQqftHa32M1M4wodfbhH6v1l527/Nw77cpq41alLDfdb4A8PuP9RyscmkAAAAASUVORK5CYII=', ], Response::HTTP_OK, ); } /** - * @param Closure $response - * @param string $status + * @param string $status * - * @return void * @dataProvider errorDataProvider + * * @throws RequestException */ final public function testErrors(Closure $response, mixed $status): void @@ -90,23 +84,18 @@ public static function errorDataProvider(): array { return [ 'status code 400' => [ - fn() => self::stubGenericError(Response::HTTP_BAD_REQUEST), + fn () => self::stubGenericError(Response::HTTP_BAD_REQUEST), Response::HTTP_BAD_REQUEST, ], - 'status code 404' => [fn() => self::stubGenericError(Response::HTTP_NOT_FOUND), Response::HTTP_NOT_FOUND], + 'status code 404' => [fn () => self::stubGenericError(Response::HTTP_NOT_FOUND), Response::HTTP_NOT_FOUND], 'status code 500' => [ - fn() => self::stubGenericError(Response::HTTP_INTERNAL_SERVER_ERROR), + fn () => self::stubGenericError(Response::HTTP_INTERNAL_SERVER_ERROR), Response::HTTP_INTERNAL_SERVER_ERROR, ], ]; } - /** - * @param int $status - * - * @return PromiseInterface - */ - static private function stubGenericError(int $status): PromiseInterface + private static function stubGenericError(int $status): PromiseInterface { return Http::response( [ diff --git a/tests/Integration/PIX/QRLocation/PixGetStaticPaymentDataTest.php b/tests/Integration/PIX/QRLocation/PixGetStaticPaymentDataTest.php index 9b15820..cd61605 100644 --- a/tests/Integration/PIX/QRLocation/PixGetStaticPaymentDataTest.php +++ b/tests/Integration/PIX/QRLocation/PixGetStaticPaymentDataTest.php @@ -14,12 +14,9 @@ class PixGetStaticPaymentDataTest extends TestCase { - /** - * @param array $search - * - * @return void * @throws RequestException + * * @dataProvider searchDataProvider */ final public function testSuccess(array $search): void @@ -45,10 +42,7 @@ final public function testSuccess(array $search): void $this->assertArrayHasKey($keyName, $response); } - /** - * @return PromiseInterface - */ - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ @@ -99,10 +93,8 @@ static private function stubSuccess(): PromiseInterface } /** - * @param string $key - * - * @return void * @throws RequestException + * * @dataProvider createErrorDataProvider */ final public function testValidationError(string $key): void @@ -128,12 +120,8 @@ final public function testValidationError(string $key): void } /** - * @param Closure $response - * @param int $status - * @param array $params - * - * @return void * @throws RequestException + * * @dataProvider errorDataProvider */ final public function testErrors(Closure $response, int $status, array $params): void @@ -185,29 +173,24 @@ public static function errorDataProvider(): array { return [ 'status code 400' => [ - fn() => self::stubGenericError(Response::HTTP_BAD_REQUEST), + fn () => self::stubGenericError(Response::HTTP_BAD_REQUEST), Response::HTTP_BAD_REQUEST, ['transactionIdBrcode' => 12345345], ], 'status code 404' => [ - fn() => self::stubGenericError(Response::HTTP_NOT_FOUND), + fn () => self::stubGenericError(Response::HTTP_NOT_FOUND), Response::HTTP_NOT_FOUND, ['transactionIdBrcode' => 12345345], ], 'status code 500' => [ - fn() => self::stubGenericError(Response::HTTP_INTERNAL_SERVER_ERROR), + fn () => self::stubGenericError(Response::HTTP_INTERNAL_SERVER_ERROR), Response::HTTP_INTERNAL_SERVER_ERROR, ['transactionIdBrcode' => 12345345], ], ]; } - /** - * @param int $status - * - * @return PromiseInterface - */ - static private function stubGenericError(int $status): PromiseInterface + private static function stubGenericError(int $status): PromiseInterface { return Http::response( [ @@ -216,4 +199,4 @@ static private function stubGenericError(int $status): PromiseInterface ], ); } -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/Receivement/PixReceivementStatusTest.php b/tests/Integration/PIX/Receivement/PixReceivementStatusTest.php index f466b8c..ddd5580 100644 --- a/tests/Integration/PIX/Receivement/PixReceivementStatusTest.php +++ b/tests/Integration/PIX/Receivement/PixReceivementStatusTest.php @@ -2,7 +2,6 @@ namespace WeDevBr\Celcoin\Tests\Integration\PIX\Receivement; - use GuzzleHttp\Promise\PromiseInterface; use Illuminate\Http\Client\RequestException; use Illuminate\Support\Facades\Http; @@ -46,7 +45,7 @@ final public function testReceivementStatusNotFound(): void } } - static public function stubErrorNotFound(): PromiseInterface + public static function stubErrorNotFound(): PromiseInterface { return Http::response( [ diff --git a/tests/Integration/PIX/Reverse/PixReverseCreateTest.php b/tests/Integration/PIX/Reverse/PixReverseCreateTest.php index 931583c..5e9e492 100644 --- a/tests/Integration/PIX/Reverse/PixReverseCreateTest.php +++ b/tests/Integration/PIX/Reverse/PixReverseCreateTest.php @@ -2,7 +2,6 @@ namespace WeDevBr\Celcoin\Tests\Integration\PIX\Reverse; - use GuzzleHttp\Promise\PromiseInterface; use Illuminate\Http\Client\RequestException; use Illuminate\Support\Facades\Http; @@ -14,7 +13,6 @@ class PixReverseCreateTest extends TestCase { - /** * @throws RequestException */ diff --git a/tests/Integration/PIX/Reverse/PixReverseGetStatusTest.php b/tests/Integration/PIX/Reverse/PixReverseGetStatusTest.php index edbc78f..6ea7182 100644 --- a/tests/Integration/PIX/Reverse/PixReverseGetStatusTest.php +++ b/tests/Integration/PIX/Reverse/PixReverseGetStatusTest.php @@ -2,7 +2,6 @@ namespace WeDevBr\Celcoin\Tests\Integration\PIX\Reverse; - use Closure; use GuzzleHttp\Promise\PromiseInterface; use Illuminate\Http\Client\RequestException; @@ -15,15 +14,14 @@ class PixReverseGetStatusTest extends TestCase { - final public static function notFoundErrorProvider(): array { return [ - 'Original transaction not found' => ['11', fn() => self::stubErrorOriginalTransactionNotFound()], - 'Transaction exceeded' => ['12', fn() => self::stubErrorTransactionExceededNotFound()], - 'Receivement transaction not found' => ['99', fn() => self::stubErrorReceivementTransactionNotFound()], - 'Uncatchable error not found' => ['999', fn() => self::stubUnwatchableErrorNotFound()], - 'Insufficient funds' => ['40', fn() => self::stubInsufficientFunds()], + 'Original transaction not found' => ['11', fn () => self::stubErrorOriginalTransactionNotFound()], + 'Transaction exceeded' => ['12', fn () => self::stubErrorTransactionExceededNotFound()], + 'Receivement transaction not found' => ['99', fn () => self::stubErrorReceivementTransactionNotFound()], + 'Uncatchable error not found' => ['999', fn () => self::stubUnwatchableErrorNotFound()], + 'Insufficient funds' => ['40', fn () => self::stubInsufficientFunds()], ]; } @@ -134,6 +132,7 @@ private static function stubSuccess(): PromiseInterface /** * @throws RequestException + * * @dataProvider notFoundErrorProvider */ final public function testReverseGetStatusErrorNotFound(string $returnCode, Closure $stub): void diff --git a/tests/Integration/PIX/StaticPayment/PixCreateStaticPaymentTest.php b/tests/Integration/PIX/StaticPayment/PixCreateStaticPaymentTest.php index a3d11b6..4918b66 100644 --- a/tests/Integration/PIX/StaticPayment/PixCreateStaticPaymentTest.php +++ b/tests/Integration/PIX/StaticPayment/PixCreateStaticPaymentTest.php @@ -15,7 +15,6 @@ class PixCreateStaticPaymentTest extends TestCase { - /** * @throws RequestException */ @@ -41,10 +40,7 @@ final public function testCreateStaticPayment(): void $this->assertArrayHasKey('transactionIdentification', $response); } - /** - * @return PromiseInterface - */ - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ @@ -74,16 +70,12 @@ private function fakeQRStaticPayment(): QRStaticPayment 'tag 1', ]; - return $staticPayment; } /** - * @param Closure $response - * @param int $status - * - * @return void * @throws RequestException + * * @dataProvider errorDataProvider */ final public function testConvertingValueError(Closure $response, int $status): void @@ -119,10 +111,9 @@ public static function errorDataProvider(): array return [ // Status 500 - Internal server error return empty array 'status·code·500' => [ - fn() => Http::response([], Response::HTTP_INTERNAL_SERVER_ERROR), + fn () => Http::response([], Response::HTTP_INTERNAL_SERVER_ERROR), Response::HTTP_INTERNAL_SERVER_ERROR, ], ]; } - -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/StaticPayment/PixGetStaticPaymentQRTest.php b/tests/Integration/PIX/StaticPayment/PixGetStaticPaymentQRTest.php index 0fa83b0..71c95fc 100644 --- a/tests/Integration/PIX/StaticPayment/PixGetStaticPaymentQRTest.php +++ b/tests/Integration/PIX/StaticPayment/PixGetStaticPaymentQRTest.php @@ -13,9 +13,7 @@ class PixGetStaticPaymentQRTest extends TestCase { - /** - * @return void * @throws RequestException */ final public function testSuccess(): void @@ -40,26 +38,22 @@ final public function testSuccess(): void $this->assertArrayHasKey('base64image', $response); } - /** - * @return PromiseInterface - */ - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "status" => 200, - "base64image" => "iVBORw0KGgoAAAANSUhEUgAAAJMAAACTAQMAAACwK7lWAAAABlBMVEX///8AAABVwtN+AAACA0lEQVRIieWWMY7jMAxFaahQJ19AgK6hTleSL+DYF7CvpE7XEKALOJ0LwZzvJLuzW41YjxAg8QtAiOTnp4l+2xmZF1IXOT4pBr4kzJDaQhm5MtfL41HCQl0CH6EZKrPnTcj2Uy1ecXaLnK25DEykyUjZK4/o2xws/Zfbzwz123z9fL5r2sVwhkzk3Zrc8t26LnZXPTnmNuTK2UYJG1KLGt/uCnYmSxJmgkLtDyoRqvFlFjHdpoxgNOX6zIUkjDzv7BaNPNDzYiTMeGt8vUIbklqzuiRsON3l1eYB7COVKGKpPRJzUpeua3prrZcRfp40ngU12KgeEjZwm061Z7d5PMkY+VvjMzWj8U/dJMxQG1G5ZAe2ht416Gb3TGC2bPQQDi8ShlmcMBm6UChGvzXezbTbdImh0A2KiOHuU7bT6fZkKbzr1828uzRDa1Mqs3Yihm4P530jKA4OOotYZqiMM0xX8dmMhCEYbkGBF/T8r+77GHz30BbBNn3fhSRsTM1glLFqEqOEUcIMkjgxl7f/PXMTMvs4Yfbw3bpyXWQMtoeeI1J78Ce3TvZKhZ+MvtFMH1/rZNgze0blUIP6x3d7GfbbCpXBBTUAHyKGnZwgtzvYg4sRMjhQvHVaRryGCNnO9QgQqftHa32M1M4wodfbhH6v1l527/Nw77cpq41alLDfdb4A8PuP9RyscmkAAAAASUVORK5CYII=", + 'status' => 200, + 'base64image' => 'iVBORw0KGgoAAAANSUhEUgAAAJMAAACTAQMAAACwK7lWAAAABlBMVEX///8AAABVwtN+AAACA0lEQVRIieWWMY7jMAxFaahQJ19AgK6hTleSL+DYF7CvpE7XEKALOJ0LwZzvJLuzW41YjxAg8QtAiOTnp4l+2xmZF1IXOT4pBr4kzJDaQhm5MtfL41HCQl0CH6EZKrPnTcj2Uy1ecXaLnK25DEykyUjZK4/o2xws/Zfbzwz123z9fL5r2sVwhkzk3Zrc8t26LnZXPTnmNuTK2UYJG1KLGt/uCnYmSxJmgkLtDyoRqvFlFjHdpoxgNOX6zIUkjDzv7BaNPNDzYiTMeGt8vUIbklqzuiRsON3l1eYB7COVKGKpPRJzUpeua3prrZcRfp40ngU12KgeEjZwm061Z7d5PMkY+VvjMzWj8U/dJMxQG1G5ZAe2ht416Gb3TGC2bPQQDi8ShlmcMBm6UChGvzXezbTbdImh0A2KiOHuU7bT6fZkKbzr1828uzRDa1Mqs3Yihm4P530jKA4OOotYZqiMM0xX8dmMhCEYbkGBF/T8r+77GHz30BbBNn3fhSRsTM1glLFqEqOEUcIMkjgxl7f/PXMTMvs4Yfbw3bpyXWQMtoeeI1J78Ce3TvZKhZ+MvtFMH1/rZNgze0blUIP6x3d7GfbbCpXBBTUAHyKGnZwgtzvYg4sRMjhQvHVaRryGCNnO9QgQqftHa32M1M4wodfbhH6v1l527/Nw77cpq41alLDfdb4A8PuP9RyscmkAAAAASUVORK5CYII=', ], Response::HTTP_OK, ); } /** - * @param Closure $response - * @param string $status + * @param string $status * - * @return void * @dataProvider errorDataProvider + * * @throws RequestException */ final public function testErrors(Closure $response, mixed $status): void @@ -91,26 +85,21 @@ public static function errorDataProvider(): array { return [ 'generic response status 400' => [ - fn() => self::stubGenericError(Response::HTTP_BAD_REQUEST), + fn () => self::stubGenericError(Response::HTTP_BAD_REQUEST), Response::HTTP_BAD_REQUEST, ], 'generic response status 404' => [ - fn() => self::stubGenericError(Response::HTTP_NOT_FOUND), + fn () => self::stubGenericError(Response::HTTP_NOT_FOUND), Response::HTTP_NOT_FOUND, ], 'generic response status 500' => [ - fn() => self::stubGenericError(Response::HTTP_INTERNAL_SERVER_ERROR), + fn () => self::stubGenericError(Response::HTTP_INTERNAL_SERVER_ERROR), Response::HTTP_INTERNAL_SERVER_ERROR, ], ]; } - /** - * @param int $status - * - * @return PromiseInterface - */ - static private function stubGenericError(int $status): PromiseInterface + private static function stubGenericError(int $status): PromiseInterface { return Http::response( [ diff --git a/tests/Integration/PIX/StaticPayment/PixGetStaticPaymentTransactionTest.php b/tests/Integration/PIX/StaticPayment/PixGetStaticPaymentTransactionTest.php index 7b1e0f2..115353f 100644 --- a/tests/Integration/PIX/StaticPayment/PixGetStaticPaymentTransactionTest.php +++ b/tests/Integration/PIX/StaticPayment/PixGetStaticPaymentTransactionTest.php @@ -13,13 +13,7 @@ class PixGetStaticPaymentTransactionTest extends TestCase { - - /** - * @param int $status - * - * @return PromiseInterface - */ - static private function stubGenericError(int $status): PromiseInterface + private static function stubGenericError(int $status): PromiseInterface { return Http::response( [ @@ -30,7 +24,6 @@ static private function stubGenericError(int $status): PromiseInterface } /** - * @return void * @throws RequestException */ final public function testSuccess(): void @@ -61,35 +54,31 @@ final public function testSuccess(): void $this->assertArrayHasKey('emvqrcps', $response); } - /** - * @return PromiseInterface - */ - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "merchantAccountInformation" => [ - "key" => "testepix@celcoin.com.br", - "additionalInformation" => null, + 'merchantAccountInformation' => [ + 'key' => 'testepix@celcoin.com.br', + 'additionalInformation' => null, ], - "merchantCategoryCode" => 0, - "transactionCurrency" => 986, - "transactionAmount" => 0, - "countryCode" => "BR", - "merchantName" => "Celcoin", - "postalCode" => "01201005", - "emvqrcps" => "00020126450014br.gov.bcb.pix0123testepix@celcoin.com.br5204000053039865802BR5907Celcoin6007Barueri61080120100562070503***6304FD53", + 'merchantCategoryCode' => 0, + 'transactionCurrency' => 986, + 'transactionAmount' => 0, + 'countryCode' => 'BR', + 'merchantName' => 'Celcoin', + 'postalCode' => '01201005', + 'emvqrcps' => '00020126450014br.gov.bcb.pix0123testepix@celcoin.com.br5204000053039865802BR5907Celcoin6007Barueri61080120100562070503***6304FD53', ], Response::HTTP_OK, ); } /** - * @param Closure $response - * @param string $status + * @param string $status * - * @return void * @dataProvider errorDataProvider + * * @throws RequestException */ final public function testErrors(Closure $response, mixed $status): void @@ -125,7 +114,7 @@ public static function errorDataProvider(): array { return [ 'status·code·500' => [ - fn() => Http::response([], Response::HTTP_INTERNAL_SERVER_ERROR), + fn () => Http::response([], Response::HTTP_INTERNAL_SERVER_ERROR), Response::HTTP_INTERNAL_SERVER_ERROR, ], ]; diff --git a/tests/Integration/PIX/Webhooks/GenericWebhookErrorsTrait.php b/tests/Integration/PIX/Webhooks/GenericWebhookErrorsTrait.php index fd2f77f..c06cba2 100644 --- a/tests/Integration/PIX/Webhooks/GenericWebhookErrorsTrait.php +++ b/tests/Integration/PIX/Webhooks/GenericWebhookErrorsTrait.php @@ -128,43 +128,42 @@ public static function stubErrorCannotResendAlreadySentWebhook(): PromiseInterfa ); } - public final static function notFoundErrorProvider(): array + final public static function notFoundErrorProvider(): array { return [ 'Webhook required' => [ 'WEBHMVAL01', - fn() => self::stubErrorWebhookRequiredNotFound(), + fn () => self::stubErrorWebhookRequiredNotFound(), ], 'Invalid Webhook' => [ 'WEBHMVAL02', - fn() => self::stubInvalidWebhookError(), + fn () => self::stubInvalidWebhookError(), ], 'DateFrom cannot be greater than dateTo' => [ 'WEBHMVAL03', - fn() => self::stubDateFromCannotBeGreaterThanDateToError(), + fn () => self::stubDateFromCannotBeGreaterThanDateToError(), ], 'Invalid date interval' => [ 'WEBHMVAL04', - fn() => self::stubInvalidDateIntervalError(), + fn () => self::stubInvalidDateIntervalError(), ], 'Invalid dateFrom' => [ 'WEBHMVAL05', - fn() => self::stubInvalidDateFromError(), + fn () => self::stubInvalidDateFromError(), ], 'Invalid dateTo' => [ 'WEBHMVAL06', - fn() => self::stubInvalidDateToError(), + fn () => self::stubInvalidDateToError(), ], 'Limit field value should not exceed 100' => [ 'WEBHMVAL08', - fn() => self::stubErrorLimitFieldValueShouldNotExceed100(), + fn () => self::stubErrorLimitFieldValueShouldNotExceed100(), ], 'Cannot resend already sent webhook' => [ 'WEBHMVAL09', - fn() => self::stubErrorCannotResendAlreadySentWebhook(), + fn () => self::stubErrorCannotResendAlreadySentWebhook(), ], - ]; } -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/Webhooks/PixReactivateAndResendAllPendingMessagesTest.php b/tests/Integration/PIX/Webhooks/PixReactivateAndResendAllPendingMessagesTest.php index 00ef8ce..8411bdb 100644 --- a/tests/Integration/PIX/Webhooks/PixReactivateAndResendAllPendingMessagesTest.php +++ b/tests/Integration/PIX/Webhooks/PixReactivateAndResendAllPendingMessagesTest.php @@ -26,7 +26,7 @@ final public function testWebhookGetListSuccess(): void * @var Types\PixReactivateAndResendAllPendingMessages $params * @var WebhookEventEnum $webhookEventEnum */ - [$params, $webhookEventEnum] = $this->callWebhookBase(fn() => self::stubSuccess()); + [$params, $webhookEventEnum] = $this->callWebhookBase(fn () => self::stubSuccess()); $pix = new Clients\CelcoinPixWebhooks(); $response = $pix->reactivateAndResendAllPendingMessages($webhookEventEnum, $params); @@ -34,9 +34,7 @@ final public function testWebhookGetListSuccess(): void } /** - * @param Closure $stub - * @param WebhookEventEnum $webhookEventEnum - * + * @param Closure $stub * @return array */ private function callWebhookBase( @@ -47,8 +45,8 @@ private function callWebhookBase( $url = sprintf(Clients\CelcoinPixWebhooks::PIX_REACTIVATE_RESEND_PENDING_ENDPOINT, $webhookEventEnum->value); - if (sizeof($params->toArray()) > 1) { - $url .= '?' . http_build_query($params->toArray()); + if (count($params->toArray()) > 1) { + $url .= '?'.http_build_query($params->toArray()); } Http::fake( @@ -61,6 +59,7 @@ private function callWebhookBase( ) => $stub, ], ); + return [$params, $webhookEventEnum]; } @@ -80,6 +79,7 @@ private static function stubSuccess(): PromiseInterface /** * @throws RequestException + * * @dataProvider notFoundErrorProvider */ final public function testWebhookErrorNotFound(string $returnCode, Closure $stub): void @@ -100,4 +100,4 @@ final public function testWebhookErrorNotFound(string $returnCode, Closure $stub throw $exception; } } -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/Webhooks/PixReactivateEventAndResendSpecifiedMessagesInListTest.php b/tests/Integration/PIX/Webhooks/PixReactivateEventAndResendSpecifiedMessagesInListTest.php index 9ce33c6..d207c23 100644 --- a/tests/Integration/PIX/Webhooks/PixReactivateEventAndResendSpecifiedMessagesInListTest.php +++ b/tests/Integration/PIX/Webhooks/PixReactivateEventAndResendSpecifiedMessagesInListTest.php @@ -26,7 +26,7 @@ final public function testWebhookGetListSuccess(): void * @var Types\PixReactivateEventAndResendSpecifiedMessagesInList $params * @var WebhookEventEnum $webhookEventEnum */ - [$params, $webhookEventEnum] = $this->callWebhookBase(fn() => self::stubSuccess()); + [$params, $webhookEventEnum] = $this->callWebhookBase(fn () => self::stubSuccess()); $pix = new Clients\CelcoinPixWebhooks(); $response = $pix->reactivateEventAndResendSpecifiedMessagesInList($webhookEventEnum, $params); @@ -34,9 +34,7 @@ final public function testWebhookGetListSuccess(): void } /** - * @param Closure $stub - * @param WebhookEventEnum $webhookEventEnum - * + * @param Closure $stub * @return array */ private function callWebhookBase( @@ -57,6 +55,7 @@ private function callWebhookBase( ) => $stub, ], ); + return [$params, $webhookEventEnum]; } @@ -76,6 +75,7 @@ private static function stubSuccess(): PromiseInterface /** * @throws RequestException + * * @dataProvider notFoundErrorProvider */ final public function testWebhookErrorNotFound(string $returnCode, Closure $stub): void @@ -96,4 +96,4 @@ final public function testWebhookErrorNotFound(string $returnCode, Closure $stub throw $exception; } } -} \ No newline at end of file +} diff --git a/tests/Integration/PIX/Webhooks/PixWebhookLisGetListTest.php b/tests/Integration/PIX/Webhooks/PixWebhookLisGetListTest.php index 3a07dc2..394afe0 100644 --- a/tests/Integration/PIX/Webhooks/PixWebhookLisGetListTest.php +++ b/tests/Integration/PIX/Webhooks/PixWebhookLisGetListTest.php @@ -26,7 +26,7 @@ final public function testWebhookGetListSuccess(): void * @var Types\PixWebhookGetList $params * @var WebhookEventEnum $webhookEventEnum */ - [$params, $webhookEventEnum] = $this->callWebhookBase(fn() => self::stubSuccess()); + [$params, $webhookEventEnum] = $this->callWebhookBase(fn () => self::stubSuccess()); $pix = new Clients\CelcoinPixWebhooks(); $response = $pix->getList($webhookEventEnum, $params); @@ -34,8 +34,7 @@ final public function testWebhookGetListSuccess(): void } /** - * @param Closure $stub - * + * @param Closure $stub * @return array */ private function callWebhookBase(Closure $stub): array @@ -45,8 +44,8 @@ private function callWebhookBase(Closure $stub): array $webhookEventEnum = WebhookEventEnum::ERROR; $url = sprintf(Clients\CelcoinPixWebhooks::PIX_WEBHOOK_GET_LIST_ENDPOINT, $webhookEventEnum->value); - if (sizeof($params->toArray()) > 1) { - $url .= '?' . http_build_query($params->toArray()); + if (count($params->toArray()) > 1) { + $url .= '?'.http_build_query($params->toArray()); } Http::fake( @@ -59,6 +58,7 @@ private function callWebhookBase(Closure $stub): array ) => $stub, ], ); + return [$params, $webhookEventEnum]; } @@ -91,6 +91,7 @@ private static function stubSuccess(): PromiseInterface /** * @throws RequestException + * * @dataProvider notFoundErrorProvider */ final public function testWebhookErrorNotFound(string $returnCode, Closure $stub): void @@ -111,4 +112,4 @@ final public function testWebhookErrorNotFound(string $returnCode, Closure $stub throw $exception; } } -} \ No newline at end of file +} diff --git a/tests/Integration/Report/ConciliationFileTest.php b/tests/Integration/Report/ConciliationFileTest.php index 47b69e2..2b8619f 100644 --- a/tests/Integration/Report/ConciliationFileTest.php +++ b/tests/Integration/Report/ConciliationFileTest.php @@ -12,7 +12,6 @@ class ConciliationFileTest extends TestCase { - /** * @return void */ @@ -34,44 +33,44 @@ public function testSuccess() $this->assertArrayHasKey('movement', $response); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "movement" => [ + 'movement' => [ [ - "DigitableLine" => "03399492813698211200901537301028400000000000000 ", - "AccountDate" => "2022-06-01T00:00:00", - "Value" => 304.1, - "TransactionType" => 1, - "TransactionDateTime" => "2022-06-01T20:00:00", - "TransactionCode" => "RECEBERCONTA", - "TransactionId" => 815977512, - "NSU" => 97102, - "ExternalTerminal" => "TesteMockado-6C59770F-4A0A-4429-9C39-0ADBFFCDB525", - "ExternalNSU" => 2105324538, - "PaymentMethod" => 2, + 'DigitableLine' => '03399492813698211200901537301028400000000000000 ', + 'AccountDate' => '2022-06-01T00:00:00', + 'Value' => 304.1, + 'TransactionType' => 1, + 'TransactionDateTime' => '2022-06-01T20:00:00', + 'TransactionCode' => 'RECEBERCONTA', + 'TransactionId' => 815977512, + 'NSU' => 97102, + 'ExternalTerminal' => 'TesteMockado-6C59770F-4A0A-4429-9C39-0ADBFFCDB525', + 'ExternalNSU' => 2105324538, + 'PaymentMethod' => 2, ], [ - "DigitableLine" => "03399492813698211200901537301028400000000000000 ", - "AccountDate" => "2022-06-01T00:00:00", - "Value" => 354.7, - "TransactionType" => 1, - "TransactionDateTime" => "2022-06-01T15:00:00", - "TransactionCode" => "RECEBERCONTA", - "TransactionId" => 815977513, - "NSU" => 2107, - "ExternalTerminal" => "TesteMockado-3A977B5E-631D-4D59-8265-F780FDD3E373", - "ExternalNSU" => 966441828, - "PaymentMethod" => 2, + 'DigitableLine' => '03399492813698211200901537301028400000000000000 ', + 'AccountDate' => '2022-06-01T00:00:00', + 'Value' => 354.7, + 'TransactionType' => 1, + 'TransactionDateTime' => '2022-06-01T15:00:00', + 'TransactionCode' => 'RECEBERCONTA', + 'TransactionId' => 815977513, + 'NSU' => 2107, + 'ExternalTerminal' => 'TesteMockado-3A977B5E-631D-4D59-8265-F780FDD3E373', + 'ExternalNSU' => 966441828, + 'PaymentMethod' => 2, ], ], - "pagination" => [ - "page" => 1, - "totalCount" => 10, - "totalPages" => 5, - "hasPrevious" => false, - "hasNext" => true, + 'pagination' => [ + 'page' => 1, + 'totalCount' => 10, + 'totalPages' => 5, + 'hasPrevious' => false, + 'hasNext' => true, ], ], Response::HTTP_OK, diff --git a/tests/Integration/Report/ConciliationFileTypesTest.php b/tests/Integration/Report/ConciliationFileTypesTest.php index 99638e0..4d8adad 100644 --- a/tests/Integration/Report/ConciliationFileTypesTest.php +++ b/tests/Integration/Report/ConciliationFileTypesTest.php @@ -11,7 +11,6 @@ class ConciliationFileTypesTest extends TestCase { - /** * @return void */ @@ -33,69 +32,69 @@ public function testSuccess() $this->assertIsArray($response); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ [ - "fileType" => 1, - "description" => "Movimentacao", + 'fileType' => 1, + 'description' => 'Movimentacao', ], [ - "fileType" => 2, - "description" => "Recusa Movimentacao", + 'fileType' => 2, + 'description' => 'Recusa Movimentacao', ], [ - "fileType" => 22, - "description" => "Transferencia Movimentacao", + 'fileType' => 22, + 'description' => 'Transferencia Movimentacao', ], [ - "fileType" => 23, - "description" => "Transferencia Recusa", + 'fileType' => 23, + 'description' => 'Transferencia Recusa', ], [ - "fileType" => 24, - "description" => "Recebimento Eletronico", + 'fileType' => 24, + 'description' => 'Recebimento Eletronico', ], [ - "fileType" => 25, - "description" => "Pagamento Eletronico", + 'fileType' => 25, + 'description' => 'Pagamento Eletronico', ], [ - "fileType" => 36, - "description" => "PIX Pagamento", + 'fileType' => 36, + 'description' => 'PIX Pagamento', ], [ - "fileType" => 37, - "description" => "PIX Recebimento", + 'fileType' => 37, + 'description' => 'PIX Recebimento', ], [ - "fileType" => 38, - "description" => "PIX Devolução de Recebimento", + 'fileType' => 38, + 'description' => 'PIX Devolução de Recebimento', ], [ - "fileType" => 39, - "description" => "PIX Devolução de Pagamento", + 'fileType' => 39, + 'description' => 'PIX Devolução de Pagamento', ], [ - "fileType" => 40, - "description" => "Recarga Internacional", + 'fileType' => 40, + 'description' => 'Recarga Internacional', ], [ - "fileType" => 41, - "description" => "PIX Aporte", + 'fileType' => 41, + 'description' => 'PIX Aporte', ], [ - "fileType" => 43, - "description" => "Pagamento DA", + 'fileType' => 43, + 'description' => 'Pagamento DA', ], [ - "fileType" => 46, - "description" => "Consulta Debito Veicular", + 'fileType' => 46, + 'description' => 'Consulta Debito Veicular', ], [ - "fileType" => 47, - "description" => "Liquidacao Debito Veicular", + 'fileType' => 47, + 'description' => 'Liquidacao Debito Veicular', ], ], Response::HTTP_OK, diff --git a/tests/Integration/Report/ConsolidatedStatementTest.php b/tests/Integration/Report/ConsolidatedStatementTest.php index 63bffa5..ecee105 100644 --- a/tests/Integration/Report/ConsolidatedStatementTest.php +++ b/tests/Integration/Report/ConsolidatedStatementTest.php @@ -12,7 +12,6 @@ class ConsolidatedStatementTest extends TestCase { - /** * @return void */ @@ -34,115 +33,115 @@ public function testSuccess() $this->assertArrayHasKey('statement', $response); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "statement" => [ + 'statement' => [ [ - "date" => "2022-01-03T00:00:00", - "accountDate" => "2022-01-03T00:00:00", - "nsa" => 5729, - "entryName" => "Pgto Contas Concessionarias/Tributos", - "entryAmount" => 47887, - "value" => -4212076.5, - "indCreditDebit" => "D", - "balance" => -1802424.5, + 'date' => '2022-01-03T00:00:00', + 'accountDate' => '2022-01-03T00:00:00', + 'nsa' => 5729, + 'entryName' => 'Pgto Contas Concessionarias/Tributos', + 'entryAmount' => 47887, + 'value' => -4212076.5, + 'indCreditDebit' => 'D', + 'balance' => -1802424.5, ], [ - "date" => "2022-01-03T00:00:00", - "accountDate" => "2022-01-03T00:00:00", - "nsa" => 5729, - "entryName" => "Pgto Contas Boletos", - "entryAmount" => 204577, - "value" => -24533722, - "indCreditDebit" => "D", - "balance" => -26336146, + 'date' => '2022-01-03T00:00:00', + 'accountDate' => '2022-01-03T00:00:00', + 'nsa' => 5729, + 'entryName' => 'Pgto Contas Boletos', + 'entryAmount' => 204577, + 'value' => -24533722, + 'indCreditDebit' => 'D', + 'balance' => -26336146, ], [ - "date" => "2022-01-03T00:00:00", - "accountDate" => "2022-01-03T00:00:00", - "nsa" => 5729, - "entryName" => "Recarga", - "entryAmount" => 103422, - "value" => -1746272.9, - "indCreditDebit" => "D", - "balance" => -28082420, + 'date' => '2022-01-03T00:00:00', + 'accountDate' => '2022-01-03T00:00:00', + 'nsa' => 5729, + 'entryName' => 'Recarga', + 'entryAmount' => 103422, + 'value' => -1746272.9, + 'indCreditDebit' => 'D', + 'balance' => -28082420, ], [ - "date" => "2022-01-03T00:00:00", - "accountDate" => "2022-01-03T00:00:00", - "entryName" => "Depósito", - "entryAmount" => 20, - "value" => 12520000, - "indCreditDebit" => "C", - "balance" => -22277410, + 'date' => '2022-01-03T00:00:00', + 'accountDate' => '2022-01-03T00:00:00', + 'entryName' => 'Depósito', + 'entryAmount' => 20, + 'value' => 12520000, + 'indCreditDebit' => 'C', + 'balance' => -22277410, ], [ - "date" => "2022-01-03T00:00:00", - "accountDate" => "2022-01-03T00:00:00", - "entryName" => "Estorno de Contas", - "entryAmount" => 113, - "value" => 4824.52, - "indCreditDebit" => "C", - "balance" => -22272586, + 'date' => '2022-01-03T00:00:00', + 'accountDate' => '2022-01-03T00:00:00', + 'entryName' => 'Estorno de Contas', + 'entryAmount' => 113, + 'value' => 4824.52, + 'indCreditDebit' => 'C', + 'balance' => -22272586, ], [ - "date" => "2022-01-03T00:00:00", - "accountDate" => "2022-01-03T00:00:00", - "entryName" => "Estorno de Conta - Desfazimento", - "entryAmount" => 1, - "value" => 55, - "indCreditDebit" => "C", - "balance" => -22272530, + 'date' => '2022-01-03T00:00:00', + 'accountDate' => '2022-01-03T00:00:00', + 'entryName' => 'Estorno de Conta - Desfazimento', + 'entryAmount' => 1, + 'value' => 55, + 'indCreditDebit' => 'C', + 'balance' => -22272530, ], [ - "date" => "2022-01-03T00:00:00", - "accountDate" => "2022-01-03T00:00:00", - "entryName" => "Devolução Transferencias", - "entryAmount" => 69, - "value" => 19452.8, - "indCreditDebit" => "C", - "balance" => -22253078, + 'date' => '2022-01-03T00:00:00', + 'accountDate' => '2022-01-03T00:00:00', + 'entryName' => 'Devolução Transferencias', + 'entryAmount' => 69, + 'value' => 19452.8, + 'indCreditDebit' => 'C', + 'balance' => -22253078, ], [ - "date" => "2022-01-03T00:00:00", - "accountDate" => "2022-01-03T00:00:00", - "entryName" => "Transferencias", - "entryAmount" => 775, - "value" => -292824.75, - "indCreditDebit" => "D", - "balance" => -28375244, + 'date' => '2022-01-03T00:00:00', + 'accountDate' => '2022-01-03T00:00:00', + 'entryName' => 'Transferencias', + 'entryAmount' => 775, + 'value' => -292824.75, + 'indCreditDebit' => 'D', + 'balance' => -28375244, ], [ - "date" => "2022-01-03T00:00:00", - "accountDate" => "2022-01-03T00:00:00", - "entryName" => "Pagamento Eletronico", - "entryAmount" => 345, - "value" => 268750, - "indCreditDebit" => "C", - "balance" => -21984328, + 'date' => '2022-01-03T00:00:00', + 'accountDate' => '2022-01-03T00:00:00', + 'entryName' => 'Pagamento Eletronico', + 'entryAmount' => 345, + 'value' => 268750, + 'indCreditDebit' => 'C', + 'balance' => -21984328, ], [ - "date" => "2022-01-03T00:00:00", - "accountDate" => "2022-01-03T00:00:00", - "entryName" => "Recebimento Eletronico", - "entryAmount" => 7, - "value" => -920, - "indCreditDebit" => "D", - "balance" => -28376164, + 'date' => '2022-01-03T00:00:00', + 'accountDate' => '2022-01-03T00:00:00', + 'entryName' => 'Recebimento Eletronico', + 'entryAmount' => 7, + 'value' => -920, + 'indCreditDebit' => 'D', + 'balance' => -28376164, ], ], - "balance" => [ - "balanceStartDate" => 2409652.2, - "balanceEndDate" => -210270.39, + 'balance' => [ + 'balanceStartDate' => 2409652.2, + 'balanceEndDate' => -210270.39, ], - "pagination" => [ - "page" => 1, - "totalCount" => 16, - "totalPages" => 2, - "hasPrevious" => false, - "hasNext" => true, + 'pagination' => [ + 'page' => 1, + 'totalCount' => 16, + 'totalPages' => 2, + 'hasPrevious' => false, + 'hasNext' => true, ], ], Response::HTTP_OK, diff --git a/tests/Integration/Topups/CancelTest.php b/tests/Integration/Topups/CancelTest.php index 1458720..6eb00b6 100644 --- a/tests/Integration/Topups/CancelTest.php +++ b/tests/Integration/Topups/CancelTest.php @@ -12,7 +12,6 @@ class CancelTest extends TestCase { - /** * @return void */ @@ -33,20 +32,20 @@ public function testSuccess() $response = $topups->cancel( 817981290, new Cancel([ - "externalNSU" => 1234, - "externalTerminal" => "teste2", + 'externalNSU' => 1234, + 'externalTerminal' => 'teste2', ]), ); $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/Topups/ConfirmTest.php b/tests/Integration/Topups/ConfirmTest.php index aab45f2..a6d9328 100644 --- a/tests/Integration/Topups/ConfirmTest.php +++ b/tests/Integration/Topups/ConfirmTest.php @@ -12,7 +12,6 @@ class ConfirmTest extends TestCase { - /** * @return void */ @@ -33,20 +32,20 @@ public function testSuccess() $response = $topups->confirm( 817981234, new Confirm([ - "externalNSU" => 1234, - "externalTerminal" => "teste2", + 'externalNSU' => 1234, + 'externalTerminal' => 'teste2', ]), ); $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/Topups/CreateTest.php b/tests/Integration/Topups/CreateTest.php index 2fe7df7..df111e1 100644 --- a/tests/Integration/Topups/CreateTest.php +++ b/tests/Integration/Topups/CreateTest.php @@ -12,7 +12,6 @@ class CreateTest extends TestCase { - /** * @return void */ @@ -32,46 +31,46 @@ public function testSuccess() $topups = new CelcoinTopups(); $response = $topups->create( new Create([ - "externalTerminal" => "teste2", - "externalNsu" => 1234, - "topupData" => [ - "value" => 15, + 'externalTerminal' => 'teste2', + 'externalNsu' => 1234, + 'topupData' => [ + 'value' => 15, ], - "cpfCnpj" => "19941206066", - "signerCode" => "1234567", - "providerId" => 2086, - "phone" => [ - "stateCode" => 31, - "countryCode" => 55, - "number" => 991452026, + 'cpfCnpj' => '19941206066', + 'signerCode' => '1234567', + 'providerId' => 2086, + 'phone' => [ + 'stateCode' => 31, + 'countryCode' => 55, + 'number' => 991452026, ], ]), ); $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "NSUnameProvider" => 610761, - "authentication" => 6003, - "authenticationAPI" => [ - "Bloco1" => "DA.53.00.C9.57.A2.6E.8E", - "Bloco2" => "8A.DB.0B.8E.17.F1.78.97", - "BlocoCompleto" => "DA.53.00.C9.57.A2.6E.8E.8A.DB.0B.8E.17.F1.78.97", + 'NSUnameProvider' => 610761, + 'authentication' => 6003, + 'authenticationAPI' => [ + 'Bloco1' => 'DA.53.00.C9.57.A2.6E.8E', + 'Bloco2' => '8A.DB.0B.8E.17.F1.78.97', + 'BlocoCompleto' => 'DA.53.00.C9.57.A2.6E.8E.8A.DB.0B.8E.17.F1.78.97', ], - "receipt" => [ - "receiptData" => "", - "receiptformatted" => "\n TESTE\n PROTOCOLO 0817981234\n 1 14/07/2023 17:46\n TERM 228001 AGENTE 228001 AUTE 06003\n ----------------------------------------\n AUTO 987535 RECARGA\n \n PRODUTO: TIM\n ASSINANTE: 1234567\n TELEFONE: 11 941497981\n NSU OPERADORA: 610761\n DATA: 14/07/2023 17:46\n VALOR: R$ 15,00\n \n VIVO TURBO: INTERNET + LIGACOES E SMS\n ILIMITADOS PARA VIVO (CEL E FIXO, USANDO\n O 15)APENAS R$9,99 POR SEMANA. LIGUE\n *9003 E CADASTRE SE!\n ----------------------------------------\n AUTENTICACAO\n DA.53.00.C9.57.A2.6E.8E\n 8A.DB.0B.8E.17.F1.78.97\n ----------------------------------------\n \n ", + 'receipt' => [ + 'receiptData' => '', + 'receiptformatted' => "\n TESTE\n PROTOCOLO 0817981234\n 1 14/07/2023 17:46\n TERM 228001 AGENTE 228001 AUTE 06003\n ----------------------------------------\n AUTO 987535 RECARGA\n \n PRODUTO: TIM\n ASSINANTE: 1234567\n TELEFONE: 11 941497981\n NSU OPERADORA: 610761\n DATA: 14/07/2023 17:46\n VALOR: R$ 15,00\n \n VIVO TURBO: INTERNET + LIGACOES E SMS\n ILIMITADOS PARA VIVO (CEL E FIXO, USANDO\n O 15)APENAS R$9,99 POR SEMANA. LIGUE\n *9003 E CADASTRE SE!\n ----------------------------------------\n AUTENTICACAO\n DA.53.00.C9.57.A2.6E.8E\n 8A.DB.0B.8E.17.F1.78.97\n ----------------------------------------\n \n ", ], - "settleDate" => "2023-07-14T00:00:00", - "createDate" => "2023-07-14T17:46:43", - "transactionId" => 817981234, - "Urlreceipt" => null, - "errorCode" => "000", - "message" => null, - "status" => 0, + 'settleDate' => '2023-07-14T00:00:00', + 'createDate' => '2023-07-14T17:46:43', + 'transactionId' => 817981234, + 'Urlreceipt' => null, + 'errorCode' => '000', + 'message' => null, + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/Topups/FindProvidersTest.php b/tests/Integration/Topups/FindProvidersTest.php index 302d792..f8e6950 100644 --- a/tests/Integration/Topups/FindProvidersTest.php +++ b/tests/Integration/Topups/FindProvidersTest.php @@ -11,7 +11,6 @@ class FindProvidersTest extends TestCase { - /** * @return void */ @@ -33,15 +32,15 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "nameProvider" => "Vivo", - "providerId" => 2088, - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'nameProvider' => 'Vivo', + 'providerId' => 2088, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/Topups/GetProviderValueTest.php b/tests/Integration/Topups/GetProviderValueTest.php index 65e7334..6479f9b 100644 --- a/tests/Integration/Topups/GetProviderValueTest.php +++ b/tests/Integration/Topups/GetProviderValueTest.php @@ -12,7 +12,6 @@ class GetProviderValueTest extends TestCase { - /** * @return void */ @@ -32,59 +31,59 @@ public function testSuccess() $topups = new CelcoinTopups(); $response = $topups->getProviderValues( new ProvidersValues([ - "stateCode" => 13, - "providerId" => '2125', + 'stateCode' => 13, + 'providerId' => '2125', ]), ); $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "value" => [ + 'value' => [ [ - "properties" => null, - "code" => 0, - "cost" => 0, - "detail" => "", - "productName" => "R$ 85,99 - Xbox Live 3 meses", - "checkSum" => -18913591, - "dueProduct" => 0, - "valueBonus" => 0, - "maxValue" => 85.99, - "minValue" => 85.99, + 'properties' => null, + 'code' => 0, + 'cost' => 0, + 'detail' => '', + 'productName' => 'R$ 85,99 - Xbox Live 3 meses', + 'checkSum' => -18913591, + 'dueProduct' => 0, + 'valueBonus' => 0, + 'maxValue' => 85.99, + 'minValue' => 85.99, ], [ - "properties" => null, - "code" => 0, - "cost" => 0, - "detail" => "", - "productName" => "R$ 171,98 - Xbox Live 6 meses", - "checkSum" => -2147483640, - "dueProduct" => 0, - "valueBonus" => 0, - "maxValue" => 171.89, - "minValue" => 171.98, + 'properties' => null, + 'code' => 0, + 'cost' => 0, + 'detail' => '', + 'productName' => 'R$ 171,98 - Xbox Live 6 meses', + 'checkSum' => -2147483640, + 'dueProduct' => 0, + 'valueBonus' => 0, + 'maxValue' => 171.89, + 'minValue' => 171.98, ], [ - "properties" => null, - "code" => 0, - "cost" => 0, - "detail" => "", - "productName" => "R$ 199,00 - Xbox Live 12 meses", - "checkSum" => -18913591, - "dueProduct" => 0, - "valueBonus" => 0, - "maxValue" => 199, - "minValue" => 199, + 'properties' => null, + 'code' => 0, + 'cost' => 0, + 'detail' => '', + 'productName' => 'R$ 199,00 - Xbox Live 12 meses', + 'checkSum' => -18913591, + 'dueProduct' => 0, + 'valueBonus' => 0, + 'maxValue' => 199, + 'minValue' => 199, ], ], - "externalNsuQuery" => null, - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'externalNsuQuery' => null, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/Topups/GetProvidersTest.php b/tests/Integration/Topups/GetProvidersTest.php index 438e8ef..bca3baf 100644 --- a/tests/Integration/Topups/GetProvidersTest.php +++ b/tests/Integration/Topups/GetProvidersTest.php @@ -14,7 +14,6 @@ class GetProvidersTest extends TestCase { - /** * @return void */ @@ -34,36 +33,36 @@ public function testSuccess() $topups = new CelcoinTopups(); $response = $topups->getProviders( new Providers([ - "stateCode" => 13, - "type" => TopupProvidersTypeEnum::ALL, - "category" => TopupProvidersCategoryEnum::ALL, + 'stateCode' => 13, + 'type' => TopupProvidersTypeEnum::ALL, + 'category' => TopupProvidersCategoryEnum::ALL, ]), ); $this->assertArrayHasKey('providers', $response); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "providers" => [ + 'providers' => [ [ - "category" => 2, - "name" => "Blizzard", - "providerId" => 2139, - "RegionaisnameProvider" => [], - "TipoRecarganameProvider" => 1, - "maxValue" => 0, - "minValue" => 0, + 'category' => 2, + 'name' => 'Blizzard', + 'providerId' => 2139, + 'RegionaisnameProvider' => [], + 'TipoRecarganameProvider' => 1, + 'maxValue' => 0, + 'minValue' => 0, ], [ - "category" => 2, - "name" => "Boa Compra", - "providerId" => 2107, - "RegionaisnameProvider" => [], - "TipoRecarganameProvider" => 1, - "maxValue" => 0, - "minValue" => 0, + 'category' => 2, + 'name' => 'Boa Compra', + 'providerId' => 2107, + 'RegionaisnameProvider' => [], + 'TipoRecarganameProvider' => 1, + 'maxValue' => 0, + 'minValue' => 0, ], ], ], diff --git a/tests/Integration/TopupsInternational/CancelTest.php b/tests/Integration/TopupsInternational/CancelTest.php index 4133f43..a8f3736 100644 --- a/tests/Integration/TopupsInternational/CancelTest.php +++ b/tests/Integration/TopupsInternational/CancelTest.php @@ -12,7 +12,6 @@ class CancelTest extends TestCase { - /** * @return void */ @@ -33,20 +32,20 @@ public function testSuccess() $response = $topups->cancel( 817981439, new Cancel([ - "externalNSU" => 1234, - "externalTerminal" => "1123123123", + 'externalNSU' => 1234, + 'externalTerminal' => '1123123123', ]), ); $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/TopupsInternational/ConfirmTest.php b/tests/Integration/TopupsInternational/ConfirmTest.php index f57bb00..19d318a 100644 --- a/tests/Integration/TopupsInternational/ConfirmTest.php +++ b/tests/Integration/TopupsInternational/ConfirmTest.php @@ -12,7 +12,6 @@ class ConfirmTest extends TestCase { - /** * @return void */ @@ -33,20 +32,20 @@ public function testSuccess() $response = $topups->confirm( 817981428, new Confirm([ - "externalNSU" => 123, - "externalTerminal" => "41233", + 'externalNSU' => 123, + 'externalTerminal' => '41233', ]), ); $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/TopupsInternational/CreateTest.php b/tests/Integration/TopupsInternational/CreateTest.php index 8de51ae..3e4b0e9 100644 --- a/tests/Integration/TopupsInternational/CreateTest.php +++ b/tests/Integration/TopupsInternational/CreateTest.php @@ -12,7 +12,6 @@ class CreateTest extends TestCase { - /** * @return void */ @@ -32,38 +31,38 @@ public function testSuccess() $topups = new CelcoinInternationalTopups(); $response = $topups->create( new Create([ - "phone" => [ - "number" => 48227030, - "countryCode" => 509, + 'phone' => [ + 'number' => 48227030, + 'countryCode' => 509, ], - "cpfCnpj" => "35914746817", - "externalNsu" => 123231312, - "externalTerminal" => "6958", - "value" => "5.4300", - "topupProductId" => "5", + 'cpfCnpj' => '35914746817', + 'externalNsu' => 123231312, + 'externalTerminal' => '6958', + 'value' => '5.4300', + 'topupProductId' => '5', ]), ); $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "NSUnameProvider" => 0, - "authentication" => 4167, - "authenticationAPI" => null, - "receipt" => [ - "receiptData" => "", - "receiptformatted" => " TESTE\r\n PROTOCOLO 0816057734\r\n1 06/04/2022 14:29\r\nTERM 228001 AGENTE 228001 AUTE 04167\r\n----------------------------------------\r\nAUTO 907545 RECARGA INTERNACIONAL\r\nVALOR :R$ 5,43\r\nOPERADORA : DIGICEL HAITI BRL\r\nNUMERO : 50948227030\r\nMOEDA : BRL\r\nVALORLOCAL : \r\nNSU : \r\n----------------------------------------\r\n\r\n", + 'NSUnameProvider' => 0, + 'authentication' => 4167, + 'authenticationAPI' => null, + 'receipt' => [ + 'receiptData' => '', + 'receiptformatted' => " TESTE\r\n PROTOCOLO 0816057734\r\n1 06/04/2022 14:29\r\nTERM 228001 AGENTE 228001 AUTE 04167\r\n----------------------------------------\r\nAUTO 907545 RECARGA INTERNACIONAL\r\nVALOR :R$ 5,43\r\nOPERADORA : DIGICEL HAITI BRL\r\nNUMERO : 50948227030\r\nMOEDA : BRL\r\nVALORLOCAL : \r\nNSU : \r\n----------------------------------------\r\n\r\n", ], - "settleDate" => "0001-01-01T00:00:00", - "createDate" => "2022-04-06T14:29:27", - "transactionId" => 816057734, - "Urlreceipt" => null, - "errorCode" => "000", - "message" => null, - "status" => 0, + 'settleDate' => '0001-01-01T00:00:00', + 'createDate' => '2022-04-06T14:29:27', + 'transactionId' => 816057734, + 'Urlreceipt' => null, + 'errorCode' => '000', + 'message' => null, + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/TopupsInternational/GetCountriesTest.php b/tests/Integration/TopupsInternational/GetCountriesTest.php index f7b98ce..dd3c329 100644 --- a/tests/Integration/TopupsInternational/GetCountriesTest.php +++ b/tests/Integration/TopupsInternational/GetCountriesTest.php @@ -11,7 +11,6 @@ class GetCountriesTest extends TestCase { - /** * @return void */ @@ -33,20 +32,20 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "countrys" => [ + 'countrys' => [ [ - "flagURL" => "https://restcountries.eu/data/guf.svg", - "code" => "+594", - "name" => "French Guiana", + 'flagURL' => 'https://restcountries.eu/data/guf.svg', + 'code' => '+594', + 'name' => 'French Guiana', ], ], - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/Integration/TopupsInternational/GetValuesTest.php b/tests/Integration/TopupsInternational/GetValuesTest.php index 2e4708d..2bdf404 100644 --- a/tests/Integration/TopupsInternational/GetValuesTest.php +++ b/tests/Integration/TopupsInternational/GetValuesTest.php @@ -11,7 +11,6 @@ class GetValuesTest extends TestCase { - /** * @return void */ @@ -33,30 +32,30 @@ public function testSuccess() $this->assertEquals(0, $response['status']); } - static private function stubSuccess(): PromiseInterface + private static function stubSuccess(): PromiseInterface { return Http::response( [ - "data" => [ - "quotation" => [ - "purchase" => "5.2468", - "quotationId" => "206353", - "quotationDateTime" => "2021-08-13T13:04:27.62", - "description" => "PTAX (Banco Central)", - "spread" => "10", - "sale" => "5.2474", + 'data' => [ + 'quotation' => [ + 'purchase' => '5.2468', + 'quotationId' => '206353', + 'quotationDateTime' => '2021-08-13T13:04:27.62', + 'description' => 'PTAX (Banco Central)', + 'spread' => '10', + 'sale' => '5.2474', ], - "baseCurrency" => "BRL", - "destinyCurrency" => "BRL", - "localCurrency" => "HTG", - "number" => "50948227030", - "nameProvider" => "Digicel Haiti BRL", - "country" => "Haiti", - "products" => [], + 'baseCurrency' => 'BRL', + 'destinyCurrency' => 'BRL', + 'localCurrency' => 'HTG', + 'number' => '50948227030', + 'nameProvider' => 'Digicel Haiti BRL', + 'country' => 'Haiti', + 'products' => [], ], - "errorCode" => "000", - "message" => "SUCESSO", - "status" => 0, + 'errorCode' => '000', + 'message' => 'SUCESSO', + 'status' => 0, ], Response::HTTP_OK, ); diff --git a/tests/TestCase.php b/tests/TestCase.php index 83dfd47..32a5f24 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -11,9 +11,6 @@ abstract class TestCase extends BaseTestCase { use CreatesApplication; - /** - * @return void - */ public function setUp(): void { parent::setUp(); @@ -28,7 +25,7 @@ protected function getPackageProviders($app) protected function getEnvironmentSetUp($app) { - $root = __DIR__ . '/../'; + $root = __DIR__.'/../'; $dotenv = Dotenv::createImmutable($root); $dotenv->safeLoad(); $app['config']->set('cache.default', env('CACHE_DRIVER', 'file')); From 36454490c467ab81e50849750c811453d90a1216 Mon Sep 17 00:00:00 2001 From: Adeildo Amorim Date: Thu, 11 Apr 2024 21:37:52 -0300 Subject: [PATCH 4/8] [Merge] merge with main --- src/Clients/CelcoinBAASBillet.php | 7 +++- src/Common/CelcoinBaseApi.php | 35 +++++++++---------- src/Interfaces/Attachable.php | 2 ++ src/Rules/BAAS/Billet.php | 4 +-- src/Types/BAAS/Billet.php | 6 +--- src/Types/KYC/KycDocument.php | 5 +++ .../BAAS/CelcoinBASSBilletTest.php | 4 +-- tests/Integration/PIX/COB/COBCreateTest.php | 6 ++-- tests/Integration/PIX/COB/COBDeteleTest.php | 14 ++++---- tests/Integration/PIX/COB/COBFetchTest.php | 6 ++-- tests/Integration/PIX/COB/COBPayloadTest.php | 6 ++-- tests/Integration/PIX/COB/COBUpdateTest.php | 6 ++-- .../Integration/PIX/COBV/COBVPayloadTest.php | 6 ++-- tests/TestCase.php | 2 ++ 14 files changed, 57 insertions(+), 52 deletions(-) diff --git a/src/Clients/CelcoinBAASBillet.php b/src/Clients/CelcoinBAASBillet.php index 4125dcc..a8ee0c3 100644 --- a/src/Clients/CelcoinBAASBillet.php +++ b/src/Clients/CelcoinBAASBillet.php @@ -10,7 +10,7 @@ class CelcoinBAASBillet extends CelcoinBaseApi { - public const BILLET_URL = '/api-integration-baas-webservice/v1/charge'; + const BILLET_URL = '/baas/v2/Charge'; /** * @throws RequestException @@ -42,4 +42,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)); + } } diff --git a/src/Common/CelcoinBaseApi.php b/src/Common/CelcoinBaseApi.php index 5c461f9..9f8a41e 100644 --- a/src/Common/CelcoinBaseApi.php +++ b/src/Common/CelcoinBaseApi.php @@ -78,10 +78,8 @@ public function get(string $endpoint, array|string|null $query = null, $response { $token = $this->getToken() ?? $this->auth->getToken(); $request = Http::withToken($token) - ->withHeaders([ - 'accept' => 'application/json', - 'content-type' => 'application/json', - ]); + ->asJson() + ->acceptJson(); if ($this->mtlsCert && $this->mtlsKey && $this->mtlsPassphrase) { $request = $this->setRequestMtls($request); @@ -100,10 +98,8 @@ public function post(string $endpoint, array $body = [], ?Attachable $attachment { $token = $this->getToken() ?? $this->auth->getToken(); $request = Http::withToken($token) - ->withHeaders([ - 'accept' => 'application/json', - 'content-type' => 'application/json', - ]); + ->asJson() + ->acceptJson(); if ($this->mtlsCert && $this->mtlsKey && $this->mtlsPassphrase) { $request = $this->setRequestMtls($request); @@ -112,11 +108,18 @@ public function post(string $endpoint, array $body = [], ?Attachable $attachment foreach ($body as $field => $document) { if ($document instanceof File) { $request->attach($field, $document->getContent(), $document->getFileName()); + $request->contentType('multipart/form-data; boundary=*'); } } if ($attachment) { - $request->attach($attachment->getField(), $attachment->getContents(), $attachment->getFileName()); + $request->attach( + $attachment->getField(), + $attachment->getContents(), + $attachment->getFileName(), + $attachment->getHeaders() + ); + $request->contentType('multipart/form-data; boundary=*'); } return $request->post($this->getFinalUrl($endpoint), $body) @@ -133,10 +136,8 @@ public function put( ): mixed { $token = $this->getToken() ?? $this->auth->getToken(); $request = Http::withToken($token) - ->withHeaders([ - 'accept' => 'application/json', - 'content-type' => 'application/json', - ]); + ->asJson() + ->acceptJson(); if ($this->mtlsCert && $this->mtlsKey && $this->mtlsPassphrase) { $request = $this->setRequestMtls($request); @@ -158,11 +159,9 @@ public function patch( $body_format = $asJson ? 'json' : 'form_params'; $token = $this->getToken() ?? $this->auth->getToken(); $request = Http::withToken($token) - ->bodyFormat($body_format) - ->withHeaders([ - 'accept' => 'application/json', - 'content-type' => 'application/json', - ]); + ->asJson() + ->acceptJson() + ->bodyFormat($body_format); if ($this->mtlsCert && $this->mtlsKey && $this->mtlsPassphrase) { $request = $this->setRequestMtls($request); diff --git a/src/Interfaces/Attachable.php b/src/Interfaces/Attachable.php index 2be6cff..caac94e 100644 --- a/src/Interfaces/Attachable.php +++ b/src/Interfaces/Attachable.php @@ -9,4 +9,6 @@ public function getField(): string; public function getContents(); public function getFileName(); + + public function getHeaders(): array; } diff --git a/src/Rules/BAAS/Billet.php b/src/Rules/BAAS/Billet.php index 9a51aee..523a7fc 100644 --- a/src/Rules/BAAS/Billet.php +++ b/src/Rules/BAAS/Billet.php @@ -8,11 +8,9 @@ public static function rules(): array { return [ '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'], 'debtor.name' => ['required', 'string', 'max: 25'], 'debtor.document' => ['required'], diff --git a/src/Types/BAAS/Billet.php b/src/Types/BAAS/Billet.php index 8159240..77612f4 100644 --- a/src/Types/BAAS/Billet.php +++ b/src/Types/BAAS/Billet.php @@ -8,16 +8,12 @@ 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; - public BilletDebtor $debtor; public BilletReceiver $receiver; diff --git a/src/Types/KYC/KycDocument.php b/src/Types/KYC/KycDocument.php index 8754ad2..de0ca2b 100644 --- a/src/Types/KYC/KycDocument.php +++ b/src/Types/KYC/KycDocument.php @@ -42,4 +42,9 @@ public function getField(): string { return $this->field; } + + public function getHeaders(): array + { + return ['Content-Type' => $this->file->getMimeType()]; + } } diff --git a/tests/Integration/BAAS/CelcoinBASSBilletTest.php b/tests/Integration/BAAS/CelcoinBASSBilletTest.php index b0772a2..b19f165 100644 --- a/tests/Integration/BAAS/CelcoinBASSBilletTest.php +++ b/tests/Integration/BAAS/CelcoinBASSBilletTest.php @@ -47,10 +47,8 @@ public static function billetBodyRequest(): Billet return new 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([ 'name' => 'João teste de teste', 'document' => '12345678910', diff --git a/tests/Integration/PIX/COB/COBCreateTest.php b/tests/Integration/PIX/COB/COBCreateTest.php index 42cedf8..ca4e55c 100644 --- a/tests/Integration/PIX/COB/COBCreateTest.php +++ b/tests/Integration/PIX/COB/COBCreateTest.php @@ -143,9 +143,9 @@ private static function stubCOBError(): PromiseInterface { return Http::response( [ - 'message' => 'Can\'t create a new PixImmediateCollection when the location type is COB', - 'errorCode' => 'PBE410', - ], + 'message' => 'Can\'t create a new PixImmediateCollection when the location type is COB', + 'errorCode' => 'PBE410', + ], Response::HTTP_BAD_REQUEST, ); } diff --git a/tests/Integration/PIX/COB/COBDeteleTest.php b/tests/Integration/PIX/COB/COBDeteleTest.php index 83a1d8e..0d44883 100644 --- a/tests/Integration/PIX/COB/COBDeteleTest.php +++ b/tests/Integration/PIX/COB/COBDeteleTest.php @@ -33,10 +33,10 @@ private function stubSuccess(): PromiseInterface { return Http::response( [ - 'transactionId' => 817849688, - 'status' => 200, - 'message' => '200', - ], + 'transactionId' => 817849688, + 'status' => 200, + 'message' => '200', + ], Response::HTTP_OK, ); } @@ -71,9 +71,9 @@ private function stubError(): PromiseInterface { return Http::response( [ - 'statusCode' => 404, - 'message' => 'Resource not found', - ], + 'statusCode' => 404, + 'message' => 'Resource not found', + ], Response::HTTP_NOT_FOUND, ); } diff --git a/tests/Integration/PIX/COB/COBFetchTest.php b/tests/Integration/PIX/COB/COBFetchTest.php index ba3c5bd..1f90a90 100644 --- a/tests/Integration/PIX/COB/COBFetchTest.php +++ b/tests/Integration/PIX/COB/COBFetchTest.php @@ -103,9 +103,9 @@ private static function stubNotFound(): PromiseInterface { return Http::response( [ - 'message' => 'Não foi possível localizar a cobrança associada ao parâmetro informado.', - 'errorCode' => 'VL002', - ], + 'message' => 'Não foi possível localizar a cobrança associada ao parâmetro informado.', + 'errorCode' => 'VL002', + ], Response::HTTP_BAD_REQUEST, ); } diff --git a/tests/Integration/PIX/COB/COBPayloadTest.php b/tests/Integration/PIX/COB/COBPayloadTest.php index 4118db0..b348b5d 100644 --- a/tests/Integration/PIX/COB/COBPayloadTest.php +++ b/tests/Integration/PIX/COB/COBPayloadTest.php @@ -98,9 +98,9 @@ private static function stubNotFound(): PromiseInterface { return Http::response( [ - 'message' => 'Não foi possível localizar a cobrança associada ao parâmetro informado.', - 'errorCode' => 'VL002', - ], + 'message' => 'Não foi possível localizar a cobrança associada ao parâmetro informado.', + 'errorCode' => 'VL002', + ], Response::HTTP_BAD_REQUEST, ); } diff --git a/tests/Integration/PIX/COB/COBUpdateTest.php b/tests/Integration/PIX/COB/COBUpdateTest.php index 949bbea..24e1e28 100644 --- a/tests/Integration/PIX/COB/COBUpdateTest.php +++ b/tests/Integration/PIX/COB/COBUpdateTest.php @@ -144,9 +144,9 @@ private static function stubCOBError(): PromiseInterface { return Http::response( [ - 'message' => 'Can\'t create a new Pix Collection when there is another Pix Collection active with the same location.', - 'errorCode' => 'PBE318', - ], + 'message' => 'Can\'t create a new Pix Collection when there is another Pix Collection active with the same location.', + 'errorCode' => 'PBE318', + ], Response::HTTP_BAD_REQUEST, ); } diff --git a/tests/Integration/PIX/COBV/COBVPayloadTest.php b/tests/Integration/PIX/COBV/COBVPayloadTest.php index 9d97c2e..972a191 100644 --- a/tests/Integration/PIX/COBV/COBVPayloadTest.php +++ b/tests/Integration/PIX/COBV/COBVPayloadTest.php @@ -125,9 +125,9 @@ private static function stubNotFound(): PromiseInterface { return Http::response( [ - 'message' => 'The BRCode is expired and can\'t be paid.', - 'errorCode' => '400', - ], + 'message' => 'The BRCode is expired and can\'t be paid.', + 'errorCode' => '400', + ], Response::HTTP_BAD_REQUEST, ); } diff --git a/tests/TestCase.php b/tests/TestCase.php index 32a5f24..e021b23 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -4,6 +4,7 @@ use Dotenv\Dotenv; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; +use Illuminate\Support\Facades\Http; use Orchestra\Testbench\Concerns\CreatesApplication; use WeDevBr\Celcoin\CelcoinServiceProvider; @@ -14,6 +15,7 @@ abstract class TestCase extends BaseTestCase public function setUp(): void { parent::setUp(); + Http::preventStrayRequests(); } protected function getPackageProviders($app) From 5c174e1114226546abfe725564213980125bcb88 Mon Sep 17 00:00:00 2001 From: Michael de Oliveira Ferreira Date: Thu, 11 Apr 2024 21:40:15 -0300 Subject: [PATCH 5/8] fix: fix test --- tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php | 2 +- tests/Integration/PIX/DICT/PixKeyClaimTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php b/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php index d77edbe..95af76a 100644 --- a/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php +++ b/tests/Integration/PIX/DICT/PixKeyClaimConsultTest.php @@ -88,7 +88,7 @@ public function testClaimBadRequest() Http::fake( [ config('celcoin.login_url') => GlobalStubs::loginResponse(), - CelcoinPIXDICT::POST_VERIFY_DICT.'/*' => self::stubBadRequest(), + CelcoinPIXDICT::CLAIM_DICT.'/*' => self::stubBadRequest(), ], ); diff --git a/tests/Integration/PIX/DICT/PixKeyClaimTest.php b/tests/Integration/PIX/DICT/PixKeyClaimTest.php index 50a3b2c..bb436eb 100644 --- a/tests/Integration/PIX/DICT/PixKeyClaimTest.php +++ b/tests/Integration/PIX/DICT/PixKeyClaimTest.php @@ -90,7 +90,7 @@ public function testClaimBadRequest() Http::fake( [ config('celcoin.login_url') => GlobalStubs::loginResponse(), - CelcoinPIXDICT::POST_VERIFY_DICT => self::stubBadRequest(), + CelcoinPIXDICT::CLAIM_DICT => self::stubBadRequest(), ], ); From c51c652a4e00fb402f4de4f4b6bd69d51d1de5c0 Mon Sep 17 00:00:00 2001 From: Adeildo Amorim Date: Thu, 11 Apr 2024 21:43:47 -0300 Subject: [PATCH 6/8] [Fix] Fixed Register pix key accepting nullable --- src/Rules/BAAS/RegisterPixKey.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Rules/BAAS/RegisterPixKey.php b/src/Rules/BAAS/RegisterPixKey.php index 5cecdc4..b548826 100644 --- a/src/Rules/BAAS/RegisterPixKey.php +++ b/src/Rules/BAAS/RegisterPixKey.php @@ -13,7 +13,7 @@ public static function rules() return [ 'account' => ['required', 'string'], 'keyType' => ['required', Rule::enum(PixKeyTypeEnum::class)], - 'key' => ['required_unless:keyType,EVP', 'string'], + 'key' => ['required_unless:keyType,EVP', 'string', 'nullable'], ]; } } From 4fcd42cf73608d575200962e2876d37563b4aad7 Mon Sep 17 00:00:00 2001 From: Adeildo Amorim Date: Thu, 11 Apr 2024 21:45:22 -0300 Subject: [PATCH 7/8] [Fix] filtering register pix key values to avoid null --- src/Clients/CelcoinBAASPIX.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Clients/CelcoinBAASPIX.php b/src/Clients/CelcoinBAASPIX.php index 0bd5dd6..a558a3b 100644 --- a/src/Clients/CelcoinBAASPIX.php +++ b/src/Clients/CelcoinBAASPIX.php @@ -84,7 +84,7 @@ public function statusPix(?string $id = null, ?string $clientCode = null, ?strin public function registerPixKey(RegisterPixKey $data) { - $body = Validator::validate($data->toArray(), BAASRegisterPixKey::rules()); + $body = Validator::validate(array_filter($data->toArray()), BAASRegisterPixKey::rules()); return $this->post( self::REGISTER_PIX_KEY_ENDPOINT, From 697a7c8696728056dc4ca59cec5e0f8789a7c66a Mon Sep 17 00:00:00 2001 From: Adeildo Amorim Date: Thu, 11 Apr 2024 21:48:57 -0300 Subject: [PATCH 8/8] [Lint] --- src/Clients/CelcoinBAASBillet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Clients/CelcoinBAASBillet.php b/src/Clients/CelcoinBAASBillet.php index a8ee0c3..8c393cb 100644 --- a/src/Clients/CelcoinBAASBillet.php +++ b/src/Clients/CelcoinBAASBillet.php @@ -10,7 +10,7 @@ class CelcoinBAASBillet extends CelcoinBaseApi { - const BILLET_URL = '/baas/v2/Charge'; + public const BILLET_URL = '/baas/v2/Charge'; /** * @throws RequestException