From 0b16a1af8178d32e18e870003ba5eed0f437018c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 13 Jul 2023 14:39:03 +0300 Subject: [PATCH 001/164] Namespace `CashierProvider` renamed to `Cashbox` --- composer.json | 22 ++++++------- src/Cash/composer.json | 2 +- src/Cash/src/Driver.php | 20 ++++++------ src/Cash/src/Exceptions/Exception.php | 4 +-- src/Cash/src/Requests/CreateRequest.php | 4 +-- src/Cash/src/Requests/RefundRequest.php | 4 +-- src/Cash/src/Requests/VerifyRequest.php | 4 +-- src/Cash/src/Responses/ResponseInfo.php | 4 +-- src/Cash/src/Services/Statuses.php | 4 +-- .../tests/Concerns/TestServiceProvider.php | 2 +- src/Cash/tests/DriverTest.php | 6 ++-- .../tests/Fixtures/Models/ReadyPayment.php | 2 +- .../tests/Fixtures/Models/RequestPayment.php | 2 +- src/Cash/tests/Fixtures/Resources/Model.php | 2 +- src/Cash/tests/Helpers/StatusesTest.php | 4 +-- src/Cash/tests/Jobs/JobsTest.php | 6 ++-- src/Cash/tests/Observers/ObserverTest.php | 6 ++-- src/Cash/tests/Requests/CancelTest.php | 4 +-- src/Cash/tests/Requests/InitTest.php | 4 +-- src/Cash/tests/Requests/StatusTest.php | 4 +-- src/Cash/tests/Resources/DetailsTest.php | 2 +- src/Cash/tests/Responses/InitTest.php | 4 +-- src/Cash/tests/Responses/RefundTest.php | 4 +-- src/Cash/tests/Responses/StateTest.php | 4 +-- src/Cash/tests/TestCase.php | 12 +++---- src/Core/composer.json | 8 ++--- src/Core/config/cashier.php | 8 ++--- ...26_133447_create_cashier_details_table.php | 2 +- ..._115126_create_cashier_increment_field.php | 2 +- ..._details_table_add_operation_id_column.php | 2 +- ...3_06_22_004000_drop_cashier_logs_table.php | 2 +- ...2343_cashier_details_drop_morph_column.php | 2 +- ..._cashier_details_rename_details_column.php | 2 +- ...4_cashier_details_create_status_column.php | 2 +- ...hange_payments_table_add_cashier_index.php | 2 +- ...4_change_payments_table_optimize_index.php | 2 +- src/Core/src/Billable.php | 8 ++--- src/Core/src/Casts/InfoCast.php | 6 ++-- src/Core/src/Concerns/Config/Application.php | 4 +-- src/Core/src/Concerns/Config/Details.php | 6 ++-- .../Concerns/Config/Payment/Attributes.php | 6 ++-- .../src/Concerns/Config/Payment/Drivers.php | 10 +++--- .../src/Concerns/Config/Payment/Payments.php | 6 ++-- .../src/Concerns/Config/Payment/Statuses.php | 6 ++-- src/Core/src/Concerns/Config/Queue.php | 10 +++--- src/Core/src/Concerns/Config/Refund.php | 6 ++-- src/Core/src/Concerns/Enums/From.php | 2 +- src/Core/src/Concerns/Events/Notifiable.php | 22 ++++++------- src/Core/src/Concerns/Helpers/DateTime.php | 2 +- src/Core/src/Concerns/Helpers/Jobs.php | 4 +-- src/Core/src/Concerns/Helpers/Logging.php | 6 ++-- src/Core/src/Concerns/Helpers/Validatable.php | 4 +-- .../Concerns/Migrations/PrivateMigration.php | 6 ++-- .../Concerns/Migrations/PublicMigration.php | 6 ++-- .../src/Concerns/Permissions/Allowable.php | 4 +-- .../Transformers/EnumsTransformer.php | 2 +- src/Core/src/Console/Commands/Command.php | 12 +++---- src/Core/src/Console/Commands/Refund.php | 2 +- src/Core/src/Console/Commands/Verify.php | 2 +- src/Core/src/Data/Casts/FromEnumCast.php | 4 +-- src/Core/src/Data/Casts/NumberCast.php | 2 +- src/Core/src/Data/Casts/PaymentModelCast.php | 4 +-- src/Core/src/Data/Config/ConfigData.php | 6 ++-- src/Core/src/Data/Config/DetailsData.php | 2 +- src/Core/src/Data/Config/DriverData.php | 8 ++--- .../Data/Config/Drivers/CredentialsData.php | 2 +- src/Core/src/Data/Config/LogsData.php | 2 +- .../src/Data/Config/Payment/AttributeData.php | 2 +- .../src/Data/Config/Payment/PaymentData.php | 4 +-- .../src/Data/Config/Payment/StatusData.php | 4 +-- src/Core/src/Data/Config/Queue/QueueData.php | 4 +-- .../src/Data/Config/Queue/QueueNameData.php | 4 +-- src/Core/src/Data/Config/RefundData.php | 4 +-- src/Core/src/Data/Config/VerifyData.php | 4 +-- src/Core/src/Data/Models/InfoData.php | 6 ++-- src/Core/src/Enums/AttributeEnum.php | 2 +- src/Core/src/Enums/CurrencyEnum.php | 4 +-- src/Core/src/Enums/RateLimiterEnum.php | 2 +- src/Core/src/Enums/StatusEnum.php | 4 +-- src/Core/src/Events/BaseEvent.php | 2 +- src/Core/src/Events/CreatedEvent.php | 2 +- src/Core/src/Events/DeletedEvent.php | 2 +- src/Core/src/Events/FailedEvent.php | 2 +- src/Core/src/Events/RefundedEvent.php | 2 +- src/Core/src/Events/SuccessEvent.php | 2 +- src/Core/src/Events/WaitRefundEvent.php | 2 +- src/Core/src/Exceptions/BaseException.php | 2 +- .../External/BadRequestClientException.php | 4 +-- .../External/EmptyResponseException.php | 4 +-- .../IncorrectPaymentModelException.php | 4 +-- .../Internal/UnknownDriverConfigException.php | 4 +-- src/Core/src/Facades/Config.php | 18 +++++------ src/Core/src/Http/Request.php | 2 +- src/Core/src/Http/ResponseInfo.php | 2 +- src/Core/src/Jobs/BaseJob.php | 16 +++++----- src/Core/src/Jobs/RefundJob.php | 4 +-- src/Core/src/Jobs/StartJob.php | 4 +-- src/Core/src/Jobs/VerifyJob.php | 6 ++-- src/Core/src/Models/Details.php | 14 ++++---- .../src/Observers/PaymentDetailsObserver.php | 10 +++--- src/Core/src/Observers/PaymentObserver.php | 12 +++---- src/Core/src/Providers/BaseProvider.php | 4 +-- .../src/Providers/ObserverServiceProvider.php | 8 ++--- .../Providers/RateLimiterServiceProvider.php | 10 +++--- src/Core/src/Providers/ServiceProvider.php | 6 ++-- src/Core/src/Services/Authorize.php | 8 ++--- src/Core/src/Services/Driver.php | 6 ++-- src/Core/src/Services/DriverManager.php | 8 ++--- src/Core/src/Services/Exception.php | 4 +-- src/Core/src/Services/Http.php | 6 ++-- src/Core/src/Services/Job.php | 20 ++++++------ src/Core/src/Services/Statuses.php | 8 ++--- src/Core/src/Services/Validator.php | 6 ++-- src/SberAuth/composer.json | 2 +- src/SberAuth/src/Auth.php | 6 ++-- src/SberAuth/src/Constants/Keys.php | 2 +- src/SberAuth/src/Exceptions/Manager.php | 6 ++-- src/SberAuth/src/Facades/Cache.php | 8 ++--- src/SberAuth/src/Http/Request.php | 6 ++-- src/SberAuth/src/Objects/Query.php | 2 +- src/SberAuth/src/Resources/AccessToken.php | 4 +-- src/SberAuth/src/Support/Cache.php | 6 ++-- src/SberAuth/src/Support/Hash.php | 16 +++++----- src/SberAuth/tests/Auth/BodyTest.php | 2 +- src/SberAuth/tests/Auth/HeadersTest.php | 2 +- src/SberAuth/tests/Auth/MakeTest.php | 2 +- src/SberAuth/tests/Auth/RefreshTest.php | 2 +- src/SberAuth/tests/Fixtures/ModelEloquent.php | 2 +- src/SberAuth/tests/Fixtures/ModelResource.php | 2 +- src/SberAuth/tests/Fixtures/Request.php | 2 +- .../AccessToken/GetAccessTokenTest.php | 2 +- .../Resources/AccessToken/GetClientIdTest.php | 2 +- .../AccessToken/GetExpiresInTest.php | 2 +- .../tests/Resources/AccessToken/MakeTest.php | 2 +- src/SberAuth/tests/Support/Cache/BaseTest.php | 6 ++-- .../tests/Support/Cache/ForgetTest.php | 2 +- src/SberAuth/tests/Support/Cache/GetTest.php | 2 +- src/SberAuth/tests/Support/Hash/GetTest.php | 2 +- src/SberAuth/tests/Support/Hash/MakeTest.php | 2 +- src/SberAuth/tests/TestCase.php | 6 ++-- src/SberOnline/composer.json | 2 +- src/SberOnline/src/Driver.php | 24 +++++++------- src/SberOnline/src/Exceptions/Manager.php | 28 ++++++++-------- src/SberOnline/src/Helpers/Statuses.php | 4 +-- src/SberOnline/src/Requests/BaseRequest.php | 8 ++--- src/SberOnline/src/Requests/Cancel.php | 2 +- src/SberOnline/src/Requests/GetState.php | 2 +- src/SberOnline/src/Requests/Init.php | 2 +- src/SberOnline/src/Resources/Details.php | 4 +-- src/SberOnline/src/Responses/Created.php | 4 +-- src/SberOnline/src/Responses/Refund.php | 4 +-- src/SberOnline/src/Responses/State.php | 4 +-- .../tests/Concerns/TestServiceProvider.php | 2 +- src/SberOnline/tests/DriverTest.php | 6 ++-- .../tests/Fixtures/Models/ReadyPayment.php | 2 +- .../tests/Fixtures/Models/RequestPayment.php | 2 +- .../tests/Fixtures/Resources/Model.php | 2 +- .../tests/Helpers/ExceptionTest.php | 10 +++--- src/SberOnline/tests/Helpers/StatusesTest.php | 4 +-- src/SberOnline/tests/Jobs/JobsTest.php | 6 ++-- .../tests/Observers/ObserverTest.php | 6 ++-- src/SberOnline/tests/Requests/CancelTest.php | 4 +-- .../tests/Requests/GetStateTest.php | 4 +-- src/SberOnline/tests/Requests/InitTest.php | 4 +-- .../tests/Resources/DetailsTest.php | 4 +-- src/SberOnline/tests/Responses/InitTest.php | 4 +-- src/SberOnline/tests/Responses/RefundTest.php | 4 +-- src/SberOnline/tests/Responses/StateTest.php | 4 +-- src/SberOnline/tests/TestCase.php | 12 +++---- src/SberQrCode/composer.json | 2 +- src/SberQrCode/src/Constants/Body.php | 2 +- src/SberQrCode/src/Constants/Scopes.php | 2 +- src/SberQrCode/src/Driver.php | 24 +++++++------- src/SberQrCode/src/Exceptions/Manager.php | 16 +++++----- src/SberQrCode/src/Helpers/Statuses.php | 4 +-- src/SberQrCode/src/Requests/BaseRequest.php | 10 +++--- src/SberQrCode/src/Requests/Cancel.php | 6 ++-- src/SberQrCode/src/Requests/Create.php | 6 ++-- src/SberQrCode/src/Requests/Status.php | 6 ++-- src/SberQrCode/src/Resources/Details.php | 4 +-- src/SberQrCode/src/Resources/Model.php | 4 +-- src/SberQrCode/src/Responses/Cancel.php | 4 +-- src/SberQrCode/src/Responses/QrCode.php | 4 +-- src/SberQrCode/src/Responses/Status.php | 4 +-- .../tests/Concerns/TestServiceProvider.php | 2 +- src/SberQrCode/tests/DriverTest.php | 6 ++-- .../tests/Fixtures/Models/ReadyPayment.php | 2 +- .../tests/Fixtures/Models/RequestPayment.php | 2 +- .../tests/Fixtures/Models/StatusPayment.php | 2 +- .../tests/Fixtures/Resources/Model.php | 2 +- .../tests/Helpers/ExceptionTest.php | 8 ++--- src/SberQrCode/tests/Helpers/StatusesTest.php | 4 +-- src/SberQrCode/tests/Jobs/JobsTest.php | 6 ++-- .../tests/Observers/ObserverTest.php | 6 ++-- src/SberQrCode/tests/Requests/CancelTest.php | 6 ++-- src/SberQrCode/tests/Requests/GetQRTest.php | 6 ++-- .../tests/Resources/DetailsTest.php | 4 +-- src/SberQrCode/tests/Responses/QrCodeTest.php | 4 +-- src/SberQrCode/tests/Responses/RefundTest.php | 4 +-- src/SberQrCode/tests/Responses/StatusTest.php | 4 +-- src/SberQrCode/tests/TestCase.php | 12 +++---- src/TemplateDriver/composer.json | 2 +- src/TemplateDriver/src/Driver.php | 24 +++++++------- src/TemplateDriver/src/Exceptions/Manager.php | 28 ++++++++-------- src/TemplateDriver/src/Helpers/Statuses.php | 4 +-- .../src/Requests/BaseRequest.php | 8 ++--- src/TemplateDriver/src/Requests/Cancel.php | 2 +- src/TemplateDriver/src/Requests/GetState.php | 2 +- src/TemplateDriver/src/Requests/Init.php | 2 +- src/TemplateDriver/src/Resources/Details.php | 4 +-- src/TemplateDriver/src/Responses/Created.php | 4 +-- src/TemplateDriver/src/Responses/Refund.php | 4 +-- src/TemplateDriver/src/Responses/State.php | 4 +-- .../tests/Concerns/TestServiceProvider.php | 2 +- src/TemplateDriver/tests/DriverTest.php | 6 ++-- .../tests/Fixtures/Models/ReadyPayment.php | 2 +- .../tests/Fixtures/Models/RequestPayment.php | 2 +- .../tests/Fixtures/Resources/Model.php | 2 +- .../tests/Helpers/ExceptionTest.php | 10 +++--- .../tests/Helpers/StatusesTest.php | 4 +-- src/TemplateDriver/tests/Jobs/JobsTest.php | 6 ++-- .../tests/Observers/ObserverTest.php | 6 ++-- .../tests/Requests/CancelTest.php | 4 +-- .../tests/Requests/GetStateTest.php | 4 +-- .../tests/Requests/InitTest.php | 4 +-- .../tests/Resources/DetailsTest.php | 4 +-- .../tests/Responses/InitTest.php | 4 +-- .../tests/Responses/RefundTest.php | 4 +-- .../tests/Responses/StateTest.php | 4 +-- src/TemplateDriver/tests/TestCase.php | 12 +++---- src/TemplateDriverAuth/composer.json | 2 +- src/TemplateDriverAuth/src/Auth.php | 8 ++--- src/TemplateDriverAuth/src/Constants/Keys.php | 2 +- .../src/Resources/AccessToken.php | 4 +-- src/TemplateDriverAuth/src/Support/Hash.php | 6 ++-- .../tests/Auth/BodyTest.php | 2 +- .../tests/Auth/HeadersTest.php | 2 +- .../tests/Auth/MakeTest.php | 2 +- .../tests/Fixtures/ModelResource.php | 2 +- .../tests/Fixtures/Request.php | 2 +- .../AccessToken/GetAccessTokenTest.php | 2 +- .../Resources/AccessToken/GetClientIdTest.php | 2 +- .../AccessToken/GetExpiresInTest.php | 2 +- .../tests/Resources/AccessToken/MakeTest.php | 2 +- .../tests/Support/Hash/GetTest.php | 2 +- .../tests/Support/Hash/MakeTest.php | 2 +- src/TemplateDriverAuth/tests/TestCase.php | 4 +-- src/TinkoffAuth/composer.json | 2 +- src/TinkoffAuth/src/Auth.php | 8 ++--- src/TinkoffAuth/src/Constants/Keys.php | 2 +- src/TinkoffAuth/src/Resources/AccessToken.php | 4 +-- src/TinkoffAuth/src/Support/Hash.php | 6 ++-- src/TinkoffAuth/tests/Auth/BodyTest.php | 2 +- src/TinkoffAuth/tests/Auth/HeadersTest.php | 2 +- src/TinkoffAuth/tests/Auth/MakeTest.php | 2 +- .../tests/Fixtures/ModelResource.php | 2 +- src/TinkoffAuth/tests/Fixtures/Request.php | 2 +- .../AccessToken/GetAccessTokenTest.php | 2 +- .../Resources/AccessToken/GetClientIdTest.php | 2 +- .../AccessToken/GetExpiresInTest.php | 2 +- .../tests/Resources/AccessToken/MakeTest.php | 2 +- .../tests/Support/Hash/GetTest.php | 2 +- .../tests/Support/Hash/MakeTest.php | 2 +- src/TinkoffAuth/tests/TestCase.php | 4 +-- src/TinkoffCredit/composer.json | 2 +- src/TinkoffCredit/src/Driver.php | 24 +++++++------- .../Exceptions/Http/CancelDeniedException.php | 4 +-- .../src/Exceptions/Http/NotFoundException.php | 4 +-- src/TinkoffCredit/src/Exceptions/Manager.php | 32 +++++++++---------- src/TinkoffCredit/src/Helpers/Statuses.php | 4 +-- .../src/Requests/BaseRequest.php | 6 ++-- src/TinkoffCredit/src/Requests/Cancel.php | 2 +- src/TinkoffCredit/src/Requests/GetState.php | 2 +- src/TinkoffCredit/src/Requests/Init.php | 2 +- src/TinkoffCredit/src/Resources/Details.php | 4 +-- src/TinkoffCredit/src/Responses/Created.php | 4 +-- src/TinkoffCredit/src/Responses/Refund.php | 4 +-- src/TinkoffCredit/src/Responses/State.php | 4 +-- .../tests/Concerns/TestServiceProvider.php | 2 +- src/TinkoffCredit/tests/DriverTest.php | 8 ++--- .../tests/Fixtures/Models/ReadyPayment.php | 2 +- .../tests/Fixtures/Models/RequestPayment.php | 2 +- .../tests/Fixtures/Resources/Model.php | 2 +- .../tests/Helpers/ExceptionTest.php | 10 +++--- .../tests/Helpers/StatusesTest.php | 4 +-- src/TinkoffCredit/tests/Jobs/JobsTest.php | 8 ++--- .../tests/Observers/ObserverTest.php | 6 ++-- .../tests/Requests/CancelTest.php | 4 +-- .../tests/Requests/GetStateTest.php | 4 +-- src/TinkoffCredit/tests/Requests/InitTest.php | 4 +-- .../tests/Resources/DetailsTest.php | 4 +-- .../tests/Responses/InitTest.php | 4 +-- .../tests/Responses/RefundTest.php | 4 +-- .../tests/Responses/StateTest.php | 4 +-- src/TinkoffCredit/tests/TestCase.php | 12 +++---- src/TinkoffOnline/composer.json | 2 +- src/TinkoffOnline/src/Driver.php | 24 +++++++------- src/TinkoffOnline/src/Exceptions/Manager.php | 28 ++++++++-------- src/TinkoffOnline/src/Helpers/Statuses.php | 4 +-- .../src/Requests/BaseRequest.php | 8 ++--- src/TinkoffOnline/src/Requests/Cancel.php | 2 +- src/TinkoffOnline/src/Requests/GetState.php | 2 +- src/TinkoffOnline/src/Requests/Init.php | 2 +- src/TinkoffOnline/src/Resources/Details.php | 4 +-- src/TinkoffOnline/src/Responses/Init.php | 4 +-- src/TinkoffOnline/src/Responses/Refund.php | 4 +-- src/TinkoffOnline/src/Responses/State.php | 4 +-- src/TinkoffOnline/tests/DriverTest.php | 4 +-- .../tests/Fixtures/Models/ReadyPayment.php | 2 +- .../tests/Fixtures/Models/RequestPayment.php | 2 +- .../tests/Fixtures/Resources/Model.php | 2 +- .../tests/Helpers/ExceptionTest.php | 10 +++--- .../tests/Helpers/StatusesTest.php | 4 +-- src/TinkoffOnline/tests/Jobs/JobsTest.php | 6 ++-- .../tests/Observers/ObserverTest.php | 8 ++--- .../tests/Requests/CancelTest.php | 4 +-- .../tests/Requests/GetStateTest.php | 4 +-- src/TinkoffOnline/tests/Requests/InitTest.php | 4 +-- .../tests/Resources/DetailsTest.php | 4 +-- .../tests/Responses/InitTest.php | 4 +-- .../tests/Responses/RefundTest.php | 4 +-- .../tests/Responses/StateTest.php | 4 +-- src/TinkoffOnline/tests/TestCase.php | 14 ++++---- src/TinkoffQrCode/composer.json | 2 +- src/TinkoffQrCode/src/Driver.php | 28 ++++++++-------- src/TinkoffQrCode/src/Exceptions/Manager.php | 28 ++++++++-------- src/TinkoffQrCode/src/Helpers/Statuses.php | 4 +-- .../src/Requests/BaseRequest.php | 8 ++--- src/TinkoffQrCode/src/Requests/Cancel.php | 2 +- src/TinkoffQrCode/src/Requests/GetQR.php | 2 +- src/TinkoffQrCode/src/Requests/GetState.php | 2 +- src/TinkoffQrCode/src/Requests/Init.php | 2 +- src/TinkoffQrCode/src/Resources/Details.php | 4 +-- src/TinkoffQrCode/src/Responses/Init.php | 4 +-- src/TinkoffQrCode/src/Responses/QrCode.php | 4 +-- src/TinkoffQrCode/src/Responses/Refund.php | 4 +-- src/TinkoffQrCode/src/Responses/State.php | 4 +-- src/TinkoffQrCode/tests/DriverTest.php | 4 +-- .../tests/Fixtures/Models/ReadyPayment.php | 2 +- .../tests/Fixtures/Models/RequestPayment.php | 2 +- .../tests/Fixtures/Resources/Model.php | 2 +- .../tests/Helpers/ExceptionTest.php | 10 +++--- .../tests/Helpers/StatusesTest.php | 4 +-- src/TinkoffQrCode/tests/Jobs/JobsTest.php | 6 ++-- .../tests/Observers/ObserverTest.php | 8 ++--- .../tests/Requests/CancelTest.php | 4 +-- .../tests/Requests/GetQRTest.php | 4 +-- .../tests/Requests/GetStateTest.php | 4 +-- src/TinkoffQrCode/tests/Requests/InitTest.php | 4 +-- .../tests/Resources/DetailsTest.php | 4 +-- .../tests/Responses/InitTest.php | 4 +-- .../tests/Responses/QrCodeTest.php | 4 +-- .../tests/Responses/RefundTest.php | 4 +-- .../tests/Responses/StateTest.php | 4 +-- src/TinkoffQrCode/tests/TestCase.php | 14 ++++---- 355 files changed, 923 insertions(+), 923 deletions(-) diff --git a/composer.json b/composer.json index 72eaf94f..41837dd0 100644 --- a/composer.json +++ b/composer.json @@ -75,17 +75,17 @@ "prefer-stable": true, "autoload": { "psr-4": { - "CashierProvider\\BankName\\Auth\\": "src/TemplateDriverAuth/src/", - "CashierProvider\\BankName\\PaymentType\\": "src/TemplateDriver/src/", - "CashierProvider\\Cash\\": "src/Cash/src/", - "CashierProvider\\Core\\": "src/Core/src/", - "CashierProvider\\Sber\\Auth\\": "src/SberAuth/src/", - "CashierProvider\\Sber\\Online\\": "src/SberOnline/src/", - "CashierProvider\\Sber\\QrCode\\": "src/SberQrCode/src/", - "CashierProvider\\Tinkoff\\Auth\\": "src/TinkoffAuth/src/", - "CashierProvider\\Tinkoff\\Credit\\": "src/TinkoffCredit/src/", - "CashierProvider\\Tinkoff\\Online\\": "src/TinkoffOnline/src/", - "CashierProvider\\Tinkoff\\QrCode\\": "src/TinkoffQrCode/src/" + "Cashbox\\BankName\\Auth\\": "src/TemplateDriverAuth/src/", + "Cashbox\\BankName\\PaymentType\\": "src/TemplateDriver/src/", + "Cashbox\\Cash\\": "src/Cash/src/", + "Cashbox\\Core\\": "src/Core/src/", + "Cashbox\\Sber\\Auth\\": "src/SberAuth/src/", + "Cashbox\\Sber\\Online\\": "src/SberOnline/src/", + "Cashbox\\Sber\\QrCode\\": "src/SberQrCode/src/", + "Cashbox\\Tinkoff\\Auth\\": "src/TinkoffAuth/src/", + "Cashbox\\Tinkoff\\Credit\\": "src/TinkoffCredit/src/", + "Cashbox\\Tinkoff\\Online\\": "src/TinkoffOnline/src/", + "Cashbox\\Tinkoff\\QrCode\\": "src/TinkoffQrCode/src/" } }, "autoload-dev": { diff --git a/src/Cash/composer.json b/src/Cash/composer.json index b88b4771..e72b6af7 100644 --- a/src/Cash/composer.json +++ b/src/Cash/composer.json @@ -47,7 +47,7 @@ "prefer-stable": true, "autoload": { "psr-4": { - "CashierProvider\\Cash\\": "src/" + "Cashbox\\Cash\\": "src/" } }, "config": { diff --git a/src/Cash/src/Driver.php b/src/Cash/src/Driver.php index 78b33848..d436def9 100644 --- a/src/Cash/src/Driver.php +++ b/src/Cash/src/Driver.php @@ -13,16 +13,16 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Cash; - -use CashierProvider\Cash\Exceptions\Exception; -use CashierProvider\Cash\Requests\CreateRequest; -use CashierProvider\Cash\Requests\RefundRequest; -use CashierProvider\Cash\Requests\VerifyRequest; -use CashierProvider\Cash\Responses\ResponseInfo; -use CashierProvider\Cash\Services\Statuses; -use CashierProvider\Core\Http\ResponseInfo as BaseInfoData; -use CashierProvider\Core\Services\Driver as BaseDriver; +namespace Cashbox\Cash; + +use Cashbox\Cash\Exceptions\Exception; +use Cashbox\Cash\Requests\CreateRequest; +use Cashbox\Cash\Requests\RefundRequest; +use Cashbox\Cash\Requests\VerifyRequest; +use Cashbox\Cash\Responses\ResponseInfo; +use Cashbox\Cash\Services\Statuses; +use Cashbox\Core\Http\ResponseInfo as BaseInfoData; +use Cashbox\Core\Services\Driver as BaseDriver; class Driver extends BaseDriver { diff --git a/src/Cash/src/Exceptions/Exception.php b/src/Cash/src/Exceptions/Exception.php index b063d88f..5e8d1bda 100644 --- a/src/Cash/src/Exceptions/Exception.php +++ b/src/Cash/src/Exceptions/Exception.php @@ -15,8 +15,8 @@ declare(strict_types=1); -namespace CashierProvider\Cash\Exceptions; +namespace Cashbox\Cash\Exceptions; -use CashierProvider\Core\Services\Exception as BaseException; +use Cashbox\Core\Services\Exception as BaseException; class Exception extends BaseException {} diff --git a/src/Cash/src/Requests/CreateRequest.php b/src/Cash/src/Requests/CreateRequest.php index 4e8a1d78..82db28f5 100644 --- a/src/Cash/src/Requests/CreateRequest.php +++ b/src/Cash/src/Requests/CreateRequest.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Cash\Requests; +namespace Cashbox\Cash\Requests; -use CashierProvider\Core\Http\Request; +use Cashbox\Core\Http\Request; class CreateRequest extends Request { diff --git a/src/Cash/src/Requests/RefundRequest.php b/src/Cash/src/Requests/RefundRequest.php index 85bfa62d..a37e8754 100644 --- a/src/Cash/src/Requests/RefundRequest.php +++ b/src/Cash/src/Requests/RefundRequest.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Cash\Requests; +namespace Cashbox\Cash\Requests; -use CashierProvider\Core\Http\Request; +use Cashbox\Core\Http\Request; class RefundRequest extends Request { diff --git a/src/Cash/src/Requests/VerifyRequest.php b/src/Cash/src/Requests/VerifyRequest.php index 1aa0ca10..72fdd2d2 100644 --- a/src/Cash/src/Requests/VerifyRequest.php +++ b/src/Cash/src/Requests/VerifyRequest.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Cash\Requests; +namespace Cashbox\Cash\Requests; -use CashierProvider\Core\Http\Request; +use Cashbox\Core\Http\Request; class VerifyRequest extends Request { diff --git a/src/Cash/src/Responses/ResponseInfo.php b/src/Cash/src/Responses/ResponseInfo.php index 936fd8cf..a99c8334 100644 --- a/src/Cash/src/Responses/ResponseInfo.php +++ b/src/Cash/src/Responses/ResponseInfo.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Cash\Responses; +namespace Cashbox\Cash\Responses; -use CashierProvider\Core\Http\ResponseInfo as BaseData; +use Cashbox\Core\Http\ResponseInfo as BaseData; class ResponseInfo extends BaseData { diff --git a/src/Cash/src/Services/Statuses.php b/src/Cash/src/Services/Statuses.php index cabe0dfa..2baa6486 100644 --- a/src/Cash/src/Services/Statuses.php +++ b/src/Cash/src/Services/Statuses.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Cash\Services; +namespace Cashbox\Cash\Services; -use CashierProvider\Core\Services\Statuses as BaseStatuses; +use Cashbox\Core\Services\Statuses as BaseStatuses; class Statuses extends BaseStatuses { diff --git a/src/Cash/tests/Concerns/TestServiceProvider.php b/src/Cash/tests/Concerns/TestServiceProvider.php index bbef67c6..f5ce1126 100644 --- a/src/Cash/tests/Concerns/TestServiceProvider.php +++ b/src/Cash/tests/Concerns/TestServiceProvider.php @@ -17,7 +17,7 @@ namespace Tests\Concerns; -use CashierProvider\Core\Providers\ServiceProvider; +use Cashbox\Core\Providers\ServiceProvider; class TestServiceProvider extends ServiceProvider { diff --git a/src/Cash/tests/DriverTest.php b/src/Cash/tests/DriverTest.php index c7c36228..9f57f7ad 100644 --- a/src/Cash/tests/DriverTest.php +++ b/src/Cash/tests/DriverTest.php @@ -15,9 +15,9 @@ namespace Tests; -use CashierProvider\Cash\Driver as Technology; -use CashierProvider\Core\Http\ResponseInfo; -use CashierProvider\Core\Services\Jobs; +use Cashbox\Cash\Driver as Technology; +use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Services\Jobs; use DragonCode\Contracts\Cashier\Driver as DriverContract; use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; use Illuminate\Database\Eloquent\Model; diff --git a/src/Cash/tests/Fixtures/Models/ReadyPayment.php b/src/Cash/tests/Fixtures/Models/ReadyPayment.php index 8cb600ec..c3cbcd9f 100644 --- a/src/Cash/tests/Fixtures/Models/ReadyPayment.php +++ b/src/Cash/tests/Fixtures/Models/ReadyPayment.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/Cash/tests/Fixtures/Models/RequestPayment.php b/src/Cash/tests/Fixtures/Models/RequestPayment.php index f35795ae..f19ecd52 100644 --- a/src/Cash/tests/Fixtures/Models/RequestPayment.php +++ b/src/Cash/tests/Fixtures/Models/RequestPayment.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; /** diff --git a/src/Cash/tests/Fixtures/Resources/Model.php b/src/Cash/tests/Fixtures/Resources/Model.php index 5383e408..3328e3b7 100644 --- a/src/Cash/tests/Fixtures/Resources/Model.php +++ b/src/Cash/tests/Fixtures/Resources/Model.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Resources; -use CashierProvider\Core\Resources\Model as BaseModel; +use Cashbox\Core\Resources\Model as BaseModel; use Illuminate\Support\Carbon; /** @property \Tests\Fixtures\Models\ReadyPayment $model */ diff --git a/src/Cash/tests/Helpers/StatusesTest.php b/src/Cash/tests/Helpers/StatusesTest.php index 2396f497..27f44743 100644 --- a/src/Cash/tests/Helpers/StatusesTest.php +++ b/src/Cash/tests/Helpers/StatusesTest.php @@ -15,8 +15,8 @@ namespace Tests\Helpers; -use CashierProvider\Cash\Helpers\Statuses; -use CashierProvider\Cash\Resources\Details; +use Cashbox\Cash\Helpers\Statuses; +use Cashbox\Cash\Resources\Details; use Tests\TestCase; class StatusesTest extends TestCase diff --git a/src/Cash/tests/Jobs/JobsTest.php b/src/Cash/tests/Jobs/JobsTest.php index 7838be72..1818c13b 100644 --- a/src/Cash/tests/Jobs/JobsTest.php +++ b/src/Cash/tests/Jobs/JobsTest.php @@ -15,9 +15,9 @@ namespace Tests\Jobs; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Services\Jobs; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Services\Jobs; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\DB; use Tests\Fixtures\Models\RequestPayment; diff --git a/src/Cash/tests/Observers/ObserverTest.php b/src/Cash/tests/Observers/ObserverTest.php index 6c419178..761500a2 100644 --- a/src/Cash/tests/Observers/ObserverTest.php +++ b/src/Cash/tests/Observers/ObserverTest.php @@ -15,9 +15,9 @@ namespace Tests\Observers; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Providers\ObserverServiceProvider; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Providers\ObserverServiceProvider; use Illuminate\Database\Eloquent\Model; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\DB; diff --git a/src/Cash/tests/Requests/CancelTest.php b/src/Cash/tests/Requests/CancelTest.php index c59eb2b0..bcfeb4f9 100644 --- a/src/Cash/tests/Requests/CancelTest.php +++ b/src/Cash/tests/Requests/CancelTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Cash\Requests\Cancel; -use CashierProvider\Core\Http\Request; +use Cashbox\Cash\Requests\Cancel; +use Cashbox\Core\Http\Request; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use Tests\TestCase; diff --git a/src/Cash/tests/Requests/InitTest.php b/src/Cash/tests/Requests/InitTest.php index bd2c9bc3..07480c61 100644 --- a/src/Cash/tests/Requests/InitTest.php +++ b/src/Cash/tests/Requests/InitTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Cash\Requests\CreateRequest; -use CashierProvider\Core\Http\Request; +use Cashbox\Cash\Requests\CreateRequest; +use Cashbox\Core\Http\Request; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use Tests\TestCase; diff --git a/src/Cash/tests/Requests/StatusTest.php b/src/Cash/tests/Requests/StatusTest.php index ea9d9538..e3e94c2f 100644 --- a/src/Cash/tests/Requests/StatusTest.php +++ b/src/Cash/tests/Requests/StatusTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Cash\Requests\Status; -use CashierProvider\Core\Http\Request; +use Cashbox\Cash\Requests\Status; +use Cashbox\Core\Http\Request; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use Tests\TestCase; diff --git a/src/Cash/tests/Resources/DetailsTest.php b/src/Cash/tests/Resources/DetailsTest.php index ea639988..642846a1 100644 --- a/src/Cash/tests/Resources/DetailsTest.php +++ b/src/Cash/tests/Resources/DetailsTest.php @@ -15,7 +15,7 @@ namespace Tests\Resources; -use CashierProvider\Cash\Resources\Details as BaseDetails; +use Cashbox\Cash\Resources\Details as BaseDetails; use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; use Tests\TestCase; diff --git a/src/Cash/tests/Responses/InitTest.php b/src/Cash/tests/Responses/InitTest.php index 2a79cf11..218384a5 100644 --- a/src/Cash/tests/Responses/InitTest.php +++ b/src/Cash/tests/Responses/InitTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Cash\Responses\Created; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Cash\Responses\Created; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/Cash/tests/Responses/RefundTest.php b/src/Cash/tests/Responses/RefundTest.php index d568c3e7..c82e769e 100644 --- a/src/Cash/tests/Responses/RefundTest.php +++ b/src/Cash/tests/Responses/RefundTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Cash\Responses\Refund; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Cash\Responses\Refund; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/Cash/tests/Responses/StateTest.php b/src/Cash/tests/Responses/StateTest.php index f31ff6a0..f430fb66 100644 --- a/src/Cash/tests/Responses/StateTest.php +++ b/src/Cash/tests/Responses/StateTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Cash\Responses\State; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Cash\Responses\State; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/Cash/tests/TestCase.php b/src/Cash/tests/TestCase.php index c93bf834..4ff489d5 100644 --- a/src/Cash/tests/TestCase.php +++ b/src/Cash/tests/TestCase.php @@ -15,11 +15,11 @@ namespace Tests; -use CashierProvider\Cash\Driver; -use CashierProvider\Core\Config\Driver as DriverConfig; -use CashierProvider\Core\Constants\Driver as DriverConstant; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Models\CashierDetail; +use Cashbox\Cash\Driver; +use Cashbox\Core\Config\Driver as DriverConfig; +use Cashbox\Core\Constants\Driver as DriverConstant; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Models\CashierDetail; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\Details; use Illuminate\Database\Eloquent\Model as EloquentModel; @@ -98,7 +98,7 @@ protected function detailsRelation(EloquentModel $model, ?Details $details): Cas } /** - * @param \CashierProvider\Cash\Requests\BaseRequest|string $request + * @param \Cashbox\Cash\Requests\BaseRequest|string $request */ protected function request(string $request): Request { diff --git a/src/Core/composer.json b/src/Core/composer.json index abeb51bf..829009e9 100644 --- a/src/Core/composer.json +++ b/src/Core/composer.json @@ -60,7 +60,7 @@ "prefer-stable": true, "autoload": { "psr-4": { - "CashierProvider\\Core\\": "src/" + "Cashbox\\Core\\": "src/" } }, "config": { @@ -79,9 +79,9 @@ }, "laravel": { "providers": [ - "CashierProvider\\Core\\Providers\\ServiceProvider", - "CashierProvider\\Core\\Providers\\ObserverServiceProvider", - "CashierProvider\\Core\\Providers\\RateLimiterServiceProvider" + "Cashbox\\Core\\Providers\\ServiceProvider", + "Cashbox\\Core\\Providers\\ObserverServiceProvider", + "Cashbox\\Core\\Providers\\RateLimiterServiceProvider" ] }, "thanks": [ diff --git a/src/Core/config/cashier.php b/src/Core/config/cashier.php index 4ae8a9d4..325ea479 100644 --- a/src/Core/config/cashier.php +++ b/src/Core/config/cashier.php @@ -15,8 +15,8 @@ declare(strict_types=1); -use CashierProvider\Core\Enums\AttributeEnum; -use CashierProvider\Core\Enums\StatusEnum; +use Cashbox\Core\Enums\AttributeEnum; +use Cashbox\Core\Enums\StatusEnum; return [ /* @@ -355,13 +355,13 @@ 'drivers' => [ // 'driver_name_foo' => [ - // 'driver' => \CashierProvider\CoreDriver\BankName\PaymentType\Driver::class, + // 'driver' => \Cashbox\CoreDriver\BankName\PaymentType\Driver::class, // // 'details' => \App\Payments\BankName::class, // ], // // 'driver_name_bar' => [ - // 'driver' => \CashierProvider\CoreDriver\BankName\PaymentType\Driver::class, + // 'driver' => \Cashbox\CoreDriver\BankName\PaymentType\Driver::class, // // 'details' => \App\Payments\BankName::class, // diff --git a/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php b/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php index 78562ed6..eefe38d3 100644 --- a/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php +++ b/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php @@ -15,7 +15,7 @@ declare(strict_types=1); -use CashierProvider\Core\Concerns\Migrations\PrivateMigration; +use Cashbox\Core\Concerns\Migrations\PrivateMigration; use Illuminate\Database\Schema\Blueprint; new class extends PrivateMigration { diff --git a/src/Core/database/migrations/private/2021_09_10_115126_create_cashier_increment_field.php b/src/Core/database/migrations/private/2021_09_10_115126_create_cashier_increment_field.php index 766d766a..5d551eca 100644 --- a/src/Core/database/migrations/private/2021_09_10_115126_create_cashier_increment_field.php +++ b/src/Core/database/migrations/private/2021_09_10_115126_create_cashier_increment_field.php @@ -15,7 +15,7 @@ declare(strict_types=1); -use CashierProvider\Core\Concerns\Migrations\PrivateMigration; +use Cashbox\Core\Concerns\Migrations\PrivateMigration; use Illuminate\Database\Schema\Blueprint; new class extends PrivateMigration { diff --git a/src/Core/database/migrations/private/2021_10_12_125617_change_cashier_details_table_add_operation_id_column.php b/src/Core/database/migrations/private/2021_10_12_125617_change_cashier_details_table_add_operation_id_column.php index 412e9438..b9508116 100644 --- a/src/Core/database/migrations/private/2021_10_12_125617_change_cashier_details_table_add_operation_id_column.php +++ b/src/Core/database/migrations/private/2021_10_12_125617_change_cashier_details_table_add_operation_id_column.php @@ -15,7 +15,7 @@ declare(strict_types=1); -use CashierProvider\Core\Concerns\Migrations\PrivateMigration; +use Cashbox\Core\Concerns\Migrations\PrivateMigration; use Illuminate\Database\Schema\Blueprint; new class extends PrivateMigration { diff --git a/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php b/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php index 694745cf..e38cc1eb 100644 --- a/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php +++ b/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php @@ -15,7 +15,7 @@ declare(strict_types=1); -use CashierProvider\Core\Concerns\Migrations\PrivateMigration; +use Cashbox\Core\Concerns\Migrations\PrivateMigration; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; diff --git a/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php b/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php index 26d3cdc4..2bd144cd 100644 --- a/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php +++ b/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php @@ -15,7 +15,7 @@ declare(strict_types=1); -use CashierProvider\Core\Concerns\Migrations\PrivateMigration; +use Cashbox\Core\Concerns\Migrations\PrivateMigration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; diff --git a/src/Core/database/migrations/private/2023_07_08_195624_cashier_details_rename_details_column.php b/src/Core/database/migrations/private/2023_07_08_195624_cashier_details_rename_details_column.php index 05234bf6..db0bd7c0 100644 --- a/src/Core/database/migrations/private/2023_07_08_195624_cashier_details_rename_details_column.php +++ b/src/Core/database/migrations/private/2023_07_08_195624_cashier_details_rename_details_column.php @@ -15,7 +15,7 @@ declare(strict_types=1); -use CashierProvider\Core\Concerns\Migrations\PrivateMigration; +use Cashbox\Core\Concerns\Migrations\PrivateMigration; use Illuminate\Database\Schema\Blueprint; new class extends PrivateMigration { diff --git a/src/Core/database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php b/src/Core/database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php index d7e53a4b..dfcb791a 100644 --- a/src/Core/database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php +++ b/src/Core/database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php @@ -15,7 +15,7 @@ declare(strict_types=1); -use CashierProvider\Core\Concerns\Migrations\PrivateMigration; +use Cashbox\Core\Concerns\Migrations\PrivateMigration; use Illuminate\Database\Schema\Blueprint; new class extends PrivateMigration { diff --git a/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php b/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php index 126615e8..96acef6a 100644 --- a/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php +++ b/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php @@ -15,7 +15,7 @@ declare(strict_types=1); -use CashierProvider\Core\Concerns\Migrations\PublicMigration; +use Cashbox\Core\Concerns\Migrations\PublicMigration; use Illuminate\Database\Schema\Blueprint; new class extends PublicMigration { diff --git a/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php b/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php index 3956c05f..87506086 100644 --- a/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php +++ b/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php @@ -15,7 +15,7 @@ declare(strict_types=1); -use CashierProvider\Core\Concerns\Migrations\PublicMigration; +use Cashbox\Core\Concerns\Migrations\PublicMigration; use Illuminate\Database\Schema\Blueprint; new class extends PublicMigration { diff --git a/src/Core/src/Billable.php b/src/Core/src/Billable.php index 7561cb17..2ecc4167 100644 --- a/src/Core/src/Billable.php +++ b/src/Core/src/Billable.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\Core; +namespace Cashbox\Core; -use CashierProvider\Core\Models\Details; -use CashierProvider\Core\Services\Driver; -use CashierProvider\Core\Services\DriverManager; +use Cashbox\Core\Models\Details; +use Cashbox\Core\Services\Driver; +use Cashbox\Core\Services\DriverManager; use Illuminate\Database\Eloquent\Relations\Relation; /** diff --git a/src/Core/src/Casts/InfoCast.php b/src/Core/src/Casts/InfoCast.php index 12833a3f..f2dd875f 100644 --- a/src/Core/src/Casts/InfoCast.php +++ b/src/Core/src/Casts/InfoCast.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Casts; +namespace Cashbox\Core\Casts; -use CashierProvider\Core\Concerns\Config\Application; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Concerns\Config\Application; +use Cashbox\Core\Http\ResponseInfo; use Illuminate\Contracts\Database\Eloquent\CastsAttributes; use Illuminate\Database\Eloquent\Model; diff --git a/src/Core/src/Concerns/Config/Application.php b/src/Core/src/Concerns/Config/Application.php index 7d420791..f534bdd9 100644 --- a/src/Core/src/Concerns/Config/Application.php +++ b/src/Core/src/Concerns/Config/Application.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Config; +namespace Cashbox\Core\Concerns\Config; -use CashierProvider\Core\Facades\Config; +use Cashbox\Core\Facades\Config; trait Application { diff --git a/src/Core/src/Concerns/Config/Details.php b/src/Core/src/Concerns/Config/Details.php index d5249c68..8c4384bb 100644 --- a/src/Core/src/Concerns/Config/Details.php +++ b/src/Core/src/Concerns/Config/Details.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Config; +namespace Cashbox\Core\Concerns\Config; -use CashierProvider\Core\Data\Config\DetailsData; -use CashierProvider\Core\Facades\Config; +use Cashbox\Core\Data\Config\DetailsData; +use Cashbox\Core\Facades\Config; trait Details { diff --git a/src/Core/src/Concerns/Config/Payment/Attributes.php b/src/Core/src/Concerns/Config/Payment/Attributes.php index 2fa9f6fe..f90c2f69 100644 --- a/src/Core/src/Concerns/Config/Payment/Attributes.php +++ b/src/Core/src/Concerns/Config/Payment/Attributes.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Config\Payment; +namespace Cashbox\Core\Concerns\Config\Payment; -use CashierProvider\Core\Data\Config\Payment\AttributeData; -use CashierProvider\Core\Facades\Config; +use Cashbox\Core\Data\Config\Payment\AttributeData; +use Cashbox\Core\Facades\Config; trait Attributes { diff --git a/src/Core/src/Concerns/Config/Payment/Drivers.php b/src/Core/src/Concerns/Config/Payment/Drivers.php index 4d573c00..88986527 100644 --- a/src/Core/src/Concerns/Config/Payment/Drivers.php +++ b/src/Core/src/Concerns/Config/Payment/Drivers.php @@ -15,12 +15,12 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Config\Payment; +namespace Cashbox\Core\Concerns\Config\Payment; -use CashierProvider\Core\Concerns\Transformers\EnumsTransformer; -use CashierProvider\Core\Data\Config\DriverData; -use CashierProvider\Core\Exceptions\Internal\UnknownDriverConfigException; -use CashierProvider\Core\Facades\Config; +use Cashbox\Core\Concerns\Transformers\EnumsTransformer; +use Cashbox\Core\Data\Config\DriverData; +use Cashbox\Core\Exceptions\Internal\UnknownDriverConfigException; +use Cashbox\Core\Facades\Config; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Collection; diff --git a/src/Core/src/Concerns/Config/Payment/Payments.php b/src/Core/src/Concerns/Config/Payment/Payments.php index b8c7d52f..0e700254 100644 --- a/src/Core/src/Concerns/Config/Payment/Payments.php +++ b/src/Core/src/Concerns/Config/Payment/Payments.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Config\Payment; +namespace Cashbox\Core\Concerns\Config\Payment; -use CashierProvider\Core\Data\Config\Payment\PaymentData; -use CashierProvider\Core\Facades\Config; +use Cashbox\Core\Data\Config\Payment\PaymentData; +use Cashbox\Core\Facades\Config; trait Payments { diff --git a/src/Core/src/Concerns/Config/Payment/Statuses.php b/src/Core/src/Concerns/Config/Payment/Statuses.php index 8ad9de63..69614b04 100644 --- a/src/Core/src/Concerns/Config/Payment/Statuses.php +++ b/src/Core/src/Concerns/Config/Payment/Statuses.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Config\Payment; +namespace Cashbox\Core\Concerns\Config\Payment; -use CashierProvider\Core\Data\Config\Payment\StatusData; -use CashierProvider\Core\Facades\Config; +use Cashbox\Core\Data\Config\Payment\StatusData; +use Cashbox\Core\Facades\Config; trait Statuses { diff --git a/src/Core/src/Concerns/Config/Queue.php b/src/Core/src/Concerns/Config/Queue.php index 53f32be8..7d48b70a 100644 --- a/src/Core/src/Concerns/Config/Queue.php +++ b/src/Core/src/Concerns/Config/Queue.php @@ -15,12 +15,12 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Config; +namespace Cashbox\Core\Concerns\Config; -use CashierProvider\Core\Concerns\Config\Payment\Drivers; -use CashierProvider\Core\Data\Config\Queue\QueueData; -use CashierProvider\Core\Data\Config\Queue\QueueNameData; -use CashierProvider\Core\Facades\Config; +use Cashbox\Core\Concerns\Config\Payment\Drivers; +use Cashbox\Core\Data\Config\Queue\QueueData; +use Cashbox\Core\Data\Config\Queue\QueueNameData; +use Cashbox\Core\Facades\Config; use Illuminate\Database\Eloquent\Model; trait Queue diff --git a/src/Core/src/Concerns/Config/Refund.php b/src/Core/src/Concerns/Config/Refund.php index 01b24b4f..0ceda5e1 100644 --- a/src/Core/src/Concerns/Config/Refund.php +++ b/src/Core/src/Concerns/Config/Refund.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Config; +namespace Cashbox\Core\Concerns\Config; -use CashierProvider\Core\Data\Config\RefundData; -use CashierProvider\Core\Facades\Config; +use Cashbox\Core\Data\Config\RefundData; +use Cashbox\Core\Facades\Config; trait Refund { diff --git a/src/Core/src/Concerns/Enums/From.php b/src/Core/src/Concerns/Enums/From.php index 83b3306a..a9362589 100644 --- a/src/Core/src/Concerns/Enums/From.php +++ b/src/Core/src/Concerns/Enums/From.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Enums; +namespace Cashbox\Core\Concerns\Enums; use OutOfBoundsException; diff --git a/src/Core/src/Concerns/Events/Notifiable.php b/src/Core/src/Concerns/Events/Notifiable.php index e33ee45f..ae1209f2 100644 --- a/src/Core/src/Concerns/Events/Notifiable.php +++ b/src/Core/src/Concerns/Events/Notifiable.php @@ -15,17 +15,17 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Events; - -use CashierProvider\Core\Concerns\Config\Payment\Attributes; -use CashierProvider\Core\Concerns\Config\Payment\Payments; -use CashierProvider\Core\Enums\StatusEnum; -use CashierProvider\Core\Events\CreatedEvent; -use CashierProvider\Core\Events\DeletedEvent; -use CashierProvider\Core\Events\FailedEvent; -use CashierProvider\Core\Events\RefundedEvent; -use CashierProvider\Core\Events\SuccessEvent; -use CashierProvider\Core\Events\WaitRefundEvent; +namespace Cashbox\Core\Concerns\Events; + +use Cashbox\Core\Concerns\Config\Payment\Attributes; +use Cashbox\Core\Concerns\Config\Payment\Payments; +use Cashbox\Core\Enums\StatusEnum; +use Cashbox\Core\Events\CreatedEvent; +use Cashbox\Core\Events\DeletedEvent; +use Cashbox\Core\Events\FailedEvent; +use Cashbox\Core\Events\RefundedEvent; +use Cashbox\Core\Events\SuccessEvent; +use Cashbox\Core\Events\WaitRefundEvent; use Illuminate\Database\Eloquent\Model; trait Notifiable diff --git a/src/Core/src/Concerns/Helpers/DateTime.php b/src/Core/src/Concerns/Helpers/DateTime.php index 698552bc..4d86046a 100644 --- a/src/Core/src/Concerns/Helpers/DateTime.php +++ b/src/Core/src/Concerns/Helpers/DateTime.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Helpers; +namespace Cashbox\Core\Concerns\Helpers; use Carbon\Carbon; use DateTimeInterface; diff --git a/src/Core/src/Concerns/Helpers/Jobs.php b/src/Core/src/Concerns/Helpers/Jobs.php index e4dc6876..846ca64c 100644 --- a/src/Core/src/Concerns/Helpers/Jobs.php +++ b/src/Core/src/Concerns/Helpers/Jobs.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Helpers; +namespace Cashbox\Core\Concerns\Helpers; -use CashierProvider\Core\Services\Job; +use Cashbox\Core\Services\Job; use Illuminate\Database\Eloquent\Model; trait Jobs diff --git a/src/Core/src/Concerns/Helpers/Logging.php b/src/Core/src/Concerns/Helpers/Logging.php index ea648293..b12076fb 100644 --- a/src/Core/src/Concerns/Helpers/Logging.php +++ b/src/Core/src/Concerns/Helpers/Logging.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Helpers; +namespace Cashbox\Core\Concerns\Helpers; -use CashierProvider\Core\Facades\Config; -use CashierProvider\Core\Http\Request; +use Cashbox\Core\Facades\Config; +use Cashbox\Core\Http\Request; use Illuminate\Http\Client\Response; use Illuminate\Support\Facades\Log; use Psr\Log\LoggerInterface; diff --git a/src/Core/src/Concerns/Helpers/Validatable.php b/src/Core/src/Concerns/Helpers/Validatable.php index e379f25e..d8b79ca4 100644 --- a/src/Core/src/Concerns/Helpers/Validatable.php +++ b/src/Core/src/Concerns/Helpers/Validatable.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Helpers; +namespace Cashbox\Core\Concerns\Helpers; -use CashierProvider\Core\Services\Validator; +use Cashbox\Core\Services\Validator; use Illuminate\Database\Eloquent\Model; trait Validatable diff --git a/src/Core/src/Concerns/Migrations/PrivateMigration.php b/src/Core/src/Concerns/Migrations/PrivateMigration.php index 7418c937..6b913222 100644 --- a/src/Core/src/Concerns/Migrations/PrivateMigration.php +++ b/src/Core/src/Concerns/Migrations/PrivateMigration.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Migrations; +namespace Cashbox\Core\Concerns\Migrations; -use CashierProvider\Core\Concerns\Config\Details; -use CashierProvider\Core\Concerns\Config\Payment\Payments; +use Cashbox\Core\Concerns\Config\Details; +use Cashbox\Core\Concerns\Config\Payment\Payments; use DragonCode\LaravelSupport\Traits\InitModelHelper; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Builder; diff --git a/src/Core/src/Concerns/Migrations/PublicMigration.php b/src/Core/src/Concerns/Migrations/PublicMigration.php index bc389886..df208804 100644 --- a/src/Core/src/Concerns/Migrations/PublicMigration.php +++ b/src/Core/src/Concerns/Migrations/PublicMigration.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Migrations; +namespace Cashbox\Core\Concerns\Migrations; -use CashierProvider\Core\Concerns\Config\Payment\Attributes; -use CashierProvider\Core\Concerns\Config\Payment\Payments; +use Cashbox\Core\Concerns\Config\Payment\Attributes; +use Cashbox\Core\Concerns\Config\Payment\Payments; use DragonCode\LaravelSupport\Traits\InitModelHelper; use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Builder; diff --git a/src/Core/src/Concerns/Permissions/Allowable.php b/src/Core/src/Concerns/Permissions/Allowable.php index 6a850224..9cefb4a5 100644 --- a/src/Core/src/Concerns/Permissions/Allowable.php +++ b/src/Core/src/Concerns/Permissions/Allowable.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Permissions; +namespace Cashbox\Core\Concerns\Permissions; -use CashierProvider\Core\Services\Authorize; +use Cashbox\Core\Services\Authorize; trait Allowable { diff --git a/src/Core/src/Concerns/Transformers/EnumsTransformer.php b/src/Core/src/Concerns/Transformers/EnumsTransformer.php index 574dc7ce..03ac5e8c 100644 --- a/src/Core/src/Concerns/Transformers/EnumsTransformer.php +++ b/src/Core/src/Concerns/Transformers/EnumsTransformer.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Concerns\Transformers; +namespace Cashbox\Core\Concerns\Transformers; use UnitEnum; diff --git a/src/Core/src/Console/Commands/Command.php b/src/Core/src/Console/Commands/Command.php index bbd6b922..74fab5ea 100644 --- a/src/Core/src/Console/Commands/Command.php +++ b/src/Core/src/Console/Commands/Command.php @@ -15,13 +15,13 @@ declare(strict_types=1); -namespace CashierProvider\Core\Console\Commands; +namespace Cashbox\Core\Console\Commands; -use CashierProvider\Core\Concerns\Config\Payment\Attributes; -use CashierProvider\Core\Concerns\Config\Payment\Drivers; -use CashierProvider\Core\Concerns\Config\Payment\Payments; -use CashierProvider\Core\Concerns\Config\Payment\Statuses; -use CashierProvider\Core\Concerns\Helpers\Jobs; +use Cashbox\Core\Concerns\Config\Payment\Attributes; +use Cashbox\Core\Concerns\Config\Payment\Drivers; +use Cashbox\Core\Concerns\Config\Payment\Payments; +use Cashbox\Core\Concerns\Config\Payment\Statuses; +use Cashbox\Core\Concerns\Helpers\Jobs; use Closure; use DragonCode\LaravelSupport\Traits\InitModelHelper; use Illuminate\Console\Command as BaseCommand; diff --git a/src/Core/src/Console/Commands/Refund.php b/src/Core/src/Console/Commands/Refund.php index fbb003ce..0c595510 100644 --- a/src/Core/src/Console/Commands/Refund.php +++ b/src/Core/src/Console/Commands/Refund.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Console\Commands; +namespace Cashbox\Core\Console\Commands; use Illuminate\Database\Eloquent\Model; use Symfony\Component\Console\Attribute\AsCommand; diff --git a/src/Core/src/Console/Commands/Verify.php b/src/Core/src/Console/Commands/Verify.php index afa49b62..b3362969 100644 --- a/src/Core/src/Console/Commands/Verify.php +++ b/src/Core/src/Console/Commands/Verify.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Console\Commands; +namespace Cashbox\Core\Console\Commands; use Illuminate\Database\Eloquent\Model; use Symfony\Component\Console\Attribute\AsCommand; diff --git a/src/Core/src/Data/Casts/FromEnumCast.php b/src/Core/src/Data/Casts/FromEnumCast.php index 3d90ca91..f305416d 100644 --- a/src/Core/src/Data/Casts/FromEnumCast.php +++ b/src/Core/src/Data/Casts/FromEnumCast.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Core\Data\Casts; +namespace Cashbox\Core\Data\Casts; -use CashierProvider\Core\Concerns\Transformers\EnumsTransformer; +use Cashbox\Core\Concerns\Transformers\EnumsTransformer; use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Support\DataProperty; diff --git a/src/Core/src/Data/Casts/NumberCast.php b/src/Core/src/Data/Casts/NumberCast.php index 7a47c02c..98ec44e0 100644 --- a/src/Core/src/Data/Casts/NumberCast.php +++ b/src/Core/src/Data/Casts/NumberCast.php @@ -13,7 +13,7 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Core\Data\Casts; +namespace Cashbox\Core\Data\Casts; use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Support\DataProperty; diff --git a/src/Core/src/Data/Casts/PaymentModelCast.php b/src/Core/src/Data/Casts/PaymentModelCast.php index 81803c85..8fc8f555 100644 --- a/src/Core/src/Data/Casts/PaymentModelCast.php +++ b/src/Core/src/Data/Casts/PaymentModelCast.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Casts; +namespace Cashbox\Core\Data\Casts; -use CashierProvider\Core\Services\Validator; +use Cashbox\Core\Services\Validator; use Illuminate\Database\Eloquent\Model; use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Support\DataProperty; diff --git a/src/Core/src/Data/Config/ConfigData.php b/src/Core/src/Data/Config/ConfigData.php index e5a44be7..d216a7b0 100644 --- a/src/Core/src/Data/Config/ConfigData.php +++ b/src/Core/src/Data/Config/ConfigData.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Config; +namespace Cashbox\Core\Data\Config; -use CashierProvider\Core\Data\Config\Payment\PaymentData; -use CashierProvider\Core\Data\Config\Queue\QueueData; +use Cashbox\Core\Data\Config\Payment\PaymentData; +use Cashbox\Core\Data\Config\Queue\QueueData; use Spatie\LaravelData\Attributes\DataCollectionOf; use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Data; diff --git a/src/Core/src/Data/Config/DetailsData.php b/src/Core/src/Data/Config/DetailsData.php index c18fc958..0b297948 100644 --- a/src/Core/src/Data/Config/DetailsData.php +++ b/src/Core/src/Data/Config/DetailsData.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Config; +namespace Cashbox\Core\Data\Config; use Spatie\LaravelData\Data; diff --git a/src/Core/src/Data/Config/DriverData.php b/src/Core/src/Data/Config/DriverData.php index 5856075e..8f0d65ad 100644 --- a/src/Core/src/Data/Config/DriverData.php +++ b/src/Core/src/Data/Config/DriverData.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Config; +namespace Cashbox\Core\Data\Config; -use CashierProvider\Core\Data\Config\Drivers\CredentialsData; -use CashierProvider\Core\Data\Config\Queue\QueueNameData; -use CashierProvider\Core\Facades\Config; +use Cashbox\Core\Data\Config\Drivers\CredentialsData; +use Cashbox\Core\Data\Config\Queue\QueueNameData; +use Cashbox\Core\Facades\Config; use Spatie\LaravelData\Data; class DriverData extends Data diff --git a/src/Core/src/Data/Config/Drivers/CredentialsData.php b/src/Core/src/Data/Config/Drivers/CredentialsData.php index 929c5734..1a186379 100644 --- a/src/Core/src/Data/Config/Drivers/CredentialsData.php +++ b/src/Core/src/Data/Config/Drivers/CredentialsData.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Config\Drivers; +namespace Cashbox\Core\Data\Config\Drivers; use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Data; diff --git a/src/Core/src/Data/Config/LogsData.php b/src/Core/src/Data/Config/LogsData.php index 2f328e52..16a17f8a 100644 --- a/src/Core/src/Data/Config/LogsData.php +++ b/src/Core/src/Data/Config/LogsData.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Config; +namespace Cashbox\Core\Data\Config; use Spatie\LaravelData\Data; diff --git a/src/Core/src/Data/Config/Payment/AttributeData.php b/src/Core/src/Data/Config/Payment/AttributeData.php index 9658861a..e67e53b2 100644 --- a/src/Core/src/Data/Config/Payment/AttributeData.php +++ b/src/Core/src/Data/Config/Payment/AttributeData.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Config\Payment; +namespace Cashbox\Core\Data\Config\Payment; use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Data; diff --git a/src/Core/src/Data/Config/Payment/PaymentData.php b/src/Core/src/Data/Config/Payment/PaymentData.php index e9f1c677..8d7de77b 100644 --- a/src/Core/src/Data/Config/Payment/PaymentData.php +++ b/src/Core/src/Data/Config/Payment/PaymentData.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Config\Payment; +namespace Cashbox\Core\Data\Config\Payment; -use CashierProvider\Core\Data\Casts\PaymentModelCast; +use Cashbox\Core\Data\Casts\PaymentModelCast; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Collection; use Spatie\LaravelData\Attributes\WithCast; diff --git a/src/Core/src/Data/Config/Payment/StatusData.php b/src/Core/src/Data/Config/Payment/StatusData.php index b64421cf..133dba76 100644 --- a/src/Core/src/Data/Config/Payment/StatusData.php +++ b/src/Core/src/Data/Config/Payment/StatusData.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Config\Payment; +namespace Cashbox\Core\Data\Config\Payment; -use CashierProvider\Core\Enums\StatusEnum; +use Cashbox\Core\Enums\StatusEnum; use Spatie\LaravelData\Attributes\MapName; use Spatie\LaravelData\Data; use Spatie\LaravelData\Mappers\SnakeCaseMapper; diff --git a/src/Core/src/Data/Config/Queue/QueueData.php b/src/Core/src/Data/Config/Queue/QueueData.php index 0478ccd5..a59ab217 100644 --- a/src/Core/src/Data/Config/Queue/QueueData.php +++ b/src/Core/src/Data/Config/Queue/QueueData.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Config\Queue; +namespace Cashbox\Core\Data\Config\Queue; -use CashierProvider\Core\Data\Casts\NumberCast; +use Cashbox\Core\Data\Casts\NumberCast; use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Attributes\WithCast; use Spatie\LaravelData\Data; diff --git a/src/Core/src/Data/Config/Queue/QueueNameData.php b/src/Core/src/Data/Config/Queue/QueueNameData.php index bcd25251..5c114fff 100644 --- a/src/Core/src/Data/Config/Queue/QueueNameData.php +++ b/src/Core/src/Data/Config/Queue/QueueNameData.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Config\Queue; +namespace Cashbox\Core\Data\Config\Queue; -use CashierProvider\Core\Data\Casts\FromEnumCast; +use Cashbox\Core\Data\Casts\FromEnumCast; use Spatie\LaravelData\Attributes\WithCast; use Spatie\LaravelData\Data; diff --git a/src/Core/src/Data/Config/RefundData.php b/src/Core/src/Data/Config/RefundData.php index 26cd21c8..5356aba7 100644 --- a/src/Core/src/Data/Config/RefundData.php +++ b/src/Core/src/Data/Config/RefundData.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Config; +namespace Cashbox\Core\Data\Config; -use CashierProvider\Core\Data\Casts\NumberCast; +use Cashbox\Core\Data\Casts\NumberCast; use Spatie\LaravelData\Attributes\WithCast; use Spatie\LaravelData\Data; diff --git a/src/Core/src/Data/Config/VerifyData.php b/src/Core/src/Data/Config/VerifyData.php index e37f30d6..7d0c97d5 100644 --- a/src/Core/src/Data/Config/VerifyData.php +++ b/src/Core/src/Data/Config/VerifyData.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Data\Config; +namespace Cashbox\Core\Data\Config; -use CashierProvider\Core\Data\Casts\NumberCast; +use Cashbox\Core\Data\Casts\NumberCast; use Spatie\LaravelData\Attributes\WithCast; use Spatie\LaravelData\Data; diff --git a/src/Core/src/Data/Models/InfoData.php b/src/Core/src/Data/Models/InfoData.php index 267204e5..ba4fb2a3 100644 --- a/src/Core/src/Data/Models/InfoData.php +++ b/src/Core/src/Data/Models/InfoData.php @@ -13,10 +13,10 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Core\Data\Models; +namespace Cashbox\Core\Data\Models; -use CashierProvider\Core\Concerns\Config\Payment\Payments; -use CashierProvider\Core\Enums\StatusEnum; +use Cashbox\Core\Concerns\Config\Payment\Payments; +use Cashbox\Core\Enums\StatusEnum; use Spatie\LaravelData\Data; /** diff --git a/src/Core/src/Enums/AttributeEnum.php b/src/Core/src/Enums/AttributeEnum.php index daadd7e1..c61feae0 100644 --- a/src/Core/src/Enums/AttributeEnum.php +++ b/src/Core/src/Enums/AttributeEnum.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Enums; +namespace Cashbox\Core\Enums; use ArchTech\Enums\InvokableCases; diff --git a/src/Core/src/Enums/CurrencyEnum.php b/src/Core/src/Enums/CurrencyEnum.php index 27e87dab..70b7ab23 100644 --- a/src/Core/src/Enums/CurrencyEnum.php +++ b/src/Core/src/Enums/CurrencyEnum.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Enums; +namespace Cashbox\Core\Enums; use ArchTech\Enums\Options; -use CashierProvider\Core\Concerns\Enums\From; +use Cashbox\Core\Concerns\Enums\From; /** @see ISO-4217 */ enum CurrencyEnum: int diff --git a/src/Core/src/Enums/RateLimiterEnum.php b/src/Core/src/Enums/RateLimiterEnum.php index a7bd8c57..65186d8d 100644 --- a/src/Core/src/Enums/RateLimiterEnum.php +++ b/src/Core/src/Enums/RateLimiterEnum.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Enums; +namespace Cashbox\Core\Enums; use ArchTech\Enums\InvokableCases; diff --git a/src/Core/src/Enums/StatusEnum.php b/src/Core/src/Enums/StatusEnum.php index f8aa48f8..2bf71529 100644 --- a/src/Core/src/Enums/StatusEnum.php +++ b/src/Core/src/Enums/StatusEnum.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\Core\Enums; +namespace Cashbox\Core\Enums; use ArchTech\Enums\InvokableCases; use ArchTech\Enums\Values; -use CashierProvider\Core\Concerns\Enums\From; +use Cashbox\Core\Concerns\Enums\From; /** * @method string deleted() diff --git a/src/Core/src/Events/BaseEvent.php b/src/Core/src/Events/BaseEvent.php index 66f2ec80..07819119 100644 --- a/src/Core/src/Events/BaseEvent.php +++ b/src/Core/src/Events/BaseEvent.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Events; +namespace Cashbox\Core\Events; use Illuminate\Database\Eloquent\Model; diff --git a/src/Core/src/Events/CreatedEvent.php b/src/Core/src/Events/CreatedEvent.php index afa806c0..c2511b73 100644 --- a/src/Core/src/Events/CreatedEvent.php +++ b/src/Core/src/Events/CreatedEvent.php @@ -15,6 +15,6 @@ declare(strict_types=1); -namespace CashierProvider\Core\Events; +namespace Cashbox\Core\Events; class CreatedEvent extends BaseEvent {} diff --git a/src/Core/src/Events/DeletedEvent.php b/src/Core/src/Events/DeletedEvent.php index d6b91db9..fc6b0c04 100644 --- a/src/Core/src/Events/DeletedEvent.php +++ b/src/Core/src/Events/DeletedEvent.php @@ -15,6 +15,6 @@ declare(strict_types=1); -namespace CashierProvider\Core\Events; +namespace Cashbox\Core\Events; class DeletedEvent extends BaseEvent {} diff --git a/src/Core/src/Events/FailedEvent.php b/src/Core/src/Events/FailedEvent.php index 676783b1..d84679bd 100644 --- a/src/Core/src/Events/FailedEvent.php +++ b/src/Core/src/Events/FailedEvent.php @@ -15,6 +15,6 @@ declare(strict_types=1); -namespace CashierProvider\Core\Events; +namespace Cashbox\Core\Events; class FailedEvent extends BaseEvent {} diff --git a/src/Core/src/Events/RefundedEvent.php b/src/Core/src/Events/RefundedEvent.php index 291c5a9c..56ba6418 100644 --- a/src/Core/src/Events/RefundedEvent.php +++ b/src/Core/src/Events/RefundedEvent.php @@ -15,6 +15,6 @@ declare(strict_types=1); -namespace CashierProvider\Core\Events; +namespace Cashbox\Core\Events; class RefundedEvent extends BaseEvent {} diff --git a/src/Core/src/Events/SuccessEvent.php b/src/Core/src/Events/SuccessEvent.php index 02d1eac1..3f5b4026 100644 --- a/src/Core/src/Events/SuccessEvent.php +++ b/src/Core/src/Events/SuccessEvent.php @@ -15,6 +15,6 @@ declare(strict_types=1); -namespace CashierProvider\Core\Events; +namespace Cashbox\Core\Events; class SuccessEvent extends BaseEvent {} diff --git a/src/Core/src/Events/WaitRefundEvent.php b/src/Core/src/Events/WaitRefundEvent.php index 91d9df8e..d39882d5 100644 --- a/src/Core/src/Events/WaitRefundEvent.php +++ b/src/Core/src/Events/WaitRefundEvent.php @@ -15,6 +15,6 @@ declare(strict_types=1); -namespace CashierProvider\Core\Events; +namespace Cashbox\Core\Events; class WaitRefundEvent extends BaseEvent {} diff --git a/src/Core/src/Exceptions/BaseException.php b/src/Core/src/Exceptions/BaseException.php index 931c1070..daed3e26 100644 --- a/src/Core/src/Exceptions/BaseException.php +++ b/src/Core/src/Exceptions/BaseException.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Exceptions; +namespace Cashbox\Core\Exceptions; use Exception; diff --git a/src/Core/src/Exceptions/External/BadRequestClientException.php b/src/Core/src/Exceptions/External/BadRequestClientException.php index 856df2ba..91b5e7db 100644 --- a/src/Core/src/Exceptions/External/BadRequestClientException.php +++ b/src/Core/src/Exceptions/External/BadRequestClientException.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Exceptions\External; +namespace Cashbox\Core\Exceptions\External; -use CashierProvider\Core\Exceptions\BaseException; +use Cashbox\Core\Exceptions\BaseException; class BadRequestClientException extends BaseException { diff --git a/src/Core/src/Exceptions/External/EmptyResponseException.php b/src/Core/src/Exceptions/External/EmptyResponseException.php index 07bdecef..f71248d6 100644 --- a/src/Core/src/Exceptions/External/EmptyResponseException.php +++ b/src/Core/src/Exceptions/External/EmptyResponseException.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Exceptions\External; +namespace Cashbox\Core\Exceptions\External; -use CashierProvider\Core\Exceptions\BaseException; +use Cashbox\Core\Exceptions\BaseException; class EmptyResponseException extends BaseException { diff --git a/src/Core/src/Exceptions/Internal/IncorrectPaymentModelException.php b/src/Core/src/Exceptions/Internal/IncorrectPaymentModelException.php index c878c519..d4848c31 100644 --- a/src/Core/src/Exceptions/Internal/IncorrectPaymentModelException.php +++ b/src/Core/src/Exceptions/Internal/IncorrectPaymentModelException.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Exceptions\Internal; +namespace Cashbox\Core\Exceptions\Internal; -use CashierProvider\Core\Exceptions\BaseException; +use Cashbox\Core\Exceptions\BaseException; class IncorrectPaymentModelException extends BaseException { diff --git a/src/Core/src/Exceptions/Internal/UnknownDriverConfigException.php b/src/Core/src/Exceptions/Internal/UnknownDriverConfigException.php index e2c5aa7a..be182c93 100644 --- a/src/Core/src/Exceptions/Internal/UnknownDriverConfigException.php +++ b/src/Core/src/Exceptions/Internal/UnknownDriverConfigException.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Exceptions\Internal; +namespace Cashbox\Core\Exceptions\Internal; -use CashierProvider\Core\Exceptions\BaseException; +use Cashbox\Core\Exceptions\BaseException; class UnknownDriverConfigException extends BaseException { diff --git a/src/Core/src/Facades/Config.php b/src/Core/src/Facades/Config.php index 97315dc8..d3d26f2d 100644 --- a/src/Core/src/Facades/Config.php +++ b/src/Core/src/Facades/Config.php @@ -15,16 +15,16 @@ declare(strict_types=1); -namespace CashierProvider\Core\Facades; +namespace Cashbox\Core\Facades; -use CashierProvider\Core\Data\Config\ConfigData; -use CashierProvider\Core\Data\Config\DetailsData; -use CashierProvider\Core\Data\Config\DriverData; -use CashierProvider\Core\Data\Config\LogsData; -use CashierProvider\Core\Data\Config\Payment\PaymentData; -use CashierProvider\Core\Data\Config\Queue\QueueData; -use CashierProvider\Core\Data\Config\RefundData; -use CashierProvider\Core\Data\Config\VerifyData; +use Cashbox\Core\Data\Config\ConfigData; +use Cashbox\Core\Data\Config\DetailsData; +use Cashbox\Core\Data\Config\DriverData; +use Cashbox\Core\Data\Config\LogsData; +use Cashbox\Core\Data\Config\Payment\PaymentData; +use Cashbox\Core\Data\Config\Queue\QueueData; +use Cashbox\Core\Data\Config\RefundData; +use Cashbox\Core\Data\Config\VerifyData; use Illuminate\Support\Facades\Facade; /** diff --git a/src/Core/src/Http/Request.php b/src/Core/src/Http/Request.php index f6d1e929..940d1413 100644 --- a/src/Core/src/Http/Request.php +++ b/src/Core/src/Http/Request.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Http; +namespace Cashbox\Core\Http; use DragonCode\Support\Concerns\Makeable; use Illuminate\Database\Eloquent\Model; diff --git a/src/Core/src/Http/ResponseInfo.php b/src/Core/src/Http/ResponseInfo.php index ced0deaa..5438eeb7 100644 --- a/src/Core/src/Http/ResponseInfo.php +++ b/src/Core/src/Http/ResponseInfo.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Core\Http; +namespace Cashbox\Core\Http; use DragonCode\Support\Facades\Helpers\Arr; use Spatie\LaravelData\Data; diff --git a/src/Core/src/Jobs/BaseJob.php b/src/Core/src/Jobs/BaseJob.php index 14f7542d..8fbbcf90 100644 --- a/src/Core/src/Jobs/BaseJob.php +++ b/src/Core/src/Jobs/BaseJob.php @@ -15,14 +15,14 @@ declare(strict_types=1); -namespace CashierProvider\Core\Jobs; - -use CashierProvider\Core\Billable; -use CashierProvider\Core\Concerns\Config\Queue; -use CashierProvider\Core\Enums\RateLimiterEnum; -use CashierProvider\Core\Exceptions\External\EmptyResponseException; -use CashierProvider\Core\Http\ResponseInfo; -use CashierProvider\Core\Services\Driver; +namespace Cashbox\Core\Jobs; + +use Cashbox\Core\Billable; +use Cashbox\Core\Concerns\Config\Queue; +use Cashbox\Core\Enums\RateLimiterEnum; +use Cashbox\Core\Exceptions\External\EmptyResponseException; +use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Services\Driver; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldBeUnique; use Illuminate\Contracts\Queue\ShouldQueue; diff --git a/src/Core/src/Jobs/RefundJob.php b/src/Core/src/Jobs/RefundJob.php index a6d1687b..d80294ca 100644 --- a/src/Core/src/Jobs/RefundJob.php +++ b/src/Core/src/Jobs/RefundJob.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Jobs; +namespace Cashbox\Core\Jobs; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class RefundJob extends BaseJob { diff --git a/src/Core/src/Jobs/StartJob.php b/src/Core/src/Jobs/StartJob.php index ba471732..176a1e1d 100644 --- a/src/Core/src/Jobs/StartJob.php +++ b/src/Core/src/Jobs/StartJob.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Jobs; +namespace Cashbox\Core\Jobs; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class StartJob extends BaseJob { diff --git a/src/Core/src/Jobs/VerifyJob.php b/src/Core/src/Jobs/VerifyJob.php index d1625df1..b3b62298 100644 --- a/src/Core/src/Jobs/VerifyJob.php +++ b/src/Core/src/Jobs/VerifyJob.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Jobs; +namespace Cashbox\Core\Jobs; -use CashierProvider\Core\Concerns\Permissions\Allowable; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Concerns\Permissions\Allowable; +use Cashbox\Core\Http\ResponseInfo; class VerifyJob extends BaseJob { diff --git a/src/Core/src/Models/Details.php b/src/Core/src/Models/Details.php index 51b8c323..d6b47eae 100644 --- a/src/Core/src/Models/Details.php +++ b/src/Core/src/Models/Details.php @@ -15,14 +15,14 @@ declare(strict_types=1); -namespace CashierProvider\Core\Models; +namespace Cashbox\Core\Models; -use CashierProvider\Core\Billable; -use CashierProvider\Core\Casts\InfoCast; -use CashierProvider\Core\Concerns\Config\Details as DetailsConcern; -use CashierProvider\Core\Data\Models\InfoData; -use CashierProvider\Core\Enums\StatusEnum; -use CashierProvider\Core\Facades\Config; +use Cashbox\Core\Billable; +use Cashbox\Core\Casts\InfoCast; +use Cashbox\Core\Concerns\Config\Details as DetailsConcern; +use Cashbox\Core\Data\Models\InfoData; +use Cashbox\Core\Enums\StatusEnum; +use Cashbox\Core\Facades\Config; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Relation; diff --git a/src/Core/src/Observers/PaymentDetailsObserver.php b/src/Core/src/Observers/PaymentDetailsObserver.php index 6ef78bf3..4ed62024 100644 --- a/src/Core/src/Observers/PaymentDetailsObserver.php +++ b/src/Core/src/Observers/PaymentDetailsObserver.php @@ -15,12 +15,12 @@ declare(strict_types=1); -namespace CashierProvider\Core\Observers; +namespace Cashbox\Core\Observers; -use CashierProvider\Core\Concerns\Config\Payment\Attributes; -use CashierProvider\Core\Concerns\Config\Payment\Payments; -use CashierProvider\Core\Enums\StatusEnum; -use CashierProvider\Core\Models\Details; +use Cashbox\Core\Concerns\Config\Payment\Attributes; +use Cashbox\Core\Concerns\Config\Payment\Payments; +use Cashbox\Core\Enums\StatusEnum; +use Cashbox\Core\Models\Details; use Illuminate\Database\Eloquent\Model; class PaymentDetailsObserver diff --git a/src/Core/src/Observers/PaymentObserver.php b/src/Core/src/Observers/PaymentObserver.php index 31be2d42..a0cfea23 100644 --- a/src/Core/src/Observers/PaymentObserver.php +++ b/src/Core/src/Observers/PaymentObserver.php @@ -15,13 +15,13 @@ declare(strict_types=1); -namespace CashierProvider\Core\Observers; +namespace Cashbox\Core\Observers; -use CashierProvider\Core\Concerns\Config\Payment\Attributes; -use CashierProvider\Core\Concerns\Events\Notifiable; -use CashierProvider\Core\Concerns\Helpers\Jobs; -use CashierProvider\Core\Concerns\Permissions\Allowable; -use CashierProvider\Core\Enums\StatusEnum; +use Cashbox\Core\Concerns\Config\Payment\Attributes; +use Cashbox\Core\Concerns\Events\Notifiable; +use Cashbox\Core\Concerns\Helpers\Jobs; +use Cashbox\Core\Concerns\Permissions\Allowable; +use Cashbox\Core\Enums\StatusEnum; use DragonCode\Support\Facades\Helpers\Arr; use Illuminate\Database\Eloquent\Model; diff --git a/src/Core/src/Providers/BaseProvider.php b/src/Core/src/Providers/BaseProvider.php index eb557cd7..5744b06b 100644 --- a/src/Core/src/Providers/BaseProvider.php +++ b/src/Core/src/Providers/BaseProvider.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Providers; +namespace Cashbox\Core\Providers; -use CashierProvider\Core\Concerns\Config\Payment\Payments; +use Cashbox\Core\Concerns\Config\Payment\Payments; use Illuminate\Support\ServiceProvider as BaseServiceProvider; use function class_exists; diff --git a/src/Core/src/Providers/ObserverServiceProvider.php b/src/Core/src/Providers/ObserverServiceProvider.php index e8f57913..9b7515e7 100644 --- a/src/Core/src/Providers/ObserverServiceProvider.php +++ b/src/Core/src/Providers/ObserverServiceProvider.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\Core\Providers; +namespace Cashbox\Core\Providers; -use CashierProvider\Core\Models\Details; -use CashierProvider\Core\Observers\PaymentDetailsObserver; -use CashierProvider\Core\Observers\PaymentObserver; +use Cashbox\Core\Models\Details; +use Cashbox\Core\Observers\PaymentDetailsObserver; +use Cashbox\Core\Observers\PaymentObserver; class ObserverServiceProvider extends BaseProvider { diff --git a/src/Core/src/Providers/RateLimiterServiceProvider.php b/src/Core/src/Providers/RateLimiterServiceProvider.php index 5416b778..5412981d 100644 --- a/src/Core/src/Providers/RateLimiterServiceProvider.php +++ b/src/Core/src/Providers/RateLimiterServiceProvider.php @@ -15,12 +15,12 @@ declare(strict_types=1); -namespace CashierProvider\Core\Providers; +namespace Cashbox\Core\Providers; -use CashierProvider\Core\Concerns\Config\Payment\Attributes; -use CashierProvider\Core\Concerns\Helpers\DateTime; -use CashierProvider\Core\Enums\RateLimiterEnum; -use CashierProvider\Core\Jobs\BaseJob; +use Cashbox\Core\Concerns\Config\Payment\Attributes; +use Cashbox\Core\Concerns\Helpers\DateTime; +use Cashbox\Core\Enums\RateLimiterEnum; +use Cashbox\Core\Jobs\BaseJob; use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\RateLimiter; diff --git a/src/Core/src/Providers/ServiceProvider.php b/src/Core/src/Providers/ServiceProvider.php index a6b9c66c..8f57234b 100644 --- a/src/Core/src/Providers/ServiceProvider.php +++ b/src/Core/src/Providers/ServiceProvider.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Providers; +namespace Cashbox\Core\Providers; -use CashierProvider\Core\Console\Commands\Refund; -use CashierProvider\Core\Console\Commands\Verify; +use Cashbox\Core\Console\Commands\Refund; +use Cashbox\Core\Console\Commands\Verify; class ServiceProvider extends BaseProvider { diff --git a/src/Core/src/Services/Authorize.php b/src/Core/src/Services/Authorize.php index 1d6a7894..56270355 100644 --- a/src/Core/src/Services/Authorize.php +++ b/src/Core/src/Services/Authorize.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\Core\Services; +namespace Cashbox\Core\Services; -use CashierProvider\Core\Concerns\Config\Payment\Attributes; -use CashierProvider\Core\Concerns\Config\Payment\Statuses; -use CashierProvider\Core\Facades\Config; +use Cashbox\Core\Concerns\Config\Payment\Attributes; +use Cashbox\Core\Concerns\Config\Payment\Statuses; +use Cashbox\Core\Facades\Config; use Illuminate\Database\Eloquent\Model; class Authorize diff --git a/src/Core/src/Services/Driver.php b/src/Core/src/Services/Driver.php index e46bfd5a..1f45345c 100644 --- a/src/Core/src/Services/Driver.php +++ b/src/Core/src/Services/Driver.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Services; +namespace Cashbox\Core\Services; -use CashierProvider\Core\Data\Config\DriverData; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Data\Config\DriverData; +use Cashbox\Core\Http\ResponseInfo; use Illuminate\Database\Eloquent\Model; abstract class Driver diff --git a/src/Core/src/Services/DriverManager.php b/src/Core/src/Services/DriverManager.php index 14dc8a7f..78e51269 100644 --- a/src/Core/src/Services/DriverManager.php +++ b/src/Core/src/Services/DriverManager.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\Core\Services; +namespace Cashbox\Core\Services; -use CashierProvider\Core\Concerns\Config\Payment\Drivers; -use CashierProvider\Core\Concerns\Helpers\Validatable; -use CashierProvider\Core\Data\Config\DriverData; +use Cashbox\Core\Concerns\Config\Payment\Drivers; +use Cashbox\Core\Concerns\Helpers\Validatable; +use Cashbox\Core\Data\Config\DriverData; use Illuminate\Database\Eloquent\Model; class DriverManager diff --git a/src/Core/src/Services/Exception.php b/src/Core/src/Services/Exception.php index 90b87c12..00b7dee1 100644 --- a/src/Core/src/Services/Exception.php +++ b/src/Core/src/Services/Exception.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Core\Services; +namespace Cashbox\Core\Services; -use CashierProvider\Core\Exceptions\External\BadRequestClientException; +use Cashbox\Core\Exceptions\External\BadRequestClientException; abstract class Exception { diff --git a/src/Core/src/Services/Http.php b/src/Core/src/Services/Http.php index 37bbd9e9..b0c58dbe 100644 --- a/src/Core/src/Services/Http.php +++ b/src/Core/src/Services/Http.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Services; +namespace Cashbox\Core\Services; -use CashierProvider\Core\Concerns\Helpers\Logging; -use CashierProvider\Core\Http\Request; +use Cashbox\Core\Concerns\Helpers\Logging; +use Cashbox\Core\Http\Request; use Illuminate\Http\Client\Response; use Illuminate\Support\Facades\Http as Client; diff --git a/src/Core/src/Services/Job.php b/src/Core/src/Services/Job.php index 332b6173..b1a4e3fc 100644 --- a/src/Core/src/Services/Job.php +++ b/src/Core/src/Services/Job.php @@ -15,16 +15,16 @@ declare(strict_types=1); -namespace CashierProvider\Core\Services; - -use CashierProvider\Core\Concerns\Config\Queue; -use CashierProvider\Core\Concerns\Config\Refund; -use CashierProvider\Core\Concerns\Helpers\Validatable; -use CashierProvider\Core\Concerns\Permissions\Allowable; -use CashierProvider\Core\Data\Config\Queue\QueueNameData; -use CashierProvider\Core\Jobs\RefundJob; -use CashierProvider\Core\Jobs\StartJob; -use CashierProvider\Core\Jobs\VerifyJob; +namespace Cashbox\Core\Services; + +use Cashbox\Core\Concerns\Config\Queue; +use Cashbox\Core\Concerns\Config\Refund; +use Cashbox\Core\Concerns\Helpers\Validatable; +use Cashbox\Core\Concerns\Permissions\Allowable; +use Cashbox\Core\Data\Config\Queue\QueueNameData; +use Cashbox\Core\Jobs\RefundJob; +use Cashbox\Core\Jobs\StartJob; +use Cashbox\Core\Jobs\VerifyJob; use Illuminate\Database\Eloquent\Model; class Job diff --git a/src/Core/src/Services/Statuses.php b/src/Core/src/Services/Statuses.php index cbdd5f79..f77ffb54 100644 --- a/src/Core/src/Services/Statuses.php +++ b/src/Core/src/Services/Statuses.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\Core\Services; +namespace Cashbox\Core\Services; -use CashierProvider\Core\Concerns\Config\Payment\Attributes; -use CashierProvider\Core\Concerns\Config\Payment\Payments; -use CashierProvider\Core\Enums\StatusEnum; +use Cashbox\Core\Concerns\Config\Payment\Attributes; +use Cashbox\Core\Concerns\Config\Payment\Payments; +use Cashbox\Core\Enums\StatusEnum; use DragonCode\Support\Facades\Helpers\Arr; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Str; diff --git a/src/Core/src/Services/Validator.php b/src/Core/src/Services/Validator.php index da3cda10..cffce47e 100644 --- a/src/Core/src/Services/Validator.php +++ b/src/Core/src/Services/Validator.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Core\Services; +namespace Cashbox\Core\Services; -use CashierProvider\Core\Billable; -use CashierProvider\Core\Exceptions\Internal\IncorrectPaymentModelException; +use Cashbox\Core\Billable; +use Cashbox\Core\Exceptions\Internal\IncorrectPaymentModelException; use DragonCode\Support\Facades\Instances\Instance; use Illuminate\Database\Eloquent\Model; diff --git a/src/SberAuth/composer.json b/src/SberAuth/composer.json index 8de2b982..d8df0427 100644 --- a/src/SberAuth/composer.json +++ b/src/SberAuth/composer.json @@ -54,7 +54,7 @@ "prefer-stable": true, "autoload": { "psr-4": { - "CashierProvider\\Sber\\Auth\\": "src/" + "Cashbox\\Sber\\Auth\\": "src/" } }, "config": { diff --git a/src/SberAuth/src/Auth.php b/src/SberAuth/src/Auth.php index 47a49f03..6605f628 100644 --- a/src/SberAuth/src/Auth.php +++ b/src/SberAuth/src/Auth.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Sber\Auth; +namespace Cashbox\Sber\Auth; -use CashierProvider\Core\Facades\Helpers\Unique; -use CashierProvider\Sber\Auth\Support\Hash; +use Cashbox\Core\Facades\Helpers\Unique; +use Cashbox\Sber\Auth\Support\Hash; use DragonCode\Contracts\Cashier\Auth\Auth as AuthContract; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\AccessToken; diff --git a/src/SberAuth/src/Constants/Keys.php b/src/SberAuth/src/Constants/Keys.php index 9f2e5342..77cee431 100644 --- a/src/SberAuth/src/Constants/Keys.php +++ b/src/SberAuth/src/Constants/Keys.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Sber\Auth\Constants; +namespace Cashbox\Sber\Auth\Constants; class Keys { diff --git a/src/SberAuth/src/Exceptions/Manager.php b/src/SberAuth/src/Exceptions/Manager.php index 9c7290c0..099fa924 100644 --- a/src/SberAuth/src/Exceptions/Manager.php +++ b/src/SberAuth/src/Exceptions/Manager.php @@ -13,10 +13,10 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Sber\Auth\Exceptions; +namespace Cashbox\Sber\Auth\Exceptions; -use CashierProvider\Core\Exceptions\Http\UnauthorizedException; -use CashierProvider\Core\Exceptions\Manager as ExceptionManager; +use Cashbox\Core\Exceptions\Http\UnauthorizedException; +use Cashbox\Core\Exceptions\Manager as ExceptionManager; class Manager extends ExceptionManager { diff --git a/src/SberAuth/src/Facades/Cache.php b/src/SberAuth/src/Facades/Cache.php index ddb9c491..9c9bb51f 100644 --- a/src/SberAuth/src/Facades/Cache.php +++ b/src/SberAuth/src/Facades/Cache.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\Sber\Auth\Facades; +namespace Cashbox\Sber\Auth\Facades; -use CashierProvider\Sber\Auth\Objects\Query; -use CashierProvider\Sber\Auth\Resources\AccessToken; -use CashierProvider\Sber\Auth\Support\Cache as Support; +use Cashbox\Sber\Auth\Objects\Query; +use Cashbox\Sber\Auth\Resources\AccessToken; +use Cashbox\Sber\Auth\Support\Cache as Support; use Illuminate\Support\Facades\Facade; /** diff --git a/src/SberAuth/src/Http/Request.php b/src/SberAuth/src/Http/Request.php index 0e0c2729..00bc4b3f 100644 --- a/src/SberAuth/src/Http/Request.php +++ b/src/SberAuth/src/Http/Request.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Sber\Auth\Http; +namespace Cashbox\Sber\Auth\Http; -use CashierProvider\Core\Facades\Config\Main; -use CashierProvider\Core\Http\Request as BaseRequest; +use Cashbox\Core\Facades\Config\Main; +use Cashbox\Core\Http\Request as BaseRequest; use DragonCode\Contracts\Cashier\Resources\Model; /** diff --git a/src/SberAuth/src/Objects/Query.php b/src/SberAuth/src/Objects/Query.php index 2e994d67..1ccb049c 100644 --- a/src/SberAuth/src/Objects/Query.php +++ b/src/SberAuth/src/Objects/Query.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Sber\Auth\Objects; +namespace Cashbox\Sber\Auth\Objects; use DragonCode\Contracts\Cashier\Resources\Model; use DragonCode\SimpleDataTransferObject\DataTransferObject; diff --git a/src/SberAuth/src/Resources/AccessToken.php b/src/SberAuth/src/Resources/AccessToken.php index 406179d3..3b31ed31 100644 --- a/src/SberAuth/src/Resources/AccessToken.php +++ b/src/SberAuth/src/Resources/AccessToken.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Sber\Auth\Resources; +namespace Cashbox\Sber\Auth\Resources; -use CashierProvider\Sber\Auth\Constants\Keys; +use Cashbox\Sber\Auth\Constants\Keys; use DragonCode\Contracts\Cashier\Resources\AccessToken as AccessTokenContract; use DragonCode\SimpleDataTransferObject\DataTransferObject; use Illuminate\Support\Carbon; diff --git a/src/SberAuth/src/Support/Cache.php b/src/SberAuth/src/Support/Cache.php index 6e332e7f..fd5e2fde 100644 --- a/src/SberAuth/src/Support/Cache.php +++ b/src/SberAuth/src/Support/Cache.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Sber\Auth\Support; +namespace Cashbox\Sber\Auth\Support; -use CashierProvider\Sber\Auth\Objects\Query; -use CashierProvider\Sber\Auth\Resources\AccessToken; +use Cashbox\Sber\Auth\Objects\Query; +use Cashbox\Sber\Auth\Resources\AccessToken; use DateTimeInterface; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Cache as Repository; diff --git a/src/SberAuth/src/Support/Hash.php b/src/SberAuth/src/Support/Hash.php index f47c768b..87655c8e 100644 --- a/src/SberAuth/src/Support/Hash.php +++ b/src/SberAuth/src/Support/Hash.php @@ -13,15 +13,15 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Sber\Auth\Support; +namespace Cashbox\Sber\Auth\Support; -use CashierProvider\Core\Facades\Helpers\Http; -use CashierProvider\Sber\Auth\Constants\Keys; -use CashierProvider\Sber\Auth\Exceptions\Manager as ExceptionManager; -use CashierProvider\Sber\Auth\Facades\Cache as CacheRepository; -use CashierProvider\Sber\Auth\Http\Request; -use CashierProvider\Sber\Auth\Objects\Query; -use CashierProvider\Sber\Auth\Resources\AccessToken; +use Cashbox\Core\Facades\Helpers\Http; +use Cashbox\Sber\Auth\Constants\Keys; +use Cashbox\Sber\Auth\Exceptions\Manager as ExceptionManager; +use Cashbox\Sber\Auth\Facades\Cache as CacheRepository; +use Cashbox\Sber\Auth\Http\Request; +use Cashbox\Sber\Auth\Objects\Query; +use Cashbox\Sber\Auth\Resources\AccessToken; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Cashier\Resources\Model; use DragonCode\Contracts\Exceptions\Manager; diff --git a/src/SberAuth/tests/Auth/BodyTest.php b/src/SberAuth/tests/Auth/BodyTest.php index 99295e70..9404bfce 100644 --- a/src/SberAuth/tests/Auth/BodyTest.php +++ b/src/SberAuth/tests/Auth/BodyTest.php @@ -17,7 +17,7 @@ namespace Tests\Auth; -use CashierProvider\Sber\Auth\Auth; +use Cashbox\Sber\Auth\Auth; use Tests\TestCase; class BodyTest extends TestCase diff --git a/src/SberAuth/tests/Auth/HeadersTest.php b/src/SberAuth/tests/Auth/HeadersTest.php index 1de467cb..6908054f 100644 --- a/src/SberAuth/tests/Auth/HeadersTest.php +++ b/src/SberAuth/tests/Auth/HeadersTest.php @@ -17,7 +17,7 @@ namespace Tests\Auth; -use CashierProvider\Sber\Auth\Auth; +use Cashbox\Sber\Auth\Auth; use DragonCode\Support\Facades\Helpers\Arr; use Tests\TestCase; diff --git a/src/SberAuth/tests/Auth/MakeTest.php b/src/SberAuth/tests/Auth/MakeTest.php index 824b1419..4682aaa3 100644 --- a/src/SberAuth/tests/Auth/MakeTest.php +++ b/src/SberAuth/tests/Auth/MakeTest.php @@ -17,7 +17,7 @@ namespace Tests\Auth; -use CashierProvider\Sber\Auth\Auth; +use Cashbox\Sber\Auth\Auth; use DragonCode\Contracts\Cashier\Auth\Auth as AuthContract; use Tests\TestCase; diff --git a/src/SberAuth/tests/Auth/RefreshTest.php b/src/SberAuth/tests/Auth/RefreshTest.php index b5dec206..b0439cfa 100644 --- a/src/SberAuth/tests/Auth/RefreshTest.php +++ b/src/SberAuth/tests/Auth/RefreshTest.php @@ -17,7 +17,7 @@ namespace Tests\Auth; -use CashierProvider\Sber\Auth\Auth; +use Cashbox\Sber\Auth\Auth; use DragonCode\Contracts\Cashier\Resources\Model; use DragonCode\Support\Facades\Helpers\Arr; use Tests\TestCase; diff --git a/src/SberAuth/tests/Fixtures/ModelEloquent.php b/src/SberAuth/tests/Fixtures/ModelEloquent.php index baf3d7e5..735565e6 100644 --- a/src/SberAuth/tests/Fixtures/ModelEloquent.php +++ b/src/SberAuth/tests/Fixtures/ModelEloquent.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/SberAuth/tests/Fixtures/ModelResource.php b/src/SberAuth/tests/Fixtures/ModelResource.php index d7b397b5..40247987 100644 --- a/src/SberAuth/tests/Fixtures/ModelResource.php +++ b/src/SberAuth/tests/Fixtures/ModelResource.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures; -use CashierProvider\Core\Resources\Model; +use Cashbox\Core\Resources\Model; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/SberAuth/tests/Fixtures/Request.php b/src/SberAuth/tests/Fixtures/Request.php index 90ee868d..9dca37d6 100644 --- a/src/SberAuth/tests/Fixtures/Request.php +++ b/src/SberAuth/tests/Fixtures/Request.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures; -use CashierProvider\Core\Http\Request as BaseRequest; +use Cashbox\Core\Http\Request as BaseRequest; class Request extends BaseRequest { diff --git a/src/SberAuth/tests/Resources/AccessToken/GetAccessTokenTest.php b/src/SberAuth/tests/Resources/AccessToken/GetAccessTokenTest.php index fecf073c..9d9d1406 100644 --- a/src/SberAuth/tests/Resources/AccessToken/GetAccessTokenTest.php +++ b/src/SberAuth/tests/Resources/AccessToken/GetAccessTokenTest.php @@ -17,7 +17,7 @@ namespace Tests\Resources\AccessToken; -use CashierProvider\Sber\Auth\Resources\AccessToken; +use Cashbox\Sber\Auth\Resources\AccessToken; use Tests\TestCase; class GetAccessTokenTest extends TestCase diff --git a/src/SberAuth/tests/Resources/AccessToken/GetClientIdTest.php b/src/SberAuth/tests/Resources/AccessToken/GetClientIdTest.php index 3830a874..a7dfc831 100644 --- a/src/SberAuth/tests/Resources/AccessToken/GetClientIdTest.php +++ b/src/SberAuth/tests/Resources/AccessToken/GetClientIdTest.php @@ -17,7 +17,7 @@ namespace Tests\Resources\AccessToken; -use CashierProvider\Sber\Auth\Resources\AccessToken; +use Cashbox\Sber\Auth\Resources\AccessToken; use Tests\TestCase; class GetClientIdTest extends TestCase diff --git a/src/SberAuth/tests/Resources/AccessToken/GetExpiresInTest.php b/src/SberAuth/tests/Resources/AccessToken/GetExpiresInTest.php index 5a65af4a..fba7a0f1 100644 --- a/src/SberAuth/tests/Resources/AccessToken/GetExpiresInTest.php +++ b/src/SberAuth/tests/Resources/AccessToken/GetExpiresInTest.php @@ -18,7 +18,7 @@ namespace Tests\Resources\AccessToken; use Carbon\Carbon as BaseCarbon; -use CashierProvider\Sber\Auth\Resources\AccessToken; +use Cashbox\Sber\Auth\Resources\AccessToken; use DateTimeInterface; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/SberAuth/tests/Resources/AccessToken/MakeTest.php b/src/SberAuth/tests/Resources/AccessToken/MakeTest.php index daea67a6..c083bb3b 100644 --- a/src/SberAuth/tests/Resources/AccessToken/MakeTest.php +++ b/src/SberAuth/tests/Resources/AccessToken/MakeTest.php @@ -17,7 +17,7 @@ namespace Tests\Resources\AccessToken; -use CashierProvider\Sber\Auth\Resources\AccessToken; +use Cashbox\Sber\Auth\Resources\AccessToken; use DragonCode\Contracts\Cashier\Resources\AccessToken as AccessTokenContract; use Tests\TestCase; diff --git a/src/SberAuth/tests/Support/Cache/BaseTest.php b/src/SberAuth/tests/Support/Cache/BaseTest.php index 54c54d20..411a8e75 100644 --- a/src/SberAuth/tests/Support/Cache/BaseTest.php +++ b/src/SberAuth/tests/Support/Cache/BaseTest.php @@ -17,9 +17,9 @@ namespace Tests\Support\Cache; -use CashierProvider\Sber\Auth\Objects\Query; -use CashierProvider\Sber\Auth\Support\Cache; -use CashierProvider\Sber\Auth\Support\Hash; +use Cashbox\Sber\Auth\Objects\Query; +use Cashbox\Sber\Auth\Support\Cache; +use Cashbox\Sber\Auth\Support\Hash; use DragonCode\Contracts\Cashier\Resources\Model; use DragonCode\Contracts\Http\Builder as BuilderContract; use DragonCode\Support\Facades\Http\Builder; diff --git a/src/SberAuth/tests/Support/Cache/ForgetTest.php b/src/SberAuth/tests/Support/Cache/ForgetTest.php index ae1dc0dc..e23e7ab3 100644 --- a/src/SberAuth/tests/Support/Cache/ForgetTest.php +++ b/src/SberAuth/tests/Support/Cache/ForgetTest.php @@ -17,7 +17,7 @@ namespace Tests\Support\Cache; -use CashierProvider\Sber\Auth\Support\Hash; +use Cashbox\Sber\Auth\Support\Hash; use Illuminate\Support\Facades\Cache as CacheRepository; class ForgetTest extends BaseTest diff --git a/src/SberAuth/tests/Support/Cache/GetTest.php b/src/SberAuth/tests/Support/Cache/GetTest.php index 131c57ba..acaab4c5 100644 --- a/src/SberAuth/tests/Support/Cache/GetTest.php +++ b/src/SberAuth/tests/Support/Cache/GetTest.php @@ -15,7 +15,7 @@ namespace Tests\Support\Cache; -use CashierProvider\Sber\Auth\Support\Hash; +use Cashbox\Sber\Auth\Support\Hash; use DragonCode\Support\Facades\Http\Builder; use Tests\TestCase; diff --git a/src/SberAuth/tests/Support/Hash/GetTest.php b/src/SberAuth/tests/Support/Hash/GetTest.php index b4d967b8..a03d2c97 100644 --- a/src/SberAuth/tests/Support/Hash/GetTest.php +++ b/src/SberAuth/tests/Support/Hash/GetTest.php @@ -18,7 +18,7 @@ namespace Tests\Support\Hash; use Carbon\Carbon as BaseCarbon; -use CashierProvider\Sber\Auth\Support\Hash; +use Cashbox\Sber\Auth\Support\Hash; use DateTimeInterface; use DragonCode\Contracts\Cashier\Resources\AccessToken; use DragonCode\Support\Facades\Http\Builder; diff --git a/src/SberAuth/tests/Support/Hash/MakeTest.php b/src/SberAuth/tests/Support/Hash/MakeTest.php index ae95056e..97405fc4 100644 --- a/src/SberAuth/tests/Support/Hash/MakeTest.php +++ b/src/SberAuth/tests/Support/Hash/MakeTest.php @@ -17,7 +17,7 @@ namespace Tests\Support\Hash; -use CashierProvider\Sber\Auth\Support\Hash; +use Cashbox\Sber\Auth\Support\Hash; use Tests\TestCase; class MakeTest extends TestCase diff --git a/src/SberAuth/tests/TestCase.php b/src/SberAuth/tests/TestCase.php index 03d351ad..96ea639b 100644 --- a/src/SberAuth/tests/TestCase.php +++ b/src/SberAuth/tests/TestCase.php @@ -15,9 +15,9 @@ namespace Tests; -use CashierProvider\Core\Config\Driver; -use CashierProvider\Core\Constants\Driver as DriverConstant; -use CashierProvider\Sber\Auth\Constants\Keys; +use Cashbox\Core\Config\Driver; +use Cashbox\Core\Constants\Driver as DriverConstant; +use Cashbox\Sber\Auth\Constants\Keys; use DragonCode\Contracts\Cashier\Config\Driver as DriverContract; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\Model; diff --git a/src/SberOnline/composer.json b/src/SberOnline/composer.json index 6fcb6526..4aea4563 100644 --- a/src/SberOnline/composer.json +++ b/src/SberOnline/composer.json @@ -46,7 +46,7 @@ }, "autoload": { "psr-4": { - "CashierProvider\\BankName\\Technology\\": "src/" + "Cashbox\\BankName\\Technology\\": "src/" } }, "config": { diff --git a/src/SberOnline/src/Driver.php b/src/SberOnline/src/Driver.php index d0053c50..e5331574 100644 --- a/src/SberOnline/src/Driver.php +++ b/src/SberOnline/src/Driver.php @@ -13,18 +13,18 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\BankName\Technology; - -use CashierProvider\BankName\Technology\Exceptions\Manager; -use CashierProvider\BankName\Technology\Helpers\Statuses; -use CashierProvider\BankName\Technology\Requests\Cancel; -use CashierProvider\BankName\Technology\Requests\GetState; -use CashierProvider\BankName\Technology\Requests\Init; -use CashierProvider\BankName\Technology\Resources\Details; -use CashierProvider\BankName\Technology\Responses\Created; -use CashierProvider\BankName\Technology\Responses\Refund; -use CashierProvider\BankName\Technology\Responses\State; -use CashierProvider\Core\Services\Driver as BaseDriver; +namespace Cashbox\BankName\Technology; + +use Cashbox\BankName\Technology\Exceptions\Manager; +use Cashbox\BankName\Technology\Helpers\Statuses; +use Cashbox\BankName\Technology\Requests\Cancel; +use Cashbox\BankName\Technology\Requests\GetState; +use Cashbox\BankName\Technology\Requests\Init; +use Cashbox\BankName\Technology\Resources\Details; +use Cashbox\BankName\Technology\Responses\Created; +use Cashbox\BankName\Technology\Responses\Refund; +use Cashbox\BankName\Technology\Responses\State; +use Cashbox\Core\Services\Driver as BaseDriver; use DragonCode\Contracts\Cashier\Http\Response; class Driver extends BaseDriver diff --git a/src/SberOnline/src/Exceptions/Manager.php b/src/SberOnline/src/Exceptions/Manager.php index 59441d8e..c74cc5b5 100644 --- a/src/SberOnline/src/Exceptions/Manager.php +++ b/src/SberOnline/src/Exceptions/Manager.php @@ -13,21 +13,21 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\BankName\Technology\Exceptions; +namespace Cashbox\BankName\Technology\Exceptions; -use CashierProvider\Core\Exceptions\Http\BankInternalErrorException; -use CashierProvider\Core\Exceptions\Http\BuyerNotFoundClientException; -use CashierProvider\Core\Exceptions\Http\CardHasStolenException; -use CashierProvider\Core\Exceptions\Http\ContactTheSellerClientException; -use CashierProvider\Core\Exceptions\Http\InsufficientFundsCardException; -use CashierProvider\Core\Exceptions\Http\InvalidCardException; -use CashierProvider\Core\Exceptions\Http\PaymentCompletedException; -use CashierProvider\Core\Exceptions\Http\PaymentDeclinedException; -use CashierProvider\Core\Exceptions\Http\PaymentTypeNotAvailableException; -use CashierProvider\Core\Exceptions\Http\SumException; -use CashierProvider\Core\Exceptions\Http\TooManyRequestsException; -use CashierProvider\Core\Exceptions\Http\TryAgainLaterClientException; -use CashierProvider\Core\Exceptions\Manager as ExceptionManager; +use Cashbox\Core\Exceptions\Http\BankInternalErrorException; +use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; +use Cashbox\Core\Exceptions\Http\CardHasStolenException; +use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; +use Cashbox\Core\Exceptions\Http\InsufficientFundsCardException; +use Cashbox\Core\Exceptions\Http\InvalidCardException; +use Cashbox\Core\Exceptions\Http\PaymentCompletedException; +use Cashbox\Core\Exceptions\Http\PaymentDeclinedException; +use Cashbox\Core\Exceptions\Http\PaymentTypeNotAvailableException; +use Cashbox\Core\Exceptions\Http\SumException; +use Cashbox\Core\Exceptions\Http\TooManyRequestsException; +use Cashbox\Core\Exceptions\Http\TryAgainLaterClientException; +use Cashbox\Core\Exceptions\Manager as ExceptionManager; class Manager extends ExceptionManager { diff --git a/src/SberOnline/src/Helpers/Statuses.php b/src/SberOnline/src/Helpers/Statuses.php index c99efc0f..7f57dd14 100644 --- a/src/SberOnline/src/Helpers/Statuses.php +++ b/src/SberOnline/src/Helpers/Statuses.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\BankName\Technology\Helpers; +namespace Cashbox\BankName\Technology\Helpers; -use CashierProvider\Core\Services\Statuses as BaseStatus; +use Cashbox\Core\Services\Statuses as BaseStatus; class Statuses extends BaseStatus { diff --git a/src/SberOnline/src/Requests/BaseRequest.php b/src/SberOnline/src/Requests/BaseRequest.php index 84868527..1c6f9a23 100644 --- a/src/SberOnline/src/Requests/BaseRequest.php +++ b/src/SberOnline/src/Requests/BaseRequest.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Requests; +namespace Cashbox\BankName\Technology\Requests; -use CashierProvider\BankName\Auth\Auth; -use CashierProvider\Core\Facades\Config\Main; -use CashierProvider\Core\Http\Request; +use Cashbox\BankName\Auth\Auth; +use Cashbox\Core\Facades\Config\Main; +use Cashbox\Core\Http\Request; abstract class BaseRequest extends Request { diff --git a/src/SberOnline/src/Requests/Cancel.php b/src/SberOnline/src/Requests/Cancel.php index 3c76741a..2d89e051 100644 --- a/src/SberOnline/src/Requests/Cancel.php +++ b/src/SberOnline/src/Requests/Cancel.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Requests; +namespace Cashbox\BankName\Technology\Requests; class Cancel extends BaseRequest { diff --git a/src/SberOnline/src/Requests/GetState.php b/src/SberOnline/src/Requests/GetState.php index 73d3149e..70c48368 100644 --- a/src/SberOnline/src/Requests/GetState.php +++ b/src/SberOnline/src/Requests/GetState.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Requests; +namespace Cashbox\BankName\Technology\Requests; class GetState extends BaseRequest { diff --git a/src/SberOnline/src/Requests/Init.php b/src/SberOnline/src/Requests/Init.php index 2bf89836..4762fc51 100644 --- a/src/SberOnline/src/Requests/Init.php +++ b/src/SberOnline/src/Requests/Init.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Requests; +namespace Cashbox\BankName\Technology\Requests; class Init extends BaseRequest { diff --git a/src/SberOnline/src/Resources/Details.php b/src/SberOnline/src/Resources/Details.php index 7e3b3d4c..2f5beca8 100644 --- a/src/SberOnline/src/Resources/Details.php +++ b/src/SberOnline/src/Resources/Details.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Resources; +namespace Cashbox\BankName\Technology\Resources; -use CashierProvider\Core\Resources\Details as BaseDetails; +use Cashbox\Core\Resources\Details as BaseDetails; class Details extends BaseDetails { diff --git a/src/SberOnline/src/Responses/Created.php b/src/SberOnline/src/Responses/Created.php index 947e6282..9880fe0b 100644 --- a/src/SberOnline/src/Responses/Created.php +++ b/src/SberOnline/src/Responses/Created.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Responses; +namespace Cashbox\BankName\Technology\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class Created extends ResponseInfo { diff --git a/src/SberOnline/src/Responses/Refund.php b/src/SberOnline/src/Responses/Refund.php index 79d11a83..e6fff41b 100644 --- a/src/SberOnline/src/Responses/Refund.php +++ b/src/SberOnline/src/Responses/Refund.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Responses; +namespace Cashbox\BankName\Technology\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class Refund extends ResponseInfo { diff --git a/src/SberOnline/src/Responses/State.php b/src/SberOnline/src/Responses/State.php index bc7b1baa..21004531 100644 --- a/src/SberOnline/src/Responses/State.php +++ b/src/SberOnline/src/Responses/State.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Responses; +namespace Cashbox\BankName\Technology\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class State extends ResponseInfo { diff --git a/src/SberOnline/tests/Concerns/TestServiceProvider.php b/src/SberOnline/tests/Concerns/TestServiceProvider.php index bbef67c6..f5ce1126 100644 --- a/src/SberOnline/tests/Concerns/TestServiceProvider.php +++ b/src/SberOnline/tests/Concerns/TestServiceProvider.php @@ -17,7 +17,7 @@ namespace Tests\Concerns; -use CashierProvider\Core\Providers\ServiceProvider; +use Cashbox\Core\Providers\ServiceProvider; class TestServiceProvider extends ServiceProvider { diff --git a/src/SberOnline/tests/DriverTest.php b/src/SberOnline/tests/DriverTest.php index 770532da..00abdb6c 100644 --- a/src/SberOnline/tests/DriverTest.php +++ b/src/SberOnline/tests/DriverTest.php @@ -15,9 +15,9 @@ namespace Tests; -use CashierProvider\BankName\Technology\Driver as Technology; -use CashierProvider\Core\Http\ResponseInfo; -use CashierProvider\Core\Services\Jobs; +use Cashbox\BankName\Technology\Driver as Technology; +use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Services\Jobs; use DragonCode\Contracts\Cashier\Driver as DriverContract; use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; use DragonCode\Support\Facades\Http\Url; diff --git a/src/SberOnline/tests/Fixtures/Models/ReadyPayment.php b/src/SberOnline/tests/Fixtures/Models/ReadyPayment.php index 8cb600ec..c3cbcd9f 100644 --- a/src/SberOnline/tests/Fixtures/Models/ReadyPayment.php +++ b/src/SberOnline/tests/Fixtures/Models/ReadyPayment.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/SberOnline/tests/Fixtures/Models/RequestPayment.php b/src/SberOnline/tests/Fixtures/Models/RequestPayment.php index f35795ae..f19ecd52 100644 --- a/src/SberOnline/tests/Fixtures/Models/RequestPayment.php +++ b/src/SberOnline/tests/Fixtures/Models/RequestPayment.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; /** diff --git a/src/SberOnline/tests/Fixtures/Resources/Model.php b/src/SberOnline/tests/Fixtures/Resources/Model.php index 5383e408..3328e3b7 100644 --- a/src/SberOnline/tests/Fixtures/Resources/Model.php +++ b/src/SberOnline/tests/Fixtures/Resources/Model.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Resources; -use CashierProvider\Core\Resources\Model as BaseModel; +use Cashbox\Core\Resources\Model as BaseModel; use Illuminate\Support\Carbon; /** @property \Tests\Fixtures\Models\ReadyPayment $model */ diff --git a/src/SberOnline/tests/Helpers/ExceptionTest.php b/src/SberOnline/tests/Helpers/ExceptionTest.php index d9e0c165..59630498 100644 --- a/src/SberOnline/tests/Helpers/ExceptionTest.php +++ b/src/SberOnline/tests/Helpers/ExceptionTest.php @@ -15,11 +15,11 @@ namespace Tests\Helpers; -use CashierProvider\BankName\Technology\Exceptions\Manager; -use CashierProvider\Core\Exceptions\Http\BadRequestClientException; -use CashierProvider\Core\Exceptions\Http\BaseException; -use CashierProvider\Core\Exceptions\Http\BuyerNotFoundClientException; -use CashierProvider\Core\Exceptions\Http\ContactTheSellerClientException; +use Cashbox\BankName\Technology\Exceptions\Manager; +use Cashbox\Core\Exceptions\Http\BadRequestClientException; +use Cashbox\Core\Exceptions\Http\BaseException; +use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; +use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; use DragonCode\Contracts\Http\Builder as HttpBuilder; use DragonCode\Support\Facades\Http\Builder; use Tests\TestCase; diff --git a/src/SberOnline/tests/Helpers/StatusesTest.php b/src/SberOnline/tests/Helpers/StatusesTest.php index ded0630f..d0268b33 100644 --- a/src/SberOnline/tests/Helpers/StatusesTest.php +++ b/src/SberOnline/tests/Helpers/StatusesTest.php @@ -15,8 +15,8 @@ namespace Tests\Helpers; -use CashierProvider\BankName\Technology\Helpers\Statuses; -use CashierProvider\BankName\Technology\Resources\Details; +use Cashbox\BankName\Technology\Helpers\Statuses; +use Cashbox\BankName\Technology\Resources\Details; use Tests\TestCase; class StatusesTest extends TestCase diff --git a/src/SberOnline/tests/Jobs/JobsTest.php b/src/SberOnline/tests/Jobs/JobsTest.php index de9a03bc..b3fa3c38 100644 --- a/src/SberOnline/tests/Jobs/JobsTest.php +++ b/src/SberOnline/tests/Jobs/JobsTest.php @@ -15,9 +15,9 @@ namespace Tests\Jobs; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Services\Jobs; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Services\Jobs; use DragonCode\Support\Facades\Http\Url; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\DB; diff --git a/src/SberOnline/tests/Observers/ObserverTest.php b/src/SberOnline/tests/Observers/ObserverTest.php index c289b712..e53da985 100644 --- a/src/SberOnline/tests/Observers/ObserverTest.php +++ b/src/SberOnline/tests/Observers/ObserverTest.php @@ -15,9 +15,9 @@ namespace Tests\Observers; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Providers\ObserverServiceProvider; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Providers\ObserverServiceProvider; use DragonCode\Support\Facades\Http\Url; use Illuminate\Database\Eloquent\Model; use Illuminate\Foundation\Testing\RefreshDatabase; diff --git a/src/SberOnline/tests/Requests/CancelTest.php b/src/SberOnline/tests/Requests/CancelTest.php index d261d726..788e5ee3 100644 --- a/src/SberOnline/tests/Requests/CancelTest.php +++ b/src/SberOnline/tests/Requests/CancelTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\BankName\Technology\Requests\Cancel; -use CashierProvider\Core\Http\Request; +use Cashbox\BankName\Technology\Requests\Cancel; +use Cashbox\Core\Http\Request; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/SberOnline/tests/Requests/GetStateTest.php b/src/SberOnline/tests/Requests/GetStateTest.php index ac2f9f97..8a7caa6c 100644 --- a/src/SberOnline/tests/Requests/GetStateTest.php +++ b/src/SberOnline/tests/Requests/GetStateTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\BankName\Technology\Requests\GetState; -use CashierProvider\Core\Http\Request; +use Cashbox\BankName\Technology\Requests\GetState; +use Cashbox\Core\Http\Request; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/SberOnline/tests/Requests/InitTest.php b/src/SberOnline/tests/Requests/InitTest.php index 93794fe0..dc7ca321 100644 --- a/src/SberOnline/tests/Requests/InitTest.php +++ b/src/SberOnline/tests/Requests/InitTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\BankName\Technology\Requests\Init; -use CashierProvider\Core\Http\Request; +use Cashbox\BankName\Technology\Requests\Init; +use Cashbox\Core\Http\Request; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/SberOnline/tests/Resources/DetailsTest.php b/src/SberOnline/tests/Resources/DetailsTest.php index f59a7748..efa173e0 100644 --- a/src/SberOnline/tests/Resources/DetailsTest.php +++ b/src/SberOnline/tests/Resources/DetailsTest.php @@ -15,8 +15,8 @@ namespace Tests\Resources; -use CashierProvider\BankName\Technology\Resources\Details; -use CashierProvider\Core\Resources\Details as BaseDetails; +use Cashbox\BankName\Technology\Resources\Details; +use Cashbox\Core\Resources\Details as BaseDetails; use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; use Tests\TestCase; diff --git a/src/SberOnline/tests/Responses/InitTest.php b/src/SberOnline/tests/Responses/InitTest.php index f483889b..dd1d0dce 100644 --- a/src/SberOnline/tests/Responses/InitTest.php +++ b/src/SberOnline/tests/Responses/InitTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\BankName\Technology\Responses\Created; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\BankName\Technology\Responses\Created; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/SberOnline/tests/Responses/RefundTest.php b/src/SberOnline/tests/Responses/RefundTest.php index 0bda0225..5fb33e96 100644 --- a/src/SberOnline/tests/Responses/RefundTest.php +++ b/src/SberOnline/tests/Responses/RefundTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\BankName\Technology\Responses\Refund; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\BankName\Technology\Responses\Refund; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/SberOnline/tests/Responses/StateTest.php b/src/SberOnline/tests/Responses/StateTest.php index 258b592f..2cee5a9e 100644 --- a/src/SberOnline/tests/Responses/StateTest.php +++ b/src/SberOnline/tests/Responses/StateTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\BankName\Technology\Responses\State; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\BankName\Technology\Responses\State; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/SberOnline/tests/TestCase.php b/src/SberOnline/tests/TestCase.php index 8e3b3197..e771194b 100644 --- a/src/SberOnline/tests/TestCase.php +++ b/src/SberOnline/tests/TestCase.php @@ -15,11 +15,11 @@ namespace Tests; -use CashierProvider\BankName\Technology\Driver; -use CashierProvider\Core\Config\Driver as DriverConfig; -use CashierProvider\Core\Constants\Driver as DriverConstant; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Models\CashierDetail; +use Cashbox\BankName\Technology\Driver; +use Cashbox\Core\Config\Driver as DriverConfig; +use Cashbox\Core\Constants\Driver as DriverConstant; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Models\CashierDetail; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\Details; use Illuminate\Database\Eloquent\Model as EloquentModel; @@ -101,7 +101,7 @@ protected function detailsRelation(EloquentModel $model, ?Details $details): Cas } /** - * @param \CashierProvider\BankName\Technology\Requests\BaseRequest|string $request + * @param \Cashbox\BankName\Technology\Requests\BaseRequest|string $request */ protected function request(string $request): Request { diff --git a/src/SberQrCode/composer.json b/src/SberQrCode/composer.json index faaedcf6..e6d8252f 100644 --- a/src/SberQrCode/composer.json +++ b/src/SberQrCode/composer.json @@ -51,7 +51,7 @@ "prefer-stable": true, "autoload": { "psr-4": { - "CashierProvider\\Sber\\QrCode\\": "src/" + "Cashbox\\Sber\\QrCode\\": "src/" } }, "config": { diff --git a/src/SberQrCode/src/Constants/Body.php b/src/SberQrCode/src/Constants/Body.php index e7e570cc..4171fba6 100644 --- a/src/SberQrCode/src/Constants/Body.php +++ b/src/SberQrCode/src/Constants/Body.php @@ -13,7 +13,7 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Sber\QrCode\Constants; +namespace Cashbox\Sber\QrCode\Constants; class Body { diff --git a/src/SberQrCode/src/Constants/Scopes.php b/src/SberQrCode/src/Constants/Scopes.php index 1d889cce..f81f879b 100644 --- a/src/SberQrCode/src/Constants/Scopes.php +++ b/src/SberQrCode/src/Constants/Scopes.php @@ -13,7 +13,7 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Sber\QrCode\Constants; +namespace Cashbox\Sber\QrCode\Constants; class Scopes { diff --git a/src/SberQrCode/src/Driver.php b/src/SberQrCode/src/Driver.php index 35e546c5..73927cdb 100644 --- a/src/SberQrCode/src/Driver.php +++ b/src/SberQrCode/src/Driver.php @@ -13,18 +13,18 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Sber\QrCode; - -use CashierProvider\Core\Services\Driver as BaseDriver; -use CashierProvider\Sber\QrCode\Exceptions\Manager; -use CashierProvider\Sber\QrCode\Helpers\Statuses; -use CashierProvider\Sber\QrCode\Requests\Cancel; -use CashierProvider\Sber\QrCode\Requests\Create; -use CashierProvider\Sber\QrCode\Requests\Status; -use CashierProvider\Sber\QrCode\Resources\Details; -use CashierProvider\Sber\QrCode\Responses\Cancel as CancelResponse; -use CashierProvider\Sber\QrCode\Responses\QrCode; -use CashierProvider\Sber\QrCode\Responses\Status as StatusResponse; +namespace Cashbox\Sber\QrCode; + +use Cashbox\Core\Services\Driver as BaseDriver; +use Cashbox\Sber\QrCode\Exceptions\Manager; +use Cashbox\Sber\QrCode\Helpers\Statuses; +use Cashbox\Sber\QrCode\Requests\Cancel; +use Cashbox\Sber\QrCode\Requests\Create; +use Cashbox\Sber\QrCode\Requests\Status; +use Cashbox\Sber\QrCode\Resources\Details; +use Cashbox\Sber\QrCode\Responses\Cancel as CancelResponse; +use Cashbox\Sber\QrCode\Responses\QrCode; +use Cashbox\Sber\QrCode\Responses\Status as StatusResponse; use DragonCode\Contracts\Cashier\Http\Response; class Driver extends BaseDriver diff --git a/src/SberQrCode/src/Exceptions/Manager.php b/src/SberQrCode/src/Exceptions/Manager.php index 5f2afcec..aa0e5b51 100644 --- a/src/SberQrCode/src/Exceptions/Manager.php +++ b/src/SberQrCode/src/Exceptions/Manager.php @@ -13,14 +13,14 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Sber\QrCode\Exceptions; - -use CashierProvider\Core\Exceptions\Http\BadRequestClientException; -use CashierProvider\Core\Exceptions\Http\BankInternalErrorException; -use CashierProvider\Core\Exceptions\Http\MethodNotFoundException; -use CashierProvider\Core\Exceptions\Http\TooManyRequestsException; -use CashierProvider\Core\Exceptions\Http\UnauthorizedException; -use CashierProvider\Core\Exceptions\Manager as ExceptionManager; +namespace Cashbox\Sber\QrCode\Exceptions; + +use Cashbox\Core\Exceptions\Http\BadRequestClientException; +use Cashbox\Core\Exceptions\Http\BankInternalErrorException; +use Cashbox\Core\Exceptions\Http\MethodNotFoundException; +use Cashbox\Core\Exceptions\Http\TooManyRequestsException; +use Cashbox\Core\Exceptions\Http\UnauthorizedException; +use Cashbox\Core\Exceptions\Manager as ExceptionManager; class Manager extends ExceptionManager { diff --git a/src/SberQrCode/src/Helpers/Statuses.php b/src/SberQrCode/src/Helpers/Statuses.php index 8274401b..b106085f 100644 --- a/src/SberQrCode/src/Helpers/Statuses.php +++ b/src/SberQrCode/src/Helpers/Statuses.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Sber\QrCode\Helpers; +namespace Cashbox\Sber\QrCode\Helpers; -use CashierProvider\Core\Services\Statuses as BaseStatus; +use Cashbox\Core\Services\Statuses as BaseStatus; class Statuses extends BaseStatus { diff --git a/src/SberQrCode/src/Requests/BaseRequest.php b/src/SberQrCode/src/Requests/BaseRequest.php index 7bb6d3b9..82495f20 100644 --- a/src/SberQrCode/src/Requests/BaseRequest.php +++ b/src/SberQrCode/src/Requests/BaseRequest.php @@ -15,12 +15,12 @@ declare(strict_types=1); -namespace CashierProvider\Sber\QrCode\Requests; +namespace Cashbox\Sber\QrCode\Requests; -use CashierProvider\Core\Facades\Config\Main; -use CashierProvider\Core\Facades\Helpers\Date; -use CashierProvider\Core\Http\Request; -use CashierProvider\Sber\Auth\Auth; +use Cashbox\Core\Facades\Config\Main; +use Cashbox\Core\Facades\Helpers\Date; +use Cashbox\Core\Http\Request; +use Cashbox\Sber\Auth\Auth; use Illuminate\Support\Carbon; abstract class BaseRequest extends Request diff --git a/src/SberQrCode/src/Requests/Cancel.php b/src/SberQrCode/src/Requests/Cancel.php index 5c104e42..87cd5087 100644 --- a/src/SberQrCode/src/Requests/Cancel.php +++ b/src/SberQrCode/src/Requests/Cancel.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Sber\QrCode\Requests; +namespace Cashbox\Sber\QrCode\Requests; -use CashierProvider\Sber\QrCode\Constants\Body; -use CashierProvider\Sber\QrCode\Constants\Scopes; +use Cashbox\Sber\QrCode\Constants\Body; +use Cashbox\Sber\QrCode\Constants\Scopes; class Cancel extends BaseRequest { diff --git a/src/SberQrCode/src/Requests/Create.php b/src/SberQrCode/src/Requests/Create.php index 9ea50233..d4228511 100644 --- a/src/SberQrCode/src/Requests/Create.php +++ b/src/SberQrCode/src/Requests/Create.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Sber\QrCode\Requests; +namespace Cashbox\Sber\QrCode\Requests; -use CashierProvider\Sber\QrCode\Constants\Body; -use CashierProvider\Sber\QrCode\Constants\Scopes; +use Cashbox\Sber\QrCode\Constants\Body; +use Cashbox\Sber\QrCode\Constants\Scopes; class Create extends BaseRequest { diff --git a/src/SberQrCode/src/Requests/Status.php b/src/SberQrCode/src/Requests/Status.php index ee4ffb7c..7bdfc09c 100644 --- a/src/SberQrCode/src/Requests/Status.php +++ b/src/SberQrCode/src/Requests/Status.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Sber\QrCode\Requests; +namespace Cashbox\Sber\QrCode\Requests; -use CashierProvider\Sber\QrCode\Constants\Body; -use CashierProvider\Sber\QrCode\Constants\Scopes; +use Cashbox\Sber\QrCode\Constants\Body; +use Cashbox\Sber\QrCode\Constants\Scopes; class Status extends BaseRequest { diff --git a/src/SberQrCode/src/Resources/Details.php b/src/SberQrCode/src/Resources/Details.php index 8c2f6f74..f449bbd8 100644 --- a/src/SberQrCode/src/Resources/Details.php +++ b/src/SberQrCode/src/Resources/Details.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Sber\QrCode\Resources; +namespace Cashbox\Sber\QrCode\Resources; -use CashierProvider\Core\Resources\Details as BaseDetails; +use Cashbox\Core\Resources\Details as BaseDetails; class Details extends BaseDetails { diff --git a/src/SberQrCode/src/Resources/Model.php b/src/SberQrCode/src/Resources/Model.php index 0accc175..06170f10 100644 --- a/src/SberQrCode/src/Resources/Model.php +++ b/src/SberQrCode/src/Resources/Model.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Sber\QrCode\Resources; +namespace Cashbox\Sber\QrCode\Resources; -use CashierProvider\Core\Resources\Model as BaseModel; +use Cashbox\Core\Resources\Model as BaseModel; abstract class Model extends BaseModel { diff --git a/src/SberQrCode/src/Responses/Cancel.php b/src/SberQrCode/src/Responses/Cancel.php index d5e061a1..fad063a1 100644 --- a/src/SberQrCode/src/Responses/Cancel.php +++ b/src/SberQrCode/src/Responses/Cancel.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Sber\QrCode\Responses; +namespace Cashbox\Sber\QrCode\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class Cancel extends ResponseInfo { diff --git a/src/SberQrCode/src/Responses/QrCode.php b/src/SberQrCode/src/Responses/QrCode.php index 32101555..5e8dc796 100644 --- a/src/SberQrCode/src/Responses/QrCode.php +++ b/src/SberQrCode/src/Responses/QrCode.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Sber\QrCode\Responses; +namespace Cashbox\Sber\QrCode\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class QrCode extends ResponseInfo { diff --git a/src/SberQrCode/src/Responses/Status.php b/src/SberQrCode/src/Responses/Status.php index 41b18060..f9e53ab7 100644 --- a/src/SberQrCode/src/Responses/Status.php +++ b/src/SberQrCode/src/Responses/Status.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Sber\QrCode\Responses; +namespace Cashbox\Sber\QrCode\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class Status extends ResponseInfo { diff --git a/src/SberQrCode/tests/Concerns/TestServiceProvider.php b/src/SberQrCode/tests/Concerns/TestServiceProvider.php index bbef67c6..f5ce1126 100644 --- a/src/SberQrCode/tests/Concerns/TestServiceProvider.php +++ b/src/SberQrCode/tests/Concerns/TestServiceProvider.php @@ -17,7 +17,7 @@ namespace Tests\Concerns; -use CashierProvider\Core\Providers\ServiceProvider; +use Cashbox\Core\Providers\ServiceProvider; class TestServiceProvider extends ServiceProvider { diff --git a/src/SberQrCode/tests/DriverTest.php b/src/SberQrCode/tests/DriverTest.php index a21e5a0b..a6acca53 100644 --- a/src/SberQrCode/tests/DriverTest.php +++ b/src/SberQrCode/tests/DriverTest.php @@ -15,9 +15,9 @@ namespace Tests; -use CashierProvider\Core\Http\ResponseInfo; -use CashierProvider\Core\Services\Jobs; -use CashierProvider\Sber\QrCode\Driver as QR; +use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Services\Jobs; +use Cashbox\Sber\QrCode\Driver as QR; use DragonCode\Contracts\Cashier\Driver as DriverContract; use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; use DragonCode\Support\Facades\Http\Url; diff --git a/src/SberQrCode/tests/Fixtures/Models/ReadyPayment.php b/src/SberQrCode/tests/Fixtures/Models/ReadyPayment.php index 7b5a32d0..6d7d21ec 100644 --- a/src/SberQrCode/tests/Fixtures/Models/ReadyPayment.php +++ b/src/SberQrCode/tests/Fixtures/Models/ReadyPayment.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/SberQrCode/tests/Fixtures/Models/RequestPayment.php b/src/SberQrCode/tests/Fixtures/Models/RequestPayment.php index db75799a..190a616d 100644 --- a/src/SberQrCode/tests/Fixtures/Models/RequestPayment.php +++ b/src/SberQrCode/tests/Fixtures/Models/RequestPayment.php @@ -14,7 +14,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; /** diff --git a/src/SberQrCode/tests/Fixtures/Models/StatusPayment.php b/src/SberQrCode/tests/Fixtures/Models/StatusPayment.php index 9739dc67..ff74c411 100644 --- a/src/SberQrCode/tests/Fixtures/Models/StatusPayment.php +++ b/src/SberQrCode/tests/Fixtures/Models/StatusPayment.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/SberQrCode/tests/Fixtures/Resources/Model.php b/src/SberQrCode/tests/Fixtures/Resources/Model.php index 261964e0..1e719f2c 100644 --- a/src/SberQrCode/tests/Fixtures/Resources/Model.php +++ b/src/SberQrCode/tests/Fixtures/Resources/Model.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Resources; -use CashierProvider\Sber\QrCode\Resources\Model as BaseModel; +use Cashbox\Sber\QrCode\Resources\Model as BaseModel; use Illuminate\Support\Carbon; /** @property \Tests\Fixtures\Models\ReadyPayment $model */ diff --git a/src/SberQrCode/tests/Helpers/ExceptionTest.php b/src/SberQrCode/tests/Helpers/ExceptionTest.php index 9563e0e7..53d9b898 100644 --- a/src/SberQrCode/tests/Helpers/ExceptionTest.php +++ b/src/SberQrCode/tests/Helpers/ExceptionTest.php @@ -15,10 +15,10 @@ namespace Tests\Helpers; -use CashierProvider\Core\Exceptions\Http\BadRequestClientException; -use CashierProvider\Core\Exceptions\Http\BankInternalErrorException; -use CashierProvider\Core\Exceptions\Http\BaseException; -use CashierProvider\Sber\QrCode\Exceptions\Manager; +use Cashbox\Core\Exceptions\Http\BadRequestClientException; +use Cashbox\Core\Exceptions\Http\BankInternalErrorException; +use Cashbox\Core\Exceptions\Http\BaseException; +use Cashbox\Sber\QrCode\Exceptions\Manager; use DragonCode\Contracts\Http\Builder as HttpBuilder; use DragonCode\Support\Facades\Http\Builder; use Tests\TestCase; diff --git a/src/SberQrCode/tests/Helpers/StatusesTest.php b/src/SberQrCode/tests/Helpers/StatusesTest.php index 92443387..4caf8e17 100644 --- a/src/SberQrCode/tests/Helpers/StatusesTest.php +++ b/src/SberQrCode/tests/Helpers/StatusesTest.php @@ -15,8 +15,8 @@ namespace Tests\Helpers; -use CashierProvider\Sber\QrCode\Helpers\Statuses; -use CashierProvider\Sber\QrCode\Resources\Details; +use Cashbox\Sber\QrCode\Helpers\Statuses; +use Cashbox\Sber\QrCode\Resources\Details; use Tests\Fixtures\Models\StatusPayment; use Tests\TestCase; diff --git a/src/SberQrCode/tests/Jobs/JobsTest.php b/src/SberQrCode/tests/Jobs/JobsTest.php index 9a94495c..a05b7a66 100644 --- a/src/SberQrCode/tests/Jobs/JobsTest.php +++ b/src/SberQrCode/tests/Jobs/JobsTest.php @@ -14,9 +14,9 @@ namespace Tests\Jobs; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Services\Jobs; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Services\Jobs; use DragonCode\Support\Facades\Http\Url; use Illuminate\Support\Facades\DB; use Tests\Fixtures\Models\RequestPayment; diff --git a/src/SberQrCode/tests/Observers/ObserverTest.php b/src/SberQrCode/tests/Observers/ObserverTest.php index db45c188..d0c04145 100644 --- a/src/SberQrCode/tests/Observers/ObserverTest.php +++ b/src/SberQrCode/tests/Observers/ObserverTest.php @@ -14,9 +14,9 @@ namespace Tests\Observers; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Providers\ObserverServiceProvider; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Providers\ObserverServiceProvider; use Illuminate\Support\Facades\DB; use Tests\Concerns\TestServiceProvider; use Tests\Fixtures\Models\RequestPayment; diff --git a/src/SberQrCode/tests/Requests/CancelTest.php b/src/SberQrCode/tests/Requests/CancelTest.php index 63261da1..ceef84b7 100644 --- a/src/SberQrCode/tests/Requests/CancelTest.php +++ b/src/SberQrCode/tests/Requests/CancelTest.php @@ -15,9 +15,9 @@ namespace Tests\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Sber\QrCode\Constants\Body; -use CashierProvider\Sber\QrCode\Requests\Cancel; +use Cashbox\Core\Http\Request; +use Cashbox\Sber\QrCode\Constants\Body; +use Cashbox\Sber\QrCode\Requests\Cancel; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use DragonCode\Support\Facades\Helpers\Arr; diff --git a/src/SberQrCode/tests/Requests/GetQRTest.php b/src/SberQrCode/tests/Requests/GetQRTest.php index d5144b71..c8964b3a 100644 --- a/src/SberQrCode/tests/Requests/GetQRTest.php +++ b/src/SberQrCode/tests/Requests/GetQRTest.php @@ -15,9 +15,9 @@ namespace Tests\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Sber\QrCode\Constants\Body; -use CashierProvider\Sber\QrCode\Requests\Create; +use Cashbox\Core\Http\Request; +use Cashbox\Sber\QrCode\Constants\Body; +use Cashbox\Sber\QrCode\Requests\Create; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use DragonCode\Support\Facades\Helpers\Arr; diff --git a/src/SberQrCode/tests/Resources/DetailsTest.php b/src/SberQrCode/tests/Resources/DetailsTest.php index 161bc57a..619c3eba 100644 --- a/src/SberQrCode/tests/Resources/DetailsTest.php +++ b/src/SberQrCode/tests/Resources/DetailsTest.php @@ -15,8 +15,8 @@ namespace Tests\Resources; -use CashierProvider\Core\Resources\Details as BaseDetails; -use CashierProvider\Sber\QrCode\Resources\Details; +use Cashbox\Core\Resources\Details as BaseDetails; +use Cashbox\Sber\QrCode\Resources\Details; use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; use Tests\TestCase; diff --git a/src/SberQrCode/tests/Responses/QrCodeTest.php b/src/SberQrCode/tests/Responses/QrCodeTest.php index 54296ea8..54d1b19a 100644 --- a/src/SberQrCode/tests/Responses/QrCodeTest.php +++ b/src/SberQrCode/tests/Responses/QrCodeTest.php @@ -15,7 +15,7 @@ namespace Tests\Responses; -use CashierProvider\Sber\QrCode\Responses\QrCode; +use Cashbox\Sber\QrCode\Responses\QrCode; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; @@ -61,7 +61,7 @@ public function testToArray() } /** - * @return \CashierProvider\Sber\QrCode\Responses\QrCode|\DragonCode\Contracts\Cashier\Http\Response + * @return \Cashbox\Sber\QrCode\Responses\QrCode|\DragonCode\Contracts\Cashier\Http\Response */ protected function response(): Response { diff --git a/src/SberQrCode/tests/Responses/RefundTest.php b/src/SberQrCode/tests/Responses/RefundTest.php index ca24af91..a42fb811 100644 --- a/src/SberQrCode/tests/Responses/RefundTest.php +++ b/src/SberQrCode/tests/Responses/RefundTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; -use CashierProvider\Sber\QrCode\Responses\Cancel as CancelResponse; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Sber\QrCode\Responses\Cancel as CancelResponse; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/SberQrCode/tests/Responses/StatusTest.php b/src/SberQrCode/tests/Responses/StatusTest.php index b5128055..4fe7c803 100644 --- a/src/SberQrCode/tests/Responses/StatusTest.php +++ b/src/SberQrCode/tests/Responses/StatusTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; -use CashierProvider\Sber\QrCode\Responses\Status; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Sber\QrCode\Responses\Status; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/SberQrCode/tests/TestCase.php b/src/SberQrCode/tests/TestCase.php index 4a781ff4..afa4b0c8 100644 --- a/src/SberQrCode/tests/TestCase.php +++ b/src/SberQrCode/tests/TestCase.php @@ -15,11 +15,11 @@ namespace Tests; -use CashierProvider\Core\Config\Driver as DriverConfig; -use CashierProvider\Core\Constants\Driver as DriverConstant; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Models\CashierDetail; -use CashierProvider\Sber\QrCode\Driver; +use Cashbox\Core\Config\Driver as DriverConfig; +use Cashbox\Core\Constants\Driver as DriverConstant; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Models\CashierDetail; +use Cashbox\Sber\QrCode\Driver; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\Details; use Illuminate\Database\Eloquent\Model as EloquentModel; @@ -114,7 +114,7 @@ protected function detailsRelation(EloquentModel $model, ?Details $details): Cas } /** - * @param \CashierProvider\Sber\QrCode\Requests\BaseRequest|string $request + * @param \Cashbox\Sber\QrCode\Requests\BaseRequest|string $request */ protected function request(string $request): Request { diff --git a/src/TemplateDriver/composer.json b/src/TemplateDriver/composer.json index ab70c1c7..20c8a9e9 100644 --- a/src/TemplateDriver/composer.json +++ b/src/TemplateDriver/composer.json @@ -62,7 +62,7 @@ "prefer-stable": true, "autoload": { "psr-4": { - "CashierProvider\\BankName\\Technology\\": "src/" + "Cashbox\\BankName\\Technology\\": "src/" } }, "config": { diff --git a/src/TemplateDriver/src/Driver.php b/src/TemplateDriver/src/Driver.php index d0053c50..e5331574 100644 --- a/src/TemplateDriver/src/Driver.php +++ b/src/TemplateDriver/src/Driver.php @@ -13,18 +13,18 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\BankName\Technology; - -use CashierProvider\BankName\Technology\Exceptions\Manager; -use CashierProvider\BankName\Technology\Helpers\Statuses; -use CashierProvider\BankName\Technology\Requests\Cancel; -use CashierProvider\BankName\Technology\Requests\GetState; -use CashierProvider\BankName\Technology\Requests\Init; -use CashierProvider\BankName\Technology\Resources\Details; -use CashierProvider\BankName\Technology\Responses\Created; -use CashierProvider\BankName\Technology\Responses\Refund; -use CashierProvider\BankName\Technology\Responses\State; -use CashierProvider\Core\Services\Driver as BaseDriver; +namespace Cashbox\BankName\Technology; + +use Cashbox\BankName\Technology\Exceptions\Manager; +use Cashbox\BankName\Technology\Helpers\Statuses; +use Cashbox\BankName\Technology\Requests\Cancel; +use Cashbox\BankName\Technology\Requests\GetState; +use Cashbox\BankName\Technology\Requests\Init; +use Cashbox\BankName\Technology\Resources\Details; +use Cashbox\BankName\Technology\Responses\Created; +use Cashbox\BankName\Technology\Responses\Refund; +use Cashbox\BankName\Technology\Responses\State; +use Cashbox\Core\Services\Driver as BaseDriver; use DragonCode\Contracts\Cashier\Http\Response; class Driver extends BaseDriver diff --git a/src/TemplateDriver/src/Exceptions/Manager.php b/src/TemplateDriver/src/Exceptions/Manager.php index 59441d8e..c74cc5b5 100644 --- a/src/TemplateDriver/src/Exceptions/Manager.php +++ b/src/TemplateDriver/src/Exceptions/Manager.php @@ -13,21 +13,21 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\BankName\Technology\Exceptions; +namespace Cashbox\BankName\Technology\Exceptions; -use CashierProvider\Core\Exceptions\Http\BankInternalErrorException; -use CashierProvider\Core\Exceptions\Http\BuyerNotFoundClientException; -use CashierProvider\Core\Exceptions\Http\CardHasStolenException; -use CashierProvider\Core\Exceptions\Http\ContactTheSellerClientException; -use CashierProvider\Core\Exceptions\Http\InsufficientFundsCardException; -use CashierProvider\Core\Exceptions\Http\InvalidCardException; -use CashierProvider\Core\Exceptions\Http\PaymentCompletedException; -use CashierProvider\Core\Exceptions\Http\PaymentDeclinedException; -use CashierProvider\Core\Exceptions\Http\PaymentTypeNotAvailableException; -use CashierProvider\Core\Exceptions\Http\SumException; -use CashierProvider\Core\Exceptions\Http\TooManyRequestsException; -use CashierProvider\Core\Exceptions\Http\TryAgainLaterClientException; -use CashierProvider\Core\Exceptions\Manager as ExceptionManager; +use Cashbox\Core\Exceptions\Http\BankInternalErrorException; +use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; +use Cashbox\Core\Exceptions\Http\CardHasStolenException; +use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; +use Cashbox\Core\Exceptions\Http\InsufficientFundsCardException; +use Cashbox\Core\Exceptions\Http\InvalidCardException; +use Cashbox\Core\Exceptions\Http\PaymentCompletedException; +use Cashbox\Core\Exceptions\Http\PaymentDeclinedException; +use Cashbox\Core\Exceptions\Http\PaymentTypeNotAvailableException; +use Cashbox\Core\Exceptions\Http\SumException; +use Cashbox\Core\Exceptions\Http\TooManyRequestsException; +use Cashbox\Core\Exceptions\Http\TryAgainLaterClientException; +use Cashbox\Core\Exceptions\Manager as ExceptionManager; class Manager extends ExceptionManager { diff --git a/src/TemplateDriver/src/Helpers/Statuses.php b/src/TemplateDriver/src/Helpers/Statuses.php index c99efc0f..7f57dd14 100644 --- a/src/TemplateDriver/src/Helpers/Statuses.php +++ b/src/TemplateDriver/src/Helpers/Statuses.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\BankName\Technology\Helpers; +namespace Cashbox\BankName\Technology\Helpers; -use CashierProvider\Core\Services\Statuses as BaseStatus; +use Cashbox\Core\Services\Statuses as BaseStatus; class Statuses extends BaseStatus { diff --git a/src/TemplateDriver/src/Requests/BaseRequest.php b/src/TemplateDriver/src/Requests/BaseRequest.php index 84868527..1c6f9a23 100644 --- a/src/TemplateDriver/src/Requests/BaseRequest.php +++ b/src/TemplateDriver/src/Requests/BaseRequest.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Requests; +namespace Cashbox\BankName\Technology\Requests; -use CashierProvider\BankName\Auth\Auth; -use CashierProvider\Core\Facades\Config\Main; -use CashierProvider\Core\Http\Request; +use Cashbox\BankName\Auth\Auth; +use Cashbox\Core\Facades\Config\Main; +use Cashbox\Core\Http\Request; abstract class BaseRequest extends Request { diff --git a/src/TemplateDriver/src/Requests/Cancel.php b/src/TemplateDriver/src/Requests/Cancel.php index 3c76741a..2d89e051 100644 --- a/src/TemplateDriver/src/Requests/Cancel.php +++ b/src/TemplateDriver/src/Requests/Cancel.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Requests; +namespace Cashbox\BankName\Technology\Requests; class Cancel extends BaseRequest { diff --git a/src/TemplateDriver/src/Requests/GetState.php b/src/TemplateDriver/src/Requests/GetState.php index 73d3149e..70c48368 100644 --- a/src/TemplateDriver/src/Requests/GetState.php +++ b/src/TemplateDriver/src/Requests/GetState.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Requests; +namespace Cashbox\BankName\Technology\Requests; class GetState extends BaseRequest { diff --git a/src/TemplateDriver/src/Requests/Init.php b/src/TemplateDriver/src/Requests/Init.php index 2bf89836..4762fc51 100644 --- a/src/TemplateDriver/src/Requests/Init.php +++ b/src/TemplateDriver/src/Requests/Init.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Requests; +namespace Cashbox\BankName\Technology\Requests; class Init extends BaseRequest { diff --git a/src/TemplateDriver/src/Resources/Details.php b/src/TemplateDriver/src/Resources/Details.php index 7e3b3d4c..2f5beca8 100644 --- a/src/TemplateDriver/src/Resources/Details.php +++ b/src/TemplateDriver/src/Resources/Details.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Resources; +namespace Cashbox\BankName\Technology\Resources; -use CashierProvider\Core\Resources\Details as BaseDetails; +use Cashbox\Core\Resources\Details as BaseDetails; class Details extends BaseDetails { diff --git a/src/TemplateDriver/src/Responses/Created.php b/src/TemplateDriver/src/Responses/Created.php index 947e6282..9880fe0b 100644 --- a/src/TemplateDriver/src/Responses/Created.php +++ b/src/TemplateDriver/src/Responses/Created.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Responses; +namespace Cashbox\BankName\Technology\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class Created extends ResponseInfo { diff --git a/src/TemplateDriver/src/Responses/Refund.php b/src/TemplateDriver/src/Responses/Refund.php index 79d11a83..e6fff41b 100644 --- a/src/TemplateDriver/src/Responses/Refund.php +++ b/src/TemplateDriver/src/Responses/Refund.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Responses; +namespace Cashbox\BankName\Technology\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class Refund extends ResponseInfo { diff --git a/src/TemplateDriver/src/Responses/State.php b/src/TemplateDriver/src/Responses/State.php index bc7b1baa..21004531 100644 --- a/src/TemplateDriver/src/Responses/State.php +++ b/src/TemplateDriver/src/Responses/State.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Technology\Responses; +namespace Cashbox\BankName\Technology\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class State extends ResponseInfo { diff --git a/src/TemplateDriver/tests/Concerns/TestServiceProvider.php b/src/TemplateDriver/tests/Concerns/TestServiceProvider.php index bbef67c6..f5ce1126 100644 --- a/src/TemplateDriver/tests/Concerns/TestServiceProvider.php +++ b/src/TemplateDriver/tests/Concerns/TestServiceProvider.php @@ -17,7 +17,7 @@ namespace Tests\Concerns; -use CashierProvider\Core\Providers\ServiceProvider; +use Cashbox\Core\Providers\ServiceProvider; class TestServiceProvider extends ServiceProvider { diff --git a/src/TemplateDriver/tests/DriverTest.php b/src/TemplateDriver/tests/DriverTest.php index 770532da..00abdb6c 100644 --- a/src/TemplateDriver/tests/DriverTest.php +++ b/src/TemplateDriver/tests/DriverTest.php @@ -15,9 +15,9 @@ namespace Tests; -use CashierProvider\BankName\Technology\Driver as Technology; -use CashierProvider\Core\Http\ResponseInfo; -use CashierProvider\Core\Services\Jobs; +use Cashbox\BankName\Technology\Driver as Technology; +use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Services\Jobs; use DragonCode\Contracts\Cashier\Driver as DriverContract; use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; use DragonCode\Support\Facades\Http\Url; diff --git a/src/TemplateDriver/tests/Fixtures/Models/ReadyPayment.php b/src/TemplateDriver/tests/Fixtures/Models/ReadyPayment.php index 8cb600ec..c3cbcd9f 100644 --- a/src/TemplateDriver/tests/Fixtures/Models/ReadyPayment.php +++ b/src/TemplateDriver/tests/Fixtures/Models/ReadyPayment.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/TemplateDriver/tests/Fixtures/Models/RequestPayment.php b/src/TemplateDriver/tests/Fixtures/Models/RequestPayment.php index f35795ae..f19ecd52 100644 --- a/src/TemplateDriver/tests/Fixtures/Models/RequestPayment.php +++ b/src/TemplateDriver/tests/Fixtures/Models/RequestPayment.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; /** diff --git a/src/TemplateDriver/tests/Fixtures/Resources/Model.php b/src/TemplateDriver/tests/Fixtures/Resources/Model.php index 5383e408..3328e3b7 100644 --- a/src/TemplateDriver/tests/Fixtures/Resources/Model.php +++ b/src/TemplateDriver/tests/Fixtures/Resources/Model.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Resources; -use CashierProvider\Core\Resources\Model as BaseModel; +use Cashbox\Core\Resources\Model as BaseModel; use Illuminate\Support\Carbon; /** @property \Tests\Fixtures\Models\ReadyPayment $model */ diff --git a/src/TemplateDriver/tests/Helpers/ExceptionTest.php b/src/TemplateDriver/tests/Helpers/ExceptionTest.php index d9e0c165..59630498 100644 --- a/src/TemplateDriver/tests/Helpers/ExceptionTest.php +++ b/src/TemplateDriver/tests/Helpers/ExceptionTest.php @@ -15,11 +15,11 @@ namespace Tests\Helpers; -use CashierProvider\BankName\Technology\Exceptions\Manager; -use CashierProvider\Core\Exceptions\Http\BadRequestClientException; -use CashierProvider\Core\Exceptions\Http\BaseException; -use CashierProvider\Core\Exceptions\Http\BuyerNotFoundClientException; -use CashierProvider\Core\Exceptions\Http\ContactTheSellerClientException; +use Cashbox\BankName\Technology\Exceptions\Manager; +use Cashbox\Core\Exceptions\Http\BadRequestClientException; +use Cashbox\Core\Exceptions\Http\BaseException; +use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; +use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; use DragonCode\Contracts\Http\Builder as HttpBuilder; use DragonCode\Support\Facades\Http\Builder; use Tests\TestCase; diff --git a/src/TemplateDriver/tests/Helpers/StatusesTest.php b/src/TemplateDriver/tests/Helpers/StatusesTest.php index ded0630f..d0268b33 100644 --- a/src/TemplateDriver/tests/Helpers/StatusesTest.php +++ b/src/TemplateDriver/tests/Helpers/StatusesTest.php @@ -15,8 +15,8 @@ namespace Tests\Helpers; -use CashierProvider\BankName\Technology\Helpers\Statuses; -use CashierProvider\BankName\Technology\Resources\Details; +use Cashbox\BankName\Technology\Helpers\Statuses; +use Cashbox\BankName\Technology\Resources\Details; use Tests\TestCase; class StatusesTest extends TestCase diff --git a/src/TemplateDriver/tests/Jobs/JobsTest.php b/src/TemplateDriver/tests/Jobs/JobsTest.php index de9a03bc..b3fa3c38 100644 --- a/src/TemplateDriver/tests/Jobs/JobsTest.php +++ b/src/TemplateDriver/tests/Jobs/JobsTest.php @@ -15,9 +15,9 @@ namespace Tests\Jobs; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Services\Jobs; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Services\Jobs; use DragonCode\Support\Facades\Http\Url; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\DB; diff --git a/src/TemplateDriver/tests/Observers/ObserverTest.php b/src/TemplateDriver/tests/Observers/ObserverTest.php index c289b712..e53da985 100644 --- a/src/TemplateDriver/tests/Observers/ObserverTest.php +++ b/src/TemplateDriver/tests/Observers/ObserverTest.php @@ -15,9 +15,9 @@ namespace Tests\Observers; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Providers\ObserverServiceProvider; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Providers\ObserverServiceProvider; use DragonCode\Support\Facades\Http\Url; use Illuminate\Database\Eloquent\Model; use Illuminate\Foundation\Testing\RefreshDatabase; diff --git a/src/TemplateDriver/tests/Requests/CancelTest.php b/src/TemplateDriver/tests/Requests/CancelTest.php index d261d726..788e5ee3 100644 --- a/src/TemplateDriver/tests/Requests/CancelTest.php +++ b/src/TemplateDriver/tests/Requests/CancelTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\BankName\Technology\Requests\Cancel; -use CashierProvider\Core\Http\Request; +use Cashbox\BankName\Technology\Requests\Cancel; +use Cashbox\Core\Http\Request; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/TemplateDriver/tests/Requests/GetStateTest.php b/src/TemplateDriver/tests/Requests/GetStateTest.php index ac2f9f97..8a7caa6c 100644 --- a/src/TemplateDriver/tests/Requests/GetStateTest.php +++ b/src/TemplateDriver/tests/Requests/GetStateTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\BankName\Technology\Requests\GetState; -use CashierProvider\Core\Http\Request; +use Cashbox\BankName\Technology\Requests\GetState; +use Cashbox\Core\Http\Request; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/TemplateDriver/tests/Requests/InitTest.php b/src/TemplateDriver/tests/Requests/InitTest.php index 93794fe0..dc7ca321 100644 --- a/src/TemplateDriver/tests/Requests/InitTest.php +++ b/src/TemplateDriver/tests/Requests/InitTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\BankName\Technology\Requests\Init; -use CashierProvider\Core\Http\Request; +use Cashbox\BankName\Technology\Requests\Init; +use Cashbox\Core\Http\Request; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/TemplateDriver/tests/Resources/DetailsTest.php b/src/TemplateDriver/tests/Resources/DetailsTest.php index f59a7748..efa173e0 100644 --- a/src/TemplateDriver/tests/Resources/DetailsTest.php +++ b/src/TemplateDriver/tests/Resources/DetailsTest.php @@ -15,8 +15,8 @@ namespace Tests\Resources; -use CashierProvider\BankName\Technology\Resources\Details; -use CashierProvider\Core\Resources\Details as BaseDetails; +use Cashbox\BankName\Technology\Resources\Details; +use Cashbox\Core\Resources\Details as BaseDetails; use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; use Tests\TestCase; diff --git a/src/TemplateDriver/tests/Responses/InitTest.php b/src/TemplateDriver/tests/Responses/InitTest.php index f483889b..dd1d0dce 100644 --- a/src/TemplateDriver/tests/Responses/InitTest.php +++ b/src/TemplateDriver/tests/Responses/InitTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\BankName\Technology\Responses\Created; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\BankName\Technology\Responses\Created; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/TemplateDriver/tests/Responses/RefundTest.php b/src/TemplateDriver/tests/Responses/RefundTest.php index 0bda0225..5fb33e96 100644 --- a/src/TemplateDriver/tests/Responses/RefundTest.php +++ b/src/TemplateDriver/tests/Responses/RefundTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\BankName\Technology\Responses\Refund; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\BankName\Technology\Responses\Refund; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/TemplateDriver/tests/Responses/StateTest.php b/src/TemplateDriver/tests/Responses/StateTest.php index 258b592f..2cee5a9e 100644 --- a/src/TemplateDriver/tests/Responses/StateTest.php +++ b/src/TemplateDriver/tests/Responses/StateTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\BankName\Technology\Responses\State; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\BankName\Technology\Responses\State; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/TemplateDriver/tests/TestCase.php b/src/TemplateDriver/tests/TestCase.php index 8e3b3197..e771194b 100644 --- a/src/TemplateDriver/tests/TestCase.php +++ b/src/TemplateDriver/tests/TestCase.php @@ -15,11 +15,11 @@ namespace Tests; -use CashierProvider\BankName\Technology\Driver; -use CashierProvider\Core\Config\Driver as DriverConfig; -use CashierProvider\Core\Constants\Driver as DriverConstant; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Models\CashierDetail; +use Cashbox\BankName\Technology\Driver; +use Cashbox\Core\Config\Driver as DriverConfig; +use Cashbox\Core\Constants\Driver as DriverConstant; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Models\CashierDetail; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\Details; use Illuminate\Database\Eloquent\Model as EloquentModel; @@ -101,7 +101,7 @@ protected function detailsRelation(EloquentModel $model, ?Details $details): Cas } /** - * @param \CashierProvider\BankName\Technology\Requests\BaseRequest|string $request + * @param \Cashbox\BankName\Technology\Requests\BaseRequest|string $request */ protected function request(string $request): Request { diff --git a/src/TemplateDriverAuth/composer.json b/src/TemplateDriverAuth/composer.json index 622451e2..7c2e4cc7 100644 --- a/src/TemplateDriverAuth/composer.json +++ b/src/TemplateDriverAuth/composer.json @@ -56,7 +56,7 @@ "prefer-stable": true, "autoload": { "psr-4": { - "CashierProvider\\BankName\\Auth\\": "src/" + "Cashbox\\BankName\\Auth\\": "src/" } }, "config": { diff --git a/src/TemplateDriverAuth/src/Auth.php b/src/TemplateDriverAuth/src/Auth.php index ce257203..0a1664da 100644 --- a/src/TemplateDriverAuth/src/Auth.php +++ b/src/TemplateDriverAuth/src/Auth.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Auth; +namespace Cashbox\BankName\Auth; -use CashierProvider\BankName\Auth\Constants\Keys; -use CashierProvider\BankName\Auth\Resources\AccessToken; -use CashierProvider\BankName\Auth\Support\Hash; +use Cashbox\BankName\Auth\Constants\Keys; +use Cashbox\BankName\Auth\Resources\AccessToken; +use Cashbox\BankName\Auth\Support\Hash; use DragonCode\Contracts\Cashier\Auth\Auth as AuthContract; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\Model; diff --git a/src/TemplateDriverAuth/src/Constants/Keys.php b/src/TemplateDriverAuth/src/Constants/Keys.php index 4dc5e955..5fbdea91 100644 --- a/src/TemplateDriverAuth/src/Constants/Keys.php +++ b/src/TemplateDriverAuth/src/Constants/Keys.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\BankName\Auth\Constants; +namespace Cashbox\BankName\Auth\Constants; class Keys { diff --git a/src/TemplateDriverAuth/src/Resources/AccessToken.php b/src/TemplateDriverAuth/src/Resources/AccessToken.php index b5d16404..eba6d1bf 100644 --- a/src/TemplateDriverAuth/src/Resources/AccessToken.php +++ b/src/TemplateDriverAuth/src/Resources/AccessToken.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\BankName\Auth\Resources; +namespace Cashbox\BankName\Auth\Resources; -use CashierProvider\BankName\Auth\Constants\Keys; +use Cashbox\BankName\Auth\Constants\Keys; use DragonCode\Contracts\Cashier\Resources\AccessToken as AccessTokenContract; use DragonCode\SimpleDataTransferObject\DataTransferObject; use Illuminate\Support\Carbon; diff --git a/src/TemplateDriverAuth/src/Support/Hash.php b/src/TemplateDriverAuth/src/Support/Hash.php index d8d6c749..27537ccb 100644 --- a/src/TemplateDriverAuth/src/Support/Hash.php +++ b/src/TemplateDriverAuth/src/Support/Hash.php @@ -13,10 +13,10 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\BankName\Auth\Support; +namespace Cashbox\BankName\Auth\Support; -use CashierProvider\BankName\Auth\Constants\Keys; -use CashierProvider\BankName\Auth\Resources\AccessToken; +use Cashbox\BankName\Auth\Constants\Keys; +use Cashbox\BankName\Auth\Resources\AccessToken; use DragonCode\Contracts\Cashier\Resources\Model; use DragonCode\Support\Concerns\Makeable; use DragonCode\Support\Facades\Helpers\Ables\Arrayable; diff --git a/src/TemplateDriverAuth/tests/Auth/BodyTest.php b/src/TemplateDriverAuth/tests/Auth/BodyTest.php index d4285570..014597e7 100644 --- a/src/TemplateDriverAuth/tests/Auth/BodyTest.php +++ b/src/TemplateDriverAuth/tests/Auth/BodyTest.php @@ -17,7 +17,7 @@ namespace Tests\Auth; -use CashierProvider\BankName\Auth\Auth; +use Cashbox\BankName\Auth\Auth; use Tests\TestCase; class BodyTest extends TestCase diff --git a/src/TemplateDriverAuth/tests/Auth/HeadersTest.php b/src/TemplateDriverAuth/tests/Auth/HeadersTest.php index 98082de5..36e91242 100644 --- a/src/TemplateDriverAuth/tests/Auth/HeadersTest.php +++ b/src/TemplateDriverAuth/tests/Auth/HeadersTest.php @@ -17,7 +17,7 @@ namespace Tests\Auth; -use CashierProvider\BankName\Auth\Auth; +use Cashbox\BankName\Auth\Auth; use Tests\TestCase; class HeadersTest extends TestCase diff --git a/src/TemplateDriverAuth/tests/Auth/MakeTest.php b/src/TemplateDriverAuth/tests/Auth/MakeTest.php index 9e237146..fd76c55b 100644 --- a/src/TemplateDriverAuth/tests/Auth/MakeTest.php +++ b/src/TemplateDriverAuth/tests/Auth/MakeTest.php @@ -17,7 +17,7 @@ namespace Tests\Auth; -use CashierProvider\BankName\Auth\Auth; +use Cashbox\BankName\Auth\Auth; use DragonCode\Contracts\Cashier\Auth\Auth as AuthContract; use Tests\TestCase; diff --git a/src/TemplateDriverAuth/tests/Fixtures/ModelResource.php b/src/TemplateDriverAuth/tests/Fixtures/ModelResource.php index cb85697a..45a14395 100644 --- a/src/TemplateDriverAuth/tests/Fixtures/ModelResource.php +++ b/src/TemplateDriverAuth/tests/Fixtures/ModelResource.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures; -use CashierProvider\Core\Resources\Model; +use Cashbox\Core\Resources\Model; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/TemplateDriverAuth/tests/Fixtures/Request.php b/src/TemplateDriverAuth/tests/Fixtures/Request.php index a5b2a524..b767089c 100644 --- a/src/TemplateDriverAuth/tests/Fixtures/Request.php +++ b/src/TemplateDriverAuth/tests/Fixtures/Request.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures; -use CashierProvider\Core\Http\Request as BaseRequest; +use Cashbox\Core\Http\Request as BaseRequest; class Request extends BaseRequest { diff --git a/src/TemplateDriverAuth/tests/Resources/AccessToken/GetAccessTokenTest.php b/src/TemplateDriverAuth/tests/Resources/AccessToken/GetAccessTokenTest.php index 7dac90c2..ae7cac8f 100644 --- a/src/TemplateDriverAuth/tests/Resources/AccessToken/GetAccessTokenTest.php +++ b/src/TemplateDriverAuth/tests/Resources/AccessToken/GetAccessTokenTest.php @@ -17,7 +17,7 @@ namespace Tests\Resources\AccessToken; -use CashierProvider\BankName\Auth\Resources\AccessToken; +use Cashbox\BankName\Auth\Resources\AccessToken; use Tests\TestCase; class GetAccessTokenTest extends TestCase diff --git a/src/TemplateDriverAuth/tests/Resources/AccessToken/GetClientIdTest.php b/src/TemplateDriverAuth/tests/Resources/AccessToken/GetClientIdTest.php index 5e457f70..7526c558 100644 --- a/src/TemplateDriverAuth/tests/Resources/AccessToken/GetClientIdTest.php +++ b/src/TemplateDriverAuth/tests/Resources/AccessToken/GetClientIdTest.php @@ -17,7 +17,7 @@ namespace Tests\Resources\AccessToken; -use CashierProvider\BankName\Auth\Resources\AccessToken; +use Cashbox\BankName\Auth\Resources\AccessToken; use Tests\TestCase; class GetClientIdTest extends TestCase diff --git a/src/TemplateDriverAuth/tests/Resources/AccessToken/GetExpiresInTest.php b/src/TemplateDriverAuth/tests/Resources/AccessToken/GetExpiresInTest.php index 829afa30..fe49809e 100644 --- a/src/TemplateDriverAuth/tests/Resources/AccessToken/GetExpiresInTest.php +++ b/src/TemplateDriverAuth/tests/Resources/AccessToken/GetExpiresInTest.php @@ -18,7 +18,7 @@ namespace Tests\Resources\AccessToken; use Carbon\Carbon as BaseCarbon; -use CashierProvider\BankName\Auth\Resources\AccessToken; +use Cashbox\BankName\Auth\Resources\AccessToken; use DateTimeInterface; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/TemplateDriverAuth/tests/Resources/AccessToken/MakeTest.php b/src/TemplateDriverAuth/tests/Resources/AccessToken/MakeTest.php index d5573124..60b75463 100644 --- a/src/TemplateDriverAuth/tests/Resources/AccessToken/MakeTest.php +++ b/src/TemplateDriverAuth/tests/Resources/AccessToken/MakeTest.php @@ -17,7 +17,7 @@ namespace Tests\Resources\AccessToken; -use CashierProvider\BankName\Auth\Resources\AccessToken; +use Cashbox\BankName\Auth\Resources\AccessToken; use DragonCode\Contracts\Cashier\Resources\AccessToken as AccessTokenContract; use Tests\TestCase; diff --git a/src/TemplateDriverAuth/tests/Support/Hash/GetTest.php b/src/TemplateDriverAuth/tests/Support/Hash/GetTest.php index 3586acd6..82c692be 100644 --- a/src/TemplateDriverAuth/tests/Support/Hash/GetTest.php +++ b/src/TemplateDriverAuth/tests/Support/Hash/GetTest.php @@ -18,7 +18,7 @@ namespace Tests\Support\Hash; use Carbon\Carbon as BaseCarbon; -use CashierProvider\BankName\Auth\Support\Hash; +use Cashbox\BankName\Auth\Support\Hash; use DateTimeInterface; use DragonCode\Contracts\Cashier\Resources\AccessToken; use Illuminate\Support\Carbon; diff --git a/src/TemplateDriverAuth/tests/Support/Hash/MakeTest.php b/src/TemplateDriverAuth/tests/Support/Hash/MakeTest.php index 5bd1529e..29901221 100644 --- a/src/TemplateDriverAuth/tests/Support/Hash/MakeTest.php +++ b/src/TemplateDriverAuth/tests/Support/Hash/MakeTest.php @@ -17,7 +17,7 @@ namespace Tests\Support\Hash; -use CashierProvider\BankName\Auth\Support\Hash; +use Cashbox\BankName\Auth\Support\Hash; use Tests\TestCase; class MakeTest extends TestCase diff --git a/src/TemplateDriverAuth/tests/TestCase.php b/src/TemplateDriverAuth/tests/TestCase.php index cd35195d..99e3c542 100644 --- a/src/TemplateDriverAuth/tests/TestCase.php +++ b/src/TemplateDriverAuth/tests/TestCase.php @@ -15,8 +15,8 @@ namespace Tests; -use CashierProvider\Core\Config\Driver; -use CashierProvider\Core\Constants\Driver as DriverConstant; +use Cashbox\Core\Config\Driver; +use Cashbox\Core\Constants\Driver as DriverConstant; use DragonCode\Contracts\Cashier\Config\Driver as DriverCotract; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\Model; diff --git a/src/TinkoffAuth/composer.json b/src/TinkoffAuth/composer.json index e132d87f..22166c0d 100644 --- a/src/TinkoffAuth/composer.json +++ b/src/TinkoffAuth/composer.json @@ -53,7 +53,7 @@ "prefer-stable": true, "autoload": { "psr-4": { - "CashierProvider\\Tinkoff\\Auth\\": "src/" + "Cashbox\\Tinkoff\\Auth\\": "src/" } }, "config": { diff --git a/src/TinkoffAuth/src/Auth.php b/src/TinkoffAuth/src/Auth.php index cb396b67..65cc4646 100644 --- a/src/TinkoffAuth/src/Auth.php +++ b/src/TinkoffAuth/src/Auth.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Auth; +namespace Cashbox\Tinkoff\Auth; -use CashierProvider\Tinkoff\Auth\Constants\Keys; -use CashierProvider\Tinkoff\Auth\Resources\AccessToken; -use CashierProvider\Tinkoff\Auth\Support\Hash; +use Cashbox\Tinkoff\Auth\Constants\Keys; +use Cashbox\Tinkoff\Auth\Resources\AccessToken; +use Cashbox\Tinkoff\Auth\Support\Hash; use DragonCode\Contracts\Cashier\Auth\Auth as AuthContract; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\Model; diff --git a/src/TinkoffAuth/src/Constants/Keys.php b/src/TinkoffAuth/src/Constants/Keys.php index c118ebba..5623ab1e 100644 --- a/src/TinkoffAuth/src/Constants/Keys.php +++ b/src/TinkoffAuth/src/Constants/Keys.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Auth\Constants; +namespace Cashbox\Tinkoff\Auth\Constants; class Keys { diff --git a/src/TinkoffAuth/src/Resources/AccessToken.php b/src/TinkoffAuth/src/Resources/AccessToken.php index 7472e272..a1d1fb52 100644 --- a/src/TinkoffAuth/src/Resources/AccessToken.php +++ b/src/TinkoffAuth/src/Resources/AccessToken.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\Auth\Resources; +namespace Cashbox\Tinkoff\Auth\Resources; -use CashierProvider\Tinkoff\Auth\Constants\Keys; +use Cashbox\Tinkoff\Auth\Constants\Keys; use DragonCode\Contracts\Cashier\Resources\AccessToken as AccessTokenContract; use DragonCode\SimpleDataTransferObject\DataTransferObject; use Illuminate\Support\Carbon; diff --git a/src/TinkoffAuth/src/Support/Hash.php b/src/TinkoffAuth/src/Support/Hash.php index eb88a08a..75b34025 100644 --- a/src/TinkoffAuth/src/Support/Hash.php +++ b/src/TinkoffAuth/src/Support/Hash.php @@ -13,10 +13,10 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\Auth\Support; +namespace Cashbox\Tinkoff\Auth\Support; -use CashierProvider\Tinkoff\Auth\Constants\Keys; -use CashierProvider\Tinkoff\Auth\Resources\AccessToken; +use Cashbox\Tinkoff\Auth\Constants\Keys; +use Cashbox\Tinkoff\Auth\Resources\AccessToken; use DragonCode\Contracts\Cashier\Resources\Model; use DragonCode\Support\Concerns\Makeable; use DragonCode\Support\Facades\Helpers\Ables\Arrayable; diff --git a/src/TinkoffAuth/tests/Auth/BodyTest.php b/src/TinkoffAuth/tests/Auth/BodyTest.php index 1e60a13f..8b94b86f 100644 --- a/src/TinkoffAuth/tests/Auth/BodyTest.php +++ b/src/TinkoffAuth/tests/Auth/BodyTest.php @@ -17,7 +17,7 @@ namespace Tests\Auth; -use CashierProvider\Tinkoff\Auth\Auth; +use Cashbox\Tinkoff\Auth\Auth; use Tests\TestCase; class BodyTest extends TestCase diff --git a/src/TinkoffAuth/tests/Auth/HeadersTest.php b/src/TinkoffAuth/tests/Auth/HeadersTest.php index b8e13b15..4543bf0e 100644 --- a/src/TinkoffAuth/tests/Auth/HeadersTest.php +++ b/src/TinkoffAuth/tests/Auth/HeadersTest.php @@ -17,7 +17,7 @@ namespace Tests\Auth; -use CashierProvider\Tinkoff\Auth\Auth; +use Cashbox\Tinkoff\Auth\Auth; use Tests\TestCase; class HeadersTest extends TestCase diff --git a/src/TinkoffAuth/tests/Auth/MakeTest.php b/src/TinkoffAuth/tests/Auth/MakeTest.php index 30a8da2d..39a5650a 100644 --- a/src/TinkoffAuth/tests/Auth/MakeTest.php +++ b/src/TinkoffAuth/tests/Auth/MakeTest.php @@ -17,7 +17,7 @@ namespace Tests\Auth; -use CashierProvider\Tinkoff\Auth\Auth; +use Cashbox\Tinkoff\Auth\Auth; use DragonCode\Contracts\Cashier\Auth\Auth as AuthContract; use Tests\TestCase; diff --git a/src/TinkoffAuth/tests/Fixtures/ModelResource.php b/src/TinkoffAuth/tests/Fixtures/ModelResource.php index cb85697a..45a14395 100644 --- a/src/TinkoffAuth/tests/Fixtures/ModelResource.php +++ b/src/TinkoffAuth/tests/Fixtures/ModelResource.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures; -use CashierProvider\Core\Resources\Model; +use Cashbox\Core\Resources\Model; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/TinkoffAuth/tests/Fixtures/Request.php b/src/TinkoffAuth/tests/Fixtures/Request.php index a5b2a524..b767089c 100644 --- a/src/TinkoffAuth/tests/Fixtures/Request.php +++ b/src/TinkoffAuth/tests/Fixtures/Request.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures; -use CashierProvider\Core\Http\Request as BaseRequest; +use Cashbox\Core\Http\Request as BaseRequest; class Request extends BaseRequest { diff --git a/src/TinkoffAuth/tests/Resources/AccessToken/GetAccessTokenTest.php b/src/TinkoffAuth/tests/Resources/AccessToken/GetAccessTokenTest.php index 5a29d42c..465ad2c1 100644 --- a/src/TinkoffAuth/tests/Resources/AccessToken/GetAccessTokenTest.php +++ b/src/TinkoffAuth/tests/Resources/AccessToken/GetAccessTokenTest.php @@ -17,7 +17,7 @@ namespace Tests\Resources\AccessToken; -use CashierProvider\Tinkoff\Auth\Resources\AccessToken; +use Cashbox\Tinkoff\Auth\Resources\AccessToken; use Tests\TestCase; class GetAccessTokenTest extends TestCase diff --git a/src/TinkoffAuth/tests/Resources/AccessToken/GetClientIdTest.php b/src/TinkoffAuth/tests/Resources/AccessToken/GetClientIdTest.php index 3e0b45da..7d23342e 100644 --- a/src/TinkoffAuth/tests/Resources/AccessToken/GetClientIdTest.php +++ b/src/TinkoffAuth/tests/Resources/AccessToken/GetClientIdTest.php @@ -17,7 +17,7 @@ namespace Tests\Resources\AccessToken; -use CashierProvider\Tinkoff\Auth\Resources\AccessToken; +use Cashbox\Tinkoff\Auth\Resources\AccessToken; use Tests\TestCase; class GetClientIdTest extends TestCase diff --git a/src/TinkoffAuth/tests/Resources/AccessToken/GetExpiresInTest.php b/src/TinkoffAuth/tests/Resources/AccessToken/GetExpiresInTest.php index 3946db61..6ae26517 100644 --- a/src/TinkoffAuth/tests/Resources/AccessToken/GetExpiresInTest.php +++ b/src/TinkoffAuth/tests/Resources/AccessToken/GetExpiresInTest.php @@ -18,7 +18,7 @@ namespace Tests\Resources\AccessToken; use Carbon\Carbon as BaseCarbon; -use CashierProvider\Tinkoff\Auth\Resources\AccessToken; +use Cashbox\Tinkoff\Auth\Resources\AccessToken; use DateTimeInterface; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/TinkoffAuth/tests/Resources/AccessToken/MakeTest.php b/src/TinkoffAuth/tests/Resources/AccessToken/MakeTest.php index aba10370..7bc4155c 100644 --- a/src/TinkoffAuth/tests/Resources/AccessToken/MakeTest.php +++ b/src/TinkoffAuth/tests/Resources/AccessToken/MakeTest.php @@ -17,7 +17,7 @@ namespace Tests\Resources\AccessToken; -use CashierProvider\Tinkoff\Auth\Resources\AccessToken; +use Cashbox\Tinkoff\Auth\Resources\AccessToken; use DragonCode\Contracts\Cashier\Resources\AccessToken as AccessTokenContract; use Tests\TestCase; diff --git a/src/TinkoffAuth/tests/Support/Hash/GetTest.php b/src/TinkoffAuth/tests/Support/Hash/GetTest.php index 3aa16b20..71307b7d 100644 --- a/src/TinkoffAuth/tests/Support/Hash/GetTest.php +++ b/src/TinkoffAuth/tests/Support/Hash/GetTest.php @@ -18,7 +18,7 @@ namespace Tests\Support\Hash; use Carbon\Carbon as BaseCarbon; -use CashierProvider\Tinkoff\Auth\Support\Hash; +use Cashbox\Tinkoff\Auth\Support\Hash; use DateTimeInterface; use DragonCode\Contracts\Cashier\Resources\AccessToken; use Illuminate\Support\Carbon; diff --git a/src/TinkoffAuth/tests/Support/Hash/MakeTest.php b/src/TinkoffAuth/tests/Support/Hash/MakeTest.php index 8913d449..0a628c7e 100644 --- a/src/TinkoffAuth/tests/Support/Hash/MakeTest.php +++ b/src/TinkoffAuth/tests/Support/Hash/MakeTest.php @@ -17,7 +17,7 @@ namespace Tests\Support\Hash; -use CashierProvider\Tinkoff\Auth\Support\Hash; +use Cashbox\Tinkoff\Auth\Support\Hash; use Tests\TestCase; class MakeTest extends TestCase diff --git a/src/TinkoffAuth/tests/TestCase.php b/src/TinkoffAuth/tests/TestCase.php index cd35195d..99e3c542 100644 --- a/src/TinkoffAuth/tests/TestCase.php +++ b/src/TinkoffAuth/tests/TestCase.php @@ -15,8 +15,8 @@ namespace Tests; -use CashierProvider\Core\Config\Driver; -use CashierProvider\Core\Constants\Driver as DriverConstant; +use Cashbox\Core\Config\Driver; +use Cashbox\Core\Constants\Driver as DriverConstant; use DragonCode\Contracts\Cashier\Config\Driver as DriverCotract; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\Model; diff --git a/src/TinkoffCredit/composer.json b/src/TinkoffCredit/composer.json index 576ab46f..6310bf25 100644 --- a/src/TinkoffCredit/composer.json +++ b/src/TinkoffCredit/composer.json @@ -48,7 +48,7 @@ "prefer-stable": true, "autoload": { "psr-4": { - "CashierProvider\\Tinkoff\\Credit\\": "src/" + "Cashbox\\Tinkoff\\Credit\\": "src/" } }, "config": { diff --git a/src/TinkoffCredit/src/Driver.php b/src/TinkoffCredit/src/Driver.php index 892d20d4..829c6993 100644 --- a/src/TinkoffCredit/src/Driver.php +++ b/src/TinkoffCredit/src/Driver.php @@ -13,18 +13,18 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\Credit; - -use CashierProvider\Core\Services\Driver as BaseDriver; -use CashierProvider\Tinkoff\Credit\Exceptions\Manager; -use CashierProvider\Tinkoff\Credit\Helpers\Statuses; -use CashierProvider\Tinkoff\Credit\Requests\Cancel; -use CashierProvider\Tinkoff\Credit\Requests\GetState; -use CashierProvider\Tinkoff\Credit\Requests\Init; -use CashierProvider\Tinkoff\Credit\Resources\Details; -use CashierProvider\Tinkoff\Credit\Responses\Created; -use CashierProvider\Tinkoff\Credit\Responses\Refund; -use CashierProvider\Tinkoff\Credit\Responses\State; +namespace Cashbox\Tinkoff\Credit; + +use Cashbox\Core\Services\Driver as BaseDriver; +use Cashbox\Tinkoff\Credit\Exceptions\Manager; +use Cashbox\Tinkoff\Credit\Helpers\Statuses; +use Cashbox\Tinkoff\Credit\Requests\Cancel; +use Cashbox\Tinkoff\Credit\Requests\GetState; +use Cashbox\Tinkoff\Credit\Requests\Init; +use Cashbox\Tinkoff\Credit\Resources\Details; +use Cashbox\Tinkoff\Credit\Responses\Created; +use Cashbox\Tinkoff\Credit\Responses\Refund; +use Cashbox\Tinkoff\Credit\Responses\State; use DragonCode\Contracts\Cashier\Http\Response; class Driver extends BaseDriver diff --git a/src/TinkoffCredit/src/Exceptions/Http/CancelDeniedException.php b/src/TinkoffCredit/src/Exceptions/Http/CancelDeniedException.php index a5f97e44..d6cc6af1 100644 --- a/src/TinkoffCredit/src/Exceptions/Http/CancelDeniedException.php +++ b/src/TinkoffCredit/src/Exceptions/Http/CancelDeniedException.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\Credit\Exceptions\Http; +namespace Cashbox\Tinkoff\Credit\Exceptions\Http; -use CashierProvider\Core\Exceptions\Http\BaseException; +use Cashbox\Core\Exceptions\Http\BaseException; class CancelDeniedException extends BaseException { diff --git a/src/TinkoffCredit/src/Exceptions/Http/NotFoundException.php b/src/TinkoffCredit/src/Exceptions/Http/NotFoundException.php index 076a56a4..b4074ae2 100644 --- a/src/TinkoffCredit/src/Exceptions/Http/NotFoundException.php +++ b/src/TinkoffCredit/src/Exceptions/Http/NotFoundException.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\Credit\Exceptions\Http; +namespace Cashbox\Tinkoff\Credit\Exceptions\Http; -use CashierProvider\Core\Exceptions\Http\BaseException; +use Cashbox\Core\Exceptions\Http\BaseException; class NotFoundException extends BaseException { diff --git a/src/TinkoffCredit/src/Exceptions/Manager.php b/src/TinkoffCredit/src/Exceptions/Manager.php index e3ec5df2..40693932 100644 --- a/src/TinkoffCredit/src/Exceptions/Manager.php +++ b/src/TinkoffCredit/src/Exceptions/Manager.php @@ -13,23 +13,23 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\Credit\Exceptions; +namespace Cashbox\Tinkoff\Credit\Exceptions; -use CashierProvider\Core\Exceptions\Http\BankInternalErrorException; -use CashierProvider\Core\Exceptions\Http\BuyerNotFoundClientException; -use CashierProvider\Core\Exceptions\Http\CardHasStolenException; -use CashierProvider\Core\Exceptions\Http\ContactTheSellerClientException; -use CashierProvider\Core\Exceptions\Http\InsufficientFundsCardException; -use CashierProvider\Core\Exceptions\Http\InvalidCardException; -use CashierProvider\Core\Exceptions\Http\PaymentCompletedException; -use CashierProvider\Core\Exceptions\Http\PaymentDeclinedException; -use CashierProvider\Core\Exceptions\Http\PaymentTypeNotAvailableException; -use CashierProvider\Core\Exceptions\Http\SumException; -use CashierProvider\Core\Exceptions\Http\TooManyRequestsException; -use CashierProvider\Core\Exceptions\Http\TryAgainLaterClientException; -use CashierProvider\Core\Exceptions\Manager as ExceptionManager; -use CashierProvider\Tinkoff\Credit\Exceptions\Http\CancelDeniedException; -use CashierProvider\Tinkoff\Credit\Exceptions\Http\NotFoundException; +use Cashbox\Core\Exceptions\Http\BankInternalErrorException; +use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; +use Cashbox\Core\Exceptions\Http\CardHasStolenException; +use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; +use Cashbox\Core\Exceptions\Http\InsufficientFundsCardException; +use Cashbox\Core\Exceptions\Http\InvalidCardException; +use Cashbox\Core\Exceptions\Http\PaymentCompletedException; +use Cashbox\Core\Exceptions\Http\PaymentDeclinedException; +use Cashbox\Core\Exceptions\Http\PaymentTypeNotAvailableException; +use Cashbox\Core\Exceptions\Http\SumException; +use Cashbox\Core\Exceptions\Http\TooManyRequestsException; +use Cashbox\Core\Exceptions\Http\TryAgainLaterClientException; +use Cashbox\Core\Exceptions\Manager as ExceptionManager; +use Cashbox\Tinkoff\Credit\Exceptions\Http\CancelDeniedException; +use Cashbox\Tinkoff\Credit\Exceptions\Http\NotFoundException; use Illuminate\Support\Arr; class Manager extends ExceptionManager diff --git a/src/TinkoffCredit/src/Helpers/Statuses.php b/src/TinkoffCredit/src/Helpers/Statuses.php index 49339fbc..bc20678f 100644 --- a/src/TinkoffCredit/src/Helpers/Statuses.php +++ b/src/TinkoffCredit/src/Helpers/Statuses.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\Credit\Helpers; +namespace Cashbox\Tinkoff\Credit\Helpers; -use CashierProvider\Core\Services\Statuses as BaseStatus; +use Cashbox\Core\Services\Statuses as BaseStatus; class Statuses extends BaseStatus { diff --git a/src/TinkoffCredit/src/Requests/BaseRequest.php b/src/TinkoffCredit/src/Requests/BaseRequest.php index 7003ab06..ce8359a0 100644 --- a/src/TinkoffCredit/src/Requests/BaseRequest.php +++ b/src/TinkoffCredit/src/Requests/BaseRequest.php @@ -15,10 +15,10 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Credit\Requests; +namespace Cashbox\Tinkoff\Credit\Requests; -use CashierProvider\Core\Facades\Config\Main; -use CashierProvider\Core\Http\Request; +use Cashbox\Core\Facades\Config\Main; +use Cashbox\Core\Http\Request; use DragonCode\Support\Facades\Helpers\Str; use Lmc\HttpConstants\Header; diff --git a/src/TinkoffCredit/src/Requests/Cancel.php b/src/TinkoffCredit/src/Requests/Cancel.php index 708b86ce..33604c3d 100644 --- a/src/TinkoffCredit/src/Requests/Cancel.php +++ b/src/TinkoffCredit/src/Requests/Cancel.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Credit\Requests; +namespace Cashbox\Tinkoff\Credit\Requests; class Cancel extends BaseRequest { diff --git a/src/TinkoffCredit/src/Requests/GetState.php b/src/TinkoffCredit/src/Requests/GetState.php index 17e9ae15..c634b53d 100644 --- a/src/TinkoffCredit/src/Requests/GetState.php +++ b/src/TinkoffCredit/src/Requests/GetState.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Credit\Requests; +namespace Cashbox\Tinkoff\Credit\Requests; use Fig\Http\Message\RequestMethodInterface; diff --git a/src/TinkoffCredit/src/Requests/Init.php b/src/TinkoffCredit/src/Requests/Init.php index edcd9cdb..78d2a6a3 100644 --- a/src/TinkoffCredit/src/Requests/Init.php +++ b/src/TinkoffCredit/src/Requests/Init.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Credit\Requests; +namespace Cashbox\Tinkoff\Credit\Requests; class Init extends BaseRequest { diff --git a/src/TinkoffCredit/src/Resources/Details.php b/src/TinkoffCredit/src/Resources/Details.php index cde99bb2..0c19b78b 100644 --- a/src/TinkoffCredit/src/Resources/Details.php +++ b/src/TinkoffCredit/src/Resources/Details.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Credit\Resources; +namespace Cashbox\Tinkoff\Credit\Resources; -use CashierProvider\Core\Resources\Details as BaseDetails; +use Cashbox\Core\Resources\Details as BaseDetails; class Details extends BaseDetails { diff --git a/src/TinkoffCredit/src/Responses/Created.php b/src/TinkoffCredit/src/Responses/Created.php index 826a94d0..ec7813fc 100644 --- a/src/TinkoffCredit/src/Responses/Created.php +++ b/src/TinkoffCredit/src/Responses/Created.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Credit\Responses; +namespace Cashbox\Tinkoff\Credit\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class Created extends ResponseInfo { diff --git a/src/TinkoffCredit/src/Responses/Refund.php b/src/TinkoffCredit/src/Responses/Refund.php index ec200dfc..0d3a3c10 100644 --- a/src/TinkoffCredit/src/Responses/Refund.php +++ b/src/TinkoffCredit/src/Responses/Refund.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Credit\Responses; +namespace Cashbox\Tinkoff\Credit\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class Refund extends ResponseInfo { diff --git a/src/TinkoffCredit/src/Responses/State.php b/src/TinkoffCredit/src/Responses/State.php index df4b09f2..dee9a1d6 100644 --- a/src/TinkoffCredit/src/Responses/State.php +++ b/src/TinkoffCredit/src/Responses/State.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Credit\Responses; +namespace Cashbox\Tinkoff\Credit\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class State extends ResponseInfo { diff --git a/src/TinkoffCredit/tests/Concerns/TestServiceProvider.php b/src/TinkoffCredit/tests/Concerns/TestServiceProvider.php index bbef67c6..f5ce1126 100644 --- a/src/TinkoffCredit/tests/Concerns/TestServiceProvider.php +++ b/src/TinkoffCredit/tests/Concerns/TestServiceProvider.php @@ -17,7 +17,7 @@ namespace Tests\Concerns; -use CashierProvider\Core\Providers\ServiceProvider; +use Cashbox\Core\Providers\ServiceProvider; class TestServiceProvider extends ServiceProvider { diff --git a/src/TinkoffCredit/tests/DriverTest.php b/src/TinkoffCredit/tests/DriverTest.php index daa4af00..5cf9b05b 100644 --- a/src/TinkoffCredit/tests/DriverTest.php +++ b/src/TinkoffCredit/tests/DriverTest.php @@ -15,10 +15,10 @@ namespace Tests; -use CashierProvider\Core\Http\ResponseInfo; -use CashierProvider\Core\Services\Jobs; -use CashierProvider\Tinkoff\Credit\Driver as Credit; -use CashierProvider\Tinkoff\Credit\Exceptions\Http\CancelDeniedException; +use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Services\Jobs; +use Cashbox\Tinkoff\Credit\Driver as Credit; +use Cashbox\Tinkoff\Credit\Exceptions\Http\CancelDeniedException; use DragonCode\Contracts\Cashier\Driver as DriverContract; use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; use DragonCode\Support\Facades\Http\Url; diff --git a/src/TinkoffCredit/tests/Fixtures/Models/ReadyPayment.php b/src/TinkoffCredit/tests/Fixtures/Models/ReadyPayment.php index 8cb600ec..c3cbcd9f 100644 --- a/src/TinkoffCredit/tests/Fixtures/Models/ReadyPayment.php +++ b/src/TinkoffCredit/tests/Fixtures/Models/ReadyPayment.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/TinkoffCredit/tests/Fixtures/Models/RequestPayment.php b/src/TinkoffCredit/tests/Fixtures/Models/RequestPayment.php index f35795ae..f19ecd52 100644 --- a/src/TinkoffCredit/tests/Fixtures/Models/RequestPayment.php +++ b/src/TinkoffCredit/tests/Fixtures/Models/RequestPayment.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; /** diff --git a/src/TinkoffCredit/tests/Fixtures/Resources/Model.php b/src/TinkoffCredit/tests/Fixtures/Resources/Model.php index 662c4616..d071fbf6 100644 --- a/src/TinkoffCredit/tests/Fixtures/Resources/Model.php +++ b/src/TinkoffCredit/tests/Fixtures/Resources/Model.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Resources; -use CashierProvider\Core\Resources\Model as BaseModel; +use Cashbox\Core\Resources\Model as BaseModel; use Illuminate\Support\Carbon; use Illuminate\Support\Collection; use Tests\Fixtures\Models\OrderItem; diff --git a/src/TinkoffCredit/tests/Helpers/ExceptionTest.php b/src/TinkoffCredit/tests/Helpers/ExceptionTest.php index 4d7b7e6b..716a5adb 100644 --- a/src/TinkoffCredit/tests/Helpers/ExceptionTest.php +++ b/src/TinkoffCredit/tests/Helpers/ExceptionTest.php @@ -15,11 +15,11 @@ namespace Tests\Helpers; -use CashierProvider\Core\Exceptions\Http\BadRequestClientException; -use CashierProvider\Core\Exceptions\Http\BaseException; -use CashierProvider\Core\Exceptions\Http\BuyerNotFoundClientException; -use CashierProvider\Core\Exceptions\Http\ContactTheSellerClientException; -use CashierProvider\Tinkoff\Credit\Exceptions\Manager; +use Cashbox\Core\Exceptions\Http\BadRequestClientException; +use Cashbox\Core\Exceptions\Http\BaseException; +use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; +use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; +use Cashbox\Tinkoff\Credit\Exceptions\Manager; use DragonCode\Contracts\Http\Builder as HttpBuilder; use DragonCode\Support\Facades\Http\Builder; use Tests\TestCase; diff --git a/src/TinkoffCredit/tests/Helpers/StatusesTest.php b/src/TinkoffCredit/tests/Helpers/StatusesTest.php index 263b66c5..d6ff86e1 100644 --- a/src/TinkoffCredit/tests/Helpers/StatusesTest.php +++ b/src/TinkoffCredit/tests/Helpers/StatusesTest.php @@ -15,8 +15,8 @@ namespace Tests\Helpers; -use CashierProvider\Tinkoff\Credit\Helpers\Statuses; -use CashierProvider\Tinkoff\Credit\Resources\Details; +use Cashbox\Tinkoff\Credit\Helpers\Statuses; +use Cashbox\Tinkoff\Credit\Resources\Details; use Tests\TestCase; class StatusesTest extends TestCase diff --git a/src/TinkoffCredit/tests/Jobs/JobsTest.php b/src/TinkoffCredit/tests/Jobs/JobsTest.php index 9f3a398e..4fc6386d 100644 --- a/src/TinkoffCredit/tests/Jobs/JobsTest.php +++ b/src/TinkoffCredit/tests/Jobs/JobsTest.php @@ -15,10 +15,10 @@ namespace Tests\Jobs; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Services\Jobs; -use CashierProvider\Tinkoff\Credit\Exceptions\Http\CancelDeniedException; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Services\Jobs; +use Cashbox\Tinkoff\Credit\Exceptions\Http\CancelDeniedException; use DragonCode\Support\Facades\Http\Url; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\DB; diff --git a/src/TinkoffCredit/tests/Observers/ObserverTest.php b/src/TinkoffCredit/tests/Observers/ObserverTest.php index d3417af2..7295fdbc 100644 --- a/src/TinkoffCredit/tests/Observers/ObserverTest.php +++ b/src/TinkoffCredit/tests/Observers/ObserverTest.php @@ -15,9 +15,9 @@ namespace Tests\Observers; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Providers\ObserverServiceProvider; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Providers\ObserverServiceProvider; use DragonCode\Support\Facades\Http\Url; use Illuminate\Database\Eloquent\Model; use Illuminate\Foundation\Testing\RefreshDatabase; diff --git a/src/TinkoffCredit/tests/Requests/CancelTest.php b/src/TinkoffCredit/tests/Requests/CancelTest.php index 43cc76af..aa28fad0 100644 --- a/src/TinkoffCredit/tests/Requests/CancelTest.php +++ b/src/TinkoffCredit/tests/Requests/CancelTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Tinkoff\Credit\Requests\Cancel; +use Cashbox\Core\Http\Request; +use Cashbox\Tinkoff\Credit\Requests\Cancel; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Lmc\HttpConstants\Header; diff --git a/src/TinkoffCredit/tests/Requests/GetStateTest.php b/src/TinkoffCredit/tests/Requests/GetStateTest.php index 6b25f11c..5ec66aa0 100644 --- a/src/TinkoffCredit/tests/Requests/GetStateTest.php +++ b/src/TinkoffCredit/tests/Requests/GetStateTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Tinkoff\Credit\Requests\GetState; +use Cashbox\Core\Http\Request; +use Cashbox\Tinkoff\Credit\Requests\GetState; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Lmc\HttpConstants\Header; diff --git a/src/TinkoffCredit/tests/Requests/InitTest.php b/src/TinkoffCredit/tests/Requests/InitTest.php index dcb4bdd3..3daa9c4b 100644 --- a/src/TinkoffCredit/tests/Requests/InitTest.php +++ b/src/TinkoffCredit/tests/Requests/InitTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Tinkoff\Credit\Requests\Init; +use Cashbox\Core\Http\Request; +use Cashbox\Tinkoff\Credit\Requests\Init; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Lmc\HttpConstants\Header; diff --git a/src/TinkoffCredit/tests/Resources/DetailsTest.php b/src/TinkoffCredit/tests/Resources/DetailsTest.php index d9889939..e287584a 100644 --- a/src/TinkoffCredit/tests/Resources/DetailsTest.php +++ b/src/TinkoffCredit/tests/Resources/DetailsTest.php @@ -15,8 +15,8 @@ namespace Tests\Resources; -use CashierProvider\Core\Resources\Details as BaseDetails; -use CashierProvider\Tinkoff\Credit\Resources\Details; +use Cashbox\Core\Resources\Details as BaseDetails; +use Cashbox\Tinkoff\Credit\Resources\Details; use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; use Tests\TestCase; diff --git a/src/TinkoffCredit/tests/Responses/InitTest.php b/src/TinkoffCredit/tests/Responses/InitTest.php index 88e4156a..c0c05923 100644 --- a/src/TinkoffCredit/tests/Responses/InitTest.php +++ b/src/TinkoffCredit/tests/Responses/InitTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; -use CashierProvider\Tinkoff\Credit\Responses\Created; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Tinkoff\Credit\Responses\Created; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/TinkoffCredit/tests/Responses/RefundTest.php b/src/TinkoffCredit/tests/Responses/RefundTest.php index c476e6cd..be4e34a5 100644 --- a/src/TinkoffCredit/tests/Responses/RefundTest.php +++ b/src/TinkoffCredit/tests/Responses/RefundTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; -use CashierProvider\Tinkoff\Credit\Responses\Refund; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Tinkoff\Credit\Responses\Refund; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/TinkoffCredit/tests/Responses/StateTest.php b/src/TinkoffCredit/tests/Responses/StateTest.php index 4f1476da..a55cb4b2 100644 --- a/src/TinkoffCredit/tests/Responses/StateTest.php +++ b/src/TinkoffCredit/tests/Responses/StateTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; -use CashierProvider\Tinkoff\Credit\Responses\State; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Tinkoff\Credit\Responses\State; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/TinkoffCredit/tests/TestCase.php b/src/TinkoffCredit/tests/TestCase.php index 19480e3f..3b69fccc 100644 --- a/src/TinkoffCredit/tests/TestCase.php +++ b/src/TinkoffCredit/tests/TestCase.php @@ -15,11 +15,11 @@ namespace Tests; -use CashierProvider\Core\Config\Driver as DriverConfig; -use CashierProvider\Core\Constants\Driver as DriverConstant; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Models\CashierDetail; -use CashierProvider\Tinkoff\Credit\Driver; +use Cashbox\Core\Config\Driver as DriverConfig; +use Cashbox\Core\Constants\Driver as DriverConstant; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Models\CashierDetail; +use Cashbox\Tinkoff\Credit\Driver; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\Details; use Illuminate\Database\Eloquent\Model as EloquentModel; @@ -111,7 +111,7 @@ protected function detailsRelation(EloquentModel $model, ?Details $details): Cas } /** - * @param \CashierProvider\Tinkoff\Credit\Requests\BaseRequest|string $request + * @param \Cashbox\Tinkoff\Credit\Requests\BaseRequest|string $request */ protected function request(string $request): Request { diff --git a/src/TinkoffOnline/composer.json b/src/TinkoffOnline/composer.json index 06e2e548..393f91a6 100644 --- a/src/TinkoffOnline/composer.json +++ b/src/TinkoffOnline/composer.json @@ -53,7 +53,7 @@ "prefer-stable": true, "autoload": { "psr-4": { - "CashierProvider\\Tinkoff\\Online\\": "src/" + "Cashbox\\Tinkoff\\Online\\": "src/" } }, "config": { diff --git a/src/TinkoffOnline/src/Driver.php b/src/TinkoffOnline/src/Driver.php index ee08dd0d..31a73cb6 100644 --- a/src/TinkoffOnline/src/Driver.php +++ b/src/TinkoffOnline/src/Driver.php @@ -13,18 +13,18 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\Online; - -use CashierProvider\Core\Facades\Helpers\Model; -use CashierProvider\Core\Services\Driver as BaseDriver; -use CashierProvider\Tinkoff\Online\Exceptions\Manager; -use CashierProvider\Tinkoff\Online\Helpers\Statuses; -use CashierProvider\Tinkoff\Online\Requests\Cancel; -use CashierProvider\Tinkoff\Online\Requests\GetState; -use CashierProvider\Tinkoff\Online\Requests\Init; -use CashierProvider\Tinkoff\Online\Resources\Details; -use CashierProvider\Tinkoff\Online\Responses\Refund; -use CashierProvider\Tinkoff\Online\Responses\State; +namespace Cashbox\Tinkoff\Online; + +use Cashbox\Core\Facades\Helpers\Model; +use Cashbox\Core\Services\Driver as BaseDriver; +use Cashbox\Tinkoff\Online\Exceptions\Manager; +use Cashbox\Tinkoff\Online\Helpers\Statuses; +use Cashbox\Tinkoff\Online\Requests\Cancel; +use Cashbox\Tinkoff\Online\Requests\GetState; +use Cashbox\Tinkoff\Online\Requests\Init; +use Cashbox\Tinkoff\Online\Resources\Details; +use Cashbox\Tinkoff\Online\Responses\Refund; +use Cashbox\Tinkoff\Online\Responses\State; use DragonCode\Contracts\Cashier\Http\Response; class Driver extends BaseDriver diff --git a/src/TinkoffOnline/src/Exceptions/Manager.php b/src/TinkoffOnline/src/Exceptions/Manager.php index 1f725292..189b10d7 100644 --- a/src/TinkoffOnline/src/Exceptions/Manager.php +++ b/src/TinkoffOnline/src/Exceptions/Manager.php @@ -13,21 +13,21 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\Online\Exceptions; +namespace Cashbox\Tinkoff\Online\Exceptions; -use CashierProvider\Core\Exceptions\Http\BankInternalErrorException; -use CashierProvider\Core\Exceptions\Http\BuyerNotFoundClientException; -use CashierProvider\Core\Exceptions\Http\CardHasStolenException; -use CashierProvider\Core\Exceptions\Http\ContactTheSellerClientException; -use CashierProvider\Core\Exceptions\Http\InsufficientFundsCardException; -use CashierProvider\Core\Exceptions\Http\InvalidCardException; -use CashierProvider\Core\Exceptions\Http\PaymentCompletedException; -use CashierProvider\Core\Exceptions\Http\PaymentDeclinedException; -use CashierProvider\Core\Exceptions\Http\PaymentTypeNotAvailableException; -use CashierProvider\Core\Exceptions\Http\SumException; -use CashierProvider\Core\Exceptions\Http\TooManyRequestsException; -use CashierProvider\Core\Exceptions\Http\TryAgainLaterClientException; -use CashierProvider\Core\Exceptions\Manager as ExceptionManager; +use Cashbox\Core\Exceptions\Http\BankInternalErrorException; +use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; +use Cashbox\Core\Exceptions\Http\CardHasStolenException; +use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; +use Cashbox\Core\Exceptions\Http\InsufficientFundsCardException; +use Cashbox\Core\Exceptions\Http\InvalidCardException; +use Cashbox\Core\Exceptions\Http\PaymentCompletedException; +use Cashbox\Core\Exceptions\Http\PaymentDeclinedException; +use Cashbox\Core\Exceptions\Http\PaymentTypeNotAvailableException; +use Cashbox\Core\Exceptions\Http\SumException; +use Cashbox\Core\Exceptions\Http\TooManyRequestsException; +use Cashbox\Core\Exceptions\Http\TryAgainLaterClientException; +use Cashbox\Core\Exceptions\Manager as ExceptionManager; class Manager extends ExceptionManager { diff --git a/src/TinkoffOnline/src/Helpers/Statuses.php b/src/TinkoffOnline/src/Helpers/Statuses.php index fcbdd463..8c63736b 100644 --- a/src/TinkoffOnline/src/Helpers/Statuses.php +++ b/src/TinkoffOnline/src/Helpers/Statuses.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\Online\Helpers; +namespace Cashbox\Tinkoff\Online\Helpers; -use CashierProvider\Core\Services\Statuses as BaseStatus; +use Cashbox\Core\Services\Statuses as BaseStatus; class Statuses extends BaseStatus { diff --git a/src/TinkoffOnline/src/Requests/BaseRequest.php b/src/TinkoffOnline/src/Requests/BaseRequest.php index 9a5896d7..e6de32e9 100644 --- a/src/TinkoffOnline/src/Requests/BaseRequest.php +++ b/src/TinkoffOnline/src/Requests/BaseRequest.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Online\Requests; +namespace Cashbox\Tinkoff\Online\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Core\Support\URI; -use CashierProvider\Tinkoff\Auth\Auth; +use Cashbox\Core\Http\Request; +use Cashbox\Core\Support\URI; +use Cashbox\Tinkoff\Auth\Auth; abstract class BaseRequest extends Request { diff --git a/src/TinkoffOnline/src/Requests/Cancel.php b/src/TinkoffOnline/src/Requests/Cancel.php index b2fc8361..1d688366 100644 --- a/src/TinkoffOnline/src/Requests/Cancel.php +++ b/src/TinkoffOnline/src/Requests/Cancel.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Online\Requests; +namespace Cashbox\Tinkoff\Online\Requests; class Cancel extends BaseRequest { diff --git a/src/TinkoffOnline/src/Requests/GetState.php b/src/TinkoffOnline/src/Requests/GetState.php index f276caf2..ec2f3bdb 100644 --- a/src/TinkoffOnline/src/Requests/GetState.php +++ b/src/TinkoffOnline/src/Requests/GetState.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Online\Requests; +namespace Cashbox\Tinkoff\Online\Requests; class GetState extends BaseRequest { diff --git a/src/TinkoffOnline/src/Requests/Init.php b/src/TinkoffOnline/src/Requests/Init.php index 72fa3824..d3af4e9a 100644 --- a/src/TinkoffOnline/src/Requests/Init.php +++ b/src/TinkoffOnline/src/Requests/Init.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Online\Requests; +namespace Cashbox\Tinkoff\Online\Requests; class Init extends BaseRequest { diff --git a/src/TinkoffOnline/src/Resources/Details.php b/src/TinkoffOnline/src/Resources/Details.php index 3ed1d2eb..8b70ad20 100644 --- a/src/TinkoffOnline/src/Resources/Details.php +++ b/src/TinkoffOnline/src/Resources/Details.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Online\Resources; +namespace Cashbox\Tinkoff\Online\Resources; -use CashierProvider\Core\Resources\Details as BaseDetails; +use Cashbox\Core\Resources\Details as BaseDetails; class Details extends BaseDetails { diff --git a/src/TinkoffOnline/src/Responses/Init.php b/src/TinkoffOnline/src/Responses/Init.php index baeba94b..84440b5f 100644 --- a/src/TinkoffOnline/src/Responses/Init.php +++ b/src/TinkoffOnline/src/Responses/Init.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Online\Responses; +namespace Cashbox\Tinkoff\Online\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class Init extends ResponseInfo { diff --git a/src/TinkoffOnline/src/Responses/Refund.php b/src/TinkoffOnline/src/Responses/Refund.php index bf67b852..73c7b77b 100644 --- a/src/TinkoffOnline/src/Responses/Refund.php +++ b/src/TinkoffOnline/src/Responses/Refund.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Online\Responses; +namespace Cashbox\Tinkoff\Online\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class Refund extends ResponseInfo { diff --git a/src/TinkoffOnline/src/Responses/State.php b/src/TinkoffOnline/src/Responses/State.php index 794fabb0..da1741f3 100644 --- a/src/TinkoffOnline/src/Responses/State.php +++ b/src/TinkoffOnline/src/Responses/State.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\Online\Responses; +namespace Cashbox\Tinkoff\Online\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class State extends ResponseInfo { diff --git a/src/TinkoffOnline/tests/DriverTest.php b/src/TinkoffOnline/tests/DriverTest.php index d2d53c31..5e91924f 100644 --- a/src/TinkoffOnline/tests/DriverTest.php +++ b/src/TinkoffOnline/tests/DriverTest.php @@ -15,8 +15,8 @@ namespace Tests; -use CashierProvider\Core\Http\ResponseInfo; -use CashierProvider\Tinkoff\Online\Driver as Online; +use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Tinkoff\Online\Driver as Online; use DragonCode\Contracts\Cashier\Driver as DriverContract; use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; use DragonCode\Support\Facades\Http\Url; diff --git a/src/TinkoffOnline/tests/Fixtures/Models/ReadyPayment.php b/src/TinkoffOnline/tests/Fixtures/Models/ReadyPayment.php index 8cb600ec..c3cbcd9f 100644 --- a/src/TinkoffOnline/tests/Fixtures/Models/ReadyPayment.php +++ b/src/TinkoffOnline/tests/Fixtures/Models/ReadyPayment.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/TinkoffOnline/tests/Fixtures/Models/RequestPayment.php b/src/TinkoffOnline/tests/Fixtures/Models/RequestPayment.php index f35795ae..f19ecd52 100644 --- a/src/TinkoffOnline/tests/Fixtures/Models/RequestPayment.php +++ b/src/TinkoffOnline/tests/Fixtures/Models/RequestPayment.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; /** diff --git a/src/TinkoffOnline/tests/Fixtures/Resources/Model.php b/src/TinkoffOnline/tests/Fixtures/Resources/Model.php index 9e102495..0780a8bb 100644 --- a/src/TinkoffOnline/tests/Fixtures/Resources/Model.php +++ b/src/TinkoffOnline/tests/Fixtures/Resources/Model.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Resources; -use CashierProvider\Core\Resources\Model as BaseModel; +use Cashbox\Core\Resources\Model as BaseModel; use Illuminate\Support\Carbon; /** @property \Tests\Fixtures\Models\ReadyPayment $model */ diff --git a/src/TinkoffOnline/tests/Helpers/ExceptionTest.php b/src/TinkoffOnline/tests/Helpers/ExceptionTest.php index f124257c..313fdabb 100644 --- a/src/TinkoffOnline/tests/Helpers/ExceptionTest.php +++ b/src/TinkoffOnline/tests/Helpers/ExceptionTest.php @@ -15,11 +15,11 @@ namespace Tests\Helpers; -use CashierProvider\Core\Exceptions\Http\BadRequestClientException; -use CashierProvider\Core\Exceptions\Http\BaseException; -use CashierProvider\Core\Exceptions\Http\BuyerNotFoundClientException; -use CashierProvider\Core\Exceptions\Http\ContactTheSellerClientException; -use CashierProvider\Tinkoff\Online\Exceptions\Manager; +use Cashbox\Core\Exceptions\Http\BadRequestClientException; +use Cashbox\Core\Exceptions\Http\BaseException; +use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; +use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; +use Cashbox\Tinkoff\Online\Exceptions\Manager; use DragonCode\Contracts\Http\Builder as HttpBuilder; use DragonCode\Support\Facades\Http\Builder; use Tests\TestCase; diff --git a/src/TinkoffOnline/tests/Helpers/StatusesTest.php b/src/TinkoffOnline/tests/Helpers/StatusesTest.php index 8fdc2452..314fd33e 100644 --- a/src/TinkoffOnline/tests/Helpers/StatusesTest.php +++ b/src/TinkoffOnline/tests/Helpers/StatusesTest.php @@ -15,8 +15,8 @@ namespace Tests\Helpers; -use CashierProvider\Tinkoff\Online\Helpers\Statuses; -use CashierProvider\Tinkoff\Online\Resources\Details; +use Cashbox\Tinkoff\Online\Helpers\Statuses; +use Cashbox\Tinkoff\Online\Resources\Details; use Tests\TestCase; class StatusesTest extends TestCase diff --git a/src/TinkoffOnline/tests/Jobs/JobsTest.php b/src/TinkoffOnline/tests/Jobs/JobsTest.php index 4aec8af3..1d18ff28 100644 --- a/src/TinkoffOnline/tests/Jobs/JobsTest.php +++ b/src/TinkoffOnline/tests/Jobs/JobsTest.php @@ -15,9 +15,9 @@ namespace Tests\Jobs; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Services\Jobs; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Services\Jobs; use DragonCode\Support\Facades\Http\Url; use Illuminate\Support\Facades\DB; use Tests\Fixtures\Factories\Payment; diff --git a/src/TinkoffOnline/tests/Observers/ObserverTest.php b/src/TinkoffOnline/tests/Observers/ObserverTest.php index c5d689d3..b0ecd80d 100644 --- a/src/TinkoffOnline/tests/Observers/ObserverTest.php +++ b/src/TinkoffOnline/tests/Observers/ObserverTest.php @@ -15,10 +15,10 @@ namespace Tests\Observers; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Providers\ObserverServiceProvider; -use CashierProvider\Core\Providers\ServiceProvider; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Providers\ObserverServiceProvider; +use Cashbox\Core\Providers\ServiceProvider; use DragonCode\Support\Facades\Http\Url; use Illuminate\Support\Facades\DB; use Tests\Fixtures\Factories\Payment; diff --git a/src/TinkoffOnline/tests/Requests/CancelTest.php b/src/TinkoffOnline/tests/Requests/CancelTest.php index 5df9251a..3023b9ee 100644 --- a/src/TinkoffOnline/tests/Requests/CancelTest.php +++ b/src/TinkoffOnline/tests/Requests/CancelTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Tinkoff\Online\Requests\Cancel; +use Cashbox\Core\Http\Request; +use Cashbox\Tinkoff\Online\Requests\Cancel; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/TinkoffOnline/tests/Requests/GetStateTest.php b/src/TinkoffOnline/tests/Requests/GetStateTest.php index cd350cfc..6ff0245e 100644 --- a/src/TinkoffOnline/tests/Requests/GetStateTest.php +++ b/src/TinkoffOnline/tests/Requests/GetStateTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Tinkoff\Online\Requests\GetState; +use Cashbox\Core\Http\Request; +use Cashbox\Tinkoff\Online\Requests\GetState; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/TinkoffOnline/tests/Requests/InitTest.php b/src/TinkoffOnline/tests/Requests/InitTest.php index 9a06906b..37949a70 100644 --- a/src/TinkoffOnline/tests/Requests/InitTest.php +++ b/src/TinkoffOnline/tests/Requests/InitTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Tinkoff\Online\Requests\Init; +use Cashbox\Core\Http\Request; +use Cashbox\Tinkoff\Online\Requests\Init; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/TinkoffOnline/tests/Resources/DetailsTest.php b/src/TinkoffOnline/tests/Resources/DetailsTest.php index 922c3874..07c3c094 100644 --- a/src/TinkoffOnline/tests/Resources/DetailsTest.php +++ b/src/TinkoffOnline/tests/Resources/DetailsTest.php @@ -15,8 +15,8 @@ namespace Tests\Resources; -use CashierProvider\Core\Resources\Details as BaseDetails; -use CashierProvider\Tinkoff\Online\Resources\Details; +use Cashbox\Core\Resources\Details as BaseDetails; +use Cashbox\Tinkoff\Online\Resources\Details; use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; use Tests\TestCase; diff --git a/src/TinkoffOnline/tests/Responses/InitTest.php b/src/TinkoffOnline/tests/Responses/InitTest.php index 1a242cfb..42a77575 100644 --- a/src/TinkoffOnline/tests/Responses/InitTest.php +++ b/src/TinkoffOnline/tests/Responses/InitTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; -use CashierProvider\Tinkoff\Online\Responses\Init; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Tinkoff\Online\Responses\Init; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/TinkoffOnline/tests/Responses/RefundTest.php b/src/TinkoffOnline/tests/Responses/RefundTest.php index e8e73f01..610dda7c 100644 --- a/src/TinkoffOnline/tests/Responses/RefundTest.php +++ b/src/TinkoffOnline/tests/Responses/RefundTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; -use CashierProvider\Tinkoff\Online\Responses\Refund; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Tinkoff\Online\Responses\Refund; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/TinkoffOnline/tests/Responses/StateTest.php b/src/TinkoffOnline/tests/Responses/StateTest.php index 21bd4b4f..ca2d49a4 100644 --- a/src/TinkoffOnline/tests/Responses/StateTest.php +++ b/src/TinkoffOnline/tests/Responses/StateTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; -use CashierProvider\Tinkoff\Online\Responses\State; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Tinkoff\Online\Responses\State; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/TinkoffOnline/tests/TestCase.php b/src/TinkoffOnline/tests/TestCase.php index 01cd38eb..2918aa4f 100644 --- a/src/TinkoffOnline/tests/TestCase.php +++ b/src/TinkoffOnline/tests/TestCase.php @@ -15,12 +15,12 @@ namespace Tests; -use CashierProvider\Core\Config\Driver as DriverConfig; -use CashierProvider\Core\Constants\Driver as DriverConstant; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Models\CashierDetail; -use CashierProvider\Core\Providers\ServiceProvider; -use CashierProvider\Tinkoff\Online\Driver; +use Cashbox\Core\Config\Driver as DriverConfig; +use Cashbox\Core\Constants\Driver as DriverConstant; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Models\CashierDetail; +use Cashbox\Core\Providers\ServiceProvider; +use Cashbox\Tinkoff\Online\Driver; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\Details; use Illuminate\Database\Eloquent\Model as EloquentModel; @@ -107,7 +107,7 @@ protected function detailsRelation(EloquentModel $model, ?Details $details): Cas } /** - * @param \CashierProvider\Tinkoff\Online\Requests\BaseRequest|string $request + * @param \Cashbox\Tinkoff\Online\Requests\BaseRequest|string $request */ protected function request(string $request): Request { diff --git a/src/TinkoffQrCode/composer.json b/src/TinkoffQrCode/composer.json index 2eca6110..8a9ea309 100644 --- a/src/TinkoffQrCode/composer.json +++ b/src/TinkoffQrCode/composer.json @@ -52,7 +52,7 @@ "prefer-stable": true, "autoload": { "psr-4": { - "CashierProvider\\Tinkoff\\QrCode\\": "src/" + "Cashbox\\Tinkoff\\QrCode\\": "src/" } }, "config": { diff --git a/src/TinkoffQrCode/src/Driver.php b/src/TinkoffQrCode/src/Driver.php index bcd07047..fa2385d9 100644 --- a/src/TinkoffQrCode/src/Driver.php +++ b/src/TinkoffQrCode/src/Driver.php @@ -13,20 +13,20 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\QrCode; - -use CashierProvider\Core\Facades\Helpers\Model; -use CashierProvider\Core\Services\Driver as BaseDriver; -use CashierProvider\Tinkoff\QrCode\Exceptions\Manager; -use CashierProvider\Tinkoff\QrCode\Helpers\Statuses; -use CashierProvider\Tinkoff\QrCode\Requests\Cancel; -use CashierProvider\Tinkoff\QrCode\Requests\GetQR; -use CashierProvider\Tinkoff\QrCode\Requests\GetState; -use CashierProvider\Tinkoff\QrCode\Requests\Init; -use CashierProvider\Tinkoff\QrCode\Resources\Details; -use CashierProvider\Tinkoff\QrCode\Responses\QrCode; -use CashierProvider\Tinkoff\QrCode\Responses\Refund; -use CashierProvider\Tinkoff\QrCode\Responses\State; +namespace Cashbox\Tinkoff\QrCode; + +use Cashbox\Core\Facades\Helpers\Model; +use Cashbox\Core\Services\Driver as BaseDriver; +use Cashbox\Tinkoff\QrCode\Exceptions\Manager; +use Cashbox\Tinkoff\QrCode\Helpers\Statuses; +use Cashbox\Tinkoff\QrCode\Requests\Cancel; +use Cashbox\Tinkoff\QrCode\Requests\GetQR; +use Cashbox\Tinkoff\QrCode\Requests\GetState; +use Cashbox\Tinkoff\QrCode\Requests\Init; +use Cashbox\Tinkoff\QrCode\Resources\Details; +use Cashbox\Tinkoff\QrCode\Responses\QrCode; +use Cashbox\Tinkoff\QrCode\Responses\Refund; +use Cashbox\Tinkoff\QrCode\Responses\State; use DragonCode\Contracts\Cashier\Http\Response; class Driver extends BaseDriver diff --git a/src/TinkoffQrCode/src/Exceptions/Manager.php b/src/TinkoffQrCode/src/Exceptions/Manager.php index 7b7bb3d9..0393e246 100644 --- a/src/TinkoffQrCode/src/Exceptions/Manager.php +++ b/src/TinkoffQrCode/src/Exceptions/Manager.php @@ -13,21 +13,21 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\QrCode\Exceptions; +namespace Cashbox\Tinkoff\QrCode\Exceptions; -use CashierProvider\Core\Exceptions\Http\BankInternalErrorException; -use CashierProvider\Core\Exceptions\Http\BuyerNotFoundClientException; -use CashierProvider\Core\Exceptions\Http\CardHasStolenException; -use CashierProvider\Core\Exceptions\Http\ContactTheSellerClientException; -use CashierProvider\Core\Exceptions\Http\InsufficientFundsCardException; -use CashierProvider\Core\Exceptions\Http\InvalidCardException; -use CashierProvider\Core\Exceptions\Http\PaymentCompletedException; -use CashierProvider\Core\Exceptions\Http\PaymentDeclinedException; -use CashierProvider\Core\Exceptions\Http\PaymentTypeNotAvailableException; -use CashierProvider\Core\Exceptions\Http\SumException; -use CashierProvider\Core\Exceptions\Http\TooManyRequestsException; -use CashierProvider\Core\Exceptions\Http\TryAgainLaterClientException; -use CashierProvider\Core\Exceptions\Manager as ExceptionManager; +use Cashbox\Core\Exceptions\Http\BankInternalErrorException; +use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; +use Cashbox\Core\Exceptions\Http\CardHasStolenException; +use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; +use Cashbox\Core\Exceptions\Http\InsufficientFundsCardException; +use Cashbox\Core\Exceptions\Http\InvalidCardException; +use Cashbox\Core\Exceptions\Http\PaymentCompletedException; +use Cashbox\Core\Exceptions\Http\PaymentDeclinedException; +use Cashbox\Core\Exceptions\Http\PaymentTypeNotAvailableException; +use Cashbox\Core\Exceptions\Http\SumException; +use Cashbox\Core\Exceptions\Http\TooManyRequestsException; +use Cashbox\Core\Exceptions\Http\TryAgainLaterClientException; +use Cashbox\Core\Exceptions\Manager as ExceptionManager; class Manager extends ExceptionManager { diff --git a/src/TinkoffQrCode/src/Helpers/Statuses.php b/src/TinkoffQrCode/src/Helpers/Statuses.php index b0e1c2dc..2ac2bb58 100644 --- a/src/TinkoffQrCode/src/Helpers/Statuses.php +++ b/src/TinkoffQrCode/src/Helpers/Statuses.php @@ -13,9 +13,9 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace CashierProvider\Tinkoff\QrCode\Helpers; +namespace Cashbox\Tinkoff\QrCode\Helpers; -use CashierProvider\Core\Services\Statuses as BaseStatus; +use Cashbox\Core\Services\Statuses as BaseStatus; class Statuses extends BaseStatus { diff --git a/src/TinkoffQrCode/src/Requests/BaseRequest.php b/src/TinkoffQrCode/src/Requests/BaseRequest.php index 8e6979c7..d22d37a3 100644 --- a/src/TinkoffQrCode/src/Requests/BaseRequest.php +++ b/src/TinkoffQrCode/src/Requests/BaseRequest.php @@ -15,11 +15,11 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\QrCode\Requests; +namespace Cashbox\Tinkoff\QrCode\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Core\Support\URI; -use CashierProvider\Tinkoff\Auth\Auth; +use Cashbox\Core\Http\Request; +use Cashbox\Core\Support\URI; +use Cashbox\Tinkoff\Auth\Auth; abstract class BaseRequest extends Request { diff --git a/src/TinkoffQrCode/src/Requests/Cancel.php b/src/TinkoffQrCode/src/Requests/Cancel.php index 0a75db1a..6bc9b0b1 100644 --- a/src/TinkoffQrCode/src/Requests/Cancel.php +++ b/src/TinkoffQrCode/src/Requests/Cancel.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\QrCode\Requests; +namespace Cashbox\Tinkoff\QrCode\Requests; class Cancel extends BaseRequest { diff --git a/src/TinkoffQrCode/src/Requests/GetQR.php b/src/TinkoffQrCode/src/Requests/GetQR.php index ef5baa38..bb6d1414 100644 --- a/src/TinkoffQrCode/src/Requests/GetQR.php +++ b/src/TinkoffQrCode/src/Requests/GetQR.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\QrCode\Requests; +namespace Cashbox\Tinkoff\QrCode\Requests; class GetQR extends BaseRequest { diff --git a/src/TinkoffQrCode/src/Requests/GetState.php b/src/TinkoffQrCode/src/Requests/GetState.php index 31c10a44..2a02c124 100644 --- a/src/TinkoffQrCode/src/Requests/GetState.php +++ b/src/TinkoffQrCode/src/Requests/GetState.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\QrCode\Requests; +namespace Cashbox\Tinkoff\QrCode\Requests; class GetState extends BaseRequest { diff --git a/src/TinkoffQrCode/src/Requests/Init.php b/src/TinkoffQrCode/src/Requests/Init.php index 7fd808f9..4829d877 100644 --- a/src/TinkoffQrCode/src/Requests/Init.php +++ b/src/TinkoffQrCode/src/Requests/Init.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\QrCode\Requests; +namespace Cashbox\Tinkoff\QrCode\Requests; class Init extends BaseRequest { diff --git a/src/TinkoffQrCode/src/Resources/Details.php b/src/TinkoffQrCode/src/Resources/Details.php index 80e994c8..5c11a8ee 100644 --- a/src/TinkoffQrCode/src/Resources/Details.php +++ b/src/TinkoffQrCode/src/Resources/Details.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\QrCode\Resources; +namespace Cashbox\Tinkoff\QrCode\Resources; -use CashierProvider\Core\Resources\Details as BaseDetails; +use Cashbox\Core\Resources\Details as BaseDetails; class Details extends BaseDetails { diff --git a/src/TinkoffQrCode/src/Responses/Init.php b/src/TinkoffQrCode/src/Responses/Init.php index 997a0c92..cfef8552 100644 --- a/src/TinkoffQrCode/src/Responses/Init.php +++ b/src/TinkoffQrCode/src/Responses/Init.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\QrCode\Responses; +namespace Cashbox\Tinkoff\QrCode\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class Init extends ResponseInfo { diff --git a/src/TinkoffQrCode/src/Responses/QrCode.php b/src/TinkoffQrCode/src/Responses/QrCode.php index f009618b..7dab18e2 100644 --- a/src/TinkoffQrCode/src/Responses/QrCode.php +++ b/src/TinkoffQrCode/src/Responses/QrCode.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\QrCode\Responses; +namespace Cashbox\Tinkoff\QrCode\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class QrCode extends ResponseInfo { diff --git a/src/TinkoffQrCode/src/Responses/Refund.php b/src/TinkoffQrCode/src/Responses/Refund.php index 2634bd8d..6b071dfd 100644 --- a/src/TinkoffQrCode/src/Responses/Refund.php +++ b/src/TinkoffQrCode/src/Responses/Refund.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\QrCode\Responses; +namespace Cashbox\Tinkoff\QrCode\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class Refund extends ResponseInfo { diff --git a/src/TinkoffQrCode/src/Responses/State.php b/src/TinkoffQrCode/src/Responses/State.php index 66532864..ec9a6a74 100644 --- a/src/TinkoffQrCode/src/Responses/State.php +++ b/src/TinkoffQrCode/src/Responses/State.php @@ -15,9 +15,9 @@ declare(strict_types=1); -namespace CashierProvider\Tinkoff\QrCode\Responses; +namespace Cashbox\Tinkoff\QrCode\Responses; -use CashierProvider\Core\Http\ResponseInfo; +use Cashbox\Core\Http\ResponseInfo; class State extends ResponseInfo { diff --git a/src/TinkoffQrCode/tests/DriverTest.php b/src/TinkoffQrCode/tests/DriverTest.php index 4e418692..5c7f5654 100644 --- a/src/TinkoffQrCode/tests/DriverTest.php +++ b/src/TinkoffQrCode/tests/DriverTest.php @@ -15,8 +15,8 @@ namespace Tests; -use CashierProvider\Core\Http\ResponseInfo; -use CashierProvider\Tinkoff\QrCode\Driver as QR; +use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Tinkoff\QrCode\Driver as QR; use DragonCode\Contracts\Cashier\Driver as DriverContract; use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; use DragonCode\Support\Facades\Http\Url; diff --git a/src/TinkoffQrCode/tests/Fixtures/Models/ReadyPayment.php b/src/TinkoffQrCode/tests/Fixtures/Models/ReadyPayment.php index 8cb600ec..c3cbcd9f 100644 --- a/src/TinkoffQrCode/tests/Fixtures/Models/ReadyPayment.php +++ b/src/TinkoffQrCode/tests/Fixtures/Models/ReadyPayment.php @@ -17,7 +17,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; use Illuminate\Support\Carbon; use Tests\TestCase; diff --git a/src/TinkoffQrCode/tests/Fixtures/Models/RequestPayment.php b/src/TinkoffQrCode/tests/Fixtures/Models/RequestPayment.php index f35795ae..f19ecd52 100644 --- a/src/TinkoffQrCode/tests/Fixtures/Models/RequestPayment.php +++ b/src/TinkoffQrCode/tests/Fixtures/Models/RequestPayment.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Models; -use CashierProvider\Core\Billable; +use Cashbox\Core\Billable; use DragonCode\LaravelSupport\Eloquent\UuidModel; /** diff --git a/src/TinkoffQrCode/tests/Fixtures/Resources/Model.php b/src/TinkoffQrCode/tests/Fixtures/Resources/Model.php index 9e102495..0780a8bb 100644 --- a/src/TinkoffQrCode/tests/Fixtures/Resources/Model.php +++ b/src/TinkoffQrCode/tests/Fixtures/Resources/Model.php @@ -15,7 +15,7 @@ namespace Tests\Fixtures\Resources; -use CashierProvider\Core\Resources\Model as BaseModel; +use Cashbox\Core\Resources\Model as BaseModel; use Illuminate\Support\Carbon; /** @property \Tests\Fixtures\Models\ReadyPayment $model */ diff --git a/src/TinkoffQrCode/tests/Helpers/ExceptionTest.php b/src/TinkoffQrCode/tests/Helpers/ExceptionTest.php index f4e59daf..ad9b816a 100644 --- a/src/TinkoffQrCode/tests/Helpers/ExceptionTest.php +++ b/src/TinkoffQrCode/tests/Helpers/ExceptionTest.php @@ -15,11 +15,11 @@ namespace Tests\Helpers; -use CashierProvider\Core\Exceptions\Http\BadRequestClientException; -use CashierProvider\Core\Exceptions\Http\BaseException; -use CashierProvider\Core\Exceptions\Http\BuyerNotFoundClientException; -use CashierProvider\Core\Exceptions\Http\ContactTheSellerClientException; -use CashierProvider\Tinkoff\QrCode\Exceptions\Manager; +use Cashbox\Core\Exceptions\Http\BadRequestClientException; +use Cashbox\Core\Exceptions\Http\BaseException; +use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; +use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; +use Cashbox\Tinkoff\QrCode\Exceptions\Manager; use DragonCode\Contracts\Http\Builder as HttpBuilder; use DragonCode\Support\Facades\Http\Builder; use Tests\TestCase; diff --git a/src/TinkoffQrCode/tests/Helpers/StatusesTest.php b/src/TinkoffQrCode/tests/Helpers/StatusesTest.php index 9117c9ab..6dccec52 100644 --- a/src/TinkoffQrCode/tests/Helpers/StatusesTest.php +++ b/src/TinkoffQrCode/tests/Helpers/StatusesTest.php @@ -15,8 +15,8 @@ namespace Tests\Helpers; -use CashierProvider\Tinkoff\QrCode\Helpers\Statuses; -use CashierProvider\Tinkoff\QrCode\Resources\Details; +use Cashbox\Tinkoff\QrCode\Helpers\Statuses; +use Cashbox\Tinkoff\QrCode\Resources\Details; use Tests\TestCase; class StatusesTest extends TestCase diff --git a/src/TinkoffQrCode/tests/Jobs/JobsTest.php b/src/TinkoffQrCode/tests/Jobs/JobsTest.php index 4aec8af3..1d18ff28 100644 --- a/src/TinkoffQrCode/tests/Jobs/JobsTest.php +++ b/src/TinkoffQrCode/tests/Jobs/JobsTest.php @@ -15,9 +15,9 @@ namespace Tests\Jobs; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Services\Jobs; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Services\Jobs; use DragonCode\Support\Facades\Http\Url; use Illuminate\Support\Facades\DB; use Tests\Fixtures\Factories\Payment; diff --git a/src/TinkoffQrCode/tests/Observers/ObserverTest.php b/src/TinkoffQrCode/tests/Observers/ObserverTest.php index 0987c8d0..e73ddf95 100644 --- a/src/TinkoffQrCode/tests/Observers/ObserverTest.php +++ b/src/TinkoffQrCode/tests/Observers/ObserverTest.php @@ -15,10 +15,10 @@ namespace Tests\Observers; -use CashierProvider\Core\Constants\Status; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Providers\ObserverServiceProvider; -use CashierProvider\Core\Providers\ServiceProvider; +use Cashbox\Core\Constants\Status; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Providers\ObserverServiceProvider; +use Cashbox\Core\Providers\ServiceProvider; use DragonCode\Support\Facades\Http\Url; use Illuminate\Support\Facades\DB; use Tests\Fixtures\Factories\Payment; diff --git a/src/TinkoffQrCode/tests/Requests/CancelTest.php b/src/TinkoffQrCode/tests/Requests/CancelTest.php index 9cfd63d5..aa55ff50 100644 --- a/src/TinkoffQrCode/tests/Requests/CancelTest.php +++ b/src/TinkoffQrCode/tests/Requests/CancelTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Tinkoff\QrCode\Requests\Cancel; +use Cashbox\Core\Http\Request; +use Cashbox\Tinkoff\QrCode\Requests\Cancel; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/TinkoffQrCode/tests/Requests/GetQRTest.php b/src/TinkoffQrCode/tests/Requests/GetQRTest.php index e4517e96..7edb3396 100644 --- a/src/TinkoffQrCode/tests/Requests/GetQRTest.php +++ b/src/TinkoffQrCode/tests/Requests/GetQRTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Tinkoff\QrCode\Requests\GetQR; +use Cashbox\Core\Http\Request; +use Cashbox\Tinkoff\QrCode\Requests\GetQR; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/TinkoffQrCode/tests/Requests/GetStateTest.php b/src/TinkoffQrCode/tests/Requests/GetStateTest.php index 6d8ec02b..6ad8b0ff 100644 --- a/src/TinkoffQrCode/tests/Requests/GetStateTest.php +++ b/src/TinkoffQrCode/tests/Requests/GetStateTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Tinkoff\QrCode\Requests\GetState; +use Cashbox\Core\Http\Request; +use Cashbox\Tinkoff\QrCode\Requests\GetState; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/TinkoffQrCode/tests/Requests/InitTest.php b/src/TinkoffQrCode/tests/Requests/InitTest.php index 686d6cb2..73e96f2d 100644 --- a/src/TinkoffQrCode/tests/Requests/InitTest.php +++ b/src/TinkoffQrCode/tests/Requests/InitTest.php @@ -15,8 +15,8 @@ namespace Tests\Requests; -use CashierProvider\Core\Http\Request; -use CashierProvider\Tinkoff\QrCode\Requests\Init; +use Cashbox\Core\Http\Request; +use Cashbox\Tinkoff\QrCode\Requests\Init; use DragonCode\Contracts\Cashier\Http\Request as RequestContract; use DragonCode\Contracts\Http\Builder; use Tests\TestCase; diff --git a/src/TinkoffQrCode/tests/Resources/DetailsTest.php b/src/TinkoffQrCode/tests/Resources/DetailsTest.php index 399bc25b..4370b9a9 100644 --- a/src/TinkoffQrCode/tests/Resources/DetailsTest.php +++ b/src/TinkoffQrCode/tests/Resources/DetailsTest.php @@ -15,8 +15,8 @@ namespace Tests\Resources; -use CashierProvider\Core\Resources\Details as BaseDetails; -use CashierProvider\Tinkoff\QrCode\Resources\Details; +use Cashbox\Core\Resources\Details as BaseDetails; +use Cashbox\Tinkoff\QrCode\Resources\Details; use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; use Tests\TestCase; diff --git a/src/TinkoffQrCode/tests/Responses/InitTest.php b/src/TinkoffQrCode/tests/Responses/InitTest.php index d10376ea..351be56d 100644 --- a/src/TinkoffQrCode/tests/Responses/InitTest.php +++ b/src/TinkoffQrCode/tests/Responses/InitTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; -use CashierProvider\Tinkoff\QrCode\Responses\Init; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Tinkoff\QrCode\Responses\Init; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/TinkoffQrCode/tests/Responses/QrCodeTest.php b/src/TinkoffQrCode/tests/Responses/QrCodeTest.php index ddae4f8b..94343d67 100644 --- a/src/TinkoffQrCode/tests/Responses/QrCodeTest.php +++ b/src/TinkoffQrCode/tests/Responses/QrCodeTest.php @@ -15,7 +15,7 @@ namespace Tests\Responses; -use CashierProvider\Tinkoff\QrCode\Responses\QrCode; +use Cashbox\Tinkoff\QrCode\Responses\QrCode; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; @@ -65,7 +65,7 @@ public function testToArray() } /** - * @return \CashierProvider\Tinkoff\QrCode\Responses\QrCode|\DragonCode\Contracts\Cashier\Http\Response + * @return \Cashbox\Tinkoff\QrCode\Responses\QrCode|\DragonCode\Contracts\Cashier\Http\Response */ protected function response(): Response { diff --git a/src/TinkoffQrCode/tests/Responses/RefundTest.php b/src/TinkoffQrCode/tests/Responses/RefundTest.php index 2046c7b3..7afb262d 100644 --- a/src/TinkoffQrCode/tests/Responses/RefundTest.php +++ b/src/TinkoffQrCode/tests/Responses/RefundTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; -use CashierProvider\Tinkoff\QrCode\Responses\Refund; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Tinkoff\QrCode\Responses\Refund; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/TinkoffQrCode/tests/Responses/StateTest.php b/src/TinkoffQrCode/tests/Responses/StateTest.php index 29bc5f17..fb34b2ca 100644 --- a/src/TinkoffQrCode/tests/Responses/StateTest.php +++ b/src/TinkoffQrCode/tests/Responses/StateTest.php @@ -15,8 +15,8 @@ namespace Tests\Responses; -use CashierProvider\Core\Http\ResponseInfo as BaseResponse; -use CashierProvider\Tinkoff\QrCode\Responses\State; +use Cashbox\Core\Http\ResponseInfo as BaseResponse; +use Cashbox\Tinkoff\QrCode\Responses\State; use DragonCode\Contracts\Cashier\Http\Response; use Tests\TestCase; diff --git a/src/TinkoffQrCode/tests/TestCase.php b/src/TinkoffQrCode/tests/TestCase.php index ab1e3f71..66f72f2b 100644 --- a/src/TinkoffQrCode/tests/TestCase.php +++ b/src/TinkoffQrCode/tests/TestCase.php @@ -15,12 +15,12 @@ namespace Tests; -use CashierProvider\Core\Config\Driver as DriverConfig; -use CashierProvider\Core\Constants\Driver as DriverConstant; -use CashierProvider\Core\Facades\Config\Payment as PaymentConfig; -use CashierProvider\Core\Models\CashierDetail; -use CashierProvider\Core\Providers\ServiceProvider; -use CashierProvider\Tinkoff\QrCode\Driver; +use Cashbox\Core\Config\Driver as DriverConfig; +use Cashbox\Core\Constants\Driver as DriverConstant; +use Cashbox\Core\Facades\Config\Payment as PaymentConfig; +use Cashbox\Core\Models\CashierDetail; +use Cashbox\Core\Providers\ServiceProvider; +use Cashbox\Tinkoff\QrCode\Driver; use DragonCode\Contracts\Cashier\Http\Request; use DragonCode\Contracts\Cashier\Resources\Details; use Illuminate\Database\Eloquent\Model as EloquentModel; @@ -107,7 +107,7 @@ protected function detailsRelation(EloquentModel $model, ?Details $details): Cas } /** - * @param \CashierProvider\Tinkoff\QrCode\Requests\BaseRequest|string $request + * @param \Cashbox\Tinkoff\QrCode\Requests\BaseRequest|string $request */ protected function request(string $request): Request { From 247aec22cb231b990c914b4c49b1de6026cba1bc Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 13 Jul 2023 14:43:24 +0300 Subject: [PATCH 002/164] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c566f954..f231cf35 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Cashbox for Laravel -![cashbox](https://preview.dragon-code.pro/cashbox/payments.svg?brand=laravel) +![cashbox payments](https://preview.dragon-code.pro/cashbox/payments.svg?brand=laravel&preposition=with) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] From e9743d18953648f4fe289f959c91c8e8019493d7 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 13 Jul 2023 14:52:50 +0300 Subject: [PATCH 003/164] Added links to telegram channels --- README.md | 6 ++++++ src/Cash/README.md | 6 ++++++ src/Core/README.md | 6 ++++++ src/SberAuth/README.md | 6 ++++++ src/SberOnline/README.md | 6 ++++++ src/SberQrCode/README.md | 6 ++++++ src/TemplateDriver/README.md | 6 ++++++ src/TemplateDriverAuth/README.md | 6 ++++++ src/TinkoffAuth/README.md | 6 ++++++ src/TinkoffCredit/README.md | 6 ++++++ src/TinkoffOnline/README.md | 6 ++++++ src/TinkoffQrCode/README.md | 6 ++++++ 12 files changed, 72 insertions(+) diff --git a/README.md b/README.md index f231cf35..b3fef69b 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,12 @@ to [Foundation](https://github.com/cashbox-laravel/foundation). You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Украинский](https://t.me/dragon_code_news_ua) + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/Cash/README.md b/src/Cash/README.md index 53536be6..06837dc6 100644 --- a/src/Cash/README.md +++ b/src/Cash/README.md @@ -28,6 +28,12 @@ It is not connected to any bank, so all actions are instantaneous. You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Украинский](https://t.me/dragon_code_news_ua) + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/Core/README.md b/src/Core/README.md index 0fad554a..7c520a08 100644 --- a/src/Core/README.md +++ b/src/Core/README.md @@ -28,6 +28,12 @@ It works only in conjunction with payment drivers. You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Украинский](https://t.me/dragon_code_news_ua) + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/SberAuth/README.md b/src/SberAuth/README.md index b6c55ec9..3576e48e 100644 --- a/src/SberAuth/README.md +++ b/src/SberAuth/README.md @@ -28,6 +28,12 @@ Realizes the functionality of signing outgoing requests to the bank. You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Украинский](https://t.me/dragon_code_news_ua) + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/SberOnline/README.md b/src/SberOnline/README.md index c9fecca3..7adcb65c 100644 --- a/src/SberOnline/README.md +++ b/src/SberOnline/README.md @@ -30,6 +30,12 @@ Driver for online payments in [Sberbank](https://www.sberbank.ru). You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Украинский](https://t.me/dragon_code_news_ua) + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/SberQrCode/README.md b/src/SberQrCode/README.md index 66adb000..19d9f93c 100644 --- a/src/SberQrCode/README.md +++ b/src/SberQrCode/README.md @@ -30,6 +30,12 @@ The driver allows you to implement payment on the site using a QR code from [Sbe You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Украинский](https://t.me/dragon_code_news_ua) + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/TemplateDriver/README.md b/src/TemplateDriver/README.md index 03e3789e..b978c80e 100644 --- a/src/TemplateDriver/README.md +++ b/src/TemplateDriver/README.md @@ -27,6 +27,12 @@ Template for fast driver development. You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Украинский](https://t.me/dragon_code_news_ua) + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/TemplateDriverAuth/README.md b/src/TemplateDriverAuth/README.md index 740fac4b..71c312fd 100644 --- a/src/TemplateDriverAuth/README.md +++ b/src/TemplateDriverAuth/README.md @@ -27,6 +27,12 @@ Template for fast authorization driver development. You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Украинский](https://t.me/dragon_code_news_ua) + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/TinkoffAuth/README.md b/src/TinkoffAuth/README.md index 41c64d1f..e74809d4 100644 --- a/src/TinkoffAuth/README.md +++ b/src/TinkoffAuth/README.md @@ -28,6 +28,12 @@ Realizes the functionality of signing outgoing requests to the bank. You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Украинский](https://t.me/dragon_code_news_ua) + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/TinkoffCredit/README.md b/src/TinkoffCredit/README.md index 75ad2ed0..9606773c 100644 --- a/src/TinkoffCredit/README.md +++ b/src/TinkoffCredit/README.md @@ -27,6 +27,12 @@ The driver allows you to use the credit payment system from [Tinkoff](https://ww You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Украинский](https://t.me/dragon_code_news_ua) + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/TinkoffOnline/README.md b/src/TinkoffOnline/README.md index afd39783..9820d02b 100644 --- a/src/TinkoffOnline/README.md +++ b/src/TinkoffOnline/README.md @@ -27,6 +27,12 @@ The driver allows you to use the online payment system from [Tinkoff](https://ww You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Украинский](https://t.me/dragon_code_news_ua) + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/TinkoffQrCode/README.md b/src/TinkoffQrCode/README.md index 8e99b7e2..543c6941 100644 --- a/src/TinkoffQrCode/README.md +++ b/src/TinkoffQrCode/README.md @@ -27,6 +27,12 @@ The driver allows you to implement payment on the site using a QR code from [Tin You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Украинский](https://t.me/dragon_code_news_ua) + ## Contributing Thank you for considering contributing to the `Cashbox`! From 73126d3c3e2978b7e01e80e85e829a1952b76d7e Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 13 Jul 2023 15:16:02 +0300 Subject: [PATCH 004/164] The word "Ukrainian" is translated into Ukrainian --- README.md | 2 +- src/Cash/README.md | 2 +- src/Core/README.md | 2 +- src/SberAuth/README.md | 2 +- src/SberOnline/README.md | 2 +- src/SberQrCode/README.md | 2 +- src/TemplateDriver/README.md | 2 +- src/TemplateDriverAuth/README.md | 2 +- src/TinkoffAuth/README.md | 2 +- src/TinkoffCredit/README.md | 2 +- src/TinkoffOnline/README.md | 2 +- src/TinkoffQrCode/README.md | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index b3fef69b..fdfef5ec 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Украинский](https://t.me/dragon_code_news_ua) +- [Український](https://t.me/dragon_code_news_ua) ## Contributing diff --git a/src/Cash/README.md b/src/Cash/README.md index 06837dc6..3be8931d 100644 --- a/src/Cash/README.md +++ b/src/Cash/README.md @@ -32,7 +32,7 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Украинский](https://t.me/dragon_code_news_ua) +- [Український](https://t.me/dragon_code_news_ua) ## Contributing diff --git a/src/Core/README.md b/src/Core/README.md index 7c520a08..596b43de 100644 --- a/src/Core/README.md +++ b/src/Core/README.md @@ -32,7 +32,7 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Украинский](https://t.me/dragon_code_news_ua) +- [Український](https://t.me/dragon_code_news_ua) ## Contributing diff --git a/src/SberAuth/README.md b/src/SberAuth/README.md index 3576e48e..09dde0db 100644 --- a/src/SberAuth/README.md +++ b/src/SberAuth/README.md @@ -32,7 +32,7 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Украинский](https://t.me/dragon_code_news_ua) +- [Український](https://t.me/dragon_code_news_ua) ## Contributing diff --git a/src/SberOnline/README.md b/src/SberOnline/README.md index 7adcb65c..4cf35920 100644 --- a/src/SberOnline/README.md +++ b/src/SberOnline/README.md @@ -34,7 +34,7 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Украинский](https://t.me/dragon_code_news_ua) +- [Український](https://t.me/dragon_code_news_ua) ## Contributing diff --git a/src/SberQrCode/README.md b/src/SberQrCode/README.md index 19d9f93c..f08d2322 100644 --- a/src/SberQrCode/README.md +++ b/src/SberQrCode/README.md @@ -34,7 +34,7 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Украинский](https://t.me/dragon_code_news_ua) +- [Український](https://t.me/dragon_code_news_ua) ## Contributing diff --git a/src/TemplateDriver/README.md b/src/TemplateDriver/README.md index b978c80e..71456483 100644 --- a/src/TemplateDriver/README.md +++ b/src/TemplateDriver/README.md @@ -31,7 +31,7 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Украинский](https://t.me/dragon_code_news_ua) +- [Український](https://t.me/dragon_code_news_ua) ## Contributing diff --git a/src/TemplateDriverAuth/README.md b/src/TemplateDriverAuth/README.md index 71c312fd..f397a74a 100644 --- a/src/TemplateDriverAuth/README.md +++ b/src/TemplateDriverAuth/README.md @@ -31,7 +31,7 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Украинский](https://t.me/dragon_code_news_ua) +- [Український](https://t.me/dragon_code_news_ua) ## Contributing diff --git a/src/TinkoffAuth/README.md b/src/TinkoffAuth/README.md index e74809d4..7af03fdd 100644 --- a/src/TinkoffAuth/README.md +++ b/src/TinkoffAuth/README.md @@ -32,7 +32,7 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Украинский](https://t.me/dragon_code_news_ua) +- [Український](https://t.me/dragon_code_news_ua) ## Contributing diff --git a/src/TinkoffCredit/README.md b/src/TinkoffCredit/README.md index 9606773c..0f8c0cf6 100644 --- a/src/TinkoffCredit/README.md +++ b/src/TinkoffCredit/README.md @@ -31,7 +31,7 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Украинский](https://t.me/dragon_code_news_ua) +- [Український](https://t.me/dragon_code_news_ua) ## Contributing diff --git a/src/TinkoffOnline/README.md b/src/TinkoffOnline/README.md index 9820d02b..62f0d271 100644 --- a/src/TinkoffOnline/README.md +++ b/src/TinkoffOnline/README.md @@ -31,7 +31,7 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Украинский](https://t.me/dragon_code_news_ua) +- [Український](https://t.me/dragon_code_news_ua) ## Contributing diff --git a/src/TinkoffQrCode/README.md b/src/TinkoffQrCode/README.md index 543c6941..2816da19 100644 --- a/src/TinkoffQrCode/README.md +++ b/src/TinkoffQrCode/README.md @@ -31,7 +31,7 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Украинский](https://t.me/dragon_code_news_ua) +- [Український](https://t.me/dragon_code_news_ua) ## Contributing From 1e6e8873484e6fcdfe705ff1d27d737cc7f6afa0 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 13 Jul 2023 18:58:06 +0300 Subject: [PATCH 005/164] Added template presets for forwarding to drivers --- .gitattributes | 2 ++ .templates/LICENSE | 21 ++++++++++++++ .templates/README.md | 65 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 .templates/LICENSE create mode 100644 .templates/README.md diff --git a/.gitattributes b/.gitattributes index 9847f8b4..3fc478fd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,6 +2,8 @@ .github/ export-ignore .idea/ export-ignore +.requests/ export-ignore +.template/ export-ignore tests/ export-ignore diff --git a/.templates/LICENSE b/.templates/LICENSE new file mode 100644 index 00000000..d558c99c --- /dev/null +++ b/.templates/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) {{year}} Andrey Helldar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/.templates/README.md b/.templates/README.md new file mode 100644 index 00000000..cd9bce50 --- /dev/null +++ b/.templates/README.md @@ -0,0 +1,65 @@ +# {{title}} + +![{{title}}](https://preview.dragon-code.pro/cashbox/{{package}}.svg?brand=laravel&preposition=of) + +[![Stable Version][badge_stable]][link_packagist] +[![Unstable Version][badge_unstable]][link_packagist] +[![Total Downloads][badge_downloads]][link_packagist] +[![License][badge_license]][link_license] + +> Attention +> +> The project is in a state of global upgrade and some links may not be correct. + +## About Cashbox + +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification services. +We believe that development should be an enjoyable, creative experience to be truly rewarding. +`Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. + +The project contains some ready-made solutions of payment systems, but you can offer your own. + +## About {{title}} + +{{description}} + +## Documentation + +You will find full documentation on the dedicated [documentation](https://cashbox-laravel.github.io/docs) site. + +We also have Telegram channels where we post announcements: + +- [English](https://t.me/dragon_code_news_en) +- [Русский](https://t.me/dragon_code_news) +- [Український](https://t.me/dragon_code_news_ua) + +## Contributing + +Thank you for considering contributing to the `Cashbox`! +The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). + +## Code of Conduct + +In order to ensure that the `Cashbox` community is welcoming to all, please review and abide by +the [Code of Conduct](https://cashbox-laravel.github.io/docs). + +## Security Vulnerabilities + +Please review [our security policy](https://cashbox-laravel.github.io/docs) on how to report security vulnerabilities. + +## License + +The `Cashbox` is open-source software that works in conjunction with +the [Laravel framework](https://laravel.com/), distributed under the MIT license. + +[badge_downloads]: https://img.shields.io/packagist/dt/cashbox/{{package}}.svg?style=flat-square + +[badge_license]: https://img.shields.io/packagist/l/cashbox/{{package}}.svg?style=flat-square + +[badge_stable]: https://img.shields.io/github/v/release/cashbox/{{package}}?label=stable&style=flat-square + +[badge_unstable]: https://img.shields.io/badge/unstable-dev--main-orange?style=flat-square + +[link_license]: LICENSE + +[link_packagist]: https://packagist.org/packages/cashbox/{{package}} From ff52f8df054a320ec5bde658a7c1633c2b946f56 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 13 Jul 2023 18:58:16 +0300 Subject: [PATCH 006/164] Installed dev dependency --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 41837dd0..596779f2 100644 --- a/composer.json +++ b/composer.json @@ -57,6 +57,7 @@ "symfony/console": "^6.3" }, "require-dev": { + "cerbero/json-parser": "^1.0", "orchestra/testbench": "^8.5.10", "pestphp/pest": "^2.8.2", "symfony/var-dumper": "^6.3.1" From 4f8caf0ec84c62e72855c2cd75c0ef74122fe9d5 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 13 Jul 2023 19:40:08 +0300 Subject: [PATCH 007/164] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B3=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=D0=BA=D0=B0=20=D1=84=D0=B0=D0=B9=D0=BB=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=BA=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86?= =?UTF-8?q?=D0=B8=D0=B8=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 1 - bin/composer.php | 5 +++++ bin/license.php | 5 +++++ bin/readme.php | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 bin/composer.php create mode 100644 bin/license.php create mode 100644 bin/readme.php diff --git a/.gitattributes b/.gitattributes index 3fc478fd..4f0354d1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,7 +3,6 @@ .github/ export-ignore .idea/ export-ignore .requests/ export-ignore -.template/ export-ignore tests/ export-ignore diff --git a/bin/composer.php b/bin/composer.php new file mode 100644 index 00000000..a075e1e8 --- /dev/null +++ b/bin/composer.php @@ -0,0 +1,5 @@ + Date: Thu, 13 Jul 2023 21:57:01 +0300 Subject: [PATCH 008/164] Added update of license files --- .templates/README.md | 3 ++- app/Commands/Command.php | 48 ++++++++++++++++++++++++++++++++++ app/Commands/Composer.php | 15 +++++++++++ app/Commands/License.php | 34 ++++++++++++++++++++++++ app/Commands/Readme.php | 15 +++++++++++ app/Services/Template.php | 33 +++++++++++++++++++++++ bin/cashbox.php | 40 ++++++++++++++++++++++++++++ bin/composer.php | 5 ---- bin/license.php | 5 ---- bin/readme.php | 5 ---- composer.json | 1 + src/Cash/LICENSE | 2 +- src/Core/LICENSE | 2 +- src/SberAuth/LICENSE | 2 +- src/SberOnline/LICENSE | 2 +- src/SberQrCode/LICENSE | 2 +- src/TemplateDriver/LICENSE | 2 +- src/TemplateDriverAuth/LICENSE | 2 +- src/TinkoffAuth/LICENSE | 2 +- src/TinkoffCredit/LICENSE | 2 +- src/TinkoffOnline/LICENSE | 2 +- src/TinkoffQrCode/LICENSE | 2 +- 22 files changed, 199 insertions(+), 27 deletions(-) create mode 100644 app/Commands/Command.php create mode 100644 app/Commands/Composer.php create mode 100644 app/Commands/License.php create mode 100644 app/Commands/Readme.php create mode 100644 app/Services/Template.php create mode 100644 bin/cashbox.php delete mode 100644 bin/composer.php delete mode 100644 bin/license.php delete mode 100644 bin/readme.php diff --git a/.templates/README.md b/.templates/README.md index cd9bce50..66ef9c7f 100644 --- a/.templates/README.md +++ b/.templates/README.md @@ -13,7 +13,8 @@ ## About Cashbox -`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification services. +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification +services. We believe that development should be an enjoyable, creative experience to be truly rewarding. `Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. diff --git a/app/Commands/Command.php b/app/Commands/Command.php new file mode 100644 index 00000000..eb8a6b22 --- /dev/null +++ b/app/Commands/Command.php @@ -0,0 +1,48 @@ +setName($this->commandName()); + } + + protected function execute(InputInterface $input, OutputInterface $output): void + { + $this->handle($output); + } + + protected function projects(): array + { + return Directory::allPaths($this->basePath('src')); + } + + protected function template(): string + { + return $this->basePath($this->template); + } + + protected function basePath(?string $path = null): string + { + return __DIR__ . '/../../' . $path; + } + + protected function commandName(): string + { + return Instance::basename($this); + } +} diff --git a/app/Commands/Composer.php b/app/Commands/Composer.php new file mode 100644 index 00000000..dd2d3d2b --- /dev/null +++ b/app/Commands/Composer.php @@ -0,0 +1,15 @@ +projects() as $project) { + $this->process($this->template(), $project . '/LICENSE'); + } + } + + protected function process(string $source, string $target): void + { + Template::replace($source, $target, [ + 'year' => $this->year(), + ]); + } + + protected function year(): string + { + return date('Y'); + } +} diff --git a/app/Commands/Readme.php b/app/Commands/Readme.php new file mode 100644 index 00000000..410df045 --- /dev/null +++ b/app/Commands/Readme.php @@ -0,0 +1,15 @@ +add(new Composer()); +$application->add(new License()); +$application->add(new Readme()); + +$application->run(); diff --git a/bin/composer.php b/bin/composer.php deleted file mode 100644 index a075e1e8..00000000 --- a/bin/composer.php +++ /dev/null @@ -1,5 +0,0 @@ - Date: Thu, 13 Jul 2023 22:38:46 +0300 Subject: [PATCH 009/164] Added updating README.md files according to a given template --- .templates/README.md | 13 +++++++------ README.md | 3 ++- app/Commands/Command.php | 4 +++- app/Commands/License.php | 2 ++ app/Commands/Readme.php | 24 +++++++++++++++++++++++- src/Cash/README.md | 15 ++++++++------- src/Cash/composer.json | 3 ++- src/Core/README.md | 15 ++++++++------- src/Core/composer.json | 1 + src/SberAuth/README.md | 15 ++++++++------- src/SberAuth/composer.json | 3 ++- src/SberOnline/README.md | 17 ++++++++--------- src/SberOnline/composer.json | 3 ++- src/SberQrCode/README.md | 19 +++++++++---------- src/SberQrCode/composer.json | 3 ++- src/TemplateDriver/README.md | 24 +++++++++++++----------- src/TemplateDriver/composer.json | 3 ++- src/TemplateDriverAuth/README.md | 24 +++++++++++++----------- src/TemplateDriverAuth/composer.json | 3 ++- src/TinkoffAuth/README.md | 15 ++++++++------- src/TinkoffAuth/composer.json | 3 ++- src/TinkoffCredit/README.md | 14 ++++++++------ src/TinkoffCredit/composer.json | 3 ++- src/TinkoffOnline/README.md | 16 +++++++++------- src/TinkoffOnline/composer.json | 3 ++- src/TinkoffQrCode/README.md | 16 +++++++++------- src/TinkoffQrCode/composer.json | 3 ++- 27 files changed, 159 insertions(+), 108 deletions(-) diff --git a/.templates/README.md b/.templates/README.md index 66ef9c7f..621bb8b7 100644 --- a/.templates/README.md +++ b/.templates/README.md @@ -1,6 +1,6 @@ # {{title}} -![{{title}}](https://preview.dragon-code.pro/cashbox/{{package}}.svg?brand=laravel&preposition=of) +![{{title}}](https://preview.dragon-code.pro/{{name}}.svg?brand=laravel&preposition=none) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] @@ -37,7 +37,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -53,14 +53,15 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h The `Cashbox` is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. -[badge_downloads]: https://img.shields.io/packagist/dt/cashbox/{{package}}.svg?style=flat-square -[badge_license]: https://img.shields.io/packagist/l/cashbox/{{package}}.svg?style=flat-square +[badge_downloads]: https://img.shields.io/packagist/dt/{{name}}.svg?style=flat-square -[badge_stable]: https://img.shields.io/github/v/release/cashbox/{{package}}?label=stable&style=flat-square +[badge_license]: https://img.shields.io/packagist/l/{{name}}.svg?style=flat-square + +[badge_stable]: https://img.shields.io/github/v/release/{{name}}?label=stable&style=flat-square [badge_unstable]: https://img.shields.io/badge/unstable-dev--main-orange?style=flat-square [link_license]: LICENSE -[link_packagist]: https://packagist.org/packages/cashbox/{{package}} +[link_packagist]: https://packagist.org/packages/{{name}} diff --git a/README.md b/README.md index fdfef5ec..119cc169 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -54,6 +54,7 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h The Cashbox for Laravel is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. + [badge_downloads]: https://img.shields.io/packagist/dt/cashbox/core.svg?style=flat-square [badge_license]: https://img.shields.io/packagist/l/cashbox/foundation.svg?style=flat-square diff --git a/app/Commands/Command.php b/app/Commands/Command.php index eb8a6b22..35d26dd4 100644 --- a/app/Commands/Command.php +++ b/app/Commands/Command.php @@ -21,9 +21,11 @@ protected function configure(): void $this->setName($this->commandName()); } - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $this->handle($output); + + return static::SUCCESS; } protected function projects(): array diff --git a/app/Commands/License.php b/app/Commands/License.php index 60d19948..20213a47 100644 --- a/app/Commands/License.php +++ b/app/Commands/License.php @@ -16,6 +16,8 @@ class License extends Command protected function handle(OutputInterface $output): void { foreach ($this->projects() as $project) { + $output->writeln('Processing: ' . $project); + $this->process($this->template(), $project . '/LICENSE'); } } diff --git a/app/Commands/Readme.php b/app/Commands/Readme.php index 410df045..b3ab420c 100644 --- a/app/Commands/Readme.php +++ b/app/Commands/Readme.php @@ -4,12 +4,34 @@ namespace App\Commands; +use App\Services\Template; +use Cerbero\JsonParser\JsonParser; use Symfony\Component\Console\Output\OutputInterface; class Readme extends Command { + protected ?string $template = '.templates/README.md'; + protected function handle(OutputInterface $output): void { - // TODO: Implement handle() method. + foreach ($this->projects() as $project) { + $output->writeln('Processing: ' . $project); + + $this->process($this->template(), $project . '/README.md', $this->parse($project)); + } + } + + protected function process(string $source, string $target, JsonParser $json): void + { + Template::replace($source, $target, $json->toArray()); + } + + protected function parse(string $path): JsonParser + { + return JsonParser::parse($path . '/composer.json')->pointers([ + '/name', + '/description', + '/extra/title', + ]); } } diff --git a/src/Cash/README.md b/src/Cash/README.md index 3be8931d..53e008fa 100644 --- a/src/Cash/README.md +++ b/src/Cash/README.md @@ -1,6 +1,6 @@ # Cash Driver -![cashbox](https://preview.dragon-code.pro/cashbox/cash.svg?brand=laravel) +![Cash Driver](https://preview.dragon-code.pro/cashbox/cash.svg?brand=laravel&preposition=none) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] @@ -13,16 +13,16 @@ ## About Cashbox -`Cashbox` provides an expressive and user-friendly interface for managing billing and payment verification services. +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification +services. We believe that development should be an enjoyable, creative experience to be truly rewarding. `Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. The project contains some ready-made solutions of payment systems, but you can offer your own. -## About Driver +## About Cash Driver -The `Cash` payment driver implements cash payments in your application using the `Cashbox` interface. -It is not connected to any bank, so all actions are instantaneous. +The driver implements the functionality of working with cash payment. ## Documentation @@ -37,7 +37,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -50,9 +50,10 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h ## License -The Cashbox is open-source software that works in conjunction with +The `Cashbox` is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. + [badge_downloads]: https://img.shields.io/packagist/dt/cashbox/cash.svg?style=flat-square [badge_license]: https://img.shields.io/packagist/l/cashbox/cash.svg?style=flat-square diff --git a/src/Cash/composer.json b/src/Cash/composer.json index e72b6af7..7c483f34 100644 --- a/src/Cash/composer.json +++ b/src/Cash/composer.json @@ -1,6 +1,6 @@ { "name": "cashbox/cash", - "description": "Driver for managing cash payments (see cashbox/core)", + "description": "The driver implements the functionality of working with cash payment.", "license": "MIT", "type": "library", "keywords": [ @@ -64,6 +64,7 @@ "branch-alias": { "dev-main": "4.x-dev" }, + "title": "Cash Driver", "thanks": [ { "name": "dragon-code/laravel-support", diff --git a/src/Core/README.md b/src/Core/README.md index 596b43de..53daa823 100644 --- a/src/Core/README.md +++ b/src/Core/README.md @@ -1,6 +1,6 @@ -# Cashbox Core +# Core -![cashbox](https://preview.dragon-code.pro/cashbox/core.svg?brand=laravel) +![Core](https://preview.dragon-code.pro/cashbox/core.svg?brand=laravel&preposition=none) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] @@ -13,7 +13,8 @@ ## About Cashbox -`Cashier` provides an expressive and user-friendly interface for managing billing and payment verification services. +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification +services. We believe that development should be an enjoyable, creative experience to be truly rewarding. `Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. @@ -21,8 +22,7 @@ The project contains some ready-made solutions of payment systems, but you can o ## About Core -This project contains the basic functionality of working with payment systems. -It works only in conjunction with payment drivers. +Cashbox provides an expressive, fluent interface to manage billing services. ## Documentation @@ -37,7 +37,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -50,9 +50,10 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h ## License -The Cashbox is open-source software that works in conjunction with +The `Cashbox` is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. + [badge_downloads]: https://img.shields.io/packagist/dt/cashbox/core.svg?style=flat-square [badge_license]: https://img.shields.io/packagist/l/cashbox/core.svg?style=flat-square diff --git a/src/Core/composer.json b/src/Core/composer.json index 829009e9..74d2bb1f 100644 --- a/src/Core/composer.json +++ b/src/Core/composer.json @@ -84,6 +84,7 @@ "Cashbox\\Core\\Providers\\RateLimiterServiceProvider" ] }, + "title": "Core", "thanks": [ { "name": "dragon-code/laravel-support", diff --git a/src/SberAuth/README.md b/src/SberAuth/README.md index 09dde0db..7404694d 100644 --- a/src/SberAuth/README.md +++ b/src/SberAuth/README.md @@ -1,6 +1,6 @@ # Sber Auth Driver -![cashbox](https://preview.dragon-code.pro/cashbox/sber-auth.svg?brand=laravel) +![Sber Auth Driver](https://preview.dragon-code.pro/cashbox/sber-auth.svg?brand=laravel&preposition=none) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] @@ -13,16 +13,16 @@ ## About Cashbox -`Cashier` provides an expressive and user-friendly interface for managing billing and payment verification services. +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification +services. We believe that development should be an enjoyable, creative experience to be truly rewarding. `Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. The project contains some ready-made solutions of payment systems, but you can offer your own. -## About Driver +## About Sber Auth Driver -Authorization driver for [Sberbank](https://www.sberbank.ru) payment systems. -Realizes the functionality of signing outgoing requests to the bank. +The Auth driver generates a signature for requests in the Sber API. ## Documentation @@ -37,7 +37,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -50,9 +50,10 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h ## License -The Cashbox is open-source software that works in conjunction with +The `Cashbox` is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. + [badge_downloads]: https://img.shields.io/packagist/dt/cashbox/sber-auth.svg?style=flat-square [badge_license]: https://img.shields.io/packagist/l/cashbox/sber-auth.svg?style=flat-square diff --git a/src/SberAuth/composer.json b/src/SberAuth/composer.json index d8df0427..c3f0ef1d 100644 --- a/src/SberAuth/composer.json +++ b/src/SberAuth/composer.json @@ -1,6 +1,6 @@ { "name": "cashbox/sber-auth", - "description": "Sber API Authorization Driver", + "description": "The Auth driver generates a signature for requests in the Sber API.", "license": "MIT", "type": "library", "keywords": [ @@ -71,6 +71,7 @@ "branch-alias": { "dev-main": "4.x-dev" }, + "title": "Sber Auth Driver", "thanks": [ { "name": "dragon-code/laravel-support", diff --git a/src/SberOnline/README.md b/src/SberOnline/README.md index 4cf35920..d09ea8aa 100644 --- a/src/SberOnline/README.md +++ b/src/SberOnline/README.md @@ -1,6 +1,6 @@ # Sber Online Driver -![cashbox](https://preview.dragon-code.pro/cashbox/sber-online.svg?brand=laravel) +![Sber Online Driver](https://preview.dragon-code.pro/cashbox/sber-online.svg?brand=laravel&preposition=none) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] @@ -11,20 +11,18 @@ > > The project is in a state of global upgrade and some links may not be correct. -> The driver is in a state of development. -> If you have an opportunity to help in development, please write to us. - ## About Cashbox -`Cashier` provides an expressive and user-friendly interface for managing billing and payment verification services. +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification +services. We believe that development should be an enjoyable, creative experience to be truly rewarding. `Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. The project contains some ready-made solutions of payment systems, but you can offer your own. -## About Driver +## About Sber Online Driver -Driver for online payments in [Sberbank](https://www.sberbank.ru). +The Sber Online driver implements payments in the Sber billing system. ## Documentation @@ -39,7 +37,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -52,9 +50,10 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h ## License -The Cashbox is open-source software that works in conjunction with +The `Cashbox` is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. + [badge_downloads]: https://img.shields.io/packagist/dt/cashbox/sber-online.svg?style=flat-square [badge_license]: https://img.shields.io/packagist/l/cashbox/sber-online.svg?style=flat-square diff --git a/src/SberOnline/composer.json b/src/SberOnline/composer.json index 4aea4563..498d5300 100644 --- a/src/SberOnline/composer.json +++ b/src/SberOnline/composer.json @@ -1,6 +1,6 @@ { "name": "cashbox/sber-online", - "description": "Driver for payment with TECHNOLOGY codes via BankName (see cashbox/core)", + "description": "The Sber Online driver implements payments in the Sber billing system.", "type": "library", "license": "MIT", "keywords": [ @@ -65,6 +65,7 @@ "branch-alias": { "dev-main": "4.x-dev" }, + "title": "Sber Online Driver", "thanks": [ { "name": "dragon-code/laravel-support", diff --git a/src/SberQrCode/README.md b/src/SberQrCode/README.md index f08d2322..b7d14f56 100644 --- a/src/SberQrCode/README.md +++ b/src/SberQrCode/README.md @@ -1,6 +1,6 @@ -# Sber QR Code Driver +# Sber QR Driver -![cashbox](https://preview.dragon-code.pro/cashbox/sber-qr-code.svg?brand=laravel) +![Sber QR Driver](https://preview.dragon-code.pro/cashbox/sber-qr.svg?brand=laravel&preposition=none) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] @@ -11,20 +11,18 @@ > > The project is in a state of global upgrade and some links may not be correct. -> The driver is in a state of development. -> If you have an opportunity to help in development, please write to us. - ## About Cashbox -`Cashier` provides an expressive and user-friendly interface for managing billing and payment verification services. +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification +services. We believe that development should be an enjoyable, creative experience to be truly rewarding. `Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. The project contains some ready-made solutions of payment systems, but you can offer your own. -## About Driver +## About Sber QR Driver -The driver allows you to implement payment on the site using a QR code from [Sberbank](https://www.sberbank.ru). +The Sber QR Code driver implements payments in the Sber billing system. ## Documentation @@ -39,7 +37,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -52,9 +50,10 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h ## License -The Cashbox is open-source software that works in conjunction with +The `Cashbox` is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. + [badge_downloads]: https://img.shields.io/packagist/dt/cashbox/sber-qr.svg?style=flat-square [badge_license]: https://img.shields.io/packagist/l/cashbox/sber-qr.svg?style=flat-square diff --git a/src/SberQrCode/composer.json b/src/SberQrCode/composer.json index e6d8252f..abbe429b 100644 --- a/src/SberQrCode/composer.json +++ b/src/SberQrCode/composer.json @@ -1,6 +1,6 @@ { "name": "cashbox/sber-qr", - "description": "Driver for payment with QR codes via Sber (see cashbox/core)", + "description": "The Sber QR Code driver implements payments in the Sber billing system.", "license": "MIT", "type": "library", "keywords": [ @@ -68,6 +68,7 @@ "branch-alias": { "dev-main": "4.x-dev" }, + "title": "Sber QR Driver", "thanks": [ { "name": "dragon-code/laravel-support", diff --git a/src/TemplateDriver/README.md b/src/TemplateDriver/README.md index 71456483..a8fac257 100644 --- a/src/TemplateDriver/README.md +++ b/src/TemplateDriver/README.md @@ -1,6 +1,6 @@ -# Template Driver +# Driver Template -![cashbox](https://preview.dragon-code.pro/cashbox/cash-driver.svg?brand=laravel) +![Driver Template](https://preview.dragon-code.pro/cashbox/bankname-technology.svg?brand=laravel&preposition=none) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] @@ -13,15 +13,16 @@ ## About Cashbox -`Cashier` provides an expressive and user-friendly interface for managing billing and payment verification services. +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification +services. We believe that development should be an enjoyable, creative experience to be truly rewarding. `Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. The project contains some ready-made solutions of payment systems, but you can offer your own. -## About Driver +## About Driver Template -Template for fast driver development. +The Technology driver implements payments in the Bank billing system. ## Documentation @@ -36,7 +37,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -49,17 +50,18 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h ## License -The Cashbox is open-source software that works in conjunction with +The `Cashbox` is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. -[badge_downloads]: https://img.shields.io/packagist/dt/cashbox/core.svg?style=flat-square -[badge_license]: https://img.shields.io/packagist/l/cashbox/core.svg?style=flat-square +[badge_downloads]: https://img.shields.io/packagist/dt/cashbox/bankname-technology.svg?style=flat-square -[badge_stable]: https://img.shields.io/github/v/release/cashbox/foundation?label=stable&style=flat-square +[badge_license]: https://img.shields.io/packagist/l/cashbox/bankname-technology.svg?style=flat-square + +[badge_stable]: https://img.shields.io/github/v/release/cashbox/bankname-technology?label=stable&style=flat-square [badge_unstable]: https://img.shields.io/badge/unstable-dev--main-orange?style=flat-square [link_license]: LICENSE -[link_packagist]: https://packagist.org/packages/cashbox/core +[link_packagist]: https://packagist.org/packages/cashbox/bankname-technology diff --git a/src/TemplateDriver/composer.json b/src/TemplateDriver/composer.json index 20c8a9e9..0b37ba77 100644 --- a/src/TemplateDriver/composer.json +++ b/src/TemplateDriver/composer.json @@ -1,6 +1,6 @@ { "name": "cashbox/bankname-technology", - "description": "Driver for payment with TECHNOLOGY codes via BankName (see cashbox/core)", + "description": "The Technology driver implements payments in the Bank billing system.", "license": "MIT", "type": "library", "keywords": [ @@ -79,6 +79,7 @@ "branch-alias": { "dev-main": "4.x-dev" }, + "title": "Driver Template", "thanks": [ { "name": "dragon-code/laravel-support", diff --git a/src/TemplateDriverAuth/README.md b/src/TemplateDriverAuth/README.md index f397a74a..85c884ff 100644 --- a/src/TemplateDriverAuth/README.md +++ b/src/TemplateDriverAuth/README.md @@ -1,6 +1,6 @@ -# Template Auth Driver +# Driver Auth Template -![cashbox](https://preview.dragon-code.pro/cashbox/cash-driver.svg?brand=laravel) +![Driver Auth Template](https://preview.dragon-code.pro/cashbox/bankname-auth.svg?brand=laravel&preposition=none) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] @@ -13,15 +13,16 @@ ## About Cashbox -`Cashier` provides an expressive and user-friendly interface for managing billing and payment verification services. +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification +services. We believe that development should be an enjoyable, creative experience to be truly rewarding. `Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. The project contains some ready-made solutions of payment systems, but you can offer your own. -## About Driver +## About Driver Auth Template -Template for fast authorization driver development. +The Auth driver implements payments in the Bank billing system. ## Documentation @@ -36,7 +37,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -49,17 +50,18 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h ## License -The Cashbox is open-source software that works in conjunction with +The `Cashbox` is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. -[badge_downloads]: https://img.shields.io/packagist/dt/cashbox/core.svg?style=flat-square -[badge_license]: https://img.shields.io/packagist/l/cashbox/core.svg?style=flat-square +[badge_downloads]: https://img.shields.io/packagist/dt/cashbox/bankname-auth.svg?style=flat-square -[badge_stable]: https://img.shields.io/github/v/release/cashbox/foundation?label=stable&style=flat-square +[badge_license]: https://img.shields.io/packagist/l/cashbox/bankname-auth.svg?style=flat-square + +[badge_stable]: https://img.shields.io/github/v/release/cashbox/bankname-auth?label=stable&style=flat-square [badge_unstable]: https://img.shields.io/badge/unstable-dev--main-orange?style=flat-square [link_license]: LICENSE -[link_packagist]: https://packagist.org/packages/cashbox/core +[link_packagist]: https://packagist.org/packages/cashbox/bankname-auth diff --git a/src/TemplateDriverAuth/composer.json b/src/TemplateDriverAuth/composer.json index 7c2e4cc7..64bf6fde 100644 --- a/src/TemplateDriverAuth/composer.json +++ b/src/TemplateDriverAuth/composer.json @@ -1,6 +1,6 @@ { "name": "cashbox/bankname-auth", - "description": "BankName API Authorization Driver", + "description": "The Auth driver implements payments in the Bank billing system.", "license": "MIT", "type": "library", "keywords": [ @@ -73,6 +73,7 @@ "branch-alias": { "dev-main": "4.x-dev" }, + "title": "Driver Auth Template", "thanks": [ { "name": "dragon-code/laravel-support", diff --git a/src/TinkoffAuth/README.md b/src/TinkoffAuth/README.md index 7af03fdd..55b7e79f 100644 --- a/src/TinkoffAuth/README.md +++ b/src/TinkoffAuth/README.md @@ -1,6 +1,6 @@ # Tinkoff Auth Driver -![cashbox](https://preview.dragon-code.pro/cashbox/tinkoff-auth.svg?brand=laravel) +![Tinkoff Auth Driver](https://preview.dragon-code.pro/cashbox/tinkoff-auth.svg?brand=laravel&preposition=none) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] @@ -13,16 +13,16 @@ ## About Cashbox -`Cashier` provides an expressive and user-friendly interface for managing billing and payment verification services. +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification +services. We believe that development should be an enjoyable, creative experience to be truly rewarding. `Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. The project contains some ready-made solutions of payment systems, but you can offer your own. -## About Driver +## About Tinkoff Auth Driver -Authorization driver for [Tinkoff](https://www.tinkoff.ru) payment systems. -Realizes the functionality of signing outgoing requests to the bank. +The Auth driver generates a signature for requests in the Tinkoff API. ## Documentation @@ -37,7 +37,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -50,9 +50,10 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h ## License -The Cashbox is open-source software that works in conjunction with +The `Cashbox` is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. + [badge_downloads]: https://img.shields.io/packagist/dt/cashbox/tinkoff-auth.svg?style=flat-square [badge_license]: https://img.shields.io/packagist/l/cashbox/tinkoff-auth.svg?style=flat-square diff --git a/src/TinkoffAuth/composer.json b/src/TinkoffAuth/composer.json index 22166c0d..82368932 100644 --- a/src/TinkoffAuth/composer.json +++ b/src/TinkoffAuth/composer.json @@ -1,6 +1,6 @@ { "name": "cashbox/tinkoff-auth", - "description": "Tinkoff API Authorization Driver", + "description": "The Auth driver generates a signature for requests in the Tinkoff API.", "license": "MIT", "type": "library", "keywords": [ @@ -70,6 +70,7 @@ "branch-alias": { "dev-main": "4.x-dev" }, + "title": "Tinkoff Auth Driver", "thanks": [ { "name": "dragon-code/laravel-support", diff --git a/src/TinkoffCredit/README.md b/src/TinkoffCredit/README.md index 0f8c0cf6..08d0c8ea 100644 --- a/src/TinkoffCredit/README.md +++ b/src/TinkoffCredit/README.md @@ -1,6 +1,6 @@ # Tinkoff Credit Driver -![cashbox](https://preview.dragon-code.pro/cashbox/tinkoff-credit.svg?brand=laravel) +![Tinkoff Credit Driver](https://preview.dragon-code.pro/cashbox/tinkoff-credit.svg?brand=laravel&preposition=none) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] @@ -13,15 +13,16 @@ ## About Cashbox -`Cashier` provides an expressive and user-friendly interface for managing billing and payment verification services. +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification +services. We believe that development should be an enjoyable, creative experience to be truly rewarding. `Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. The project contains some ready-made solutions of payment systems, but you can offer your own. -## About Driver +## About Tinkoff Credit Driver -The driver allows you to use the credit payment system from [Tinkoff](https://www.tinkoff.ru) in the web application. +The Tinkoff Credit driver implements payments in the Tinkoff billing system. ## Documentation @@ -36,7 +37,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -49,9 +50,10 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h ## License -The Cashbox is open-source software that works in conjunction with +The `Cashbox` is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. + [badge_downloads]: https://img.shields.io/packagist/dt/cashbox/tinkoff-credit.svg?style=flat-square [badge_license]: https://img.shields.io/packagist/l/cashbox/tinkoff-credit.svg?style=flat-square diff --git a/src/TinkoffCredit/composer.json b/src/TinkoffCredit/composer.json index 6310bf25..9436159f 100644 --- a/src/TinkoffCredit/composer.json +++ b/src/TinkoffCredit/composer.json @@ -1,6 +1,6 @@ { "name": "cashbox/tinkoff-credit", - "description": "Driver for payment with Credit via Tinkoff Bank (see cashbox/core)", + "description": "The Tinkoff Credit driver implements payments in the Tinkoff billing system.", "license": "MIT", "type": "library", "keywords": [ @@ -65,6 +65,7 @@ "branch-alias": { "dev-main": "4.x-dev" }, + "title": "Tinkoff Credit Driver", "thanks": [ { "name": "dragon-code/laravel-support", diff --git a/src/TinkoffOnline/README.md b/src/TinkoffOnline/README.md index 62f0d271..b0f940a1 100644 --- a/src/TinkoffOnline/README.md +++ b/src/TinkoffOnline/README.md @@ -1,6 +1,6 @@ -# Tinkoff Credit Driver +# Tinkoff Online Driver -![cashbox](https://preview.dragon-code.pro/cashbox/tinkoff-online.svg?brand=laravel) +![Tinkoff Online Driver](https://preview.dragon-code.pro/cashbox/tinkoff-online.svg?brand=laravel&preposition=none) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] @@ -13,15 +13,16 @@ ## About Cashbox -`Cashier` provides an expressive and user-friendly interface for managing billing and payment verification services. +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification +services. We believe that development should be an enjoyable, creative experience to be truly rewarding. `Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. The project contains some ready-made solutions of payment systems, but you can offer your own. -## About Driver +## About Tinkoff Online Driver -The driver allows you to use the online payment system from [Tinkoff](https://www.tinkoff.ru) in the web application. +The Tinkoff Online driver implements payments in the Tinkoff billing system. ## Documentation @@ -36,7 +37,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -49,9 +50,10 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h ## License -The Cashbox is open-source software that works in conjunction with +The `Cashbox` is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. + [badge_downloads]: https://img.shields.io/packagist/dt/cashbox/tinkoff-online.svg?style=flat-square [badge_license]: https://img.shields.io/packagist/l/cashbox/tinkoff-online.svg?style=flat-square diff --git a/src/TinkoffOnline/composer.json b/src/TinkoffOnline/composer.json index 393f91a6..ecfc20ce 100644 --- a/src/TinkoffOnline/composer.json +++ b/src/TinkoffOnline/composer.json @@ -1,6 +1,6 @@ { "name": "cashbox/tinkoff-online", - "description": "Driver for online payments via Tinkoff (see cashbox/core)", + "description": "The Tinkoff Online driver implements payments in the Tinkoff billing system.", "license": "MIT", "type": "library", "keywords": [ @@ -70,6 +70,7 @@ "branch-alias": { "dev-main": "4.x-dev" }, + "title": "Tinkoff Online Driver", "thanks": [ { "name": "dragon-code/laravel-support", diff --git a/src/TinkoffQrCode/README.md b/src/TinkoffQrCode/README.md index 2816da19..c017b6dc 100644 --- a/src/TinkoffQrCode/README.md +++ b/src/TinkoffQrCode/README.md @@ -1,6 +1,6 @@ -# Tinkoff Credit Driver +# Tinkoff QR Code Driver -![cashbox](https://preview.dragon-code.pro/cashbox/tinkoff-qr-code.svg?brand=laravel) +![Tinkoff QR Code Driver](https://preview.dragon-code.pro/cashbox/tinkoff-qr.svg?brand=laravel&preposition=none) [![Stable Version][badge_stable]][link_packagist] [![Unstable Version][badge_unstable]][link_packagist] @@ -13,15 +13,16 @@ ## About Cashbox -`Cashier` provides an expressive and user-friendly interface for managing billing and payment verification services. +`Cashbox for Laravel` provides an expressive and user-friendly interface for managing billing and payment verification +services. We believe that development should be an enjoyable, creative experience to be truly rewarding. `Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. The project contains some ready-made solutions of payment systems, but you can offer your own. -## About Driver +## About Tinkoff QR Code Driver -The driver allows you to implement payment on the site using a QR code from [Tinkoff](https://www.tinkoff.ru). +The Tinkoff QR Code driver implements payments in the Tinkoff billing system. ## Documentation @@ -36,7 +37,7 @@ We also have Telegram channels where we post announcements: ## Contributing Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox-laravel.github.io/docs). +The contribution guide can be found in the [documentation](https://cashbox-laravel.github.io/docs). ## Code of Conduct @@ -49,9 +50,10 @@ Please review [our security policy](https://cashbox-laravel.github.io/docs) on h ## License -The Cashbox is open-source software that works in conjunction with +The `Cashbox` is open-source software that works in conjunction with the [Laravel framework](https://laravel.com/), distributed under the MIT license. + [badge_downloads]: https://img.shields.io/packagist/dt/cashbox/tinkoff-qr.svg?style=flat-square [badge_license]: https://img.shields.io/packagist/l/cashbox/tinkoff-qr.svg?style=flat-square diff --git a/src/TinkoffQrCode/composer.json b/src/TinkoffQrCode/composer.json index 8a9ea309..73f9af73 100644 --- a/src/TinkoffQrCode/composer.json +++ b/src/TinkoffQrCode/composer.json @@ -1,6 +1,6 @@ { "name": "cashbox/tinkoff-qr", - "description": "Driver for payment with QR codes via Tinkoff (see cashbox/core)", + "description": "The Tinkoff QR Code driver implements payments in the Tinkoff billing system.", "license": "MIT", "type": "library", "keywords": [ @@ -69,6 +69,7 @@ "branch-alias": { "dev-main": "4.x-dev" }, + "title": "Tinkoff QR Code Driver", "thanks": [ { "name": "dragon-code/laravel-support", From 62c7a73fa0cbaa80ab2b51160cab4b372977bdff Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 13 Jul 2023 23:12:04 +0300 Subject: [PATCH 010/164] Added synchronization of `composer.json` files --- .github/workflows/sync.yml | 75 +++++++++++++++++++++++ app/Commands/Command.php | 16 ++++- app/Commands/Composer.php | 114 ++++++++++++++++++++++++++++++++++- app/Commands/License.php | 14 +---- app/Commands/Readme.php | 14 +---- app/Services/Template.php | 2 +- bin/{cashbox.php => cashbox} | 0 7 files changed, 205 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/sync.yml rename bin/{cashbox.php => cashbox} (100%) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 00000000..ad70a1f6 --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,75 @@ +name: Synchronization + +on: + push: + branches: + - main + - 4.x + +jobs: + run: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Git setup + if: success() + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, bcmath + coverage: none + + - name: Install dependency + run: composer global require ergebnis/composer-normalize + + - name: Install dependencies + run: composer update + + - name: Updating license files + id: license + run: | + IS_DIRTY=1 + + ./bin/cashbox license + + { git add . && git commit -a -m "Updated license files"; } || IS_DIRTY_0 + + echo "is_dirty=${IS_DIRTY}" >> $GITHUB_OUTPUT + + - name: Updating readme files + id: readme + run: | + IS_DIRTY=1 + + ./bin/cashbox readme + + { git add . && git commit -a -m "Updated readme files"; } || IS_DIRTY_0 + + echo "is_dirty=${IS_DIRTY}" >> $GITHUB_OUTPUT + + - name: Updating composer.json files + id: composer + run: | + IS_DIRTY=1 + + ./bin/cashbox composer + + { git add . && git commit -a -m "Updated \`composer.json\` files"; } || IS_DIRTY_0 + + echo "is_dirty=${IS_DIRTY}" >> $GITHUB_OUTPUT + + - name: Push changes + uses: ad-m/github-push-action@master + if: steps.license.outputs.is_dirty == 1 || \ + steps.readme.outputs.is_dirty == 1 || \ + steps.composer.outputs.is_dirty == 1 + with: + github_token: ${{ secrets.COMPOSER_TOKEN }} diff --git a/app/Commands/Command.php b/app/Commands/Command.php index 35d26dd4..69dd4170 100644 --- a/app/Commands/Command.php +++ b/app/Commands/Command.php @@ -14,7 +14,7 @@ abstract class Command extends BaseCommand { protected ?string $template = null; - abstract protected function handle(OutputInterface $output): void; + abstract protected function handle(string $source, string $target): void; protected function configure(): void { @@ -23,11 +23,23 @@ protected function configure(): void protected function execute(InputInterface $input, OutputInterface $output): int { - $this->handle($output); + $this->prepare(); + + foreach ($this->projects() as $project) { + $output->writeln('Processing: ' . $project); + + $this->handle($this->template(), $project); + } + + $this->finish(); return static::SUCCESS; } + protected function prepare(): void {} + + protected function finish(): void {} + protected function projects(): array { return Directory::allPaths($this->basePath('src')); diff --git a/app/Commands/Composer.php b/app/Commands/Composer.php index dd2d3d2b..5923b50f 100644 --- a/app/Commands/Composer.php +++ b/app/Commands/Composer.php @@ -4,12 +4,120 @@ namespace App\Commands; -use Symfony\Component\Console\Output\OutputInterface; +use Cerbero\JsonParser\JsonParser; +use DragonCode\Support\Facades\Filesystem\File; +use DragonCode\Support\Facades\Helpers\Arr; +use DragonCode\Support\Helpers\Ables\Arrayable; +use Illuminate\Support\Arr as IA; +use Symfony\Component\Process\Process; + +use function str_starts_with; class Composer extends Command { - protected function handle(OutputInterface $output): void + protected array $main = []; + + protected string $exclude = 'cashbox/'; + + protected function handle(string $source, string $target): void + { + $composer = $this->load($target . '/composer.json'); + + $this->copyToDriver($composer, 'license'); + $this->copyToDriver($composer, 'authors'); + $this->copyToDriver($composer, 'support'); + $this->copyToDriver($composer, 'funding'); + $this->copyToDriver($composer, 'minimum-stability', 'stable'); + $this->copyToDriver($composer, 'prefer-stable', true); + $this->copyToDriver($composer, 'require.php'); + $this->copyToDriver($composer, 'config'); + $this->copyToDriver($composer, 'extra.branch-alias'); + $this->copyToDriver($composer, 'extra.thanks'); + + $this->copyToDriverIntersect($composer, 'require'); + + $this->copyToMain($composer, 'keywords'); + $this->copyToMain($composer, 'require'); + + $this->store($target, $composer); + } + + protected function prepare(): void + { + $this->main = $this->load($this->basePath('composer.json')); + } + + protected function finish(): void + { + $this->store($this->basePath(), $this->main); + } + + protected function store(string $target, array $composer): void + { + $flags = JSON_PRETTY_PRINT ^ JSON_UNESCAPED_SLASHES ^ JSON_UNESCAPED_UNICODE; + + file_put_contents($target . '/composer.json', json_encode($composer, $flags) . PHP_EOL); + + $this->composerLock($target . '/composer.lock'); + $this->normalize($target . '/composer.json'); + } + + protected function copyToDriver(&$array, string $key, mixed $default = null): void + { + IA::set($array, $key, $this->fromMain($key, $default)); + } + + protected function copyToDriverIntersect(&$array, string $key): void + { + foreach (Arr::get($this->main, $key) as $package => $version) { + if (IA::has($array, $key . '.' . $package)) { + IA::set($array, $key . '.' . $package, $version); + } + } + } + + protected function copyToMain($array, string $key): void + { + $main = Arr::get($this->main, $key); + $driver = Arr::get($array, $key); + + $items = Arr::of($driver) + ->merge($main) + ->filter(fn (int|string $key) => ! str_starts_with((string) $key, $this->exclude), ARRAY_FILTER_USE_KEY) + ->when( + fn (Arrayable $arr) => is_numeric($arr->keys()->first()), + fn (Arrayable $arr) => $arr->unique()->sort()->values(), + fn (Arrayable $arr) => $arr->ksort() + )->toArray(); + + IA::set($this->main, $key, $items); + } + + protected function fromMain(string $key, mixed $default = null): mixed + { + return Arr::get($this->main, $key, $default); + } + + protected function normalize(string $path): void + { + if ($path = realpath($path)) { + $process = new Process(['composer', 'normalize', $path]); + + $process->run(); + + if (! $process->isSuccessful()) { + dd($process->getOutput()); + } + } + } + + protected function composerLock(string $path): void + { + File::ensureDelete($path); + } + + protected function load(string $path): array { - // TODO: Implement handle() method. + return JsonParser::parse($path)->toArray(); } } diff --git a/app/Commands/License.php b/app/Commands/License.php index 20213a47..613fca47 100644 --- a/app/Commands/License.php +++ b/app/Commands/License.php @@ -5,7 +5,6 @@ namespace App\Commands; use App\Services\Template; -use Symfony\Component\Console\Output\OutputInterface; use function date; @@ -13,18 +12,9 @@ class License extends Command { protected ?string $template = '.templates/LICENSE'; - protected function handle(OutputInterface $output): void + protected function handle(string $source, string $target): void { - foreach ($this->projects() as $project) { - $output->writeln('Processing: ' . $project); - - $this->process($this->template(), $project . '/LICENSE'); - } - } - - protected function process(string $source, string $target): void - { - Template::replace($source, $target, [ + Template::replace($source, $target . '/LICENSE', [ 'year' => $this->year(), ]); } diff --git a/app/Commands/Readme.php b/app/Commands/Readme.php index b3ab420c..1856820a 100644 --- a/app/Commands/Readme.php +++ b/app/Commands/Readme.php @@ -6,24 +6,14 @@ use App\Services\Template; use Cerbero\JsonParser\JsonParser; -use Symfony\Component\Console\Output\OutputInterface; class Readme extends Command { protected ?string $template = '.templates/README.md'; - protected function handle(OutputInterface $output): void + protected function handle(string $source, string $target): void { - foreach ($this->projects() as $project) { - $output->writeln('Processing: ' . $project); - - $this->process($this->template(), $project . '/README.md', $this->parse($project)); - } - } - - protected function process(string $source, string $target, JsonParser $json): void - { - Template::replace($source, $target, $json->toArray()); + Template::replace($source, $target . '/README.md', $this->parse($target)->toArray()); } protected function parse(string $path): JsonParser diff --git a/app/Services/Template.php b/app/Services/Template.php index 24cbff76..02196ae6 100644 --- a/app/Services/Template.php +++ b/app/Services/Template.php @@ -28,6 +28,6 @@ protected static function format(string $template, array $replaces): string protected static function store(string $path, string $content): void { - file_put_contents($path, $content); + file_put_contents($path, $content . PHP_EOL); } } diff --git a/bin/cashbox.php b/bin/cashbox similarity index 100% rename from bin/cashbox.php rename to bin/cashbox From cdec77d048ba334d966cf2e1d388dfa7304d3974 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:12:06 +0300 Subject: [PATCH 011/164] Update `composer.json` files --- composer.json | 9 ++- src/Cash/composer.json | 88 +++++++++++++------------- src/Core/composer.json | 90 +++++++++++++------------- src/SberAuth/composer.json | 92 +++++++++++++-------------- src/SberOnline/composer.json | 94 +++++++++++++--------------- src/SberQrCode/composer.json | 88 +++++++++++++------------- src/TemplateDriver/composer.json | 88 +++++++++++++------------- src/TemplateDriverAuth/composer.json | 92 +++++++++++++-------------- src/TinkoffAuth/composer.json | 92 +++++++++++++-------------- src/TinkoffCredit/composer.json | 88 +++++++++++++------------- src/TinkoffOnline/composer.json | 88 +++++++++++++------------- src/TinkoffQrCode/composer.json | 88 +++++++++++++------------- 12 files changed, 480 insertions(+), 517 deletions(-) diff --git a/composer.json b/composer.json index 53a2555b..b43801d9 100644 --- a/composer.json +++ b/composer.json @@ -4,10 +4,14 @@ "license": "MIT", "type": "library", "keywords": [ + "auth", "bank", "billing", "cashier", - "payments" + "payment", + "payments", + "qr", + "sber" ], "authors": [ { @@ -42,7 +46,9 @@ "php": "^8.1", "ext-json": "*", "archtechx/enums": "^0.3.2", + "dragon-code/contracts": "^2.0", "dragon-code/laravel-support": "^3.6", + "dragon-code/simple-dto": "^2.2", "dragon-code/support": "^6.11.2", "guzzlehttp/guzzle": "^7.7", "illuminate/bus": "*", @@ -52,6 +58,7 @@ "illuminate/queue": "*", "illuminate/support": "^10.14", "nesbot/carbon": "^2.68.1", + "psr/http-message": "^1.0", "psr/log": "^3.0", "spatie/laravel-data": "^3.7", "symfony/console": "^6.3" diff --git a/src/Cash/composer.json b/src/Cash/composer.json index 7c483f34..07a03976 100644 --- a/src/Cash/composer.json +++ b/src/Cash/composer.json @@ -64,63 +64,30 @@ "branch-alias": { "dev-main": "4.x-dev" }, - "title": "Cash Driver", "thanks": [ - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, { "name": "archtechx/enums", "url": "https://github.com/archtechx/enums" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" + "name": "cashbox/cash", + "url": "https://github.com/cashbox-laravel/cash" }, { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "cashbox/core", + "url": "https://github.com/cashbox-laravel/core" }, { "name": "cashbox/docs", "url": "https://github.com/cashbox-laravel/docs" }, { - "name": "cashbox/foundation", - "url": "https://github.com/cashbox-laravel/foundation" - }, - { - "name": "cashbox/core", - "url": "https://github.com/cashbox-laravel/core" + "name": "cashbox/driver", + "url": "https://github.com/cashbox-laravel/driver" }, { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" + "name": "cashbox/driver-auth", + "url": "https://github.com/cashbox-laravel/driver-auth" }, { "name": "cashbox/sber-auth", @@ -151,13 +118,42 @@ "url": "https://github.com/cashbox-laravel/tinkoff-qr" }, { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" + "name": "dragon-code/laravel-support", + "url": "https://github.com/TheDragonCode/laravel-support" }, { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" + "name": "dragon-code/support", + "url": "https://github.com/TheDragonCode/support" + }, + { + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" + }, + { + "name": "nesbot/carbon", + "url": "https://github.com/briannesbitt/Carbon" + }, + { + "name": "orchestra/testbench", + "url": "https://github.com/orchestral/testbench" + }, + { + "name": "pestphp/pest", + "url": "https://github.com/pestphp/pest" + }, + { + "name": "spatie/laravel-data", + "url": "https://github.com/spatie/laravel-data" + }, + { + "name": "symfony/console", + "url": "https://github.com/symfony/console" + }, + { + "name": "symfony/var-dumper", + "url": "https://github.com/symfony/var-dumper" } - ] + ], + "title": "Cash Driver" } } diff --git a/src/Core/composer.json b/src/Core/composer.json index 74d2bb1f..f43f2746 100644 --- a/src/Core/composer.json +++ b/src/Core/composer.json @@ -51,8 +51,8 @@ "illuminate/database": "*", "illuminate/queue": "*", "illuminate/support": "^10.14", - "psr/log": "^3.0", "nesbot/carbon": "^2.68.1", + "psr/log": "^3.0", "spatie/laravel-data": "^3.7", "symfony/console": "^6.3" }, @@ -84,63 +84,30 @@ "Cashbox\\Core\\Providers\\RateLimiterServiceProvider" ] }, - "title": "Core", "thanks": [ - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, { "name": "archtechx/enums", "url": "https://github.com/archtechx/enums" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "cashbox/cash", + "url": "https://github.com/cashbox-laravel/cash" }, { - "name": "cashbox/foundation", - "url": "https://github.com/cashbox-laravel/foundation" + "name": "cashbox/core", + "url": "https://github.com/cashbox-laravel/core" }, { "name": "cashbox/docs", "url": "https://github.com/cashbox-laravel/docs" }, { - "name": "cashbox/core", - "url": "https://github.com/cashbox-laravel/core" + "name": "cashbox/driver", + "url": "https://github.com/cashbox-laravel/driver" }, { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" + "name": "cashbox/driver-auth", + "url": "https://github.com/cashbox-laravel/driver-auth" }, { "name": "cashbox/sber-auth", @@ -171,13 +138,42 @@ "url": "https://github.com/cashbox-laravel/tinkoff-qr" }, { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" + "name": "dragon-code/laravel-support", + "url": "https://github.com/TheDragonCode/laravel-support" }, { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" + "name": "dragon-code/support", + "url": "https://github.com/TheDragonCode/support" + }, + { + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" + }, + { + "name": "nesbot/carbon", + "url": "https://github.com/briannesbitt/Carbon" + }, + { + "name": "orchestra/testbench", + "url": "https://github.com/orchestral/testbench" + }, + { + "name": "pestphp/pest", + "url": "https://github.com/pestphp/pest" + }, + { + "name": "spatie/laravel-data", + "url": "https://github.com/spatie/laravel-data" + }, + { + "name": "symfony/console", + "url": "https://github.com/symfony/console" + }, + { + "name": "symfony/var-dumper", + "url": "https://github.com/symfony/var-dumper" } - ] + ], + "title": "Core" } } diff --git a/src/SberAuth/composer.json b/src/SberAuth/composer.json index c3f0ef1d..73eba175 100644 --- a/src/SberAuth/composer.json +++ b/src/SberAuth/composer.json @@ -47,8 +47,8 @@ "cashbox/core": "^3.0", "dragon-code/contracts": "^2.0", "dragon-code/simple-dto": "^2.2", - "dragon-code/support": "^5.0", - "illuminate/support": "^6.0 || ^7.0 || ^8.0" + "dragon-code/support": "^6.11.2", + "illuminate/support": "^10.14" }, "minimum-stability": "stable", "prefer-stable": true, @@ -71,63 +71,30 @@ "branch-alias": { "dev-main": "4.x-dev" }, - "title": "Sber Auth Driver", "thanks": [ - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, { "name": "archtechx/enums", "url": "https://github.com/archtechx/enums" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "cashbox/cash", + "url": "https://github.com/cashbox-laravel/cash" }, { - "name": "cashbox/foundation", - "url": "https://github.com/cashbox-laravel/foundation" + "name": "cashbox/core", + "url": "https://github.com/cashbox-laravel/core" }, { "name": "cashbox/docs", "url": "https://github.com/cashbox-laravel/docs" }, { - "name": "cashbox/core", - "url": "https://github.com/cashbox-laravel/core" + "name": "cashbox/driver", + "url": "https://github.com/cashbox-laravel/driver" }, { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" + "name": "cashbox/driver-auth", + "url": "https://github.com/cashbox-laravel/driver-auth" }, { "name": "cashbox/sber-auth", @@ -158,13 +125,42 @@ "url": "https://github.com/cashbox-laravel/tinkoff-qr" }, { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" + "name": "dragon-code/laravel-support", + "url": "https://github.com/TheDragonCode/laravel-support" }, { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" + "name": "dragon-code/support", + "url": "https://github.com/TheDragonCode/support" + }, + { + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" + }, + { + "name": "nesbot/carbon", + "url": "https://github.com/briannesbitt/Carbon" + }, + { + "name": "orchestra/testbench", + "url": "https://github.com/orchestral/testbench" + }, + { + "name": "pestphp/pest", + "url": "https://github.com/pestphp/pest" + }, + { + "name": "spatie/laravel-data", + "url": "https://github.com/spatie/laravel-data" + }, + { + "name": "symfony/console", + "url": "https://github.com/symfony/console" + }, + { + "name": "symfony/var-dumper", + "url": "https://github.com/symfony/var-dumper" } - ] + ], + "title": "Sber Auth Driver" } } diff --git a/src/SberOnline/composer.json b/src/SberOnline/composer.json index 498d5300..7ea83288 100644 --- a/src/SberOnline/composer.json +++ b/src/SberOnline/composer.json @@ -1,8 +1,8 @@ { "name": "cashbox/sber-online", "description": "The Sber Online driver implements payments in the Sber billing system.", - "type": "library", "license": "MIT", + "type": "library", "keywords": [ "your-name", "bank", @@ -44,6 +44,8 @@ "cashbox/core": "^3.0", "psr/http-message": "^1.0" }, + "minimum-stability": "stable", + "prefer-stable": true, "autoload": { "psr-4": { "Cashbox\\BankName\\Technology\\": "src/" @@ -59,69 +61,34 @@ "preferred-install": "dist", "sort-packages": true }, - "minimum-stability": "stable", - "prefer-stable": true, "extra": { "branch-alias": { "dev-main": "4.x-dev" }, - "title": "Sber Online Driver", "thanks": [ - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, { "name": "archtechx/enums", "url": "https://github.com/archtechx/enums" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "cashbox/cash", + "url": "https://github.com/cashbox-laravel/cash" }, { - "name": "cashbox/foundation", - "url": "https://github.com/cashbox-laravel/foundation" + "name": "cashbox/core", + "url": "https://github.com/cashbox-laravel/core" }, { "name": "cashbox/docs", "url": "https://github.com/cashbox-laravel/docs" }, { - "name": "cashbox/core", - "url": "https://github.com/cashbox-laravel/core" + "name": "cashbox/driver", + "url": "https://github.com/cashbox-laravel/driver" }, { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" + "name": "cashbox/driver-auth", + "url": "https://github.com/cashbox-laravel/driver-auth" }, { "name": "cashbox/sber-auth", @@ -152,13 +119,42 @@ "url": "https://github.com/cashbox-laravel/tinkoff-qr" }, { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" + "name": "dragon-code/laravel-support", + "url": "https://github.com/TheDragonCode/laravel-support" }, { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" + "name": "dragon-code/support", + "url": "https://github.com/TheDragonCode/support" + }, + { + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" + }, + { + "name": "nesbot/carbon", + "url": "https://github.com/briannesbitt/Carbon" + }, + { + "name": "orchestra/testbench", + "url": "https://github.com/orchestral/testbench" + }, + { + "name": "pestphp/pest", + "url": "https://github.com/pestphp/pest" + }, + { + "name": "spatie/laravel-data", + "url": "https://github.com/spatie/laravel-data" + }, + { + "name": "symfony/console", + "url": "https://github.com/symfony/console" + }, + { + "name": "symfony/var-dumper", + "url": "https://github.com/symfony/var-dumper" } - ] + ], + "title": "Sber Online Driver" } } diff --git a/src/SberQrCode/composer.json b/src/SberQrCode/composer.json index abbe429b..b6377c02 100644 --- a/src/SberQrCode/composer.json +++ b/src/SberQrCode/composer.json @@ -68,63 +68,30 @@ "branch-alias": { "dev-main": "4.x-dev" }, - "title": "Sber QR Driver", "thanks": [ - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, { "name": "archtechx/enums", "url": "https://github.com/archtechx/enums" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "cashbox/cash", + "url": "https://github.com/cashbox-laravel/cash" }, { - "name": "cashbox/foundation", - "url": "https://github.com/cashbox-laravel/foundation" + "name": "cashbox/core", + "url": "https://github.com/cashbox-laravel/core" }, { "name": "cashbox/docs", "url": "https://github.com/cashbox-laravel/docs" }, { - "name": "cashbox/core", - "url": "https://github.com/cashbox-laravel/core" + "name": "cashbox/driver", + "url": "https://github.com/cashbox-laravel/driver" }, { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" + "name": "cashbox/driver-auth", + "url": "https://github.com/cashbox-laravel/driver-auth" }, { "name": "cashbox/sber-auth", @@ -155,13 +122,42 @@ "url": "https://github.com/cashbox-laravel/tinkoff-qr" }, { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" + "name": "dragon-code/laravel-support", + "url": "https://github.com/TheDragonCode/laravel-support" }, { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" + "name": "dragon-code/support", + "url": "https://github.com/TheDragonCode/support" + }, + { + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" + }, + { + "name": "nesbot/carbon", + "url": "https://github.com/briannesbitt/Carbon" + }, + { + "name": "orchestra/testbench", + "url": "https://github.com/orchestral/testbench" + }, + { + "name": "pestphp/pest", + "url": "https://github.com/pestphp/pest" + }, + { + "name": "spatie/laravel-data", + "url": "https://github.com/spatie/laravel-data" + }, + { + "name": "symfony/console", + "url": "https://github.com/symfony/console" + }, + { + "name": "symfony/var-dumper", + "url": "https://github.com/symfony/var-dumper" } - ] + ], + "title": "Sber QR Driver" } } diff --git a/src/TemplateDriver/composer.json b/src/TemplateDriver/composer.json index 0b37ba77..21b49ba3 100644 --- a/src/TemplateDriver/composer.json +++ b/src/TemplateDriver/composer.json @@ -79,63 +79,30 @@ "branch-alias": { "dev-main": "4.x-dev" }, - "title": "Driver Template", "thanks": [ - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, { "name": "archtechx/enums", "url": "https://github.com/archtechx/enums" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "cashbox/cash", + "url": "https://github.com/cashbox-laravel/cash" }, { - "name": "cashbox/foundation", - "url": "https://github.com/cashbox-laravel/foundation" + "name": "cashbox/core", + "url": "https://github.com/cashbox-laravel/core" }, { "name": "cashbox/docs", "url": "https://github.com/cashbox-laravel/docs" }, { - "name": "cashbox/core", - "url": "https://github.com/cashbox-laravel/core" + "name": "cashbox/driver", + "url": "https://github.com/cashbox-laravel/driver" }, { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" + "name": "cashbox/driver-auth", + "url": "https://github.com/cashbox-laravel/driver-auth" }, { "name": "cashbox/sber-auth", @@ -166,13 +133,42 @@ "url": "https://github.com/cashbox-laravel/tinkoff-qr" }, { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" + "name": "dragon-code/laravel-support", + "url": "https://github.com/TheDragonCode/laravel-support" }, { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" + "name": "dragon-code/support", + "url": "https://github.com/TheDragonCode/support" + }, + { + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" + }, + { + "name": "nesbot/carbon", + "url": "https://github.com/briannesbitt/Carbon" + }, + { + "name": "orchestra/testbench", + "url": "https://github.com/orchestral/testbench" + }, + { + "name": "pestphp/pest", + "url": "https://github.com/pestphp/pest" + }, + { + "name": "spatie/laravel-data", + "url": "https://github.com/spatie/laravel-data" + }, + { + "name": "symfony/console", + "url": "https://github.com/symfony/console" + }, + { + "name": "symfony/var-dumper", + "url": "https://github.com/symfony/var-dumper" } - ] + ], + "title": "Driver Template" } } diff --git a/src/TemplateDriverAuth/composer.json b/src/TemplateDriverAuth/composer.json index 64bf6fde..0c1997cd 100644 --- a/src/TemplateDriverAuth/composer.json +++ b/src/TemplateDriverAuth/composer.json @@ -44,8 +44,8 @@ "cashbox/core": "^3.0", "dragon-code/contracts": "^2.0", "dragon-code/simple-dto": "^2.2", - "dragon-code/support": "^5.0", - "illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0" + "dragon-code/support": "^6.11.2", + "illuminate/support": "^10.14" }, "require-dev": { "orchestra/testbench": "^4.0 || ^5.0 || ^6.0 || ^7.0", @@ -73,63 +73,30 @@ "branch-alias": { "dev-main": "4.x-dev" }, - "title": "Driver Auth Template", "thanks": [ - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, { "name": "archtechx/enums", "url": "https://github.com/archtechx/enums" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "cashbox/cash", + "url": "https://github.com/cashbox-laravel/cash" }, { - "name": "cashbox/foundation", - "url": "https://github.com/cashbox-laravel/foundation" + "name": "cashbox/core", + "url": "https://github.com/cashbox-laravel/core" }, { "name": "cashbox/docs", "url": "https://github.com/cashbox-laravel/docs" }, { - "name": "cashbox/core", - "url": "https://github.com/cashbox-laravel/core" + "name": "cashbox/driver", + "url": "https://github.com/cashbox-laravel/driver" }, { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" + "name": "cashbox/driver-auth", + "url": "https://github.com/cashbox-laravel/driver-auth" }, { "name": "cashbox/sber-auth", @@ -160,13 +127,42 @@ "url": "https://github.com/cashbox-laravel/tinkoff-qr" }, { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" + "name": "dragon-code/laravel-support", + "url": "https://github.com/TheDragonCode/laravel-support" }, { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" + "name": "dragon-code/support", + "url": "https://github.com/TheDragonCode/support" + }, + { + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" + }, + { + "name": "nesbot/carbon", + "url": "https://github.com/briannesbitt/Carbon" + }, + { + "name": "orchestra/testbench", + "url": "https://github.com/orchestral/testbench" + }, + { + "name": "pestphp/pest", + "url": "https://github.com/pestphp/pest" + }, + { + "name": "spatie/laravel-data", + "url": "https://github.com/spatie/laravel-data" + }, + { + "name": "symfony/console", + "url": "https://github.com/symfony/console" + }, + { + "name": "symfony/var-dumper", + "url": "https://github.com/symfony/var-dumper" } - ] + ], + "title": "Driver Auth Template" } } diff --git a/src/TinkoffAuth/composer.json b/src/TinkoffAuth/composer.json index 82368932..c1d4d622 100644 --- a/src/TinkoffAuth/composer.json +++ b/src/TinkoffAuth/composer.json @@ -46,8 +46,8 @@ "cashbox/core": "^3.0", "dragon-code/contracts": "^2.0", "dragon-code/simple-dto": "^2.2", - "dragon-code/support": "^5.0", - "illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0" + "dragon-code/support": "^6.11.2", + "illuminate/support": "^10.14" }, "minimum-stability": "stable", "prefer-stable": true, @@ -70,63 +70,30 @@ "branch-alias": { "dev-main": "4.x-dev" }, - "title": "Tinkoff Auth Driver", "thanks": [ - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, { "name": "archtechx/enums", "url": "https://github.com/archtechx/enums" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "cashbox/cash", + "url": "https://github.com/cashbox-laravel/cash" }, { - "name": "cashbox/foundation", - "url": "https://github.com/cashbox-laravel/foundation" + "name": "cashbox/core", + "url": "https://github.com/cashbox-laravel/core" }, { "name": "cashbox/docs", "url": "https://github.com/cashbox-laravel/docs" }, { - "name": "cashbox/core", - "url": "https://github.com/cashbox-laravel/core" + "name": "cashbox/driver", + "url": "https://github.com/cashbox-laravel/driver" }, { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" + "name": "cashbox/driver-auth", + "url": "https://github.com/cashbox-laravel/driver-auth" }, { "name": "cashbox/sber-auth", @@ -157,13 +124,42 @@ "url": "https://github.com/cashbox-laravel/tinkoff-qr" }, { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" + "name": "dragon-code/laravel-support", + "url": "https://github.com/TheDragonCode/laravel-support" }, { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" + "name": "dragon-code/support", + "url": "https://github.com/TheDragonCode/support" + }, + { + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" + }, + { + "name": "nesbot/carbon", + "url": "https://github.com/briannesbitt/Carbon" + }, + { + "name": "orchestra/testbench", + "url": "https://github.com/orchestral/testbench" + }, + { + "name": "pestphp/pest", + "url": "https://github.com/pestphp/pest" + }, + { + "name": "spatie/laravel-data", + "url": "https://github.com/spatie/laravel-data" + }, + { + "name": "symfony/console", + "url": "https://github.com/symfony/console" + }, + { + "name": "symfony/var-dumper", + "url": "https://github.com/symfony/var-dumper" } - ] + ], + "title": "Tinkoff Auth Driver" } } diff --git a/src/TinkoffCredit/composer.json b/src/TinkoffCredit/composer.json index 9436159f..04473c70 100644 --- a/src/TinkoffCredit/composer.json +++ b/src/TinkoffCredit/composer.json @@ -65,63 +65,30 @@ "branch-alias": { "dev-main": "4.x-dev" }, - "title": "Tinkoff Credit Driver", "thanks": [ - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, { "name": "archtechx/enums", "url": "https://github.com/archtechx/enums" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "cashbox/cash", + "url": "https://github.com/cashbox-laravel/cash" }, { - "name": "cashbox/foundation", - "url": "https://github.com/cashbox-laravel/foundation" + "name": "cashbox/core", + "url": "https://github.com/cashbox-laravel/core" }, { "name": "cashbox/docs", "url": "https://github.com/cashbox-laravel/docs" }, { - "name": "cashbox/core", - "url": "https://github.com/cashbox-laravel/core" + "name": "cashbox/driver", + "url": "https://github.com/cashbox-laravel/driver" }, { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" + "name": "cashbox/driver-auth", + "url": "https://github.com/cashbox-laravel/driver-auth" }, { "name": "cashbox/sber-auth", @@ -152,13 +119,42 @@ "url": "https://github.com/cashbox-laravel/tinkoff-qr" }, { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" + "name": "dragon-code/laravel-support", + "url": "https://github.com/TheDragonCode/laravel-support" }, { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" + "name": "dragon-code/support", + "url": "https://github.com/TheDragonCode/support" + }, + { + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" + }, + { + "name": "nesbot/carbon", + "url": "https://github.com/briannesbitt/Carbon" + }, + { + "name": "orchestra/testbench", + "url": "https://github.com/orchestral/testbench" + }, + { + "name": "pestphp/pest", + "url": "https://github.com/pestphp/pest" + }, + { + "name": "spatie/laravel-data", + "url": "https://github.com/spatie/laravel-data" + }, + { + "name": "symfony/console", + "url": "https://github.com/symfony/console" + }, + { + "name": "symfony/var-dumper", + "url": "https://github.com/symfony/var-dumper" } - ] + ], + "title": "Tinkoff Credit Driver" } } diff --git a/src/TinkoffOnline/composer.json b/src/TinkoffOnline/composer.json index ecfc20ce..6acaf8ee 100644 --- a/src/TinkoffOnline/composer.json +++ b/src/TinkoffOnline/composer.json @@ -70,63 +70,30 @@ "branch-alias": { "dev-main": "4.x-dev" }, - "title": "Tinkoff Online Driver", "thanks": [ - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, { "name": "archtechx/enums", "url": "https://github.com/archtechx/enums" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "cashbox/cash", + "url": "https://github.com/cashbox-laravel/cash" }, { - "name": "cashbox/foundation", - "url": "https://github.com/cashbox-laravel/foundation" + "name": "cashbox/core", + "url": "https://github.com/cashbox-laravel/core" }, { "name": "cashbox/docs", "url": "https://github.com/cashbox-laravel/docs" }, { - "name": "cashbox/core", - "url": "https://github.com/cashbox-laravel/core" + "name": "cashbox/driver", + "url": "https://github.com/cashbox-laravel/driver" }, { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" + "name": "cashbox/driver-auth", + "url": "https://github.com/cashbox-laravel/driver-auth" }, { "name": "cashbox/sber-auth", @@ -157,13 +124,42 @@ "url": "https://github.com/cashbox-laravel/tinkoff-qr" }, { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" + "name": "dragon-code/laravel-support", + "url": "https://github.com/TheDragonCode/laravel-support" }, { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" + "name": "dragon-code/support", + "url": "https://github.com/TheDragonCode/support" + }, + { + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" + }, + { + "name": "nesbot/carbon", + "url": "https://github.com/briannesbitt/Carbon" + }, + { + "name": "orchestra/testbench", + "url": "https://github.com/orchestral/testbench" + }, + { + "name": "pestphp/pest", + "url": "https://github.com/pestphp/pest" + }, + { + "name": "spatie/laravel-data", + "url": "https://github.com/spatie/laravel-data" + }, + { + "name": "symfony/console", + "url": "https://github.com/symfony/console" + }, + { + "name": "symfony/var-dumper", + "url": "https://github.com/symfony/var-dumper" } - ] + ], + "title": "Tinkoff Online Driver" } } diff --git a/src/TinkoffQrCode/composer.json b/src/TinkoffQrCode/composer.json index 73f9af73..9fa8ce30 100644 --- a/src/TinkoffQrCode/composer.json +++ b/src/TinkoffQrCode/composer.json @@ -69,63 +69,30 @@ "branch-alias": { "dev-main": "4.x-dev" }, - "title": "Tinkoff QR Code Driver", "thanks": [ - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, { "name": "archtechx/enums", "url": "https://github.com/archtechx/enums" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "cashbox/cash", + "url": "https://github.com/cashbox-laravel/cash" }, { - "name": "cashbox/foundation", - "url": "https://github.com/cashbox-laravel/foundation" + "name": "cashbox/core", + "url": "https://github.com/cashbox-laravel/core" }, { "name": "cashbox/docs", "url": "https://github.com/cashbox-laravel/docs" }, { - "name": "cashbox/core", - "url": "https://github.com/cashbox-laravel/core" + "name": "cashbox/driver", + "url": "https://github.com/cashbox-laravel/driver" }, { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" + "name": "cashbox/driver-auth", + "url": "https://github.com/cashbox-laravel/driver-auth" }, { "name": "cashbox/sber-auth", @@ -156,13 +123,42 @@ "url": "https://github.com/cashbox-laravel/tinkoff-qr" }, { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" + "name": "dragon-code/laravel-support", + "url": "https://github.com/TheDragonCode/laravel-support" }, { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" + "name": "dragon-code/support", + "url": "https://github.com/TheDragonCode/support" + }, + { + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" + }, + { + "name": "nesbot/carbon", + "url": "https://github.com/briannesbitt/Carbon" + }, + { + "name": "orchestra/testbench", + "url": "https://github.com/orchestral/testbench" + }, + { + "name": "pestphp/pest", + "url": "https://github.com/pestphp/pest" + }, + { + "name": "spatie/laravel-data", + "url": "https://github.com/spatie/laravel-data" + }, + { + "name": "symfony/console", + "url": "https://github.com/symfony/console" + }, + { + "name": "symfony/var-dumper", + "url": "https://github.com/symfony/var-dumper" } - ] + ], + "title": "Tinkoff QR Code Driver" } } From 85202641fb3449d7f8895c8a0622cac78d4623d7 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:14:14 +0300 Subject: [PATCH 012/164] Fixed: The workflow is not valid --- .github/workflows/sync.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index ad70a1f6..fd60c6a3 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -68,8 +68,8 @@ jobs: - name: Push changes uses: ad-m/github-push-action@master - if: steps.license.outputs.is_dirty == 1 || \ - steps.readme.outputs.is_dirty == 1 || \ + if: steps.license.outputs.is_dirty == 1 || + steps.readme.outputs.is_dirty == 1 || steps.composer.outputs.is_dirty == 1 with: github_token: ${{ secrets.COMPOSER_TOKEN }} From fc5ff28bfaf5ad0008c3c769feb9b03dffda1f28 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:15:14 +0300 Subject: [PATCH 013/164] Fixed permission denied --- .github/workflows/sync.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index fd60c6a3..b75f2dda 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -38,7 +38,7 @@ jobs: run: | IS_DIRTY=1 - ./bin/cashbox license + sudo ./bin/cashbox license { git add . && git commit -a -m "Updated license files"; } || IS_DIRTY_0 @@ -49,7 +49,7 @@ jobs: run: | IS_DIRTY=1 - ./bin/cashbox readme + sudo ./bin/cashbox readme { git add . && git commit -a -m "Updated readme files"; } || IS_DIRTY_0 @@ -60,7 +60,7 @@ jobs: run: | IS_DIRTY=1 - ./bin/cashbox composer + sudo ./bin/cashbox composer { git add . && git commit -a -m "Updated \`composer.json\` files"; } || IS_DIRTY_0 From a9c41fb9f24e96d0a697d2e20dcea5b47bf3dc1c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:16:05 +0300 Subject: [PATCH 014/164] Fixed command not found --- .github/workflows/sync.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index b75f2dda..7cb69805 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -38,7 +38,7 @@ jobs: run: | IS_DIRTY=1 - sudo ./bin/cashbox license + sudo php ./bin/cashbox license { git add . && git commit -a -m "Updated license files"; } || IS_DIRTY_0 @@ -49,7 +49,7 @@ jobs: run: | IS_DIRTY=1 - sudo ./bin/cashbox readme + sudo php ./bin/cashbox readme { git add . && git commit -a -m "Updated readme files"; } || IS_DIRTY_0 @@ -60,7 +60,7 @@ jobs: run: | IS_DIRTY=1 - sudo ./bin/cashbox composer + sudo php ./bin/cashbox composer { git add . && git commit -a -m "Updated \`composer.json\` files"; } || IS_DIRTY_0 From 9b02197d57cc31327f5b4300465fcd698fd70643 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:18:59 +0300 Subject: [PATCH 015/164] Error: Process completed with exit code 1 --- .github/workflows/sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 7cb69805..16d03c2b 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -24,7 +24,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, bcmath + extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, bcmath, json coverage: none - name: Install dependency From fe165fadec8d4fed813a9c9e7deb171328d3aabf Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:20:22 +0300 Subject: [PATCH 016/164] Error: Process completed with exit code 1 --- app/Commands/Composer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Commands/Composer.php b/app/Commands/Composer.php index 5923b50f..4864d03d 100644 --- a/app/Commands/Composer.php +++ b/app/Commands/Composer.php @@ -101,7 +101,7 @@ protected function fromMain(string $key, mixed $default = null): mixed protected function normalize(string $path): void { if ($path = realpath($path)) { - $process = new Process(['composer', 'normalize', $path]); + $process = new Process(['php', 'composer', 'normalize', $path]); $process->run(); From 078229777e5a35b93a22e70e8fc3b9dbccbac2e0 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:23:36 +0300 Subject: [PATCH 017/164] Error: Process completed with exit code 1 --- app/Commands/Composer.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/app/Commands/Composer.php b/app/Commands/Composer.php index 4864d03d..bc1076c5 100644 --- a/app/Commands/Composer.php +++ b/app/Commands/Composer.php @@ -9,7 +9,6 @@ use DragonCode\Support\Facades\Helpers\Arr; use DragonCode\Support\Helpers\Ables\Arrayable; use Illuminate\Support\Arr as IA; -use Symfony\Component\Process\Process; use function str_starts_with; @@ -59,7 +58,6 @@ protected function store(string $target, array $composer): void file_put_contents($target . '/composer.json', json_encode($composer, $flags) . PHP_EOL); $this->composerLock($target . '/composer.lock'); - $this->normalize($target . '/composer.json'); } protected function copyToDriver(&$array, string $key, mixed $default = null): void @@ -98,19 +96,6 @@ protected function fromMain(string $key, mixed $default = null): mixed return Arr::get($this->main, $key, $default); } - protected function normalize(string $path): void - { - if ($path = realpath($path)) { - $process = new Process(['php', 'composer', 'normalize', $path]); - - $process->run(); - - if (! $process->isSuccessful()) { - dd($process->getOutput()); - } - } - } - protected function composerLock(string $path): void { File::ensureDelete($path); From efdea4b8266af88f9ef1e34e12ab9b89f3178750 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:25:32 +0300 Subject: [PATCH 018/164] Fixed branch name to push changes --- .github/workflows/sync.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 16d03c2b..89b67d2e 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -73,3 +73,4 @@ jobs: steps.composer.outputs.is_dirty == 1 with: github_token: ${{ secrets.COMPOSER_TOKEN }} + branch: ${{ github.ref }} From d39472b2f55c8986fe5f797e60580fd68ba0cab8 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 13 Jul 2023 21:26:01 +0000 Subject: [PATCH 019/164] Updated license files --- src/Cash/LICENSE | 1 + src/Core/LICENSE | 1 + src/SberAuth/LICENSE | 1 + src/SberOnline/LICENSE | 1 + src/SberQrCode/LICENSE | 1 + src/TemplateDriver/LICENSE | 1 + src/TemplateDriverAuth/LICENSE | 1 + src/TinkoffAuth/LICENSE | 1 + src/TinkoffCredit/LICENSE | 1 + src/TinkoffOnline/LICENSE | 1 + src/TinkoffQrCode/LICENSE | 1 + 11 files changed, 11 insertions(+) diff --git a/src/Cash/LICENSE b/src/Cash/LICENSE index 00be0b97..fd68224f 100644 --- a/src/Cash/LICENSE +++ b/src/Cash/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/Core/LICENSE b/src/Core/LICENSE index 00be0b97..fd68224f 100644 --- a/src/Core/LICENSE +++ b/src/Core/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/SberAuth/LICENSE b/src/SberAuth/LICENSE index 00be0b97..fd68224f 100644 --- a/src/SberAuth/LICENSE +++ b/src/SberAuth/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/SberOnline/LICENSE b/src/SberOnline/LICENSE index 00be0b97..fd68224f 100644 --- a/src/SberOnline/LICENSE +++ b/src/SberOnline/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/SberQrCode/LICENSE b/src/SberQrCode/LICENSE index 00be0b97..fd68224f 100644 --- a/src/SberQrCode/LICENSE +++ b/src/SberQrCode/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/TemplateDriver/LICENSE b/src/TemplateDriver/LICENSE index 00be0b97..fd68224f 100644 --- a/src/TemplateDriver/LICENSE +++ b/src/TemplateDriver/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/TemplateDriverAuth/LICENSE b/src/TemplateDriverAuth/LICENSE index 00be0b97..fd68224f 100644 --- a/src/TemplateDriverAuth/LICENSE +++ b/src/TemplateDriverAuth/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/TinkoffAuth/LICENSE b/src/TinkoffAuth/LICENSE index 00be0b97..fd68224f 100644 --- a/src/TinkoffAuth/LICENSE +++ b/src/TinkoffAuth/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/TinkoffCredit/LICENSE b/src/TinkoffCredit/LICENSE index 00be0b97..fd68224f 100644 --- a/src/TinkoffCredit/LICENSE +++ b/src/TinkoffCredit/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/TinkoffOnline/LICENSE b/src/TinkoffOnline/LICENSE index 00be0b97..fd68224f 100644 --- a/src/TinkoffOnline/LICENSE +++ b/src/TinkoffOnline/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/src/TinkoffQrCode/LICENSE b/src/TinkoffQrCode/LICENSE index 00be0b97..fd68224f 100644 --- a/src/TinkoffQrCode/LICENSE +++ b/src/TinkoffQrCode/LICENSE @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + From 1478690779c4c15e4c34806b1da8069e9dd10126 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 13 Jul 2023 21:26:01 +0000 Subject: [PATCH 020/164] Updated readme files --- src/Cash/README.md | 1 + src/Core/README.md | 1 + src/SberAuth/README.md | 1 + src/SberOnline/README.md | 1 + src/SberQrCode/README.md | 1 + src/TemplateDriver/README.md | 1 + src/TemplateDriverAuth/README.md | 1 + src/TinkoffAuth/README.md | 1 + src/TinkoffCredit/README.md | 1 + src/TinkoffOnline/README.md | 1 + src/TinkoffQrCode/README.md | 1 + 11 files changed, 11 insertions(+) diff --git a/src/Cash/README.md b/src/Cash/README.md index 53e008fa..c8b9f9f9 100644 --- a/src/Cash/README.md +++ b/src/Cash/README.md @@ -65,3 +65,4 @@ the [Laravel framework](https://laravel.com/), distributed under the MIT license [link_license]: LICENSE [link_packagist]: https://packagist.org/packages/cashbox/cash + diff --git a/src/Core/README.md b/src/Core/README.md index 53daa823..ec3a1a37 100644 --- a/src/Core/README.md +++ b/src/Core/README.md @@ -65,3 +65,4 @@ the [Laravel framework](https://laravel.com/), distributed under the MIT license [link_license]: LICENSE [link_packagist]: https://packagist.org/packages/cashbox/core + diff --git a/src/SberAuth/README.md b/src/SberAuth/README.md index 7404694d..3c7c0df7 100644 --- a/src/SberAuth/README.md +++ b/src/SberAuth/README.md @@ -65,3 +65,4 @@ the [Laravel framework](https://laravel.com/), distributed under the MIT license [link_license]: LICENSE [link_packagist]: https://packagist.org/packages/cashbox/sber-auth + diff --git a/src/SberOnline/README.md b/src/SberOnline/README.md index d09ea8aa..f4446822 100644 --- a/src/SberOnline/README.md +++ b/src/SberOnline/README.md @@ -65,3 +65,4 @@ the [Laravel framework](https://laravel.com/), distributed under the MIT license [link_license]: LICENSE [link_packagist]: https://packagist.org/packages/cashbox/sber-online + diff --git a/src/SberQrCode/README.md b/src/SberQrCode/README.md index b7d14f56..5a77e55f 100644 --- a/src/SberQrCode/README.md +++ b/src/SberQrCode/README.md @@ -65,3 +65,4 @@ the [Laravel framework](https://laravel.com/), distributed under the MIT license [link_license]: LICENSE [link_packagist]: https://packagist.org/packages/cashbox/sber-qr + diff --git a/src/TemplateDriver/README.md b/src/TemplateDriver/README.md index a8fac257..417ada02 100644 --- a/src/TemplateDriver/README.md +++ b/src/TemplateDriver/README.md @@ -65,3 +65,4 @@ the [Laravel framework](https://laravel.com/), distributed under the MIT license [link_license]: LICENSE [link_packagist]: https://packagist.org/packages/cashbox/bankname-technology + diff --git a/src/TemplateDriverAuth/README.md b/src/TemplateDriverAuth/README.md index 85c884ff..e5c19e8f 100644 --- a/src/TemplateDriverAuth/README.md +++ b/src/TemplateDriverAuth/README.md @@ -65,3 +65,4 @@ the [Laravel framework](https://laravel.com/), distributed under the MIT license [link_license]: LICENSE [link_packagist]: https://packagist.org/packages/cashbox/bankname-auth + diff --git a/src/TinkoffAuth/README.md b/src/TinkoffAuth/README.md index 55b7e79f..963bc8a2 100644 --- a/src/TinkoffAuth/README.md +++ b/src/TinkoffAuth/README.md @@ -65,3 +65,4 @@ the [Laravel framework](https://laravel.com/), distributed under the MIT license [link_license]: LICENSE [link_packagist]: https://packagist.org/packages/cashbox/tinkoff-auth + diff --git a/src/TinkoffCredit/README.md b/src/TinkoffCredit/README.md index 08d0c8ea..409b26a0 100644 --- a/src/TinkoffCredit/README.md +++ b/src/TinkoffCredit/README.md @@ -65,3 +65,4 @@ the [Laravel framework](https://laravel.com/), distributed under the MIT license [link_license]: LICENSE [link_packagist]: https://packagist.org/packages/cashbox/tinkoff-credit + diff --git a/src/TinkoffOnline/README.md b/src/TinkoffOnline/README.md index b0f940a1..0f6137e2 100644 --- a/src/TinkoffOnline/README.md +++ b/src/TinkoffOnline/README.md @@ -65,3 +65,4 @@ the [Laravel framework](https://laravel.com/), distributed under the MIT license [link_license]: LICENSE [link_packagist]: https://packagist.org/packages/cashbox/tinkoff-online + diff --git a/src/TinkoffQrCode/README.md b/src/TinkoffQrCode/README.md index c017b6dc..094d6350 100644 --- a/src/TinkoffQrCode/README.md +++ b/src/TinkoffQrCode/README.md @@ -65,3 +65,4 @@ the [Laravel framework](https://laravel.com/), distributed under the MIT license [link_license]: LICENSE [link_packagist]: https://packagist.org/packages/cashbox/tinkoff-qr + From 8a6d90aaaa6726e996dd297cf2f627c071ece7ea Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 13 Jul 2023 21:26:01 +0000 Subject: [PATCH 021/164] Updated `composer.json` files --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index b43801d9..662acfc0 100644 --- a/composer.json +++ b/composer.json @@ -43,13 +43,12 @@ } ], "require": { - "php": "^8.1", - "ext-json": "*", "archtechx/enums": "^0.3.2", "dragon-code/contracts": "^2.0", "dragon-code/laravel-support": "^3.6", "dragon-code/simple-dto": "^2.2", "dragon-code/support": "^6.11.2", + "ext-json": "*", "guzzlehttp/guzzle": "^7.7", "illuminate/bus": "*", "illuminate/console": "^10.14", @@ -58,6 +57,7 @@ "illuminate/queue": "*", "illuminate/support": "^10.14", "nesbot/carbon": "^2.68.1", + "php": "^8.1", "psr/http-message": "^1.0", "psr/log": "^3.0", "spatie/laravel-data": "^3.7", From 1864ba0415a00304123c847c334d944a2fd3bc6b Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:35:07 +0300 Subject: [PATCH 022/164] Update `.gitignore` --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index a57b0dbc..5fd8d71f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ build/ node_modules/ vendor/ -docs/.env http-client.private.env.json *.bak From a12b6a3dd52ae996dc03d707539a53478d6e8e22 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:36:33 +0300 Subject: [PATCH 023/164] Fixed error: IS_DIRTY_0: command not found --- .github/workflows/sync.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 89b67d2e..92737530 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -40,7 +40,7 @@ jobs: sudo php ./bin/cashbox license - { git add . && git commit -a -m "Updated license files"; } || IS_DIRTY_0 + { git add . && git commit -a -m "Updated license files"; } || IS_DIRTY=0 echo "is_dirty=${IS_DIRTY}" >> $GITHUB_OUTPUT @@ -51,7 +51,7 @@ jobs: sudo php ./bin/cashbox readme - { git add . && git commit -a -m "Updated readme files"; } || IS_DIRTY_0 + { git add . && git commit -a -m "Updated readme files"; } || IS_DIRTY=0 echo "is_dirty=${IS_DIRTY}" >> $GITHUB_OUTPUT @@ -62,7 +62,7 @@ jobs: sudo php ./bin/cashbox composer - { git add . && git commit -a -m "Updated \`composer.json\` files"; } || IS_DIRTY_0 + { git add . && git commit -a -m "Updated \`composer.json\` files"; } || IS_DIRTY=0 echo "is_dirty=${IS_DIRTY}" >> $GITHUB_OUTPUT From 6dc796e5807641b3a26ff505c0837a5a894ad45c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:41:14 +0300 Subject: [PATCH 024/164] Removed synchronization of `composer.json` files from GitHub Actions --- .github/workflows/sync.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 92737530..7a4b77d3 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -55,22 +55,10 @@ jobs: echo "is_dirty=${IS_DIRTY}" >> $GITHUB_OUTPUT - - name: Updating composer.json files - id: composer - run: | - IS_DIRTY=1 - - sudo php ./bin/cashbox composer - - { git add . && git commit -a -m "Updated \`composer.json\` files"; } || IS_DIRTY=0 - - echo "is_dirty=${IS_DIRTY}" >> $GITHUB_OUTPUT - - name: Push changes uses: ad-m/github-push-action@master if: steps.license.outputs.is_dirty == 1 || - steps.readme.outputs.is_dirty == 1 || - steps.composer.outputs.is_dirty == 1 + steps.readme.outputs.is_dirty == 1 with: github_token: ${{ secrets.COMPOSER_TOKEN }} branch: ${{ github.ref }} From a3b15936a7540365a85f1b59a08eea09bdb1f26e Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:41:50 +0300 Subject: [PATCH 025/164] Normalize `composer.json` --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 662acfc0..b43801d9 100644 --- a/composer.json +++ b/composer.json @@ -43,12 +43,13 @@ } ], "require": { + "php": "^8.1", + "ext-json": "*", "archtechx/enums": "^0.3.2", "dragon-code/contracts": "^2.0", "dragon-code/laravel-support": "^3.6", "dragon-code/simple-dto": "^2.2", "dragon-code/support": "^6.11.2", - "ext-json": "*", "guzzlehttp/guzzle": "^7.7", "illuminate/bus": "*", "illuminate/console": "^10.14", @@ -57,7 +58,6 @@ "illuminate/queue": "*", "illuminate/support": "^10.14", "nesbot/carbon": "^2.68.1", - "php": "^8.1", "psr/http-message": "^1.0", "psr/log": "^3.0", "spatie/laravel-data": "^3.7", From 8df5b2555baed2b2b178b35d0a4b92aeb6914468 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:42:29 +0300 Subject: [PATCH 026/164] Bump dependencies --- composer.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index b43801d9..566afe5b 100644 --- a/composer.json +++ b/composer.json @@ -46,19 +46,19 @@ "php": "^8.1", "ext-json": "*", "archtechx/enums": "^0.3.2", - "dragon-code/contracts": "^2.0", + "dragon-code/contracts": "^2.20", "dragon-code/laravel-support": "^3.6", - "dragon-code/simple-dto": "^2.2", + "dragon-code/simple-dto": "^2.7.1", "dragon-code/support": "^6.11.2", "guzzlehttp/guzzle": "^7.7", "illuminate/bus": "*", - "illuminate/console": "^10.14", - "illuminate/contracts": "*", - "illuminate/database": "*", - "illuminate/queue": "*", - "illuminate/support": "^10.14", + "illuminate/console": "^10.15", + "illuminate/contracts": "^10.15", + "illuminate/database": "^10.15", + "illuminate/queue": "^10.15", + "illuminate/support": "^10.15", "nesbot/carbon": "^2.68.1", - "psr/http-message": "^1.0", + "psr/http-message": "^1.1", "psr/log": "^3.0", "spatie/laravel-data": "^3.7", "symfony/console": "^6.3" @@ -66,7 +66,7 @@ "require-dev": { "cerbero/json-parser": "^1.0", "orchestra/testbench": "^8.5.10", - "pestphp/pest": "^2.8.2", + "pestphp/pest": "^2.8.3", "symfony/var-dumper": "^6.3.1" }, "replace": { From 6f4b8c5b251a8608f5270494a7d1241f5f3302b4 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 00:45:20 +0300 Subject: [PATCH 027/164] Fixed code-style --- app/Commands/Composer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Commands/Composer.php b/app/Commands/Composer.php index bc1076c5..917b4027 100644 --- a/app/Commands/Composer.php +++ b/app/Commands/Composer.php @@ -76,7 +76,7 @@ protected function copyToDriverIntersect(&$array, string $key): void protected function copyToMain($array, string $key): void { - $main = Arr::get($this->main, $key); + $main = Arr::get($this->main, $key); $driver = Arr::get($array, $key); $items = Arr::of($driver) From b748158f3110f8cc8d8e7e9f85ff533af00fe1d4 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 01:38:46 +0300 Subject: [PATCH 028/164] Technical classes moved to secure namespace --- app/Commands/Command.php | 2 +- app/Commands/Composer.php | 2 +- app/Commands/License.php | 4 ++-- app/Commands/Readme.php | 4 ++-- app/Services/Template.php | 2 +- bin/cashbox | 6 +++--- composer.json | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/Commands/Command.php b/app/Commands/Command.php index 69dd4170..a09b8020 100644 --- a/app/Commands/Command.php +++ b/app/Commands/Command.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Commands; +namespace CashboxDev\Commands; use DragonCode\Support\Facades\Filesystem\Directory; use DragonCode\Support\Facades\Instances\Instance; diff --git a/app/Commands/Composer.php b/app/Commands/Composer.php index 917b4027..9416f928 100644 --- a/app/Commands/Composer.php +++ b/app/Commands/Composer.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Commands; +namespace CashboxDev\Commands; use Cerbero\JsonParser\JsonParser; use DragonCode\Support\Facades\Filesystem\File; diff --git a/app/Commands/License.php b/app/Commands/License.php index 613fca47..4784dca0 100644 --- a/app/Commands/License.php +++ b/app/Commands/License.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace App\Commands; +namespace CashboxDev\Commands; -use App\Services\Template; +use CashboxDev\Services\Template; use function date; diff --git a/app/Commands/Readme.php b/app/Commands/Readme.php index 1856820a..a925fce4 100644 --- a/app/Commands/Readme.php +++ b/app/Commands/Readme.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace App\Commands; +namespace CashboxDev\Commands; -use App\Services\Template; +use CashboxDev\Services\Template; use Cerbero\JsonParser\JsonParser; class Readme extends Command diff --git a/app/Services/Template.php b/app/Services/Template.php index 02196ae6..74331d41 100644 --- a/app/Services/Template.php +++ b/app/Services/Template.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace App\Services; +namespace CashboxDev\Services; use DragonCode\Support\Facades\Helpers\Str; diff --git a/bin/cashbox b/bin/cashbox index 09543c6d..1d5e73db 100644 --- a/bin/cashbox +++ b/bin/cashbox @@ -3,9 +3,9 @@ declare(strict_types=1); -use App\Commands\Composer; -use App\Commands\License; -use App\Commands\Readme; +use CashboxDev\Commands\Composer; +use CashboxDev\Commands\License; +use CashboxDev\Commands\Readme; use Symfony\Component\Console\Application; error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED); diff --git a/composer.json b/composer.json index 566afe5b..7e73ccd4 100644 --- a/composer.json +++ b/composer.json @@ -98,7 +98,7 @@ }, "autoload-dev": { "psr-4": { - "App\\": "app/", + "CashboxDev\\": "app/", "Tests\\": "tests/" } }, From ce4a0c87120462cf664e3f57365401cb36c41503 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 02:05:44 +0300 Subject: [PATCH 029/164] Added filtering and sorting of the `Thanks` block --- app/Commands/Composer.php | 40 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/app/Commands/Composer.php b/app/Commands/Composer.php index 9416f928..92600b4e 100644 --- a/app/Commands/Composer.php +++ b/app/Commands/Composer.php @@ -18,6 +18,10 @@ class Composer extends Command protected string $exclude = 'cashbox/'; + protected array $thanks = [ + 'illuminate/' => 'laravel/framework', + ]; + protected function handle(string $source, string $target): void { $composer = $this->load($target . '/composer.json'); @@ -31,8 +35,8 @@ protected function handle(string $source, string $target): void $this->copyToDriver($composer, 'require.php'); $this->copyToDriver($composer, 'config'); $this->copyToDriver($composer, 'extra.branch-alias'); - $this->copyToDriver($composer, 'extra.thanks'); + $this->copyToDriverThanks($composer, 'extra.thanks', 'require'); $this->copyToDriverIntersect($composer, 'require'); $this->copyToMain($composer, 'keywords'); @@ -48,6 +52,8 @@ protected function prepare(): void protected function finish(): void { + $this->sortMainThanks($this->main, 'extra.thanks'); + $this->store($this->basePath(), $this->main); } @@ -65,6 +71,27 @@ protected function copyToDriver(&$array, string $key, mixed $default = null): vo IA::set($array, $key, $this->fromMain($key, $default)); } + protected function copyToDriverThanks(&$array, string $key, string $filterKey): void + { + $dependencies = array_keys($array[$filterKey] ?? []); + + foreach ($this->thanks as $project => $thank) { + foreach ($dependencies as $dependency) { + if (str_starts_with($dependency, $project)) { + $dependencies[] = $thank; + } + } + } + + $source = collect($this->fromMain($key)) + ->filter(fn (array $item) => in_array($item['name'], $dependencies)) + ->sortBy('name') + ->values() + ->all(); + + IA::set($array, $key, $source); + } + protected function copyToDriverIntersect(&$array, string $key): void { foreach (Arr::get($this->main, $key) as $package => $version) { @@ -76,7 +103,7 @@ protected function copyToDriverIntersect(&$array, string $key): void protected function copyToMain($array, string $key): void { - $main = Arr::get($this->main, $key); + $main = Arr::get($this->main, $key); $driver = Arr::get($array, $key); $items = Arr::of($driver) @@ -91,6 +118,15 @@ protected function copyToMain($array, string $key): void IA::set($this->main, $key, $items); } + protected function sortMainThanks(array &$array, string $key): void + { + $thanks = Arr::get($array, $key, []); + + $items = collect($thanks)->sortBy('name')->values()->all(); + + IA::set($array, $key, $items); + } + protected function fromMain(string $key, mixed $default = null): mixed { return Arr::get($this->main, $key, $default); From 72541b9ff6302be0e0462b42f778ed925c43ba6c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 02:07:24 +0300 Subject: [PATCH 030/164] The `Thanks` blocks has been filtered and sorted --- composer.json | 51 ++++++++++++++++- src/Cash/composer.json | 86 +--------------------------- src/Core/composer.json | 80 +++++++++----------------- src/SberAuth/composer.json | 86 +++------------------------- src/SberOnline/composer.json | 86 +--------------------------- src/SberQrCode/composer.json | 82 +------------------------- src/TemplateDriver/composer.json | 86 +--------------------------- src/TemplateDriverAuth/composer.json | 86 +++------------------------- src/TinkoffAuth/composer.json | 86 +++------------------------- src/TinkoffCredit/composer.json | 86 +--------------------------- src/TinkoffOnline/composer.json | 82 +------------------------- src/TinkoffQrCode/composer.json | 82 +------------------------- 12 files changed, 116 insertions(+), 863 deletions(-) diff --git a/composer.json b/composer.json index 7e73ccd4..bcf46062 100644 --- a/composer.json +++ b/composer.json @@ -43,21 +43,21 @@ } ], "require": { - "php": "^8.1", - "ext-json": "*", "archtechx/enums": "^0.3.2", "dragon-code/contracts": "^2.20", "dragon-code/laravel-support": "^3.6", "dragon-code/simple-dto": "^2.7.1", "dragon-code/support": "^6.11.2", + "ext-json": "*", "guzzlehttp/guzzle": "^7.7", - "illuminate/bus": "*", + "illuminate/bus": "^10.15", "illuminate/console": "^10.15", "illuminate/contracts": "^10.15", "illuminate/database": "^10.15", "illuminate/queue": "^10.15", "illuminate/support": "^10.15", "nesbot/carbon": "^2.68.1", + "php": "^8.1", "psr/http-message": "^1.1", "psr/log": "^3.0", "spatie/laravel-data": "^3.7", @@ -65,6 +65,7 @@ }, "require-dev": { "cerbero/json-parser": "^1.0", + "mockery/mockery": "^1.6", "orchestra/testbench": "^8.5.10", "pestphp/pest": "^2.8.3", "symfony/var-dumper": "^6.3.1" @@ -169,6 +170,10 @@ "name": "cashbox/tinkoff-qr", "url": "https://github.com/cashbox-laravel/tinkoff-qr" }, + { + "name": "cerbero/json-parser", + "url": "https://github.com/cerbero90/json-parser" + }, { "name": "dragon-code/laravel-support", "url": "https://github.com/TheDragonCode/laravel-support" @@ -177,10 +182,42 @@ "name": "dragon-code/support", "url": "https://github.com/TheDragonCode/support" }, + { + "name": "guzzlehttp/guzzle", + "url": "https://github.com/guzzle/guzzle" + }, + { + "name": "illuminate/bus", + "url": "https://github.com/illuminate/bus" + }, + { + "name": "illuminate/console", + "url": "https://github.com/illuminate/console" + }, + { + "name": "illuminate/contracts", + "url": "https://github.com/illuminate/contracts" + }, + { + "name": "illuminate/database", + "url": "https://github.com/illuminate/database" + }, + { + "name": "illuminate/queue", + "url": "https://github.com/illuminate/queue" + }, + { + "name": "illuminate/support", + "url": "https://github.com/illuminate/support" + }, { "name": "laravel/framework", "url": "https://github.com/laravel/framework" }, + { + "name": "mockery/mockery", + "url": "https://github.com/mockery/mockery" + }, { "name": "nesbot/carbon", "url": "https://github.com/briannesbitt/Carbon" @@ -193,6 +230,14 @@ "name": "pestphp/pest", "url": "https://github.com/pestphp/pest" }, + { + "name": "psr/http-message", + "url": "https://github.com/php-fig/http-message" + }, + { + "name": "psr/log", + "url": "https://github.com/php-fig/log" + }, { "name": "spatie/laravel-data", "url": "https://github.com/spatie/laravel-data" diff --git a/src/Cash/composer.json b/src/Cash/composer.json index 07a03976..57eef1e3 100644 --- a/src/Cash/composer.json +++ b/src/Cash/composer.json @@ -41,7 +41,7 @@ "require": { "php": "^8.1", "cashbox/core": "^2.5 || ^3.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.1" }, "minimum-stability": "stable", "prefer-stable": true, @@ -65,93 +65,13 @@ "dev-main": "4.x-dev" }, "thanks": [ - { - "name": "archtechx/enums", - "url": "https://github.com/archtechx/enums" - }, - { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" - }, { "name": "cashbox/core", "url": "https://github.com/cashbox-laravel/core" }, { - "name": "cashbox/docs", - "url": "https://github.com/cashbox-laravel/docs" - }, - { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" - }, - { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" - }, - { - "name": "cashbox/sber-auth", - "url": "https://github.com/cashbox-laravel/sber-auth" - }, - { - "name": "cashbox/sber-online", - "url": "https://github.com/cashbox-laravel/sber-online" - }, - { - "name": "cashbox/sber-qr", - "url": "https://github.com/cashbox-laravel/sber-qr" - }, - { - "name": "cashbox/tinkoff-auth", - "url": "https://github.com/cashbox-laravel/tinkoff-auth" - }, - { - "name": "cashbox/tinkoff-credit", - "url": "https://github.com/cashbox-laravel/tinkoff-credit" - }, - { - "name": "cashbox/tinkoff-online", - "url": "https://github.com/cashbox-laravel/tinkoff-online" - }, - { - "name": "cashbox/tinkoff-qr", - "url": "https://github.com/cashbox-laravel/tinkoff-qr" - }, - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, - { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "psr/http-message", + "url": "https://github.com/php-fig/http-message" } ], "title": "Cash Driver" diff --git a/src/Core/composer.json b/src/Core/composer.json index f43f2746..bf315c2b 100644 --- a/src/Core/composer.json +++ b/src/Core/composer.json @@ -45,12 +45,12 @@ "dragon-code/laravel-support": "^3.6", "dragon-code/support": "^6.11.2", "guzzlehttp/guzzle": "^7.7", - "illuminate/bus": "*", - "illuminate/console": "^10.14", - "illuminate/contracts": "*", - "illuminate/database": "*", - "illuminate/queue": "*", - "illuminate/support": "^10.14", + "illuminate/bus": "^10.15", + "illuminate/console": "^10.15", + "illuminate/contracts": "^10.15", + "illuminate/database": "^10.15", + "illuminate/queue": "^10.15", + "illuminate/support": "^10.15", "nesbot/carbon": "^2.68.1", "psr/log": "^3.0", "spatie/laravel-data": "^3.7", @@ -90,60 +90,40 @@ "url": "https://github.com/archtechx/enums" }, { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" - }, - { - "name": "cashbox/core", - "url": "https://github.com/cashbox-laravel/core" - }, - { - "name": "cashbox/docs", - "url": "https://github.com/cashbox-laravel/docs" - }, - { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" - }, - { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" - }, - { - "name": "cashbox/sber-auth", - "url": "https://github.com/cashbox-laravel/sber-auth" + "name": "dragon-code/laravel-support", + "url": "https://github.com/TheDragonCode/laravel-support" }, { - "name": "cashbox/sber-online", - "url": "https://github.com/cashbox-laravel/sber-online" + "name": "dragon-code/support", + "url": "https://github.com/TheDragonCode/support" }, { - "name": "cashbox/sber-qr", - "url": "https://github.com/cashbox-laravel/sber-qr" + "name": "guzzlehttp/guzzle", + "url": "https://github.com/guzzle/guzzle" }, { - "name": "cashbox/tinkoff-auth", - "url": "https://github.com/cashbox-laravel/tinkoff-auth" + "name": "illuminate/bus", + "url": "https://github.com/illuminate/bus" }, { - "name": "cashbox/tinkoff-credit", - "url": "https://github.com/cashbox-laravel/tinkoff-credit" + "name": "illuminate/console", + "url": "https://github.com/illuminate/console" }, { - "name": "cashbox/tinkoff-online", - "url": "https://github.com/cashbox-laravel/tinkoff-online" + "name": "illuminate/contracts", + "url": "https://github.com/illuminate/contracts" }, { - "name": "cashbox/tinkoff-qr", - "url": "https://github.com/cashbox-laravel/tinkoff-qr" + "name": "illuminate/database", + "url": "https://github.com/illuminate/database" }, { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" + "name": "illuminate/queue", + "url": "https://github.com/illuminate/queue" }, { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" + "name": "illuminate/support", + "url": "https://github.com/illuminate/support" }, { "name": "laravel/framework", @@ -154,12 +134,8 @@ "url": "https://github.com/briannesbitt/Carbon" }, { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" + "name": "psr/log", + "url": "https://github.com/php-fig/log" }, { "name": "spatie/laravel-data", @@ -168,10 +144,6 @@ { "name": "symfony/console", "url": "https://github.com/symfony/console" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" } ], "title": "Core" diff --git a/src/SberAuth/composer.json b/src/SberAuth/composer.json index 73eba175..c1528056 100644 --- a/src/SberAuth/composer.json +++ b/src/SberAuth/composer.json @@ -45,10 +45,10 @@ "php": "^8.1", "ext-json": "*", "cashbox/core": "^3.0", - "dragon-code/contracts": "^2.0", - "dragon-code/simple-dto": "^2.2", + "dragon-code/contracts": "^2.20", + "dragon-code/simple-dto": "^2.7.1", "dragon-code/support": "^6.11.2", - "illuminate/support": "^10.14" + "illuminate/support": "^10.15" }, "minimum-stability": "stable", "prefer-stable": true, @@ -72,93 +72,21 @@ "dev-main": "4.x-dev" }, "thanks": [ - { - "name": "archtechx/enums", - "url": "https://github.com/archtechx/enums" - }, - { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" - }, { "name": "cashbox/core", "url": "https://github.com/cashbox-laravel/core" }, - { - "name": "cashbox/docs", - "url": "https://github.com/cashbox-laravel/docs" - }, - { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" - }, - { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" - }, - { - "name": "cashbox/sber-auth", - "url": "https://github.com/cashbox-laravel/sber-auth" - }, - { - "name": "cashbox/sber-online", - "url": "https://github.com/cashbox-laravel/sber-online" - }, - { - "name": "cashbox/sber-qr", - "url": "https://github.com/cashbox-laravel/sber-qr" - }, - { - "name": "cashbox/tinkoff-auth", - "url": "https://github.com/cashbox-laravel/tinkoff-auth" - }, - { - "name": "cashbox/tinkoff-credit", - "url": "https://github.com/cashbox-laravel/tinkoff-credit" - }, - { - "name": "cashbox/tinkoff-online", - "url": "https://github.com/cashbox-laravel/tinkoff-online" - }, - { - "name": "cashbox/tinkoff-qr", - "url": "https://github.com/cashbox-laravel/tinkoff-qr" - }, - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, { "name": "dragon-code/support", "url": "https://github.com/TheDragonCode/support" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" + "name": "illuminate/support", + "url": "https://github.com/illuminate/support" }, { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" } ], "title": "Sber Auth Driver" diff --git a/src/SberOnline/composer.json b/src/SberOnline/composer.json index 7ea83288..cd8b9dad 100644 --- a/src/SberOnline/composer.json +++ b/src/SberOnline/composer.json @@ -42,7 +42,7 @@ "php": "^8.1", "cashbox/bankname-auth": "^3.0", "cashbox/core": "^3.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.1" }, "minimum-stability": "stable", "prefer-stable": true, @@ -66,93 +66,13 @@ "dev-main": "4.x-dev" }, "thanks": [ - { - "name": "archtechx/enums", - "url": "https://github.com/archtechx/enums" - }, - { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" - }, { "name": "cashbox/core", "url": "https://github.com/cashbox-laravel/core" }, { - "name": "cashbox/docs", - "url": "https://github.com/cashbox-laravel/docs" - }, - { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" - }, - { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" - }, - { - "name": "cashbox/sber-auth", - "url": "https://github.com/cashbox-laravel/sber-auth" - }, - { - "name": "cashbox/sber-online", - "url": "https://github.com/cashbox-laravel/sber-online" - }, - { - "name": "cashbox/sber-qr", - "url": "https://github.com/cashbox-laravel/sber-qr" - }, - { - "name": "cashbox/tinkoff-auth", - "url": "https://github.com/cashbox-laravel/tinkoff-auth" - }, - { - "name": "cashbox/tinkoff-credit", - "url": "https://github.com/cashbox-laravel/tinkoff-credit" - }, - { - "name": "cashbox/tinkoff-online", - "url": "https://github.com/cashbox-laravel/tinkoff-online" - }, - { - "name": "cashbox/tinkoff-qr", - "url": "https://github.com/cashbox-laravel/tinkoff-qr" - }, - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, - { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "psr/http-message", + "url": "https://github.com/php-fig/http-message" } ], "title": "Sber Online Driver" diff --git a/src/SberQrCode/composer.json b/src/SberQrCode/composer.json index b6377c02..f5b54921 100644 --- a/src/SberQrCode/composer.json +++ b/src/SberQrCode/composer.json @@ -45,7 +45,7 @@ "php": "^8.1", "cashbox/core": "^3.0", "cashbox/sber-auth": "^3.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.1" }, "minimum-stability": "stable", "prefer-stable": true, @@ -69,93 +69,17 @@ "dev-main": "4.x-dev" }, "thanks": [ - { - "name": "archtechx/enums", - "url": "https://github.com/archtechx/enums" - }, - { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" - }, { "name": "cashbox/core", "url": "https://github.com/cashbox-laravel/core" }, - { - "name": "cashbox/docs", - "url": "https://github.com/cashbox-laravel/docs" - }, - { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" - }, - { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" - }, { "name": "cashbox/sber-auth", "url": "https://github.com/cashbox-laravel/sber-auth" }, { - "name": "cashbox/sber-online", - "url": "https://github.com/cashbox-laravel/sber-online" - }, - { - "name": "cashbox/sber-qr", - "url": "https://github.com/cashbox-laravel/sber-qr" - }, - { - "name": "cashbox/tinkoff-auth", - "url": "https://github.com/cashbox-laravel/tinkoff-auth" - }, - { - "name": "cashbox/tinkoff-credit", - "url": "https://github.com/cashbox-laravel/tinkoff-credit" - }, - { - "name": "cashbox/tinkoff-online", - "url": "https://github.com/cashbox-laravel/tinkoff-online" - }, - { - "name": "cashbox/tinkoff-qr", - "url": "https://github.com/cashbox-laravel/tinkoff-qr" - }, - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, - { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "psr/http-message", + "url": "https://github.com/php-fig/http-message" } ], "title": "Sber QR Driver" diff --git a/src/TemplateDriver/composer.json b/src/TemplateDriver/composer.json index 21b49ba3..d450206b 100644 --- a/src/TemplateDriver/composer.json +++ b/src/TemplateDriver/composer.json @@ -42,7 +42,7 @@ "php": "^8.1", "cashbox/bankname-auth": "^3.0", "cashbox/core": "^3.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.1" }, "require-dev": { "ext-json": "*", @@ -80,93 +80,13 @@ "dev-main": "4.x-dev" }, "thanks": [ - { - "name": "archtechx/enums", - "url": "https://github.com/archtechx/enums" - }, - { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" - }, { "name": "cashbox/core", "url": "https://github.com/cashbox-laravel/core" }, { - "name": "cashbox/docs", - "url": "https://github.com/cashbox-laravel/docs" - }, - { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" - }, - { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" - }, - { - "name": "cashbox/sber-auth", - "url": "https://github.com/cashbox-laravel/sber-auth" - }, - { - "name": "cashbox/sber-online", - "url": "https://github.com/cashbox-laravel/sber-online" - }, - { - "name": "cashbox/sber-qr", - "url": "https://github.com/cashbox-laravel/sber-qr" - }, - { - "name": "cashbox/tinkoff-auth", - "url": "https://github.com/cashbox-laravel/tinkoff-auth" - }, - { - "name": "cashbox/tinkoff-credit", - "url": "https://github.com/cashbox-laravel/tinkoff-credit" - }, - { - "name": "cashbox/tinkoff-online", - "url": "https://github.com/cashbox-laravel/tinkoff-online" - }, - { - "name": "cashbox/tinkoff-qr", - "url": "https://github.com/cashbox-laravel/tinkoff-qr" - }, - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, - { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "psr/http-message", + "url": "https://github.com/php-fig/http-message" } ], "title": "Driver Template" diff --git a/src/TemplateDriverAuth/composer.json b/src/TemplateDriverAuth/composer.json index 0c1997cd..38726d97 100644 --- a/src/TemplateDriverAuth/composer.json +++ b/src/TemplateDriverAuth/composer.json @@ -42,10 +42,10 @@ "php": "^8.1", "ext-json": "*", "cashbox/core": "^3.0", - "dragon-code/contracts": "^2.0", - "dragon-code/simple-dto": "^2.2", + "dragon-code/contracts": "^2.20", + "dragon-code/simple-dto": "^2.7.1", "dragon-code/support": "^6.11.2", - "illuminate/support": "^10.14" + "illuminate/support": "^10.15" }, "require-dev": { "orchestra/testbench": "^4.0 || ^5.0 || ^6.0 || ^7.0", @@ -74,93 +74,21 @@ "dev-main": "4.x-dev" }, "thanks": [ - { - "name": "archtechx/enums", - "url": "https://github.com/archtechx/enums" - }, - { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" - }, { "name": "cashbox/core", "url": "https://github.com/cashbox-laravel/core" }, - { - "name": "cashbox/docs", - "url": "https://github.com/cashbox-laravel/docs" - }, - { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" - }, - { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" - }, - { - "name": "cashbox/sber-auth", - "url": "https://github.com/cashbox-laravel/sber-auth" - }, - { - "name": "cashbox/sber-online", - "url": "https://github.com/cashbox-laravel/sber-online" - }, - { - "name": "cashbox/sber-qr", - "url": "https://github.com/cashbox-laravel/sber-qr" - }, - { - "name": "cashbox/tinkoff-auth", - "url": "https://github.com/cashbox-laravel/tinkoff-auth" - }, - { - "name": "cashbox/tinkoff-credit", - "url": "https://github.com/cashbox-laravel/tinkoff-credit" - }, - { - "name": "cashbox/tinkoff-online", - "url": "https://github.com/cashbox-laravel/tinkoff-online" - }, - { - "name": "cashbox/tinkoff-qr", - "url": "https://github.com/cashbox-laravel/tinkoff-qr" - }, - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, { "name": "dragon-code/support", "url": "https://github.com/TheDragonCode/support" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" + "name": "illuminate/support", + "url": "https://github.com/illuminate/support" }, { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" } ], "title": "Driver Auth Template" diff --git a/src/TinkoffAuth/composer.json b/src/TinkoffAuth/composer.json index c1d4d622..c2b6a373 100644 --- a/src/TinkoffAuth/composer.json +++ b/src/TinkoffAuth/composer.json @@ -44,10 +44,10 @@ "php": "^8.1", "ext-json": "*", "cashbox/core": "^3.0", - "dragon-code/contracts": "^2.0", - "dragon-code/simple-dto": "^2.2", + "dragon-code/contracts": "^2.20", + "dragon-code/simple-dto": "^2.7.1", "dragon-code/support": "^6.11.2", - "illuminate/support": "^10.14" + "illuminate/support": "^10.15" }, "minimum-stability": "stable", "prefer-stable": true, @@ -71,93 +71,21 @@ "dev-main": "4.x-dev" }, "thanks": [ - { - "name": "archtechx/enums", - "url": "https://github.com/archtechx/enums" - }, - { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" - }, { "name": "cashbox/core", "url": "https://github.com/cashbox-laravel/core" }, - { - "name": "cashbox/docs", - "url": "https://github.com/cashbox-laravel/docs" - }, - { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" - }, - { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" - }, - { - "name": "cashbox/sber-auth", - "url": "https://github.com/cashbox-laravel/sber-auth" - }, - { - "name": "cashbox/sber-online", - "url": "https://github.com/cashbox-laravel/sber-online" - }, - { - "name": "cashbox/sber-qr", - "url": "https://github.com/cashbox-laravel/sber-qr" - }, - { - "name": "cashbox/tinkoff-auth", - "url": "https://github.com/cashbox-laravel/tinkoff-auth" - }, - { - "name": "cashbox/tinkoff-credit", - "url": "https://github.com/cashbox-laravel/tinkoff-credit" - }, - { - "name": "cashbox/tinkoff-online", - "url": "https://github.com/cashbox-laravel/tinkoff-online" - }, - { - "name": "cashbox/tinkoff-qr", - "url": "https://github.com/cashbox-laravel/tinkoff-qr" - }, - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, { "name": "dragon-code/support", "url": "https://github.com/TheDragonCode/support" }, { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" + "name": "illuminate/support", + "url": "https://github.com/illuminate/support" }, { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "laravel/framework", + "url": "https://github.com/laravel/framework" } ], "title": "Tinkoff Auth Driver" diff --git a/src/TinkoffCredit/composer.json b/src/TinkoffCredit/composer.json index 04473c70..1d887c88 100644 --- a/src/TinkoffCredit/composer.json +++ b/src/TinkoffCredit/composer.json @@ -42,7 +42,7 @@ "require": { "php": "^8.1", "cashbox/core": "^3.4", - "psr/http-message": "^1.0" + "psr/http-message": "^1.1" }, "minimum-stability": "stable", "prefer-stable": true, @@ -66,93 +66,13 @@ "dev-main": "4.x-dev" }, "thanks": [ - { - "name": "archtechx/enums", - "url": "https://github.com/archtechx/enums" - }, - { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" - }, { "name": "cashbox/core", "url": "https://github.com/cashbox-laravel/core" }, { - "name": "cashbox/docs", - "url": "https://github.com/cashbox-laravel/docs" - }, - { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" - }, - { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" - }, - { - "name": "cashbox/sber-auth", - "url": "https://github.com/cashbox-laravel/sber-auth" - }, - { - "name": "cashbox/sber-online", - "url": "https://github.com/cashbox-laravel/sber-online" - }, - { - "name": "cashbox/sber-qr", - "url": "https://github.com/cashbox-laravel/sber-qr" - }, - { - "name": "cashbox/tinkoff-auth", - "url": "https://github.com/cashbox-laravel/tinkoff-auth" - }, - { - "name": "cashbox/tinkoff-credit", - "url": "https://github.com/cashbox-laravel/tinkoff-credit" - }, - { - "name": "cashbox/tinkoff-online", - "url": "https://github.com/cashbox-laravel/tinkoff-online" - }, - { - "name": "cashbox/tinkoff-qr", - "url": "https://github.com/cashbox-laravel/tinkoff-qr" - }, - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, - { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "psr/http-message", + "url": "https://github.com/php-fig/http-message" } ], "title": "Tinkoff Credit Driver" diff --git a/src/TinkoffOnline/composer.json b/src/TinkoffOnline/composer.json index 6acaf8ee..3e85a226 100644 --- a/src/TinkoffOnline/composer.json +++ b/src/TinkoffOnline/composer.json @@ -47,7 +47,7 @@ "php": "^8.1", "cashbox/core": "^3.0", "cashbox/tinkoff-auth": "^3.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.1" }, "minimum-stability": "stable", "prefer-stable": true, @@ -71,93 +71,17 @@ "dev-main": "4.x-dev" }, "thanks": [ - { - "name": "archtechx/enums", - "url": "https://github.com/archtechx/enums" - }, - { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" - }, { "name": "cashbox/core", "url": "https://github.com/cashbox-laravel/core" }, - { - "name": "cashbox/docs", - "url": "https://github.com/cashbox-laravel/docs" - }, - { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" - }, - { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" - }, - { - "name": "cashbox/sber-auth", - "url": "https://github.com/cashbox-laravel/sber-auth" - }, - { - "name": "cashbox/sber-online", - "url": "https://github.com/cashbox-laravel/sber-online" - }, - { - "name": "cashbox/sber-qr", - "url": "https://github.com/cashbox-laravel/sber-qr" - }, { "name": "cashbox/tinkoff-auth", "url": "https://github.com/cashbox-laravel/tinkoff-auth" }, { - "name": "cashbox/tinkoff-credit", - "url": "https://github.com/cashbox-laravel/tinkoff-credit" - }, - { - "name": "cashbox/tinkoff-online", - "url": "https://github.com/cashbox-laravel/tinkoff-online" - }, - { - "name": "cashbox/tinkoff-qr", - "url": "https://github.com/cashbox-laravel/tinkoff-qr" - }, - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, - { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "psr/http-message", + "url": "https://github.com/php-fig/http-message" } ], "title": "Tinkoff Online Driver" diff --git a/src/TinkoffQrCode/composer.json b/src/TinkoffQrCode/composer.json index 9fa8ce30..f3013d3d 100644 --- a/src/TinkoffQrCode/composer.json +++ b/src/TinkoffQrCode/composer.json @@ -46,7 +46,7 @@ "php": "^8.1", "cashbox/core": "^3.0", "cashbox/tinkoff-auth": "^3.0", - "psr/http-message": "^1.0" + "psr/http-message": "^1.1" }, "minimum-stability": "stable", "prefer-stable": true, @@ -70,93 +70,17 @@ "dev-main": "4.x-dev" }, "thanks": [ - { - "name": "archtechx/enums", - "url": "https://github.com/archtechx/enums" - }, - { - "name": "cashbox/cash", - "url": "https://github.com/cashbox-laravel/cash" - }, { "name": "cashbox/core", "url": "https://github.com/cashbox-laravel/core" }, - { - "name": "cashbox/docs", - "url": "https://github.com/cashbox-laravel/docs" - }, - { - "name": "cashbox/driver", - "url": "https://github.com/cashbox-laravel/driver" - }, - { - "name": "cashbox/driver-auth", - "url": "https://github.com/cashbox-laravel/driver-auth" - }, - { - "name": "cashbox/sber-auth", - "url": "https://github.com/cashbox-laravel/sber-auth" - }, - { - "name": "cashbox/sber-online", - "url": "https://github.com/cashbox-laravel/sber-online" - }, - { - "name": "cashbox/sber-qr", - "url": "https://github.com/cashbox-laravel/sber-qr" - }, { "name": "cashbox/tinkoff-auth", "url": "https://github.com/cashbox-laravel/tinkoff-auth" }, { - "name": "cashbox/tinkoff-credit", - "url": "https://github.com/cashbox-laravel/tinkoff-credit" - }, - { - "name": "cashbox/tinkoff-online", - "url": "https://github.com/cashbox-laravel/tinkoff-online" - }, - { - "name": "cashbox/tinkoff-qr", - "url": "https://github.com/cashbox-laravel/tinkoff-qr" - }, - { - "name": "dragon-code/laravel-support", - "url": "https://github.com/TheDragonCode/laravel-support" - }, - { - "name": "dragon-code/support", - "url": "https://github.com/TheDragonCode/support" - }, - { - "name": "laravel/framework", - "url": "https://github.com/laravel/framework" - }, - { - "name": "nesbot/carbon", - "url": "https://github.com/briannesbitt/Carbon" - }, - { - "name": "orchestra/testbench", - "url": "https://github.com/orchestral/testbench" - }, - { - "name": "pestphp/pest", - "url": "https://github.com/pestphp/pest" - }, - { - "name": "spatie/laravel-data", - "url": "https://github.com/spatie/laravel-data" - }, - { - "name": "symfony/console", - "url": "https://github.com/symfony/console" - }, - { - "name": "symfony/var-dumper", - "url": "https://github.com/symfony/var-dumper" + "name": "psr/http-message", + "url": "https://github.com/php-fig/http-message" } ], "title": "Tinkoff QR Code Driver" From 1f1b9a6020b4c995ddaaa00c1e1eb8b4481562ba Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 02:54:44 +0300 Subject: [PATCH 031/164] Testing started --- composer.json | 9 ++- phpunit.xml | 1 + src/Core/config/{cashier.php => cashbox.php} | 44 ++++++------- src/Core/src/Exceptions/BaseException.php | 2 +- .../Internal/ConfigCannotBeEmptyException.php | 12 ++++ src/Core/src/Facades/Config.php | 7 +- src/Core/src/Providers/ServiceProvider.php | 4 +- tests/.gitkeep | 0 tests/Fixtures/Details/CashPaymentDetails.php | 9 +++ tests/Fixtures/Enums/StatusEnum.php | 14 ++++ tests/Fixtures/Enums/TypeEnum.php | 17 +++++ tests/Fixtures/Models/PaymentModel.php | 28 ++++++++ ...023_07_14_022222_create_payments_model.php | 24 +++++++ tests/Pest.php | 66 +++++++++++++++++++ tests/TestCase.php | 51 ++++++++++++++ tests/Unit/Core/EmptyConfigTest.php | 12 ++++ tests/Unit/Drivers/Cash/CreateTest.php | 11 ++++ tests/Unit/Drivers/Cash/FailedTest.php | 3 + tests/Unit/Drivers/Cash/RefundTest.php | 3 + tests/Unit/Drivers/Cash/VerifyTest.php | 3 + 20 files changed, 292 insertions(+), 28 deletions(-) rename src/Core/config/{cashier.php => cashbox.php} (90%) create mode 100644 src/Core/src/Exceptions/Internal/ConfigCannotBeEmptyException.php delete mode 100644 tests/.gitkeep create mode 100644 tests/Fixtures/Details/CashPaymentDetails.php create mode 100644 tests/Fixtures/Enums/StatusEnum.php create mode 100644 tests/Fixtures/Enums/TypeEnum.php create mode 100644 tests/Fixtures/Models/PaymentModel.php create mode 100644 tests/Fixtures/database/2023_07_14_022222_create_payments_model.php create mode 100644 tests/Pest.php create mode 100644 tests/TestCase.php create mode 100644 tests/Unit/Core/EmptyConfigTest.php create mode 100644 tests/Unit/Drivers/Cash/CreateTest.php create mode 100644 tests/Unit/Drivers/Cash/FailedTest.php create mode 100644 tests/Unit/Drivers/Cash/RefundTest.php create mode 100644 tests/Unit/Drivers/Cash/VerifyTest.php diff --git a/composer.json b/composer.json index bcf46062..41f17a91 100644 --- a/composer.json +++ b/composer.json @@ -43,12 +43,13 @@ } ], "require": { + "php": "^8.1", + "ext-json": "*", "archtechx/enums": "^0.3.2", "dragon-code/contracts": "^2.20", "dragon-code/laravel-support": "^3.6", "dragon-code/simple-dto": "^2.7.1", "dragon-code/support": "^6.11.2", - "ext-json": "*", "guzzlehttp/guzzle": "^7.7", "illuminate/bus": "^10.15", "illuminate/console": "^10.15", @@ -57,7 +58,6 @@ "illuminate/queue": "^10.15", "illuminate/support": "^10.15", "nesbot/carbon": "^2.68.1", - "php": "^8.1", "psr/http-message": "^1.1", "psr/log": "^3.0", "spatie/laravel-data": "^3.7", @@ -251,5 +251,10 @@ "url": "https://github.com/symfony/var-dumper" } ] + }, + "scripts": { + "post-autoload-dump": [ + "@php vendor/bin/testbench package:discover --ansi" + ] } } diff --git a/phpunit.xml b/phpunit.xml index 79fa0bf8..3d4d93f9 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -25,6 +25,7 @@ > + diff --git a/src/Core/config/cashier.php b/src/Core/config/cashbox.php similarity index 90% rename from src/Core/config/cashier.php rename to src/Core/config/cashbox.php index 325ea479..151af2cc 100644 --- a/src/Core/config/cashier.php +++ b/src/Core/config/cashbox.php @@ -21,17 +21,17 @@ return [ /* |-------------------------------------------------------------------------- - | Cashier Environment + | CASHBOX Environment |-------------------------------------------------------------------------- | - | This value determines the "environment" your cashier instance is + | This value determines the "environment" your CASHBOX instance is | currently running in. This may determine how you prefer to configure | various services the application utilizes. Set this in your ".env" | file. | */ - 'env' => env('CASHIER_ENV', env('APP_ENV', 'production')), + 'env' => env('CASHBOX_ENV', env('APP_ENV', 'production')), /* |-------------------------------------------------------------------------- @@ -59,7 +59,7 @@ | Payment Model Attributes |-------------------------------------------------------------------------- | - | Correspondence of Cashier attributes to Payment model. + | Correspondence of CASHBOX attributes to Payment model. | | type of field => column name from payment model | @@ -108,10 +108,10 @@ /* |-------------------------------------------------------------------------- - | Cashier Details + | CASHBOX Details |-------------------------------------------------------------------------- | - | This parameter contains settings for the cashier table. + | This parameter contains settings for the CASHBOX table. | */ @@ -122,7 +122,7 @@ |-------------------------------------------------------------------------- | | This value defines the name of the connection for accessing the - | database with the cashier table. + | database with the CASHBOX table. | */ @@ -130,14 +130,14 @@ /* |-------------------------------------------------------------------------- - | Cashier Details table settings + | CASHBOX Details table settings |-------------------------------------------------------------------------- | - | Table name for the Cashier Details. + | Table name for the CASHBOX Details. | */ - 'table' => 'cashier_details', + 'table' => 'CASHBOX_details', ], /* @@ -153,8 +153,8 @@ */ 'logs' => [ - 'info' => env('CASHIER_LOGS_CHANNEL_INFO'), - 'error' => env('CASHIER_LOGS_CHANNEL_ERROR'), + 'info' => env('CASHBOX_LOGS_CHANNEL_INFO'), + 'error' => env('CASHBOX_LOGS_CHANNEL_ERROR'), ], /* @@ -234,7 +234,7 @@ | */ - 'start' => env('CASHIER_QUEUE'), + 'start' => env('CASHBOX_QUEUE'), /* |-------------------------------------------------------------------------- @@ -247,7 +247,7 @@ | */ - 'verify' => env('CASHIER_QUEUE'), + 'verify' => env('CASHBOX_QUEUE'), /* |-------------------------------------------------------------------------- @@ -260,7 +260,7 @@ | */ - 'refund' => env('CASHIER_QUEUE'), + 'refund' => env('CASHBOX_QUEUE'), ], ], @@ -321,7 +321,7 @@ | */ - 'enabled' => (bool) env('CASHIER_AUTO_REFUND_ENABLED', false), + 'enabled' => (bool) env('CASHBOX_AUTO_REFUND_ENABLED', false), /* |-------------------------------------------------------------------------- @@ -335,7 +335,7 @@ | */ - 'delay' => env('CASHIER_AUTO_REFUND_DELAY', 600), + 'delay' => env('CASHBOX_AUTO_REFUND_DELAY', 600), ], /* @@ -366,14 +366,14 @@ // 'details' => \App\Payments\BankName::class, // // 'credentials' => [ - // 'client_id' => env('CASHIER_BANK_CLIENT_ID'), - // 'client_secret' => env('CASHIER_BANK_CLIENT_SECRET'), + // 'client_id' => env('CASHBOX_BANK_CLIENT_ID'), + // 'client_secret' => env('CASHBOX_BANK_CLIENT_SECRET'), // ], // // 'queue' => [ - // 'start' => env('CASHIER_QUEUE'), - // 'verify' => env('CASHIER_QUEUE'), - // 'refund' => env('CASHIER_QUEUE'), + // 'start' => env('CASHBOX_QUEUE'), + // 'verify' => env('CASHBOX_QUEUE'), + // 'refund' => env('CASHBOX_QUEUE'), // ], // ], ], diff --git a/src/Core/src/Exceptions/BaseException.php b/src/Core/src/Exceptions/BaseException.php index daed3e26..82d95554 100644 --- a/src/Core/src/Exceptions/BaseException.php +++ b/src/Core/src/Exceptions/BaseException.php @@ -30,7 +30,7 @@ public function __construct(object|string|null $haystack = null, ?string $needle parent::__construct($this->reason($haystack, $needle), $this->statusCode); } - protected function reason(object|string|null $haystack, string $needle): string + protected function reason(object|string|null $haystack, ?string $needle): string { if ($haystack = $this->haystack($haystack)) { return sprintf($this->reason, $haystack, $needle); diff --git a/src/Core/src/Exceptions/Internal/ConfigCannotBeEmptyException.php b/src/Core/src/Exceptions/Internal/ConfigCannotBeEmptyException.php new file mode 100644 index 00000000..f1a2ae51 --- /dev/null +++ b/src/Core/src/Exceptions/Internal/ConfigCannotBeEmptyException.php @@ -0,0 +1,12 @@ +publishes([ - __DIR__ . '/../../config/cashier.php' => $this->app->configPath('cashier.php'), + __DIR__ . '/../../config/cashbox.php' => $this->app->configPath('cashbox.php'), ], 'config'); $this->publishes([ @@ -68,6 +68,6 @@ protected function bootCommands(): void protected function registerConfig(): void { - $this->mergeConfigFrom(__DIR__ . '/../../config/cashier.php', 'cashier'); + $this->mergeConfigFrom(__DIR__ . '/../../config/cashbox.php', 'cashbox'); } } diff --git a/tests/.gitkeep b/tests/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/Fixtures/Details/CashPaymentDetails.php b/tests/Fixtures/Details/CashPaymentDetails.php new file mode 100644 index 00000000..2b8d3f2e --- /dev/null +++ b/tests/Fixtures/Details/CashPaymentDetails.php @@ -0,0 +1,9 @@ + TypeEnum::class, + 'status' => StatusEnum::class, + ]; +} diff --git a/tests/Fixtures/database/2023_07_14_022222_create_payments_model.php b/tests/Fixtures/database/2023_07_14_022222_create_payments_model.php new file mode 100644 index 00000000..1c60b2ca --- /dev/null +++ b/tests/Fixtures/database/2023_07_14_022222_create_payments_model.php @@ -0,0 +1,24 @@ +id(); + + $table->double('price', 10, 2); + + $table->string('type'); + $table->smallInteger('status')->default(StatusEnum::new->value); + + $table->timestamps(); + }); + } +}; diff --git a/tests/Pest.php b/tests/Pest.php new file mode 100644 index 00000000..b8403adb --- /dev/null +++ b/tests/Pest.php @@ -0,0 +1,66 @@ +in('Unit'); + +/* +|-------------------------------------------------------------------------- +| Expectations +|-------------------------------------------------------------------------- +| +| When you're writing tests, you often need to check that values meet certain conditions. The +| "expect()" function gives you access to a set of "expectations" methods that you can use +| to assert different things. Of course, you may extend the Expectation API at any time. +| +*/ + +expect()->extend('toBeOne', function () { + return $this->toBe(1); +}); + +function tableToBeNotEmpty(string $table): void +{ + expect( + DB::table($table)->exists() + )->toBeTrue(); +} + +function tableToBeEmpty(string $table): void +{ + expect( + DB::table($table)->doesntExist() + )->toBeTrue(); +} + +/* +|-------------------------------------------------------------------------- +| Functions +|-------------------------------------------------------------------------- +| +| While Pest is very powerful out-of-the-box, you may have some testing code specific to your +| project that you don't want to repeat in every file. Here you can also expose helpers as +| global functions to help you to reduce the number of lines of code in your test files. +| +*/ + +function createPayment(TypeEnum $type, ?float $price = null): PaymentModel +{ + $price ??= random_int(1, 50000); + + return PaymentModel::create(compact('type', 'price')); +} diff --git a/tests/TestCase.php b/tests/TestCase.php new file mode 100644 index 00000000..b11609d9 --- /dev/null +++ b/tests/TestCase.php @@ -0,0 +1,51 @@ +set('cashbox.payment.model', PaymentModel::class); + + $app['config']->set('cashbox.payment.attribute.' . AttributeEnum::type(), 'type'); + $app['config']->set('cashbox.payment.attribute.' . AttributeEnum::status(), 'status'); + + $app['config']->set('cashbox.payment.status.' . StatusEnum::new(), TestStatusEnum::new); + $app['config']->set('cashbox.payment.status.' . StatusEnum::success(), TestStatusEnum::success); + $app['config']->set('cashbox.payment.status.' . StatusEnum::waitRefund(), TestStatusEnum::waitRefund); + $app['config']->set('cashbox.payment.status.' . StatusEnum::refund(), TestStatusEnum::refund); + $app['config']->set('cashbox.payment.status.' . StatusEnum::failed(), TestStatusEnum::failed); + + $app['config']->set('cashbox.payment.drivers.' . TypeEnum::cash(), TypeEnum::cash()); + + $app['config']->set('cashbox.drivers.' . TypeEnum::cash(), [ + 'driver' => Driver::class, + 'details' => CashPaymentDetails::class, + ]); + } +} diff --git a/tests/Unit/Core/EmptyConfigTest.php b/tests/Unit/Core/EmptyConfigTest.php new file mode 100644 index 00000000..a1d9c03c --- /dev/null +++ b/tests/Unit/Core/EmptyConfigTest.php @@ -0,0 +1,12 @@ + []]); +})->throws( + ConfigCannotBeEmptyException::class, + 'Error reading configuration. Check the existence of the "config/cashbox.php" file.' +); diff --git a/tests/Unit/Drivers/Cash/CreateTest.php b/tests/Unit/Drivers/Cash/CreateTest.php new file mode 100644 index 00000000..5a046ff5 --- /dev/null +++ b/tests/Unit/Drivers/Cash/CreateTest.php @@ -0,0 +1,11 @@ +toArray()); +}); diff --git a/tests/Unit/Drivers/Cash/FailedTest.php b/tests/Unit/Drivers/Cash/FailedTest.php new file mode 100644 index 00000000..174d7fd7 --- /dev/null +++ b/tests/Unit/Drivers/Cash/FailedTest.php @@ -0,0 +1,3 @@ + Date: Fri, 14 Jul 2023 02:58:22 +0300 Subject: [PATCH 032/164] Created TestServiceProvider.php --- tests/Fixtures/Providers/TestServiceProvider.php | 15 +++++++++++++++ .../2023_07_14_022222_create_payments_model.php | 0 tests/TestCase.php | 2 ++ 3 files changed, 17 insertions(+) create mode 100644 tests/Fixtures/Providers/TestServiceProvider.php rename tests/Fixtures/database/{ => migrations}/2023_07_14_022222_create_payments_model.php (100%) diff --git a/tests/Fixtures/Providers/TestServiceProvider.php b/tests/Fixtures/Providers/TestServiceProvider.php new file mode 100644 index 00000000..5b4a6d91 --- /dev/null +++ b/tests/Fixtures/Providers/TestServiceProvider.php @@ -0,0 +1,15 @@ +loadMigrationsFrom(__DIR__ . '/../database/migrations'); + } +} diff --git a/tests/Fixtures/database/2023_07_14_022222_create_payments_model.php b/tests/Fixtures/database/migrations/2023_07_14_022222_create_payments_model.php similarity index 100% rename from tests/Fixtures/database/2023_07_14_022222_create_payments_model.php rename to tests/Fixtures/database/migrations/2023_07_14_022222_create_payments_model.php diff --git a/tests/TestCase.php b/tests/TestCase.php index b11609d9..6e53385f 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -14,6 +14,7 @@ use Tests\Fixtures\Enums\StatusEnum as TestStatusEnum; use Tests\Fixtures\Enums\TypeEnum; use Tests\Fixtures\Models\PaymentModel; +use Tests\Fixtures\Providers\TestServiceProvider; abstract class TestCase extends BaseTestCase { @@ -22,6 +23,7 @@ abstract class TestCase extends BaseTestCase protected function getPackageProviders($app): array { return [ + TestServiceProvider::class, ServiceProvider::class, ObserverServiceProvider::class, RateLimiterServiceProvider::class, From c60f15e44126d8d2bb573bb00ad65da9f46d3cfc Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 11:25:56 +0300 Subject: [PATCH 033/164] Added link to Telegram folder of news channels --- .templates/README.md | 2 ++ README.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.templates/README.md b/.templates/README.md index 621bb8b7..d436a664 100644 --- a/.templates/README.md +++ b/.templates/README.md @@ -34,6 +34,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/README.md b/README.md index 119cc169..b388d309 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! From 6aa1f86a2d5ccc5d37aeb14fe65c2c919f5ceeae Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Fri, 14 Jul 2023 08:26:20 +0000 Subject: [PATCH 034/164] Updated readme files --- src/Cash/README.md | 2 ++ src/Core/README.md | 2 ++ src/SberAuth/README.md | 2 ++ src/SberOnline/README.md | 2 ++ src/SberQrCode/README.md | 2 ++ src/TemplateDriver/README.md | 2 ++ src/TemplateDriverAuth/README.md | 2 ++ src/TinkoffAuth/README.md | 2 ++ src/TinkoffCredit/README.md | 2 ++ src/TinkoffOnline/README.md | 2 ++ src/TinkoffQrCode/README.md | 2 ++ 11 files changed, 22 insertions(+) diff --git a/src/Cash/README.md b/src/Cash/README.md index c8b9f9f9..59998b9e 100644 --- a/src/Cash/README.md +++ b/src/Cash/README.md @@ -34,6 +34,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/Core/README.md b/src/Core/README.md index ec3a1a37..d9cf2b75 100644 --- a/src/Core/README.md +++ b/src/Core/README.md @@ -34,6 +34,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/SberAuth/README.md b/src/SberAuth/README.md index 3c7c0df7..2424161a 100644 --- a/src/SberAuth/README.md +++ b/src/SberAuth/README.md @@ -34,6 +34,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/SberOnline/README.md b/src/SberOnline/README.md index f4446822..4dc9980f 100644 --- a/src/SberOnline/README.md +++ b/src/SberOnline/README.md @@ -34,6 +34,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/SberQrCode/README.md b/src/SberQrCode/README.md index 5a77e55f..ffd4f153 100644 --- a/src/SberQrCode/README.md +++ b/src/SberQrCode/README.md @@ -34,6 +34,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/TemplateDriver/README.md b/src/TemplateDriver/README.md index 417ada02..d3b5c76c 100644 --- a/src/TemplateDriver/README.md +++ b/src/TemplateDriver/README.md @@ -34,6 +34,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/TemplateDriverAuth/README.md b/src/TemplateDriverAuth/README.md index e5c19e8f..2a933867 100644 --- a/src/TemplateDriverAuth/README.md +++ b/src/TemplateDriverAuth/README.md @@ -34,6 +34,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/TinkoffAuth/README.md b/src/TinkoffAuth/README.md index 963bc8a2..7210c797 100644 --- a/src/TinkoffAuth/README.md +++ b/src/TinkoffAuth/README.md @@ -34,6 +34,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/TinkoffCredit/README.md b/src/TinkoffCredit/README.md index 409b26a0..533fff74 100644 --- a/src/TinkoffCredit/README.md +++ b/src/TinkoffCredit/README.md @@ -34,6 +34,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/TinkoffOnline/README.md b/src/TinkoffOnline/README.md index 0f6137e2..36468d18 100644 --- a/src/TinkoffOnline/README.md +++ b/src/TinkoffOnline/README.md @@ -34,6 +34,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! diff --git a/src/TinkoffQrCode/README.md b/src/TinkoffQrCode/README.md index 094d6350..7e4df0a6 100644 --- a/src/TinkoffQrCode/README.md +++ b/src/TinkoffQrCode/README.md @@ -34,6 +34,8 @@ We also have Telegram channels where we post announcements: - [Русский](https://t.me/dragon_code_news) - [Український](https://t.me/dragon_code_news_ua) +You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). + ## Contributing Thank you for considering contributing to the `Cashbox`! From 218b0163478cd46bc3c512ed00769da79d1b2909 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 12:12:14 +0300 Subject: [PATCH 035/164] Added runner to quickly run tests from phpStorm --- .gitattributes | 1 + .run/parallel.run.xml | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 .run/parallel.run.xml diff --git a/.gitattributes b/.gitattributes index 4f0354d1..52c63e07 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,7 @@ .github/ export-ignore .idea/ export-ignore .requests/ export-ignore +.run/ export-ignore tests/ export-ignore diff --git a/.run/parallel.run.xml b/.run/parallel.run.xml new file mode 100644 index 00000000..a6efef1d --- /dev/null +++ b/.run/parallel.run.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file From d5caa8e3f9a39f0e961109ea997dbb701b727d73 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 12:12:34 +0300 Subject: [PATCH 036/164] Updated phpunit.xml file --- phpunit.xml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 3d4d93f9..d399a5ea 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -11,17 +11,16 @@ ~ ~ @see https://github.com/cashbox-laravel/foundation --> - @@ -31,9 +30,6 @@ - - ./src - @@ -45,4 +41,9 @@ ./tests + + + ./src + + From 6590e2b605342a64386d5a4aa83ee7d7f7d98837 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 12:13:20 +0300 Subject: [PATCH 037/164] Updated startup test file in GitHub Actions --- .github/workflows/phpunit.yml | 31 ------------------------------- .github/workflows/tests.yml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 31 deletions(-) delete mode 100644 .github/workflows/phpunit.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml deleted file mode 100644 index d5fbef28..00000000 --- a/.github/workflows/phpunit.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Tests - -on: [ push ] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - fail-fast: true - matrix: - php: [ "8.1", "8.2" ] - - name: PHP ${{ matrix.php }} - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, bcmath - coverage: none - - - name: Install dependencies - run: composer install - - - name: Execute tests - run: sudo vendor/bin/phpunit diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..a86eac05 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,31 @@ +name: Tests + +on: [ push, pull_request ] + +jobs: + ci: + runs-on: ubuntu-latest + + strategy: + fail-fast: true + matrix: + php: [ "8.1", "8.2" ] + + name: PHP ${{ matrix.php }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, bcmath + coverage: xdebug + + - name: Install dependencies + run: composer install --no-interaction --prefer-dist --optimize-autoloader + + - name: Execute tests + run: sudo vendor/bin/pest --parallel --compact From 1c6046eb21f4a3cad8fdd5c1368dd03eef85070c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 12:15:01 +0300 Subject: [PATCH 038/164] Removed the limit on the number of processes in parallel testing --- .run/parallel.run.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.run/parallel.run.xml b/.run/parallel.run.xml index a6efef1d..020dd320 100644 --- a/.run/parallel.run.xml +++ b/.run/parallel.run.xml @@ -1,10 +1,10 @@ From ad787605d54c5c272a5cf50c1863a4b016ea4818 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 19:58:07 +0300 Subject: [PATCH 039/164] Added a preset for testing the application on different databases --- .github/workflows/tests.yml | 175 ++++++++++++++++++++++++++++++++++-- phpunit.xml | 6 +- 2 files changed, 171 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a86eac05..90061f83 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,16 +3,74 @@ name: Tests on: [ push, pull_request ] jobs: - ci: - runs-on: ubuntu-latest + mysql: + runs-on: ${{ matrix.os }} + + name: OS ${{ matrix.os }}, MySQL ${{ matrix.db }}, PHP ${{ matrix.php }} strategy: fail-fast: true matrix: + os: [ "ubuntu-latest", "macos-latest", "windows-latest" ] php: [ "8.1", "8.2" ] + db: [ "8" ] - name: PHP ${{ matrix.php }} - + services: + mysql: + image: mysql:${{ matrix.db }} + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: forge + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, json + coverage: none + + - name: Install dependencies + uses: nick-fields/retry@v2 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader + + - name: Execute tests + run: vendor/bin/pest --parallel --compact + env: + DB_CONNECTION: mysql + DB_USERNAME: root + + mariadb: + runs-on: ${{ matrix.os }} + + name: OS ${{ matrix.os }}, MariaDB ${{ matrix.db }}, PHP ${{ matrix.php }} + + strategy: + fail-fast: true + matrix: + os: [ "ubuntu-latest", "macos-latest", "windows-latest" ] + php: [ "8.1", "8.2" ] + db: [ "10" ] + + services: + mysql: + image: mariadb:${{ matrix.db }} + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: forge + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + steps: - name: Checkout code uses: actions/checkout@v3 @@ -21,11 +79,112 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, bcmath - coverage: xdebug + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, json + coverage: none - name: Install dependencies - run: composer install --no-interaction --prefer-dist --optimize-autoloader + uses: nick-fields/retry@v2 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader + + - name: Execute tests + run: vendor/bin/pest --parallel --compact + env: + DB_CONNECTION: mysql + DB_USERNAME: root + + pgsql: + runs-on: ${{ matrix.os }} + + name: OS ${{ matrix.os }}, PostgreSQL ${{ matrix.db }}, PHP ${{ matrix.php }} + + strategy: + fail-fast: true + matrix: + os: [ "ubuntu-latest", "macos-latest", "windows-latest" ] + php: [ "8.1", "8.2" ] + db: [ "14", "15" ] + + services: + postgresql: + image: postgres:${{ matrix.db }} + env: + POSTGRES_DB: forge + POSTGRES_USER: forge + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3 + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, json + coverage: none + + - name: Install dependencies + uses: nick-fields/retry@v2 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader + + - name: Execute tests + run: vendor/bin/pest --parallel --compact + env: + DB_CONNECTION: pgsql + DB_PASSWORD: password + + mssql: + runs-on: ${{ matrix.os }} + + name: OS ${{ matrix.os }}, SQL Server ${{ matrix.db }}, PHP ${{ matrix.php }} + + strategy: + fail-fast: true + matrix: + os: [ "ubuntu-latest", "macos-latest", "windows-latest" ] + php: [ "8.1", "8.2" ] + db: [ "2019-latest", "2022-latest" ] + + services: + sqlsrv: + image: mcr.microsoft.com/mssql/server:${{ matrix.db }} + env: + ACCEPT_EULA: Y + SA_PASSWORD: Forge123 + ports: + - 1433:1433 + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_mysql, json + coverage: none + + - name: Install dependencies + uses: nick-fields/retry@v2 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: sudo vendor/bin/pest --parallel --compact + run: vendor/bin/pest --parallel --compact + env: + DB_CONNECTION: sqlsrv + DB_DATABASE: master + DB_USERNAME: SA + DB_PASSWORD: Forge123 diff --git a/phpunit.xml b/phpunit.xml index d399a5ea..a5622d2a 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -23,10 +23,12 @@ stopOnFailure="false" > + + + - - + From bce1ca6543458b42ba9cf3f2b37ffecac341febb Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 19:59:25 +0300 Subject: [PATCH 040/164] Removed `OS` prefix from tests --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 90061f83..7b4a7279 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ jobs: mysql: runs-on: ${{ matrix.os }} - name: OS ${{ matrix.os }}, MySQL ${{ matrix.db }}, PHP ${{ matrix.php }} + name: ${{ matrix.os }}, MySQL ${{ matrix.db }}, PHP ${{ matrix.php }} strategy: fail-fast: true @@ -52,7 +52,7 @@ jobs: mariadb: runs-on: ${{ matrix.os }} - name: OS ${{ matrix.os }}, MariaDB ${{ matrix.db }}, PHP ${{ matrix.php }} + name: ${{ matrix.os }}, MariaDB ${{ matrix.db }}, PHP ${{ matrix.php }} strategy: fail-fast: true @@ -98,7 +98,7 @@ jobs: pgsql: runs-on: ${{ matrix.os }} - name: OS ${{ matrix.os }}, PostgreSQL ${{ matrix.db }}, PHP ${{ matrix.php }} + name: ${{ matrix.os }}, PostgreSQL ${{ matrix.db }}, PHP ${{ matrix.php }} strategy: fail-fast: true @@ -145,7 +145,7 @@ jobs: mssql: runs-on: ${{ matrix.os }} - name: OS ${{ matrix.os }}, SQL Server ${{ matrix.db }}, PHP ${{ matrix.php }} + name: ${{ matrix.os }}, SQL Server ${{ matrix.db }}, PHP ${{ matrix.php }} strategy: fail-fast: true From 193f33cf225a1f8e2349a427859fa05555296386 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 20:02:31 +0300 Subject: [PATCH 041/164] Removed testing on macos --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7b4a7279..59466b94 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: true matrix: - os: [ "ubuntu-latest", "macos-latest", "windows-latest" ] + os: [ "ubuntu-latest" ] php: [ "8.1", "8.2" ] db: [ "8" ] @@ -57,7 +57,7 @@ jobs: strategy: fail-fast: true matrix: - os: [ "ubuntu-latest", "macos-latest", "windows-latest" ] + os: [ "ubuntu-latest" ] php: [ "8.1", "8.2" ] db: [ "10" ] @@ -103,7 +103,7 @@ jobs: strategy: fail-fast: true matrix: - os: [ "ubuntu-latest", "macos-latest", "windows-latest" ] + os: [ "ubuntu-latest" ] php: [ "8.1", "8.2" ] db: [ "14", "15" ] @@ -150,7 +150,7 @@ jobs: strategy: fail-fast: true matrix: - os: [ "ubuntu-latest", "macos-latest", "windows-latest" ] + os: [ "ubuntu-latest", "windows-latest" ] php: [ "8.1", "8.2" ] db: [ "2019-latest", "2022-latest" ] From 0f6ea688414e670b1941ad7356ffc63e4dc9d9ab Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 20:05:46 +0300 Subject: [PATCH 042/164] Bump `psr/http-message` --- composer.json | 2 +- src/Cash/composer.json | 2 +- src/SberOnline/composer.json | 2 +- src/SberQrCode/composer.json | 2 +- src/TemplateDriver/composer.json | 2 +- src/TinkoffCredit/composer.json | 2 +- src/TinkoffOnline/composer.json | 2 +- src/TinkoffQrCode/composer.json | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 41f17a91..593df452 100644 --- a/composer.json +++ b/composer.json @@ -58,7 +58,7 @@ "illuminate/queue": "^10.15", "illuminate/support": "^10.15", "nesbot/carbon": "^2.68.1", - "psr/http-message": "^1.1", + "psr/http-message": "^2.0", "psr/log": "^3.0", "spatie/laravel-data": "^3.7", "symfony/console": "^6.3" diff --git a/src/Cash/composer.json b/src/Cash/composer.json index 57eef1e3..ad32329a 100644 --- a/src/Cash/composer.json +++ b/src/Cash/composer.json @@ -41,7 +41,7 @@ "require": { "php": "^8.1", "cashbox/core": "^2.5 || ^3.0", - "psr/http-message": "^1.1" + "psr/http-message": "^2.0" }, "minimum-stability": "stable", "prefer-stable": true, diff --git a/src/SberOnline/composer.json b/src/SberOnline/composer.json index cd8b9dad..f25bf331 100644 --- a/src/SberOnline/composer.json +++ b/src/SberOnline/composer.json @@ -42,7 +42,7 @@ "php": "^8.1", "cashbox/bankname-auth": "^3.0", "cashbox/core": "^3.0", - "psr/http-message": "^1.1" + "psr/http-message": "^2.0" }, "minimum-stability": "stable", "prefer-stable": true, diff --git a/src/SberQrCode/composer.json b/src/SberQrCode/composer.json index f5b54921..99268262 100644 --- a/src/SberQrCode/composer.json +++ b/src/SberQrCode/composer.json @@ -45,7 +45,7 @@ "php": "^8.1", "cashbox/core": "^3.0", "cashbox/sber-auth": "^3.0", - "psr/http-message": "^1.1" + "psr/http-message": "^2.0" }, "minimum-stability": "stable", "prefer-stable": true, diff --git a/src/TemplateDriver/composer.json b/src/TemplateDriver/composer.json index d450206b..7a3fd257 100644 --- a/src/TemplateDriver/composer.json +++ b/src/TemplateDriver/composer.json @@ -42,7 +42,7 @@ "php": "^8.1", "cashbox/bankname-auth": "^3.0", "cashbox/core": "^3.0", - "psr/http-message": "^1.1" + "psr/http-message": "^2.0" }, "require-dev": { "ext-json": "*", diff --git a/src/TinkoffCredit/composer.json b/src/TinkoffCredit/composer.json index 1d887c88..e945bcfb 100644 --- a/src/TinkoffCredit/composer.json +++ b/src/TinkoffCredit/composer.json @@ -42,7 +42,7 @@ "require": { "php": "^8.1", "cashbox/core": "^3.4", - "psr/http-message": "^1.1" + "psr/http-message": "^2.0" }, "minimum-stability": "stable", "prefer-stable": true, diff --git a/src/TinkoffOnline/composer.json b/src/TinkoffOnline/composer.json index 3e85a226..7beae123 100644 --- a/src/TinkoffOnline/composer.json +++ b/src/TinkoffOnline/composer.json @@ -47,7 +47,7 @@ "php": "^8.1", "cashbox/core": "^3.0", "cashbox/tinkoff-auth": "^3.0", - "psr/http-message": "^1.1" + "psr/http-message": "^2.0" }, "minimum-stability": "stable", "prefer-stable": true, diff --git a/src/TinkoffQrCode/composer.json b/src/TinkoffQrCode/composer.json index f3013d3d..1b1b67b6 100644 --- a/src/TinkoffQrCode/composer.json +++ b/src/TinkoffQrCode/composer.json @@ -46,7 +46,7 @@ "php": "^8.1", "cashbox/core": "^3.0", "cashbox/tinkoff-auth": "^3.0", - "psr/http-message": "^1.1" + "psr/http-message": "^2.0" }, "minimum-stability": "stable", "prefer-stable": true, From 8be8f5a4583c3c9b5af602ff54f6ebf1ef87236a Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 23:04:32 +0300 Subject: [PATCH 043/164] Renaming `cashier` to `cashbox` --- src/Cash/tests/Jobs/JobsTest.php | 8 ++-- src/Cash/tests/Observers/ObserverTest.php | 8 ++-- src/Core/composer.json | 1 + src/Core/config/cashbox.php | 18 ++++---- ...ename_cashier_details_table_to_cashbox.php | 45 +++++++++++++++++++ src/Core/src/Billable.php | 6 +-- src/Core/src/Casts/InfoCast.php | 2 +- src/Core/src/Jobs/BaseJob.php | 8 ++-- src/Core/src/Services/Authorize.php | 2 +- src/Core/src/Services/Statuses.php | 20 ++++----- src/SberOnline/tests/Jobs/JobsTest.php | 22 ++++----- .../tests/Observers/ObserverTest.php | 16 +++---- src/SberQrCode/tests/Jobs/JobsTest.php | 22 ++++----- .../tests/Observers/ObserverTest.php | 22 ++++----- src/TemplateDriver/tests/Jobs/JobsTest.php | 22 ++++----- .../tests/Observers/ObserverTest.php | 16 +++---- src/TinkoffCredit/tests/Jobs/JobsTest.php | 16 +++---- .../tests/Observers/ObserverTest.php | 16 +++---- .../tests/Fixtures/Resources/Model.php | 2 +- src/TinkoffOnline/tests/Jobs/JobsTest.php | 22 ++++----- .../tests/Observers/ObserverTest.php | 16 +++---- .../tests/Fixtures/Resources/Model.php | 2 +- src/TinkoffQrCode/tests/Jobs/JobsTest.php | 22 ++++----- .../tests/Observers/ObserverTest.php | 16 +++---- 24 files changed, 198 insertions(+), 152 deletions(-) create mode 100644 src/Core/database/migrations/private/2023_07_14_201238_rename_cashier_details_table_to_cashbox.php diff --git a/src/Cash/tests/Jobs/JobsTest.php b/src/Cash/tests/Jobs/JobsTest.php index 1818c13b..6269a51f 100644 --- a/src/Cash/tests/Jobs/JobsTest.php +++ b/src/Cash/tests/Jobs/JobsTest.php @@ -59,9 +59,9 @@ public function testCheck() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); - $this->assertSame('PAID', $payment->cashier->details->getStatus()); + $this->assertSame('PAID', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), @@ -89,9 +89,9 @@ public function testRefund() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); - $this->assertSame('REFUNDED', $payment->cashier->details->getStatus()); + $this->assertSame('REFUNDED', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::REFUND), diff --git a/src/Cash/tests/Observers/ObserverTest.php b/src/Cash/tests/Observers/ObserverTest.php index 761500a2..3ea1124e 100644 --- a/src/Cash/tests/Observers/ObserverTest.php +++ b/src/Cash/tests/Observers/ObserverTest.php @@ -49,9 +49,9 @@ public function testCreate(): Model $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); - $this->assertSame('PAID', $payment->cashier->details->getStatus()); + $this->assertSame('PAID', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), @@ -74,9 +74,9 @@ public function testUpdate() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); - $this->assertSame('PAID', $payment->cashier->details->getStatus()); + $this->assertSame('PAID', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), diff --git a/src/Core/composer.json b/src/Core/composer.json index bf315c2b..ef0bbe92 100644 --- a/src/Core/composer.json +++ b/src/Core/composer.json @@ -7,6 +7,7 @@ "bank", "billing", "cashier", + "cashbox", "payments" ], "authors": [ diff --git a/src/Core/config/cashbox.php b/src/Core/config/cashbox.php index 151af2cc..585244c9 100644 --- a/src/Core/config/cashbox.php +++ b/src/Core/config/cashbox.php @@ -21,10 +21,10 @@ return [ /* |-------------------------------------------------------------------------- - | CASHBOX Environment + | Cashbox Environment |-------------------------------------------------------------------------- | - | This value determines the "environment" your CASHBOX instance is + | This value determines the "environment" your Cashbox instance is | currently running in. This may determine how you prefer to configure | various services the application utilizes. Set this in your ".env" | file. @@ -59,7 +59,7 @@ | Payment Model Attributes |-------------------------------------------------------------------------- | - | Correspondence of CASHBOX attributes to Payment model. + | Correspondence of Cashbox attributes to Payment model. | | type of field => column name from payment model | @@ -108,10 +108,10 @@ /* |-------------------------------------------------------------------------- - | CASHBOX Details + | Cashbox Details |-------------------------------------------------------------------------- | - | This parameter contains settings for the CASHBOX table. + | This parameter contains settings for the Cashbox table. | */ @@ -122,7 +122,7 @@ |-------------------------------------------------------------------------- | | This value defines the name of the connection for accessing the - | database with the CASHBOX table. + | database with the Cashbox table. | */ @@ -130,14 +130,14 @@ /* |-------------------------------------------------------------------------- - | CASHBOX Details table settings + | Cashbox Details table settings |-------------------------------------------------------------------------- | - | Table name for the CASHBOX Details. + | Table name for the Cashbox Details. | */ - 'table' => 'CASHBOX_details', + 'table' => 'cashbox_details', ], /* diff --git a/src/Core/database/migrations/private/2023_07_14_201238_rename_cashier_details_table_to_cashbox.php b/src/Core/database/migrations/private/2023_07_14_201238_rename_cashier_details_table_to_cashbox.php new file mode 100644 index 00000000..cea7a570 --- /dev/null +++ b/src/Core/database/migrations/private/2023_07_14_201238_rename_cashier_details_table_to_cashbox.php @@ -0,0 +1,45 @@ +doesntSame() && $this->exists()) { + $this->rename(); + } + } + + protected function rename(): void + { + $this->connection()->rename($this->detectName(), $this->table()); + } + + protected function exists(): bool + { + return $this->connection()->hasTable($this->detectName()); + } + + protected function doesntSame(): bool + { + return $this->detectName() !== $this->table(); + } + + protected function detectName(): string + { + $old = config('cashier.details.table'); + $new = config('cashbox.details.table'); + + if ($old) { + return $old; + } + + if ($new && $new !== $this->table()) { + return $new; + } + + return 'cashier_details'; + } +}; diff --git a/src/Core/src/Billable.php b/src/Core/src/Billable.php index 2ecc4167..7445f822 100644 --- a/src/Core/src/Billable.php +++ b/src/Core/src/Billable.php @@ -23,16 +23,16 @@ use Illuminate\Database\Eloquent\Relations\Relation; /** - * @property Details $cashier + * @property Details $cashbox */ trait Billable { - public function cashier(): Relation + public function cashbox(): Relation { return $this->hasOne(Details::class, 'payment_id', $this->getKeyName()); } - public function cashierDriver(): Driver + public function cashboxDriver(): Driver { return DriverManager::find($this); } diff --git a/src/Core/src/Casts/InfoCast.php b/src/Core/src/Casts/InfoCast.php index f2dd875f..0a7f2192 100644 --- a/src/Core/src/Casts/InfoCast.php +++ b/src/Core/src/Casts/InfoCast.php @@ -28,7 +28,7 @@ class InfoCast implements CastsAttributes public function get(Model $model, string $key, mixed $value, array $attributes): ResponseInfo { - $instance = $model->parent->cashierDriver()->info; + $instance = $model->parent->cashboxDriver()->info; return call_user_func([$instance, 'from'], json_decode($value, true)); } diff --git a/src/Core/src/Jobs/BaseJob.php b/src/Core/src/Jobs/BaseJob.php index 8fbbcf90..9ebb285e 100644 --- a/src/Core/src/Jobs/BaseJob.php +++ b/src/Core/src/Jobs/BaseJob.php @@ -72,9 +72,9 @@ public function handle(): void 'info' => $response, ]; - $this->payment->cashier - ? $this->payment->cashier->update($data) - : $this->payment->cashier()->create($data); + $this->payment->cashbox + ? $this->payment->cashbox->update($data) + : $this->payment->cashbox()->create($data); } public function uniqueId(): int|string @@ -89,7 +89,7 @@ public function middleware(): array protected function driver(): Driver { - return $this->payment->cashierDriver(); + return $this->payment->cashboxDriver(); } protected function getRateLimiter(): string diff --git a/src/Core/src/Services/Authorize.php b/src/Core/src/Services/Authorize.php index 56270355..b01938ec 100644 --- a/src/Core/src/Services/Authorize.php +++ b/src/Core/src/Services/Authorize.php @@ -65,7 +65,7 @@ protected static function acceptStatus(Model $payment, array|int|string $statuse protected static function hasDetails(Model $payment): bool { - return ! empty($payment->cashier); + return ! empty($payment->cashbox); } protected static function doesntHaveDetails(Model $payment): bool diff --git a/src/Core/src/Services/Statuses.php b/src/Core/src/Services/Statuses.php index f77ffb54..4e50c1e7 100644 --- a/src/Core/src/Services/Statuses.php +++ b/src/Core/src/Services/Statuses.php @@ -49,37 +49,37 @@ public function isUnknown(?StatusEnum $status = null): bool static::FAILED, ]); - return ! $this->hasCashier($bank, $status) + return ! $this->hasCashbox($bank, $status) && ! $this->hasModel(StatusEnum::values(), $status); } public function isCreated(?StatusEnum $status = null): bool { - return $this->hasCashier(static::NEW, $status) + return $this->hasCashbox(static::NEW, $status) || $this->hasModel(static::NEW, $status); } public function isFailed(?StatusEnum $status = null): bool { - return $this->hasCashier(static::FAILED, $status) + return $this->hasCashbox(static::FAILED, $status) || $this->hasModel(static::FAILED, $status); } public function isRefunding(?StatusEnum $status = null): bool { - return $this->hasCashier(static::REFUNDING, $status) + return $this->hasCashbox(static::REFUNDING, $status) || $this->hasModel(static::REFUNDING, $status); } public function isRefunded(?StatusEnum $status = null): bool { - return $this->hasCashier(static::REFUNDED, $status) + return $this->hasCashbox(static::REFUNDED, $status) || $this->hasModel(static::REFUNDED, $status); } public function isSuccess(?StatusEnum $status = null): bool { - return $this->hasCashier(static::SUCCESS, $status) + return $this->hasCashbox(static::SUCCESS, $status) || $this->hasModel(static::SUCCESS, $status); } @@ -90,9 +90,9 @@ public function inProgress(?StatusEnum $status = null): bool && ! $this->isRefunded($status); } - protected function hasCashier(array|string $statuses, ?StatusEnum $status): bool + protected function hasCashbox(array|string $statuses, ?StatusEnum $status): bool { - $status ??= $this->cashierStatus(); + $status ??= $this->cashboxStatus(); return $this->has($status, $statuses); } @@ -115,9 +115,9 @@ protected function has(?StatusEnum $needle, array $haystack): bool return in_array($this->resolveStatus($needle), $this->resolveStatus($haystack), true); } - protected function cashierStatus(): ?StatusEnum + protected function cashboxStatus(): ?StatusEnum { - if ($status = $this->payment->cashier?->details?->getStatus()) { + if ($status = $this->payment->cashbox?->details?->getStatus()) { return StatusEnum::tryFrom($status); } diff --git a/src/SberOnline/tests/Jobs/JobsTest.php b/src/SberOnline/tests/Jobs/JobsTest.php index b3fa3c38..9c7e9786 100644 --- a/src/SberOnline/tests/Jobs/JobsTest.php +++ b/src/SberOnline/tests/Jobs/JobsTest.php @@ -44,12 +44,12 @@ public function testStart() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -72,12 +72,12 @@ public function testCheck() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -105,10 +105,10 @@ public function testRefund() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertSame('CANCELED', $payment->cashier->details->getStatus()); + $this->assertSame('CANCELED', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::REFUND), diff --git a/src/SberOnline/tests/Observers/ObserverTest.php b/src/SberOnline/tests/Observers/ObserverTest.php index e53da985..51478f1a 100644 --- a/src/SberOnline/tests/Observers/ObserverTest.php +++ b/src/SberOnline/tests/Observers/ObserverTest.php @@ -50,12 +50,12 @@ public function testCreate(): Model $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -78,12 +78,12 @@ public function testUpdate() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), diff --git a/src/SberQrCode/tests/Jobs/JobsTest.php b/src/SberQrCode/tests/Jobs/JobsTest.php index a05b7a66..db545dfb 100644 --- a/src/SberQrCode/tests/Jobs/JobsTest.php +++ b/src/SberQrCode/tests/Jobs/JobsTest.php @@ -42,12 +42,12 @@ public function testStart() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('CREATED', $payment->cashier->details->getStatus()); + $this->assertSame('CREATED', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -70,12 +70,12 @@ public function testCheck() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertNull($payment->cashier->details->getUrl()); + $this->assertNull($payment->cashbox->details->getUrl()); - $this->assertSame('PAID', $payment->cashier->details->getStatus()); + $this->assertSame('PAID', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), @@ -103,10 +103,10 @@ public function testRefund() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertSame('REVERSED', $payment->cashier->details->getStatus()); + $this->assertSame('REVERSED', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::REFUND), diff --git a/src/SberQrCode/tests/Observers/ObserverTest.php b/src/SberQrCode/tests/Observers/ObserverTest.php index d0c04145..b4b0012e 100644 --- a/src/SberQrCode/tests/Observers/ObserverTest.php +++ b/src/SberQrCode/tests/Observers/ObserverTest.php @@ -36,12 +36,12 @@ public function testCreate() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertNull($payment->cashier->details->getUrl()); + $this->assertNull($payment->cashbox->details->getUrl()); - $this->assertSame('PAID', $payment->cashier->details->getStatus()); + $this->assertSame('PAID', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), @@ -59,10 +59,10 @@ public function testUpdate() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertSame('PAID', $payment->cashier->details->getStatus()); + $this->assertSame('PAID', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), @@ -78,12 +78,12 @@ public function testUpdate() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertNull($payment->cashier->details->getUrl()); + $this->assertNull($payment->cashbox->details->getUrl()); - $this->assertSame('PAID', $payment->cashier->details->getStatus()); + $this->assertSame('PAID', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), diff --git a/src/TemplateDriver/tests/Jobs/JobsTest.php b/src/TemplateDriver/tests/Jobs/JobsTest.php index b3fa3c38..9c7e9786 100644 --- a/src/TemplateDriver/tests/Jobs/JobsTest.php +++ b/src/TemplateDriver/tests/Jobs/JobsTest.php @@ -44,12 +44,12 @@ public function testStart() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -72,12 +72,12 @@ public function testCheck() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -105,10 +105,10 @@ public function testRefund() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertSame('CANCELED', $payment->cashier->details->getStatus()); + $this->assertSame('CANCELED', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::REFUND), diff --git a/src/TemplateDriver/tests/Observers/ObserverTest.php b/src/TemplateDriver/tests/Observers/ObserverTest.php index e53da985..51478f1a 100644 --- a/src/TemplateDriver/tests/Observers/ObserverTest.php +++ b/src/TemplateDriver/tests/Observers/ObserverTest.php @@ -50,12 +50,12 @@ public function testCreate(): Model $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -78,12 +78,12 @@ public function testUpdate() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), diff --git a/src/TinkoffCredit/tests/Jobs/JobsTest.php b/src/TinkoffCredit/tests/Jobs/JobsTest.php index 4fc6386d..d1a8c603 100644 --- a/src/TinkoffCredit/tests/Jobs/JobsTest.php +++ b/src/TinkoffCredit/tests/Jobs/JobsTest.php @@ -45,12 +45,12 @@ public function testStart() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -73,12 +73,12 @@ public function testCheck() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), diff --git a/src/TinkoffCredit/tests/Observers/ObserverTest.php b/src/TinkoffCredit/tests/Observers/ObserverTest.php index 7295fdbc..f54b489e 100644 --- a/src/TinkoffCredit/tests/Observers/ObserverTest.php +++ b/src/TinkoffCredit/tests/Observers/ObserverTest.php @@ -50,12 +50,12 @@ public function testCreate(): Model $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -78,12 +78,12 @@ public function testUpdate() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), diff --git a/src/TinkoffOnline/tests/Fixtures/Resources/Model.php b/src/TinkoffOnline/tests/Fixtures/Resources/Model.php index 0780a8bb..8bb2f745 100644 --- a/src/TinkoffOnline/tests/Fixtures/Resources/Model.php +++ b/src/TinkoffOnline/tests/Fixtures/Resources/Model.php @@ -23,7 +23,7 @@ class Model extends BaseModel { public function getExternalId(): ?string { - return $this->model->cashier->external_id ?? null; + return $this->model->cashbox->external_id ?? null; } protected function paymentId(): string diff --git a/src/TinkoffOnline/tests/Jobs/JobsTest.php b/src/TinkoffOnline/tests/Jobs/JobsTest.php index 1d18ff28..be981f65 100644 --- a/src/TinkoffOnline/tests/Jobs/JobsTest.php +++ b/src/TinkoffOnline/tests/Jobs/JobsTest.php @@ -42,12 +42,12 @@ public function testStart() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -70,12 +70,12 @@ public function testCheck() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -103,10 +103,10 @@ public function testRefund() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertSame('CANCELED', $payment->cashier->details->getStatus()); + $this->assertSame('CANCELED', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::REFUND), diff --git a/src/TinkoffOnline/tests/Observers/ObserverTest.php b/src/TinkoffOnline/tests/Observers/ObserverTest.php index b0ecd80d..ff7896b6 100644 --- a/src/TinkoffOnline/tests/Observers/ObserverTest.php +++ b/src/TinkoffOnline/tests/Observers/ObserverTest.php @@ -49,12 +49,12 @@ public function testCreate(): RequestPayment $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -77,12 +77,12 @@ public function testUpdate() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), diff --git a/src/TinkoffQrCode/tests/Fixtures/Resources/Model.php b/src/TinkoffQrCode/tests/Fixtures/Resources/Model.php index 0780a8bb..8bb2f745 100644 --- a/src/TinkoffQrCode/tests/Fixtures/Resources/Model.php +++ b/src/TinkoffQrCode/tests/Fixtures/Resources/Model.php @@ -23,7 +23,7 @@ class Model extends BaseModel { public function getExternalId(): ?string { - return $this->model->cashier->external_id ?? null; + return $this->model->cashbox->external_id ?? null; } protected function paymentId(): string diff --git a/src/TinkoffQrCode/tests/Jobs/JobsTest.php b/src/TinkoffQrCode/tests/Jobs/JobsTest.php index 1d18ff28..be981f65 100644 --- a/src/TinkoffQrCode/tests/Jobs/JobsTest.php +++ b/src/TinkoffQrCode/tests/Jobs/JobsTest.php @@ -42,12 +42,12 @@ public function testStart() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -70,12 +70,12 @@ public function testCheck() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -103,10 +103,10 @@ public function testRefund() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertSame('CANCELED', $payment->cashier->details->getStatus()); + $this->assertSame('CANCELED', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::REFUND), diff --git a/src/TinkoffQrCode/tests/Observers/ObserverTest.php b/src/TinkoffQrCode/tests/Observers/ObserverTest.php index e73ddf95..163e88e1 100644 --- a/src/TinkoffQrCode/tests/Observers/ObserverTest.php +++ b/src/TinkoffQrCode/tests/Observers/ObserverTest.php @@ -41,12 +41,12 @@ public function testCreate(): RequestPayment $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), @@ -69,12 +69,12 @@ public function testUpdate() $this->assertSame(1, DB::table('payments')->count()); $this->assertSame(1, DB::table('cashier_details')->count()); - $this->assertIsString($payment->cashier->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashier->external_id); + $this->assertIsString($payment->cashbox->external_id); + $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - $this->assertTrue(Url::is($payment->cashier->details->getUrl())); + $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - $this->assertSame('NEW', $payment->cashier->details->getStatus()); + $this->assertSame('NEW', $payment->cashbox->details->getStatus()); $this->assertSame( PaymentConfig::getStatuses()->getStatus(Status::NEW), From 8cadb2597c34b4eba5846ef0ec6dfa7438df2325 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 23:04:38 +0300 Subject: [PATCH 044/164] Updated tests --- tests/Fixtures/Enums/TypeEnum.php | 4 +++- tests/Fixtures/Models/PaymentModel.php | 2 ++ tests/Unit/Core/EmptyConfigTest.php | 16 +++++++++------- tests/Unit/Drivers/Cash/CreateTest.php | 12 ++++++++---- tests/Unit/Drivers/Cash/FailedTest.php | 4 ++++ tests/Unit/Drivers/Cash/RefundTest.php | 4 ++++ tests/Unit/Drivers/Cash/VerifyTest.php | 4 ++++ 7 files changed, 34 insertions(+), 12 deletions(-) diff --git a/tests/Fixtures/Enums/TypeEnum.php b/tests/Fixtures/Enums/TypeEnum.php index fde01d22..072d5472 100644 --- a/tests/Fixtures/Enums/TypeEnum.php +++ b/tests/Fixtures/Enums/TypeEnum.php @@ -8,10 +8,12 @@ /** * @method static string cash() + * @method static string outside() */ enum TypeEnum: string { use InvokableCases; - case cash = 'cash'; + case cash = 'cash'; + case outside = 'outside'; } diff --git a/tests/Fixtures/Models/PaymentModel.php b/tests/Fixtures/Models/PaymentModel.php index dbf6f92a..58e62dca 100644 --- a/tests/Fixtures/Models/PaymentModel.php +++ b/tests/Fixtures/Models/PaymentModel.php @@ -24,5 +24,7 @@ class PaymentModel extends Model protected $casts = [ 'type' => TypeEnum::class, 'status' => StatusEnum::class, + + 'price' => 'float', ]; } diff --git a/tests/Unit/Core/EmptyConfigTest.php b/tests/Unit/Core/EmptyConfigTest.php index a1d9c03c..3b051b75 100644 --- a/tests/Unit/Core/EmptyConfigTest.php +++ b/tests/Unit/Core/EmptyConfigTest.php @@ -2,11 +2,13 @@ declare(strict_types=1); -use Cashbox\Core\Exceptions\Internal\ConfigCannotBeEmptyException; +//it('must be a empty config', function () { +// config(['cashbox' => []]); +//})->throws( +// ConfigCannotBeEmptyException::class, +// 'Error reading configuration. Check the existence of the "config/cashbox.php" file.' +//); -it('must be a empty config', function () { - config(['cashbox' => []]); -})->throws( - ConfigCannotBeEmptyException::class, - 'Error reading configuration. Check the existence of the "config/cashbox.php" file.' -); +it('some', function () { + expect(true)->toBeTrue(); +}); diff --git a/tests/Unit/Drivers/Cash/CreateTest.php b/tests/Unit/Drivers/Cash/CreateTest.php index 5a046ff5..7d1178f0 100644 --- a/tests/Unit/Drivers/Cash/CreateTest.php +++ b/tests/Unit/Drivers/Cash/CreateTest.php @@ -4,8 +4,12 @@ use Tests\Fixtures\Enums\TypeEnum; -it('success created', function () { - $payment = createPayment(TypeEnum::cash); - - dd($payment->toArray()); +//it('success created', function () { +// $payment = createPayment(TypeEnum::cash); +// +// dd($payment->toArray()); +//}); + +it('some', function () { + expect(true)->toBeTrue(); }); diff --git a/tests/Unit/Drivers/Cash/FailedTest.php b/tests/Unit/Drivers/Cash/FailedTest.php index 174d7fd7..0485940b 100644 --- a/tests/Unit/Drivers/Cash/FailedTest.php +++ b/tests/Unit/Drivers/Cash/FailedTest.php @@ -1,3 +1,7 @@ toBeTrue(); +}); diff --git a/tests/Unit/Drivers/Cash/RefundTest.php b/tests/Unit/Drivers/Cash/RefundTest.php index 174d7fd7..0485940b 100644 --- a/tests/Unit/Drivers/Cash/RefundTest.php +++ b/tests/Unit/Drivers/Cash/RefundTest.php @@ -1,3 +1,7 @@ toBeTrue(); +}); diff --git a/tests/Unit/Drivers/Cash/VerifyTest.php b/tests/Unit/Drivers/Cash/VerifyTest.php index 174d7fd7..0485940b 100644 --- a/tests/Unit/Drivers/Cash/VerifyTest.php +++ b/tests/Unit/Drivers/Cash/VerifyTest.php @@ -1,3 +1,7 @@ toBeTrue(); +}); From f7e7bd54a55a6b23385b03781b6c8009e5e74019 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 14 Jul 2023 23:06:11 +0300 Subject: [PATCH 045/164] Updated tests.yml --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 59466b94..26a9adec 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,7 +44,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --parallel --compact + run: vendor/bin/pest --parallel --compact --colors=always env: DB_CONNECTION: mysql DB_USERNAME: root @@ -90,7 +90,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --parallel --compact + run: vendor/bin/pest --parallel --compact --colors=always env: DB_CONNECTION: mysql DB_USERNAME: root @@ -137,7 +137,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --parallel --compact + run: vendor/bin/pest --parallel --compact --colors=always env: DB_CONNECTION: pgsql DB_PASSWORD: password @@ -182,7 +182,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --parallel --compact + run: vendor/bin/pest --parallel --compact --colors=always env: DB_CONNECTION: sqlsrv DB_DATABASE: master From 6cf19400de0c15197fb70fdcef591a58229803ad Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 15 Jul 2023 02:15:57 +0300 Subject: [PATCH 046/164] Removed tests due to namespace conflict --- src/Cash/tests/Concerns/Database.php | 44 ---- .../tests/Concerns/TestServiceProvider.php | 31 --- src/Cash/tests/DriverTest.php | 87 -------- .../tests/Fixtures/Models/ReadyPayment.php | 66 ------ .../tests/Fixtures/Models/RequestPayment.php | 44 ---- src/Cash/tests/Fixtures/Resources/Model.php | 43 ---- src/Cash/tests/Helpers/StatusesTest.php | 74 ------- src/Cash/tests/Jobs/JobsTest.php | 101 --------- src/Cash/tests/Observers/ObserverTest.php | 86 -------- src/Cash/tests/Requests/CancelTest.php | 59 ------ src/Cash/tests/Requests/InitTest.php | 57 ------ src/Cash/tests/Requests/StatusTest.php | 59 ------ src/Cash/tests/Resources/DetailsTest.php | 64 ------ src/Cash/tests/Responses/InitTest.php | 63 ------ src/Cash/tests/Responses/RefundTest.php | 63 ------ src/Cash/tests/Responses/StateTest.php | 63 ------ src/Cash/tests/TestCase.php | 121 ----------- ...021_05_26_000000_create_payments_table.php | 44 ---- src/SberAuth/tests/Auth/BodyTest.php | 38 ---- src/SberAuth/tests/Auth/HeadersTest.php | 44 ---- src/SberAuth/tests/Auth/MakeTest.php | 39 ---- src/SberAuth/tests/Auth/RefreshTest.php | 60 ------ src/SberAuth/tests/Fixtures/ModelEloquent.php | 74 ------- src/SberAuth/tests/Fixtures/ModelResource.php | 70 ------- src/SberAuth/tests/Fixtures/Request.php | 44 ---- .../AccessToken/GetAccessTokenTest.php | 31 --- .../Resources/AccessToken/GetClientIdTest.php | 31 --- .../AccessToken/GetExpiresInTest.php | 38 ---- .../tests/Resources/AccessToken/MakeTest.php | 39 ---- src/SberAuth/tests/Support/Cache/BaseTest.php | 80 -------- .../tests/Support/Cache/CacheableTest.php | 34 ---- .../tests/Support/Cache/ForgetTest.php | 57 ------ src/SberAuth/tests/Support/Cache/GetTest.php | 53 ----- src/SberAuth/tests/Support/Hash/GetTest.php | 55 ----- src/SberAuth/tests/Support/Hash/MakeTest.php | 38 ---- src/SberAuth/tests/TestCase.php | 106 ---------- src/SberOnline/tests/Concerns/Database.php | 44 ---- .../tests/Concerns/TestServiceProvider.php | 31 --- src/SberOnline/tests/DriverTest.php | 93 --------- .../tests/Fixtures/Models/ReadyPayment.php | 66 ------ .../tests/Fixtures/Models/RequestPayment.php | 44 ---- .../tests/Fixtures/Resources/Model.php | 43 ---- .../tests/Helpers/ExceptionTest.php | 135 ------------- src/SberOnline/tests/Helpers/StatusesTest.php | 191 ------------------ src/SberOnline/tests/Jobs/JobsTest.php | 118 ----------- .../tests/Observers/ObserverTest.php | 93 --------- src/SberOnline/tests/Requests/CancelTest.php | 95 --------- .../tests/Requests/GetStateTest.php | 93 --------- src/SberOnline/tests/Requests/InitTest.php | 96 --------- .../tests/Resources/DetailsTest.php | 73 ------- src/SberOnline/tests/Responses/InitTest.php | 69 ------- src/SberOnline/tests/Responses/RefundTest.php | 68 ------- src/SberOnline/tests/Responses/StateTest.php | 68 ------- src/SberOnline/tests/TestCase.php | 134 ------------ ...021_05_26_000000_create_payments_table.php | 44 ---- src/SberQrCode/tests/Concerns/Database.php | 44 ---- .../tests/Concerns/TestServiceProvider.php | 31 --- src/SberQrCode/tests/DriverTest.php | 95 --------- .../tests/Fixtures/Models/ReadyPayment.php | 66 ------ .../tests/Fixtures/Models/RequestPayment.php | 42 ---- .../tests/Fixtures/Models/StatusPayment.php | 59 ------ .../tests/Fixtures/Resources/Model.php | 63 ------ .../tests/Helpers/ExceptionTest.php | 134 ------------ src/SberQrCode/tests/Helpers/StatusesTest.php | 170 ---------------- src/SberQrCode/tests/Jobs/JobsTest.php | 116 ----------- .../tests/Observers/ObserverTest.php | 101 --------- src/SberQrCode/tests/Requests/CancelTest.php | 107 ---------- src/SberQrCode/tests/Requests/GetQRTest.php | 117 ----------- .../tests/Resources/DetailsTest.php | 73 ------- src/SberQrCode/tests/Responses/QrCodeTest.php | 77 ------- src/SberQrCode/tests/Responses/RefundTest.php | 66 ------ src/SberQrCode/tests/Responses/StatusTest.php | 66 ------ src/SberQrCode/tests/TestCase.php | 147 -------------- ...021_05_26_000000_create_payments_table.php | 44 ---- .../tests/Concerns/Database.php | 44 ---- .../tests/Concerns/TestServiceProvider.php | 31 --- src/TemplateDriver/tests/DriverTest.php | 93 --------- .../tests/Fixtures/Models/ReadyPayment.php | 66 ------ .../tests/Fixtures/Models/RequestPayment.php | 44 ---- .../tests/Fixtures/Resources/Model.php | 43 ---- .../tests/Helpers/ExceptionTest.php | 135 ------------- .../tests/Helpers/StatusesTest.php | 191 ------------------ src/TemplateDriver/tests/Jobs/JobsTest.php | 118 ----------- .../tests/Observers/ObserverTest.php | 93 --------- .../tests/Requests/CancelTest.php | 95 --------- .../tests/Requests/GetStateTest.php | 93 --------- .../tests/Requests/InitTest.php | 96 --------- .../tests/Resources/DetailsTest.php | 73 ------- .../tests/Responses/InitTest.php | 69 ------- .../tests/Responses/RefundTest.php | 68 ------- .../tests/Responses/StateTest.php | 68 ------- src/TemplateDriver/tests/TestCase.php | 134 ------------ ...021_05_26_000000_create_payments_table.php | 44 ---- .../tests/Auth/BodyTest.php | 58 ------ .../tests/Auth/HeadersTest.php | 42 ---- .../tests/Auth/MakeTest.php | 53 ----- .../tests/Fixtures/ModelEloquent.php | 65 ------ .../tests/Fixtures/ModelResource.php | 55 ----- .../tests/Fixtures/Request.php | 38 ---- .../AccessToken/GetAccessTokenTest.php | 38 ---- .../Resources/AccessToken/GetClientIdTest.php | 38 ---- .../AccessToken/GetExpiresInTest.php | 49 ----- .../tests/Resources/AccessToken/MakeTest.php | 39 ---- .../tests/Support/Hash/GetTest.php | 88 -------- .../tests/Support/Hash/MakeTest.php | 38 ---- src/TemplateDriverAuth/tests/TestCase.php | 80 -------- src/TinkoffAuth/tests/Auth/BodyTest.php | 56 ----- src/TinkoffAuth/tests/Auth/HeadersTest.php | 42 ---- src/TinkoffAuth/tests/Auth/MakeTest.php | 53 ----- .../tests/Fixtures/ModelEloquent.php | 65 ------ .../tests/Fixtures/ModelResource.php | 55 ----- src/TinkoffAuth/tests/Fixtures/Request.php | 38 ---- .../AccessToken/GetAccessTokenTest.php | 38 ---- .../Resources/AccessToken/GetClientIdTest.php | 38 ---- .../AccessToken/GetExpiresInTest.php | 49 ----- .../tests/Resources/AccessToken/MakeTest.php | 39 ---- .../tests/Support/Hash/GetTest.php | 88 -------- .../tests/Support/Hash/MakeTest.php | 38 ---- src/TinkoffAuth/tests/TestCase.php | 80 -------- src/TinkoffCredit/tests/Concerns/Database.php | 44 ---- .../tests/Concerns/TestServiceProvider.php | 31 --- src/TinkoffCredit/tests/DriverTest.php | 89 -------- .../tests/Fixtures/Models/OrderItem.php | 38 ---- .../tests/Fixtures/Models/ReadyPayment.php | 66 ------ .../tests/Fixtures/Models/RequestPayment.php | 44 ---- .../tests/Fixtures/Models/User.php | 54 ----- .../tests/Fixtures/Resources/Model.php | 77 ------- .../tests/Helpers/ExceptionTest.php | 135 ------------- .../tests/Helpers/StatusesTest.php | 119 ----------- src/TinkoffCredit/tests/Jobs/JobsTest.php | 107 ---------- .../tests/Observers/ObserverTest.php | 93 --------- .../tests/Requests/CancelTest.php | 86 -------- .../tests/Requests/GetStateTest.php | 86 -------- src/TinkoffCredit/tests/Requests/InitTest.php | 142 ------------- .../tests/Resources/DetailsTest.php | 73 ------- .../tests/Responses/InitTest.php | 64 ------ .../tests/Responses/RefundTest.php | 63 ------ .../tests/Responses/StateTest.php | 63 ------ src/TinkoffCredit/tests/TestCase.php | 149 -------------- ...021_05_26_000000_create_payments_table.php | 44 ---- src/TinkoffOnline/tests/DriverTest.php | 98 --------- .../tests/Fixtures/Factories/Payment.php | 33 --- .../tests/Fixtures/Models/ReadyPayment.php | 66 ------ .../tests/Fixtures/Models/RequestPayment.php | 44 ---- .../tests/Fixtures/Resources/Model.php | 48 ----- .../tests/Helpers/ExceptionTest.php | 135 ------------- .../tests/Helpers/StatusesTest.php | 191 ------------------ src/TinkoffOnline/tests/Jobs/JobsTest.php | 121 ----------- .../tests/Observers/ObserverTest.php | 97 --------- .../tests/Requests/CancelTest.php | 95 --------- .../tests/Requests/GetStateTest.php | 93 --------- src/TinkoffOnline/tests/Requests/InitTest.php | 96 --------- .../tests/Resources/DetailsTest.php | 73 ------- .../tests/Responses/InitTest.php | 69 ------- .../tests/Responses/RefundTest.php | 68 ------- .../tests/Responses/StateTest.php | 68 ------- src/TinkoffOnline/tests/TestCase.php | 147 -------------- ...021_05_26_000000_create_payments_table.php | 44 ---- .../tests/database/seeders/DatabaseSeeder.php | 26 --- .../tests/database/seeders/PaymentSeeder.php | 27 --- src/TinkoffQrCode/tests/DriverTest.php | 98 --------- .../tests/Fixtures/Factories/Payment.php | 33 --- .../tests/Fixtures/Models/ReadyPayment.php | 66 ------ .../tests/Fixtures/Models/RequestPayment.php | 44 ---- .../tests/Fixtures/Resources/Model.php | 48 ----- .../tests/Helpers/ExceptionTest.php | 135 ------------- .../tests/Helpers/StatusesTest.php | 191 ------------------ src/TinkoffQrCode/tests/Jobs/JobsTest.php | 121 ----------- .../tests/Observers/ObserverTest.php | 97 --------- .../tests/Requests/CancelTest.php | 95 --------- .../tests/Requests/GetQRTest.php | 93 --------- .../tests/Requests/GetStateTest.php | 93 --------- src/TinkoffQrCode/tests/Requests/InitTest.php | 96 --------- .../tests/Resources/DetailsTest.php | 73 ------- .../tests/Responses/InitTest.php | 69 ------- .../tests/Responses/QrCodeTest.php | 82 -------- .../tests/Responses/RefundTest.php | 68 ------- .../tests/Responses/StateTest.php | 68 ------- src/TinkoffQrCode/tests/TestCase.php | 147 -------------- ...021_05_26_000000_create_payments_table.php | 44 ---- .../tests/database/seeders/DatabaseSeeder.php | 26 --- .../tests/database/seeders/PaymentSeeder.php | 27 --- 182 files changed, 13394 deletions(-) delete mode 100644 src/Cash/tests/Concerns/Database.php delete mode 100644 src/Cash/tests/Concerns/TestServiceProvider.php delete mode 100644 src/Cash/tests/DriverTest.php delete mode 100644 src/Cash/tests/Fixtures/Models/ReadyPayment.php delete mode 100644 src/Cash/tests/Fixtures/Models/RequestPayment.php delete mode 100644 src/Cash/tests/Fixtures/Resources/Model.php delete mode 100644 src/Cash/tests/Helpers/StatusesTest.php delete mode 100644 src/Cash/tests/Jobs/JobsTest.php delete mode 100644 src/Cash/tests/Observers/ObserverTest.php delete mode 100644 src/Cash/tests/Requests/CancelTest.php delete mode 100644 src/Cash/tests/Requests/InitTest.php delete mode 100644 src/Cash/tests/Requests/StatusTest.php delete mode 100644 src/Cash/tests/Resources/DetailsTest.php delete mode 100644 src/Cash/tests/Responses/InitTest.php delete mode 100644 src/Cash/tests/Responses/RefundTest.php delete mode 100644 src/Cash/tests/Responses/StateTest.php delete mode 100644 src/Cash/tests/TestCase.php delete mode 100644 src/Cash/tests/database/migrations/2021_05_26_000000_create_payments_table.php delete mode 100644 src/SberAuth/tests/Auth/BodyTest.php delete mode 100644 src/SberAuth/tests/Auth/HeadersTest.php delete mode 100644 src/SberAuth/tests/Auth/MakeTest.php delete mode 100644 src/SberAuth/tests/Auth/RefreshTest.php delete mode 100644 src/SberAuth/tests/Fixtures/ModelEloquent.php delete mode 100644 src/SberAuth/tests/Fixtures/ModelResource.php delete mode 100644 src/SberAuth/tests/Fixtures/Request.php delete mode 100644 src/SberAuth/tests/Resources/AccessToken/GetAccessTokenTest.php delete mode 100644 src/SberAuth/tests/Resources/AccessToken/GetClientIdTest.php delete mode 100644 src/SberAuth/tests/Resources/AccessToken/GetExpiresInTest.php delete mode 100644 src/SberAuth/tests/Resources/AccessToken/MakeTest.php delete mode 100644 src/SberAuth/tests/Support/Cache/BaseTest.php delete mode 100644 src/SberAuth/tests/Support/Cache/CacheableTest.php delete mode 100644 src/SberAuth/tests/Support/Cache/ForgetTest.php delete mode 100644 src/SberAuth/tests/Support/Cache/GetTest.php delete mode 100644 src/SberAuth/tests/Support/Hash/GetTest.php delete mode 100644 src/SberAuth/tests/Support/Hash/MakeTest.php delete mode 100644 src/SberAuth/tests/TestCase.php delete mode 100644 src/SberOnline/tests/Concerns/Database.php delete mode 100644 src/SberOnline/tests/Concerns/TestServiceProvider.php delete mode 100644 src/SberOnline/tests/DriverTest.php delete mode 100644 src/SberOnline/tests/Fixtures/Models/ReadyPayment.php delete mode 100644 src/SberOnline/tests/Fixtures/Models/RequestPayment.php delete mode 100644 src/SberOnline/tests/Fixtures/Resources/Model.php delete mode 100644 src/SberOnline/tests/Helpers/ExceptionTest.php delete mode 100644 src/SberOnline/tests/Helpers/StatusesTest.php delete mode 100644 src/SberOnline/tests/Jobs/JobsTest.php delete mode 100644 src/SberOnline/tests/Observers/ObserverTest.php delete mode 100644 src/SberOnline/tests/Requests/CancelTest.php delete mode 100644 src/SberOnline/tests/Requests/GetStateTest.php delete mode 100644 src/SberOnline/tests/Requests/InitTest.php delete mode 100644 src/SberOnline/tests/Resources/DetailsTest.php delete mode 100644 src/SberOnline/tests/Responses/InitTest.php delete mode 100644 src/SberOnline/tests/Responses/RefundTest.php delete mode 100644 src/SberOnline/tests/Responses/StateTest.php delete mode 100644 src/SberOnline/tests/TestCase.php delete mode 100644 src/SberOnline/tests/database/migrations/2021_05_26_000000_create_payments_table.php delete mode 100644 src/SberQrCode/tests/Concerns/Database.php delete mode 100644 src/SberQrCode/tests/Concerns/TestServiceProvider.php delete mode 100644 src/SberQrCode/tests/DriverTest.php delete mode 100644 src/SberQrCode/tests/Fixtures/Models/ReadyPayment.php delete mode 100644 src/SberQrCode/tests/Fixtures/Models/RequestPayment.php delete mode 100644 src/SberQrCode/tests/Fixtures/Models/StatusPayment.php delete mode 100644 src/SberQrCode/tests/Fixtures/Resources/Model.php delete mode 100644 src/SberQrCode/tests/Helpers/ExceptionTest.php delete mode 100644 src/SberQrCode/tests/Helpers/StatusesTest.php delete mode 100644 src/SberQrCode/tests/Jobs/JobsTest.php delete mode 100644 src/SberQrCode/tests/Observers/ObserverTest.php delete mode 100644 src/SberQrCode/tests/Requests/CancelTest.php delete mode 100644 src/SberQrCode/tests/Requests/GetQRTest.php delete mode 100644 src/SberQrCode/tests/Resources/DetailsTest.php delete mode 100644 src/SberQrCode/tests/Responses/QrCodeTest.php delete mode 100644 src/SberQrCode/tests/Responses/RefundTest.php delete mode 100644 src/SberQrCode/tests/Responses/StatusTest.php delete mode 100644 src/SberQrCode/tests/TestCase.php delete mode 100644 src/SberQrCode/tests/database/migrations/2021_05_26_000000_create_payments_table.php delete mode 100644 src/TemplateDriver/tests/Concerns/Database.php delete mode 100644 src/TemplateDriver/tests/Concerns/TestServiceProvider.php delete mode 100644 src/TemplateDriver/tests/DriverTest.php delete mode 100644 src/TemplateDriver/tests/Fixtures/Models/ReadyPayment.php delete mode 100644 src/TemplateDriver/tests/Fixtures/Models/RequestPayment.php delete mode 100644 src/TemplateDriver/tests/Fixtures/Resources/Model.php delete mode 100644 src/TemplateDriver/tests/Helpers/ExceptionTest.php delete mode 100644 src/TemplateDriver/tests/Helpers/StatusesTest.php delete mode 100644 src/TemplateDriver/tests/Jobs/JobsTest.php delete mode 100644 src/TemplateDriver/tests/Observers/ObserverTest.php delete mode 100644 src/TemplateDriver/tests/Requests/CancelTest.php delete mode 100644 src/TemplateDriver/tests/Requests/GetStateTest.php delete mode 100644 src/TemplateDriver/tests/Requests/InitTest.php delete mode 100644 src/TemplateDriver/tests/Resources/DetailsTest.php delete mode 100644 src/TemplateDriver/tests/Responses/InitTest.php delete mode 100644 src/TemplateDriver/tests/Responses/RefundTest.php delete mode 100644 src/TemplateDriver/tests/Responses/StateTest.php delete mode 100644 src/TemplateDriver/tests/TestCase.php delete mode 100644 src/TemplateDriver/tests/database/migrations/2021_05_26_000000_create_payments_table.php delete mode 100644 src/TemplateDriverAuth/tests/Auth/BodyTest.php delete mode 100644 src/TemplateDriverAuth/tests/Auth/HeadersTest.php delete mode 100644 src/TemplateDriverAuth/tests/Auth/MakeTest.php delete mode 100644 src/TemplateDriverAuth/tests/Fixtures/ModelEloquent.php delete mode 100644 src/TemplateDriverAuth/tests/Fixtures/ModelResource.php delete mode 100644 src/TemplateDriverAuth/tests/Fixtures/Request.php delete mode 100644 src/TemplateDriverAuth/tests/Resources/AccessToken/GetAccessTokenTest.php delete mode 100644 src/TemplateDriverAuth/tests/Resources/AccessToken/GetClientIdTest.php delete mode 100644 src/TemplateDriverAuth/tests/Resources/AccessToken/GetExpiresInTest.php delete mode 100644 src/TemplateDriverAuth/tests/Resources/AccessToken/MakeTest.php delete mode 100644 src/TemplateDriverAuth/tests/Support/Hash/GetTest.php delete mode 100644 src/TemplateDriverAuth/tests/Support/Hash/MakeTest.php delete mode 100644 src/TemplateDriverAuth/tests/TestCase.php delete mode 100644 src/TinkoffAuth/tests/Auth/BodyTest.php delete mode 100644 src/TinkoffAuth/tests/Auth/HeadersTest.php delete mode 100644 src/TinkoffAuth/tests/Auth/MakeTest.php delete mode 100644 src/TinkoffAuth/tests/Fixtures/ModelEloquent.php delete mode 100644 src/TinkoffAuth/tests/Fixtures/ModelResource.php delete mode 100644 src/TinkoffAuth/tests/Fixtures/Request.php delete mode 100644 src/TinkoffAuth/tests/Resources/AccessToken/GetAccessTokenTest.php delete mode 100644 src/TinkoffAuth/tests/Resources/AccessToken/GetClientIdTest.php delete mode 100644 src/TinkoffAuth/tests/Resources/AccessToken/GetExpiresInTest.php delete mode 100644 src/TinkoffAuth/tests/Resources/AccessToken/MakeTest.php delete mode 100644 src/TinkoffAuth/tests/Support/Hash/GetTest.php delete mode 100644 src/TinkoffAuth/tests/Support/Hash/MakeTest.php delete mode 100644 src/TinkoffAuth/tests/TestCase.php delete mode 100644 src/TinkoffCredit/tests/Concerns/Database.php delete mode 100644 src/TinkoffCredit/tests/Concerns/TestServiceProvider.php delete mode 100644 src/TinkoffCredit/tests/DriverTest.php delete mode 100644 src/TinkoffCredit/tests/Fixtures/Models/OrderItem.php delete mode 100644 src/TinkoffCredit/tests/Fixtures/Models/ReadyPayment.php delete mode 100644 src/TinkoffCredit/tests/Fixtures/Models/RequestPayment.php delete mode 100644 src/TinkoffCredit/tests/Fixtures/Models/User.php delete mode 100644 src/TinkoffCredit/tests/Fixtures/Resources/Model.php delete mode 100644 src/TinkoffCredit/tests/Helpers/ExceptionTest.php delete mode 100644 src/TinkoffCredit/tests/Helpers/StatusesTest.php delete mode 100644 src/TinkoffCredit/tests/Jobs/JobsTest.php delete mode 100644 src/TinkoffCredit/tests/Observers/ObserverTest.php delete mode 100644 src/TinkoffCredit/tests/Requests/CancelTest.php delete mode 100644 src/TinkoffCredit/tests/Requests/GetStateTest.php delete mode 100644 src/TinkoffCredit/tests/Requests/InitTest.php delete mode 100644 src/TinkoffCredit/tests/Resources/DetailsTest.php delete mode 100644 src/TinkoffCredit/tests/Responses/InitTest.php delete mode 100644 src/TinkoffCredit/tests/Responses/RefundTest.php delete mode 100644 src/TinkoffCredit/tests/Responses/StateTest.php delete mode 100644 src/TinkoffCredit/tests/TestCase.php delete mode 100644 src/TinkoffCredit/tests/database/migrations/2021_05_26_000000_create_payments_table.php delete mode 100644 src/TinkoffOnline/tests/DriverTest.php delete mode 100644 src/TinkoffOnline/tests/Fixtures/Factories/Payment.php delete mode 100644 src/TinkoffOnline/tests/Fixtures/Models/ReadyPayment.php delete mode 100644 src/TinkoffOnline/tests/Fixtures/Models/RequestPayment.php delete mode 100644 src/TinkoffOnline/tests/Fixtures/Resources/Model.php delete mode 100644 src/TinkoffOnline/tests/Helpers/ExceptionTest.php delete mode 100644 src/TinkoffOnline/tests/Helpers/StatusesTest.php delete mode 100644 src/TinkoffOnline/tests/Jobs/JobsTest.php delete mode 100644 src/TinkoffOnline/tests/Observers/ObserverTest.php delete mode 100644 src/TinkoffOnline/tests/Requests/CancelTest.php delete mode 100644 src/TinkoffOnline/tests/Requests/GetStateTest.php delete mode 100644 src/TinkoffOnline/tests/Requests/InitTest.php delete mode 100644 src/TinkoffOnline/tests/Resources/DetailsTest.php delete mode 100644 src/TinkoffOnline/tests/Responses/InitTest.php delete mode 100644 src/TinkoffOnline/tests/Responses/RefundTest.php delete mode 100644 src/TinkoffOnline/tests/Responses/StateTest.php delete mode 100644 src/TinkoffOnline/tests/TestCase.php delete mode 100644 src/TinkoffOnline/tests/database/migrations/2021_05_26_000000_create_payments_table.php delete mode 100644 src/TinkoffOnline/tests/database/seeders/DatabaseSeeder.php delete mode 100644 src/TinkoffOnline/tests/database/seeders/PaymentSeeder.php delete mode 100644 src/TinkoffQrCode/tests/DriverTest.php delete mode 100644 src/TinkoffQrCode/tests/Fixtures/Factories/Payment.php delete mode 100644 src/TinkoffQrCode/tests/Fixtures/Models/ReadyPayment.php delete mode 100644 src/TinkoffQrCode/tests/Fixtures/Models/RequestPayment.php delete mode 100644 src/TinkoffQrCode/tests/Fixtures/Resources/Model.php delete mode 100644 src/TinkoffQrCode/tests/Helpers/ExceptionTest.php delete mode 100644 src/TinkoffQrCode/tests/Helpers/StatusesTest.php delete mode 100644 src/TinkoffQrCode/tests/Jobs/JobsTest.php delete mode 100644 src/TinkoffQrCode/tests/Observers/ObserverTest.php delete mode 100644 src/TinkoffQrCode/tests/Requests/CancelTest.php delete mode 100644 src/TinkoffQrCode/tests/Requests/GetQRTest.php delete mode 100644 src/TinkoffQrCode/tests/Requests/GetStateTest.php delete mode 100644 src/TinkoffQrCode/tests/Requests/InitTest.php delete mode 100644 src/TinkoffQrCode/tests/Resources/DetailsTest.php delete mode 100644 src/TinkoffQrCode/tests/Responses/InitTest.php delete mode 100644 src/TinkoffQrCode/tests/Responses/QrCodeTest.php delete mode 100644 src/TinkoffQrCode/tests/Responses/RefundTest.php delete mode 100644 src/TinkoffQrCode/tests/Responses/StateTest.php delete mode 100644 src/TinkoffQrCode/tests/TestCase.php delete mode 100644 src/TinkoffQrCode/tests/database/migrations/2021_05_26_000000_create_payments_table.php delete mode 100644 src/TinkoffQrCode/tests/database/seeders/DatabaseSeeder.php delete mode 100644 src/TinkoffQrCode/tests/database/seeders/PaymentSeeder.php diff --git a/src/Cash/tests/Concerns/Database.php b/src/Cash/tests/Concerns/Database.php deleted file mode 100644 index bd0b6ce8..00000000 --- a/src/Cash/tests/Concerns/Database.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Concerns; - -use Illuminate\Database\Eloquent\Model; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Tests\Fixtures\Models\ReadyPayment; -use Tests\TestCase; - -trait Database -{ - use RefreshDatabase; - - /** @var \Illuminate\Database\Eloquent\Model|string */ - protected $model = ReadyPayment::class; - - protected function payment(): Model - { - $model = $this->model; - - return $model::create([ - 'type_id' => TestCase::MODEL_TYPE_ID, - 'status_id' => TestCase::MODEL_STATUS_ID, - - 'sum' => TestCase::PAYMENT_SUM, - 'currency' => TestCase::CURRENCY, - ]); - } -} diff --git a/src/Cash/tests/Concerns/TestServiceProvider.php b/src/Cash/tests/Concerns/TestServiceProvider.php deleted file mode 100644 index f5ce1126..00000000 --- a/src/Cash/tests/Concerns/TestServiceProvider.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Concerns; - -use Cashbox\Core\Providers\ServiceProvider; - -class TestServiceProvider extends ServiceProvider -{ - protected function bootMigrations(): void - { - $this->loadMigrationsFrom([ - __DIR__ . '/../database/migrations', - __DIR__ . '/../../vendor/cashbox/core/database/migrations/main', - ]); - } -} diff --git a/src/Cash/tests/DriverTest.php b/src/Cash/tests/DriverTest.php deleted file mode 100644 index 9f57f7ad..00000000 --- a/src/Cash/tests/DriverTest.php +++ /dev/null @@ -1,87 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Cash\Driver as Technology; -use Cashbox\Core\Http\ResponseInfo; -use Cashbox\Core\Services\Jobs; -use DragonCode\Contracts\Cashier\Driver as DriverContract; -use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; -use Illuminate\Database\Eloquent\Model; -use Tests\Fixtures\Models\RequestPayment; - -class DriverTest extends TestCase -{ - protected $model = RequestPayment::class; - - public function testStart() - { - $payment = $this->payment(); - - $response = $this->driver($payment)->start(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testCheck() - { - $payment = $this->payment(); - - Jobs::make($payment)->start(); - - $response = $this->driver($payment)->check(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - - $this->assertSame(self::STATUS, $response->getStatus()); - - $this->assertSame([ - 'status' => self::STATUS, - ], $response->toArray()); - } - - public function testRefund() - { - $payment = $this->payment(); - - Jobs::make($payment)->start(); - Jobs::make($payment)->check(true); - - $response = $this->driver($payment)->refund(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - - $this->assertSame('REFUNDED', $response->getStatus()); - } - - protected function driver(Model $payment): DriverContract - { - $config = $this->config(); - - return Technology::make($config, $payment); - } -} diff --git a/src/Cash/tests/Fixtures/Models/ReadyPayment.php b/src/Cash/tests/Fixtures/Models/ReadyPayment.php deleted file mode 100644 index c3cbcd9f..00000000 --- a/src/Cash/tests/Fixtures/Models/ReadyPayment.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $uuid; - */ -class ReadyPayment extends UuidModel -{ - use Billable; - - protected function getUuidAttribute(): string - { - return TestCase::PAYMENT_ID; - } - - protected function getTypeIdAttribute(): int - { - return TestCase::MODEL_TYPE_ID; - } - - protected function getStatusIdAttribute(): int - { - return TestCase::MODEL_STATUS_ID; - } - - protected function getSumAttribute(): float - { - return TestCase::PAYMENT_SUM; - } - - protected function getCurrencyAttribute(): int - { - return TestCase::CURRENCY; - } - - protected function getCreatedAtAttribute(): Carbon - { - return Carbon::parse(TestCase::PAYMENT_DATE); - } -} diff --git a/src/Cash/tests/Fixtures/Models/RequestPayment.php b/src/Cash/tests/Fixtures/Models/RequestPayment.php deleted file mode 100644 index f19ecd52..00000000 --- a/src/Cash/tests/Fixtures/Models/RequestPayment.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $id; - */ -class RequestPayment extends UuidModel -{ - use Billable; - - protected $table = 'payments'; - - protected $fillable = ['type_id', 'status_id', 'sum', 'currency']; - - protected $casts = [ - 'type_id' => 'integer', - 'status_id' => 'integer', - - 'sum' => 'float', - 'currency' => 'integer', - ]; -} diff --git a/src/Cash/tests/Fixtures/Resources/Model.php b/src/Cash/tests/Fixtures/Resources/Model.php deleted file mode 100644 index 3328e3b7..00000000 --- a/src/Cash/tests/Fixtures/Resources/Model.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Resources; - -use Cashbox\Core\Resources\Model as BaseModel; -use Illuminate\Support\Carbon; - -/** @property \Tests\Fixtures\Models\ReadyPayment $model */ -class Model extends BaseModel -{ - protected function paymentId(): string - { - return $this->model->uuid; - } - - protected function sum(): float - { - return $this->model->sum; - } - - protected function currency(): int - { - return $this->model->currency; - } - - protected function createdAt(): Carbon - { - return $this->model->created_at; - } -} diff --git a/src/Cash/tests/Helpers/StatusesTest.php b/src/Cash/tests/Helpers/StatusesTest.php deleted file mode 100644 index 27f44743..00000000 --- a/src/Cash/tests/Helpers/StatusesTest.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\Cash\Helpers\Statuses; -use Cashbox\Cash\Resources\Details; -use Tests\TestCase; - -class StatusesTest extends TestCase -{ - public function testModel() - { - $this->assertTrue($this->status('NEW')->hasCreated()); - $this->assertTrue($this->status('NEW')->inProgress()); - - $this->assertFalse($this->status('NEW')->hasSuccess()); - $this->assertFalse($this->status('NEW')->hasFailed()); - $this->assertFalse($this->status('NEW')->hasRefunding()); - $this->assertFalse($this->status('NEW')->hasRefunded()); - } - - public function testHasSuccess() - { - $this->assertTrue($this->status('PAID')->hasSuccess('PAID')); - $this->assertFalse($this->status('PAID')->hasSuccess('REFUNDED')); - - $this->assertTrue($this->status('REFUNDED')->hasSuccess('PAID')); - $this->assertFalse($this->status('REFUNDED')->hasSuccess('REFUNDED')); - - $this->assertFalse($this->status('UNKNOWN')->hasSuccess('UNKNOWN')); - } - - public function testHasRefunded() - { - $this->assertFalse($this->status('PAID')->hasRefunded('PAID')); - $this->assertTrue($this->status('PAID')->hasRefunded('REFUNDED')); - - $this->assertFalse($this->status('REFUNDED')->hasRefunded('PAID')); - $this->assertTrue($this->status('REFUNDED')->hasRefunded('REFUNDED')); - - $this->assertFalse($this->status('UNKNOWN')->hasRefunded('UNKNOWN')); - } - - public function testInProgress() - { - $this->assertFalse($this->status('PAID')->inProgress('PAID')); - $this->assertFalse($this->status('PAID')->inProgress('REFUNDED')); - - $this->assertFalse($this->status('REFUNDED')->inProgress('PAID')); - $this->assertFalse($this->status('REFUNDED')->inProgress('REFUNDED')); - - $this->assertTrue($this->status('UNKNOWN')->inProgress('UNKNOWN')); - } - - protected function status(string $status): Statuses - { - $details = Details::make(compact('status')); - - return Statuses::make($this->model($details)); - } -} diff --git a/src/Cash/tests/Jobs/JobsTest.php b/src/Cash/tests/Jobs/JobsTest.php deleted file mode 100644 index 6269a51f..00000000 --- a/src/Cash/tests/Jobs/JobsTest.php +++ /dev/null @@ -1,101 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Jobs; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Services\Jobs; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Illuminate\Support\Facades\DB; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class JobsTest extends TestCase -{ - use RefreshDatabase; - - protected $model = RequestPayment::class; - - public function testStart() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - } - - public function testCheck() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - Jobs::make($payment)->check(true); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - - $this->assertSame('PAID', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), - $payment->status_id - ); - } - - public function testRefund() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - - Jobs::make($payment)->start(); - Jobs::make($payment)->refund(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - - $this->assertSame('REFUNDED', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::REFUND), - $payment->status_id - ); - } -} diff --git a/src/Cash/tests/Observers/ObserverTest.php b/src/Cash/tests/Observers/ObserverTest.php deleted file mode 100644 index 3ea1124e..00000000 --- a/src/Cash/tests/Observers/ObserverTest.php +++ /dev/null @@ -1,86 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Observers; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Providers\ObserverServiceProvider; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Illuminate\Support\Facades\DB; -use Tests\Concerns\TestServiceProvider; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class ObserverTest extends TestCase -{ - use RefreshDatabase; - - protected $model = RequestPayment::class; - - protected function getPackageProviders($app): array - { - return [ - TestServiceProvider::class, - ObserverServiceProvider::class, - ]; - } - - public function testCreate(): Model - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment()->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - - $this->assertSame('PAID', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), - $payment->status_id - ); - - return $payment; - } - - public function testUpdate() - { - $payment = $this->testCreate(); - - $payment->update([ - 'sum' => 34.56, - ]); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - - $this->assertSame('PAID', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), - $payment->status_id - ); - } -} diff --git a/src/Cash/tests/Requests/CancelTest.php b/src/Cash/tests/Requests/CancelTest.php deleted file mode 100644 index bcfeb4f9..00000000 --- a/src/Cash/tests/Requests/CancelTest.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Cash\Requests\Cancel; -use Cashbox\Core\Http\Request; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use Tests\TestCase; - -class CancelTest extends TestCase -{ - public const STATUS = 'REFUNDED'; - - public function testInstance() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Cancel::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testBody() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Status' => self::STATUS, - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Status' => self::STATUS, - ], $request->body()); - } -} diff --git a/src/Cash/tests/Requests/InitTest.php b/src/Cash/tests/Requests/InitTest.php deleted file mode 100644 index 07480c61..00000000 --- a/src/Cash/tests/Requests/InitTest.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Cash\Requests\CreateRequest; -use Cashbox\Core\Http\Request; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use Tests\TestCase; - -class InitTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(CreateRequest::class); - - $this->assertInstanceOf(CreateRequest::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testBody() - { - $request = $this->request(CreateRequest::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Status' => self::STATUS, - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(CreateRequest::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Status' => self::STATUS, - ], $request->body()); - } -} diff --git a/src/Cash/tests/Requests/StatusTest.php b/src/Cash/tests/Requests/StatusTest.php deleted file mode 100644 index e3e94c2f..00000000 --- a/src/Cash/tests/Requests/StatusTest.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Cash\Requests\Status; -use Cashbox\Core\Http\Request; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use Tests\TestCase; - -class StatusTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Status::class); - - $this->assertInstanceOf(Status::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testBody() - { - $request = $this->request(Status::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - - 'Status' => null, - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(Status::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - - 'Status' => null, - ], $request->body()); - } -} diff --git a/src/Cash/tests/Resources/DetailsTest.php b/src/Cash/tests/Resources/DetailsTest.php deleted file mode 100644 index 642846a1..00000000 --- a/src/Cash/tests/Resources/DetailsTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Resources; - -use Cashbox\Cash\Resources\Details as BaseDetails; -use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; -use Tests\TestCase; - -class DetailsTest extends TestCase -{ - protected $expected = [ - 'status' => self::STATUS, - ]; - - public function testMake() - { - $details = $this->details(); - - $this->assertInstanceOf(BaseDetails::class, $details); - $this->assertInstanceOf(BaseDetails::class, $details); - $this->assertInstanceOf(DetailsContract::class, $details); - } - - public function testGetStatus() - { - $details = $this->details(); - - $this->assertSame(self::STATUS, $details->getStatus()); - } - - public function testToArray() - { - $details = $this->details(); - - $this->assertSame($this->expected, $details->toArray()); - } - - public function testToJson() - { - $details = $this->details(); - - $this->assertJson($details->toJson()); - - $this->assertSame(json_encode($this->expected), $details->toJson()); - } - - protected function details(): BaseDetails - { - return BaseDetails::make($this->expected); - } -} diff --git a/src/Cash/tests/Responses/InitTest.php b/src/Cash/tests/Responses/InitTest.php deleted file mode 100644 index 218384a5..00000000 --- a/src/Cash/tests/Responses/InitTest.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Cash\Responses\Created; -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class InitTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Created::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Created::make([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Status' => self::STATUS, - ]); - } -} diff --git a/src/Cash/tests/Responses/RefundTest.php b/src/Cash/tests/Responses/RefundTest.php deleted file mode 100644 index c82e769e..00000000 --- a/src/Cash/tests/Responses/RefundTest.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Cash\Responses\Refund; -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class RefundTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Refund::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Refund::make([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Status' => self::STATUS, - ]); - } -} diff --git a/src/Cash/tests/Responses/StateTest.php b/src/Cash/tests/Responses/StateTest.php deleted file mode 100644 index f430fb66..00000000 --- a/src/Cash/tests/Responses/StateTest.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Cash\Responses\State; -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class StateTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(State::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return State::make([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Status' => self::STATUS, - ]); - } -} diff --git a/src/Cash/tests/TestCase.php b/src/Cash/tests/TestCase.php deleted file mode 100644 index 4ff489d5..00000000 --- a/src/Cash/tests/TestCase.php +++ /dev/null @@ -1,121 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Cash\Driver; -use Cashbox\Core\Config\Driver as DriverConfig; -use Cashbox\Core\Constants\Driver as DriverConstant; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Models\CashierDetail; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\Details; -use Illuminate\Database\Eloquent\Model as EloquentModel; -use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; -use Orchestra\Testbench\TestCase as BaseTestCase; -use Tests\Concerns\Database; -use Tests\Concerns\TestServiceProvider; -use Tests\Fixtures\Models\ReadyPayment; -use Tests\Fixtures\Resources\Model; - -abstract class TestCase extends BaseTestCase -{ - use Database; - - public const PAYMENT_EXTERNAL_ID = '1234567890'; - public const PAYMENT_ID = '1234567890'; - public const PAYMENT_SUM = 12.34; - public const PAYMENT_SUM_FORMATTED = 1234; - public const CURRENCY = 643; - public const CURRENCY_FORMATTED = '643'; - public const PAYMENT_DATE = '2021-07-23 17:33:27'; - public const PAYMENT_DATE_FORMATTED = '2021-07-23T17:33:27Z'; - public const STATUS = 'PAID'; - public const URL = 'https://example.com'; - public const MODEL_TYPE_ID = 123; - public const MODEL_STATUS_ID = 0; - - protected function getPackageProviders($app): array - { - return [TestServiceProvider::class]; - } - - protected function getEnvironmentSetup($app) - { - $app->useEnvironmentPath(__DIR__ . '/../'); - $app->bootstrapWith([LoadEnvironmentVariables::class]); - - /** @var \Illuminate\Config\Repository $config */ - $config = $app['config']; - - $config->set('cashier.payment.model', $this->model); - - $config->set('cashier.payment.map', [ - self::MODEL_TYPE_ID => 'cash', - ]); - - $config->set('cashier.drivers.cash', [ - DriverConstant::DRIVER => Driver::class, - DriverConstant::DETAILS => Model::class, - ]); - } - - protected function model(?Details $details = null): ReadyPayment - { - $model = PaymentConfig::getModel(); - - $payment = new $model(); - - $cashier = $this->detailsRelation($payment, $details); - - return $payment->setRelation('cashier', $cashier); - } - - protected function detailsRelation(EloquentModel $model, ?Details $details): CashierDetail - { - $details = new CashierDetail([ - 'item_type' => ReadyPayment::class, - - 'item_id' => self::PAYMENT_ID, - 'external_id' => self::PAYMENT_EXTERNAL_ID, - - 'details' => $details, - ]); - - return $details->setRelation('parent', $model); - } - - /** - * @param \Cashbox\Cash\Requests\BaseRequest|string $request - */ - protected function request(string $request): Request - { - $model = $this->modelRequest(); - - return $request::make($model); - } - - protected function modelRequest(): Model - { - return Model::make($this->model(), $this->config()); - } - - protected function config(): DriverConfig - { - $config = config('cashier.drivers.cash'); - - return DriverConfig::make($config); - } -} diff --git a/src/Cash/tests/database/migrations/2021_05_26_000000_create_payments_table.php b/src/Cash/tests/database/migrations/2021_05_26_000000_create_payments_table.php deleted file mode 100644 index a37e8827..00000000 --- a/src/Cash/tests/database/migrations/2021_05_26_000000_create_payments_table.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; - -class CreatePaymentsTable extends Migration -{ - protected $table = 'payments'; - - public function up() - { - Schema::create($this->table, function (Blueprint $table) { - $table->uuid('uuid'); - - $table->smallInteger('type_id'); - $table->smallInteger('status_id'); - - $table->double('sum', 10, 2)->default(0); - - $table->smallInteger('currency'); - - $table->timestamps(); - }); - } - - public function down() - { - Schema::dropIfExists($this->table); - } -} diff --git a/src/SberAuth/tests/Auth/BodyTest.php b/src/SberAuth/tests/Auth/BodyTest.php deleted file mode 100644 index 9404bfce..00000000 --- a/src/SberAuth/tests/Auth/BodyTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Auth; - -use Cashbox\Sber\Auth\Auth; -use Tests\TestCase; - -class BodyTest extends TestCase -{ - public function testBasic() - { - $auth = Auth::make($this->model(), $this->request()); - - $this->assertIsArray($auth->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_ID, - 'Sum' => self::SUM_RESULT, - 'Currency' => self::CURRENCY_RESULT, - 'CreatedAt' => self::CREATED_AT_RESULT, - ], $auth->body()); - } -} diff --git a/src/SberAuth/tests/Auth/HeadersTest.php b/src/SberAuth/tests/Auth/HeadersTest.php deleted file mode 100644 index 6908054f..00000000 --- a/src/SberAuth/tests/Auth/HeadersTest.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Auth; - -use Cashbox\Sber\Auth\Auth; -use DragonCode\Support\Facades\Helpers\Arr; -use Tests\TestCase; - -class HeadersTest extends TestCase -{ - public function testBasic() - { - $auth = Auth::make($this->model(), $this->request(), true, [ - 'scope' => self::SCOPE_CREATE, - ]); - - $this->assertIsArray($auth->headers()); - - $this->assertArrayHasKey('Accept', $auth->headers()); - $this->assertArrayHasKey('Authorization', $auth->headers()); - - $this->assertSame('application/json', Arr::get($auth->headers(), 'Accept')); - - $this->assertMatchesRegularExpression( - '/^Bearer\s[\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12}$/', - Arr::get($auth->headers(), 'Authorization') - ); - } -} diff --git a/src/SberAuth/tests/Auth/MakeTest.php b/src/SberAuth/tests/Auth/MakeTest.php deleted file mode 100644 index 4682aaa3..00000000 --- a/src/SberAuth/tests/Auth/MakeTest.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Auth; - -use Cashbox\Sber\Auth\Auth; -use DragonCode\Contracts\Cashier\Auth\Auth as AuthContract; -use Tests\TestCase; - -class MakeTest extends TestCase -{ - public function testMakeBasic() - { - $auth = Auth::make($this->model(), $this->request()); - - $this->assertInstanceOf(AuthContract::class, $auth); - } - - public function testConstructBasic() - { - $auth = new Auth($this->model(), $this->request()); - - $this->assertInstanceOf(AuthContract::class, $auth); - } -} diff --git a/src/SberAuth/tests/Auth/RefreshTest.php b/src/SberAuth/tests/Auth/RefreshTest.php deleted file mode 100644 index b0439cfa..00000000 --- a/src/SberAuth/tests/Auth/RefreshTest.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Auth; - -use Cashbox\Sber\Auth\Auth; -use DragonCode\Contracts\Cashier\Resources\Model; -use DragonCode\Support\Facades\Helpers\Arr; -use Tests\TestCase; - -class RefreshTest extends TestCase -{ - public function testBasic() - { - $model = $this->model(); - - $first = Arr::get($this->makeAuth($model)->headers(), 'Authorization'); - $second = Arr::get($this->makeAuth($model)->headers(), 'Authorization'); - - $this->makeAuth($model)->refresh(); - - $third = Arr::get($this->makeAuth($model)->headers(), 'Authorization'); - $fourth = Arr::get($this->makeAuth($model)->headers(), 'Authorization'); - - $this->assertIsString($first); - $this->assertIsString($second); - $this->assertIsString($third); - $this->assertIsString($fourth); - - $this->assertSame($first, $second); - $this->assertSame($third, $fourth); - - $this->assertNotSame($first, $third); - $this->assertNotSame($first, $fourth); - - $this->assertNotSame($second, $third); - $this->assertNotSame($second, $fourth); - } - - protected function makeAuth(Model $model): Auth - { - return Auth::make($model, $this->request(), true, [ - 'scope' => self::SCOPE_CREATE, - ]); - } -} diff --git a/src/SberAuth/tests/Fixtures/ModelEloquent.php b/src/SberAuth/tests/Fixtures/ModelEloquent.php deleted file mode 100644 index 735565e6..00000000 --- a/src/SberAuth/tests/Fixtures/ModelEloquent.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures; - -use Cashbox\Core\Billable; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -/** - * @property string $client_id - * @property string $client_secret - * @property string $created_at - * @property string $currency - * @property string $member_id - * @property string $payment_id - * @property string $sum - */ -class ModelEloquent extends Model -{ - use Billable; - - public $timestamps = false; - - protected function getClientIdAttribute(): string - { - return config('cashier.drivers.sber_qr.client_id'); - } - - protected function getClientSecretAttribute(): string - { - return config('cashier.drivers.sber_qr.client_secret'); - } - - protected function getMemberIdAttribute(): string - { - return config('cashier.drivers.sber_qr.member_id'); - } - - protected function getPaymentIdAttribute(): string - { - return TestCase::PAYMENT_ID; - } - - protected function getSumAttribute(): float - { - return TestCase::SUM; - } - - protected function getCurrencyAttribute(): string - { - return TestCase::CURRENCY; - } - - protected function getCreatedAtAttribute(): Carbon - { - return Carbon::parse(TestCase::CREATED_AT); - } -} diff --git a/src/SberAuth/tests/Fixtures/ModelResource.php b/src/SberAuth/tests/Fixtures/ModelResource.php deleted file mode 100644 index 40247987..00000000 --- a/src/SberAuth/tests/Fixtures/ModelResource.php +++ /dev/null @@ -1,70 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures; - -use Cashbox\Core\Resources\Model; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -class ModelResource extends Model -{ - public function getCertificatePath(): ?string - { - return null; - } - - public function getCertificatePassword(): ?string - { - return null; - } - - protected function clientId(): string - { - return config('cashier.drivers.sber_qr.client_id'); - } - - protected function clientSecret(): string - { - return config('cashier.drivers.sber_qr.client_secret'); - } - - protected function memberId(): string - { - return config('cashier.drivers.sber_qr.member_id'); - } - - protected function paymentId(): string - { - return TestCase::PAYMENT_ID; - } - - protected function sum(): float - { - return TestCase::SUM; - } - - protected function currency(): string - { - return TestCase::CURRENCY; - } - - protected function createdAt(): Carbon - { - return Carbon::parse(TestCase::CREATED_AT); - } -} diff --git a/src/SberAuth/tests/Fixtures/Request.php b/src/SberAuth/tests/Fixtures/Request.php deleted file mode 100644 index 9dca37d6..00000000 --- a/src/SberAuth/tests/Fixtures/Request.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures; - -use Cashbox\Core\Http\Request as BaseRequest; - -class Request extends BaseRequest -{ - /** @var string */ - protected $production_host = 'https://api.sberbank.ru'; - - /** @var string */ - protected $dev_host = 'https://dev.api.sberbank.ru'; - - public function getRawHeaders(): array - { - return ['Accept' => 'application/json']; - } - - public function getRawBody(): array - { - return [ - 'PaymentId' => $this->model->getPaymentId(), - 'Sum' => $this->model->getSum(), - 'Currency' => $this->model->getCurrency(), - 'CreatedAt' => $this->model->getCreatedAt(), - ]; - } -} diff --git a/src/SberAuth/tests/Resources/AccessToken/GetAccessTokenTest.php b/src/SberAuth/tests/Resources/AccessToken/GetAccessTokenTest.php deleted file mode 100644 index 9d9d1406..00000000 --- a/src/SberAuth/tests/Resources/AccessToken/GetAccessTokenTest.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Resources\AccessToken; - -use Cashbox\Sber\Auth\Resources\AccessToken; -use Tests\TestCase; - -class GetAccessTokenTest extends TestCase -{ - public function testBasic() - { - $token = AccessToken::make($this->credentials()); - - $this->assertSame($this->clientSecret(), $token->getAccessToken()); - } -} diff --git a/src/SberAuth/tests/Resources/AccessToken/GetClientIdTest.php b/src/SberAuth/tests/Resources/AccessToken/GetClientIdTest.php deleted file mode 100644 index a7dfc831..00000000 --- a/src/SberAuth/tests/Resources/AccessToken/GetClientIdTest.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Resources\AccessToken; - -use Cashbox\Sber\Auth\Resources\AccessToken; -use Tests\TestCase; - -class GetClientIdTest extends TestCase -{ - public function testBasic() - { - $token = AccessToken::make($this->credentials()); - - $this->assertSame($this->clientId(), $token->getClientId()); - } -} diff --git a/src/SberAuth/tests/Resources/AccessToken/GetExpiresInTest.php b/src/SberAuth/tests/Resources/AccessToken/GetExpiresInTest.php deleted file mode 100644 index fba7a0f1..00000000 --- a/src/SberAuth/tests/Resources/AccessToken/GetExpiresInTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Resources\AccessToken; - -use Carbon\Carbon as BaseCarbon; -use Cashbox\Sber\Auth\Resources\AccessToken; -use DateTimeInterface; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -class GetExpiresInTest extends TestCase -{ - public function testBasic() - { - $token = AccessToken::make($this->credentials()); - - $this->assertInstanceOf(Carbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(BaseCarbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(DateTimeInterface::class, $token->getExpiresIn()); - - $this->assertGreaterThan(Carbon::now(), $token->getExpiresIn()); - } -} diff --git a/src/SberAuth/tests/Resources/AccessToken/MakeTest.php b/src/SberAuth/tests/Resources/AccessToken/MakeTest.php deleted file mode 100644 index c083bb3b..00000000 --- a/src/SberAuth/tests/Resources/AccessToken/MakeTest.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Resources\AccessToken; - -use Cashbox\Sber\Auth\Resources\AccessToken; -use DragonCode\Contracts\Cashier\Resources\AccessToken as AccessTokenContract; -use Tests\TestCase; - -class MakeTest extends TestCase -{ - public function testMake() - { - $token = AccessToken::make(); - - $this->assertInstanceOf(AccessTokenContract::class, $token); - } - - public function testConstruct() - { - $token = new AccessToken(); - - $this->assertInstanceOf(AccessTokenContract::class, $token); - } -} diff --git a/src/SberAuth/tests/Support/Cache/BaseTest.php b/src/SberAuth/tests/Support/Cache/BaseTest.php deleted file mode 100644 index 411a8e75..00000000 --- a/src/SberAuth/tests/Support/Cache/BaseTest.php +++ /dev/null @@ -1,80 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Support\Cache; - -use Cashbox\Sber\Auth\Objects\Query; -use Cashbox\Sber\Auth\Support\Cache; -use Cashbox\Sber\Auth\Support\Hash; -use DragonCode\Contracts\Cashier\Resources\Model; -use DragonCode\Contracts\Http\Builder as BuilderContract; -use DragonCode\Support\Facades\Http\Builder; -use Illuminate\Support\Collection; -use Tests\TestCase; - -abstract class BaseTest extends TestCase -{ - protected $uri = 'https://dev.api.sberbank.ru/ru/prod/order/v1/creation'; - - protected function uri(): BuilderContract - { - return Builder::parse($this->uri); - } - - protected function getCache(): string - { - $model = $this->model(); - - $uri = Builder::parse($this->uri); - - $token = Hash::make()->get($model, $uri, self::SCOPE_CREATE); - - return $token->getAccessToken(); - } - - protected function query(Model $model, string $scope): Query - { - return Query::make(compact('model', 'scope')); - } - - protected function getKey(): string - { - $model = $this->model(); - - $query = $this->query($model, self::SCOPE_CREATE); - - return $this->key($query); - } - - protected function key(Query $query): string - { - return $this->compact([ - Cache::class, - $query->getModel()->getClientId(), - $query->getModel()->getPaymentId(), - $query->getScope(), - ]); - } - - protected function compact(array $values): string - { - return Collection::make($values) - ->map(static function ($value) { - return md5($value); - })->implode('::'); - } -} diff --git a/src/SberAuth/tests/Support/Cache/CacheableTest.php b/src/SberAuth/tests/Support/Cache/CacheableTest.php deleted file mode 100644 index 9512dbb3..00000000 --- a/src/SberAuth/tests/Support/Cache/CacheableTest.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Support\Cache; - -use Illuminate\Support\Facades\Cache as CacheRepository; - -class CacheableTest extends BaseTest -{ - public function testSet() - { - $key = $this->getKey(); - - $this->assertFalse(CacheRepository::has($key)); - - $this->getCache(); - - $this->assertTrue(CacheRepository::has($key)); - - $this->assertIsString(CacheRepository::get($key)); - } -} diff --git a/src/SberAuth/tests/Support/Cache/ForgetTest.php b/src/SberAuth/tests/Support/Cache/ForgetTest.php deleted file mode 100644 index e23e7ab3..00000000 --- a/src/SberAuth/tests/Support/Cache/ForgetTest.php +++ /dev/null @@ -1,57 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Support\Cache; - -use Cashbox\Sber\Auth\Support\Hash; -use Illuminate\Support\Facades\Cache as CacheRepository; - -class ForgetTest extends BaseTest -{ - public function testBasic() - { - $key = $this->getKey(); - - $this->getCache(); - $first = CacheRepository::get($key); - - $this->getCache(); - $second = CacheRepository::get($key); - - Hash::make()->forget($this->model(), self::SCOPE_CREATE); - - $this->getCache(); - $third = CacheRepository::get($key); - - $this->getCache(); - $fourth = CacheRepository::get($key); - - $this->assertIsString($first); - $this->assertIsString($second); - $this->assertIsString($third); - $this->assertIsString($fourth); - - $this->assertSame($first, $second); - $this->assertSame($third, $fourth); - - $this->assertNotSame($first, $third); - $this->assertNotSame($first, $fourth); - - $this->assertNotSame($second, $third); - $this->assertNotSame($second, $fourth); - } -} diff --git a/src/SberAuth/tests/Support/Cache/GetTest.php b/src/SberAuth/tests/Support/Cache/GetTest.php deleted file mode 100644 index acaab4c5..00000000 --- a/src/SberAuth/tests/Support/Cache/GetTest.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Support\Cache; - -use Cashbox\Sber\Auth\Support\Hash; -use DragonCode\Support\Facades\Http\Builder; -use Tests\TestCase; - -class GetTest extends TestCase -{ - protected $uri_create = 'https://dev.api.sberbank.ru/ru/prod/order/v1/creation'; - - protected $pattern = '/^[\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12}$/'; - - public function testBasic() - { - $first = $this->getCache(); - $second = $this->getCache(); - $third = $this->getCache(); - - $this->assertMatchesRegularExpression($this->pattern, $first); - $this->assertMatchesRegularExpression($this->pattern, $second); - $this->assertMatchesRegularExpression($this->pattern, $third); - - $this->assertSame($first, $second); - $this->assertSame($first, $third); - $this->assertSame($second, $third); - } - - protected function getCache(): string - { - $model = $this->model(); - - $uri = Builder::parse($this->uri_create); - - $token = Hash::make()->get($model, $uri, self::SCOPE_CREATE); - - return $token->getAccessToken(); - } -} diff --git a/src/SberAuth/tests/Support/Hash/GetTest.php b/src/SberAuth/tests/Support/Hash/GetTest.php deleted file mode 100644 index a03d2c97..00000000 --- a/src/SberAuth/tests/Support/Hash/GetTest.php +++ /dev/null @@ -1,55 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Support\Hash; - -use Carbon\Carbon as BaseCarbon; -use Cashbox\Sber\Auth\Support\Hash; -use DateTimeInterface; -use DragonCode\Contracts\Cashier\Resources\AccessToken; -use DragonCode\Support\Facades\Http\Builder; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -class GetTest extends TestCase -{ - protected $uri_create = 'https://dev.api.sberbank.ru/ru/prod/order/v1/creation'; - - public function testBasic() - { - $model = $this->model(); - - $uri = Builder::parse($this->uri_create); - - $token = Hash::make()->get($model, $uri, self::SCOPE_CREATE); - - $this->assertInstanceOf(AccessToken::class, $token); - - $this->assertSame($this->clientId(), $token->getClientId()); - - $this->assertMatchesRegularExpression( - '/^[\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12}$/', - $token->getAccessToken() - ); - - $this->assertInstanceOf(Carbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(BaseCarbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(DateTimeInterface::class, $token->getExpiresIn()); - - $this->assertGreaterThan(Carbon::now(), $token->getExpiresIn()); - } -} diff --git a/src/SberAuth/tests/Support/Hash/MakeTest.php b/src/SberAuth/tests/Support/Hash/MakeTest.php deleted file mode 100644 index 97405fc4..00000000 --- a/src/SberAuth/tests/Support/Hash/MakeTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Support\Hash; - -use Cashbox\Sber\Auth\Support\Hash; -use Tests\TestCase; - -class MakeTest extends TestCase -{ - public function testMake() - { - $hash = Hash::make(); - - $this->assertInstanceOf(Hash::class, $hash); - } - - public function testConstruct() - { - $hash = new Hash(); - - $this->assertInstanceOf(Hash::class, $hash); - } -} diff --git a/src/SberAuth/tests/TestCase.php b/src/SberAuth/tests/TestCase.php deleted file mode 100644 index 96ea639b..00000000 --- a/src/SberAuth/tests/TestCase.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Core\Config\Driver; -use Cashbox\Core\Constants\Driver as DriverConstant; -use Cashbox\Sber\Auth\Constants\Keys; -use DragonCode\Contracts\Cashier\Config\Driver as DriverContract; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\Model; -use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; -use Orchestra\Testbench\TestCase as BaseTestCase; -use Tests\Fixtures\ModelEloquent; -use Tests\Fixtures\ModelResource; - -abstract class TestCase extends BaseTestCase -{ - public const PAYMENT_ID = '123456'; - public const SUM = 123.45; - public const SUM_RESULT = 12345; - public const CURRENCY = 'RUB'; - public const CURRENCY_RESULT = '643'; - public const CREATED_AT = '2021-07-29 18:51:03'; - public const CREATED_AT_RESULT = '2021-07-29T18:51:03Z'; - public const SCOPE_CREATE = 'https://api.sberbank.ru/order.create'; - - protected function setUp(): void - { - parent::setUp(); - - $this->artisan('cache:clear')->run(); - } - - protected function getEnvironmentSetUp($app) - { - $app->useEnvironmentPath(__DIR__ . '/../'); - $app->bootstrapWith([LoadEnvironmentVariables::class]); - - /** @var \Illuminate\Config\Repository $config */ - $config = $app['config']; - - $config->set('cashier.logs.enabled', false); - - $config->set('cashier.drivers.sber_qr', [ - DriverConstant::CLIENT_ID => env('CASHIER_SBER_QR_CLIENT_ID'), - DriverConstant::CLIENT_SECRET => env('CASHIER_SBER_QR_CLIENT_SECRET'), - - 'member_id' => env('CASHIER_SBER_QR_MEMBER_ID'), - ]); - } - - protected function credentials(): array - { - return $this->auth($this->clientId(), $this->clientSecret()); - } - - protected function auth(string $client_id, string $client_secret): array - { - return [ - Keys::CLIENT_ID => $client_id, - Keys::TOKEN => $client_secret, - ]; - } - - protected function model(): Model - { - $eloquent = new ModelEloquent(); - - $config = $this->config(); - - return new ModelResource($eloquent, $config); - } - - protected function config(): DriverContract - { - return Driver::make(config('cashier.drivers.sber_qr')); - } - - protected function request(): Request - { - return Fixtures\Request::make($this->model()); - } - - protected function clientId(): string - { - return config('cashier.drivers.sber_qr.client_id'); - } - - protected function clientSecret(): string - { - return config('cashier.drivers.sber_qr.client_secret'); - } -} diff --git a/src/SberOnline/tests/Concerns/Database.php b/src/SberOnline/tests/Concerns/Database.php deleted file mode 100644 index bd0b6ce8..00000000 --- a/src/SberOnline/tests/Concerns/Database.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Concerns; - -use Illuminate\Database\Eloquent\Model; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Tests\Fixtures\Models\ReadyPayment; -use Tests\TestCase; - -trait Database -{ - use RefreshDatabase; - - /** @var \Illuminate\Database\Eloquent\Model|string */ - protected $model = ReadyPayment::class; - - protected function payment(): Model - { - $model = $this->model; - - return $model::create([ - 'type_id' => TestCase::MODEL_TYPE_ID, - 'status_id' => TestCase::MODEL_STATUS_ID, - - 'sum' => TestCase::PAYMENT_SUM, - 'currency' => TestCase::CURRENCY, - ]); - } -} diff --git a/src/SberOnline/tests/Concerns/TestServiceProvider.php b/src/SberOnline/tests/Concerns/TestServiceProvider.php deleted file mode 100644 index f5ce1126..00000000 --- a/src/SberOnline/tests/Concerns/TestServiceProvider.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Concerns; - -use Cashbox\Core\Providers\ServiceProvider; - -class TestServiceProvider extends ServiceProvider -{ - protected function bootMigrations(): void - { - $this->loadMigrationsFrom([ - __DIR__ . '/../database/migrations', - __DIR__ . '/../../vendor/cashbox/core/database/migrations/main', - ]); - } -} diff --git a/src/SberOnline/tests/DriverTest.php b/src/SberOnline/tests/DriverTest.php deleted file mode 100644 index 00abdb6c..00000000 --- a/src/SberOnline/tests/DriverTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\BankName\Technology\Driver as Technology; -use Cashbox\Core\Http\ResponseInfo; -use Cashbox\Core\Services\Jobs; -use DragonCode\Contracts\Cashier\Driver as DriverContract; -use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Database\Eloquent\Model; -use Tests\Fixtures\Models\RequestPayment; - -class DriverTest extends TestCase -{ - protected $model = RequestPayment::class; - - public function testStart() - { - $payment = $this->payment(); - - $response = $this->driver($payment)->start(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertNull($response->getStatus()); - - $this->assertTrue(Url::is($response->getUrl())); - } - - public function testCheck() - { - $payment = $this->payment(); - - Jobs::make($payment)->start(); - - $response = $this->driver($payment)->check(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertSame('FORM_SHOWED', $response->getStatus()); - - $this->assertSame([ - 'status' => 'FORM_SHOWED', - ], $response->toArray()); - } - - public function testRefund() - { - $payment = $this->payment(); - - Jobs::make($payment)->start(); - Jobs::make($payment)->check(true); - - $response = $this->driver($payment)->refund(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertSame('CANCELED', $response->getStatus()); - } - - protected function driver(Model $payment): DriverContract - { - $config = $this->config(); - - return Technology::make($config, $payment); - } -} diff --git a/src/SberOnline/tests/Fixtures/Models/ReadyPayment.php b/src/SberOnline/tests/Fixtures/Models/ReadyPayment.php deleted file mode 100644 index c3cbcd9f..00000000 --- a/src/SberOnline/tests/Fixtures/Models/ReadyPayment.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $uuid; - */ -class ReadyPayment extends UuidModel -{ - use Billable; - - protected function getUuidAttribute(): string - { - return TestCase::PAYMENT_ID; - } - - protected function getTypeIdAttribute(): int - { - return TestCase::MODEL_TYPE_ID; - } - - protected function getStatusIdAttribute(): int - { - return TestCase::MODEL_STATUS_ID; - } - - protected function getSumAttribute(): float - { - return TestCase::PAYMENT_SUM; - } - - protected function getCurrencyAttribute(): int - { - return TestCase::CURRENCY; - } - - protected function getCreatedAtAttribute(): Carbon - { - return Carbon::parse(TestCase::PAYMENT_DATE); - } -} diff --git a/src/SberOnline/tests/Fixtures/Models/RequestPayment.php b/src/SberOnline/tests/Fixtures/Models/RequestPayment.php deleted file mode 100644 index f19ecd52..00000000 --- a/src/SberOnline/tests/Fixtures/Models/RequestPayment.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $id; - */ -class RequestPayment extends UuidModel -{ - use Billable; - - protected $table = 'payments'; - - protected $fillable = ['type_id', 'status_id', 'sum', 'currency']; - - protected $casts = [ - 'type_id' => 'integer', - 'status_id' => 'integer', - - 'sum' => 'float', - 'currency' => 'integer', - ]; -} diff --git a/src/SberOnline/tests/Fixtures/Resources/Model.php b/src/SberOnline/tests/Fixtures/Resources/Model.php deleted file mode 100644 index 3328e3b7..00000000 --- a/src/SberOnline/tests/Fixtures/Resources/Model.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Resources; - -use Cashbox\Core\Resources\Model as BaseModel; -use Illuminate\Support\Carbon; - -/** @property \Tests\Fixtures\Models\ReadyPayment $model */ -class Model extends BaseModel -{ - protected function paymentId(): string - { - return $this->model->uuid; - } - - protected function sum(): float - { - return $this->model->sum; - } - - protected function currency(): int - { - return $this->model->currency; - } - - protected function createdAt(): Carbon - { - return $this->model->created_at; - } -} diff --git a/src/SberOnline/tests/Helpers/ExceptionTest.php b/src/SberOnline/tests/Helpers/ExceptionTest.php deleted file mode 100644 index 59630498..00000000 --- a/src/SberOnline/tests/Helpers/ExceptionTest.php +++ /dev/null @@ -1,135 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\BankName\Technology\Exceptions\Manager; -use Cashbox\Core\Exceptions\Http\BadRequestClientException; -use Cashbox\Core\Exceptions\Http\BaseException; -use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; -use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; -use DragonCode\Contracts\Http\Builder as HttpBuilder; -use DragonCode\Support\Facades\Http\Builder; -use Tests\TestCase; - -class ExceptionTest extends TestCase -{ - public function test7() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Buyer Not Found'); - $this->expectExceptionCode(404); - - $this->throw(7); - } - - public function test7String() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Buyer Not Found'); - $this->expectExceptionCode(404); - - $this->throw('7'); - } - - public function test7Reason() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(404); - - $this->throw(7, 'Foo Bar'); - } - - public function test53() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Contact The Seller'); - $this->expectExceptionCode(409); - - $this->throw(53); - } - - public function test53String() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Contact The Seller'); - $this->expectExceptionCode(409); - - $this->throw('53'); - } - - public function test53Reason() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(409); - - $this->throw(53, 'Foo Bar'); - } - - public function testDefault() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw(10000); - } - - public function testDefaultString() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw('10000'); - } - - public function testDefaultReason() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(400); - - $this->throw(10000, 'Foo Bar'); - } - - protected function throw($code, ?string $reason = null) - { - $this->manager()->throw($this->uri(), $code, [ - 'Message' => $reason, - ]); - } - - protected function uri(): HttpBuilder - { - return Builder::parse('https://example.com/foo'); - } - - protected function manager(): Manager - { - return new Manager(); - } -} diff --git a/src/SberOnline/tests/Helpers/StatusesTest.php b/src/SberOnline/tests/Helpers/StatusesTest.php deleted file mode 100644 index d0268b33..00000000 --- a/src/SberOnline/tests/Helpers/StatusesTest.php +++ /dev/null @@ -1,191 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\BankName\Technology\Helpers\Statuses; -use Cashbox\BankName\Technology\Resources\Details; -use Tests\TestCase; - -class StatusesTest extends TestCase -{ - public function testModel() - { - $this->assertTrue($this->status('NEW')->hasCreated()); - $this->assertTrue($this->status('NEW')->inProgress()); - - $this->assertFalse($this->status('NEW')->hasSuccess()); - $this->assertFalse($this->status('NEW')->hasFailed()); - $this->assertFalse($this->status('NEW')->hasRefunding()); - $this->assertFalse($this->status('NEW')->hasRefunded()); - } - - public function testHasCreated() - { - $this->assertTrue($this->status('FORM_SHOWED')->hasCreated('FORM_SHOWED')); - $this->assertTrue($this->status('NEW')->hasCreated('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasCreated('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasCreated('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasCreated('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasCreated('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasCreated('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasCreated('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasCreated('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasCreated('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasCreated('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasCreated('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasCreated('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasCreated('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasCreated('UNKNOWN')); - } - - public function testHasSuccess() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasSuccess('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasSuccess('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasSuccess('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasSuccess('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasSuccess('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasSuccess('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasSuccess('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasSuccess('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasSuccess('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasSuccess('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasSuccess('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasSuccess('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasSuccess('REJECTED')); - - $this->assertTrue($this->status('CONFIRMED')->hasSuccess('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasSuccess('UNKNOWN')); - } - - public function testHasFailed() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasFailed('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasFailed('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasFailed('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasFailed('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasFailed('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasFailed('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasFailed('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasFailed('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasFailed('REVERSED')); - - $this->assertTrue($this->status('ATTEMPTS_EXPIRED')->hasFailed('ATTEMPTS_EXPIRED')); - $this->assertTrue($this->status('CANCELED')->hasFailed('CANCELED')); - $this->assertTrue($this->status('DEADLINE_EXPIRED')->hasFailed('DEADLINE_EXPIRED')); - $this->assertTrue($this->status('REJECTED')->hasFailed('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasFailed('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasFailed('UNKNOWN')); - } - - public function testHasRefunding() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasRefunding('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasRefunding('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasRefunding('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasRefunding('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasRefunding('CONFIRMING')); - - $this->assertTrue($this->status('REFUNDING')->hasRefunding('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasRefunding('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasRefunding('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasRefunding('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasRefunding('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasRefunding('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasRefunding('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasRefunding('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasRefunding('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasRefunding('UNKNOWN')); - } - - public function testHasRefunded() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasRefunded('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasRefunded('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasRefunded('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasRefunded('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasRefunded('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasRefunded('REFUNDING')); - - $this->assertTrue($this->status('PARTIAL_REFUNDED')->hasRefunded('PARTIAL_REFUNDED')); - $this->assertTrue($this->status('REFUNDED')->hasRefunded('REFUNDED')); - $this->assertTrue($this->status('REVERSED')->hasRefunded('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasRefunded('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasRefunded('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasRefunded('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasRefunded('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasRefunded('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasRefunded('UNKNOWN')); - } - - public function testInProgress() - { - $this->assertTrue($this->status('FORM_SHOWED')->inProgress('FORM_SHOWED')); - $this->assertTrue($this->status('NEW')->inProgress('NEW')); - - $this->assertTrue($this->status('AUTHORIZED')->inProgress('AUTHORIZED')); - $this->assertTrue($this->status('AUTHORIZING')->inProgress('AUTHORIZING')); - $this->assertTrue($this->status('CONFIRMING')->inProgress('CONFIRMING')); - - $this->assertTrue($this->status('REFUNDING')->inProgress('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->inProgress('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->inProgress('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->inProgress('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->inProgress('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->inProgress('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->inProgress('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->inProgress('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->inProgress('CONFIRMED')); - - $this->assertTrue($this->status('UNKNOWN')->inProgress('UNKNOWN')); - } - - protected function status(string $status): Statuses - { - $details = Details::make(compact('status')); - - return Statuses::make($this->model($details)); - } -} diff --git a/src/SberOnline/tests/Jobs/JobsTest.php b/src/SberOnline/tests/Jobs/JobsTest.php deleted file mode 100644 index 9c7e9786..00000000 --- a/src/SberOnline/tests/Jobs/JobsTest.php +++ /dev/null @@ -1,118 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Jobs; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Services\Jobs; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Illuminate\Support\Facades\DB; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class JobsTest extends TestCase -{ - use RefreshDatabase; - - protected $model = RequestPayment::class; - - public function testStart() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - public function testCheck() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - Jobs::make($payment)->check(true); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - public function testRefund() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - - Jobs::make($payment)->start(); - Jobs::make($payment)->refund(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertSame('CANCELED', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::REFUND), - $payment->status_id - ); - } -} diff --git a/src/SberOnline/tests/Observers/ObserverTest.php b/src/SberOnline/tests/Observers/ObserverTest.php deleted file mode 100644 index 51478f1a..00000000 --- a/src/SberOnline/tests/Observers/ObserverTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Observers; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Providers\ObserverServiceProvider; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Illuminate\Support\Facades\DB; -use Tests\Concerns\TestServiceProvider; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class ObserverTest extends TestCase -{ - use RefreshDatabase; - - protected $model = RequestPayment::class; - - protected function getPackageProviders($app): array - { - return [ - TestServiceProvider::class, - ObserverServiceProvider::class, - ]; - } - - public function testCreate(): Model - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment()->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - - return $payment; - } - - public function testUpdate() - { - $payment = $this->testCreate(); - - $payment->update([ - 'sum' => 34.56, - ]); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } -} diff --git a/src/SberOnline/tests/Requests/CancelTest.php b/src/SberOnline/tests/Requests/CancelTest.php deleted file mode 100644 index 788e5ee3..00000000 --- a/src/SberOnline/tests/Requests/CancelTest.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\BankName\Technology\Requests\Cancel; -use Cashbox\Core\Http\Request; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class CancelTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Cancel::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://dev.api-bank-uri.com/api/cancel', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - - 'TerminalKey' => $this->getTerminalKey(), - - 'Token' => '8473d8d4cafb9ec63071e9050c05e0dd1178fc8e1f3c765ffef7ec7fb5fcb758', - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - ], $request->getRawBody()); - } -} diff --git a/src/SberOnline/tests/Requests/GetStateTest.php b/src/SberOnline/tests/Requests/GetStateTest.php deleted file mode 100644 index 8a7caa6c..00000000 --- a/src/SberOnline/tests/Requests/GetStateTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\BankName\Technology\Requests\GetState; -use Cashbox\Core\Http\Request; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class GetStateTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(GetState::class); - - $this->assertInstanceOf(GetState::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(GetState::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://dev.api-bank-uri.com/api/status', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - - 'TerminalKey' => $this->getTerminalKey(), - - 'Token' => 'dbcbdf5539c35132b63c1b54e0f107cc96e71cf96040ba54dec5e140255b2e63', - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - ], $request->getRawBody()); - } -} diff --git a/src/SberOnline/tests/Requests/InitTest.php b/src/SberOnline/tests/Requests/InitTest.php deleted file mode 100644 index dc7ca321..00000000 --- a/src/SberOnline/tests/Requests/InitTest.php +++ /dev/null @@ -1,96 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\BankName\Technology\Requests\Init; -use Cashbox\Core\Http\Request; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class InitTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Init::class); - - $this->assertInstanceOf(Init::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(Init::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://dev.api-bank-uri.com/api/create', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'OrderId' => self::PAYMENT_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - 'Currency' => self::CURRENCY_FORMATTED, - - 'TerminalKey' => $this->getTerminalKey(), - 'Token' => $this->getTerminalSecret(), - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'OrderId' => self::PAYMENT_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - 'Currency' => self::CURRENCY_FORMATTED, - ], $request->getRawBody()); - } -} diff --git a/src/SberOnline/tests/Resources/DetailsTest.php b/src/SberOnline/tests/Resources/DetailsTest.php deleted file mode 100644 index efa173e0..00000000 --- a/src/SberOnline/tests/Resources/DetailsTest.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Resources; - -use Cashbox\BankName\Technology\Resources\Details; -use Cashbox\Core\Resources\Details as BaseDetails; -use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; -use Tests\TestCase; - -class DetailsTest extends TestCase -{ - protected $expected = [ - 'status' => self::STATUS, - 'url' => self::URL, - ]; - - public function testMake() - { - $details = $this->details(); - - $this->assertInstanceOf(Details::class, $details); - $this->assertInstanceOf(BaseDetails::class, $details); - $this->assertInstanceOf(DetailsContract::class, $details); - } - - public function testGetUrl() - { - $details = $this->details(); - - $this->assertSame(self::URL, $details->getUrl()); - } - - public function testGetStatus() - { - $details = $this->details(); - - $this->assertSame(self::STATUS, $details->getStatus()); - } - - public function testToArray() - { - $details = $this->details(); - - $this->assertSame($this->expected, $details->toArray()); - } - - public function testToJson() - { - $details = $this->details(); - - $this->assertJson($details->toJson()); - - $this->assertSame(json_encode($this->expected), $details->toJson()); - } - - protected function details(): Details - { - return Details::make($this->expected); - } -} diff --git a/src/SberOnline/tests/Responses/InitTest.php b/src/SberOnline/tests/Responses/InitTest.php deleted file mode 100644 index dd1d0dce..00000000 --- a/src/SberOnline/tests/Responses/InitTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\BankName\Technology\Responses\Created; -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class InitTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Created::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Created::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'Amount' => self::PAYMENT_SUM_FORMATTED, - 'OrderId' => self::PAYMENT_ID, - 'Success' => true, - 'Status' => self::STATUS, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'ErrorCode' => 0, - ]); - } -} diff --git a/src/SberOnline/tests/Responses/RefundTest.php b/src/SberOnline/tests/Responses/RefundTest.php deleted file mode 100644 index 5fb33e96..00000000 --- a/src/SberOnline/tests/Responses/RefundTest.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\BankName\Technology\Responses\Refund; -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class RefundTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Refund::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Refund::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'Success' => true, - 'Status' => self::STATUS, - 'ErrorCode' => 0, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'OrderId' => self::PAYMENT_ID, - ]); - } -} diff --git a/src/SberOnline/tests/Responses/StateTest.php b/src/SberOnline/tests/Responses/StateTest.php deleted file mode 100644 index 2cee5a9e..00000000 --- a/src/SberOnline/tests/Responses/StateTest.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\BankName\Technology\Responses\State; -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class StateTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(State::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return State::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'OrderId' => self::PAYMENT_ID, - 'Success' => true, - 'Status' => self::STATUS, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'ErrorCode' => 0, - ]); - } -} diff --git a/src/SberOnline/tests/TestCase.php b/src/SberOnline/tests/TestCase.php deleted file mode 100644 index e771194b..00000000 --- a/src/SberOnline/tests/TestCase.php +++ /dev/null @@ -1,134 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\BankName\Technology\Driver; -use Cashbox\Core\Config\Driver as DriverConfig; -use Cashbox\Core\Constants\Driver as DriverConstant; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Models\CashierDetail; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\Details; -use Illuminate\Database\Eloquent\Model as EloquentModel; -use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; -use Orchestra\Testbench\TestCase as BaseTestCase; -use Tests\Concerns\Database; -use Tests\Concerns\TestServiceProvider; -use Tests\Fixtures\Models\ReadyPayment; -use Tests\Fixtures\Resources\Model; - -abstract class TestCase extends BaseTestCase -{ - use Database; - - public const PAYMENT_EXTERNAL_ID = '456789'; - public const PAYMENT_ID = '1234567890'; - public const PAYMENT_SUM = 12.34; - public const PAYMENT_SUM_FORMATTED = 1234; - public const CURRENCY = 643; - public const CURRENCY_FORMATTED = '643'; - public const PAYMENT_DATE = '2021-07-23 17:33:27'; - public const PAYMENT_DATE_FORMATTED = '2021-07-23T17:33:27Z'; - public const STATUS = 'NEW'; - public const URL = 'https://example.com'; - public const MODEL_TYPE_ID = 123; - public const MODEL_STATUS_ID = 0; - - protected function getPackageProviders($app): array - { - return [TestServiceProvider::class]; - } - - protected function getEnvironmentSetup($app) - { - $app->useEnvironmentPath(__DIR__ . '/../'); - $app->bootstrapWith([LoadEnvironmentVariables::class]); - - /** @var \Illuminate\Config\Repository $config */ - $config = $app['config']; - - $config->set('cashier.payment.model', $this->model); - - $config->set('cashier.payment.map', [ - self::MODEL_TYPE_ID => 'driver_name', - ]); - - $config->set('cashier.drivers.driver_name', [ - DriverConstant::DRIVER => Driver::class, - DriverConstant::DETAILS => Model::class, - - DriverConstant::CLIENT_ID => env('CASHIER_BANK_TECHNOLOGY_CLIENT_ID'), - DriverConstant::CLIENT_SECRET => env('CASHIER_BANK_TECHNOLOGY_CLIENT_SECRET'), - ]); - } - - protected function model(?Details $details = null): ReadyPayment - { - $model = PaymentConfig::getModel(); - - $payment = new $model(); - - $cashier = $this->detailsRelation($payment, $details); - - return $payment->setRelation('cashier', $cashier); - } - - protected function detailsRelation(EloquentModel $model, ?Details $details): CashierDetail - { - $details = new CashierDetail([ - 'item_type' => ReadyPayment::class, - - 'item_id' => self::PAYMENT_ID, - 'external_id' => self::PAYMENT_EXTERNAL_ID, - - 'details' => $details, - ]); - - return $details->setRelation('parent', $model); - } - - /** - * @param \Cashbox\BankName\Technology\Requests\BaseRequest|string $request - */ - protected function request(string $request): Request - { - $model = $this->modelRequest(); - - return $request::make($model); - } - - protected function modelRequest(): Model - { - return Model::make($this->model(), $this->config()); - } - - protected function config(): DriverConfig - { - $config = config('cashier.drivers.driver_name'); - - return DriverConfig::make($config); - } - - protected function getTerminalKey(): string - { - return config('cashier.drivers.driver_name.client_id'); - } - - protected function getTerminalSecret(): string - { - return config('cashier.drivers.driver_name.client_secret'); - } -} diff --git a/src/SberOnline/tests/database/migrations/2021_05_26_000000_create_payments_table.php b/src/SberOnline/tests/database/migrations/2021_05_26_000000_create_payments_table.php deleted file mode 100644 index a37e8827..00000000 --- a/src/SberOnline/tests/database/migrations/2021_05_26_000000_create_payments_table.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; - -class CreatePaymentsTable extends Migration -{ - protected $table = 'payments'; - - public function up() - { - Schema::create($this->table, function (Blueprint $table) { - $table->uuid('uuid'); - - $table->smallInteger('type_id'); - $table->smallInteger('status_id'); - - $table->double('sum', 10, 2)->default(0); - - $table->smallInteger('currency'); - - $table->timestamps(); - }); - } - - public function down() - { - Schema::dropIfExists($this->table); - } -} diff --git a/src/SberQrCode/tests/Concerns/Database.php b/src/SberQrCode/tests/Concerns/Database.php deleted file mode 100644 index bd0b6ce8..00000000 --- a/src/SberQrCode/tests/Concerns/Database.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Concerns; - -use Illuminate\Database\Eloquent\Model; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Tests\Fixtures\Models\ReadyPayment; -use Tests\TestCase; - -trait Database -{ - use RefreshDatabase; - - /** @var \Illuminate\Database\Eloquent\Model|string */ - protected $model = ReadyPayment::class; - - protected function payment(): Model - { - $model = $this->model; - - return $model::create([ - 'type_id' => TestCase::MODEL_TYPE_ID, - 'status_id' => TestCase::MODEL_STATUS_ID, - - 'sum' => TestCase::PAYMENT_SUM, - 'currency' => TestCase::CURRENCY, - ]); - } -} diff --git a/src/SberQrCode/tests/Concerns/TestServiceProvider.php b/src/SberQrCode/tests/Concerns/TestServiceProvider.php deleted file mode 100644 index f5ce1126..00000000 --- a/src/SberQrCode/tests/Concerns/TestServiceProvider.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Concerns; - -use Cashbox\Core\Providers\ServiceProvider; - -class TestServiceProvider extends ServiceProvider -{ - protected function bootMigrations(): void - { - $this->loadMigrationsFrom([ - __DIR__ . '/../database/migrations', - __DIR__ . '/../../vendor/cashbox/core/database/migrations/main', - ]); - } -} diff --git a/src/SberQrCode/tests/DriverTest.php b/src/SberQrCode/tests/DriverTest.php deleted file mode 100644 index a6acca53..00000000 --- a/src/SberQrCode/tests/DriverTest.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Core\Http\ResponseInfo; -use Cashbox\Core\Services\Jobs; -use Cashbox\Sber\QrCode\Driver as QR; -use DragonCode\Contracts\Cashier\Driver as DriverContract; -use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Database\Eloquent\Model; -use Tests\Fixtures\Models\RequestPayment; - -class DriverTest extends TestCase -{ - protected $model = RequestPayment::class; - - public function testStart() - { - $payment = $this->payment(); - - $response = $this->driver($payment)->start(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertSame(self::STATUS, $response->getStatus()); - - $this->assertTrue(Url::is($response->getUrl())); - } - - public function testCheck() - { - $payment = $this->payment(); - - Jobs::make($payment)->start(); - - $response = $this->driver($payment)->check(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertSame('PAID', $response->getStatus()); - - $this->assertSame([ - 'operation_id' => '10001HFYYR8956637', - - 'status' => 'PAID', - ], $response->toArray()); - } - - public function testRefund() - { - $payment = $this->payment(); - - Jobs::make($payment)->start(); - Jobs::make($payment)->check(true); - - $response = $this->driver($payment)->refund(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertSame('REVERSED', $response->getStatus()); - } - - protected function driver(Model $payment): DriverContract - { - $config = $this->config(); - - return QR::make($config, $payment); - } -} diff --git a/src/SberQrCode/tests/Fixtures/Models/ReadyPayment.php b/src/SberQrCode/tests/Fixtures/Models/ReadyPayment.php deleted file mode 100644 index 6d7d21ec..00000000 --- a/src/SberQrCode/tests/Fixtures/Models/ReadyPayment.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $uuid; - */ -class ReadyPayment extends UuidModel -{ - use Billable; - - protected function getUuidAttribute(): string - { - return TestCase::PAYMENT_ID; - } - - protected function getTypeIdAttribute(): int - { - return TestCase::MODEL_TYPE_ID; - } - - protected function getStatusIdAttribute(): int - { - return TestCase::MODEL_STATUS_ID; - } - - protected function getSumAttribute(): float - { - return TestCase::PAYMENT_SUM; - } - - protected function getCurrencyAttribute(): string - { - return TestCase::CURRENCY; - } - - protected function getCreatedAtAttribute(): Carbon - { - return Carbon::parse(TestCase::PAYMENT_DATE); - } -} diff --git a/src/SberQrCode/tests/Fixtures/Models/RequestPayment.php b/src/SberQrCode/tests/Fixtures/Models/RequestPayment.php deleted file mode 100644 index 190a616d..00000000 --- a/src/SberQrCode/tests/Fixtures/Models/RequestPayment.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $id; - */ -class RequestPayment extends UuidModel -{ - use Billable; - - protected $table = 'payments'; - - protected $fillable = ['type_id', 'status_id', 'sum', 'currency']; - - protected $casts = [ - 'type_id' => 'integer', - 'status_id' => 'integer', - - 'sum' => 'float', - ]; -} diff --git a/src/SberQrCode/tests/Fixtures/Models/StatusPayment.php b/src/SberQrCode/tests/Fixtures/Models/StatusPayment.php deleted file mode 100644 index ff74c411..00000000 --- a/src/SberQrCode/tests/Fixtures/Models/StatusPayment.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $uuid; - */ -class StatusPayment extends UuidModel -{ - use Billable; - - protected function getUuidAttribute(): string - { - return TestCase::PAYMENT_ID; - } - - protected function getTypeIdAttribute(): int - { - return TestCase::MODEL_TYPE_ID; - } - - protected function getSumAttribute(): float - { - return TestCase::PAYMENT_SUM; - } - - protected function getCurrencyAttribute(): string - { - return TestCase::CURRENCY; - } - - protected function getCreatedAtAttribute(): Carbon - { - return Carbon::parse(TestCase::PAYMENT_DATE); - } -} diff --git a/src/SberQrCode/tests/Fixtures/Resources/Model.php b/src/SberQrCode/tests/Fixtures/Resources/Model.php deleted file mode 100644 index 1e719f2c..00000000 --- a/src/SberQrCode/tests/Fixtures/Resources/Model.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Resources; - -use Cashbox\Sber\QrCode\Resources\Model as BaseModel; -use Illuminate\Support\Carbon; - -/** @property \Tests\Fixtures\Models\ReadyPayment $model */ -class Model extends BaseModel -{ - public function getMemberId(): string - { - return config('cashier.drivers.sber_qr.member_id'); - } - - public function getTerminalId(): string - { - return config('cashier.drivers.sber_qr.terminal_id'); - } - - public function getCertificatePath(): ?string - { - return config('cashier.drivers.sber_qr.certificate_path'); - } - - public function getCertificatePassword(): ?string - { - return config('cashier.drivers.sber_qr.certificate_password'); - } - - protected function paymentId(): string - { - return $this->model->uuid; - } - - protected function sum(): float - { - return $this->model->sum; - } - - protected function currency(): string - { - return $this->model->currency; - } - - protected function createdAt(): Carbon - { - return $this->model->created_at; - } -} diff --git a/src/SberQrCode/tests/Helpers/ExceptionTest.php b/src/SberQrCode/tests/Helpers/ExceptionTest.php deleted file mode 100644 index 53d9b898..00000000 --- a/src/SberQrCode/tests/Helpers/ExceptionTest.php +++ /dev/null @@ -1,134 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\Core\Exceptions\Http\BadRequestClientException; -use Cashbox\Core\Exceptions\Http\BankInternalErrorException; -use Cashbox\Core\Exceptions\Http\BaseException; -use Cashbox\Sber\QrCode\Exceptions\Manager; -use DragonCode\Contracts\Http\Builder as HttpBuilder; -use DragonCode\Support\Facades\Http\Builder; -use Tests\TestCase; - -class ExceptionTest extends TestCase -{ - public function test400() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw(400); - } - - public function test400String() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw('400'); - } - - public function test400Reason() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(400); - - $this->throw(400, 'Foo Bar'); - } - - public function test500() - { - $this->expectException(BankInternalErrorException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Internal error of the bank system'); - $this->expectExceptionCode(400); - - $this->throw(500); - } - - public function test500String() - { - $this->expectException(BankInternalErrorException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Internal error of the bank system'); - $this->expectExceptionCode(400); - - $this->throw('500'); - } - - public function test500Reason() - { - $this->expectException(BankInternalErrorException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(400); - - $this->throw(500, 'Foo Bar'); - } - - public function testDefault() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw(10000); - } - - public function testDefaultString() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw('10000'); - } - - public function testDefaultReason() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(400); - - $this->throw(10000, 'Foo Bar'); - } - - protected function throw($code, ?string $reason = null) - { - $this->manager()->throw($this->uri(), $code, [ - 'Message' => $reason, - ]); - } - - protected function uri(): HttpBuilder - { - return Builder::parse('https://example.com/foo'); - } - - protected function manager(): Manager - { - return new Manager(); - } -} diff --git a/src/SberQrCode/tests/Helpers/StatusesTest.php b/src/SberQrCode/tests/Helpers/StatusesTest.php deleted file mode 100644 index 4caf8e17..00000000 --- a/src/SberQrCode/tests/Helpers/StatusesTest.php +++ /dev/null @@ -1,170 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\Sber\QrCode\Helpers\Statuses; -use Cashbox\Sber\QrCode\Resources\Details; -use Tests\Fixtures\Models\StatusPayment; -use Tests\TestCase; - -class StatusesTest extends TestCase -{ - protected $model = StatusPayment::class; - - public function testHasCreated() - { - $this->assertTrue($this->status('CREATED')->hasCreated()); - - $this->assertFalse($this->status('REVERSED', 3)->hasCreated()); - $this->assertFalse($this->status('REFUNDED', 3)->hasCreated()); - $this->assertFalse($this->status('REVOKED', 3)->hasCreated()); - - $this->assertFalse($this->status('PAID', 1)->hasCreated()); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasCreated()); - - $this->assertTrue($this->status('UNKNOWN', 7)->hasCreated('CREATED')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasCreated('REVERSED')); - $this->assertFalse($this->status('UNKNOWN', 7)->hasCreated('REFUNDED')); - $this->assertFalse($this->status('UNKNOWN', 7)->hasCreated('REVOKED')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasCreated('PAID')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasCreated('UNKNOWN')); - } - - public function testHasSuccess() - { - $this->assertFalse($this->status('CREATED')->hasSuccess()); - - $this->assertFalse($this->status('REVERSED', 3)->hasSuccess()); - $this->assertFalse($this->status('REFUNDED', 3)->hasSuccess()); - $this->assertFalse($this->status('REVOKED', 3)->hasSuccess()); - - $this->assertTrue($this->status('PAID', 1)->hasSuccess()); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasSuccess()); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasSuccess('CREATED')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasSuccess('REVERSED')); - $this->assertFalse($this->status('UNKNOWN', 7)->hasSuccess('REFUNDED')); - $this->assertFalse($this->status('UNKNOWN', 7)->hasSuccess('REVOKED')); - - $this->assertTrue($this->status('UNKNOWN', 7)->hasSuccess('PAID')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasSuccess('UNKNOWN')); - } - - public function testHasFailed() - { - $this->assertFalse($this->status('CREATED')->hasFailed()); - - $this->assertFalse($this->status('REVERSED', 3)->hasFailed()); - $this->assertFalse($this->status('REFUNDED', 3)->hasFailed()); - $this->assertFalse($this->status('REVOKED', 3)->hasFailed()); - - $this->assertFalse($this->status('PAID', 1)->hasFailed()); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasFailed()); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasFailed('CREATED')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasFailed('REVERSED')); - $this->assertFalse($this->status('UNKNOWN', 7)->hasFailed('REFUNDED')); - $this->assertFalse($this->status('UNKNOWN', 7)->hasFailed('REVOKED')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasFailed('PAID')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasFailed('UNKNOWN')); - } - - public function testHasRefunding() - { - $this->assertFalse($this->status('CREATED')->hasRefunding()); - - $this->assertFalse($this->status('REVERSED', 3)->hasRefunding()); - $this->assertFalse($this->status('REFUNDED', 3)->hasRefunding()); - $this->assertFalse($this->status('REVOKED', 3)->hasRefunding()); - - $this->assertFalse($this->status('PAID', 1)->hasRefunding()); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasRefunding()); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasRefunding('CREATED')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasRefunding('REVERSED')); - $this->assertFalse($this->status('UNKNOWN', 7)->hasRefunding('REFUNDED')); - $this->assertFalse($this->status('UNKNOWN', 7)->hasRefunding('REVOKED')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasRefunding('PAID')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasRefunding('UNKNOWN')); - } - - public function testHasRefunded() - { - $this->assertFalse($this->status('CREATED')->hasRefunded()); - - $this->assertTrue($this->status('REVERSED', 3)->hasRefunded()); - $this->assertTrue($this->status('REFUNDED', 3)->hasRefunded()); - $this->assertTrue($this->status('REVOKED', 3)->hasRefunded()); - - $this->assertFalse($this->status('PAID', 1)->hasRefunded()); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasRefunded()); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasRefunded('CREATED')); - - $this->assertTrue($this->status('UNKNOWN', 7)->hasRefunded('REVERSED')); - $this->assertTrue($this->status('UNKNOWN', 7)->hasRefunded('REFUNDED')); - $this->assertTrue($this->status('UNKNOWN', 7)->hasRefunded('REVOKED')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasRefunded('PAID')); - - $this->assertFalse($this->status('UNKNOWN', 7)->hasRefunded('UNKNOWN')); - } - - public function testInProgress() - { - $this->assertTrue($this->status('CREATED')->inProgress()); - - $this->assertFalse($this->status('REVERSED', 3)->inProgress()); - $this->assertFalse($this->status('REFUNDED', 3)->inProgress()); - $this->assertFalse($this->status('REVOKED', 3)->inProgress()); - - $this->assertFalse($this->status('PAID', 1)->inProgress()); - - $this->assertTrue($this->status('UNKNOWN', 7)->inProgress()); - $this->assertTrue($this->status('UNKNOWN', 7)->inProgress('CREATED')); - - $this->assertFalse($this->status('UNKNOWN', 7)->inProgress('REVERSED')); - $this->assertFalse($this->status('UNKNOWN', 7)->inProgress('REFUNDED')); - $this->assertFalse($this->status('UNKNOWN', 7)->inProgress('REVOKED')); - - $this->assertFalse($this->status('UNKNOWN', 7)->inProgress('PAID')); - - $this->assertTrue($this->status('UNKNOWN', 7)->inProgress('UNKNOWN')); - } - - protected function status(string $name, int $status_id = 0): Statuses - { - $details = Details::make(compact('name')); - - return Statuses::make($this->model($details, $status_id)); - } -} diff --git a/src/SberQrCode/tests/Jobs/JobsTest.php b/src/SberQrCode/tests/Jobs/JobsTest.php deleted file mode 100644 index db545dfb..00000000 --- a/src/SberQrCode/tests/Jobs/JobsTest.php +++ /dev/null @@ -1,116 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Jobs; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Services\Jobs; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Support\Facades\DB; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class JobsTest extends TestCase -{ - protected $model = RequestPayment::class; - - protected $pre_payment = false; - - public function testStart() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('CREATED', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - public function testCheck() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - Jobs::make($payment)->check(true); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertNull($payment->cashbox->details->getUrl()); - - $this->assertSame('PAID', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), - $payment->status_id - ); - } - - public function testRefund() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - - Jobs::make($payment)->start(); - Jobs::make($payment)->refund(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertSame('REVERSED', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::REFUND), - $payment->status_id - ); - } -} diff --git a/src/SberQrCode/tests/Observers/ObserverTest.php b/src/SberQrCode/tests/Observers/ObserverTest.php deleted file mode 100644 index b4b0012e..00000000 --- a/src/SberQrCode/tests/Observers/ObserverTest.php +++ /dev/null @@ -1,101 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Observers; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Providers\ObserverServiceProvider; -use Illuminate\Support\Facades\DB; -use Tests\Concerns\TestServiceProvider; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class ObserverTest extends TestCase -{ - protected $model = RequestPayment::class; - - public function testCreate() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment()->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertNull($payment->cashbox->details->getUrl()); - - $this->assertSame('PAID', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), - $payment->status_id - ); - } - - public function testUpdate() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment()->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertSame('PAID', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), - $payment->status_id - ); - - $payment->update([ - 'sum' => 34.56, - ]); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertNull($payment->cashbox->details->getUrl()); - - $this->assertSame('PAID', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::SUCCESS), - $payment->status_id - ); - } - - protected function getPackageProviders($app): array - { - return [ - TestServiceProvider::class, - ObserverServiceProvider::class, - ]; - } -} diff --git a/src/SberQrCode/tests/Requests/CancelTest.php b/src/SberQrCode/tests/Requests/CancelTest.php deleted file mode 100644 index ceef84b7..00000000 --- a/src/SberQrCode/tests/Requests/CancelTest.php +++ /dev/null @@ -1,107 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Core\Http\Request; -use Cashbox\Sber\QrCode\Constants\Body; -use Cashbox\Sber\QrCode\Requests\Cancel; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use DragonCode\Support\Facades\Helpers\Arr; -use Tests\TestCase; - -class CancelTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Cancel::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://dev.api.sberbank.ru/ru/prod/order/v1/cancel', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(Cancel::class); - - $headers = $request->headers(); - - $this->assertIsArray($headers); - - $this->assertArrayHasKey('Accept', $headers); - $this->assertArrayHasKey('Content-Type', $headers); - $this->assertArrayHasKey('X-IBM-Client-Id', $headers); - $this->assertArrayHasKey('Authorization', $headers); - $this->assertArrayHasKey('x-Introspect-RqUID', $headers); - - $this->assertSame('application/json', Arr::get($headers, 'Accept')); - $this->assertSame('application/json', Arr::get($headers, 'Content-Type')); - - $this->assertSame($this->getClientId(), Arr::get($headers, 'X-IBM-Client-Id')); - } - - public function testGetRawHeaders() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(Cancel::class); - - $body = $request->body(); - - $this->assertIsArray($body); - - $this->assertArrayHasKey(Body::REQUEST_ID, $body); - $this->assertArrayHasKey(Body::REQUEST_TIME, $body); - $this->assertArrayHasKey(Body::EXTERNAL_ID, $body); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, Arr::get($body, Body::EXTERNAL_ID)); - } - - public function testGetRawBody() - { - $request = $this->request(Cancel::class); - - $body = $request->getRawBody(); - - $this->assertIsArray($body); - - $this->assertArrayHasKey(Body::REQUEST_ID, $body); - $this->assertArrayHasKey(Body::REQUEST_TIME, $body); - $this->assertArrayHasKey(Body::EXTERNAL_ID, $body); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, Arr::get($body, Body::EXTERNAL_ID)); - } -} diff --git a/src/SberQrCode/tests/Requests/GetQRTest.php b/src/SberQrCode/tests/Requests/GetQRTest.php deleted file mode 100644 index c8964b3a..00000000 --- a/src/SberQrCode/tests/Requests/GetQRTest.php +++ /dev/null @@ -1,117 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Core\Http\Request; -use Cashbox\Sber\QrCode\Constants\Body; -use Cashbox\Sber\QrCode\Requests\Create; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use DragonCode\Support\Facades\Helpers\Arr; -use Tests\TestCase; - -class GetQRTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Create::class); - - $this->assertInstanceOf(Create::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(Create::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://dev.api.sberbank.ru/ru/prod/order/v1/creation', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(Create::class); - - $headers = $request->headers(); - - $this->assertIsArray($headers); - - $this->assertArrayHasKey('Accept', $headers); - $this->assertArrayHasKey('Content-Type', $headers); - $this->assertArrayHasKey('X-IBM-Client-Id', $headers); - $this->assertArrayHasKey('Authorization', $headers); - $this->assertArrayHasKey('x-Introspect-RqUID', $headers); - - $this->assertSame('application/json', Arr::get($headers, 'Accept')); - $this->assertSame('application/json', Arr::get($headers, 'Content-Type')); - - $this->assertSame($this->getClientId(), Arr::get($headers, 'X-IBM-Client-Id')); - } - - public function testGetRawHeaders() - { - $request = $this->request(Create::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(Create::class); - - $body = $request->body(); - - $this->assertIsArray($body); - - $this->assertArrayHasKey(Body::REQUEST_ID, $body); - $this->assertArrayHasKey(Body::REQUEST_TIME, $body); - - $this->assertArrayHasKey(Body::MEMBER_ID, $body); - $this->assertArrayHasKey(Body::TERMINAL_ID, $body); - - $this->assertArrayHasKey(Body::ORDER_ID, $body); - $this->assertArrayHasKey(Body::ORDER_SUM, $body); - $this->assertArrayHasKey(Body::ORDER_CURRENCY, $body); - $this->assertArrayHasKey(Body::ORDER_CREATED_AT, $body); - } - - public function testGetRawBody() - { - $request = $this->request(Create::class); - - $body = $request->getRawBody(); - - $this->assertIsArray($body); - - $this->assertArrayHasKey(Body::REQUEST_ID, $body); - $this->assertArrayHasKey(Body::REQUEST_TIME, $body); - - $this->assertArrayHasKey(Body::MEMBER_ID, $body); - $this->assertArrayHasKey(Body::TERMINAL_ID, $body); - - $this->assertArrayHasKey(Body::ORDER_ID, $body); - $this->assertArrayHasKey(Body::ORDER_SUM, $body); - $this->assertArrayHasKey(Body::ORDER_CURRENCY, $body); - $this->assertArrayHasKey(Body::ORDER_CREATED_AT, $body); - } -} diff --git a/src/SberQrCode/tests/Resources/DetailsTest.php b/src/SberQrCode/tests/Resources/DetailsTest.php deleted file mode 100644 index 619c3eba..00000000 --- a/src/SberQrCode/tests/Resources/DetailsTest.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Resources; - -use Cashbox\Core\Resources\Details as BaseDetails; -use Cashbox\Sber\QrCode\Resources\Details; -use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; -use Tests\TestCase; - -class DetailsTest extends TestCase -{ - protected $expected = [ - 'status' => self::STATUS, - 'url' => self::URL, - ]; - - public function testMake() - { - $details = $this->details(); - - $this->assertInstanceOf(Details::class, $details); - $this->assertInstanceOf(BaseDetails::class, $details); - $this->assertInstanceOf(DetailsContract::class, $details); - } - - public function testGetUrl() - { - $details = $this->details(); - - $this->assertSame(self::URL, $details->getUrl()); - } - - public function testGetStatus() - { - $details = $this->details(); - - $this->assertSame(self::STATUS, $details->getStatus()); - } - - public function testToArray() - { - $details = $this->details(); - - $this->assertSame($this->expected, $details->toArray()); - } - - public function testToJson() - { - $details = $this->details(); - - $this->assertJson($details->toJson()); - - $this->assertSame(json_encode($this->expected), $details->toJson()); - } - - protected function details(): Details - { - return Details::make($this->expected); - } -} diff --git a/src/SberQrCode/tests/Responses/QrCodeTest.php b/src/SberQrCode/tests/Responses/QrCodeTest.php deleted file mode 100644 index 54d1b19a..00000000 --- a/src/SberQrCode/tests/Responses/QrCodeTest.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Sber\QrCode\Responses\QrCode; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class QrCodeTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(QrCode::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testGetUrl() - { - $response = $this->response(); - - $this->assertSame(self::URL, $response->getUrl()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - QrCode::KEY_STATUS => self::STATUS, - QrCode::KEY_URL => self::URL, - ], $response->toArray()); - } - - /** - * @return \Cashbox\Sber\QrCode\Responses\QrCode|\DragonCode\Contracts\Cashier\Http\Response - */ - protected function response(): Response - { - return QrCode::make([ - 'status' => [ - 'order_id' => self::PAYMENT_EXTERNAL_ID, - 'order_state' => self::STATUS, - 'order_form_url' => self::URL, - 'error' => 0, - ], - ]); - } -} diff --git a/src/SberQrCode/tests/Responses/RefundTest.php b/src/SberQrCode/tests/Responses/RefundTest.php deleted file mode 100644 index a42fb811..00000000 --- a/src/SberQrCode/tests/Responses/RefundTest.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use Cashbox\Sber\QrCode\Responses\Cancel as CancelResponse; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class RefundTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(CancelResponse::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame('REVERSED', $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => 'REVERSED', - ], $response->toArray()); - } - - protected function response(): Response - { - return CancelResponse::make([ - 'status' => [ - 'order_id' => self::PAYMENT_EXTERNAL_ID, - 'order_status' => 'REVERSED', - 'error_code' => 0, - ], - ]); - } -} diff --git a/src/SberQrCode/tests/Responses/StatusTest.php b/src/SberQrCode/tests/Responses/StatusTest.php deleted file mode 100644 index 4fe7c803..00000000 --- a/src/SberQrCode/tests/Responses/StatusTest.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use Cashbox\Sber\QrCode\Responses\Status; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class StatusTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Status::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Status::make([ - 'status' => [ - 'order_id' => self::PAYMENT_EXTERNAL_ID, - 'order_state' => self::STATUS, - 'error' => 0, - ], - ]); - } -} diff --git a/src/SberQrCode/tests/TestCase.php b/src/SberQrCode/tests/TestCase.php deleted file mode 100644 index afa4b0c8..00000000 --- a/src/SberQrCode/tests/TestCase.php +++ /dev/null @@ -1,147 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Core\Config\Driver as DriverConfig; -use Cashbox\Core\Constants\Driver as DriverConstant; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Models\CashierDetail; -use Cashbox\Sber\QrCode\Driver; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\Details; -use Illuminate\Database\Eloquent\Model as EloquentModel; -use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; -use Orchestra\Testbench\TestCase as BaseTestCase; -use Tests\Concerns\Database; -use Tests\Concerns\TestServiceProvider; -use Tests\Fixtures\Resources\Model; - -abstract class TestCase extends BaseTestCase -{ - use Database; - - public const PAYMENT_EXTERNAL_ID = '456789'; - public const PAYMENT_ID = '1234567890'; - public const PAYMENT_SUM = 12.34; - public const PAYMENT_SUM_FORMATTED = 1234; - public const CURRENCY = 'RUB'; - public const CURRENCY_FORMATTED = '643'; - public const PAYMENT_DATE = '2021-07-23 17:33:27'; - public const PAYMENT_DATE_FORMATTED = '2021-07-23T17:33:27Z'; - public const STATUS = 'CREATED'; - public const URL = 'https://example.com'; - public const MODEL_TYPE_ID = 123; - public const MODEL_STATUS_ID = 0; - - protected function getPackageProviders($app): array - { - return [TestServiceProvider::class]; - } - - protected function getEnvironmentSetup($app) - { - $app->useEnvironmentPath(__DIR__ . '/../'); - $app->bootstrapWith([LoadEnvironmentVariables::class]); - - /** @var \Illuminate\Config\Repository $config */ - $config = $app['config']; - - $config->set('cashier.env', env('CASHIER_ENV', env('APP_ENV', 'testing'))); - - $config->set('cashier.payment.model', $this->model); - - $config->set('cashier.payment.map', [ - self::MODEL_TYPE_ID => 'sber_qr', - ]); - - $is_production = $config->get('cashier.env') === 'production'; - - $config->set('cashier.drivers.sber_qr', [ - DriverConstant::DRIVER => Driver::class, - DriverConstant::DETAILS => Model::class, - - DriverConstant::CLIENT_ID => env('CASHIER_SBER_QR_CLIENT_ID'), - DriverConstant::CLIENT_SECRET => env('CASHIER_SBER_QR_CLIENT_SECRET'), - - 'member_id' => env('CASHIER_SBER_QR_MEMBER_ID'), - 'terminal_id' => env('CASHIER_SBER_QR_TERMINAL_ID'), - - 'certificate_path' => $is_production ? realpath(__DIR__ . '/../sber.pem') : null, - - 'certificate_password' => $is_production ? env('CASHIER_SBER_QR_CERTIFICATE_PASSWORD') : null, - ]); - } - - protected function model(?Details $details = null, int $status_id = 0): EloquentModel - { - $model = PaymentConfig::getModel(); - - /** @var \Illuminate\Database\Eloquent\Model $payment */ - $payment = new $model(); - - $cashier = $this->detailsRelation($payment, $details); - - return $payment - ->setRelation('cashier', $cashier) - ->setAttribute('status_id', $status_id); - } - - protected function detailsRelation(EloquentModel $model, ?Details $details): CashierDetail - { - $details = new CashierDetail([ - 'item_type' => get_class($model), - - 'item_id' => self::PAYMENT_ID, - 'external_id' => self::PAYMENT_EXTERNAL_ID, - - 'details' => $details, - ]); - - return $details->setRelation('parent', $model); - } - - /** - * @param \Cashbox\Sber\QrCode\Requests\BaseRequest|string $request - */ - protected function request(string $request): Request - { - $model = $this->modelRequest(); - - return $request::make($model); - } - - protected function modelRequest(): Model - { - return Model::make($this->model(), $this->config()); - } - - protected function config(): DriverConfig - { - $config = config('cashier.drivers.sber_qr'); - - return DriverConfig::make($config); - } - - protected function getClientId(): string - { - return config('cashier.drivers.sber_qr.client_id'); - } - - protected function getClientSecret(): string - { - return config('cashier.drivers.sber_qr.client_secret'); - } -} diff --git a/src/SberQrCode/tests/database/migrations/2021_05_26_000000_create_payments_table.php b/src/SberQrCode/tests/database/migrations/2021_05_26_000000_create_payments_table.php deleted file mode 100644 index aa415dd4..00000000 --- a/src/SberQrCode/tests/database/migrations/2021_05_26_000000_create_payments_table.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; - -class CreatePaymentsTable extends Migration -{ - protected $table = 'payments'; - - public function up() - { - Schema::create($this->table, function (Blueprint $table) { - $table->uuid('uuid'); - - $table->smallInteger('type_id'); - $table->smallInteger('status_id'); - - $table->double('sum', 10, 2)->default(0); - - $table->string('currency'); - - $table->timestamps(); - }); - } - - public function down() - { - Schema::dropIfExists($this->table); - } -} diff --git a/src/TemplateDriver/tests/Concerns/Database.php b/src/TemplateDriver/tests/Concerns/Database.php deleted file mode 100644 index bd0b6ce8..00000000 --- a/src/TemplateDriver/tests/Concerns/Database.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Concerns; - -use Illuminate\Database\Eloquent\Model; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Tests\Fixtures\Models\ReadyPayment; -use Tests\TestCase; - -trait Database -{ - use RefreshDatabase; - - /** @var \Illuminate\Database\Eloquent\Model|string */ - protected $model = ReadyPayment::class; - - protected function payment(): Model - { - $model = $this->model; - - return $model::create([ - 'type_id' => TestCase::MODEL_TYPE_ID, - 'status_id' => TestCase::MODEL_STATUS_ID, - - 'sum' => TestCase::PAYMENT_SUM, - 'currency' => TestCase::CURRENCY, - ]); - } -} diff --git a/src/TemplateDriver/tests/Concerns/TestServiceProvider.php b/src/TemplateDriver/tests/Concerns/TestServiceProvider.php deleted file mode 100644 index f5ce1126..00000000 --- a/src/TemplateDriver/tests/Concerns/TestServiceProvider.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Concerns; - -use Cashbox\Core\Providers\ServiceProvider; - -class TestServiceProvider extends ServiceProvider -{ - protected function bootMigrations(): void - { - $this->loadMigrationsFrom([ - __DIR__ . '/../database/migrations', - __DIR__ . '/../../vendor/cashbox/core/database/migrations/main', - ]); - } -} diff --git a/src/TemplateDriver/tests/DriverTest.php b/src/TemplateDriver/tests/DriverTest.php deleted file mode 100644 index 00abdb6c..00000000 --- a/src/TemplateDriver/tests/DriverTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\BankName\Technology\Driver as Technology; -use Cashbox\Core\Http\ResponseInfo; -use Cashbox\Core\Services\Jobs; -use DragonCode\Contracts\Cashier\Driver as DriverContract; -use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Database\Eloquent\Model; -use Tests\Fixtures\Models\RequestPayment; - -class DriverTest extends TestCase -{ - protected $model = RequestPayment::class; - - public function testStart() - { - $payment = $this->payment(); - - $response = $this->driver($payment)->start(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertNull($response->getStatus()); - - $this->assertTrue(Url::is($response->getUrl())); - } - - public function testCheck() - { - $payment = $this->payment(); - - Jobs::make($payment)->start(); - - $response = $this->driver($payment)->check(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertSame('FORM_SHOWED', $response->getStatus()); - - $this->assertSame([ - 'status' => 'FORM_SHOWED', - ], $response->toArray()); - } - - public function testRefund() - { - $payment = $this->payment(); - - Jobs::make($payment)->start(); - Jobs::make($payment)->check(true); - - $response = $this->driver($payment)->refund(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertSame('CANCELED', $response->getStatus()); - } - - protected function driver(Model $payment): DriverContract - { - $config = $this->config(); - - return Technology::make($config, $payment); - } -} diff --git a/src/TemplateDriver/tests/Fixtures/Models/ReadyPayment.php b/src/TemplateDriver/tests/Fixtures/Models/ReadyPayment.php deleted file mode 100644 index c3cbcd9f..00000000 --- a/src/TemplateDriver/tests/Fixtures/Models/ReadyPayment.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $uuid; - */ -class ReadyPayment extends UuidModel -{ - use Billable; - - protected function getUuidAttribute(): string - { - return TestCase::PAYMENT_ID; - } - - protected function getTypeIdAttribute(): int - { - return TestCase::MODEL_TYPE_ID; - } - - protected function getStatusIdAttribute(): int - { - return TestCase::MODEL_STATUS_ID; - } - - protected function getSumAttribute(): float - { - return TestCase::PAYMENT_SUM; - } - - protected function getCurrencyAttribute(): int - { - return TestCase::CURRENCY; - } - - protected function getCreatedAtAttribute(): Carbon - { - return Carbon::parse(TestCase::PAYMENT_DATE); - } -} diff --git a/src/TemplateDriver/tests/Fixtures/Models/RequestPayment.php b/src/TemplateDriver/tests/Fixtures/Models/RequestPayment.php deleted file mode 100644 index f19ecd52..00000000 --- a/src/TemplateDriver/tests/Fixtures/Models/RequestPayment.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $id; - */ -class RequestPayment extends UuidModel -{ - use Billable; - - protected $table = 'payments'; - - protected $fillable = ['type_id', 'status_id', 'sum', 'currency']; - - protected $casts = [ - 'type_id' => 'integer', - 'status_id' => 'integer', - - 'sum' => 'float', - 'currency' => 'integer', - ]; -} diff --git a/src/TemplateDriver/tests/Fixtures/Resources/Model.php b/src/TemplateDriver/tests/Fixtures/Resources/Model.php deleted file mode 100644 index 3328e3b7..00000000 --- a/src/TemplateDriver/tests/Fixtures/Resources/Model.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Resources; - -use Cashbox\Core\Resources\Model as BaseModel; -use Illuminate\Support\Carbon; - -/** @property \Tests\Fixtures\Models\ReadyPayment $model */ -class Model extends BaseModel -{ - protected function paymentId(): string - { - return $this->model->uuid; - } - - protected function sum(): float - { - return $this->model->sum; - } - - protected function currency(): int - { - return $this->model->currency; - } - - protected function createdAt(): Carbon - { - return $this->model->created_at; - } -} diff --git a/src/TemplateDriver/tests/Helpers/ExceptionTest.php b/src/TemplateDriver/tests/Helpers/ExceptionTest.php deleted file mode 100644 index 59630498..00000000 --- a/src/TemplateDriver/tests/Helpers/ExceptionTest.php +++ /dev/null @@ -1,135 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\BankName\Technology\Exceptions\Manager; -use Cashbox\Core\Exceptions\Http\BadRequestClientException; -use Cashbox\Core\Exceptions\Http\BaseException; -use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; -use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; -use DragonCode\Contracts\Http\Builder as HttpBuilder; -use DragonCode\Support\Facades\Http\Builder; -use Tests\TestCase; - -class ExceptionTest extends TestCase -{ - public function test7() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Buyer Not Found'); - $this->expectExceptionCode(404); - - $this->throw(7); - } - - public function test7String() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Buyer Not Found'); - $this->expectExceptionCode(404); - - $this->throw('7'); - } - - public function test7Reason() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(404); - - $this->throw(7, 'Foo Bar'); - } - - public function test53() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Contact The Seller'); - $this->expectExceptionCode(409); - - $this->throw(53); - } - - public function test53String() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Contact The Seller'); - $this->expectExceptionCode(409); - - $this->throw('53'); - } - - public function test53Reason() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(409); - - $this->throw(53, 'Foo Bar'); - } - - public function testDefault() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw(10000); - } - - public function testDefaultString() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw('10000'); - } - - public function testDefaultReason() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(400); - - $this->throw(10000, 'Foo Bar'); - } - - protected function throw($code, ?string $reason = null) - { - $this->manager()->throw($this->uri(), $code, [ - 'Message' => $reason, - ]); - } - - protected function uri(): HttpBuilder - { - return Builder::parse('https://example.com/foo'); - } - - protected function manager(): Manager - { - return new Manager(); - } -} diff --git a/src/TemplateDriver/tests/Helpers/StatusesTest.php b/src/TemplateDriver/tests/Helpers/StatusesTest.php deleted file mode 100644 index d0268b33..00000000 --- a/src/TemplateDriver/tests/Helpers/StatusesTest.php +++ /dev/null @@ -1,191 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\BankName\Technology\Helpers\Statuses; -use Cashbox\BankName\Technology\Resources\Details; -use Tests\TestCase; - -class StatusesTest extends TestCase -{ - public function testModel() - { - $this->assertTrue($this->status('NEW')->hasCreated()); - $this->assertTrue($this->status('NEW')->inProgress()); - - $this->assertFalse($this->status('NEW')->hasSuccess()); - $this->assertFalse($this->status('NEW')->hasFailed()); - $this->assertFalse($this->status('NEW')->hasRefunding()); - $this->assertFalse($this->status('NEW')->hasRefunded()); - } - - public function testHasCreated() - { - $this->assertTrue($this->status('FORM_SHOWED')->hasCreated('FORM_SHOWED')); - $this->assertTrue($this->status('NEW')->hasCreated('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasCreated('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasCreated('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasCreated('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasCreated('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasCreated('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasCreated('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasCreated('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasCreated('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasCreated('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasCreated('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasCreated('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasCreated('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasCreated('UNKNOWN')); - } - - public function testHasSuccess() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasSuccess('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasSuccess('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasSuccess('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasSuccess('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasSuccess('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasSuccess('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasSuccess('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasSuccess('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasSuccess('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasSuccess('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasSuccess('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasSuccess('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasSuccess('REJECTED')); - - $this->assertTrue($this->status('CONFIRMED')->hasSuccess('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasSuccess('UNKNOWN')); - } - - public function testHasFailed() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasFailed('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasFailed('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasFailed('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasFailed('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasFailed('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasFailed('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasFailed('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasFailed('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasFailed('REVERSED')); - - $this->assertTrue($this->status('ATTEMPTS_EXPIRED')->hasFailed('ATTEMPTS_EXPIRED')); - $this->assertTrue($this->status('CANCELED')->hasFailed('CANCELED')); - $this->assertTrue($this->status('DEADLINE_EXPIRED')->hasFailed('DEADLINE_EXPIRED')); - $this->assertTrue($this->status('REJECTED')->hasFailed('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasFailed('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasFailed('UNKNOWN')); - } - - public function testHasRefunding() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasRefunding('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasRefunding('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasRefunding('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasRefunding('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasRefunding('CONFIRMING')); - - $this->assertTrue($this->status('REFUNDING')->hasRefunding('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasRefunding('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasRefunding('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasRefunding('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasRefunding('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasRefunding('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasRefunding('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasRefunding('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasRefunding('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasRefunding('UNKNOWN')); - } - - public function testHasRefunded() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasRefunded('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasRefunded('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasRefunded('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasRefunded('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasRefunded('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasRefunded('REFUNDING')); - - $this->assertTrue($this->status('PARTIAL_REFUNDED')->hasRefunded('PARTIAL_REFUNDED')); - $this->assertTrue($this->status('REFUNDED')->hasRefunded('REFUNDED')); - $this->assertTrue($this->status('REVERSED')->hasRefunded('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasRefunded('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasRefunded('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasRefunded('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasRefunded('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasRefunded('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasRefunded('UNKNOWN')); - } - - public function testInProgress() - { - $this->assertTrue($this->status('FORM_SHOWED')->inProgress('FORM_SHOWED')); - $this->assertTrue($this->status('NEW')->inProgress('NEW')); - - $this->assertTrue($this->status('AUTHORIZED')->inProgress('AUTHORIZED')); - $this->assertTrue($this->status('AUTHORIZING')->inProgress('AUTHORIZING')); - $this->assertTrue($this->status('CONFIRMING')->inProgress('CONFIRMING')); - - $this->assertTrue($this->status('REFUNDING')->inProgress('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->inProgress('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->inProgress('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->inProgress('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->inProgress('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->inProgress('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->inProgress('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->inProgress('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->inProgress('CONFIRMED')); - - $this->assertTrue($this->status('UNKNOWN')->inProgress('UNKNOWN')); - } - - protected function status(string $status): Statuses - { - $details = Details::make(compact('status')); - - return Statuses::make($this->model($details)); - } -} diff --git a/src/TemplateDriver/tests/Jobs/JobsTest.php b/src/TemplateDriver/tests/Jobs/JobsTest.php deleted file mode 100644 index 9c7e9786..00000000 --- a/src/TemplateDriver/tests/Jobs/JobsTest.php +++ /dev/null @@ -1,118 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Jobs; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Services\Jobs; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Illuminate\Support\Facades\DB; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class JobsTest extends TestCase -{ - use RefreshDatabase; - - protected $model = RequestPayment::class; - - public function testStart() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - public function testCheck() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - Jobs::make($payment)->check(true); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - public function testRefund() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - - Jobs::make($payment)->start(); - Jobs::make($payment)->refund(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertSame('CANCELED', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::REFUND), - $payment->status_id - ); - } -} diff --git a/src/TemplateDriver/tests/Observers/ObserverTest.php b/src/TemplateDriver/tests/Observers/ObserverTest.php deleted file mode 100644 index 51478f1a..00000000 --- a/src/TemplateDriver/tests/Observers/ObserverTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Observers; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Providers\ObserverServiceProvider; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Illuminate\Support\Facades\DB; -use Tests\Concerns\TestServiceProvider; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class ObserverTest extends TestCase -{ - use RefreshDatabase; - - protected $model = RequestPayment::class; - - protected function getPackageProviders($app): array - { - return [ - TestServiceProvider::class, - ObserverServiceProvider::class, - ]; - } - - public function testCreate(): Model - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment()->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - - return $payment; - } - - public function testUpdate() - { - $payment = $this->testCreate(); - - $payment->update([ - 'sum' => 34.56, - ]); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } -} diff --git a/src/TemplateDriver/tests/Requests/CancelTest.php b/src/TemplateDriver/tests/Requests/CancelTest.php deleted file mode 100644 index 788e5ee3..00000000 --- a/src/TemplateDriver/tests/Requests/CancelTest.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\BankName\Technology\Requests\Cancel; -use Cashbox\Core\Http\Request; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class CancelTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Cancel::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://dev.api-bank-uri.com/api/cancel', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - - 'TerminalKey' => $this->getTerminalKey(), - - 'Token' => '8473d8d4cafb9ec63071e9050c05e0dd1178fc8e1f3c765ffef7ec7fb5fcb758', - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - ], $request->getRawBody()); - } -} diff --git a/src/TemplateDriver/tests/Requests/GetStateTest.php b/src/TemplateDriver/tests/Requests/GetStateTest.php deleted file mode 100644 index 8a7caa6c..00000000 --- a/src/TemplateDriver/tests/Requests/GetStateTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\BankName\Technology\Requests\GetState; -use Cashbox\Core\Http\Request; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class GetStateTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(GetState::class); - - $this->assertInstanceOf(GetState::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(GetState::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://dev.api-bank-uri.com/api/status', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - - 'TerminalKey' => $this->getTerminalKey(), - - 'Token' => 'dbcbdf5539c35132b63c1b54e0f107cc96e71cf96040ba54dec5e140255b2e63', - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - ], $request->getRawBody()); - } -} diff --git a/src/TemplateDriver/tests/Requests/InitTest.php b/src/TemplateDriver/tests/Requests/InitTest.php deleted file mode 100644 index dc7ca321..00000000 --- a/src/TemplateDriver/tests/Requests/InitTest.php +++ /dev/null @@ -1,96 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\BankName\Technology\Requests\Init; -use Cashbox\Core\Http\Request; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class InitTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Init::class); - - $this->assertInstanceOf(Init::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(Init::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://dev.api-bank-uri.com/api/create', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'OrderId' => self::PAYMENT_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - 'Currency' => self::CURRENCY_FORMATTED, - - 'TerminalKey' => $this->getTerminalKey(), - 'Token' => $this->getTerminalSecret(), - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'OrderId' => self::PAYMENT_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - 'Currency' => self::CURRENCY_FORMATTED, - ], $request->getRawBody()); - } -} diff --git a/src/TemplateDriver/tests/Resources/DetailsTest.php b/src/TemplateDriver/tests/Resources/DetailsTest.php deleted file mode 100644 index efa173e0..00000000 --- a/src/TemplateDriver/tests/Resources/DetailsTest.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Resources; - -use Cashbox\BankName\Technology\Resources\Details; -use Cashbox\Core\Resources\Details as BaseDetails; -use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; -use Tests\TestCase; - -class DetailsTest extends TestCase -{ - protected $expected = [ - 'status' => self::STATUS, - 'url' => self::URL, - ]; - - public function testMake() - { - $details = $this->details(); - - $this->assertInstanceOf(Details::class, $details); - $this->assertInstanceOf(BaseDetails::class, $details); - $this->assertInstanceOf(DetailsContract::class, $details); - } - - public function testGetUrl() - { - $details = $this->details(); - - $this->assertSame(self::URL, $details->getUrl()); - } - - public function testGetStatus() - { - $details = $this->details(); - - $this->assertSame(self::STATUS, $details->getStatus()); - } - - public function testToArray() - { - $details = $this->details(); - - $this->assertSame($this->expected, $details->toArray()); - } - - public function testToJson() - { - $details = $this->details(); - - $this->assertJson($details->toJson()); - - $this->assertSame(json_encode($this->expected), $details->toJson()); - } - - protected function details(): Details - { - return Details::make($this->expected); - } -} diff --git a/src/TemplateDriver/tests/Responses/InitTest.php b/src/TemplateDriver/tests/Responses/InitTest.php deleted file mode 100644 index dd1d0dce..00000000 --- a/src/TemplateDriver/tests/Responses/InitTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\BankName\Technology\Responses\Created; -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class InitTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Created::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Created::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'Amount' => self::PAYMENT_SUM_FORMATTED, - 'OrderId' => self::PAYMENT_ID, - 'Success' => true, - 'Status' => self::STATUS, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'ErrorCode' => 0, - ]); - } -} diff --git a/src/TemplateDriver/tests/Responses/RefundTest.php b/src/TemplateDriver/tests/Responses/RefundTest.php deleted file mode 100644 index 5fb33e96..00000000 --- a/src/TemplateDriver/tests/Responses/RefundTest.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\BankName\Technology\Responses\Refund; -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class RefundTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Refund::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Refund::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'Success' => true, - 'Status' => self::STATUS, - 'ErrorCode' => 0, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'OrderId' => self::PAYMENT_ID, - ]); - } -} diff --git a/src/TemplateDriver/tests/Responses/StateTest.php b/src/TemplateDriver/tests/Responses/StateTest.php deleted file mode 100644 index 2cee5a9e..00000000 --- a/src/TemplateDriver/tests/Responses/StateTest.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\BankName\Technology\Responses\State; -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class StateTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(State::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return State::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'OrderId' => self::PAYMENT_ID, - 'Success' => true, - 'Status' => self::STATUS, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'ErrorCode' => 0, - ]); - } -} diff --git a/src/TemplateDriver/tests/TestCase.php b/src/TemplateDriver/tests/TestCase.php deleted file mode 100644 index e771194b..00000000 --- a/src/TemplateDriver/tests/TestCase.php +++ /dev/null @@ -1,134 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\BankName\Technology\Driver; -use Cashbox\Core\Config\Driver as DriverConfig; -use Cashbox\Core\Constants\Driver as DriverConstant; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Models\CashierDetail; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\Details; -use Illuminate\Database\Eloquent\Model as EloquentModel; -use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; -use Orchestra\Testbench\TestCase as BaseTestCase; -use Tests\Concerns\Database; -use Tests\Concerns\TestServiceProvider; -use Tests\Fixtures\Models\ReadyPayment; -use Tests\Fixtures\Resources\Model; - -abstract class TestCase extends BaseTestCase -{ - use Database; - - public const PAYMENT_EXTERNAL_ID = '456789'; - public const PAYMENT_ID = '1234567890'; - public const PAYMENT_SUM = 12.34; - public const PAYMENT_SUM_FORMATTED = 1234; - public const CURRENCY = 643; - public const CURRENCY_FORMATTED = '643'; - public const PAYMENT_DATE = '2021-07-23 17:33:27'; - public const PAYMENT_DATE_FORMATTED = '2021-07-23T17:33:27Z'; - public const STATUS = 'NEW'; - public const URL = 'https://example.com'; - public const MODEL_TYPE_ID = 123; - public const MODEL_STATUS_ID = 0; - - protected function getPackageProviders($app): array - { - return [TestServiceProvider::class]; - } - - protected function getEnvironmentSetup($app) - { - $app->useEnvironmentPath(__DIR__ . '/../'); - $app->bootstrapWith([LoadEnvironmentVariables::class]); - - /** @var \Illuminate\Config\Repository $config */ - $config = $app['config']; - - $config->set('cashier.payment.model', $this->model); - - $config->set('cashier.payment.map', [ - self::MODEL_TYPE_ID => 'driver_name', - ]); - - $config->set('cashier.drivers.driver_name', [ - DriverConstant::DRIVER => Driver::class, - DriverConstant::DETAILS => Model::class, - - DriverConstant::CLIENT_ID => env('CASHIER_BANK_TECHNOLOGY_CLIENT_ID'), - DriverConstant::CLIENT_SECRET => env('CASHIER_BANK_TECHNOLOGY_CLIENT_SECRET'), - ]); - } - - protected function model(?Details $details = null): ReadyPayment - { - $model = PaymentConfig::getModel(); - - $payment = new $model(); - - $cashier = $this->detailsRelation($payment, $details); - - return $payment->setRelation('cashier', $cashier); - } - - protected function detailsRelation(EloquentModel $model, ?Details $details): CashierDetail - { - $details = new CashierDetail([ - 'item_type' => ReadyPayment::class, - - 'item_id' => self::PAYMENT_ID, - 'external_id' => self::PAYMENT_EXTERNAL_ID, - - 'details' => $details, - ]); - - return $details->setRelation('parent', $model); - } - - /** - * @param \Cashbox\BankName\Technology\Requests\BaseRequest|string $request - */ - protected function request(string $request): Request - { - $model = $this->modelRequest(); - - return $request::make($model); - } - - protected function modelRequest(): Model - { - return Model::make($this->model(), $this->config()); - } - - protected function config(): DriverConfig - { - $config = config('cashier.drivers.driver_name'); - - return DriverConfig::make($config); - } - - protected function getTerminalKey(): string - { - return config('cashier.drivers.driver_name.client_id'); - } - - protected function getTerminalSecret(): string - { - return config('cashier.drivers.driver_name.client_secret'); - } -} diff --git a/src/TemplateDriver/tests/database/migrations/2021_05_26_000000_create_payments_table.php b/src/TemplateDriver/tests/database/migrations/2021_05_26_000000_create_payments_table.php deleted file mode 100644 index a37e8827..00000000 --- a/src/TemplateDriver/tests/database/migrations/2021_05_26_000000_create_payments_table.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; - -class CreatePaymentsTable extends Migration -{ - protected $table = 'payments'; - - public function up() - { - Schema::create($this->table, function (Blueprint $table) { - $table->uuid('uuid'); - - $table->smallInteger('type_id'); - $table->smallInteger('status_id'); - - $table->double('sum', 10, 2)->default(0); - - $table->smallInteger('currency'); - - $table->timestamps(); - }); - } - - public function down() - { - Schema::dropIfExists($this->table); - } -} diff --git a/src/TemplateDriverAuth/tests/Auth/BodyTest.php b/src/TemplateDriverAuth/tests/Auth/BodyTest.php deleted file mode 100644 index 014597e7..00000000 --- a/src/TemplateDriverAuth/tests/Auth/BodyTest.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Auth; - -use Cashbox\BankName\Auth\Auth; -use Tests\TestCase; - -class BodyTest extends TestCase -{ - public const TOKEN_HASH = '714bee21f51693eb5effb1895560f2a50dac0e795d5859a06b94bbdbe26faa1d'; - - public function testBasic() - { - $auth = Auth::make($this->model(), $this->request(), false); - - $this->assertIsArray($auth->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_ID, - 'Sum' => self::SUM_RESULT, - 'Currency' => self::CURRENCY_RESULT, - 'CreatedAt' => self::CREATED_AT_RESULT, - 'TerminalKey' => self::TERMINAL_KEY, - 'Token' => self::TOKEN, - ], $auth->body()); - } - - public function testHash() - { - $auth = Auth::make($this->model(), $this->request()); - - $this->assertIsArray($auth->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_ID, - 'Sum' => self::SUM_RESULT, - 'Currency' => self::CURRENCY_RESULT, - 'CreatedAt' => self::CREATED_AT_RESULT, - 'TerminalKey' => self::TERMINAL_KEY, - 'Token' => self::TOKEN_HASH, - ], $auth->body()); - } -} diff --git a/src/TemplateDriverAuth/tests/Auth/HeadersTest.php b/src/TemplateDriverAuth/tests/Auth/HeadersTest.php deleted file mode 100644 index 36e91242..00000000 --- a/src/TemplateDriverAuth/tests/Auth/HeadersTest.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Auth; - -use Cashbox\BankName\Auth\Auth; -use Tests\TestCase; - -class HeadersTest extends TestCase -{ - public function testBasic() - { - $auth = Auth::make($this->model(), $this->request(), false); - - $this->assertIsArray($auth->headers()); - - $this->assertSame(['Accept' => 'application/json'], $auth->headers()); - } - - public function testHash() - { - $auth = Auth::make($this->model(), $this->request()); - - $this->assertIsArray($auth->headers()); - - $this->assertSame(['Accept' => 'application/json'], $auth->headers()); - } -} diff --git a/src/TemplateDriverAuth/tests/Auth/MakeTest.php b/src/TemplateDriverAuth/tests/Auth/MakeTest.php deleted file mode 100644 index fd76c55b..00000000 --- a/src/TemplateDriverAuth/tests/Auth/MakeTest.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Auth; - -use Cashbox\BankName\Auth\Auth; -use DragonCode\Contracts\Cashier\Auth\Auth as AuthContract; -use Tests\TestCase; - -class MakeTest extends TestCase -{ - public function testMakeBasic() - { - $auth = Auth::make($this->model(), $this->request(), false); - - $this->assertInstanceOf(AuthContract::class, $auth); - } - - public function testMakeHash() - { - $auth = Auth::make($this->model(), $this->request()); - - $this->assertInstanceOf(AuthContract::class, $auth); - } - - public function testConstructBasic() - { - $auth = new Auth($this->model(), $this->request(), false); - - $this->assertInstanceOf(AuthContract::class, $auth); - } - - public function testConstructHash() - { - $auth = new Auth($this->model(), $this->request()); - - $this->assertInstanceOf(AuthContract::class, $auth); - } -} diff --git a/src/TemplateDriverAuth/tests/Fixtures/ModelEloquent.php b/src/TemplateDriverAuth/tests/Fixtures/ModelEloquent.php deleted file mode 100644 index 557983b0..00000000 --- a/src/TemplateDriverAuth/tests/Fixtures/ModelEloquent.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures; - -use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -/** - * @property string $client_id - * @property string $client_secret - * @property string $payment_id - * @property string $sum - * @property string $currency - * @property string $created_at - */ -class ModelEloquent extends Model -{ - public $timestamps = false; - - protected function getClientIdAttribute(): string - { - return TestCase::TERMINAL_KEY; - } - - protected function getClientSecretAttribute(): string - { - return TestCase::TOKEN; - } - - protected function getPaymentIdAttribute(): string - { - return TestCase::PAYMENT_ID; - } - - protected function getSumAttribute(): float - { - return TestCase::SUM; - } - - protected function getCurrencyAttribute(): string - { - return TestCase::CURRENCY; - } - - protected function getCreatedAtAttribute(): Carbon - { - return Carbon::parse(TestCase::CREATED_AT); - } -} diff --git a/src/TemplateDriverAuth/tests/Fixtures/ModelResource.php b/src/TemplateDriverAuth/tests/Fixtures/ModelResource.php deleted file mode 100644 index 45a14395..00000000 --- a/src/TemplateDriverAuth/tests/Fixtures/ModelResource.php +++ /dev/null @@ -1,55 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures; - -use Cashbox\Core\Resources\Model; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -class ModelResource extends Model -{ - protected function clientId(): string - { - return TestCase::TERMINAL_KEY; - } - - protected function clientSecret(): string - { - return TestCase::TOKEN; - } - - protected function paymentId(): string - { - return TestCase::PAYMENT_ID; - } - - protected function sum(): float - { - return TestCase::SUM; - } - - protected function currency(): string - { - return TestCase::CURRENCY; - } - - protected function createdAt(): Carbon - { - return Carbon::parse(TestCase::CREATED_AT); - } -} diff --git a/src/TemplateDriverAuth/tests/Fixtures/Request.php b/src/TemplateDriverAuth/tests/Fixtures/Request.php deleted file mode 100644 index b767089c..00000000 --- a/src/TemplateDriverAuth/tests/Fixtures/Request.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures; - -use Cashbox\Core\Http\Request as BaseRequest; - -class Request extends BaseRequest -{ - public function getRawHeaders(): array - { - return ['Accept' => 'application/json']; - } - - public function getRawBody(): array - { - return [ - 'PaymentId' => $this->model->getPaymentId(), - 'Sum' => $this->model->getSum(), - 'Currency' => $this->model->getCurrency(), - 'CreatedAt' => $this->model->getCreatedAt(), - ]; - } -} diff --git a/src/TemplateDriverAuth/tests/Resources/AccessToken/GetAccessTokenTest.php b/src/TemplateDriverAuth/tests/Resources/AccessToken/GetAccessTokenTest.php deleted file mode 100644 index ae7cac8f..00000000 --- a/src/TemplateDriverAuth/tests/Resources/AccessToken/GetAccessTokenTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Resources\AccessToken; - -use Cashbox\BankName\Auth\Resources\AccessToken; -use Tests\TestCase; - -class GetAccessTokenTest extends TestCase -{ - public function testBasic() - { - $token = AccessToken::make($this->credentials()); - - $this->assertSame(self::TOKEN, $token->getAccessToken()); - } - - public function testHashed() - { - $token = AccessToken::make($this->credentialsHash()); - - $this->assertSame(self::TOKEN_HASH, $token->getAccessToken()); - } -} diff --git a/src/TemplateDriverAuth/tests/Resources/AccessToken/GetClientIdTest.php b/src/TemplateDriverAuth/tests/Resources/AccessToken/GetClientIdTest.php deleted file mode 100644 index 7526c558..00000000 --- a/src/TemplateDriverAuth/tests/Resources/AccessToken/GetClientIdTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Resources\AccessToken; - -use Cashbox\BankName\Auth\Resources\AccessToken; -use Tests\TestCase; - -class GetClientIdTest extends TestCase -{ - public function testBasic() - { - $token = AccessToken::make($this->credentials()); - - $this->assertSame(self::TERMINAL_KEY, $token->getClientId()); - } - - public function testHashed() - { - $token = AccessToken::make($this->credentialsHash()); - - $this->assertSame(self::TERMINAL_KEY, $token->getClientId()); - } -} diff --git a/src/TemplateDriverAuth/tests/Resources/AccessToken/GetExpiresInTest.php b/src/TemplateDriverAuth/tests/Resources/AccessToken/GetExpiresInTest.php deleted file mode 100644 index fe49809e..00000000 --- a/src/TemplateDriverAuth/tests/Resources/AccessToken/GetExpiresInTest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Resources\AccessToken; - -use Carbon\Carbon as BaseCarbon; -use Cashbox\BankName\Auth\Resources\AccessToken; -use DateTimeInterface; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -class GetExpiresInTest extends TestCase -{ - public function testBasic() - { - $token = AccessToken::make($this->credentials()); - - $this->assertInstanceOf(Carbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(BaseCarbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(DateTimeInterface::class, $token->getExpiresIn()); - - $this->assertGreaterThan(Carbon::now(), $token->getExpiresIn()); - } - - public function testHashed() - { - $token = AccessToken::make($this->credentialsHash()); - - $this->assertInstanceOf(Carbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(BaseCarbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(DateTimeInterface::class, $token->getExpiresIn()); - - $this->assertGreaterThan(Carbon::now(), $token->getExpiresIn()); - } -} diff --git a/src/TemplateDriverAuth/tests/Resources/AccessToken/MakeTest.php b/src/TemplateDriverAuth/tests/Resources/AccessToken/MakeTest.php deleted file mode 100644 index 60b75463..00000000 --- a/src/TemplateDriverAuth/tests/Resources/AccessToken/MakeTest.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Resources\AccessToken; - -use Cashbox\BankName\Auth\Resources\AccessToken; -use DragonCode\Contracts\Cashier\Resources\AccessToken as AccessTokenContract; -use Tests\TestCase; - -class MakeTest extends TestCase -{ - public function testMake() - { - $token = AccessToken::make(); - - $this->assertInstanceOf(AccessTokenContract::class, $token); - } - - public function testConstruct() - { - $token = new AccessToken(); - - $this->assertInstanceOf(AccessTokenContract::class, $token); - } -} diff --git a/src/TemplateDriverAuth/tests/Support/Hash/GetTest.php b/src/TemplateDriverAuth/tests/Support/Hash/GetTest.php deleted file mode 100644 index 82c692be..00000000 --- a/src/TemplateDriverAuth/tests/Support/Hash/GetTest.php +++ /dev/null @@ -1,88 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Support\Hash; - -use Carbon\Carbon as BaseCarbon; -use Cashbox\BankName\Auth\Support\Hash; -use DateTimeInterface; -use DragonCode\Contracts\Cashier\Resources\AccessToken; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -class GetTest extends TestCase -{ - public function testBasic() - { - $model = $this->model(); - - $data = ['PaymentId' => self::PAYMENT_ID]; - - $token = Hash::make()->get($model, $data, false); - - $this->assertInstanceOf(AccessToken::class, $token); - - $this->assertSame(self::TERMINAL_KEY, $token->getClientId()); - $this->assertSame(self::TOKEN, $token->getAccessToken()); - - $this->assertInstanceOf(Carbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(BaseCarbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(DateTimeInterface::class, $token->getExpiresIn()); - - $this->assertGreaterThan(Carbon::now(), $token->getExpiresIn()); - } - - public function testHash() - { - $model = $this->model(); - - $data = ['PaymentId' => self::PAYMENT_ID]; - - $token = Hash::make()->get($model, $data); - - $this->assertInstanceOf(AccessToken::class, $token); - - $this->assertSame(self::TERMINAL_KEY, $token->getClientId()); - $this->assertSame(self::TOKEN_HASH, $token->getAccessToken()); - - $this->assertInstanceOf(Carbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(BaseCarbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(DateTimeInterface::class, $token->getExpiresIn()); - - $this->assertGreaterThan(Carbon::now(), $token->getExpiresIn()); - } - - public function testWrongHash() - { - $model = $this->model(); - - $data = ['PaymentId' => '123']; - - $token = Hash::make()->get($model, $data); - - $this->assertInstanceOf(AccessToken::class, $token); - - $this->assertSame(self::TERMINAL_KEY, $token->getClientId()); - $this->assertNotSame(self::TOKEN_HASH, $token->getAccessToken()); - - $this->assertInstanceOf(Carbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(BaseCarbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(DateTimeInterface::class, $token->getExpiresIn()); - - $this->assertGreaterThan(Carbon::now(), $token->getExpiresIn()); - } -} diff --git a/src/TemplateDriverAuth/tests/Support/Hash/MakeTest.php b/src/TemplateDriverAuth/tests/Support/Hash/MakeTest.php deleted file mode 100644 index 29901221..00000000 --- a/src/TemplateDriverAuth/tests/Support/Hash/MakeTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Support\Hash; - -use Cashbox\BankName\Auth\Support\Hash; -use Tests\TestCase; - -class MakeTest extends TestCase -{ - public function testMake() - { - $hash = Hash::make(); - - $this->assertInstanceOf(Hash::class, $hash); - } - - public function testConstruct() - { - $hash = new Hash(); - - $this->assertInstanceOf(Hash::class, $hash); - } -} diff --git a/src/TemplateDriverAuth/tests/TestCase.php b/src/TemplateDriverAuth/tests/TestCase.php deleted file mode 100644 index 99e3c542..00000000 --- a/src/TemplateDriverAuth/tests/TestCase.php +++ /dev/null @@ -1,80 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Core\Config\Driver; -use Cashbox\Core\Constants\Driver as DriverConstant; -use DragonCode\Contracts\Cashier\Config\Driver as DriverCotract; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\Model; -use Orchestra\Testbench\TestCase as BaseTestCase; -use Tests\Fixtures\ModelEloquent; -use Tests\Fixtures\ModelResource; - -abstract class TestCase extends BaseTestCase -{ - public const TERMINAL_KEY = '1234567890'; - public const TOKEN = '5szqkybmwvjcgcb7'; - public const TOKEN_HASH = '16237a729273fbf1b5224906a40ea601664660b77aabcdaecab505b16ed0f545'; - public const PAYMENT_ID = '123456'; - public const SUM = 123.45; - public const SUM_RESULT = 12345; - public const CURRENCY = 'RUB'; - public const CURRENCY_RESULT = '643'; - public const CREATED_AT = '2021-07-29 18:51:03'; - public const CREATED_AT_RESULT = '2021-07-29T18:51:03Z'; - - protected function credentials(): array - { - return $this->auth(self::TERMINAL_KEY, self::TOKEN); - } - - protected function credentialsHash(): array - { - return $this->auth(self::TERMINAL_KEY, self::TOKEN_HASH); - } - - protected function auth(string $terminal, string $secret): array - { - return [ - 'TerminalKey' => $terminal, - 'Token' => $secret, - ]; - } - - protected function model(): Model - { - $eloquent = new ModelEloquent(); - - $config = $this->config(); - - return new ModelResource($eloquent, $config); - } - - protected function config(): DriverCotract - { - return Driver::make([ - DriverConstant::CLIENT_ID => self::TERMINAL_KEY, - - DriverConstant::CLIENT_SECRET => self::TOKEN, - ]); - } - - protected function request(): Request - { - return Fixtures\Request::make($this->model()); - } -} diff --git a/src/TinkoffAuth/tests/Auth/BodyTest.php b/src/TinkoffAuth/tests/Auth/BodyTest.php deleted file mode 100644 index 8b94b86f..00000000 --- a/src/TinkoffAuth/tests/Auth/BodyTest.php +++ /dev/null @@ -1,56 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Auth; - -use Cashbox\Tinkoff\Auth\Auth; -use Tests\TestCase; - -class BodyTest extends TestCase -{ - public const TOKEN_HASH = '714bee21f51693eb5effb1895560f2a50dac0e795d5859a06b94bbdbe26faa1d'; - - public function testBasic() - { - $auth = Auth::make($this->model(), $this->request(), false); - - $this->assertIsArray($auth->body()); - $this->assertSame([ - 'PaymentId' => self::PAYMENT_ID, - 'Sum' => self::SUM_RESULT, - 'Currency' => self::CURRENCY_RESULT, - 'CreatedAt' => self::CREATED_AT_RESULT, - 'TerminalKey' => self::TERMINAL_KEY, - 'Token' => self::TOKEN, - ], $auth->body()); - } - - public function testHash() - { - $auth = Auth::make($this->model(), $this->request()); - - $this->assertIsArray($auth->body()); - $this->assertSame([ - 'PaymentId' => self::PAYMENT_ID, - 'Sum' => self::SUM_RESULT, - 'Currency' => self::CURRENCY_RESULT, - 'CreatedAt' => self::CREATED_AT_RESULT, - 'TerminalKey' => self::TERMINAL_KEY, - 'Token' => self::TOKEN_HASH, - ], $auth->body()); - } -} diff --git a/src/TinkoffAuth/tests/Auth/HeadersTest.php b/src/TinkoffAuth/tests/Auth/HeadersTest.php deleted file mode 100644 index 4543bf0e..00000000 --- a/src/TinkoffAuth/tests/Auth/HeadersTest.php +++ /dev/null @@ -1,42 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Auth; - -use Cashbox\Tinkoff\Auth\Auth; -use Tests\TestCase; - -class HeadersTest extends TestCase -{ - public function testBasic() - { - $auth = Auth::make($this->model(), $this->request(), false); - - $this->assertIsArray($auth->headers()); - - $this->assertSame(['Accept' => 'application/json'], $auth->headers()); - } - - public function testHash() - { - $auth = Auth::make($this->model(), $this->request()); - - $this->assertIsArray($auth->headers()); - - $this->assertSame(['Accept' => 'application/json'], $auth->headers()); - } -} diff --git a/src/TinkoffAuth/tests/Auth/MakeTest.php b/src/TinkoffAuth/tests/Auth/MakeTest.php deleted file mode 100644 index 39a5650a..00000000 --- a/src/TinkoffAuth/tests/Auth/MakeTest.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Auth; - -use Cashbox\Tinkoff\Auth\Auth; -use DragonCode\Contracts\Cashier\Auth\Auth as AuthContract; -use Tests\TestCase; - -class MakeTest extends TestCase -{ - public function testMakeBasic() - { - $auth = Auth::make($this->model(), $this->request(), false); - - $this->assertInstanceOf(AuthContract::class, $auth); - } - - public function testMakeHash() - { - $auth = Auth::make($this->model(), $this->request()); - - $this->assertInstanceOf(AuthContract::class, $auth); - } - - public function testConstructBasic() - { - $auth = new Auth($this->model(), $this->request(), false); - - $this->assertInstanceOf(AuthContract::class, $auth); - } - - public function testConstructHash() - { - $auth = new Auth($this->model(), $this->request()); - - $this->assertInstanceOf(AuthContract::class, $auth); - } -} diff --git a/src/TinkoffAuth/tests/Fixtures/ModelEloquent.php b/src/TinkoffAuth/tests/Fixtures/ModelEloquent.php deleted file mode 100644 index 557983b0..00000000 --- a/src/TinkoffAuth/tests/Fixtures/ModelEloquent.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures; - -use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -/** - * @property string $client_id - * @property string $client_secret - * @property string $payment_id - * @property string $sum - * @property string $currency - * @property string $created_at - */ -class ModelEloquent extends Model -{ - public $timestamps = false; - - protected function getClientIdAttribute(): string - { - return TestCase::TERMINAL_KEY; - } - - protected function getClientSecretAttribute(): string - { - return TestCase::TOKEN; - } - - protected function getPaymentIdAttribute(): string - { - return TestCase::PAYMENT_ID; - } - - protected function getSumAttribute(): float - { - return TestCase::SUM; - } - - protected function getCurrencyAttribute(): string - { - return TestCase::CURRENCY; - } - - protected function getCreatedAtAttribute(): Carbon - { - return Carbon::parse(TestCase::CREATED_AT); - } -} diff --git a/src/TinkoffAuth/tests/Fixtures/ModelResource.php b/src/TinkoffAuth/tests/Fixtures/ModelResource.php deleted file mode 100644 index 45a14395..00000000 --- a/src/TinkoffAuth/tests/Fixtures/ModelResource.php +++ /dev/null @@ -1,55 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures; - -use Cashbox\Core\Resources\Model; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -class ModelResource extends Model -{ - protected function clientId(): string - { - return TestCase::TERMINAL_KEY; - } - - protected function clientSecret(): string - { - return TestCase::TOKEN; - } - - protected function paymentId(): string - { - return TestCase::PAYMENT_ID; - } - - protected function sum(): float - { - return TestCase::SUM; - } - - protected function currency(): string - { - return TestCase::CURRENCY; - } - - protected function createdAt(): Carbon - { - return Carbon::parse(TestCase::CREATED_AT); - } -} diff --git a/src/TinkoffAuth/tests/Fixtures/Request.php b/src/TinkoffAuth/tests/Fixtures/Request.php deleted file mode 100644 index b767089c..00000000 --- a/src/TinkoffAuth/tests/Fixtures/Request.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures; - -use Cashbox\Core\Http\Request as BaseRequest; - -class Request extends BaseRequest -{ - public function getRawHeaders(): array - { - return ['Accept' => 'application/json']; - } - - public function getRawBody(): array - { - return [ - 'PaymentId' => $this->model->getPaymentId(), - 'Sum' => $this->model->getSum(), - 'Currency' => $this->model->getCurrency(), - 'CreatedAt' => $this->model->getCreatedAt(), - ]; - } -} diff --git a/src/TinkoffAuth/tests/Resources/AccessToken/GetAccessTokenTest.php b/src/TinkoffAuth/tests/Resources/AccessToken/GetAccessTokenTest.php deleted file mode 100644 index 465ad2c1..00000000 --- a/src/TinkoffAuth/tests/Resources/AccessToken/GetAccessTokenTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Resources\AccessToken; - -use Cashbox\Tinkoff\Auth\Resources\AccessToken; -use Tests\TestCase; - -class GetAccessTokenTest extends TestCase -{ - public function testBasic() - { - $token = AccessToken::make($this->credentials()); - - $this->assertSame(self::TOKEN, $token->getAccessToken()); - } - - public function testHashed() - { - $token = AccessToken::make($this->credentialsHash()); - - $this->assertSame(self::TOKEN_HASH, $token->getAccessToken()); - } -} diff --git a/src/TinkoffAuth/tests/Resources/AccessToken/GetClientIdTest.php b/src/TinkoffAuth/tests/Resources/AccessToken/GetClientIdTest.php deleted file mode 100644 index 7d23342e..00000000 --- a/src/TinkoffAuth/tests/Resources/AccessToken/GetClientIdTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Resources\AccessToken; - -use Cashbox\Tinkoff\Auth\Resources\AccessToken; -use Tests\TestCase; - -class GetClientIdTest extends TestCase -{ - public function testBasic() - { - $token = AccessToken::make($this->credentials()); - - $this->assertSame(self::TERMINAL_KEY, $token->getClientId()); - } - - public function testHashed() - { - $token = AccessToken::make($this->credentialsHash()); - - $this->assertSame(self::TERMINAL_KEY, $token->getClientId()); - } -} diff --git a/src/TinkoffAuth/tests/Resources/AccessToken/GetExpiresInTest.php b/src/TinkoffAuth/tests/Resources/AccessToken/GetExpiresInTest.php deleted file mode 100644 index 6ae26517..00000000 --- a/src/TinkoffAuth/tests/Resources/AccessToken/GetExpiresInTest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Resources\AccessToken; - -use Carbon\Carbon as BaseCarbon; -use Cashbox\Tinkoff\Auth\Resources\AccessToken; -use DateTimeInterface; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -class GetExpiresInTest extends TestCase -{ - public function testBasic() - { - $token = AccessToken::make($this->credentials()); - - $this->assertInstanceOf(Carbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(BaseCarbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(DateTimeInterface::class, $token->getExpiresIn()); - - $this->assertGreaterThan(Carbon::now(), $token->getExpiresIn()); - } - - public function testHashed() - { - $token = AccessToken::make($this->credentialsHash()); - - $this->assertInstanceOf(Carbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(BaseCarbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(DateTimeInterface::class, $token->getExpiresIn()); - - $this->assertGreaterThan(Carbon::now(), $token->getExpiresIn()); - } -} diff --git a/src/TinkoffAuth/tests/Resources/AccessToken/MakeTest.php b/src/TinkoffAuth/tests/Resources/AccessToken/MakeTest.php deleted file mode 100644 index 7bc4155c..00000000 --- a/src/TinkoffAuth/tests/Resources/AccessToken/MakeTest.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Resources\AccessToken; - -use Cashbox\Tinkoff\Auth\Resources\AccessToken; -use DragonCode\Contracts\Cashier\Resources\AccessToken as AccessTokenContract; -use Tests\TestCase; - -class MakeTest extends TestCase -{ - public function testMake() - { - $token = AccessToken::make(); - - $this->assertInstanceOf(AccessTokenContract::class, $token); - } - - public function testConstruct() - { - $token = new AccessToken(); - - $this->assertInstanceOf(AccessTokenContract::class, $token); - } -} diff --git a/src/TinkoffAuth/tests/Support/Hash/GetTest.php b/src/TinkoffAuth/tests/Support/Hash/GetTest.php deleted file mode 100644 index 71307b7d..00000000 --- a/src/TinkoffAuth/tests/Support/Hash/GetTest.php +++ /dev/null @@ -1,88 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Support\Hash; - -use Carbon\Carbon as BaseCarbon; -use Cashbox\Tinkoff\Auth\Support\Hash; -use DateTimeInterface; -use DragonCode\Contracts\Cashier\Resources\AccessToken; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -class GetTest extends TestCase -{ - public function testBasic() - { - $model = $this->model(); - - $data = ['PaymentId' => self::PAYMENT_ID]; - - $token = Hash::make()->get($model, $data, false); - - $this->assertInstanceOf(AccessToken::class, $token); - - $this->assertSame(self::TERMINAL_KEY, $token->getClientId()); - $this->assertSame(self::TOKEN, $token->getAccessToken()); - - $this->assertInstanceOf(Carbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(BaseCarbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(DateTimeInterface::class, $token->getExpiresIn()); - - $this->assertGreaterThan(Carbon::now(), $token->getExpiresIn()); - } - - public function testHash() - { - $model = $this->model(); - - $data = ['PaymentId' => self::PAYMENT_ID]; - - $token = Hash::make()->get($model, $data); - - $this->assertInstanceOf(AccessToken::class, $token); - - $this->assertSame(self::TERMINAL_KEY, $token->getClientId()); - $this->assertSame(self::TOKEN_HASH, $token->getAccessToken()); - - $this->assertInstanceOf(Carbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(BaseCarbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(DateTimeInterface::class, $token->getExpiresIn()); - - $this->assertGreaterThan(Carbon::now(), $token->getExpiresIn()); - } - - public function testWrongHash() - { - $model = $this->model(); - - $data = ['PaymentId' => '123']; - - $token = Hash::make()->get($model, $data); - - $this->assertInstanceOf(AccessToken::class, $token); - - $this->assertSame(self::TERMINAL_KEY, $token->getClientId()); - $this->assertNotSame(self::TOKEN_HASH, $token->getAccessToken()); - - $this->assertInstanceOf(Carbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(BaseCarbon::class, $token->getExpiresIn()); - $this->assertInstanceOf(DateTimeInterface::class, $token->getExpiresIn()); - - $this->assertGreaterThan(Carbon::now(), $token->getExpiresIn()); - } -} diff --git a/src/TinkoffAuth/tests/Support/Hash/MakeTest.php b/src/TinkoffAuth/tests/Support/Hash/MakeTest.php deleted file mode 100644 index 0a628c7e..00000000 --- a/src/TinkoffAuth/tests/Support/Hash/MakeTest.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Support\Hash; - -use Cashbox\Tinkoff\Auth\Support\Hash; -use Tests\TestCase; - -class MakeTest extends TestCase -{ - public function testMake() - { - $hash = Hash::make(); - - $this->assertInstanceOf(Hash::class, $hash); - } - - public function testConstruct() - { - $hash = new Hash(); - - $this->assertInstanceOf(Hash::class, $hash); - } -} diff --git a/src/TinkoffAuth/tests/TestCase.php b/src/TinkoffAuth/tests/TestCase.php deleted file mode 100644 index 99e3c542..00000000 --- a/src/TinkoffAuth/tests/TestCase.php +++ /dev/null @@ -1,80 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Core\Config\Driver; -use Cashbox\Core\Constants\Driver as DriverConstant; -use DragonCode\Contracts\Cashier\Config\Driver as DriverCotract; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\Model; -use Orchestra\Testbench\TestCase as BaseTestCase; -use Tests\Fixtures\ModelEloquent; -use Tests\Fixtures\ModelResource; - -abstract class TestCase extends BaseTestCase -{ - public const TERMINAL_KEY = '1234567890'; - public const TOKEN = '5szqkybmwvjcgcb7'; - public const TOKEN_HASH = '16237a729273fbf1b5224906a40ea601664660b77aabcdaecab505b16ed0f545'; - public const PAYMENT_ID = '123456'; - public const SUM = 123.45; - public const SUM_RESULT = 12345; - public const CURRENCY = 'RUB'; - public const CURRENCY_RESULT = '643'; - public const CREATED_AT = '2021-07-29 18:51:03'; - public const CREATED_AT_RESULT = '2021-07-29T18:51:03Z'; - - protected function credentials(): array - { - return $this->auth(self::TERMINAL_KEY, self::TOKEN); - } - - protected function credentialsHash(): array - { - return $this->auth(self::TERMINAL_KEY, self::TOKEN_HASH); - } - - protected function auth(string $terminal, string $secret): array - { - return [ - 'TerminalKey' => $terminal, - 'Token' => $secret, - ]; - } - - protected function model(): Model - { - $eloquent = new ModelEloquent(); - - $config = $this->config(); - - return new ModelResource($eloquent, $config); - } - - protected function config(): DriverCotract - { - return Driver::make([ - DriverConstant::CLIENT_ID => self::TERMINAL_KEY, - - DriverConstant::CLIENT_SECRET => self::TOKEN, - ]); - } - - protected function request(): Request - { - return Fixtures\Request::make($this->model()); - } -} diff --git a/src/TinkoffCredit/tests/Concerns/Database.php b/src/TinkoffCredit/tests/Concerns/Database.php deleted file mode 100644 index bd0b6ce8..00000000 --- a/src/TinkoffCredit/tests/Concerns/Database.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Concerns; - -use Illuminate\Database\Eloquent\Model; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Tests\Fixtures\Models\ReadyPayment; -use Tests\TestCase; - -trait Database -{ - use RefreshDatabase; - - /** @var \Illuminate\Database\Eloquent\Model|string */ - protected $model = ReadyPayment::class; - - protected function payment(): Model - { - $model = $this->model; - - return $model::create([ - 'type_id' => TestCase::MODEL_TYPE_ID, - 'status_id' => TestCase::MODEL_STATUS_ID, - - 'sum' => TestCase::PAYMENT_SUM, - 'currency' => TestCase::CURRENCY, - ]); - } -} diff --git a/src/TinkoffCredit/tests/Concerns/TestServiceProvider.php b/src/TinkoffCredit/tests/Concerns/TestServiceProvider.php deleted file mode 100644 index f5ce1126..00000000 --- a/src/TinkoffCredit/tests/Concerns/TestServiceProvider.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Concerns; - -use Cashbox\Core\Providers\ServiceProvider; - -class TestServiceProvider extends ServiceProvider -{ - protected function bootMigrations(): void - { - $this->loadMigrationsFrom([ - __DIR__ . '/../database/migrations', - __DIR__ . '/../../vendor/cashbox/core/database/migrations/main', - ]); - } -} diff --git a/src/TinkoffCredit/tests/DriverTest.php b/src/TinkoffCredit/tests/DriverTest.php deleted file mode 100644 index 5cf9b05b..00000000 --- a/src/TinkoffCredit/tests/DriverTest.php +++ /dev/null @@ -1,89 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Core\Http\ResponseInfo; -use Cashbox\Core\Services\Jobs; -use Cashbox\Tinkoff\Credit\Driver as Credit; -use Cashbox\Tinkoff\Credit\Exceptions\Http\CancelDeniedException; -use DragonCode\Contracts\Cashier\Driver as DriverContract; -use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Database\Eloquent\Model; -use Tests\Fixtures\Models\RequestPayment; - -class DriverTest extends TestCase -{ - protected $model = RequestPayment::class; - - public function testStart() - { - $payment = $this->payment(); - - $response = $this->driver($payment)->start(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $response->getExternalId()); - - $this->assertSame(self::STATUS, $response->getStatus()); - - $this->assertTrue(Url::is($response->getUrl())); - } - - public function testCheck() - { - $payment = $this->payment(); - - Jobs::make($payment)->start(); - - $response = $this->driver($payment)->check(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $response->getExternalId()); - - $this->assertSame('new', $response->getStatus()); - - $this->assertSame([ - 'status' => 'new', - ], $response->toArray()); - } - - public function testRefund() - { - $this->expectException(CancelDeniedException::class); - $this->expectExceptionMessage('Запрещено отменять эту заявку'); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - Jobs::make($payment)->check(true); - - $this->driver($payment)->refund(); - } - - protected function driver(Model $payment): DriverContract - { - $config = $this->config(); - - return Credit::make($config, $payment); - } -} diff --git a/src/TinkoffCredit/tests/Fixtures/Models/OrderItem.php b/src/TinkoffCredit/tests/Fixtures/Models/OrderItem.php deleted file mode 100644 index f5f4b6e1..00000000 --- a/src/TinkoffCredit/tests/Fixtures/Models/OrderItem.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Models; - -use Illuminate\Database\Eloquent\Model; -use Tests\TestCase; - -class OrderItem extends Model -{ - protected $fillable = ['name', 'quantity', 'price']; - - protected $casts = [ - 'quantity' => 'int', - 'price' => 'float', - ]; - - public function __construct() - { - parent::__construct([ - 'name' => TestCase::ORDER_ITEM_TITLE, - 'quantity' => 1, - 'price' => TestCase::PAYMENT_SUM, - ]); - } -} diff --git a/src/TinkoffCredit/tests/Fixtures/Models/ReadyPayment.php b/src/TinkoffCredit/tests/Fixtures/Models/ReadyPayment.php deleted file mode 100644 index c3cbcd9f..00000000 --- a/src/TinkoffCredit/tests/Fixtures/Models/ReadyPayment.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $uuid; - */ -class ReadyPayment extends UuidModel -{ - use Billable; - - protected function getUuidAttribute(): string - { - return TestCase::PAYMENT_ID; - } - - protected function getTypeIdAttribute(): int - { - return TestCase::MODEL_TYPE_ID; - } - - protected function getStatusIdAttribute(): int - { - return TestCase::MODEL_STATUS_ID; - } - - protected function getSumAttribute(): float - { - return TestCase::PAYMENT_SUM; - } - - protected function getCurrencyAttribute(): int - { - return TestCase::CURRENCY; - } - - protected function getCreatedAtAttribute(): Carbon - { - return Carbon::parse(TestCase::PAYMENT_DATE); - } -} diff --git a/src/TinkoffCredit/tests/Fixtures/Models/RequestPayment.php b/src/TinkoffCredit/tests/Fixtures/Models/RequestPayment.php deleted file mode 100644 index f19ecd52..00000000 --- a/src/TinkoffCredit/tests/Fixtures/Models/RequestPayment.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $id; - */ -class RequestPayment extends UuidModel -{ - use Billable; - - protected $table = 'payments'; - - protected $fillable = ['type_id', 'status_id', 'sum', 'currency']; - - protected $casts = [ - 'type_id' => 'integer', - 'status_id' => 'integer', - - 'sum' => 'float', - 'currency' => 'integer', - ]; -} diff --git a/src/TinkoffCredit/tests/Fixtures/Models/User.php b/src/TinkoffCredit/tests/Fixtures/Models/User.php deleted file mode 100644 index e879dcf7..00000000 --- a/src/TinkoffCredit/tests/Fixtures/Models/User.php +++ /dev/null @@ -1,54 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Models; - -use Illuminate\Database\Eloquent\Model; -use Tests\TestCase; - -/** - * @property string $email - * @property string $first_name - * @property string $last_name - * @property string $middle_name - * @property string $phone - */ -class User extends Model -{ - protected function getFirstNameAttribute(): string - { - return TestCase::USER_FIRST_NAME; - } - - protected function getMiddleNameAttribute(): string - { - return TestCase::USER_MIDDLE_NAME; - } - - protected function getLastNameAttribute(): string - { - return TestCase::USER_LAST_NAME; - } - - protected function getPhoneAttribute(): string - { - return TestCase::USER_PHONE; - } - - protected function getEmailAttribute(): string - { - return TestCase::USER_EMAIL; - } -} diff --git a/src/TinkoffCredit/tests/Fixtures/Resources/Model.php b/src/TinkoffCredit/tests/Fixtures/Resources/Model.php deleted file mode 100644 index d071fbf6..00000000 --- a/src/TinkoffCredit/tests/Fixtures/Resources/Model.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Resources; - -use Cashbox\Core\Resources\Model as BaseModel; -use Illuminate\Support\Carbon; -use Illuminate\Support\Collection; -use Tests\Fixtures\Models\OrderItem; -use Tests\Fixtures\Models\User; - -/** @property \Tests\Fixtures\Models\ReadyPayment $model */ -class Model extends BaseModel -{ - public function getShowCaseId(): ?string - { - return config('cashier.drivers.tinkoff_credit.show_case_id'); - } - - public function getPromoCode(): ?string - { - return config('cashier.drivers.tinkoff_credit.promocode'); - } - - public function getClient(): User - { - return new User(); - } - - public function getItems(): Collection - { - return collect([new OrderItem()])->map(function ($item) { - return [ - 'name' => $item->name, - 'quantity' => $item->quantity, - 'price' => (int) $item->price, - ]; - }); - } - - public function getSum(): int - { - return (int) $this->sum(); - } - - protected function paymentId(): string - { - return $this->model->uuid; - } - - protected function sum(): float - { - return $this->model->sum; - } - - protected function currency(): int - { - return $this->model->currency; - } - - protected function createdAt(): Carbon - { - return $this->model->created_at; - } -} diff --git a/src/TinkoffCredit/tests/Helpers/ExceptionTest.php b/src/TinkoffCredit/tests/Helpers/ExceptionTest.php deleted file mode 100644 index 716a5adb..00000000 --- a/src/TinkoffCredit/tests/Helpers/ExceptionTest.php +++ /dev/null @@ -1,135 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\Core\Exceptions\Http\BadRequestClientException; -use Cashbox\Core\Exceptions\Http\BaseException; -use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; -use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; -use Cashbox\Tinkoff\Credit\Exceptions\Manager; -use DragonCode\Contracts\Http\Builder as HttpBuilder; -use DragonCode\Support\Facades\Http\Builder; -use Tests\TestCase; - -class ExceptionTest extends TestCase -{ - public function test7() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Buyer Not Found'); - $this->expectExceptionCode(404); - - $this->throw(7); - } - - public function test7String() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Buyer Not Found'); - $this->expectExceptionCode(404); - - $this->throw('7'); - } - - public function test7Reason() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(404); - - $this->throw(7, 'Foo Bar'); - } - - public function test53() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Contact The Seller'); - $this->expectExceptionCode(409); - - $this->throw(53); - } - - public function test53String() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Contact The Seller'); - $this->expectExceptionCode(409); - - $this->throw('53'); - } - - public function test53Reason() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(409); - - $this->throw(53, 'Foo Bar'); - } - - public function testDefault() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw(10000); - } - - public function testDefaultString() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw('10000'); - } - - public function testDefaultReason() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(400); - - $this->throw(10000, 'Foo Bar'); - } - - protected function throw($code, ?string $reason = null) - { - $this->manager()->throw($this->uri(), $code, [ - 'Message' => $reason, - ]); - } - - protected function uri(): HttpBuilder - { - return Builder::parse('https://example.com/foo'); - } - - protected function manager(): Manager - { - return new Manager(); - } -} diff --git a/src/TinkoffCredit/tests/Helpers/StatusesTest.php b/src/TinkoffCredit/tests/Helpers/StatusesTest.php deleted file mode 100644 index d6ff86e1..00000000 --- a/src/TinkoffCredit/tests/Helpers/StatusesTest.php +++ /dev/null @@ -1,119 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\Tinkoff\Credit\Helpers\Statuses; -use Cashbox\Tinkoff\Credit\Resources\Details; -use Tests\TestCase; - -class StatusesTest extends TestCase -{ - public function testModel() - { - $this->assertTrue($this->status('NEW')->hasCreated()); - $this->assertTrue($this->status('NEW')->inProgress()); - - $this->assertFalse($this->status('NEW')->hasSuccess()); - $this->assertFalse($this->status('NEW')->hasFailed()); - $this->assertFalse($this->status('NEW')->hasRefunding()); - $this->assertFalse($this->status('NEW')->hasRefunded()); - } - - public function testHasCreated() - { - $this->assertTrue($this->status('NEW')->hasCreated('NEW')); - - $this->assertFalse($this->status('CANCELED')->hasCreated('CANCELED')); - - $this->assertFalse($this->status('REJECTED')->hasCreated('REJECTED')); - - $this->assertFalse($this->status('APPROVED')->hasCreated('APPROVED')); - - $this->assertFalse($this->status('UNKNOWN')->hasCreated('UNKNOWN')); - } - - public function testHasSuccess() - { - $this->assertFalse($this->status('NEW')->hasSuccess('NEW')); - - $this->assertFalse($this->status('CANCELED')->hasSuccess('CANCELED')); - - $this->assertFalse($this->status('REJECTED')->hasSuccess('REJECTED')); - - $this->assertTrue($this->status('APPROVED')->hasSuccess('APPROVED')); - - $this->assertFalse($this->status('UNKNOWN')->hasSuccess('UNKNOWN')); - } - - public function testHasFailed() - { - $this->assertFalse($this->status('NEW')->hasFailed('NEW')); - - $this->assertFalse($this->status('CANCELED')->hasFailed('CANCELED')); - - $this->assertTrue($this->status('REJECTED')->hasFailed('REJECTED')); - - $this->assertFalse($this->status('APPROVED')->hasFailed('APPROVED')); - - $this->assertFalse($this->status('UNKNOWN')->hasFailed('UNKNOWN')); - } - - public function testHasRefunding() - { - $this->assertFalse($this->status('NEW')->hasRefunding('NEW')); - - $this->assertFalse($this->status('CANCELED')->hasRefunding('CANCELED')); - - $this->assertFalse($this->status('REJECTED')->hasRefunding('REJECTED')); - - $this->assertFalse($this->status('APPROVED')->hasRefunding('APPROVED')); - - $this->assertFalse($this->status('UNKNOWN')->hasRefunding('UNKNOWN')); - } - - public function testHasRefunded() - { - $this->assertFalse($this->status('NEW')->hasRefunded('NEW')); - - $this->assertTrue($this->status('CANCELED')->hasRefunded('CANCELED')); - - $this->assertFalse($this->status('REJECTED')->hasRefunded('REJECTED')); - - $this->assertFalse($this->status('APPROVED')->hasRefunded('APPROVED')); - - $this->assertFalse($this->status('UNKNOWN')->hasRefunded('UNKNOWN')); - } - - public function testInProgress() - { - $this->assertTrue($this->status('NEW')->inProgress('NEW')); - - $this->assertFalse($this->status('CANCELED')->inProgress('CANCELED')); - - $this->assertFalse($this->status('REJECTED')->inProgress('REJECTED')); - - $this->assertFalse($this->status('APPROVED')->inProgress('APPROVED')); - - $this->assertTrue($this->status('UNKNOWN')->inProgress('UNKNOWN')); - } - - protected function status(string $status): Statuses - { - $details = Details::make(compact('status')); - - return Statuses::make($this->model($details)); - } -} diff --git a/src/TinkoffCredit/tests/Jobs/JobsTest.php b/src/TinkoffCredit/tests/Jobs/JobsTest.php deleted file mode 100644 index d1a8c603..00000000 --- a/src/TinkoffCredit/tests/Jobs/JobsTest.php +++ /dev/null @@ -1,107 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Jobs; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Services\Jobs; -use Cashbox\Tinkoff\Credit\Exceptions\Http\CancelDeniedException; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Illuminate\Support\Facades\DB; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class JobsTest extends TestCase -{ - use RefreshDatabase; - - protected $model = RequestPayment::class; - - public function testStart() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - public function testCheck() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - Jobs::make($payment)->check(true); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - public function testRefund() - { - $this->expectException(CancelDeniedException::class); - $this->expectExceptionMessage('Запрещено отменять эту заявку'); - - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - - Jobs::make($payment)->start(); - Jobs::make($payment)->refund(); - } -} diff --git a/src/TinkoffCredit/tests/Observers/ObserverTest.php b/src/TinkoffCredit/tests/Observers/ObserverTest.php deleted file mode 100644 index f54b489e..00000000 --- a/src/TinkoffCredit/tests/Observers/ObserverTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Observers; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Providers\ObserverServiceProvider; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Database\Eloquent\Model; -use Illuminate\Foundation\Testing\RefreshDatabase; -use Illuminate\Support\Facades\DB; -use Tests\Concerns\TestServiceProvider; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class ObserverTest extends TestCase -{ - use RefreshDatabase; - - protected $model = RequestPayment::class; - - protected function getPackageProviders($app): array - { - return [ - TestServiceProvider::class, - ObserverServiceProvider::class, - ]; - } - - public function testCreate(): Model - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment()->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - - return $payment; - } - - public function testUpdate() - { - $payment = $this->testCreate(); - - $payment->update([ - 'sum' => 34.56, - ]); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } -} diff --git a/src/TinkoffCredit/tests/Requests/CancelTest.php b/src/TinkoffCredit/tests/Requests/CancelTest.php deleted file mode 100644 index aa28fad0..00000000 --- a/src/TinkoffCredit/tests/Requests/CancelTest.php +++ /dev/null @@ -1,86 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Core\Http\Request; -use Cashbox\Tinkoff\Credit\Requests\Cancel; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Lmc\HttpConstants\Header; -use Tests\TestCase; - -class CancelTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Cancel::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $id = self::PAYMENT_ID; - - $this->assertSame("https://forma.tinkoff.ru/api/partners/v2/orders/{$id}/cancel", $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - Header::ACCEPT => 'application/json', - Header::CONTENT_TYPE => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - Header::ACCEPT => 'application/json', - Header::CONTENT_TYPE => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->body()); - $this->assertEmpty($request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->getRawBody()); - $this->assertEmpty($request->getRawBody()); - } -} diff --git a/src/TinkoffCredit/tests/Requests/GetStateTest.php b/src/TinkoffCredit/tests/Requests/GetStateTest.php deleted file mode 100644 index 5ec66aa0..00000000 --- a/src/TinkoffCredit/tests/Requests/GetStateTest.php +++ /dev/null @@ -1,86 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Core\Http\Request; -use Cashbox\Tinkoff\Credit\Requests\GetState; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Lmc\HttpConstants\Header; -use Tests\TestCase; - -class GetStateTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(GetState::class); - - $this->assertInstanceOf(GetState::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(GetState::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $id = self::PAYMENT_ID; - - $this->assertSame("https://forma.tinkoff.ru/api/partners/v2/orders/{$id}/info", $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - Header::ACCEPT => 'application/json', - Header::CONTENT_TYPE => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - Header::ACCEPT => 'application/json', - Header::CONTENT_TYPE => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->body()); - $this->assertEmpty($request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->getRawBody()); - $this->assertEmpty($request->body()); - } -} diff --git a/src/TinkoffCredit/tests/Requests/InitTest.php b/src/TinkoffCredit/tests/Requests/InitTest.php deleted file mode 100644 index 3daa9c4b..00000000 --- a/src/TinkoffCredit/tests/Requests/InitTest.php +++ /dev/null @@ -1,142 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Core\Http\Request; -use Cashbox\Tinkoff\Credit\Requests\Init; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Lmc\HttpConstants\Header; -use Tests\TestCase; - -class InitTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Init::class); - - $this->assertInstanceOf(Init::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(Init::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://forma.tinkoff.ru/api/partners/v2/orders/create-demo', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - Header::ACCEPT => 'application/json', - Header::CONTENT_TYPE => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - Header::ACCEPT => 'application/json', - Header::CONTENT_TYPE => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'shopId' => $this->getClientId(), - 'showcaseId' => $this->getShowCaseId(), - 'promoCode' => $this->getPromoCode(), - - 'sum' => (int) self::PAYMENT_SUM, - - 'orderNumber' => self::PAYMENT_ID, - - 'values' => [ - 'contact' => [ - 'fio' => [ - 'lastName' => self::USER_LAST_NAME, - 'firstName' => self::USER_FIRST_NAME, - 'middleName' => self::USER_MIDDLE_NAME, - ], - 'mobilePhone' => self::USER_PHONE, - 'email' => self::USER_EMAIL, - ], - ], - - 'items' => [ - [ - 'name' => self::ORDER_ITEM_TITLE, - 'quantity' => 1, - 'price' => (int) self::PAYMENT_SUM, - ], - ], - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'shopId' => $this->getClientId(), - 'showcaseId' => $this->getShowCaseId(), - 'promoCode' => $this->getPromoCode(), - - 'sum' => (int) self::PAYMENT_SUM, - - 'orderNumber' => self::PAYMENT_ID, - - 'values' => [ - 'contact' => [ - 'fio' => [ - 'lastName' => self::USER_LAST_NAME, - 'firstName' => self::USER_FIRST_NAME, - 'middleName' => self::USER_MIDDLE_NAME, - ], - 'mobilePhone' => self::USER_PHONE, - 'email' => self::USER_EMAIL, - ], - ], - - 'items' => [ - [ - 'name' => self::ORDER_ITEM_TITLE, - 'quantity' => 1, - 'price' => (int) self::PAYMENT_SUM, - ], - ], - ], $request->getRawBody()); - } -} diff --git a/src/TinkoffCredit/tests/Resources/DetailsTest.php b/src/TinkoffCredit/tests/Resources/DetailsTest.php deleted file mode 100644 index e287584a..00000000 --- a/src/TinkoffCredit/tests/Resources/DetailsTest.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Resources; - -use Cashbox\Core\Resources\Details as BaseDetails; -use Cashbox\Tinkoff\Credit\Resources\Details; -use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; -use Tests\TestCase; - -class DetailsTest extends TestCase -{ - protected $expected = [ - 'status' => self::STATUS, - 'url' => self::URL, - ]; - - public function testMake() - { - $details = $this->details(); - - $this->assertInstanceOf(Details::class, $details); - $this->assertInstanceOf(BaseDetails::class, $details); - $this->assertInstanceOf(DetailsContract::class, $details); - } - - public function testGetUrl() - { - $details = $this->details(); - - $this->assertSame(self::URL, $details->getUrl()); - } - - public function testGetStatus() - { - $details = $this->details(); - - $this->assertSame(self::STATUS, $details->getStatus()); - } - - public function testToArray() - { - $details = $this->details(); - - $this->assertSame($this->expected, $details->toArray()); - } - - public function testToJson() - { - $details = $this->details(); - - $this->assertJson($details->toJson()); - - $this->assertSame(json_encode($this->expected), $details->toJson()); - } - - protected function details(): Details - { - return Details::make($this->expected); - } -} diff --git a/src/TinkoffCredit/tests/Responses/InitTest.php b/src/TinkoffCredit/tests/Responses/InitTest.php deleted file mode 100644 index c0c05923..00000000 --- a/src/TinkoffCredit/tests/Responses/InitTest.php +++ /dev/null @@ -1,64 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use Cashbox\Tinkoff\Credit\Responses\Created; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class InitTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Created::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - Created::KEY_URL => self::URL, - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Created::make([ - 'id' => self::PAYMENT_EXTERNAL_ID, - 'link' => self::URL, - ]); - } -} diff --git a/src/TinkoffCredit/tests/Responses/RefundTest.php b/src/TinkoffCredit/tests/Responses/RefundTest.php deleted file mode 100644 index be4e34a5..00000000 --- a/src/TinkoffCredit/tests/Responses/RefundTest.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use Cashbox\Tinkoff\Credit\Responses\Refund; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class RefundTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Refund::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Refund::make([ - 'id' => self::PAYMENT_EXTERNAL_ID, - 'status' => self::STATUS, - ]); - } -} diff --git a/src/TinkoffCredit/tests/Responses/StateTest.php b/src/TinkoffCredit/tests/Responses/StateTest.php deleted file mode 100644 index a55cb4b2..00000000 --- a/src/TinkoffCredit/tests/Responses/StateTest.php +++ /dev/null @@ -1,63 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use Cashbox\Tinkoff\Credit\Responses\State; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class StateTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(State::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return State::make([ - 'id' => self::PAYMENT_EXTERNAL_ID, - 'status' => self::STATUS, - ]); - } -} diff --git a/src/TinkoffCredit/tests/TestCase.php b/src/TinkoffCredit/tests/TestCase.php deleted file mode 100644 index 3b69fccc..00000000 --- a/src/TinkoffCredit/tests/TestCase.php +++ /dev/null @@ -1,149 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Core\Config\Driver as DriverConfig; -use Cashbox\Core\Constants\Driver as DriverConstant; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Models\CashierDetail; -use Cashbox\Tinkoff\Credit\Driver; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\Details; -use Illuminate\Database\Eloquent\Model as EloquentModel; -use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; -use Orchestra\Testbench\TestCase as BaseTestCase; -use Tests\Concerns\Database; -use Tests\Concerns\TestServiceProvider; -use Tests\Fixtures\Models\ReadyPayment; -use Tests\Fixtures\Resources\Model; - -abstract class TestCase extends BaseTestCase -{ - use Database; - - public const PAYMENT_EXTERNAL_ID = '456789'; - public const PAYMENT_ID = '1234567890'; - public const PAYMENT_SUM = 6000.34; - public const PAYMENT_SUM_FORMATTED = 600034; - public const CURRENCY = 643; - public const CURRENCY_FORMATTED = '643'; - public const PAYMENT_DATE = '2021-07-23 17:33:27'; - public const PAYMENT_DATE_FORMATTED = '2021-07-23T17:33:27Z'; - public const STATUS = 'NEW'; - public const URL = 'https://example.com'; - public const MODEL_TYPE_ID = 123; - public const MODEL_STATUS_ID = 0; - public const USER_FIRST_NAME = 'John'; - public const USER_MIDDLE_NAME = 'Michael'; - public const USER_LAST_NAME = 'Doe'; - public const USER_PHONE = '+79123456789'; - public const USER_EMAIL = 'john@example.com'; - public const ORDER_ITEM_TITLE = 'Item Name'; - - protected function getPackageProviders($app): array - { - return [TestServiceProvider::class]; - } - - protected function getEnvironmentSetup($app) - { - $app->useEnvironmentPath(__DIR__ . '/../'); - $app->bootstrapWith([LoadEnvironmentVariables::class]); - - /** @var \Illuminate\Config\Repository $config */ - $config = $app['config']; - - $config->set('cashier.payment.model', $this->model); - - $config->set('cashier.payment.map', [ - self::MODEL_TYPE_ID => 'tinkoff_credit', - ]); - - $config->set('cashier.drivers.tinkoff_credit', [ - DriverConstant::DRIVER => Driver::class, - DriverConstant::DETAILS => Model::class, - - DriverConstant::CLIENT_ID => env('CASHIER_TINKOFF_CREDIT_CLIENT_ID'), - DriverConstant::CLIENT_SECRET => env('CASHIER_TINKOFF_CREDIT_PASSWORD'), - - 'show_case_id' => env('CASHIER_TINKOFF_CREDIT_SHOW_CASE_ID'), - - 'promocode' => env('CASHIER_TINKOFF_CREDIT_PROMOCODE'), - ]); - } - - protected function model(?Details $details = null): ReadyPayment - { - $model = PaymentConfig::getModel(); - - $payment = new $model(); - - $cashier = $this->detailsRelation($payment, $details); - - return $payment->setRelation('cashier', $cashier); - } - - protected function detailsRelation(EloquentModel $model, ?Details $details): CashierDetail - { - $details = new CashierDetail([ - 'item_type' => ReadyPayment::class, - - 'item_id' => self::PAYMENT_ID, - 'external_id' => self::PAYMENT_EXTERNAL_ID, - - 'details' => $details, - ]); - - return $details->setRelation('parent', $model); - } - - /** - * @param \Cashbox\Tinkoff\Credit\Requests\BaseRequest|string $request - */ - protected function request(string $request): Request - { - $model = $this->modelRequest(); - - return $request::make($model); - } - - protected function modelRequest(): Model - { - return Model::make($this->model(), $this->config()); - } - - protected function config(): DriverConfig - { - $config = config('cashier.drivers.tinkoff_credit'); - - return DriverConfig::make($config); - } - - protected function getClientId(): string - { - return config('cashier.drivers.tinkoff_credit.client_id'); - } - - protected function getShowCaseId(): string - { - return config('cashier.drivers.tinkoff_credit.show_case_id'); - } - - protected function getPromoCode(): string - { - return config('cashier.drivers.tinkoff_credit.promocode'); - } -} diff --git a/src/TinkoffCredit/tests/database/migrations/2021_05_26_000000_create_payments_table.php b/src/TinkoffCredit/tests/database/migrations/2021_05_26_000000_create_payments_table.php deleted file mode 100644 index a37e8827..00000000 --- a/src/TinkoffCredit/tests/database/migrations/2021_05_26_000000_create_payments_table.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; - -class CreatePaymentsTable extends Migration -{ - protected $table = 'payments'; - - public function up() - { - Schema::create($this->table, function (Blueprint $table) { - $table->uuid('uuid'); - - $table->smallInteger('type_id'); - $table->smallInteger('status_id'); - - $table->double('sum', 10, 2)->default(0); - - $table->smallInteger('currency'); - - $table->timestamps(); - }); - } - - public function down() - { - Schema::dropIfExists($this->table); - } -} diff --git a/src/TinkoffOnline/tests/DriverTest.php b/src/TinkoffOnline/tests/DriverTest.php deleted file mode 100644 index 5e91924f..00000000 --- a/src/TinkoffOnline/tests/DriverTest.php +++ /dev/null @@ -1,98 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Core\Http\ResponseInfo; -use Cashbox\Tinkoff\Online\Driver as Online; -use DragonCode\Contracts\Cashier\Driver as DriverContract; -use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; -use DragonCode\Support\Facades\Http\Url; -use Tests\Fixtures\Models\RequestPayment; - -class DriverTest extends TestCase -{ - protected $model = RequestPayment::class; - - protected function setUp(): void - { - parent::setUp(); - - $this->runSeeders(); - } - - public function testStart() - { - $response = $this->driver()->start(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertSame('NEW', $response->getStatus()); - - $this->assertTrue(Url::is($response->getUrl())); - } - - public function testCheck() - { - $this->driver()->start(); - - $response = $this->driver()->check(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertSame('NEW', $response->getStatus()); - - $this->assertSame([ - 'status' => 'NEW', - ], $response->toArray()); - } - - public function testRefund() - { - $this->driver()->start(); - - $response = $this->driver()->refund(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertSame('CANCELED', $response->getStatus()); - } - - protected function driver(): DriverContract - { - $model = $this->payment(); - - $config = $this->config(); - - return Online::make($config, $model); - } - - protected function payment(): RequestPayment - { - return RequestPayment::firstOrFail(); - } -} diff --git a/src/TinkoffOnline/tests/Fixtures/Factories/Payment.php b/src/TinkoffOnline/tests/Fixtures/Factories/Payment.php deleted file mode 100644 index d3b2107d..00000000 --- a/src/TinkoffOnline/tests/Fixtures/Factories/Payment.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Factories; - -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class Payment -{ - public static function create(): RequestPayment - { - return RequestPayment::create([ - 'type_id' => TestCase::MODEL_TYPE_ID, - 'status_id' => TestCase::MODEL_STATUS_ID, - - 'sum' => TestCase::PAYMENT_SUM, - 'currency' => TestCase::CURRENCY, - ]); - } -} diff --git a/src/TinkoffOnline/tests/Fixtures/Models/ReadyPayment.php b/src/TinkoffOnline/tests/Fixtures/Models/ReadyPayment.php deleted file mode 100644 index c3cbcd9f..00000000 --- a/src/TinkoffOnline/tests/Fixtures/Models/ReadyPayment.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $uuid; - */ -class ReadyPayment extends UuidModel -{ - use Billable; - - protected function getUuidAttribute(): string - { - return TestCase::PAYMENT_ID; - } - - protected function getTypeIdAttribute(): int - { - return TestCase::MODEL_TYPE_ID; - } - - protected function getStatusIdAttribute(): int - { - return TestCase::MODEL_STATUS_ID; - } - - protected function getSumAttribute(): float - { - return TestCase::PAYMENT_SUM; - } - - protected function getCurrencyAttribute(): int - { - return TestCase::CURRENCY; - } - - protected function getCreatedAtAttribute(): Carbon - { - return Carbon::parse(TestCase::PAYMENT_DATE); - } -} diff --git a/src/TinkoffOnline/tests/Fixtures/Models/RequestPayment.php b/src/TinkoffOnline/tests/Fixtures/Models/RequestPayment.php deleted file mode 100644 index f19ecd52..00000000 --- a/src/TinkoffOnline/tests/Fixtures/Models/RequestPayment.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $id; - */ -class RequestPayment extends UuidModel -{ - use Billable; - - protected $table = 'payments'; - - protected $fillable = ['type_id', 'status_id', 'sum', 'currency']; - - protected $casts = [ - 'type_id' => 'integer', - 'status_id' => 'integer', - - 'sum' => 'float', - 'currency' => 'integer', - ]; -} diff --git a/src/TinkoffOnline/tests/Fixtures/Resources/Model.php b/src/TinkoffOnline/tests/Fixtures/Resources/Model.php deleted file mode 100644 index 8bb2f745..00000000 --- a/src/TinkoffOnline/tests/Fixtures/Resources/Model.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Resources; - -use Cashbox\Core\Resources\Model as BaseModel; -use Illuminate\Support\Carbon; - -/** @property \Tests\Fixtures\Models\ReadyPayment $model */ -class Model extends BaseModel -{ - public function getExternalId(): ?string - { - return $this->model->cashbox->external_id ?? null; - } - - protected function paymentId(): string - { - return $this->model->uuid; - } - - protected function sum(): float - { - return $this->model->sum; - } - - protected function currency(): int - { - return $this->model->currency; - } - - protected function createdAt(): Carbon - { - return $this->model->created_at; - } -} diff --git a/src/TinkoffOnline/tests/Helpers/ExceptionTest.php b/src/TinkoffOnline/tests/Helpers/ExceptionTest.php deleted file mode 100644 index 313fdabb..00000000 --- a/src/TinkoffOnline/tests/Helpers/ExceptionTest.php +++ /dev/null @@ -1,135 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\Core\Exceptions\Http\BadRequestClientException; -use Cashbox\Core\Exceptions\Http\BaseException; -use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; -use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; -use Cashbox\Tinkoff\Online\Exceptions\Manager; -use DragonCode\Contracts\Http\Builder as HttpBuilder; -use DragonCode\Support\Facades\Http\Builder; -use Tests\TestCase; - -class ExceptionTest extends TestCase -{ - public function test7() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Buyer Not Found'); - $this->expectExceptionCode(404); - - $this->throw(7); - } - - public function test7String() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Buyer Not Found'); - $this->expectExceptionCode(404); - - $this->throw('7'); - } - - public function test7Reason() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(404); - - $this->throw(7, 'Foo Bar'); - } - - public function test53() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Contact The Seller'); - $this->expectExceptionCode(409); - - $this->throw(53); - } - - public function test53String() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Contact The Seller'); - $this->expectExceptionCode(409); - - $this->throw('53'); - } - - public function test53Reason() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(409); - - $this->throw(53, 'Foo Bar'); - } - - public function testDefault() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw(10000); - } - - public function testDefaultString() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw('10000'); - } - - public function testDefaultReason() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(400); - - $this->throw(10000, 'Foo Bar'); - } - - protected function throw($code, ?string $reason = null) - { - $this->manager()->throw($this->uri(), $code, [ - 'Message' => $reason, - ]); - } - - protected function uri(): HttpBuilder - { - return Builder::parse('https://example.com/foo'); - } - - protected function manager(): Manager - { - return new Manager(); - } -} diff --git a/src/TinkoffOnline/tests/Helpers/StatusesTest.php b/src/TinkoffOnline/tests/Helpers/StatusesTest.php deleted file mode 100644 index 314fd33e..00000000 --- a/src/TinkoffOnline/tests/Helpers/StatusesTest.php +++ /dev/null @@ -1,191 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\Tinkoff\Online\Helpers\Statuses; -use Cashbox\Tinkoff\Online\Resources\Details; -use Tests\TestCase; - -class StatusesTest extends TestCase -{ - public function testModel() - { - $this->assertTrue($this->status('NEW')->hasCreated()); - $this->assertTrue($this->status('NEW')->inProgress()); - - $this->assertFalse($this->status('NEW')->hasSuccess()); - $this->assertFalse($this->status('NEW')->hasFailed()); - $this->assertFalse($this->status('NEW')->hasRefunding()); - $this->assertFalse($this->status('NEW')->hasRefunded()); - } - - public function testHasCreated() - { - $this->assertTrue($this->status('FORM_SHOWED')->hasCreated('FORM_SHOWED')); - $this->assertTrue($this->status('NEW')->hasCreated('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasCreated('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasCreated('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasCreated('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasCreated('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasCreated('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasCreated('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasCreated('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasCreated('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasCreated('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasCreated('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasCreated('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasCreated('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasCreated('UNKNOWN')); - } - - public function testHasSuccess() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasSuccess('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasSuccess('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasSuccess('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasSuccess('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasSuccess('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasSuccess('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasSuccess('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasSuccess('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasSuccess('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasSuccess('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasSuccess('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasSuccess('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasSuccess('REJECTED')); - - $this->assertTrue($this->status('CONFIRMED')->hasSuccess('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasSuccess('UNKNOWN')); - } - - public function testHasFailed() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasFailed('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasFailed('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasFailed('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasFailed('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasFailed('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasFailed('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasFailed('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasFailed('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasFailed('REVERSED')); - - $this->assertTrue($this->status('ATTEMPTS_EXPIRED')->hasFailed('ATTEMPTS_EXPIRED')); - $this->assertTrue($this->status('CANCELED')->hasFailed('CANCELED')); - $this->assertTrue($this->status('DEADLINE_EXPIRED')->hasFailed('DEADLINE_EXPIRED')); - $this->assertTrue($this->status('REJECTED')->hasFailed('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasFailed('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasFailed('UNKNOWN')); - } - - public function testHasRefunding() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasRefunding('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasRefunding('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasRefunding('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasRefunding('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasRefunding('CONFIRMING')); - - $this->assertTrue($this->status('REFUNDING')->hasRefunding('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasRefunding('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasRefunding('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasRefunding('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasRefunding('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasRefunding('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasRefunding('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasRefunding('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasRefunding('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasRefunding('UNKNOWN')); - } - - public function testHasRefunded() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasRefunded('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasRefunded('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasRefunded('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasRefunded('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasRefunded('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasRefunded('REFUNDING')); - - $this->assertTrue($this->status('PARTIAL_REFUNDED')->hasRefunded('PARTIAL_REFUNDED')); - $this->assertTrue($this->status('REFUNDED')->hasRefunded('REFUNDED')); - $this->assertTrue($this->status('REVERSED')->hasRefunded('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasRefunded('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasRefunded('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasRefunded('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasRefunded('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasRefunded('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasRefunded('UNKNOWN')); - } - - public function testInProgress() - { - $this->assertTrue($this->status('FORM_SHOWED')->inProgress('FORM_SHOWED')); - $this->assertTrue($this->status('NEW')->inProgress('NEW')); - - $this->assertTrue($this->status('AUTHORIZED')->inProgress('AUTHORIZED')); - $this->assertTrue($this->status('AUTHORIZING')->inProgress('AUTHORIZING')); - $this->assertTrue($this->status('CONFIRMING')->inProgress('CONFIRMING')); - - $this->assertTrue($this->status('REFUNDING')->inProgress('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->inProgress('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->inProgress('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->inProgress('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->inProgress('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->inProgress('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->inProgress('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->inProgress('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->inProgress('CONFIRMED')); - - $this->assertTrue($this->status('UNKNOWN')->inProgress('UNKNOWN')); - } - - protected function status(string $status): Statuses - { - $details = Details::make(compact('status')); - - return Statuses::make($this->model($details)); - } -} diff --git a/src/TinkoffOnline/tests/Jobs/JobsTest.php b/src/TinkoffOnline/tests/Jobs/JobsTest.php deleted file mode 100644 index be981f65..00000000 --- a/src/TinkoffOnline/tests/Jobs/JobsTest.php +++ /dev/null @@ -1,121 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Jobs; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Services\Jobs; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Support\Facades\DB; -use Tests\Fixtures\Factories\Payment; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class JobsTest extends TestCase -{ - protected $model = RequestPayment::class; - - public function testStart() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - public function testCheck() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - Jobs::make($payment)->check(true); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - public function testRefund() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - - Jobs::make($payment)->start(); - Jobs::make($payment)->refund(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertSame('CANCELED', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::REFUND), - $payment->status_id - ); - } - - protected function payment(): RequestPayment - { - return Payment::create(); - } -} diff --git a/src/TinkoffOnline/tests/Observers/ObserverTest.php b/src/TinkoffOnline/tests/Observers/ObserverTest.php deleted file mode 100644 index ff7896b6..00000000 --- a/src/TinkoffOnline/tests/Observers/ObserverTest.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Observers; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Providers\ObserverServiceProvider; -use Cashbox\Core\Providers\ServiceProvider; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Support\Facades\DB; -use Tests\Fixtures\Factories\Payment; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class ObserverTest extends TestCase -{ - protected $model = RequestPayment::class; - - protected function getPackageProviders($app): array - { - return [ - ServiceProvider::class, - ObserverServiceProvider::class, - ]; - } - - public function testCreate(): RequestPayment - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - - return $payment; - } - - public function testUpdate() - { - $payment = $this->testCreate(); - - $payment->update([ - 'sum' => 34.56, - ]); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - protected function payment(): RequestPayment - { - return Payment::create()->refresh(); - } -} diff --git a/src/TinkoffOnline/tests/Requests/CancelTest.php b/src/TinkoffOnline/tests/Requests/CancelTest.php deleted file mode 100644 index 3023b9ee..00000000 --- a/src/TinkoffOnline/tests/Requests/CancelTest.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Core\Http\Request; -use Cashbox\Tinkoff\Online\Requests\Cancel; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class CancelTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Cancel::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://securepay.tinkoff.ru/v2/Cancel', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - - 'TerminalKey' => $this->getTerminalKey(), - - 'Token' => '8473d8d4cafb9ec63071e9050c05e0dd1178fc8e1f3c765ffef7ec7fb5fcb758', - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - ], $request->getRawBody()); - } -} diff --git a/src/TinkoffOnline/tests/Requests/GetStateTest.php b/src/TinkoffOnline/tests/Requests/GetStateTest.php deleted file mode 100644 index 6ff0245e..00000000 --- a/src/TinkoffOnline/tests/Requests/GetStateTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Core\Http\Request; -use Cashbox\Tinkoff\Online\Requests\GetState; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class GetStateTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(GetState::class); - - $this->assertInstanceOf(GetState::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(GetState::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://securepay.tinkoff.ru/v2/GetState', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - - 'TerminalKey' => $this->getTerminalKey(), - - 'Token' => 'dbcbdf5539c35132b63c1b54e0f107cc96e71cf96040ba54dec5e140255b2e63', - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - ], $request->getRawBody()); - } -} diff --git a/src/TinkoffOnline/tests/Requests/InitTest.php b/src/TinkoffOnline/tests/Requests/InitTest.php deleted file mode 100644 index 37949a70..00000000 --- a/src/TinkoffOnline/tests/Requests/InitTest.php +++ /dev/null @@ -1,96 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Core\Http\Request; -use Cashbox\Tinkoff\Online\Requests\Init; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class InitTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Init::class); - - $this->assertInstanceOf(Init::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(Init::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://securepay.tinkoff.ru/v2/Init', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'OrderId' => self::PAYMENT_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - 'Currency' => self::CURRENCY_FORMATTED, - - 'TerminalKey' => $this->getTerminalKey(), - 'Token' => $this->getTerminalSecret(), - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'OrderId' => self::PAYMENT_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - 'Currency' => self::CURRENCY_FORMATTED, - ], $request->getRawBody()); - } -} diff --git a/src/TinkoffOnline/tests/Resources/DetailsTest.php b/src/TinkoffOnline/tests/Resources/DetailsTest.php deleted file mode 100644 index 07c3c094..00000000 --- a/src/TinkoffOnline/tests/Resources/DetailsTest.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Resources; - -use Cashbox\Core\Resources\Details as BaseDetails; -use Cashbox\Tinkoff\Online\Resources\Details; -use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; -use Tests\TestCase; - -class DetailsTest extends TestCase -{ - protected $expected = [ - 'status' => self::STATUS, - 'url' => self::URL, - ]; - - public function testMake() - { - $details = $this->details(); - - $this->assertInstanceOf(Details::class, $details); - $this->assertInstanceOf(BaseDetails::class, $details); - $this->assertInstanceOf(DetailsContract::class, $details); - } - - public function testGetUrl() - { - $details = $this->details(); - - $this->assertSame(self::URL, $details->getUrl()); - } - - public function testGetStatus() - { - $details = $this->details(); - - $this->assertSame(self::STATUS, $details->getStatus()); - } - - public function testToArray() - { - $details = $this->details(); - - $this->assertSame($this->expected, $details->toArray()); - } - - public function testToJson() - { - $details = $this->details(); - - $this->assertJson($details->toJson()); - - $this->assertSame(json_encode($this->expected), $details->toJson()); - } - - protected function details(): Details - { - return Details::make($this->expected); - } -} diff --git a/src/TinkoffOnline/tests/Responses/InitTest.php b/src/TinkoffOnline/tests/Responses/InitTest.php deleted file mode 100644 index 42a77575..00000000 --- a/src/TinkoffOnline/tests/Responses/InitTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use Cashbox\Tinkoff\Online\Responses\Init; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class InitTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Init::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Init::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'Amount' => self::PAYMENT_SUM_FORMATTED, - 'OrderId' => self::PAYMENT_ID, - 'Success' => true, - 'Status' => self::STATUS, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'ErrorCode' => 0, - ]); - } -} diff --git a/src/TinkoffOnline/tests/Responses/RefundTest.php b/src/TinkoffOnline/tests/Responses/RefundTest.php deleted file mode 100644 index 610dda7c..00000000 --- a/src/TinkoffOnline/tests/Responses/RefundTest.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use Cashbox\Tinkoff\Online\Responses\Refund; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class RefundTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Refund::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Refund::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'Success' => true, - 'Status' => self::STATUS, - 'ErrorCode' => 0, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'OrderId' => self::PAYMENT_ID, - ]); - } -} diff --git a/src/TinkoffOnline/tests/Responses/StateTest.php b/src/TinkoffOnline/tests/Responses/StateTest.php deleted file mode 100644 index ca2d49a4..00000000 --- a/src/TinkoffOnline/tests/Responses/StateTest.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use Cashbox\Tinkoff\Online\Responses\State; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class StateTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(State::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return State::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'OrderId' => self::PAYMENT_ID, - 'Success' => true, - 'Status' => self::STATUS, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'ErrorCode' => 0, - ]); - } -} diff --git a/src/TinkoffOnline/tests/TestCase.php b/src/TinkoffOnline/tests/TestCase.php deleted file mode 100644 index 2918aa4f..00000000 --- a/src/TinkoffOnline/tests/TestCase.php +++ /dev/null @@ -1,147 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Core\Config\Driver as DriverConfig; -use Cashbox\Core\Constants\Driver as DriverConstant; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Models\CashierDetail; -use Cashbox\Core\Providers\ServiceProvider; -use Cashbox\Tinkoff\Online\Driver; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\Details; -use Illuminate\Database\Eloquent\Model as EloquentModel; -use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; -use Orchestra\Testbench\TestCase as BaseTestCase; -use Tests\database\seeders\DatabaseSeeder; -use Tests\Fixtures\Models\ReadyPayment; -use Tests\Fixtures\Resources\Model; - -abstract class TestCase extends BaseTestCase -{ - public const PAYMENT_EXTERNAL_ID = '456789'; - public const PAYMENT_ID = '1234567890'; - public const PAYMENT_SUM = 12.34; - public const PAYMENT_SUM_FORMATTED = 1234; - public const CURRENCY = 643; - public const CURRENCY_FORMATTED = '643'; - public const PAYMENT_DATE = '2021-07-23 17:33:27'; - public const PAYMENT_DATE_FORMATTED = '2021-07-23T17:33:27Z'; - public const STATUS = 'NEW'; - public const URL = 'https://example.com'; - public const MODEL_TYPE_ID = 123; - public const MODEL_STATUS_ID = 0; - - protected $loadEnvironmentVariables = true; - - protected $model = ReadyPayment::class; - - protected function getPackageProviders($app): array - { - return [ServiceProvider::class]; - } - - protected function getEnvironmentSetup($app) - { - $app->useEnvironmentPath(__DIR__ . '/../'); - $app->bootstrapWith([LoadEnvironmentVariables::class]); - - /** @var \Illuminate\Config\Repository $config */ - $config = $app['config']; - - $config->set('cashier.payment.model', $this->model); - - $config->set('cashier.payment.map', [ - self::MODEL_TYPE_ID => 'tinkoff_online', - ]); - - $config->set('cashier.logs.enabled', false); - - $config->set('cashier.drivers.tinkoff_online', [ - DriverConstant::DRIVER => Driver::class, - DriverConstant::DETAILS => Model::class, - - DriverConstant::CLIENT_ID => env('CASHIER_TINKOFF_CLIENT_ID'), - DriverConstant::CLIENT_SECRET => env('CASHIER_TINKOFF_CLIENT_SECRET'), - ]); - } - - protected function defineDatabaseMigrations() - { - $this->loadMigrationsFrom(__DIR__ . '/database/migrations'); - $this->loadMigrationsFrom(__DIR__ . '/../vendor/cashbox/core/database/migrations/main'); - } - - protected function model(?Details $details = null): ReadyPayment - { - $model = PaymentConfig::getModel(); - - $payment = new $model(); - - return $payment->setRelation('cashier', $this->detailsRelation($payment, $details)); - } - - protected function detailsRelation(EloquentModel $model, ?Details $details): CashierDetail - { - $details = new CashierDetail([ - 'item_type' => ReadyPayment::class, - 'item_id' => self::PAYMENT_ID, - 'external_id' => self::PAYMENT_EXTERNAL_ID, - 'details' => $details, - ]); - - return $details->setRelation('parent', $model); - } - - /** - * @param \Cashbox\Tinkoff\Online\Requests\BaseRequest|string $request - */ - protected function request(string $request): Request - { - $model = $this->modelRequest(); - - return $request::make($model); - } - - protected function modelRequest(): Model - { - return Model::make($this->model(), $this->config()); - } - - protected function config(): DriverConfig - { - $config = config('cashier.drivers.tinkoff_online'); - - return DriverConfig::make($config); - } - - protected function getTerminalKey(): string - { - return config('cashier.drivers.tinkoff_online.client_id'); - } - - protected function getTerminalSecret(): string - { - return config('cashier.drivers.tinkoff_online.client_secret'); - } - - protected function runSeeders() - { - $seeder = new DatabaseSeeder(); - - $seeder->run(); - } -} diff --git a/src/TinkoffOnline/tests/database/migrations/2021_05_26_000000_create_payments_table.php b/src/TinkoffOnline/tests/database/migrations/2021_05_26_000000_create_payments_table.php deleted file mode 100644 index a37e8827..00000000 --- a/src/TinkoffOnline/tests/database/migrations/2021_05_26_000000_create_payments_table.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; - -class CreatePaymentsTable extends Migration -{ - protected $table = 'payments'; - - public function up() - { - Schema::create($this->table, function (Blueprint $table) { - $table->uuid('uuid'); - - $table->smallInteger('type_id'); - $table->smallInteger('status_id'); - - $table->double('sum', 10, 2)->default(0); - - $table->smallInteger('currency'); - - $table->timestamps(); - }); - } - - public function down() - { - Schema::dropIfExists($this->table); - } -} diff --git a/src/TinkoffOnline/tests/database/seeders/DatabaseSeeder.php b/src/TinkoffOnline/tests/database/seeders/DatabaseSeeder.php deleted file mode 100644 index 3a17e7ec..00000000 --- a/src/TinkoffOnline/tests/database/seeders/DatabaseSeeder.php +++ /dev/null @@ -1,26 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\database\seeders; - -use Illuminate\Database\Seeder; - -class DatabaseSeeder extends Seeder -{ - public function run() - { - $this->call(PaymentSeeder::class); - } -} diff --git a/src/TinkoffOnline/tests/database/seeders/PaymentSeeder.php b/src/TinkoffOnline/tests/database/seeders/PaymentSeeder.php deleted file mode 100644 index 7911818f..00000000 --- a/src/TinkoffOnline/tests/database/seeders/PaymentSeeder.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\database\seeders; - -use Illuminate\Database\Seeder; -use Tests\Fixtures\Factories\Payment; - -class PaymentSeeder extends Seeder -{ - public function run() - { - Payment::create(); - } -} diff --git a/src/TinkoffQrCode/tests/DriverTest.php b/src/TinkoffQrCode/tests/DriverTest.php deleted file mode 100644 index 5c7f5654..00000000 --- a/src/TinkoffQrCode/tests/DriverTest.php +++ /dev/null @@ -1,98 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Core\Http\ResponseInfo; -use Cashbox\Tinkoff\QrCode\Driver as QR; -use DragonCode\Contracts\Cashier\Driver as DriverContract; -use DragonCode\Contracts\Cashier\Http\Response as ResponseContract; -use DragonCode\Support\Facades\Http\Url; -use Tests\Fixtures\Models\RequestPayment; - -class DriverTest extends TestCase -{ - protected $model = RequestPayment::class; - - protected function setUp(): void - { - parent::setUp(); - - $this->runSeeders(); - } - - public function testStart() - { - $response = $this->driver()->start(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertNull($response->getStatus()); - - $this->assertTrue(Url::is($response->getUrl())); - } - - public function testCheck() - { - $this->driver()->start(); - - $response = $this->driver()->check(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertSame('FORM_SHOWED', $response->getStatus()); - - $this->assertSame([ - 'status' => 'FORM_SHOWED', - ], $response->toArray()); - } - - public function testRefund() - { - $this->driver()->start(); - - $response = $this->driver()->refund(); - - $this->assertInstanceOf(ResponseInfo::class, $response); - $this->assertInstanceOf(ResponseContract::class, $response); - - $this->assertIsString($response->getExternalId()); - $this->assertMatchesRegularExpression('/^(\d+)$/', $response->getExternalId()); - - $this->assertSame('CANCELED', $response->getStatus()); - } - - protected function driver(): DriverContract - { - $model = $this->payment(); - - $config = $this->config(); - - return QR::make($config, $model); - } - - protected function payment(): RequestPayment - { - return RequestPayment::firstOrFail(); - } -} diff --git a/src/TinkoffQrCode/tests/Fixtures/Factories/Payment.php b/src/TinkoffQrCode/tests/Fixtures/Factories/Payment.php deleted file mode 100644 index d3b2107d..00000000 --- a/src/TinkoffQrCode/tests/Fixtures/Factories/Payment.php +++ /dev/null @@ -1,33 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Factories; - -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class Payment -{ - public static function create(): RequestPayment - { - return RequestPayment::create([ - 'type_id' => TestCase::MODEL_TYPE_ID, - 'status_id' => TestCase::MODEL_STATUS_ID, - - 'sum' => TestCase::PAYMENT_SUM, - 'currency' => TestCase::CURRENCY, - ]); - } -} diff --git a/src/TinkoffQrCode/tests/Fixtures/Models/ReadyPayment.php b/src/TinkoffQrCode/tests/Fixtures/Models/ReadyPayment.php deleted file mode 100644 index c3cbcd9f..00000000 --- a/src/TinkoffQrCode/tests/Fixtures/Models/ReadyPayment.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; -use Illuminate\Support\Carbon; -use Tests\TestCase; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $uuid; - */ -class ReadyPayment extends UuidModel -{ - use Billable; - - protected function getUuidAttribute(): string - { - return TestCase::PAYMENT_ID; - } - - protected function getTypeIdAttribute(): int - { - return TestCase::MODEL_TYPE_ID; - } - - protected function getStatusIdAttribute(): int - { - return TestCase::MODEL_STATUS_ID; - } - - protected function getSumAttribute(): float - { - return TestCase::PAYMENT_SUM; - } - - protected function getCurrencyAttribute(): int - { - return TestCase::CURRENCY; - } - - protected function getCreatedAtAttribute(): Carbon - { - return Carbon::parse(TestCase::PAYMENT_DATE); - } -} diff --git a/src/TinkoffQrCode/tests/Fixtures/Models/RequestPayment.php b/src/TinkoffQrCode/tests/Fixtures/Models/RequestPayment.php deleted file mode 100644 index f19ecd52..00000000 --- a/src/TinkoffQrCode/tests/Fixtures/Models/RequestPayment.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Models; - -use Cashbox\Core\Billable; -use DragonCode\LaravelSupport\Eloquent\UuidModel; - -/** - * @property \Illuminate\Support\Carbon $created_at - * @property float $sum - * @property int $currency - * @property int $status_id - * @property int $type_id - * @property string $id; - */ -class RequestPayment extends UuidModel -{ - use Billable; - - protected $table = 'payments'; - - protected $fillable = ['type_id', 'status_id', 'sum', 'currency']; - - protected $casts = [ - 'type_id' => 'integer', - 'status_id' => 'integer', - - 'sum' => 'float', - 'currency' => 'integer', - ]; -} diff --git a/src/TinkoffQrCode/tests/Fixtures/Resources/Model.php b/src/TinkoffQrCode/tests/Fixtures/Resources/Model.php deleted file mode 100644 index 8bb2f745..00000000 --- a/src/TinkoffQrCode/tests/Fixtures/Resources/Model.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Fixtures\Resources; - -use Cashbox\Core\Resources\Model as BaseModel; -use Illuminate\Support\Carbon; - -/** @property \Tests\Fixtures\Models\ReadyPayment $model */ -class Model extends BaseModel -{ - public function getExternalId(): ?string - { - return $this->model->cashbox->external_id ?? null; - } - - protected function paymentId(): string - { - return $this->model->uuid; - } - - protected function sum(): float - { - return $this->model->sum; - } - - protected function currency(): int - { - return $this->model->currency; - } - - protected function createdAt(): Carbon - { - return $this->model->created_at; - } -} diff --git a/src/TinkoffQrCode/tests/Helpers/ExceptionTest.php b/src/TinkoffQrCode/tests/Helpers/ExceptionTest.php deleted file mode 100644 index ad9b816a..00000000 --- a/src/TinkoffQrCode/tests/Helpers/ExceptionTest.php +++ /dev/null @@ -1,135 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\Core\Exceptions\Http\BadRequestClientException; -use Cashbox\Core\Exceptions\Http\BaseException; -use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; -use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; -use Cashbox\Tinkoff\QrCode\Exceptions\Manager; -use DragonCode\Contracts\Http\Builder as HttpBuilder; -use DragonCode\Support\Facades\Http\Builder; -use Tests\TestCase; - -class ExceptionTest extends TestCase -{ - public function test7() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Buyer Not Found'); - $this->expectExceptionCode(404); - - $this->throw(7); - } - - public function test7String() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Buyer Not Found'); - $this->expectExceptionCode(404); - - $this->throw('7'); - } - - public function test7Reason() - { - $this->expectException(BuyerNotFoundClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(404); - - $this->throw(7, 'Foo Bar'); - } - - public function test53() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Contact The Seller'); - $this->expectExceptionCode(409); - - $this->throw(53); - } - - public function test53String() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Contact The Seller'); - $this->expectExceptionCode(409); - - $this->throw('53'); - } - - public function test53Reason() - { - $this->expectException(ContactTheSellerClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(409); - - $this->throw(53, 'Foo Bar'); - } - - public function testDefault() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw(10000); - } - - public function testDefaultString() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Bad Request'); - $this->expectExceptionCode(400); - - $this->throw('10000'); - } - - public function testDefaultReason() - { - $this->expectException(BadRequestClientException::class); - $this->expectException(BaseException::class); - $this->expectExceptionMessage('https://example.com/foo: Foo Bar'); - $this->expectExceptionCode(400); - - $this->throw(10000, 'Foo Bar'); - } - - protected function throw($code, ?string $reason = null) - { - $this->manager()->throw($this->uri(), $code, [ - 'Message' => $reason, - ]); - } - - protected function uri(): HttpBuilder - { - return Builder::parse('https://example.com/foo'); - } - - protected function manager(): Manager - { - return new Manager(); - } -} diff --git a/src/TinkoffQrCode/tests/Helpers/StatusesTest.php b/src/TinkoffQrCode/tests/Helpers/StatusesTest.php deleted file mode 100644 index 6dccec52..00000000 --- a/src/TinkoffQrCode/tests/Helpers/StatusesTest.php +++ /dev/null @@ -1,191 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Helpers; - -use Cashbox\Tinkoff\QrCode\Helpers\Statuses; -use Cashbox\Tinkoff\QrCode\Resources\Details; -use Tests\TestCase; - -class StatusesTest extends TestCase -{ - public function testModel() - { - $this->assertTrue($this->status('NEW')->hasCreated()); - $this->assertTrue($this->status('NEW')->inProgress()); - - $this->assertFalse($this->status('NEW')->hasSuccess()); - $this->assertFalse($this->status('NEW')->hasFailed()); - $this->assertFalse($this->status('NEW')->hasRefunding()); - $this->assertFalse($this->status('NEW')->hasRefunded()); - } - - public function testHasCreated() - { - $this->assertTrue($this->status('FORM_SHOWED')->hasCreated('FORM_SHOWED')); - $this->assertTrue($this->status('NEW')->hasCreated('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasCreated('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasCreated('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasCreated('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasCreated('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasCreated('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasCreated('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasCreated('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasCreated('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasCreated('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasCreated('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasCreated('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasCreated('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasCreated('UNKNOWN')); - } - - public function testHasSuccess() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasSuccess('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasSuccess('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasSuccess('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasSuccess('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasSuccess('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasSuccess('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasSuccess('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasSuccess('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasSuccess('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasSuccess('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasSuccess('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasSuccess('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasSuccess('REJECTED')); - - $this->assertTrue($this->status('CONFIRMED')->hasSuccess('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasSuccess('UNKNOWN')); - } - - public function testHasFailed() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasFailed('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasFailed('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasFailed('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasFailed('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasFailed('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasFailed('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasFailed('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasFailed('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasFailed('REVERSED')); - - $this->assertTrue($this->status('ATTEMPTS_EXPIRED')->hasFailed('ATTEMPTS_EXPIRED')); - $this->assertTrue($this->status('CANCELED')->hasFailed('CANCELED')); - $this->assertTrue($this->status('DEADLINE_EXPIRED')->hasFailed('DEADLINE_EXPIRED')); - $this->assertTrue($this->status('REJECTED')->hasFailed('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasFailed('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasFailed('UNKNOWN')); - } - - public function testHasRefunding() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasRefunding('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasRefunding('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasRefunding('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasRefunding('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasRefunding('CONFIRMING')); - - $this->assertTrue($this->status('REFUNDING')->hasRefunding('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->hasRefunding('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->hasRefunding('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->hasRefunding('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasRefunding('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasRefunding('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasRefunding('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasRefunding('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasRefunding('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasRefunding('UNKNOWN')); - } - - public function testHasRefunded() - { - $this->assertFalse($this->status('FORM_SHOWED')->hasRefunded('FORM_SHOWED')); - $this->assertFalse($this->status('NEW')->hasRefunded('NEW')); - - $this->assertFalse($this->status('AUTHORIZED')->hasRefunded('AUTHORIZED')); - $this->assertFalse($this->status('AUTHORIZING')->hasRefunded('AUTHORIZING')); - $this->assertFalse($this->status('CONFIRMING')->hasRefunded('CONFIRMING')); - - $this->assertFalse($this->status('REFUNDING')->hasRefunded('REFUNDING')); - - $this->assertTrue($this->status('PARTIAL_REFUNDED')->hasRefunded('PARTIAL_REFUNDED')); - $this->assertTrue($this->status('REFUNDED')->hasRefunded('REFUNDED')); - $this->assertTrue($this->status('REVERSED')->hasRefunded('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->hasRefunded('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->hasRefunded('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->hasRefunded('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->hasRefunded('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->hasRefunded('CONFIRMED')); - - $this->assertFalse($this->status('UNKNOWN')->hasRefunded('UNKNOWN')); - } - - public function testInProgress() - { - $this->assertTrue($this->status('FORM_SHOWED')->inProgress('FORM_SHOWED')); - $this->assertTrue($this->status('NEW')->inProgress('NEW')); - - $this->assertTrue($this->status('AUTHORIZED')->inProgress('AUTHORIZED')); - $this->assertTrue($this->status('AUTHORIZING')->inProgress('AUTHORIZING')); - $this->assertTrue($this->status('CONFIRMING')->inProgress('CONFIRMING')); - - $this->assertTrue($this->status('REFUNDING')->inProgress('REFUNDING')); - - $this->assertFalse($this->status('PARTIAL_REFUNDED')->inProgress('PARTIAL_REFUNDED')); - $this->assertFalse($this->status('REFUNDED')->inProgress('REFUNDED')); - $this->assertFalse($this->status('REVERSED')->inProgress('REVERSED')); - - $this->assertFalse($this->status('ATTEMPTS_EXPIRED')->inProgress('ATTEMPTS_EXPIRED')); - $this->assertFalse($this->status('CANCELED')->inProgress('CANCELED')); - $this->assertFalse($this->status('DEADLINE_EXPIRED')->inProgress('DEADLINE_EXPIRED')); - $this->assertFalse($this->status('REJECTED')->inProgress('REJECTED')); - - $this->assertFalse($this->status('CONFIRMED')->inProgress('CONFIRMED')); - - $this->assertTrue($this->status('UNKNOWN')->inProgress('UNKNOWN')); - } - - protected function status(string $status): Statuses - { - $details = Details::make(compact('status')); - - return Statuses::make($this->model($details)); - } -} diff --git a/src/TinkoffQrCode/tests/Jobs/JobsTest.php b/src/TinkoffQrCode/tests/Jobs/JobsTest.php deleted file mode 100644 index be981f65..00000000 --- a/src/TinkoffQrCode/tests/Jobs/JobsTest.php +++ /dev/null @@ -1,121 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Jobs; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Services\Jobs; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Support\Facades\DB; -use Tests\Fixtures\Factories\Payment; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class JobsTest extends TestCase -{ - protected $model = RequestPayment::class; - - public function testStart() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - public function testCheck() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - Jobs::make($payment)->start(); - Jobs::make($payment)->check(true); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - public function testRefund() - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - - Jobs::make($payment)->start(); - Jobs::make($payment)->refund(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertSame('CANCELED', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::REFUND), - $payment->status_id - ); - } - - protected function payment(): RequestPayment - { - return Payment::create(); - } -} diff --git a/src/TinkoffQrCode/tests/Observers/ObserverTest.php b/src/TinkoffQrCode/tests/Observers/ObserverTest.php deleted file mode 100644 index 163e88e1..00000000 --- a/src/TinkoffQrCode/tests/Observers/ObserverTest.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Observers; - -use Cashbox\Core\Constants\Status; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Providers\ObserverServiceProvider; -use Cashbox\Core\Providers\ServiceProvider; -use DragonCode\Support\Facades\Http\Url; -use Illuminate\Support\Facades\DB; -use Tests\Fixtures\Factories\Payment; -use Tests\Fixtures\Models\RequestPayment; -use Tests\TestCase; - -class ObserverTest extends TestCase -{ - protected $model = RequestPayment::class; - - public function testCreate(): RequestPayment - { - $this->assertSame(0, DB::table('payments')->count()); - $this->assertSame(0, DB::table('cashier_details')->count()); - - $payment = $this->payment(); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - - return $payment; - } - - public function testUpdate() - { - $payment = $this->testCreate(); - - $payment->update([ - 'sum' => 34.56, - ]); - - $payment->refresh(); - - $this->assertSame(1, DB::table('payments')->count()); - $this->assertSame(1, DB::table('cashier_details')->count()); - - $this->assertIsString($payment->cashbox->external_id); - $this->assertMatchesRegularExpression('/^(\d+)$/', $payment->cashbox->external_id); - - $this->assertTrue(Url::is($payment->cashbox->details->getUrl())); - - $this->assertSame('NEW', $payment->cashbox->details->getStatus()); - - $this->assertSame( - PaymentConfig::getStatuses()->getStatus(Status::NEW), - $payment->status_id - ); - } - - protected function getPackageProviders($app): array - { - return [ - ServiceProvider::class, - ObserverServiceProvider::class, - ]; - } - - protected function payment(): RequestPayment - { - return Payment::create()->refresh(); - } -} diff --git a/src/TinkoffQrCode/tests/Requests/CancelTest.php b/src/TinkoffQrCode/tests/Requests/CancelTest.php deleted file mode 100644 index aa55ff50..00000000 --- a/src/TinkoffQrCode/tests/Requests/CancelTest.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Core\Http\Request; -use Cashbox\Tinkoff\QrCode\Requests\Cancel; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class CancelTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Cancel::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(Cancel::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://securepay.tinkoff.ru/v2/Cancel', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - - 'TerminalKey' => $this->getTerminalKey(), - - 'Token' => '8473d8d4cafb9ec63071e9050c05e0dd1178fc8e1f3c765ffef7ec7fb5fcb758', - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(Cancel::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - ], $request->getRawBody()); - } -} diff --git a/src/TinkoffQrCode/tests/Requests/GetQRTest.php b/src/TinkoffQrCode/tests/Requests/GetQRTest.php deleted file mode 100644 index 7edb3396..00000000 --- a/src/TinkoffQrCode/tests/Requests/GetQRTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Core\Http\Request; -use Cashbox\Tinkoff\QrCode\Requests\GetQR; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class GetQRTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(GetQR::class); - - $this->assertInstanceOf(GetQR::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(GetQR::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://securepay.tinkoff.ru/v2/GetQr', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(GetQR::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(GetQR::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(GetQR::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - - 'TerminalKey' => $this->getTerminalKey(), - - 'Token' => 'dbcbdf5539c35132b63c1b54e0f107cc96e71cf96040ba54dec5e140255b2e63', - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(GetQR::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - ], $request->getRawBody()); - } -} diff --git a/src/TinkoffQrCode/tests/Requests/GetStateTest.php b/src/TinkoffQrCode/tests/Requests/GetStateTest.php deleted file mode 100644 index 6ad8b0ff..00000000 --- a/src/TinkoffQrCode/tests/Requests/GetStateTest.php +++ /dev/null @@ -1,93 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Core\Http\Request; -use Cashbox\Tinkoff\QrCode\Requests\GetState; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class GetStateTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(GetState::class); - - $this->assertInstanceOf(GetState::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(GetState::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://securepay.tinkoff.ru/v2/GetState', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - - 'TerminalKey' => $this->getTerminalKey(), - - 'Token' => 'dbcbdf5539c35132b63c1b54e0f107cc96e71cf96040ba54dec5e140255b2e63', - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(GetState::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - ], $request->getRawBody()); - } -} diff --git a/src/TinkoffQrCode/tests/Requests/InitTest.php b/src/TinkoffQrCode/tests/Requests/InitTest.php deleted file mode 100644 index 73e96f2d..00000000 --- a/src/TinkoffQrCode/tests/Requests/InitTest.php +++ /dev/null @@ -1,96 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Requests; - -use Cashbox\Core\Http\Request; -use Cashbox\Tinkoff\QrCode\Requests\Init; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Http\Builder; -use Tests\TestCase; - -class InitTest extends TestCase -{ - public function testInstance() - { - $request = $this->request(Init::class); - - $this->assertInstanceOf(Init::class, $request); - $this->assertInstanceOf(Request::class, $request); - $this->assertInstanceOf(RequestContract::class, $request); - } - - public function testUri() - { - $request = $this->request(Init::class); - - $this->assertInstanceOf(Builder::class, $request->uri()); - - $this->assertSame('https://securepay.tinkoff.ru/v2/Init', $request->uri()->toUrl()); - } - - public function testHeaders() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->headers()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->headers()); - } - - public function testGetRawHeaders() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->getRawHeaders()); - - $this->assertSame([ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ], $request->getRawHeaders()); - } - - public function testBody() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->body()); - - $this->assertSame([ - 'OrderId' => self::PAYMENT_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - 'Currency' => self::CURRENCY_FORMATTED, - - 'TerminalKey' => $this->getTerminalKey(), - 'Token' => $this->getTerminalSecret(), - ], $request->body()); - } - - public function testGetRawBody() - { - $request = $this->request(Init::class); - - $this->assertIsArray($request->getRawBody()); - - $this->assertSame([ - 'OrderId' => self::PAYMENT_ID, - 'Amount' => self::PAYMENT_SUM_FORMATTED, - 'Currency' => self::CURRENCY_FORMATTED, - ], $request->getRawBody()); - } -} diff --git a/src/TinkoffQrCode/tests/Resources/DetailsTest.php b/src/TinkoffQrCode/tests/Resources/DetailsTest.php deleted file mode 100644 index 4370b9a9..00000000 --- a/src/TinkoffQrCode/tests/Resources/DetailsTest.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Resources; - -use Cashbox\Core\Resources\Details as BaseDetails; -use Cashbox\Tinkoff\QrCode\Resources\Details; -use DragonCode\Contracts\Cashier\Resources\Details as DetailsContract; -use Tests\TestCase; - -class DetailsTest extends TestCase -{ - protected $expected = [ - 'status' => self::STATUS, - 'url' => self::URL, - ]; - - public function testMake() - { - $details = $this->details(); - - $this->assertInstanceOf(Details::class, $details); - $this->assertInstanceOf(BaseDetails::class, $details); - $this->assertInstanceOf(DetailsContract::class, $details); - } - - public function testGetUrl() - { - $details = $this->details(); - - $this->assertSame(self::URL, $details->getUrl()); - } - - public function testGetStatus() - { - $details = $this->details(); - - $this->assertSame(self::STATUS, $details->getStatus()); - } - - public function testToArray() - { - $details = $this->details(); - - $this->assertSame($this->expected, $details->toArray()); - } - - public function testToJson() - { - $details = $this->details(); - - $this->assertJson($details->toJson()); - - $this->assertSame(json_encode($this->expected), $details->toJson()); - } - - protected function details(): Details - { - return Details::make($this->expected); - } -} diff --git a/src/TinkoffQrCode/tests/Responses/InitTest.php b/src/TinkoffQrCode/tests/Responses/InitTest.php deleted file mode 100644 index 351be56d..00000000 --- a/src/TinkoffQrCode/tests/Responses/InitTest.php +++ /dev/null @@ -1,69 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use Cashbox\Tinkoff\QrCode\Responses\Init; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class InitTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Init::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Init::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'Amount' => self::PAYMENT_SUM_FORMATTED, - 'OrderId' => self::PAYMENT_ID, - 'Success' => true, - 'Status' => self::STATUS, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'ErrorCode' => 0, - ]); - } -} diff --git a/src/TinkoffQrCode/tests/Responses/QrCodeTest.php b/src/TinkoffQrCode/tests/Responses/QrCodeTest.php deleted file mode 100644 index 94343d67..00000000 --- a/src/TinkoffQrCode/tests/Responses/QrCodeTest.php +++ /dev/null @@ -1,82 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Tinkoff\QrCode\Responses\QrCode; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class QrCodeTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(QrCode::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $response->put('Status', self::STATUS); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testGetUrl() - { - $response = $this->response(); - - $this->assertSame(self::URL, $response->getUrl()); - } - - public function testToArray() - { - $response = $this->response(); - - $response->put('Status', self::STATUS); - - $this->assertSame([ - QrCode::KEY_STATUS => self::STATUS, - QrCode::KEY_URL => self::URL, - ], $response->toArray()); - } - - /** - * @return \Cashbox\Tinkoff\QrCode\Responses\QrCode|\DragonCode\Contracts\Cashier\Http\Response - */ - protected function response(): Response - { - return QrCode::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'OrderId' => self::PAYMENT_ID, - 'Success' => true, - 'Data' => self::URL, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'ErrorCode' => 0, - ]); - } -} diff --git a/src/TinkoffQrCode/tests/Responses/RefundTest.php b/src/TinkoffQrCode/tests/Responses/RefundTest.php deleted file mode 100644 index 7afb262d..00000000 --- a/src/TinkoffQrCode/tests/Responses/RefundTest.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use Cashbox\Tinkoff\QrCode\Responses\Refund; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class RefundTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(Refund::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return Refund::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'Success' => true, - 'Status' => self::STATUS, - 'ErrorCode' => 0, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'OrderId' => self::PAYMENT_ID, - ]); - } -} diff --git a/src/TinkoffQrCode/tests/Responses/StateTest.php b/src/TinkoffQrCode/tests/Responses/StateTest.php deleted file mode 100644 index fb34b2ca..00000000 --- a/src/TinkoffQrCode/tests/Responses/StateTest.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\Responses; - -use Cashbox\Core\Http\ResponseInfo as BaseResponse; -use Cashbox\Tinkoff\QrCode\Responses\State; -use DragonCode\Contracts\Cashier\Http\Response; -use Tests\TestCase; - -class StateTest extends TestCase -{ - public function testInstance() - { - $response = $this->response(); - - $this->assertInstanceOf(State::class, $response); - $this->assertInstanceOf(Response::class, $response); - } - - public function testGetExternalId() - { - $response = $this->response(); - - $this->assertSame(self::PAYMENT_EXTERNAL_ID, $response->getExternalId()); - } - - public function testGetStatus() - { - $response = $this->response(); - - $this->assertSame(self::STATUS, $response->getStatus()); - } - - public function testToArray() - { - $response = $this->response(); - - $this->assertSame([ - BaseResponse::KEY_STATUS => self::STATUS, - ], $response->toArray()); - } - - protected function response(): Response - { - return State::make([ - 'TerminalKey' => $this->getTerminalKey(), - - 'OrderId' => self::PAYMENT_ID, - 'Success' => true, - 'Status' => self::STATUS, - 'PaymentId' => self::PAYMENT_EXTERNAL_ID, - 'ErrorCode' => 0, - ]); - } -} diff --git a/src/TinkoffQrCode/tests/TestCase.php b/src/TinkoffQrCode/tests/TestCase.php deleted file mode 100644 index 66f72f2b..00000000 --- a/src/TinkoffQrCode/tests/TestCase.php +++ /dev/null @@ -1,147 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests; - -use Cashbox\Core\Config\Driver as DriverConfig; -use Cashbox\Core\Constants\Driver as DriverConstant; -use Cashbox\Core\Facades\Config\Payment as PaymentConfig; -use Cashbox\Core\Models\CashierDetail; -use Cashbox\Core\Providers\ServiceProvider; -use Cashbox\Tinkoff\QrCode\Driver; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\Details; -use Illuminate\Database\Eloquent\Model as EloquentModel; -use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; -use Orchestra\Testbench\TestCase as BaseTestCase; -use Tests\database\seeders\DatabaseSeeder; -use Tests\Fixtures\Models\ReadyPayment; -use Tests\Fixtures\Resources\Model; - -abstract class TestCase extends BaseTestCase -{ - public const PAYMENT_EXTERNAL_ID = '456789'; - public const PAYMENT_ID = '1234567890'; - public const PAYMENT_SUM = 12.34; - public const PAYMENT_SUM_FORMATTED = 1234; - public const CURRENCY = 643; - public const CURRENCY_FORMATTED = '643'; - public const PAYMENT_DATE = '2021-07-23 17:33:27'; - public const PAYMENT_DATE_FORMATTED = '2021-07-23T17:33:27Z'; - public const STATUS = 'NEW'; - public const URL = 'https://example.com'; - public const MODEL_TYPE_ID = 123; - public const MODEL_STATUS_ID = 0; - - protected $loadEnvironmentVariables = true; - - protected $model = ReadyPayment::class; - - protected function getPackageProviders($app): array - { - return [ServiceProvider::class]; - } - - protected function getEnvironmentSetup($app) - { - $app->useEnvironmentPath(__DIR__ . '/../'); - $app->bootstrapWith([LoadEnvironmentVariables::class]); - - /** @var \Illuminate\Config\Repository $config */ - $config = $app['config']; - - $config->set('cashier.payment.model', $this->model); - - $config->set('cashier.payment.map', [ - self::MODEL_TYPE_ID => 'tinkoff_qr', - ]); - - $config->set('cashier.logs.enabled', false); - - $config->set('cashier.drivers.tinkoff_qr', [ - DriverConstant::DRIVER => Driver::class, - DriverConstant::DETAILS => Model::class, - - DriverConstant::CLIENT_ID => env('CASHIER_TINKOFF_QR_CLIENT_ID'), - DriverConstant::CLIENT_SECRET => env('CASHIER_TINKOFF_QR_CLIENT_SECRET'), - ]); - } - - protected function defineDatabaseMigrations() - { - $this->loadMigrationsFrom(__DIR__ . '/database/migrations'); - $this->loadMigrationsFrom(__DIR__ . '/../vendor/cashbox/core/database/migrations/main'); - } - - protected function model(?Details $details = null): ReadyPayment - { - $model = PaymentConfig::getModel(); - - $payment = new $model(); - - return $payment->setRelation('cashier', $this->detailsRelation($payment, $details)); - } - - protected function detailsRelation(EloquentModel $model, ?Details $details): CashierDetail - { - $details = new CashierDetail([ - 'item_type' => ReadyPayment::class, - 'item_id' => self::PAYMENT_ID, - 'external_id' => self::PAYMENT_EXTERNAL_ID, - 'details' => $details, - ]); - - return $details->setRelation('parent', $model); - } - - /** - * @param \Cashbox\Tinkoff\QrCode\Requests\BaseRequest|string $request - */ - protected function request(string $request): Request - { - $model = $this->modelRequest(); - - return $request::make($model); - } - - protected function modelRequest(): Model - { - return Model::make($this->model(), $this->config()); - } - - protected function config(): DriverConfig - { - $config = config('cashier.drivers.tinkoff_qr'); - - return DriverConfig::make($config); - } - - protected function getTerminalKey(): string - { - return config('cashier.drivers.tinkoff_qr.client_id'); - } - - protected function getTerminalSecret(): string - { - return config('cashier.drivers.tinkoff_qr.client_secret'); - } - - protected function runSeeders() - { - $seeder = new DatabaseSeeder(); - - $seeder->run(); - } -} diff --git a/src/TinkoffQrCode/tests/database/migrations/2021_05_26_000000_create_payments_table.php b/src/TinkoffQrCode/tests/database/migrations/2021_05_26_000000_create_payments_table.php deleted file mode 100644 index a37e8827..00000000 --- a/src/TinkoffQrCode/tests/database/migrations/2021_05_26_000000_create_payments_table.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -use Illuminate\Database\Migrations\Migration; -use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\Schema; - -class CreatePaymentsTable extends Migration -{ - protected $table = 'payments'; - - public function up() - { - Schema::create($this->table, function (Blueprint $table) { - $table->uuid('uuid'); - - $table->smallInteger('type_id'); - $table->smallInteger('status_id'); - - $table->double('sum', 10, 2)->default(0); - - $table->smallInteger('currency'); - - $table->timestamps(); - }); - } - - public function down() - { - Schema::dropIfExists($this->table); - } -} diff --git a/src/TinkoffQrCode/tests/database/seeders/DatabaseSeeder.php b/src/TinkoffQrCode/tests/database/seeders/DatabaseSeeder.php deleted file mode 100644 index 3a17e7ec..00000000 --- a/src/TinkoffQrCode/tests/database/seeders/DatabaseSeeder.php +++ /dev/null @@ -1,26 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\database\seeders; - -use Illuminate\Database\Seeder; - -class DatabaseSeeder extends Seeder -{ - public function run() - { - $this->call(PaymentSeeder::class); - } -} diff --git a/src/TinkoffQrCode/tests/database/seeders/PaymentSeeder.php b/src/TinkoffQrCode/tests/database/seeders/PaymentSeeder.php deleted file mode 100644 index 7911818f..00000000 --- a/src/TinkoffQrCode/tests/database/seeders/PaymentSeeder.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Tests\database\seeders; - -use Illuminate\Database\Seeder; -use Tests\Fixtures\Factories\Payment; - -class PaymentSeeder extends Seeder -{ - public function run() - { - Payment::create(); - } -} From bd60f0903f4de8db5ce08aeda92eba4cc3c94391 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 15 Jul 2023 02:16:33 +0300 Subject: [PATCH 047/164] Fixed DTO binding --- src/Core/composer.json | 1 + .../src/Concerns/Config/Payment/Drivers.php | 3 +- src/Core/src/Data/Config/ConfigData.php | 11 +++++--- .../src/Data/Config/Payment/PaymentData.php | 5 ++-- src/Core/src/Facades/Config.php | 9 ++---- .../src/Providers/BindingServiceProvider.php | 28 +++++++++++++++++++ src/Core/src/Providers/ServiceProvider.php | 8 ------ 7 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 src/Core/src/Providers/BindingServiceProvider.php diff --git a/src/Core/composer.json b/src/Core/composer.json index ef0bbe92..23db224c 100644 --- a/src/Core/composer.json +++ b/src/Core/composer.json @@ -81,6 +81,7 @@ "laravel": { "providers": [ "Cashbox\\Core\\Providers\\ServiceProvider", + "Cashbox\\Core\\Providers\\BindingServiceProvider", "Cashbox\\Core\\Providers\\ObserverServiceProvider", "Cashbox\\Core\\Providers\\RateLimiterServiceProvider" ] diff --git a/src/Core/src/Concerns/Config/Payment/Drivers.php b/src/Core/src/Concerns/Config/Payment/Drivers.php index 88986527..22814248 100644 --- a/src/Core/src/Concerns/Config/Payment/Drivers.php +++ b/src/Core/src/Concerns/Config/Payment/Drivers.php @@ -22,14 +22,13 @@ use Cashbox\Core\Exceptions\Internal\UnknownDriverConfigException; use Cashbox\Core\Facades\Config; use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Collection; trait Drivers { use Attributes; use EnumsTransformer; - protected static function drivers(): Collection + protected static function drivers(): array { return Config::payment()->drivers; } diff --git a/src/Core/src/Data/Config/ConfigData.php b/src/Core/src/Data/Config/ConfigData.php index d216a7b0..a7ff3913 100644 --- a/src/Core/src/Data/Config/ConfigData.php +++ b/src/Core/src/Data/Config/ConfigData.php @@ -22,7 +22,6 @@ use Spatie\LaravelData\Attributes\DataCollectionOf; use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Data; -use Spatie\LaravelData\DataCollection; class ConfigData extends Data { @@ -43,7 +42,7 @@ class ConfigData extends Data public RefundData $refund; #[DataCollectionOf(DriverData::class)] - public DataCollection $drivers; + public array $drivers; public function payment(): PaymentData { @@ -75,9 +74,13 @@ public function refund(): RefundData return $this->refund; } - public function driver(int|string $name): DriverData + public function driver(int|string $name): ?DriverData { - return $this->drivers->offsetGet($name); + if ($driver = $this->drivers[$name] ?? null) { + return $driver; + } + + return null; } public function isProduction(): bool diff --git a/src/Core/src/Data/Config/Payment/PaymentData.php b/src/Core/src/Data/Config/Payment/PaymentData.php index 8d7de77b..ebc8a1dc 100644 --- a/src/Core/src/Data/Config/Payment/PaymentData.php +++ b/src/Core/src/Data/Config/Payment/PaymentData.php @@ -19,7 +19,6 @@ use Cashbox\Core\Data\Casts\PaymentModelCast; use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Collection; use Spatie\LaravelData\Attributes\WithCast; use Spatie\LaravelData\Data; @@ -32,6 +31,6 @@ class PaymentData extends Data public StatusData $status; - /** @var \Illuminate\Support\Collection */ - public Collection $drivers; + /** @var array */ + public array $drivers; } diff --git a/src/Core/src/Facades/Config.php b/src/Core/src/Facades/Config.php index 95cceda1..34343307 100644 --- a/src/Core/src/Facades/Config.php +++ b/src/Core/src/Facades/Config.php @@ -25,7 +25,6 @@ use Cashbox\Core\Data\Config\Queue\QueueData; use Cashbox\Core\Data\Config\RefundData; use Cashbox\Core\Data\Config\VerifyData; -use Cashbox\Core\Exceptions\Internal\ConfigCannotBeEmptyException; use Illuminate\Support\Facades\Facade; /** @@ -40,12 +39,8 @@ */ class Config extends Facade { - protected static function getFacadeAccessor(): ConfigData + protected static function getFacadeAccessor(): string { - if ($config = config('cashbox')) { - return ConfigData::from($config); - } - - throw new ConfigCannotBeEmptyException(); + return ConfigData::class; } } diff --git a/src/Core/src/Providers/BindingServiceProvider.php b/src/Core/src/Providers/BindingServiceProvider.php new file mode 100644 index 00000000..8480cd0f --- /dev/null +++ b/src/Core/src/Providers/BindingServiceProvider.php @@ -0,0 +1,28 @@ +bindConfig(); + } + + protected function bindConfig(): void + { + $this->app->singleton(ConfigData::class, function () { + if ($config = config('cashbox')) { + return ConfigData::from($config); + } + + throw new ConfigCannotBeEmptyException(); + }); + } +} diff --git a/src/Core/src/Providers/ServiceProvider.php b/src/Core/src/Providers/ServiceProvider.php index 64b80b3f..6d2c8ba4 100644 --- a/src/Core/src/Providers/ServiceProvider.php +++ b/src/Core/src/Providers/ServiceProvider.php @@ -24,10 +24,6 @@ class ServiceProvider extends BaseProvider { public function boot(): void { - if ($this->disabled()) { - return; - } - $this->bootMigrations(); $this->bootPublishes(); $this->bootCommands(); @@ -35,10 +31,6 @@ public function boot(): void public function register(): void { - if ($this->disabled()) { - return; - } - $this->registerConfig(); } From d3e1fa905c86885123f4bd28b2dfdacd7dada61d Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 15 Jul 2023 02:16:55 +0300 Subject: [PATCH 048/164] Removed compact output option when run from phpStorm --- .run/parallel.run.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.run/parallel.run.xml b/.run/parallel.run.xml index 020dd320..a8a7b35d 100644 --- a/.run/parallel.run.xml +++ b/.run/parallel.run.xml @@ -1,10 +1,10 @@ From caac87eda21eb3b504ed05c5eb007297c8588c58 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 15 Jul 2023 02:17:08 +0300 Subject: [PATCH 049/164] Added configuration tests --- src/Core/src/Data/Config/ConfigData.php | 3 +- tests/Pest.php | 26 ++-- tests/TestCase.php | 22 +++ tests/Unit/Core/EmptyConfigTest.php | 14 -- tests/Unit/Core/Facades/ConfigTest.php | 182 ++++++++++++++++++++++++ 5 files changed, 217 insertions(+), 30 deletions(-) delete mode 100644 tests/Unit/Core/EmptyConfigTest.php create mode 100644 tests/Unit/Core/Facades/ConfigTest.php diff --git a/src/Core/src/Data/Config/ConfigData.php b/src/Core/src/Data/Config/ConfigData.php index a7ff3913..9d6f075c 100644 --- a/src/Core/src/Data/Config/ConfigData.php +++ b/src/Core/src/Data/Config/ConfigData.php @@ -22,6 +22,7 @@ use Spatie\LaravelData\Attributes\DataCollectionOf; use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Data; +use Spatie\LaravelData\DataCollection; class ConfigData extends Data { @@ -42,7 +43,7 @@ class ConfigData extends Data public RefundData $refund; #[DataCollectionOf(DriverData::class)] - public array $drivers; + public DataCollection $drivers; public function payment(): PaymentData { diff --git a/tests/Pest.php b/tests/Pest.php index b8403adb..468dfb82 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,6 +1,7 @@ toBe(1); }); -function tableToBeNotEmpty(string $table): void -{ - expect( - DB::table($table)->exists() - )->toBeTrue(); -} - -function tableToBeEmpty(string $table): void -{ - expect( - DB::table($table)->doesntExist() - )->toBeTrue(); -} - /* |-------------------------------------------------------------------------- | Functions @@ -58,6 +45,15 @@ function tableToBeEmpty(string $table): void | */ +function forget(string $class, Facade|string|null $facade = null): void +{ + if ($facade) { + $facade::clearResolvedInstances(); + } + + App::forgetInstance($class); +} + function createPayment(TypeEnum $type, ?float $price = null): PaymentModel { $price ??= random_int(1, 50000); diff --git a/tests/TestCase.php b/tests/TestCase.php index 6e53385f..ccd55c11 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -5,11 +5,13 @@ use Cashbox\Cash\Driver; use Cashbox\Core\Enums\AttributeEnum; use Cashbox\Core\Enums\StatusEnum; +use Cashbox\Core\Providers\BindingServiceProvider; use Cashbox\Core\Providers\ObserverServiceProvider; use Cashbox\Core\Providers\RateLimiterServiceProvider; use Cashbox\Core\Providers\ServiceProvider; use Illuminate\Foundation\Testing\RefreshDatabase; use Orchestra\Testbench\TestCase as BaseTestCase; +use Spatie\LaravelData\LaravelDataServiceProvider; use Tests\Fixtures\Details\CashPaymentDetails; use Tests\Fixtures\Enums\StatusEnum as TestStatusEnum; use Tests\Fixtures\Enums\TypeEnum; @@ -23,8 +25,10 @@ abstract class TestCase extends BaseTestCase protected function getPackageProviders($app): array { return [ + LaravelDataServiceProvider::class, TestServiceProvider::class, ServiceProvider::class, + BindingServiceProvider::class, ObserverServiceProvider::class, RateLimiterServiceProvider::class, ]; @@ -49,5 +53,23 @@ protected function getEnvironmentSetUp($app): void 'driver' => Driver::class, 'details' => CashPaymentDetails::class, ]); + + $app['config']->set('cashbox.drivers.' . TypeEnum::cash() . '_1', [ + 'driver' => Driver::class, + 'details' => CashPaymentDetails::class, + 'queue' => [ + 'start' => 'q4', + 'verify' => 'q5', + 'refund' => 'q6', + ], + ]); + + $app['config']->set('cashbox.drivers.' . TypeEnum::cash() . '_2', [ + 'driver' => Driver::class, + 'details' => CashPaymentDetails::class, + 'queue' => [ + 'start' => 'q4', + ], + ]); } } diff --git a/tests/Unit/Core/EmptyConfigTest.php b/tests/Unit/Core/EmptyConfigTest.php deleted file mode 100644 index 3b051b75..00000000 --- a/tests/Unit/Core/EmptyConfigTest.php +++ /dev/null @@ -1,14 +0,0 @@ - []]); -//})->throws( -// ConfigCannotBeEmptyException::class, -// 'Error reading configuration. Check the existence of the "config/cashbox.php" file.' -//); - -it('some', function () { - expect(true)->toBeTrue(); -}); diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php new file mode 100644 index 00000000..81573e7e --- /dev/null +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -0,0 +1,182 @@ + []]); + + Config::isProduction(); +}) + ->throws(ConfigCannotBeEmptyException::class) + ->expectExceptionMessage('Error reading configuration'); + +it('is production', function () { + expect( + Config::isProduction() + )->toBeFalse(); +}); + +it('checks the payment block', function () { + $data = Config::payment(); + + expect($data->model)->toBe(PaymentModel::class); + + expect($data->attribute->type)->toBe('type'); + expect($data->attribute->status)->toBe('status'); + expect($data->attribute->createdAt)->toBe('created_at'); + + expect($data->status->new)->toBe(StatusEnum::new); + expect($data->status->success)->toBe(StatusEnum::success); + expect($data->status->waitRefund)->toBe(StatusEnum::waitRefund); + expect($data->status->refund)->toBe(StatusEnum::refund); + expect($data->status->failed)->toBe(StatusEnum::failed); + + expect($data->drivers)->toBeArray(); + expect($data->drivers)->toBe([ + TypeEnum::cash() => TypeEnum::cash(), + ]); +}); + +it('checks the details data block', function () { + $data = Config::details(); + + expect($data->connection)->toBe('testing'); + + expect($data->table)->toBe('cashbox_details'); +}); + +it('checks the logs block', function () { + $data = Config::logs(); + + expect($data->info)->toBeNull(); + expect($data->error)->toBeNull(); +}); + +it('checks the queue block', function () { + $data = Config::queue(); + + expect($data->connection)->toBe('sync'); + expect($data->tries)->toBe(50); + expect($data->exceptions)->toBe(3); + + expect($data->name->start)->toBeNull(); + expect($data->name->verify)->toBeNull(); + expect($data->name->refund)->toBeNull(); +}); + +it('should be correct tries', function (int $set, int $tries, int $exceptions) { + forget(ConfigData::class, Config::class); + + config(['cashbox.queue.tries' => $set]); + config(['cashbox.queue.exceptions' => $set]); + + expect(Config::queue()->tries)->toBe($tries); + expect(Config::queue()->exceptions)->toBe($exceptions); +})->with([ + [-10, 1, 1], + [794, 50, 10], + [51, 50, 10], + [50, 50, 10], + [1, 1, 1], +]); + +it('checks the verify block', function (int $set, int $delay, int $timeout) { + forget(ConfigData::class, Config::class); + + config(['cashbox.verify.delay' => $set]); + config(['cashbox.verify.timeout' => $set]); + + expect(Config::verify()->delay)->toBe($delay); + expect(Config::verify()->timeout)->toBe($timeout); +})->with([ + [-10, 0, 0], + [0, 0, 0], + [1, 1, 1], + [10, 10, 10], + [50, 50, 30], + [100, 60, 30], +]); + +it('checks the refund block', function (int $set, int $delay) { + forget(ConfigData::class, Config::class); + + config(['cashbox.auto_refund.delay' => $set]); + + expect(Config::refund()->delay)->toBe($delay); +})->with([ + [-10, 0], + [0, 0], + [1, 1], + [10, 10], + [50, 50], + [100, 100], + [600, 600], + [700, 600], +]); + +it('should return an error when accessing a non-existent driver', function () { + expect( + Config::driver('qwerty') + )->toBeNull(); +}); + +it('should check the correctness of the driver settings', function () { + // cash + $cash = Config::driver(TypeEnum::cash()); + + expect($cash->driver)->toBe(Driver::class); + expect($cash->details)->toBe(CashPaymentDetails::class); + expect($cash->credentials)->toBeNull(); + expect($cash->queue)->toBeNull(); + + expect($cash->getQueue()->start)->toBeNull(); + expect($cash->getQueue()->verify)->toBeNull(); + expect($cash->getQueue()->refund)->toBeNull(); +}); + +it( + 'should check the correctness of getting the name of the queue for the job', + function ( + string $name, + ?string $ms, + ?string $mv, + ?string $mr, + ?string $ds, + ?string $dv, + ?string $dr, + ?string $bs, + ?string $bv, + ?string $br + ) { + forget(ConfigData::class, Config::class); + + config(['cashbox.queue.name.start' => $ms]); + config(['cashbox.queue.name.verify' => $mv]); + config(['cashbox.queue.name.refund' => $mr]); + + config(["cashbox.drivers.$name.start" => $ds]); + config(["cashbox.drivers.$name.verify" => $dv]); + config(["cashbox.drivers.$name.refund" => $dr]); + + $item = Config::driver($name); + + expect($item->getQueue()->start)->toBe($bs); + expect($item->getQueue()->verify)->toBe($bv); + expect($item->getQueue()->refund)->toBe($br); + } +)->with([ + [TypeEnum::cash(), 'q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q1', 'q2', 'q3'], + [TypeEnum::cash() . '_1', 'q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q4', 'q5', 'q6'], + [TypeEnum::cash() . '_2', 'q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q4', null, null], +]); From 5eff6a0435d0481524372514a27eebe9c296789f Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 15 Jul 2023 14:57:50 +0300 Subject: [PATCH 050/164] Added tests for checking queue names --- tests/TestCase.php | 18 -------- tests/Unit/Core/Facades/ConfigTest.php | 63 ++++++++++++++++---------- 2 files changed, 38 insertions(+), 43 deletions(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index ccd55c11..25eb909e 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -53,23 +53,5 @@ protected function getEnvironmentSetUp($app): void 'driver' => Driver::class, 'details' => CashPaymentDetails::class, ]); - - $app['config']->set('cashbox.drivers.' . TypeEnum::cash() . '_1', [ - 'driver' => Driver::class, - 'details' => CashPaymentDetails::class, - 'queue' => [ - 'start' => 'q4', - 'verify' => 'q5', - 'refund' => 'q6', - ], - ]); - - $app['config']->set('cashbox.drivers.' . TypeEnum::cash() . '_2', [ - 'driver' => Driver::class, - 'details' => CashPaymentDetails::class, - 'queue' => [ - 'start' => 'q4', - ], - ]); } } diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 81573e7e..951d5463 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -131,7 +131,7 @@ )->toBeNull(); }); -it('should check the correctness of the driver settings', function () { +it('should check the driver settings', function () { // cash $cash = Config::driver(TypeEnum::cash()); @@ -147,36 +147,49 @@ it( 'should check the correctness of getting the name of the queue for the job', - function ( - string $name, - ?string $ms, - ?string $mv, - ?string $mr, - ?string $ds, - ?string $dv, - ?string $dr, - ?string $bs, - ?string $bv, - ?string $br - ) { + function (array $main, array $driver, array $expected) { forget(ConfigData::class, Config::class); - config(['cashbox.queue.name.start' => $ms]); - config(['cashbox.queue.name.verify' => $mv]); - config(['cashbox.queue.name.refund' => $mr]); + $name = TypeEnum::cash(); - config(["cashbox.drivers.$name.start" => $ds]); - config(["cashbox.drivers.$name.verify" => $dv]); - config(["cashbox.drivers.$name.refund" => $dr]); + config(['cashbox.queue.name' => $main]); + config(["cashbox.drivers.$name.queue" => $driver]); $item = Config::driver($name); - expect($item->getQueue()->start)->toBe($bs); - expect($item->getQueue()->verify)->toBe($bv); - expect($item->getQueue()->refund)->toBe($br); + expect($item->getQueue()->start)->toBe($expected['start']); + expect($item->getQueue()->verify)->toBe($expected['verify']); + expect($item->getQueue()->refund)->toBe($expected['refund']); } )->with([ - [TypeEnum::cash(), 'q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q1', 'q2', 'q3'], - [TypeEnum::cash() . '_1', 'q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q4', 'q5', 'q6'], - [TypeEnum::cash() . '_2', 'q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q4', null, null], + 'filled' => [ + driverData('q1', 'q2', 'q3'), + driverData('q4', 'q5', 'q6'), + driverData('q4', 'q5', 'q6'), + ], + 'partial' => [ + driverData('q1', 'q2', 'q3'), + driverData('q4', null, null), + driverData('q4', null, null), + ], + 'driver empty' => [ + driverData('q1', 'q2', 'q3'), + [], + driverData(null, null, null), + ], + 'main empty' => [ + [], + driverData('q4', 'q5', 'q6'), + driverData('q4', 'q5', 'q6'), + ], + 'full empty' => [ + [], + [], + driverData(null, null, null), + ], ]); + +function driverData(?string $start, ?string $verify, ?string $refund): array +{ + return compact('start', 'verify', 'refund'); +} From 27ecb989cb7d95df6f181ab3c0e37c014c68c59d Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 15 Jul 2023 16:23:29 +0300 Subject: [PATCH 051/164] Cast tests added --- tests/Fixtures/Data/FakeData.php | 12 ++++ tests/Pest.php | 23 +++++++ .../Unit/Core/Data/Casts/FromEnumCastTest.php | 22 +++++++ tests/Unit/Core/Data/Casts/NumberCastTest.php | 29 +++++++++ .../Core/Data/Casts/PaymentModelCastTest.php | 25 ++++++++ tests/Unit/Core/Facades/ConfigTest.php | 60 ++++--------------- 6 files changed, 122 insertions(+), 49 deletions(-) create mode 100644 tests/Fixtures/Data/FakeData.php create mode 100644 tests/Unit/Core/Data/Casts/FromEnumCastTest.php create mode 100644 tests/Unit/Core/Data/Casts/NumberCastTest.php create mode 100644 tests/Unit/Core/Data/Casts/PaymentModelCastTest.php diff --git a/tests/Fixtures/Data/FakeData.php b/tests/Fixtures/Data/FakeData.php new file mode 100644 index 00000000..8d3bfb05 --- /dev/null +++ b/tests/Fixtures/Data/FakeData.php @@ -0,0 +1,12 @@ +cast($property, $value, $context); +} diff --git a/tests/Unit/Core/Data/Casts/FromEnumCastTest.php b/tests/Unit/Core/Data/Casts/FromEnumCastTest.php new file mode 100644 index 00000000..9c1bab27 --- /dev/null +++ b/tests/Unit/Core/Data/Casts/FromEnumCastTest.php @@ -0,0 +1,22 @@ +toBe(TypeEnum::cash->value)->toBeString(); + + expect( + dataCast(FromEnumCast::class, TypeEnum::outside) + )->toBe(TypeEnum::outside->value)->toBeString(); +}); + +it('must be a empty', function () { + expect( + dataCast(FromEnumCast::class, null) + )->toBeNull(); +}); diff --git a/tests/Unit/Core/Data/Casts/NumberCastTest.php b/tests/Unit/Core/Data/Casts/NumberCastTest.php new file mode 100644 index 00000000..3dca6bef --- /dev/null +++ b/tests/Unit/Core/Data/Casts/NumberCastTest.php @@ -0,0 +1,29 @@ +toBeInt()->toBe($value); +})->with( + fn () => range(0, 20) +); + +it('should check the min value', function (int $value) { + expect( + dataCast(NumberCast::class, $value) + )->toBeInt()->toBe(0); +})->with( + fn () => range(-20, 0) +); + +it('should check the max value', function (int $value) { + expect( + dataCast(NumberCast::class, $value) + )->toBeInt()->toBe(100); +})->with( + fn () => range(100, 120) +); diff --git a/tests/Unit/Core/Data/Casts/PaymentModelCastTest.php b/tests/Unit/Core/Data/Casts/PaymentModelCastTest.php new file mode 100644 index 00000000..bbd7b1e5 --- /dev/null +++ b/tests/Unit/Core/Data/Casts/PaymentModelCastTest.php @@ -0,0 +1,25 @@ +model + )->toBe(PaymentModel::class); +}); + +it('should check the incorrect payment model', function () { + forgetConfig(); + + config(['cashbox.payment.model' => FakeData::class]); + + Config::payment()->model; +}) + ->throws(IncorrectPaymentModelException::class) + ->expectExceptionMessage(sprintf('The "%s" class must implement "%s".', FakeData::class, Billable::class)); diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 951d5463..b2aa5e77 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Cashbox\Cash\Driver; -use Cashbox\Core\Data\Config\ConfigData; use Cashbox\Core\Exceptions\Internal\ConfigCannotBeEmptyException; use Cashbox\Core\Facades\Config; use Tests\Fixtures\Details\CashPaymentDetails; @@ -12,7 +11,7 @@ use Tests\Fixtures\Models\PaymentModel; it('should return an error when running an empty config file', function () { - forget(ConfigData::class, Config::class); + forgetConfig(); config(['cashbox' => []]); @@ -75,55 +74,18 @@ expect($data->name->refund)->toBeNull(); }); -it('should be correct tries', function (int $set, int $tries, int $exceptions) { - forget(ConfigData::class, Config::class); +it('checks the verify block', function () { + $data = Config::verify(); - config(['cashbox.queue.tries' => $set]); - config(['cashbox.queue.exceptions' => $set]); - - expect(Config::queue()->tries)->toBe($tries); - expect(Config::queue()->exceptions)->toBe($exceptions); -})->with([ - [-10, 1, 1], - [794, 50, 10], - [51, 50, 10], - [50, 50, 10], - [1, 1, 1], -]); + expect($data->delay)->toBe(3); + expect($data->timeout)->toBe(30); +}); -it('checks the verify block', function (int $set, int $delay, int $timeout) { - forget(ConfigData::class, Config::class); - - config(['cashbox.verify.delay' => $set]); - config(['cashbox.verify.timeout' => $set]); - - expect(Config::verify()->delay)->toBe($delay); - expect(Config::verify()->timeout)->toBe($timeout); -})->with([ - [-10, 0, 0], - [0, 0, 0], - [1, 1, 1], - [10, 10, 10], - [50, 50, 30], - [100, 60, 30], -]); +it('checks the refund block', function () { + forgetConfig(); -it('checks the refund block', function (int $set, int $delay) { - forget(ConfigData::class, Config::class); - - config(['cashbox.auto_refund.delay' => $set]); - - expect(Config::refund()->delay)->toBe($delay); -})->with([ - [-10, 0], - [0, 0], - [1, 1], - [10, 10], - [50, 50], - [100, 100], - [600, 600], - [700, 600], -]); + expect(Config::refund()->delay)->toBe(600); +}); it('should return an error when accessing a non-existent driver', function () { expect( @@ -148,7 +110,7 @@ it( 'should check the correctness of getting the name of the queue for the job', function (array $main, array $driver, array $expected) { - forget(ConfigData::class, Config::class); + forgetConfig(); $name = TypeEnum::cash(); From e24ece8b35dbd2f48dd0da383f73d9574376abf8 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 15 Jul 2023 19:59:18 +0300 Subject: [PATCH 052/164] WIP --- src/Cash/src/Driver.php | 12 ++--- src/Cash/src/Exceptions/Exception.php | 2 +- .../src/{ => Http}/Requests/CreateRequest.php | 9 +--- .../src/{ => Http}/Requests/RefundRequest.php | 9 +--- .../src/{ => Http}/Requests/VerifyRequest.php | 9 +--- .../Responses/Response.php} | 20 ++++---- src/Cash/src/Resources/CashResource.php | 11 ++++ src/Core/config/cashbox.php | 6 ++- src/Core/src/Casts/InfoCast.php | 50 ------------------- src/Core/src/Concerns/Enums/From.php | 36 ++++++++++++- src/Core/src/Concerns/Events/Notifiable.php | 2 - src/Core/src/Concerns/Helpers/Identifiers.php | 15 ++++++ .../Transformers/EnumsTransformer.php | 6 +-- .../InstanceOfCast.php} | 14 ++++-- src/Core/src/Data/Config/DriverData.php | 10 +++- .../src/Data/Config/Payment/AttributeData.php | 4 ++ .../src/Data/Config/Payment/PaymentData.php | 6 ++- .../src/Data/Config/Payment/StatusData.php | 16 +++--- src/Core/src/Data/Models/InfoData.php | 43 ++++++++-------- src/Core/src/Enums/AttributeEnum.php | 4 ++ src/Core/src/Enums/StatusEnum.php | 6 +-- src/Core/src/Events/DeletedEvent.php | 20 -------- .../Internal/IncorrectDriverException.php | 12 +++++ ...eption.php => IncorrectModelException.php} | 2 +- .../Internal/IncorrectResourceException.php | 12 +++++ src/Core/src/Http/Request.php | 11 ++-- .../Http/{ResponseInfo.php => Response.php} | 9 ++-- src/Core/src/Jobs/BaseJob.php | 4 +- src/Core/src/Jobs/RefundJob.php | 6 +-- src/Core/src/Jobs/StartJob.php | 4 +- src/Core/src/Jobs/VerifyJob.php | 4 +- src/Core/src/Models/Details.php | 3 +- .../src/Observers/PaymentDetailsObserver.php | 7 ++- src/Core/src/Observers/PaymentObserver.php | 8 --- src/Core/src/Resources/Resource.php | 48 ++++++++++++++++++ src/Core/src/Services/Driver.php | 26 ++++++---- src/Core/src/Services/Http.php | 4 ++ src/Core/src/Services/Validator.php | 6 +-- src/SberOnline/src/Responses/Created.php | 4 +- src/SberOnline/src/Responses/Refund.php | 4 +- src/SberOnline/src/Responses/State.php | 4 +- src/SberQrCode/src/Responses/Cancel.php | 4 +- src/SberQrCode/src/Responses/QrCode.php | 4 +- src/SberQrCode/src/Responses/Status.php | 4 +- src/TemplateDriver/src/Responses/Created.php | 4 +- src/TemplateDriver/src/Responses/Refund.php | 4 +- src/TemplateDriver/src/Responses/State.php | 4 +- src/TinkoffCredit/src/Responses/Created.php | 4 +- src/TinkoffCredit/src/Responses/Refund.php | 4 +- src/TinkoffCredit/src/Responses/State.php | 4 +- src/TinkoffOnline/src/Responses/Init.php | 4 +- src/TinkoffOnline/src/Responses/Refund.php | 4 +- src/TinkoffOnline/src/Responses/State.php | 4 +- src/TinkoffQrCode/src/Responses/Init.php | 4 +- src/TinkoffQrCode/src/Responses/QrCode.php | 4 +- src/TinkoffQrCode/src/Responses/Refund.php | 4 +- src/TinkoffQrCode/src/Responses/State.php | 4 +- tests/Fixtures/Details/CashPaymentDetails.php | 9 ---- tests/Fixtures/Payments/Cash.php | 11 ++++ tests/Pest.php | 7 ++- tests/TestCase.php | 6 +-- .../Casts/Instances/InstanceOfCastTest.php | 22 ++++++++ .../Core/Data/Casts/PaymentModelCastTest.php | 25 ---------- tests/Unit/Core/Facades/ConfigTest.php | 43 ++++++++++++++-- 64 files changed, 394 insertions(+), 281 deletions(-) rename src/Cash/src/{ => Http}/Requests/CreateRequest.php (80%) rename src/Cash/src/{ => Http}/Requests/RefundRequest.php (80%) rename src/Cash/src/{ => Http}/Requests/VerifyRequest.php (80%) rename src/Cash/src/{Responses/ResponseInfo.php => Http/Responses/Response.php} (66%) create mode 100644 src/Cash/src/Resources/CashResource.php delete mode 100644 src/Core/src/Casts/InfoCast.php create mode 100644 src/Core/src/Concerns/Helpers/Identifiers.php rename src/Core/src/Data/Casts/{PaymentModelCast.php => Instances/InstanceOfCast.php} (65%) delete mode 100644 src/Core/src/Events/DeletedEvent.php create mode 100644 src/Core/src/Exceptions/Internal/IncorrectDriverException.php rename src/Core/src/Exceptions/Internal/{IncorrectPaymentModelException.php => IncorrectModelException.php} (90%) create mode 100644 src/Core/src/Exceptions/Internal/IncorrectResourceException.php rename src/Core/src/Http/{ResponseInfo.php => Response.php} (74%) create mode 100644 src/Core/src/Resources/Resource.php delete mode 100644 tests/Fixtures/Details/CashPaymentDetails.php create mode 100644 tests/Fixtures/Payments/Cash.php create mode 100644 tests/Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php delete mode 100644 tests/Unit/Core/Data/Casts/PaymentModelCastTest.php diff --git a/src/Cash/src/Driver.php b/src/Cash/src/Driver.php index d436def9..23c989cf 100644 --- a/src/Cash/src/Driver.php +++ b/src/Cash/src/Driver.php @@ -16,12 +16,12 @@ namespace Cashbox\Cash; use Cashbox\Cash\Exceptions\Exception; -use Cashbox\Cash\Requests\CreateRequest; -use Cashbox\Cash\Requests\RefundRequest; -use Cashbox\Cash\Requests\VerifyRequest; -use Cashbox\Cash\Responses\ResponseInfo; +use Cashbox\Cash\Http\Requests\CreateRequest; +use Cashbox\Cash\Http\Requests\RefundRequest; +use Cashbox\Cash\Http\Requests\VerifyRequest; +use Cashbox\Cash\Http\Responses\Response; use Cashbox\Cash\Services\Statuses; -use Cashbox\Core\Http\ResponseInfo as BaseInfoData; +use Cashbox\Core\Http\Response as BaseInfoData; use Cashbox\Core\Services\Driver as BaseDriver; class Driver extends BaseDriver @@ -30,7 +30,7 @@ class Driver extends BaseDriver protected string $exception = Exception::class; - protected string $info = ResponseInfo::class; + protected string $response = Response::class; public function start(): BaseInfoData { diff --git a/src/Cash/src/Exceptions/Exception.php b/src/Cash/src/Exceptions/Exception.php index 5e8d1bda..51b59436 100644 --- a/src/Cash/src/Exceptions/Exception.php +++ b/src/Cash/src/Exceptions/Exception.php @@ -19,4 +19,4 @@ use Cashbox\Core\Services\Exception as BaseException; -class Exception extends BaseException {} +class Exception extends BaseException { } diff --git a/src/Cash/src/Requests/CreateRequest.php b/src/Cash/src/Http/Requests/CreateRequest.php similarity index 80% rename from src/Cash/src/Requests/CreateRequest.php rename to src/Cash/src/Http/Requests/CreateRequest.php index 82db28f5..547a0a33 100644 --- a/src/Cash/src/Requests/CreateRequest.php +++ b/src/Cash/src/Http/Requests/CreateRequest.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Cashbox\Cash\Requests; +namespace Cashbox\Cash\Http\Requests; use Cashbox\Core\Http\Request; @@ -24,17 +24,12 @@ class CreateRequest extends Request public function body(): array { return [ - 'paymentId' => $this->payment->getKey(), + 'external_id' => $this->resource->paymentId(), 'status' => 'NEW', ]; } - public function headers(): array - { - return []; - } - public function uri(): ?string { return null; diff --git a/src/Cash/src/Requests/RefundRequest.php b/src/Cash/src/Http/Requests/RefundRequest.php similarity index 80% rename from src/Cash/src/Requests/RefundRequest.php rename to src/Cash/src/Http/Requests/RefundRequest.php index a37e8754..7830f258 100644 --- a/src/Cash/src/Requests/RefundRequest.php +++ b/src/Cash/src/Http/Requests/RefundRequest.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Cashbox\Cash\Requests; +namespace Cashbox\Cash\Http\Requests; use Cashbox\Core\Http\Request; @@ -24,17 +24,12 @@ class RefundRequest extends Request public function body(): array { return [ - 'paymentId' => $this->payment->getKey(), + 'external_id' => $this->resource->paymentId(), 'status' => 'REFUNDED', ]; } - public function headers(): array - { - return []; - } - public function uri(): ?string { return null; diff --git a/src/Cash/src/Requests/VerifyRequest.php b/src/Cash/src/Http/Requests/VerifyRequest.php similarity index 80% rename from src/Cash/src/Requests/VerifyRequest.php rename to src/Cash/src/Http/Requests/VerifyRequest.php index 72fdd2d2..86544185 100644 --- a/src/Cash/src/Requests/VerifyRequest.php +++ b/src/Cash/src/Http/Requests/VerifyRequest.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Cashbox\Cash\Requests; +namespace Cashbox\Cash\Http\Requests; use Cashbox\Core\Http\Request; @@ -24,17 +24,12 @@ class VerifyRequest extends Request public function body(): array { return [ - 'paymentId' => $this->payment->getKey(), + 'external_id' => $this->resource->paymentId(), 'status' => 'PAID', ]; } - public function headers(): array - { - return []; - } - public function uri(): ?string { return null; diff --git a/src/Cash/src/Responses/ResponseInfo.php b/src/Cash/src/Http/Responses/Response.php similarity index 66% rename from src/Cash/src/Responses/ResponseInfo.php rename to src/Cash/src/Http/Responses/Response.php index a99c8334..9fd24f87 100644 --- a/src/Cash/src/Responses/ResponseInfo.php +++ b/src/Cash/src/Http/Responses/Response.php @@ -15,28 +15,26 @@ declare(strict_types=1); -namespace Cashbox\Cash\Responses; +namespace Cashbox\Cash\Http\Responses; -use Cashbox\Core\Http\ResponseInfo as BaseData; +use Cashbox\Core\Concerns\Helpers\Identifiers; +use Cashbox\Core\Http\Response as BaseData; -class ResponseInfo extends BaseData +class Response extends BaseData { - public ?int $status = null; + use Identifiers; + + public ?string $status; public int|string $paymentId; public function getExternalId(): ?string { - return null; + return $this->paymentId; } public function getOperationId(): ?string { - return null; - } - - public function getStatus(): ?string - { - return $this->status; + return static::uuid(); } } diff --git a/src/Cash/src/Resources/CashResource.php b/src/Cash/src/Resources/CashResource.php new file mode 100644 index 00000000..d6ba2c97 --- /dev/null +++ b/src/Cash/src/Resources/CashResource.php @@ -0,0 +1,11 @@ + [ AttributeEnum::type() => 'type_id', AttributeEnum::status() => 'status_id', + AttributeEnum::sum() => 'sum', + AttributeEnum::currency() => 'currency', AttributeEnum::createdAt() => 'created_at', ], @@ -357,13 +359,13 @@ // 'driver_name_foo' => [ // 'driver' => \Cashbox\CoreDriver\BankName\PaymentType\Driver::class, // - // 'details' => \App\Payments\BankName::class, + // 'resource' => \App\Payments\BankName::class, // ], // // 'driver_name_bar' => [ // 'driver' => \Cashbox\CoreDriver\BankName\PaymentType\Driver::class, // - // 'details' => \App\Payments\BankName::class, + // 'resource' => \App\Payments\BankName::class, // // 'credentials' => [ // 'client_id' => env('CASHBOX_BANK_CLIENT_ID'), diff --git a/src/Core/src/Casts/InfoCast.php b/src/Core/src/Casts/InfoCast.php deleted file mode 100644 index 0a7f2192..00000000 --- a/src/Core/src/Casts/InfoCast.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Casts; - -use Cashbox\Core\Concerns\Config\Application; -use Cashbox\Core\Http\ResponseInfo; -use Illuminate\Contracts\Database\Eloquent\CastsAttributes; -use Illuminate\Database\Eloquent\Model; - -class InfoCast implements CastsAttributes -{ - use Application; - - public function get(Model $model, string $key, mixed $value, array $attributes): ResponseInfo - { - $instance = $model->parent->cashboxDriver()->info; - - return call_user_func([$instance, 'from'], json_decode($value, true)); - } - - /** - * @param \Spatie\LaravelData\Data $value - */ - public function set(Model $model, string $key, mixed $value, array $attributes): string - { - return $value->toJson($this->flags()); - } - - protected function flags(): int - { - return static::isProduction() - ? JSON_UNESCAPED_SLASHES ^ JSON_UNESCAPED_UNICODE ^ JSON_NUMERIC_CHECK - : JSON_UNESCAPED_SLASHES ^ JSON_UNESCAPED_UNICODE ^ JSON_NUMERIC_CHECK ^ JSON_PRETTY_PRINT; - } -} diff --git a/src/Core/src/Concerns/Enums/From.php b/src/Core/src/Concerns/Enums/From.php index a9362589..40c5b71a 100644 --- a/src/Core/src/Concerns/Enums/From.php +++ b/src/Core/src/Concerns/Enums/From.php @@ -17,6 +17,8 @@ namespace Cashbox\Core\Concerns\Enums; +use BackedEnum; +use Illuminate\Support\Str; use OutOfBoundsException; trait From @@ -30,14 +32,44 @@ public static function from(int|string $value): static throw new OutOfBoundsException($value); } - public static function tryFrom(int|string $value): ?static + public static function tryFrom(int|string|BackedEnum $value): ?static { + if ($value instanceof static) { + return $value; + } + + $name = static::resolveName($value); + $value = static::resolveValue($value); + foreach (static::cases() as $case) { - if ($case->name === $case || $case->value === $case) { + if (static::prepareName($case->name) === static::prepareName($name) || $case->value === $value) { return $case; } } return null; } + + protected static function prepareName(int|string $name): string + { + return Str::lower((string) $name); + } + + protected function resolveName(int|string|BackedEnum $item): string + { + if ($item instanceof BackedEnum) { + return $item->name; + } + + return (string) $item; + } + + protected function resolveValue(int|string|BackedEnum $item): string + { + if ($item instanceof BackedEnum) { + return $item->value; + } + + return (string) $item; + } } diff --git a/src/Core/src/Concerns/Events/Notifiable.php b/src/Core/src/Concerns/Events/Notifiable.php index ae1209f2..e942dba3 100644 --- a/src/Core/src/Concerns/Events/Notifiable.php +++ b/src/Core/src/Concerns/Events/Notifiable.php @@ -21,7 +21,6 @@ use Cashbox\Core\Concerns\Config\Payment\Payments; use Cashbox\Core\Enums\StatusEnum; use Cashbox\Core\Events\CreatedEvent; -use Cashbox\Core\Events\DeletedEvent; use Cashbox\Core\Events\FailedEvent; use Cashbox\Core\Events\RefundedEvent; use Cashbox\Core\Events\SuccessEvent; @@ -41,7 +40,6 @@ protected static function event(Model $payment, StatusEnum $status): void StatusEnum::waitRefund => event(new WaitRefundEvent($payment)), StatusEnum::success => event(new SuccessEvent($payment)), StatusEnum::failed => event(new FailedEvent($payment)), - StatusEnum::deleted => event(new DeletedEvent($payment)), }; } diff --git a/src/Core/src/Concerns/Helpers/Identifiers.php b/src/Core/src/Concerns/Helpers/Identifiers.php new file mode 100644 index 00000000..f0371f57 --- /dev/null +++ b/src/Core/src/Concerns/Helpers/Identifiers.php @@ -0,0 +1,15 @@ +toString(); + } +} diff --git a/src/Core/src/Concerns/Transformers/EnumsTransformer.php b/src/Core/src/Concerns/Transformers/EnumsTransformer.php index 03ac5e8c..a00c5068 100644 --- a/src/Core/src/Concerns/Transformers/EnumsTransformer.php +++ b/src/Core/src/Concerns/Transformers/EnumsTransformer.php @@ -17,12 +17,12 @@ namespace Cashbox\Core\Concerns\Transformers; -use UnitEnum; +use BackedEnum; trait EnumsTransformer { - protected static function transformFromEnum(int|string|UnitEnum $item): int|string + protected static function transformFromEnum(int|string|BackedEnum $item): int|string { - return $item instanceof UnitEnum ? ($item->value ?? $item->name) : $item; + return $item instanceof BackedEnum ? ($item->value ?? $item->name) : $item; } } diff --git a/src/Core/src/Data/Casts/PaymentModelCast.php b/src/Core/src/Data/Casts/Instances/InstanceOfCast.php similarity index 65% rename from src/Core/src/Data/Casts/PaymentModelCast.php rename to src/Core/src/Data/Casts/Instances/InstanceOfCast.php index 8fc8f555..329fea6a 100644 --- a/src/Core/src/Data/Casts/PaymentModelCast.php +++ b/src/Core/src/Data/Casts/Instances/InstanceOfCast.php @@ -15,17 +15,21 @@ declare(strict_types=1); -namespace Cashbox\Core\Data\Casts; +namespace Cashbox\Core\Data\Casts\Instances; use Cashbox\Core\Services\Validator; -use Illuminate\Database\Eloquent\Model; use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Support\DataProperty; -class PaymentModelCast implements Cast +class InstanceOfCast implements Cast { - public function cast(DataProperty $property, mixed $value, array $context): Model|string + public function __construct( + protected readonly string $needle, + protected readonly string $exception + ) {} + + public function cast(DataProperty $property, mixed $value, array $context): string { - return Validator::model($value); + return Validator::validate($value, $this->needle, $this->exception); } } diff --git a/src/Core/src/Data/Config/DriverData.php b/src/Core/src/Data/Config/DriverData.php index 8f0d65ad..69ef367a 100644 --- a/src/Core/src/Data/Config/DriverData.php +++ b/src/Core/src/Data/Config/DriverData.php @@ -17,16 +17,24 @@ namespace Cashbox\Core\Data\Config; +use Cashbox\Core\Data\Casts\Instances\InstanceOfCast; use Cashbox\Core\Data\Config\Drivers\CredentialsData; use Cashbox\Core\Data\Config\Queue\QueueNameData; +use Cashbox\Core\Exceptions\Internal\IncorrectDriverException; +use Cashbox\Core\Exceptions\Internal\IncorrectResourceException; use Cashbox\Core\Facades\Config; +use Cashbox\Core\Resources\Resource; +use Cashbox\Core\Services\Driver; +use Spatie\LaravelData\Attributes\WithCast; use Spatie\LaravelData\Data; class DriverData extends Data { + #[WithCast(InstanceOfCast::class, needle: Driver::class, exception: IncorrectDriverException::class)] public string $driver; - public string $details; + #[WithCast(InstanceOfCast::class, needle: Resource::class, exception: IncorrectResourceException::class)] + public string $resource; public ?CredentialsData $credentials; diff --git a/src/Core/src/Data/Config/Payment/AttributeData.php b/src/Core/src/Data/Config/Payment/AttributeData.php index e67e53b2..82b7abf8 100644 --- a/src/Core/src/Data/Config/Payment/AttributeData.php +++ b/src/Core/src/Data/Config/Payment/AttributeData.php @@ -28,6 +28,10 @@ class AttributeData extends Data public string $status; + public string $sum; + + public string $currency; + #[MapInputName('created_at')] public string $createdAt; } diff --git a/src/Core/src/Data/Config/Payment/PaymentData.php b/src/Core/src/Data/Config/Payment/PaymentData.php index ebc8a1dc..29732e6e 100644 --- a/src/Core/src/Data/Config/Payment/PaymentData.php +++ b/src/Core/src/Data/Config/Payment/PaymentData.php @@ -17,14 +17,16 @@ namespace Cashbox\Core\Data\Config\Payment; -use Cashbox\Core\Data\Casts\PaymentModelCast; +use Cashbox\Core\Billable; +use Cashbox\Core\Data\Casts\Instances\InstanceOfCast; +use Cashbox\Core\Exceptions\Internal\IncorrectModelException; use Illuminate\Database\Eloquent\Model; use Spatie\LaravelData\Attributes\WithCast; use Spatie\LaravelData\Data; class PaymentData extends Data { - #[WithCast(PaymentModelCast::class)] + #[WithCast(InstanceOfCast::class, needle: Billable::class, exception: IncorrectModelException::class)] public Model|string $model; public AttributeData $attribute; diff --git a/src/Core/src/Data/Config/Payment/StatusData.php b/src/Core/src/Data/Config/Payment/StatusData.php index 133dba76..c3fa16fb 100644 --- a/src/Core/src/Data/Config/Payment/StatusData.php +++ b/src/Core/src/Data/Config/Payment/StatusData.php @@ -17,26 +17,26 @@ namespace Cashbox\Core\Data\Config\Payment; +use BackedEnum; use Cashbox\Core\Enums\StatusEnum; use Spatie\LaravelData\Attributes\MapName; use Spatie\LaravelData\Data; use Spatie\LaravelData\Mappers\SnakeCaseMapper; -use UnitEnum; #[MapName(SnakeCaseMapper::class)] class StatusData extends Data { - public int|string|UnitEnum $new; + public int|string|BackedEnum $new; - public int|string|UnitEnum $success; + public int|string|BackedEnum $success; - public int|string|UnitEnum $refund; + public int|string|BackedEnum $refund; - public int|string|UnitEnum $waitRefund; + public int|string|BackedEnum $waitRefund; - public int|string|UnitEnum $failed; + public int|string|BackedEnum $failed; - public function fromEnum(StatusEnum $status): int|string|UnitEnum + public function fromEnum(StatusEnum $status): int|string|BackedEnum { return match ($status) { StatusEnum::new => $this->new, @@ -47,7 +47,7 @@ public function fromEnum(StatusEnum $status): int|string|UnitEnum }; } - public function toEnum(int|string|UnitEnum $status): StatusEnum + public function toEnum(int|string|BackedEnum $status): StatusEnum { return match ($status) { $this->new => StatusEnum::new, diff --git a/src/Core/src/Data/Models/InfoData.php b/src/Core/src/Data/Models/InfoData.php index ba4fb2a3..d3134bff 100644 --- a/src/Core/src/Data/Models/InfoData.php +++ b/src/Core/src/Data/Models/InfoData.php @@ -1,35 +1,34 @@ - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ +declare(strict_types=1); namespace Cashbox\Core\Data\Models; -use Cashbox\Core\Concerns\Config\Payment\Payments; -use Cashbox\Core\Enums\StatusEnum; +use Cashbox\Core\Concerns\Config\Application; +use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Data; -/** - * @deprecated - */ -abstract class InfoData extends Data +class InfoData extends Data { - use Payments; + use Application; - public int|string|null $status; + #[MapInputName('external_id')] + public ?string $externalId; - public function statusToEnum(): StatusEnum + #[MapInputName('operation_id')] + public ?string $operationId; + + public ?string $status; + + public function toJson($options = 0): string + { + return parent::toJson($this->flags()); + } + + protected function flags(): int { - return static::payment()->status->toEnum($this->status); + return static::isProduction() + ? JSON_UNESCAPED_SLASHES ^ JSON_UNESCAPED_UNICODE ^ JSON_NUMERIC_CHECK + : JSON_UNESCAPED_SLASHES ^ JSON_UNESCAPED_UNICODE ^ JSON_NUMERIC_CHECK ^ JSON_PRETTY_PRINT; } } diff --git a/src/Core/src/Enums/AttributeEnum.php b/src/Core/src/Enums/AttributeEnum.php index c61feae0..19c67f93 100644 --- a/src/Core/src/Enums/AttributeEnum.php +++ b/src/Core/src/Enums/AttributeEnum.php @@ -21,7 +21,9 @@ /** * @method static string createdAt() + * @method static string currency() * @method static string status() + * @method static string sum() * @method static string type() */ enum AttributeEnum: string @@ -29,6 +31,8 @@ enum AttributeEnum: string use InvokableCases; case createdAt = 'created_at'; + case currency = 'currency'; case status = 'status'; + case sum = 'sum'; case type = 'type'; } diff --git a/src/Core/src/Enums/StatusEnum.php b/src/Core/src/Enums/StatusEnum.php index 2bf71529..2105f1d7 100644 --- a/src/Core/src/Enums/StatusEnum.php +++ b/src/Core/src/Enums/StatusEnum.php @@ -22,7 +22,6 @@ use Cashbox\Core\Concerns\Enums\From; /** - * @method string deleted() * @method string failed() * @method string new() * @method string refund() @@ -35,10 +34,9 @@ enum StatusEnum: string use InvokableCases; use Values; + case failed = 'failed'; case new = 'new'; + case refund = 'refund'; case success = 'success'; case waitRefund = 'wait_refund'; - case refund = 'refund'; - case failed = 'failed'; - case deleted = 'deleted'; } diff --git a/src/Core/src/Events/DeletedEvent.php b/src/Core/src/Events/DeletedEvent.php deleted file mode 100644 index fc6b0c04..00000000 --- a/src/Core/src/Events/DeletedEvent.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Events; - -class DeletedEvent extends BaseEvent {} diff --git a/src/Core/src/Exceptions/Internal/IncorrectDriverException.php b/src/Core/src/Exceptions/Internal/IncorrectDriverException.php new file mode 100644 index 00000000..e9b676aa --- /dev/null +++ b/src/Core/src/Exceptions/Internal/IncorrectDriverException.php @@ -0,0 +1,12 @@ +toArray()) diff --git a/src/Core/src/Jobs/BaseJob.php b/src/Core/src/Jobs/BaseJob.php index 9ebb285e..1e576cfe 100644 --- a/src/Core/src/Jobs/BaseJob.php +++ b/src/Core/src/Jobs/BaseJob.php @@ -21,7 +21,7 @@ use Cashbox\Core\Concerns\Config\Queue; use Cashbox\Core\Enums\RateLimiterEnum; use Cashbox\Core\Exceptions\External\EmptyResponseException; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; use Cashbox\Core\Services\Driver; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldBeUnique; @@ -46,7 +46,7 @@ abstract class BaseJob implements ShouldBeUnique, ShouldQueue public int $maxExceptions = 3; - abstract protected function request(): ResponseInfo; + abstract protected function request(): Response; public function __construct( public Model $payment, diff --git a/src/Core/src/Jobs/RefundJob.php b/src/Core/src/Jobs/RefundJob.php index d80294ca..fc334d78 100644 --- a/src/Core/src/Jobs/RefundJob.php +++ b/src/Core/src/Jobs/RefundJob.php @@ -17,11 +17,11 @@ namespace Cashbox\Core\Jobs; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; class RefundJob extends BaseJob { - protected function request(): ResponseInfo + protected function request(): Response { $this->verify(); @@ -33,7 +33,7 @@ protected function verify(): void dispatch_sync(new VerifyJob($this->payment, true)); } - protected function refund(): ResponseInfo + protected function refund(): Response { return $this->driver()->refund(); } diff --git a/src/Core/src/Jobs/StartJob.php b/src/Core/src/Jobs/StartJob.php index 176a1e1d..b2be1a55 100644 --- a/src/Core/src/Jobs/StartJob.php +++ b/src/Core/src/Jobs/StartJob.php @@ -17,11 +17,11 @@ namespace Cashbox\Core\Jobs; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; class StartJob extends BaseJob { - protected function request(): ResponseInfo + protected function request(): Response { return $this->driver()->start(); } diff --git a/src/Core/src/Jobs/VerifyJob.php b/src/Core/src/Jobs/VerifyJob.php index b3b62298..3d02086b 100644 --- a/src/Core/src/Jobs/VerifyJob.php +++ b/src/Core/src/Jobs/VerifyJob.php @@ -18,13 +18,13 @@ namespace Cashbox\Core\Jobs; use Cashbox\Core\Concerns\Permissions\Allowable; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; class VerifyJob extends BaseJob { use Allowable; - protected function request(): ResponseInfo + protected function request(): Response { $this->start(); diff --git a/src/Core/src/Models/Details.php b/src/Core/src/Models/Details.php index d6b47eae..95730047 100644 --- a/src/Core/src/Models/Details.php +++ b/src/Core/src/Models/Details.php @@ -18,7 +18,6 @@ namespace Cashbox\Core\Models; use Cashbox\Core\Billable; -use Cashbox\Core\Casts\InfoCast; use Cashbox\Core\Concerns\Config\Details as DetailsConcern; use Cashbox\Core\Data\Models\InfoData; use Cashbox\Core\Enums\StatusEnum; @@ -44,7 +43,7 @@ class Details extends Model ]; protected $casts = [ - 'info' => InfoCast::class, + 'info' => InfoData::class, 'status' => StatusEnum::class, ]; diff --git a/src/Core/src/Observers/PaymentDetailsObserver.php b/src/Core/src/Observers/PaymentDetailsObserver.php index 4ed62024..5d22d08c 100644 --- a/src/Core/src/Observers/PaymentDetailsObserver.php +++ b/src/Core/src/Observers/PaymentDetailsObserver.php @@ -31,7 +31,7 @@ class PaymentDetailsObserver public function saving(Details $model): void { if ($model->isDirty('info') && $model->status !== null) { - $model->status = $model->info->statusToEnum(); + $model->status = $this->statusToEnum($model->info->status); } } @@ -53,4 +53,9 @@ protected function updateStatus(Model $payment, StatusEnum $status): void $payment->update([$field => $value]); } + + protected function statusToEnum(mixed $status): StatusEnum + { + return static::payment()->status->toEnum($status); + } } diff --git a/src/Core/src/Observers/PaymentObserver.php b/src/Core/src/Observers/PaymentObserver.php index a0cfea23..b0034951 100644 --- a/src/Core/src/Observers/PaymentObserver.php +++ b/src/Core/src/Observers/PaymentObserver.php @@ -21,7 +21,6 @@ use Cashbox\Core\Concerns\Events\Notifiable; use Cashbox\Core\Concerns\Helpers\Jobs; use Cashbox\Core\Concerns\Permissions\Allowable; -use Cashbox\Core\Enums\StatusEnum; use DragonCode\Support\Facades\Helpers\Arr; use Illuminate\Database\Eloquent\Model; @@ -54,13 +53,6 @@ public function updated(Model $payment): void } } - public function deleted(Model $payment): void - { - if ($this->authorizeType()) { - static::event($payment, StatusEnum::deleted); - } - } - public function restored(Model $payment): void { if ($this->authorizeType()) { diff --git a/src/Core/src/Resources/Resource.php b/src/Core/src/Resources/Resource.php new file mode 100644 index 00000000..43f8158c --- /dev/null +++ b/src/Core/src/Resources/Resource.php @@ -0,0 +1,48 @@ +payment->getKey(); + } + + public function status(): mixed + { + return $this->payment->getAttribute( + static::attribute()->status + ); + } + + public function sum(): int + { + return $this->payment->getAttribute( + static::attribute()->sum + ); + } + + public function currency(): CurrencyEnum + { + $value = $this->payment->getAttribute( + static::attribute()->currency + ); + + return CurrencyEnum::tryFrom($value) ?? $this->currency; + } +} diff --git a/src/Core/src/Services/Driver.php b/src/Core/src/Services/Driver.php index 1f45345c..c2b34a11 100644 --- a/src/Core/src/Services/Driver.php +++ b/src/Core/src/Services/Driver.php @@ -18,7 +18,8 @@ namespace Cashbox\Core\Services; use Cashbox\Core\Data\Config\DriverData; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; +use Cashbox\Core\Resources\Resource; use Illuminate\Database\Eloquent\Model; abstract class Driver @@ -27,13 +28,13 @@ abstract class Driver protected string $exception; - protected string $info; + protected string $response; - abstract public function refund(): ResponseInfo; + abstract public function refund(): Response; - abstract public function start(): ResponseInfo; + abstract public function start(): Response; - abstract public function verify(): ResponseInfo; + abstract public function verify(): Response; public function __construct( protected Model $payment, @@ -46,13 +47,20 @@ public function statuses(): Statuses return resolve($this->statuses, [$this->payment]); } - protected function request(string $request): ResponseInfo + protected function request(string $request): Response { - $client = $this->resolve($request, 'make', $this->payment); + $data = $this->resolve($request, 'make', $this->resource()); - $content = $this->http->send($client, $this->resolveException()); + $content = $this->http->send($data, $this->resolveException()); - return $this->resolve($this->info, 'from', $content); + return $this->resolve($this->response, 'from', $content); + } + + protected function resource(): Resource + { + $resource = $this->data->resource; + + return new $resource($this->payment); } protected function resolveException(): Exception diff --git a/src/Core/src/Services/Http.php b/src/Core/src/Services/Http.php index b0c58dbe..bda62731 100644 --- a/src/Core/src/Services/Http.php +++ b/src/Core/src/Services/Http.php @@ -32,6 +32,10 @@ class Http public function send(Request $request, Exception $exception): array { + if ($request->uri() === null) { + return $request->body(); + } + $response = $this->request( $request->uri(), $request->headers(), diff --git a/src/Core/src/Services/Validator.php b/src/Core/src/Services/Validator.php index cffce47e..e9508e11 100644 --- a/src/Core/src/Services/Validator.php +++ b/src/Core/src/Services/Validator.php @@ -18,7 +18,7 @@ namespace Cashbox\Core\Services; use Cashbox\Core\Billable; -use Cashbox\Core\Exceptions\Internal\IncorrectPaymentModelException; +use Cashbox\Core\Exceptions\Internal\IncorrectModelException; use DragonCode\Support\Facades\Instances\Instance; use Illuminate\Database\Eloquent\Model; @@ -26,10 +26,10 @@ class Validator { public static function model(Model|string $payment): Model|string { - return static::validate($payment, Billable::class, IncorrectPaymentModelException::class); + return static::validate($payment, Billable::class, IncorrectModelException::class); } - protected static function validate(mixed $haystack, string $needle, string $exception): mixed + public static function validate(mixed $haystack, string $needle, string $exception): mixed { if (! Instance::of($haystack, $needle)) { throw new $exception($haystack, $needle); diff --git a/src/SberOnline/src/Responses/Created.php b/src/SberOnline/src/Responses/Created.php index 9880fe0b..872a1a83 100644 --- a/src/SberOnline/src/Responses/Created.php +++ b/src/SberOnline/src/Responses/Created.php @@ -17,9 +17,9 @@ namespace Cashbox\BankName\Technology\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class Created extends ResponseInfo +class Created extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'PaymentId', diff --git a/src/SberOnline/src/Responses/Refund.php b/src/SberOnline/src/Responses/Refund.php index e6fff41b..395450d4 100644 --- a/src/SberOnline/src/Responses/Refund.php +++ b/src/SberOnline/src/Responses/Refund.php @@ -17,9 +17,9 @@ namespace Cashbox\BankName\Technology\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class Refund extends ResponseInfo +class Refund extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'PaymentId', diff --git a/src/SberOnline/src/Responses/State.php b/src/SberOnline/src/Responses/State.php index 21004531..32fda6b3 100644 --- a/src/SberOnline/src/Responses/State.php +++ b/src/SberOnline/src/Responses/State.php @@ -17,9 +17,9 @@ namespace Cashbox\BankName\Technology\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class State extends ResponseInfo +class State extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'PaymentId', diff --git a/src/SberQrCode/src/Responses/Cancel.php b/src/SberQrCode/src/Responses/Cancel.php index fad063a1..4de3a9e7 100644 --- a/src/SberQrCode/src/Responses/Cancel.php +++ b/src/SberQrCode/src/Responses/Cancel.php @@ -17,9 +17,9 @@ namespace Cashbox\Sber\QrCode\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class Cancel extends ResponseInfo +class Cancel extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'status.order_id', diff --git a/src/SberQrCode/src/Responses/QrCode.php b/src/SberQrCode/src/Responses/QrCode.php index 5e8dc796..83ed5159 100644 --- a/src/SberQrCode/src/Responses/QrCode.php +++ b/src/SberQrCode/src/Responses/QrCode.php @@ -17,9 +17,9 @@ namespace Cashbox\Sber\QrCode\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class QrCode extends ResponseInfo +class QrCode extends Response { public const KEY_URL = 'url'; diff --git a/src/SberQrCode/src/Responses/Status.php b/src/SberQrCode/src/Responses/Status.php index f9e53ab7..a2c505dd 100644 --- a/src/SberQrCode/src/Responses/Status.php +++ b/src/SberQrCode/src/Responses/Status.php @@ -17,9 +17,9 @@ namespace Cashbox\Sber\QrCode\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class Status extends ResponseInfo +class Status extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'status.order_id', diff --git a/src/TemplateDriver/src/Responses/Created.php b/src/TemplateDriver/src/Responses/Created.php index 9880fe0b..872a1a83 100644 --- a/src/TemplateDriver/src/Responses/Created.php +++ b/src/TemplateDriver/src/Responses/Created.php @@ -17,9 +17,9 @@ namespace Cashbox\BankName\Technology\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class Created extends ResponseInfo +class Created extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'PaymentId', diff --git a/src/TemplateDriver/src/Responses/Refund.php b/src/TemplateDriver/src/Responses/Refund.php index e6fff41b..395450d4 100644 --- a/src/TemplateDriver/src/Responses/Refund.php +++ b/src/TemplateDriver/src/Responses/Refund.php @@ -17,9 +17,9 @@ namespace Cashbox\BankName\Technology\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class Refund extends ResponseInfo +class Refund extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'PaymentId', diff --git a/src/TemplateDriver/src/Responses/State.php b/src/TemplateDriver/src/Responses/State.php index 21004531..32fda6b3 100644 --- a/src/TemplateDriver/src/Responses/State.php +++ b/src/TemplateDriver/src/Responses/State.php @@ -17,9 +17,9 @@ namespace Cashbox\BankName\Technology\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class State extends ResponseInfo +class State extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'PaymentId', diff --git a/src/TinkoffCredit/src/Responses/Created.php b/src/TinkoffCredit/src/Responses/Created.php index ec7813fc..cbf676e8 100644 --- a/src/TinkoffCredit/src/Responses/Created.php +++ b/src/TinkoffCredit/src/Responses/Created.php @@ -17,9 +17,9 @@ namespace Cashbox\Tinkoff\Credit\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class Created extends ResponseInfo +class Created extends Response { public const KEY_URL = 'url'; diff --git a/src/TinkoffCredit/src/Responses/Refund.php b/src/TinkoffCredit/src/Responses/Refund.php index 0d3a3c10..a3e36bf8 100644 --- a/src/TinkoffCredit/src/Responses/Refund.php +++ b/src/TinkoffCredit/src/Responses/Refund.php @@ -17,9 +17,9 @@ namespace Cashbox\Tinkoff\Credit\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class Refund extends ResponseInfo +class Refund extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'id', diff --git a/src/TinkoffCredit/src/Responses/State.php b/src/TinkoffCredit/src/Responses/State.php index dee9a1d6..190740cf 100644 --- a/src/TinkoffCredit/src/Responses/State.php +++ b/src/TinkoffCredit/src/Responses/State.php @@ -17,9 +17,9 @@ namespace Cashbox\Tinkoff\Credit\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class State extends ResponseInfo +class State extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'id', diff --git a/src/TinkoffOnline/src/Responses/Init.php b/src/TinkoffOnline/src/Responses/Init.php index 84440b5f..81ef483f 100644 --- a/src/TinkoffOnline/src/Responses/Init.php +++ b/src/TinkoffOnline/src/Responses/Init.php @@ -17,9 +17,9 @@ namespace Cashbox\Tinkoff\Online\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class Init extends ResponseInfo +class Init extends Response { public const KEY_URL = 'url'; diff --git a/src/TinkoffOnline/src/Responses/Refund.php b/src/TinkoffOnline/src/Responses/Refund.php index 73c7b77b..a6729a92 100644 --- a/src/TinkoffOnline/src/Responses/Refund.php +++ b/src/TinkoffOnline/src/Responses/Refund.php @@ -17,9 +17,9 @@ namespace Cashbox\Tinkoff\Online\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class Refund extends ResponseInfo +class Refund extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'PaymentId', diff --git a/src/TinkoffOnline/src/Responses/State.php b/src/TinkoffOnline/src/Responses/State.php index da1741f3..64c42af5 100644 --- a/src/TinkoffOnline/src/Responses/State.php +++ b/src/TinkoffOnline/src/Responses/State.php @@ -17,9 +17,9 @@ namespace Cashbox\Tinkoff\Online\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class State extends ResponseInfo +class State extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'PaymentId', diff --git a/src/TinkoffQrCode/src/Responses/Init.php b/src/TinkoffQrCode/src/Responses/Init.php index cfef8552..a0ebdf91 100644 --- a/src/TinkoffQrCode/src/Responses/Init.php +++ b/src/TinkoffQrCode/src/Responses/Init.php @@ -17,9 +17,9 @@ namespace Cashbox\Tinkoff\QrCode\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class Init extends ResponseInfo +class Init extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'PaymentId', diff --git a/src/TinkoffQrCode/src/Responses/QrCode.php b/src/TinkoffQrCode/src/Responses/QrCode.php index 7dab18e2..eebdacc5 100644 --- a/src/TinkoffQrCode/src/Responses/QrCode.php +++ b/src/TinkoffQrCode/src/Responses/QrCode.php @@ -17,9 +17,9 @@ namespace Cashbox\Tinkoff\QrCode\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class QrCode extends ResponseInfo +class QrCode extends Response { public const KEY_URL = 'url'; diff --git a/src/TinkoffQrCode/src/Responses/Refund.php b/src/TinkoffQrCode/src/Responses/Refund.php index 6b071dfd..830fe46e 100644 --- a/src/TinkoffQrCode/src/Responses/Refund.php +++ b/src/TinkoffQrCode/src/Responses/Refund.php @@ -17,9 +17,9 @@ namespace Cashbox\Tinkoff\QrCode\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class Refund extends ResponseInfo +class Refund extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'PaymentId', diff --git a/src/TinkoffQrCode/src/Responses/State.php b/src/TinkoffQrCode/src/Responses/State.php index ec9a6a74..2852b6a2 100644 --- a/src/TinkoffQrCode/src/Responses/State.php +++ b/src/TinkoffQrCode/src/Responses/State.php @@ -17,9 +17,9 @@ namespace Cashbox\Tinkoff\QrCode\Responses; -use Cashbox\Core\Http\ResponseInfo; +use Cashbox\Core\Http\Response; -class State extends ResponseInfo +class State extends Response { protected $map = [ self::KEY_EXTERNAL_ID => 'PaymentId', diff --git a/tests/Fixtures/Details/CashPaymentDetails.php b/tests/Fixtures/Details/CashPaymentDetails.php deleted file mode 100644 index 2b8d3f2e..00000000 --- a/tests/Fixtures/Details/CashPaymentDetails.php +++ /dev/null @@ -1,9 +0,0 @@ -cast($property, $value, $context); + $cast = is_string($cast) ? new $cast() : $cast; + + return $cast->cast($property, $value, $context); } diff --git a/tests/TestCase.php b/tests/TestCase.php index 25eb909e..02d34e6f 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -12,10 +12,10 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Orchestra\Testbench\TestCase as BaseTestCase; use Spatie\LaravelData\LaravelDataServiceProvider; -use Tests\Fixtures\Details\CashPaymentDetails; use Tests\Fixtures\Enums\StatusEnum as TestStatusEnum; use Tests\Fixtures\Enums\TypeEnum; use Tests\Fixtures\Models\PaymentModel; +use Tests\Fixtures\Payments\Cash; use Tests\Fixtures\Providers\TestServiceProvider; abstract class TestCase extends BaseTestCase @@ -50,8 +50,8 @@ protected function getEnvironmentSetUp($app): void $app['config']->set('cashbox.payment.drivers.' . TypeEnum::cash(), TypeEnum::cash()); $app['config']->set('cashbox.drivers.' . TypeEnum::cash(), [ - 'driver' => Driver::class, - 'details' => CashPaymentDetails::class, + 'driver' => Driver::class, + 'resource' => Cash::class, ]); } } diff --git a/tests/Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php b/tests/Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php new file mode 100644 index 00000000..01cbe99c --- /dev/null +++ b/tests/Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php @@ -0,0 +1,22 @@ +toBe(PaymentModel::class); +}); + +it('must be incorrect', function () { + dataCast(new InstanceOfCast(Driver::class, IncorrectModelException::class), FakeData::class); +}) + ->throws(IncorrectModelException::class) + ->expectExceptionMessage(sprintf('The "%s" class must implement "%s".', FakeData::class, Driver::class)); diff --git a/tests/Unit/Core/Data/Casts/PaymentModelCastTest.php b/tests/Unit/Core/Data/Casts/PaymentModelCastTest.php deleted file mode 100644 index bbd7b1e5..00000000 --- a/tests/Unit/Core/Data/Casts/PaymentModelCastTest.php +++ /dev/null @@ -1,25 +0,0 @@ -model - )->toBe(PaymentModel::class); -}); - -it('should check the incorrect payment model', function () { - forgetConfig(); - - config(['cashbox.payment.model' => FakeData::class]); - - Config::payment()->model; -}) - ->throws(IncorrectPaymentModelException::class) - ->expectExceptionMessage(sprintf('The "%s" class must implement "%s".', FakeData::class, Billable::class)); diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index b2aa5e77..bd12251a 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -2,13 +2,18 @@ declare(strict_types=1); -use Cashbox\Cash\Driver; +use Cashbox\Cash\Driver as CashDriver; use Cashbox\Core\Exceptions\Internal\ConfigCannotBeEmptyException; +use Cashbox\Core\Exceptions\Internal\IncorrectDriverException; +use Cashbox\Core\Exceptions\Internal\IncorrectResourceException; use Cashbox\Core\Facades\Config; -use Tests\Fixtures\Details\CashPaymentDetails; +use Cashbox\Core\Resources\Resource; +use Cashbox\Core\Services\Driver; +use Tests\Fixtures\Data\FakeData; use Tests\Fixtures\Enums\StatusEnum; use Tests\Fixtures\Enums\TypeEnum; use Tests\Fixtures\Models\PaymentModel; +use Tests\Fixtures\Payments\Cash; it('should return an error when running an empty config file', function () { forgetConfig(); @@ -33,6 +38,8 @@ expect($data->attribute->type)->toBe('type'); expect($data->attribute->status)->toBe('status'); + expect($data->attribute->sum)->toBe('sum'); + expect($data->attribute->currency)->toBe('currency'); expect($data->attribute->createdAt)->toBe('created_at'); expect($data->status->new)->toBe(StatusEnum::new); @@ -97,8 +104,8 @@ // cash $cash = Config::driver(TypeEnum::cash()); - expect($cash->driver)->toBe(Driver::class); - expect($cash->details)->toBe(CashPaymentDetails::class); + expect($cash->driver)->toBe(CashDriver::class); + expect($cash->resource)->toBe(Cash::class); expect($cash->credentials)->toBeNull(); expect($cash->queue)->toBeNull(); @@ -107,6 +114,34 @@ expect($cash->getQueue()->refund)->toBeNull(); }); +it('should check the driver instance', function () { + forgetConfig(); + + $name = TypeEnum::cash(); + + config(["cashbox.drivers.$name.driver" => FakeData::class]); + + Config::driver($name)->driver; +}) + ->throws(IncorrectDriverException::class) + ->expectExceptionMessage( + sprintf('The "%s" class must implement "%s".', FakeData::class, Driver::class) + ); + +it('should check the resource instance', function () { + forgetConfig(); + + $name = TypeEnum::cash(); + + config(["cashbox.drivers.$name.resource" => FakeData::class]); + + Config::driver($name)->resource; +}) + ->throws(IncorrectResourceException::class) + ->expectExceptionMessage( + sprintf('The "%s" class must implement "%s".', FakeData::class, Resource::class) + ); + it( 'should check the correctness of getting the name of the queue for the job', function (array $main, array $driver, array $expected) { From 6f01d30f074b7887d37339f9d033bd4f83f9638e Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 15 Jul 2023 22:32:45 +0300 Subject: [PATCH 053/164] Removed unnecessary --- src/Cash/src/Resources/CashResource.php | 2 +- src/Core/config/cashbox.php | 2 -- .../src/Data/Config/Payment/AttributeData.php | 4 ---- src/Core/src/Enums/AttributeEnum.php | 4 ---- src/Core/src/Resources/Resource.php | 20 ++++--------------- tests/Fixtures/Models/PaymentModel.php | 2 +- tests/Fixtures/Payments/Cash.php | 10 ++++++++++ ...023_07_14_022222_create_payments_model.php | 2 +- tests/Unit/Core/Facades/ConfigTest.php | 2 -- 9 files changed, 17 insertions(+), 31 deletions(-) diff --git a/src/Cash/src/Resources/CashResource.php b/src/Cash/src/Resources/CashResource.php index d6ba2c97..00a1521d 100644 --- a/src/Cash/src/Resources/CashResource.php +++ b/src/Cash/src/Resources/CashResource.php @@ -6,6 +6,6 @@ use Cashbox\Core\Resources\Resource; -class CashResource extends Resource +abstract class CashResource extends Resource { } diff --git a/src/Core/config/cashbox.php b/src/Core/config/cashbox.php index 04d8d34b..630b1ffd 100644 --- a/src/Core/config/cashbox.php +++ b/src/Core/config/cashbox.php @@ -68,8 +68,6 @@ 'attribute' => [ AttributeEnum::type() => 'type_id', AttributeEnum::status() => 'status_id', - AttributeEnum::sum() => 'sum', - AttributeEnum::currency() => 'currency', AttributeEnum::createdAt() => 'created_at', ], diff --git a/src/Core/src/Data/Config/Payment/AttributeData.php b/src/Core/src/Data/Config/Payment/AttributeData.php index 82b7abf8..e67e53b2 100644 --- a/src/Core/src/Data/Config/Payment/AttributeData.php +++ b/src/Core/src/Data/Config/Payment/AttributeData.php @@ -28,10 +28,6 @@ class AttributeData extends Data public string $status; - public string $sum; - - public string $currency; - #[MapInputName('created_at')] public string $createdAt; } diff --git a/src/Core/src/Enums/AttributeEnum.php b/src/Core/src/Enums/AttributeEnum.php index 19c67f93..c61feae0 100644 --- a/src/Core/src/Enums/AttributeEnum.php +++ b/src/Core/src/Enums/AttributeEnum.php @@ -21,9 +21,7 @@ /** * @method static string createdAt() - * @method static string currency() * @method static string status() - * @method static string sum() * @method static string type() */ enum AttributeEnum: string @@ -31,8 +29,6 @@ enum AttributeEnum: string use InvokableCases; case createdAt = 'created_at'; - case currency = 'currency'; case status = 'status'; - case sum = 'sum'; case type = 'type'; } diff --git a/src/Core/src/Resources/Resource.php b/src/Core/src/Resources/Resource.php index 43f8158c..68da2d46 100644 --- a/src/Core/src/Resources/Resource.php +++ b/src/Core/src/Resources/Resource.php @@ -14,6 +14,10 @@ abstract class Resource protected CurrencyEnum $currency = CurrencyEnum::USD; + abstract public function currency(): CurrencyEnum; + + abstract public function sum(): int; + public function __construct( protected Model $payment ) {} @@ -29,20 +33,4 @@ public function status(): mixed static::attribute()->status ); } - - public function sum(): int - { - return $this->payment->getAttribute( - static::attribute()->sum - ); - } - - public function currency(): CurrencyEnum - { - $value = $this->payment->getAttribute( - static::attribute()->currency - ); - - return CurrencyEnum::tryFrom($value) ?? $this->currency; - } } diff --git a/tests/Fixtures/Models/PaymentModel.php b/tests/Fixtures/Models/PaymentModel.php index 58e62dca..f0be50b4 100644 --- a/tests/Fixtures/Models/PaymentModel.php +++ b/tests/Fixtures/Models/PaymentModel.php @@ -25,6 +25,6 @@ class PaymentModel extends Model 'type' => TypeEnum::class, 'status' => StatusEnum::class, - 'price' => 'float', + 'price' => 'int', ]; } diff --git a/tests/Fixtures/Payments/Cash.php b/tests/Fixtures/Payments/Cash.php index 86441932..30a97115 100644 --- a/tests/Fixtures/Payments/Cash.php +++ b/tests/Fixtures/Payments/Cash.php @@ -5,7 +5,17 @@ namespace Tests\Fixtures\Payments; use Cashbox\Cash\Resources\CashResource; +use Cashbox\Core\Enums\CurrencyEnum; class Cash extends CashResource { + public function currency(): CurrencyEnum + { + return CurrencyEnum::USD; + } + + public function sum(): int + { + return $this->payment->price; + } } diff --git a/tests/Fixtures/database/migrations/2023_07_14_022222_create_payments_model.php b/tests/Fixtures/database/migrations/2023_07_14_022222_create_payments_model.php index 1c60b2ca..27810e78 100644 --- a/tests/Fixtures/database/migrations/2023_07_14_022222_create_payments_model.php +++ b/tests/Fixtures/database/migrations/2023_07_14_022222_create_payments_model.php @@ -13,7 +13,7 @@ public function up(): void Schema::create('payments', function (Blueprint $table) { $table->id(); - $table->double('price', 10, 2); + $table->integer('price'); $table->string('type'); $table->smallInteger('status')->default(StatusEnum::new->value); diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index bd12251a..8d70fecf 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -38,8 +38,6 @@ expect($data->attribute->type)->toBe('type'); expect($data->attribute->status)->toBe('status'); - expect($data->attribute->sum)->toBe('sum'); - expect($data->attribute->currency)->toBe('currency'); expect($data->attribute->createdAt)->toBe('created_at'); expect($data->status->new)->toBe(StatusEnum::new); From 938fe631555f7b36d6818e7a9bbf09920e5b443c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 15 Jul 2023 22:54:45 +0300 Subject: [PATCH 054/164] Minor fixes --- .../src/Concerns/Permissions/Allowable.php | 25 +++++++---- src/Core/src/Observers/PaymentObserver.php | 6 +-- src/Core/src/Services/Authorize.php | 4 +- tests/Pest.php | 15 +++++-- tests/Unit/Drivers/Outside/CreatedTest.php | 41 +++++++++++++++++++ tests/Unit/Drivers/Outside/FailedTest.php | 36 ++++++++++++++++ tests/Unit/Drivers/Outside/RefundTest.php | 7 ++++ tests/Unit/Drivers/Outside/VerifyTest.php | 7 ++++ 8 files changed, 125 insertions(+), 16 deletions(-) create mode 100644 tests/Unit/Drivers/Outside/CreatedTest.php create mode 100644 tests/Unit/Drivers/Outside/FailedTest.php create mode 100644 tests/Unit/Drivers/Outside/RefundTest.php create mode 100644 tests/Unit/Drivers/Outside/VerifyTest.php diff --git a/src/Core/src/Concerns/Permissions/Allowable.php b/src/Core/src/Concerns/Permissions/Allowable.php index 9cefb4a5..4e70cb9e 100644 --- a/src/Core/src/Concerns/Permissions/Allowable.php +++ b/src/Core/src/Concerns/Permissions/Allowable.php @@ -18,26 +18,35 @@ namespace Cashbox\Core\Concerns\Permissions; use Cashbox\Core\Services\Authorize; +use Illuminate\Database\Eloquent\Model; trait Allowable { - protected function authorizeType(): bool + protected function authorizeType(?Model $payment = null): bool { - return Authorize::type($this->payment); + return Authorize::type( + $payment ?? $this->payment + ); } - protected function authorizeToStart(): bool + protected function authorizeToStart(?Model $payment = null): bool { - return Authorize::toStart($this->payment); + return Authorize::toStart( + $payment ?? $this->payment + ); } - protected function authorizeToVerify(): bool + protected function authorizeToVerify(?Model $payment = null): bool { - return Authorize::toVerify($this->payment); + return Authorize::toVerify( + $payment ?? $this->payment + ); } - protected function authorizeToRefund(): bool + protected function authorizeToRefund(?Model $payment = null): bool { - return Authorize::toRefund($this->payment); + return Authorize::toRefund( + $payment ?? $this->payment + ); } } diff --git a/src/Core/src/Observers/PaymentObserver.php b/src/Core/src/Observers/PaymentObserver.php index b0034951..711e2ca6 100644 --- a/src/Core/src/Observers/PaymentObserver.php +++ b/src/Core/src/Observers/PaymentObserver.php @@ -33,14 +33,14 @@ class PaymentObserver public function created(Model $payment): void { - if ($this->authorizeType()) { + if ($this->authorizeType($payment)) { static::job($payment)->start(); } } public function updated(Model $payment): void { - if (! $this->authorizeType()) { + if (! $this->authorizeType($payment)) { return; } @@ -55,7 +55,7 @@ public function updated(Model $payment): void public function restored(Model $payment): void { - if ($this->authorizeType()) { + if ($this->authorizeType($payment)) { static::job($payment)->retry(); } } diff --git a/src/Core/src/Services/Authorize.php b/src/Core/src/Services/Authorize.php index b01938ec..529b9d23 100644 --- a/src/Core/src/Services/Authorize.php +++ b/src/Core/src/Services/Authorize.php @@ -75,7 +75,9 @@ protected static function doesntHaveDetails(Model $payment): bool protected static function paymentTypes(): array { - return Config::payment()->drivers->keys()->toArray(); + return array_keys( + Config::payment()->drivers + ); } protected static function paymentType(Model $payment): mixed diff --git a/tests/Pest.php b/tests/Pest.php index 12486565..7047950c 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -2,7 +2,9 @@ use Cashbox\Core\Data\Config\ConfigData; use Cashbox\Core\Facades\Config; +use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\App; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Facade; use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Support\DataProperty; @@ -35,9 +37,9 @@ | */ -expect()->extend('toBeOne', function () { - return $this->toBe(1); -}); +//expect()->extend('toBeOne', function () { +// return $this->toBe(1); +//}); /* |-------------------------------------------------------------------------- @@ -64,13 +66,18 @@ function forgetConfig(): void forget(ConfigData::class, Config::class); } -function createPayment(TypeEnum $type, ?float $price = null): PaymentModel +function createPayment(TypeEnum $type, ?int $price = null): PaymentModel { $price ??= random_int(1, 50000); return PaymentModel::create(compact('type', 'price')); } +function paymentTable(): Builder +{ + return DB::table('payments'); +} + function fakeDataProperty(): DataProperty { $reflection = new ReflectionProperty(FakeData::class, 'foo'); diff --git a/tests/Unit/Drivers/Outside/CreatedTest.php b/tests/Unit/Drivers/Outside/CreatedTest.php new file mode 100644 index 00000000..5f050b7d --- /dev/null +++ b/tests/Unit/Drivers/Outside/CreatedTest.php @@ -0,0 +1,41 @@ +count())->toBe(0); + + $payment = createPayment(TypeEnum::outside)->refresh(); + + expect($payment->price)->toBeInt(); + expect($payment->type)->toBe(TypeEnum::outside); + expect($payment->status)->toBe(StatusEnum::new); + + expect(paymentTable()->count())->toBe(1); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertNotDispatched(FailedEvent::class); + Event::assertNotDispatched(RefundedEvent::class); + Event::assertNotDispatched(SuccessEvent::class); + Event::assertNotDispatched(WaitRefundEvent::class); + + Queue::assertNotPushed(StartJob::class); + Queue::assertNotPushed(VerifyJob::class); + Queue::assertNotPushed(RefundJob::class); +}); diff --git a/tests/Unit/Drivers/Outside/FailedTest.php b/tests/Unit/Drivers/Outside/FailedTest.php new file mode 100644 index 00000000..bb392e90 --- /dev/null +++ b/tests/Unit/Drivers/Outside/FailedTest.php @@ -0,0 +1,36 @@ +count())->toBe(0); + + createPayment(TypeEnum::outside); + + expect(paymentTable()->count())->toBe(1); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertNotDispatched(FailedEvent::class); + Event::assertNotDispatched(RefundedEvent::class); + Event::assertNotDispatched(SuccessEvent::class); + Event::assertNotDispatched(WaitRefundEvent::class); + + Queue::assertNotPushed(StartJob::class); + Queue::assertNotPushed(VerifyJob::class); + Queue::assertNotPushed(RefundJob::class); +}); diff --git a/tests/Unit/Drivers/Outside/RefundTest.php b/tests/Unit/Drivers/Outside/RefundTest.php new file mode 100644 index 00000000..0485940b --- /dev/null +++ b/tests/Unit/Drivers/Outside/RefundTest.php @@ -0,0 +1,7 @@ +toBeTrue(); +}); diff --git a/tests/Unit/Drivers/Outside/VerifyTest.php b/tests/Unit/Drivers/Outside/VerifyTest.php new file mode 100644 index 00000000..0485940b --- /dev/null +++ b/tests/Unit/Drivers/Outside/VerifyTest.php @@ -0,0 +1,7 @@ +toBeTrue(); +}); From 5e882870453bdf78a15a6f187bcb2db209345dc9 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 15 Jul 2023 23:11:19 +0300 Subject: [PATCH 055/164] Completed tests for undefined payment types --- tests/Unit/Drivers/Outside/CreatedTest.php | 2 +- tests/Unit/Drivers/Outside/FailedTest.php | 13 +++- tests/Unit/Drivers/Outside/RefundTest.php | 75 +++++++++++++++++++++- tests/Unit/Drivers/Outside/VerifyTest.php | 42 +++++++++++- 4 files changed, 125 insertions(+), 7 deletions(-) diff --git a/tests/Unit/Drivers/Outside/CreatedTest.php b/tests/Unit/Drivers/Outside/CreatedTest.php index 5f050b7d..ae9e8318 100644 --- a/tests/Unit/Drivers/Outside/CreatedTest.php +++ b/tests/Unit/Drivers/Outside/CreatedTest.php @@ -15,7 +15,7 @@ use Tests\Fixtures\Enums\StatusEnum; use Tests\Fixtures\Enums\TypeEnum; -it('checks for ignoring unspecified types of payments', function () { +it('checks the create', function () { Event::fake(); Queue::fake(); diff --git a/tests/Unit/Drivers/Outside/FailedTest.php b/tests/Unit/Drivers/Outside/FailedTest.php index bb392e90..5adc9158 100644 --- a/tests/Unit/Drivers/Outside/FailedTest.php +++ b/tests/Unit/Drivers/Outside/FailedTest.php @@ -12,15 +12,24 @@ use Cashbox\Core\Jobs\VerifyJob; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Queue; +use Tests\Fixtures\Enums\StatusEnum; use Tests\Fixtures\Enums\TypeEnum; -it('checks for ignoring unspecified types of payments', function () { +it('checks the failed', function () { Event::fake(); Queue::fake(); expect(paymentTable()->count())->toBe(0); - createPayment(TypeEnum::outside); + $payment = createPayment(TypeEnum::outside)->refresh(); + + expect($payment->price)->toBeInt(); + expect($payment->type)->toBe(TypeEnum::outside); + expect($payment->status)->toBe(StatusEnum::new); + + $payment->update(['status' => StatusEnum::failed]); + + expect($payment->refresh()->status)->toBe(StatusEnum::failed); expect(paymentTable()->count())->toBe(1); diff --git a/tests/Unit/Drivers/Outside/RefundTest.php b/tests/Unit/Drivers/Outside/RefundTest.php index 0485940b..84a4ab3e 100644 --- a/tests/Unit/Drivers/Outside/RefundTest.php +++ b/tests/Unit/Drivers/Outside/RefundTest.php @@ -2,6 +2,77 @@ declare(strict_types=1); -it('some', function () { - expect(true)->toBeTrue(); +use Cashbox\Core\Events\CreatedEvent; +use Cashbox\Core\Events\FailedEvent; +use Cashbox\Core\Events\RefundedEvent; +use Cashbox\Core\Events\SuccessEvent; +use Cashbox\Core\Events\WaitRefundEvent; +use Cashbox\Core\Jobs\RefundJob; +use Cashbox\Core\Jobs\StartJob; +use Cashbox\Core\Jobs\VerifyJob; +use Illuminate\Support\Facades\Event; +use Illuminate\Support\Facades\Queue; +use Tests\Fixtures\Enums\StatusEnum; +use Tests\Fixtures\Enums\TypeEnum; + +it('checks the wait to refund', function () { + Event::fake(); + Queue::fake(); + + expect(paymentTable()->count())->toBe(0); + + $payment = createPayment(TypeEnum::outside)->refresh(); + + expect($payment->price)->toBeInt(); + expect($payment->type)->toBe(TypeEnum::outside); + expect($payment->status)->toBe(StatusEnum::new); + + $payment->update(['status' => StatusEnum::waitRefund]); + + expect($payment->refresh()->status)->toBe(StatusEnum::waitRefund); + expect(paymentTable()->count())->toBe(1); + + $payment->update(['status' => StatusEnum::refund]); + + expect($payment->refresh()->status)->toBe(StatusEnum::refund); + expect(paymentTable()->count())->toBe(1); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertNotDispatched(FailedEvent::class); + Event::assertNotDispatched(RefundedEvent::class); + Event::assertNotDispatched(SuccessEvent::class); + Event::assertNotDispatched(WaitRefundEvent::class); + + Queue::assertNotPushed(StartJob::class); + Queue::assertNotPushed(VerifyJob::class); + Queue::assertNotPushed(RefundJob::class); +}); + +it('checks the refund', function () { + Event::fake(); + Queue::fake(); + + expect(paymentTable()->count())->toBe(0); + + $payment = createPayment(TypeEnum::outside)->refresh(); + + expect($payment->price)->toBeInt(); + expect($payment->type)->toBe(TypeEnum::outside); + expect($payment->status)->toBe(StatusEnum::new); + + $payment->update(['status' => StatusEnum::refund]); + + expect($payment->refresh()->status)->toBe(StatusEnum::refund); + + expect(paymentTable()->count())->toBe(1); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertNotDispatched(FailedEvent::class); + Event::assertNotDispatched(RefundedEvent::class); + Event::assertNotDispatched(SuccessEvent::class); + Event::assertNotDispatched(WaitRefundEvent::class); + + Queue::assertNotPushed(StartJob::class); + Queue::assertNotPushed(VerifyJob::class); + Queue::assertNotPushed(RefundJob::class); }); diff --git a/tests/Unit/Drivers/Outside/VerifyTest.php b/tests/Unit/Drivers/Outside/VerifyTest.php index 0485940b..31a5ebd2 100644 --- a/tests/Unit/Drivers/Outside/VerifyTest.php +++ b/tests/Unit/Drivers/Outside/VerifyTest.php @@ -2,6 +2,44 @@ declare(strict_types=1); -it('some', function () { - expect(true)->toBeTrue(); +use Cashbox\Core\Events\CreatedEvent; +use Cashbox\Core\Events\FailedEvent; +use Cashbox\Core\Events\RefundedEvent; +use Cashbox\Core\Events\SuccessEvent; +use Cashbox\Core\Events\WaitRefundEvent; +use Cashbox\Core\Jobs\RefundJob; +use Cashbox\Core\Jobs\StartJob; +use Cashbox\Core\Jobs\VerifyJob; +use Illuminate\Support\Facades\Event; +use Illuminate\Support\Facades\Queue; +use Tests\Fixtures\Enums\StatusEnum; +use Tests\Fixtures\Enums\TypeEnum; + +it('checks the verify', function () { + Event::fake(); + Queue::fake(); + + expect(paymentTable()->count())->toBe(0); + + $payment = createPayment(TypeEnum::outside)->refresh(); + + expect($payment->price)->toBeInt(); + expect($payment->type)->toBe(TypeEnum::outside); + expect($payment->status)->toBe(StatusEnum::new); + + $payment->update(['status' => StatusEnum::failed]); + + expect($payment->refresh()->status)->toBe(StatusEnum::failed); + + expect(paymentTable()->count())->toBe(1); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertNotDispatched(FailedEvent::class); + Event::assertNotDispatched(RefundedEvent::class); + Event::assertNotDispatched(SuccessEvent::class); + Event::assertNotDispatched(WaitRefundEvent::class); + + Queue::assertNotPushed(StartJob::class); + Queue::assertNotPushed(VerifyJob::class); + Queue::assertNotPushed(RefundJob::class); }); From 6198e351d4972f2e7a0f685f68d3a2388531994b Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 15 Jul 2023 23:40:06 +0300 Subject: [PATCH 056/164] WIP --- .../Transformers/EnumsTransformer.php | 6 ++- src/Core/src/Observers/PaymentObserver.php | 5 +++ src/Core/src/Services/Authorize.php | 8 +++- tests/Pest.php | 36 ++++++++++++++++ tests/Unit/Drivers/Cash/CreateTest.php | 15 ------- tests/Unit/Drivers/Cash/CreatedTest.php | 43 +++++++++++++++++++ tests/Unit/Drivers/Outside/CreatedTest.php | 3 +- tests/Unit/Drivers/Outside/FailedTest.php | 3 +- tests/Unit/Drivers/Outside/RefundTest.php | 3 +- tests/Unit/Drivers/Outside/VerifyTest.php | 3 +- 10 files changed, 99 insertions(+), 26 deletions(-) delete mode 100644 tests/Unit/Drivers/Cash/CreateTest.php create mode 100644 tests/Unit/Drivers/Cash/CreatedTest.php diff --git a/src/Core/src/Concerns/Transformers/EnumsTransformer.php b/src/Core/src/Concerns/Transformers/EnumsTransformer.php index a00c5068..eae74c9b 100644 --- a/src/Core/src/Concerns/Transformers/EnumsTransformer.php +++ b/src/Core/src/Concerns/Transformers/EnumsTransformer.php @@ -23,6 +23,10 @@ trait EnumsTransformer { protected static function transformFromEnum(int|string|BackedEnum $item): int|string { - return $item instanceof BackedEnum ? ($item->value ?? $item->name) : $item; + if ($item instanceof BackedEnum) { + return $item->value ?? $item->name; + } + + return $item; } } diff --git a/src/Core/src/Observers/PaymentObserver.php b/src/Core/src/Observers/PaymentObserver.php index 711e2ca6..7ca0cd7e 100644 --- a/src/Core/src/Observers/PaymentObserver.php +++ b/src/Core/src/Observers/PaymentObserver.php @@ -31,6 +31,11 @@ class PaymentObserver use Jobs; use Notifiable; + public function creating(Model $payment): void + { + $payment->status = static::payment()->status->new; + } + public function created(Model $payment): void { if ($this->authorizeType($payment)) { diff --git a/src/Core/src/Services/Authorize.php b/src/Core/src/Services/Authorize.php index 529b9d23..061a9e8c 100644 --- a/src/Core/src/Services/Authorize.php +++ b/src/Core/src/Services/Authorize.php @@ -19,12 +19,14 @@ use Cashbox\Core\Concerns\Config\Payment\Attributes; use Cashbox\Core\Concerns\Config\Payment\Statuses; +use Cashbox\Core\Concerns\Transformers\EnumsTransformer; use Cashbox\Core\Facades\Config; use Illuminate\Database\Eloquent\Model; class Authorize { use Attributes; + use EnumsTransformer; use Statuses; public static function type(Model $payment): bool @@ -80,9 +82,11 @@ protected static function paymentTypes(): array ); } - protected static function paymentType(Model $payment): mixed + protected static function paymentType(Model $payment): int|string { - return $payment->getAttribute(static::attribute()->type); + return static::transformFromEnum( + $payment->getAttribute(static::attribute()->type) + ); } protected static function paymentStatus(Model $payment): mixed diff --git a/tests/Pest.php b/tests/Pest.php index 7047950c..3e0a17a6 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,11 +1,22 @@ cast($property, $value, $context); } + +function fakes(bool $events = true, bool $queue = true, bool $http = true): void +{ + if ($events) { + Event::fake([ + CreatedEvent::class, + FailedEvent::class, + RefundedEvent::class, + SuccessEvent::class, + WaitRefundEvent::class, + ]); + } + + if ($queue) { + Queue::fake([ + StartJob::class, + VerifyJob::class, + RefundJob::class, + ]); + } + + if ($http) { + Http::fake(); + } +} diff --git a/tests/Unit/Drivers/Cash/CreateTest.php b/tests/Unit/Drivers/Cash/CreateTest.php deleted file mode 100644 index 7d1178f0..00000000 --- a/tests/Unit/Drivers/Cash/CreateTest.php +++ /dev/null @@ -1,15 +0,0 @@ -toArray()); -//}); - -it('some', function () { - expect(true)->toBeTrue(); -}); diff --git a/tests/Unit/Drivers/Cash/CreatedTest.php b/tests/Unit/Drivers/Cash/CreatedTest.php new file mode 100644 index 00000000..9ad1e5e4 --- /dev/null +++ b/tests/Unit/Drivers/Cash/CreatedTest.php @@ -0,0 +1,43 @@ +count())->toBe(0); + + $payment = createPayment(TypeEnum::cash)->refresh(); + + expect($payment->price)->toBeInt(); + expect($payment->type)->toBe(TypeEnum::cash); + expect($payment->status)->toBe(StatusEnum::new); + + expect(paymentTable()->count())->toBe(1); + + Event::assertDispatched(CreatedEvent::class); + Event::assertNotDispatched(FailedEvent::class); + Event::assertNotDispatched(RefundedEvent::class); + Event::assertNotDispatched(SuccessEvent::class); + Event::assertNotDispatched(WaitRefundEvent::class); + + Queue::assertPushed(StartJob::class); + Queue::assertNotPushed(VerifyJob::class); + Queue::assertNotPushed(RefundJob::class); + + Http::assertNothingSent(); +}); diff --git a/tests/Unit/Drivers/Outside/CreatedTest.php b/tests/Unit/Drivers/Outside/CreatedTest.php index ae9e8318..60ab236e 100644 --- a/tests/Unit/Drivers/Outside/CreatedTest.php +++ b/tests/Unit/Drivers/Outside/CreatedTest.php @@ -16,8 +16,7 @@ use Tests\Fixtures\Enums\TypeEnum; it('checks the create', function () { - Event::fake(); - Queue::fake(); + fakes(); expect(paymentTable()->count())->toBe(0); diff --git a/tests/Unit/Drivers/Outside/FailedTest.php b/tests/Unit/Drivers/Outside/FailedTest.php index 5adc9158..47932583 100644 --- a/tests/Unit/Drivers/Outside/FailedTest.php +++ b/tests/Unit/Drivers/Outside/FailedTest.php @@ -16,8 +16,7 @@ use Tests\Fixtures\Enums\TypeEnum; it('checks the failed', function () { - Event::fake(); - Queue::fake(); + fakes(); expect(paymentTable()->count())->toBe(0); diff --git a/tests/Unit/Drivers/Outside/RefundTest.php b/tests/Unit/Drivers/Outside/RefundTest.php index 84a4ab3e..d274c78d 100644 --- a/tests/Unit/Drivers/Outside/RefundTest.php +++ b/tests/Unit/Drivers/Outside/RefundTest.php @@ -16,8 +16,7 @@ use Tests\Fixtures\Enums\TypeEnum; it('checks the wait to refund', function () { - Event::fake(); - Queue::fake(); + fakes(); expect(paymentTable()->count())->toBe(0); diff --git a/tests/Unit/Drivers/Outside/VerifyTest.php b/tests/Unit/Drivers/Outside/VerifyTest.php index 31a5ebd2..ebb9817e 100644 --- a/tests/Unit/Drivers/Outside/VerifyTest.php +++ b/tests/Unit/Drivers/Outside/VerifyTest.php @@ -16,8 +16,7 @@ use Tests\Fixtures\Enums\TypeEnum; it('checks the verify', function () { - Event::fake(); - Queue::fake(); + fakes(); expect(paymentTable()->count())->toBe(0); From 73c7d37cf9c3e6ea8ecca481449aec73ee06b24e Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 01:29:18 +0300 Subject: [PATCH 057/164] Split tests --- tests/Fixtures/{ => App}/Enums/StatusEnum.php | 2 +- tests/Fixtures/{ => App}/Enums/TypeEnum.php | 2 +- tests/Fixtures/{ => App}/Models/PaymentModel.php | 6 +++--- tests/Fixtures/{ => Drivers/Cash}/Payments/Cash.php | 2 +- .../2023_07_14_022222_create_payments_model.php | 2 +- tests/Pest.php | 4 ++-- tests/TestCase.php | 8 ++++---- tests/Unit/Core/Data/Casts/FromEnumCastTest.php | 2 +- .../Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php | 2 +- tests/Unit/Core/Facades/ConfigTest.php | 8 ++++---- tests/Unit/Drivers/Cash/CreatedTest.php | 4 ++-- tests/Unit/Drivers/Outside/CreatedTest.php | 4 ++-- tests/Unit/Drivers/Outside/FailedTest.php | 4 ++-- tests/Unit/Drivers/Outside/RefundTest.php | 4 ++-- tests/Unit/Drivers/Outside/VerifyTest.php | 4 ++-- 15 files changed, 29 insertions(+), 29 deletions(-) rename tests/Fixtures/{ => App}/Enums/StatusEnum.php (83%) rename tests/Fixtures/{ => App}/Enums/TypeEnum.php (87%) rename tests/Fixtures/{ => App}/Models/PaymentModel.php (78%) rename tests/Fixtures/{ => Drivers/Cash}/Payments/Cash.php (87%) diff --git a/tests/Fixtures/Enums/StatusEnum.php b/tests/Fixtures/App/Enums/StatusEnum.php similarity index 83% rename from tests/Fixtures/Enums/StatusEnum.php rename to tests/Fixtures/App/Enums/StatusEnum.php index fc9f42ed..0acb42f2 100644 --- a/tests/Fixtures/Enums/StatusEnum.php +++ b/tests/Fixtures/App/Enums/StatusEnum.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Fixtures\Enums; +namespace Tests\Fixtures\App\Enums; enum StatusEnum: int { diff --git a/tests/Fixtures/Enums/TypeEnum.php b/tests/Fixtures/App/Enums/TypeEnum.php similarity index 87% rename from tests/Fixtures/Enums/TypeEnum.php rename to tests/Fixtures/App/Enums/TypeEnum.php index 072d5472..e44acfc2 100644 --- a/tests/Fixtures/Enums/TypeEnum.php +++ b/tests/Fixtures/App/Enums/TypeEnum.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Fixtures\Enums; +namespace Tests\Fixtures\App\Enums; use ArchTech\Enums\InvokableCases; diff --git a/tests/Fixtures/Models/PaymentModel.php b/tests/Fixtures/App/Models/PaymentModel.php similarity index 78% rename from tests/Fixtures/Models/PaymentModel.php rename to tests/Fixtures/App/Models/PaymentModel.php index f0be50b4..dee26ad1 100644 --- a/tests/Fixtures/Models/PaymentModel.php +++ b/tests/Fixtures/App/Models/PaymentModel.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Fixtures\Models; +namespace Tests\Fixtures\App\Models; use Cashbox\Core\Billable; use Illuminate\Database\Eloquent\Model; -use Tests\Fixtures\Enums\StatusEnum; -use Tests\Fixtures\Enums\TypeEnum; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; class PaymentModel extends Model { diff --git a/tests/Fixtures/Payments/Cash.php b/tests/Fixtures/Drivers/Cash/Payments/Cash.php similarity index 87% rename from tests/Fixtures/Payments/Cash.php rename to tests/Fixtures/Drivers/Cash/Payments/Cash.php index 30a97115..97b0616e 100644 --- a/tests/Fixtures/Payments/Cash.php +++ b/tests/Fixtures/Drivers/Cash/Payments/Cash.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Fixtures\Payments; +namespace Tests\Fixtures\Drivers\Cash\Payments; use Cashbox\Cash\Resources\CashResource; use Cashbox\Core\Enums\CurrencyEnum; diff --git a/tests/Fixtures/database/migrations/2023_07_14_022222_create_payments_model.php b/tests/Fixtures/database/migrations/2023_07_14_022222_create_payments_model.php index 27810e78..e3215e05 100644 --- a/tests/Fixtures/database/migrations/2023_07_14_022222_create_payments_model.php +++ b/tests/Fixtures/database/migrations/2023_07_14_022222_create_payments_model.php @@ -5,7 +5,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -use Tests\Fixtures\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\StatusEnum; return new class extends Migration { public function up(): void diff --git a/tests/Pest.php b/tests/Pest.php index 3e0a17a6..daebc726 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -19,9 +19,9 @@ use Illuminate\Support\Facades\Queue; use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Support\DataProperty; +use Tests\Fixtures\App\Enums\TypeEnum; +use Tests\Fixtures\App\Models\PaymentModel; use Tests\Fixtures\Data\FakeData; -use Tests\Fixtures\Enums\TypeEnum; -use Tests\Fixtures\Models\PaymentModel; use Tests\TestCase; /* diff --git a/tests/TestCase.php b/tests/TestCase.php index 02d34e6f..7b248789 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -12,10 +12,10 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Orchestra\Testbench\TestCase as BaseTestCase; use Spatie\LaravelData\LaravelDataServiceProvider; -use Tests\Fixtures\Enums\StatusEnum as TestStatusEnum; -use Tests\Fixtures\Enums\TypeEnum; -use Tests\Fixtures\Models\PaymentModel; -use Tests\Fixtures\Payments\Cash; +use Tests\Fixtures\App\Enums\StatusEnum as TestStatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; +use Tests\Fixtures\App\Models\PaymentModel; +use Tests\Fixtures\Drivers\Cash\Payments\Cash; use Tests\Fixtures\Providers\TestServiceProvider; abstract class TestCase extends BaseTestCase diff --git a/tests/Unit/Core/Data/Casts/FromEnumCastTest.php b/tests/Unit/Core/Data/Casts/FromEnumCastTest.php index 9c1bab27..501ac23d 100644 --- a/tests/Unit/Core/Data/Casts/FromEnumCastTest.php +++ b/tests/Unit/Core/Data/Casts/FromEnumCastTest.php @@ -3,7 +3,7 @@ declare(strict_types=1); use Cashbox\Core\Data\Casts\FromEnumCast; -use Tests\Fixtures\Enums\TypeEnum; +use Tests\Fixtures\App\Enums\TypeEnum; it('must be a enum', function () { expect( diff --git a/tests/Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php b/tests/Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php index 01cbe99c..c28ebd56 100644 --- a/tests/Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php +++ b/tests/Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php @@ -6,8 +6,8 @@ use Cashbox\Core\Data\Casts\Instances\InstanceOfCast; use Cashbox\Core\Exceptions\Internal\IncorrectModelException; use Cashbox\Core\Services\Driver; +use Tests\Fixtures\App\Models\PaymentModel; use Tests\Fixtures\Data\FakeData; -use Tests\Fixtures\Models\PaymentModel; it('must be correct', function () { expect( diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 8d70fecf..35441379 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -9,11 +9,11 @@ use Cashbox\Core\Facades\Config; use Cashbox\Core\Resources\Resource; use Cashbox\Core\Services\Driver; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; +use Tests\Fixtures\App\Models\PaymentModel; use Tests\Fixtures\Data\FakeData; -use Tests\Fixtures\Enums\StatusEnum; -use Tests\Fixtures\Enums\TypeEnum; -use Tests\Fixtures\Models\PaymentModel; -use Tests\Fixtures\Payments\Cash; +use Tests\Fixtures\Drivers\Cash\Payments\Cash; it('should return an error when running an empty config file', function () { forgetConfig(); diff --git a/tests/Unit/Drivers/Cash/CreatedTest.php b/tests/Unit/Drivers/Cash/CreatedTest.php index 9ad1e5e4..21580912 100644 --- a/tests/Unit/Drivers/Cash/CreatedTest.php +++ b/tests/Unit/Drivers/Cash/CreatedTest.php @@ -13,8 +13,8 @@ use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Queue; -use Tests\Fixtures\Enums\StatusEnum; -use Tests\Fixtures\Enums\TypeEnum; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; it('checks the create', function () { fakes(); diff --git a/tests/Unit/Drivers/Outside/CreatedTest.php b/tests/Unit/Drivers/Outside/CreatedTest.php index 60ab236e..783a4c19 100644 --- a/tests/Unit/Drivers/Outside/CreatedTest.php +++ b/tests/Unit/Drivers/Outside/CreatedTest.php @@ -12,8 +12,8 @@ use Cashbox\Core\Jobs\VerifyJob; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Queue; -use Tests\Fixtures\Enums\StatusEnum; -use Tests\Fixtures\Enums\TypeEnum; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; it('checks the create', function () { fakes(); diff --git a/tests/Unit/Drivers/Outside/FailedTest.php b/tests/Unit/Drivers/Outside/FailedTest.php index 47932583..565b8c54 100644 --- a/tests/Unit/Drivers/Outside/FailedTest.php +++ b/tests/Unit/Drivers/Outside/FailedTest.php @@ -12,8 +12,8 @@ use Cashbox\Core\Jobs\VerifyJob; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Queue; -use Tests\Fixtures\Enums\StatusEnum; -use Tests\Fixtures\Enums\TypeEnum; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; it('checks the failed', function () { fakes(); diff --git a/tests/Unit/Drivers/Outside/RefundTest.php b/tests/Unit/Drivers/Outside/RefundTest.php index d274c78d..da6f96b7 100644 --- a/tests/Unit/Drivers/Outside/RefundTest.php +++ b/tests/Unit/Drivers/Outside/RefundTest.php @@ -12,8 +12,8 @@ use Cashbox\Core\Jobs\VerifyJob; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Queue; -use Tests\Fixtures\Enums\StatusEnum; -use Tests\Fixtures\Enums\TypeEnum; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; it('checks the wait to refund', function () { fakes(); diff --git a/tests/Unit/Drivers/Outside/VerifyTest.php b/tests/Unit/Drivers/Outside/VerifyTest.php index ebb9817e..7631c811 100644 --- a/tests/Unit/Drivers/Outside/VerifyTest.php +++ b/tests/Unit/Drivers/Outside/VerifyTest.php @@ -12,8 +12,8 @@ use Cashbox\Core\Jobs\VerifyJob; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Queue; -use Tests\Fixtures\Enums\StatusEnum; -use Tests\Fixtures\Enums\TypeEnum; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; it('checks the verify', function () { fakes(); From b6d4dafa26c0aa103d30731d25870138bae33a38 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 02:40:04 +0300 Subject: [PATCH 058/164] Removed unnecessary, including code duplication --- composer.json | 8 ++++ src/Core/config/cashbox.php | 4 +- src/Core/src/Billable.php | 35 +++++++++++++- .../src/Concerns/Config/Payment/Drivers.php | 22 ++++----- src/Core/src/Concerns/Config/Queue.php | 5 ++ src/Core/src/Concerns/Events/Notifiable.php | 13 +++-- src/Core/src/Concerns/Helpers/Logging.php | 8 +--- .../src/Concerns/Repositories/Registry.php | 19 ++++++++ src/Core/src/Console/Commands/Command.php | 4 +- src/Core/src/Data/Casts/NumberCast.php | 2 +- .../src/Data/Config/Payment/AttributeData.php | 1 - .../src/Data/Config/Payment/StatusData.php | 16 +++---- src/Core/src/Data/Models/InfoData.php | 4 +- src/Core/src/Enums/RateLimiterEnum.php | 4 +- src/Core/src/Http/Response.php | 6 +-- src/Core/src/Jobs/BaseJob.php | 3 +- src/Core/src/Models/Details.php | 8 +++- .../src/Observers/PaymentDetailsObserver.php | 10 ++-- src/Core/src/Observers/PaymentObserver.php | 1 + .../Providers/RateLimiterServiceProvider.php | 13 +++-- src/Core/src/Resources/Resource.php | 10 ++-- src/Core/src/Services/Authorize.php | 43 +++++++++-------- src/Core/src/Services/Driver.php | 13 +++-- src/Core/src/Services/DriverManager.php | 8 ++-- src/Core/src/Services/Http.php | 29 +++++++----- src/Core/src/Services/Statuses.php | 47 ++++++++----------- tests/TestCase.php | 2 +- 27 files changed, 199 insertions(+), 139 deletions(-) create mode 100644 src/Core/src/Concerns/Repositories/Registry.php diff --git a/composer.json b/composer.json index 593df452..63e839f6 100644 --- a/composer.json +++ b/composer.json @@ -117,6 +117,14 @@ "branch-alias": { "dev-main": "4.x-dev" }, + "laravel": { + "providers": [ + "Cashbox\\Core\\Providers\\ServiceProvider", + "Cashbox\\Core\\Providers\\BindingServiceProvider", + "Cashbox\\Core\\Providers\\ObserverServiceProvider", + "Cashbox\\Core\\Providers\\RateLimiterServiceProvider" + ] + }, "thanks": [ { "name": "archtechx/enums", diff --git a/src/Core/config/cashbox.php b/src/Core/config/cashbox.php index 630b1ffd..7028f1e2 100644 --- a/src/Core/config/cashbox.php +++ b/src/Core/config/cashbox.php @@ -101,8 +101,8 @@ */ 'drivers' => [ - // 'app_payment_type_1' => 'driver_name_foo', - // 'app_payment_type_2' => 'driver_name_bar', + // 'driver_name_foo' => 'app_payment_type_1', + // 'driver_name_bar' => 'app_payment_type_2', ], ], diff --git a/src/Core/src/Billable.php b/src/Core/src/Billable.php index 7445f822..0c3a15f2 100644 --- a/src/Core/src/Billable.php +++ b/src/Core/src/Billable.php @@ -17,9 +17,12 @@ namespace Cashbox\Core; +use Cashbox\Core\Concerns\Config\Payment\Attributes; +use Cashbox\Core\Concerns\Repositories\Registry; use Cashbox\Core\Models\Details; use Cashbox\Core\Services\Driver; use Cashbox\Core\Services\DriverManager; +use DateTimeInterface; use Illuminate\Database\Eloquent\Relations\Relation; /** @@ -27,6 +30,11 @@ */ trait Billable { + use Attributes; + use Registry; + + protected ?Driver $cashboxDriver = null; + public function cashbox(): Relation { return $this->hasOne(Details::class, 'payment_id', $this->getKeyName()); @@ -34,6 +42,31 @@ public function cashbox(): Relation public function cashboxDriver(): Driver { - return DriverManager::find($this); + if ($this->cashboxDriver) { + return $this->cashboxDriver; + } + + return $this->cashboxDriver = DriverManager::find($this); + } + + public function cashboxAttributeType(): mixed + { + return $this->getAttribute( + static::attribute()->type + ); + } + + public function cashboxAttributeStatus(): mixed + { + return $this->getAttribute( + static::attribute()->status + ); + } + + public function cashboxAttributeCreatedAt(): DateTimeInterface + { + return $this->getAttribute( + static::attribute()->createdAt + ); } } diff --git a/src/Core/src/Concerns/Config/Payment/Drivers.php b/src/Core/src/Concerns/Config/Payment/Drivers.php index 22814248..8f41db79 100644 --- a/src/Core/src/Concerns/Config/Payment/Drivers.php +++ b/src/Core/src/Concerns/Config/Payment/Drivers.php @@ -17,7 +17,6 @@ namespace Cashbox\Core\Concerns\Config\Payment; -use Cashbox\Core\Concerns\Transformers\EnumsTransformer; use Cashbox\Core\Data\Config\DriverData; use Cashbox\Core\Exceptions\Internal\UnknownDriverConfigException; use Cashbox\Core\Facades\Config; @@ -25,14 +24,6 @@ trait Drivers { - use Attributes; - use EnumsTransformer; - - protected static function drivers(): array - { - return Config::payment()->drivers; - } - protected static function driver(int|string $name, Model $payment): DriverData { if ($driver = Config::driver($name)) { @@ -42,12 +33,15 @@ protected static function driver(int|string $name, Model $payment): DriverData throw new UnknownDriverConfigException($name, $payment->getKey()); } + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment + * + * @throws \Cashbox\Core\Exceptions\Internal\UnknownDriverConfigException + * + * @return \Cashbox\Core\Data\Config\DriverData + */ protected static function driverByModel(Model $payment): DriverData { - $name = $payment->getAttribute( - static::attribute()->type - ); - - return static::driver(static::transformFromEnum($name), $payment); + return static::driver($payment->cashboxAttributeType(), $payment); } } diff --git a/src/Core/src/Concerns/Config/Queue.php b/src/Core/src/Concerns/Config/Queue.php index 7d48b70a..9db205e1 100644 --- a/src/Core/src/Concerns/Config/Queue.php +++ b/src/Core/src/Concerns/Config/Queue.php @@ -32,6 +32,11 @@ protected static function queue(): QueueData return Config::queue(); } + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable|null $payment + * + * @return \Cashbox\Core\Data\Config\Queue\QueueNameData + */ protected static function queueName(?Model $payment = null): QueueNameData { if ($payment) { diff --git a/src/Core/src/Concerns/Events/Notifiable.php b/src/Core/src/Concerns/Events/Notifiable.php index e942dba3..638e4e24 100644 --- a/src/Core/src/Concerns/Events/Notifiable.php +++ b/src/Core/src/Concerns/Events/Notifiable.php @@ -17,7 +17,6 @@ namespace Cashbox\Core\Concerns\Events; -use Cashbox\Core\Concerns\Config\Payment\Attributes; use Cashbox\Core\Concerns\Config\Payment\Payments; use Cashbox\Core\Enums\StatusEnum; use Cashbox\Core\Events\CreatedEvent; @@ -29,7 +28,6 @@ trait Notifiable { - use Attributes; use Payments; protected static function event(Model $payment, StatusEnum $status): void @@ -48,10 +46,15 @@ protected static function eventWithDetect(Model $payment): void static::event($payment, static::detectEvent($payment)); } + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment + * + * @return \Cashbox\Core\Enums\StatusEnum + */ protected static function detectEvent(Model $payment): StatusEnum { - $status = $payment->getAttribute(static::attribute()->status); - - return static::payment()->status->toEnum($status); + return static::payment()->status->toEnum( + $payment->cashboxAttributeStatus() + ); } } diff --git a/src/Core/src/Concerns/Helpers/Logging.php b/src/Core/src/Concerns/Helpers/Logging.php index b12076fb..1ad09652 100644 --- a/src/Core/src/Concerns/Helpers/Logging.php +++ b/src/Core/src/Concerns/Helpers/Logging.php @@ -54,19 +54,13 @@ protected static function error(Request $request, Response $response): void protected static function header(Request $request, Response $response): string { return sprintf( - '%d %s, %s %s', + '%d %s, POST %s', $response->status(), static::status($response), - static::method($request), $request->uri() ); } - protected static function method(Request $request): string - { - return $request->post ? 'POST' : 'GET'; - } - protected static function status(Response $response): string { return match (true) { diff --git a/src/Core/src/Concerns/Repositories/Registry.php b/src/Core/src/Concerns/Repositories/Registry.php new file mode 100644 index 00000000..ff30ae1f --- /dev/null +++ b/src/Core/src/Concerns/Repositories/Registry.php @@ -0,0 +1,19 @@ +registry[$class])) { + return $this->registry[$class]; + } + + return $this->registry[$class] = new $class(...$parameters); + } +} diff --git a/src/Core/src/Console/Commands/Command.php b/src/Core/src/Console/Commands/Command.php index 74fab5ea..69d71fe3 100644 --- a/src/Core/src/Console/Commands/Command.php +++ b/src/Core/src/Console/Commands/Command.php @@ -85,7 +85,9 @@ protected function modelKey(): string protected function getTypes(): array { - return static::drivers()->keys()->toArray(); + return array_values( + static::payment()->drivers + ); } protected function action(): string diff --git a/src/Core/src/Data/Casts/NumberCast.php b/src/Core/src/Data/Casts/NumberCast.php index 98ec44e0..161c2f8d 100644 --- a/src/Core/src/Data/Casts/NumberCast.php +++ b/src/Core/src/Data/Casts/NumberCast.php @@ -27,6 +27,6 @@ public function __construct( public function cast(DataProperty $property, mixed $value, array $context): int { - return min(max($this->min, (int) $value), $this->max); + return min(max($this->min, intval($value)), $this->max); } } diff --git a/src/Core/src/Data/Config/Payment/AttributeData.php b/src/Core/src/Data/Config/Payment/AttributeData.php index e67e53b2..11cdf10c 100644 --- a/src/Core/src/Data/Config/Payment/AttributeData.php +++ b/src/Core/src/Data/Config/Payment/AttributeData.php @@ -28,6 +28,5 @@ class AttributeData extends Data public string $status; - #[MapInputName('created_at')] public string $createdAt; } diff --git a/src/Core/src/Data/Config/Payment/StatusData.php b/src/Core/src/Data/Config/Payment/StatusData.php index c3fa16fb..e5f099bf 100644 --- a/src/Core/src/Data/Config/Payment/StatusData.php +++ b/src/Core/src/Data/Config/Payment/StatusData.php @@ -17,7 +17,6 @@ namespace Cashbox\Core\Data\Config\Payment; -use BackedEnum; use Cashbox\Core\Enums\StatusEnum; use Spatie\LaravelData\Attributes\MapName; use Spatie\LaravelData\Data; @@ -26,17 +25,17 @@ #[MapName(SnakeCaseMapper::class)] class StatusData extends Data { - public int|string|BackedEnum $new; + public mixed $new; - public int|string|BackedEnum $success; + public mixed $success; - public int|string|BackedEnum $refund; + public mixed $refund; - public int|string|BackedEnum $waitRefund; + public mixed $waitRefund; - public int|string|BackedEnum $failed; + public mixed $failed; - public function fromEnum(StatusEnum $status): int|string|BackedEnum + public function fromEnum(StatusEnum $status): mixed { return match ($status) { StatusEnum::new => $this->new, @@ -47,7 +46,7 @@ public function fromEnum(StatusEnum $status): int|string|BackedEnum }; } - public function toEnum(int|string|BackedEnum $status): StatusEnum + public function toEnum(mixed $status): ?StatusEnum { return match ($status) { $this->new => StatusEnum::new, @@ -55,6 +54,7 @@ public function toEnum(int|string|BackedEnum $status): StatusEnum $this->refund => StatusEnum::refund, $this->waitRefund => StatusEnum::waitRefund, $this->failed => StatusEnum::failed, + default => null }; } diff --git a/src/Core/src/Data/Models/InfoData.php b/src/Core/src/Data/Models/InfoData.php index d3134bff..359f1600 100644 --- a/src/Core/src/Data/Models/InfoData.php +++ b/src/Core/src/Data/Models/InfoData.php @@ -7,15 +7,15 @@ use Cashbox\Core\Concerns\Config\Application; use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Data; +use Spatie\LaravelData\Mappers\SnakeCaseMapper; +#[MapInputName(SnakeCaseMapper::class)] class InfoData extends Data { use Application; - #[MapInputName('external_id')] public ?string $externalId; - #[MapInputName('operation_id')] public ?string $operationId; public ?string $status; diff --git a/src/Core/src/Enums/RateLimiterEnum.php b/src/Core/src/Enums/RateLimiterEnum.php index 65186d8d..d8db1fc3 100644 --- a/src/Core/src/Enums/RateLimiterEnum.php +++ b/src/Core/src/Enums/RateLimiterEnum.php @@ -27,6 +27,6 @@ enum RateLimiterEnum: string { use InvokableCases; - case disabled = 'cashier_disabled'; - case enabled = 'cashier_enabled'; + case disabled = 'cashbox_disabled'; + case enabled = 'cashbox_enabled'; } diff --git a/src/Core/src/Http/Response.php b/src/Core/src/Http/Response.php index b155206c..08f81aa6 100644 --- a/src/Core/src/Http/Response.php +++ b/src/Core/src/Http/Response.php @@ -18,13 +18,11 @@ namespace Cashbox\Core\Http; use DragonCode\Support\Facades\Helpers\Arr; -use Spatie\LaravelData\Attributes\MapInputName; -use Spatie\LaravelData\Attributes\MapOutputName; +use Spatie\LaravelData\Attributes\MapName; use Spatie\LaravelData\Data; use Spatie\LaravelData\Mappers\SnakeCaseMapper; -#[MapInputName(SnakeCaseMapper::class)] -#[MapOutputName(SnakeCaseMapper::class)] +#[MapName(SnakeCaseMapper::class)] abstract class Response extends Data { abstract public function getExternalId(): ?string; diff --git a/src/Core/src/Jobs/BaseJob.php b/src/Core/src/Jobs/BaseJob.php index 1e576cfe..d044bce3 100644 --- a/src/Core/src/Jobs/BaseJob.php +++ b/src/Core/src/Jobs/BaseJob.php @@ -30,6 +30,7 @@ use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\Middleware\RateLimitedWithRedis; use Illuminate\Queue\SerializesModels; +use Illuminate\Support\Str; use Throwable; /** @@ -104,7 +105,7 @@ protected function generateUniqueId(): string return ''; } - return retry(2, fn () => '_' . random_bytes(10)); + return retry(2, fn () => Str::random()); } catch (Throwable) { return '_' . (int) $this->force; diff --git a/src/Core/src/Models/Details.php b/src/Core/src/Models/Details.php index 95730047..adb0821a 100644 --- a/src/Core/src/Models/Details.php +++ b/src/Core/src/Models/Details.php @@ -22,6 +22,7 @@ use Cashbox\Core\Data\Models\InfoData; use Cashbox\Core\Enums\StatusEnum; use Cashbox\Core\Facades\Config; +use DragonCode\LaravelSupport\Traits\InitModelHelper; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\Relation; @@ -33,6 +34,7 @@ class Details extends Model { use DetailsConcern; + use InitModelHelper; protected $fillable = [ 'payment_id', @@ -61,6 +63,10 @@ public function __construct(array $attributes = []) public function parent(): Relation { - return $this->belongsTo(Config::payment()->model, 'id', 'payment_id'); + $payment = Config::payment()->model; + + $key = $this->model()->primaryKey($payment); + + return $this->belongsTo($payment, $key, 'payment_id'); } } diff --git a/src/Core/src/Observers/PaymentDetailsObserver.php b/src/Core/src/Observers/PaymentDetailsObserver.php index 5d22d08c..d9db93b5 100644 --- a/src/Core/src/Observers/PaymentDetailsObserver.php +++ b/src/Core/src/Observers/PaymentDetailsObserver.php @@ -30,17 +30,13 @@ class PaymentDetailsObserver public function saving(Details $model): void { - if ($model->isDirty('info') && $model->status !== null) { - $model->status = $this->statusToEnum($model->info->status); + if ($model->isDirty('info') && $status = $model->info->status) { + $model->status = $model->parent->cashboxDriver()->statuses()->detect($status); } } public function saved(Details $model): void { - if ($model->isClean()) { - return; - } - if ($model->wasChanged('status')) { $this->updateStatus($model->parent, $model->status); } @@ -54,7 +50,7 @@ protected function updateStatus(Model $payment, StatusEnum $status): void $payment->update([$field => $value]); } - protected function statusToEnum(mixed $status): StatusEnum + protected function statusToEnum(mixed $status): ?StatusEnum { return static::payment()->status->toEnum($status); } diff --git a/src/Core/src/Observers/PaymentObserver.php b/src/Core/src/Observers/PaymentObserver.php index 7ca0cd7e..e92840b5 100644 --- a/src/Core/src/Observers/PaymentObserver.php +++ b/src/Core/src/Observers/PaymentObserver.php @@ -33,6 +33,7 @@ class PaymentObserver public function creating(Model $payment): void { + // Collision elimination when creating a model using the default value from the database. $payment->status = static::payment()->status->new; } diff --git a/src/Core/src/Providers/RateLimiterServiceProvider.php b/src/Core/src/Providers/RateLimiterServiceProvider.php index 5412981d..407e5709 100644 --- a/src/Core/src/Providers/RateLimiterServiceProvider.php +++ b/src/Core/src/Providers/RateLimiterServiceProvider.php @@ -56,12 +56,15 @@ protected function bootEnableLimit(): void }); } + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment + * + * @return bool + */ protected function isToday(Model $payment): bool { - $date = $payment->getAttribute( - static::attribute()->createdAt - ); - - return static::carbon($date)->isToday(); + return static::carbon( + $payment->cashboxAttributeCreatedAt() + )->isToday(); } } diff --git a/src/Core/src/Resources/Resource.php b/src/Core/src/Resources/Resource.php index 68da2d46..fe3f85aa 100644 --- a/src/Core/src/Resources/Resource.php +++ b/src/Core/src/Resources/Resource.php @@ -4,14 +4,14 @@ namespace Cashbox\Core\Resources; -use Cashbox\Core\Concerns\Config\Payment\Attributes; use Cashbox\Core\Enums\CurrencyEnum; use Illuminate\Database\Eloquent\Model; +/** + * @property Model|\Cashbox\Core\Billable $payment + */ abstract class Resource { - use Attributes; - protected CurrencyEnum $currency = CurrencyEnum::USD; abstract public function currency(): CurrencyEnum; @@ -29,8 +29,6 @@ public function paymentId(): string public function status(): mixed { - return $this->payment->getAttribute( - static::attribute()->status - ); + return $this->payment->cashboxAttributeStatus(); } } diff --git a/src/Core/src/Services/Authorize.php b/src/Core/src/Services/Authorize.php index 061a9e8c..67ee7ebc 100644 --- a/src/Core/src/Services/Authorize.php +++ b/src/Core/src/Services/Authorize.php @@ -17,16 +17,13 @@ namespace Cashbox\Core\Services; -use Cashbox\Core\Concerns\Config\Payment\Attributes; use Cashbox\Core\Concerns\Config\Payment\Statuses; -use Cashbox\Core\Concerns\Transformers\EnumsTransformer; use Cashbox\Core\Facades\Config; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Arr; class Authorize { - use Attributes; - use EnumsTransformer; use Statuses; public static function type(Model $payment): bool @@ -55,16 +52,32 @@ public static function toRefund(Model $payment): bool && static::hasDetails($payment); } + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment + * + * @return bool + */ protected static function acceptType(Model $payment): bool { - return in_array(static::paymentType($payment), static::paymentTypes(), true); + return in_array($payment->cashboxAttributeType(), static::paymentTypes(), true); } - protected static function acceptStatus(Model $payment, array|int|string $statuses): bool + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment + * @param mixed $statuses + * + * @return bool + */ + protected static function acceptStatus(Model $payment, mixed $statuses): bool { - return in_array(static::paymentStatus($payment), (array) $statuses, true); + return in_array($payment->cashboxAttributeStatus(), Arr::wrap($statuses), true); } + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment + * + * @return bool + */ protected static function hasDetails(Model $payment): bool { return ! empty($payment->cashbox); @@ -77,20 +90,6 @@ protected static function doesntHaveDetails(Model $payment): bool protected static function paymentTypes(): array { - return array_keys( - Config::payment()->drivers - ); - } - - protected static function paymentType(Model $payment): int|string - { - return static::transformFromEnum( - $payment->getAttribute(static::attribute()->type) - ); - } - - protected static function paymentStatus(Model $payment): mixed - { - return $payment->getAttribute(static::attribute()->status); + return Config::payment()->drivers; } } diff --git a/src/Core/src/Services/Driver.php b/src/Core/src/Services/Driver.php index c2b34a11..3d6b519b 100644 --- a/src/Core/src/Services/Driver.php +++ b/src/Core/src/Services/Driver.php @@ -17,6 +17,7 @@ namespace Cashbox\Core\Services; +use Cashbox\Core\Concerns\Repositories\Registry; use Cashbox\Core\Data\Config\DriverData; use Cashbox\Core\Http\Response; use Cashbox\Core\Resources\Resource; @@ -24,6 +25,8 @@ abstract class Driver { + use Registry; + protected string $statuses; protected string $exception; @@ -39,21 +42,21 @@ abstract public function verify(): Response; public function __construct( protected Model $payment, protected readonly DriverData $data, - protected readonly Http $http + protected readonly Http $http = new Http() ) {} public function statuses(): Statuses { - return resolve($this->statuses, [$this->payment]); + return $this->resolve($this->statuses, $this->payment); } protected function request(string $request): Response { - $data = $this->resolve($request, 'make', $this->resource()); + $data = $this->call($request, 'make', $this->resource()); $content = $this->http->send($data, $this->resolveException()); - return $this->resolve($this->response, 'from', $content); + return $this->call($this->response, 'from', $content); } protected function resource(): Resource @@ -68,7 +71,7 @@ protected function resolveException(): Exception return resolve($this->exception); } - protected function resolve(string $class, string $method, mixed ...$parameters): object + protected function call(string $class, string $method, mixed ...$parameters): object { return call_user_func([$class, $method], ...$parameters); } diff --git a/src/Core/src/Services/DriverManager.php b/src/Core/src/Services/DriverManager.php index 78e51269..4e0837b2 100644 --- a/src/Core/src/Services/DriverManager.php +++ b/src/Core/src/Services/DriverManager.php @@ -19,24 +19,26 @@ use Cashbox\Core\Concerns\Config\Payment\Drivers; use Cashbox\Core\Concerns\Helpers\Validatable; +use Cashbox\Core\Concerns\Repositories\Registry; use Cashbox\Core\Data\Config\DriverData; use Illuminate\Database\Eloquent\Model; class DriverManager { use Drivers; + use Registry; use Validatable; public static function find(Model $payment): Driver { - static::validateModel($payment); - return static::call(static::data($payment), $payment); } protected static function call(DriverData $data, Model $payment): Driver { - return resolve($data->driver, compact('payment', 'data')); + $driver = $data->driver; + + return new $driver($payment, $data); } protected static function data(Model $payment): ?DriverData diff --git a/src/Core/src/Services/Http.php b/src/Core/src/Services/Http.php index bda62731..2ac23f2a 100644 --- a/src/Core/src/Services/Http.php +++ b/src/Core/src/Services/Http.php @@ -40,29 +40,32 @@ public function send(Request $request, Exception $exception): array $request->uri(), $request->headers(), $request->options(), - $request->body(), - $exception + $request->body() ); static::log($request, $response); + $this->throwIf($response, $exception); + return $response->json(); } - protected function request(string $uri, array $headers, array $options, array $data, Exception $exception): Response + protected function request(string $uri, array $headers, array $options, array $data): Response { - return Client::withHeaders($headers) - ->retry($this->tries, $this->sleep) + return Client::retry($this->tries, $this->sleep) + ->withHeaders($headers) ->withOptions($options) ->acceptJson() ->asJson() - ->post($uri, $data) - ->onError( - fn (Response $instance) => $exception->throw( - (string) $instance->effectiveUri(), - $instance->status(), - $instance->json() - ) - ); + ->post($uri, $data); + } + + protected function throwIf(Response $response, Exception $exception): void + { + $exception->throw( + (string) $response->effectiveUri(), + $response->status(), + $response->json() + ); } } diff --git a/src/Core/src/Services/Statuses.php b/src/Core/src/Services/Statuses.php index 4e50c1e7..36afc0cd 100644 --- a/src/Core/src/Services/Statuses.php +++ b/src/Core/src/Services/Statuses.php @@ -17,16 +17,17 @@ namespace Cashbox\Core\Services; -use Cashbox\Core\Concerns\Config\Payment\Attributes; use Cashbox\Core\Concerns\Config\Payment\Payments; use Cashbox\Core\Enums\StatusEnum; use DragonCode\Support\Facades\Helpers\Arr; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Str; +/** + * @property Model|\Cashbox\Core\Billable $payment + */ abstract class Statuses { - use Attributes; use Payments; public const FAILED = []; @@ -90,9 +91,21 @@ public function inProgress(?StatusEnum $status = null): bool && ! $this->isRefunded($status); } - protected function hasCashbox(array|string $statuses, ?StatusEnum $status): bool + public function detect(string $status): ?StatusEnum + { + return match (true) { + Str::contains($status, static::NEW) => StatusEnum::new, + Str::contains($status, static::SUCCESS) => StatusEnum::success, + Str::contains($status, static::REFUNDING) => StatusEnum::waitRefund, + Str::contains($status, static::REFUNDED) => StatusEnum::refund, + Str::contains($status, static::FAILED) => StatusEnum::failed, + default => null + }; + } + + protected function hasCashbox(array $statuses, ?StatusEnum $status): bool { - $status ??= $this->cashboxStatus(); + $status ??= $this->payment->cashbox?->status; return $this->has($status, $statuses); } @@ -112,31 +125,11 @@ protected function has(?StatusEnum $needle, array $haystack): bool return false; } - return in_array($this->resolveStatus($needle), $this->resolveStatus($haystack), true); + return in_array($needle, $this->resolveStatuses($haystack), true); } - protected function cashboxStatus(): ?StatusEnum + protected function resolveStatuses(mixed $statuses): array { - if ($status = $this->payment->cashbox?->details?->getStatus()) { - return StatusEnum::tryFrom($status); - } - - return null; - } - - protected function modelStatus(): mixed - { - return $this->payment->getAttribute( - static::attribute()->status - ); - } - - protected function resolveStatus(mixed $status): mixed - { - if (is_array($status)) { - return array_map(fn (mixed $value) => $this->resolveStatus($value), $status); - } - - return is_string($status) ? Str::lower($status) : $status; + return array_map(fn (string $status) => $this->detect($status), $statuses); } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 7b248789..f8bb9ccd 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -47,7 +47,7 @@ protected function getEnvironmentSetUp($app): void $app['config']->set('cashbox.payment.status.' . StatusEnum::refund(), TestStatusEnum::refund); $app['config']->set('cashbox.payment.status.' . StatusEnum::failed(), TestStatusEnum::failed); - $app['config']->set('cashbox.payment.drivers.' . TypeEnum::cash(), TypeEnum::cash()); + $app['config']->set('cashbox.payment.drivers.' . TypeEnum::cash(), TypeEnum::cash); $app['config']->set('cashbox.drivers.' . TypeEnum::cash(), [ 'driver' => Driver::class, From e417ce7f39e7c84f2b8cd5a3368522f161b9b416 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 12:44:32 +0300 Subject: [PATCH 059/164] Removed running parallel tests due to the impossibility of debugging them in phpStorm --- .run/parallel.run.xml | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 .run/parallel.run.xml diff --git a/.run/parallel.run.xml b/.run/parallel.run.xml deleted file mode 100644 index a8a7b35d..00000000 --- a/.run/parallel.run.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - \ No newline at end of file From 14939565e8398c31eca4aeddcc13ad03ec32cb24 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 12:44:44 +0300 Subject: [PATCH 060/164] Test fixed --- tests/Unit/Core/Facades/ConfigTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 35441379..8b0c08b8 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -48,7 +48,7 @@ expect($data->drivers)->toBeArray(); expect($data->drivers)->toBe([ - TypeEnum::cash() => TypeEnum::cash(), + TypeEnum::cash() => TypeEnum::cash, ]); }); From 09c91bbdda714c724797ed6980247b9e03ac0ba9 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 13:09:27 +0300 Subject: [PATCH 061/164] Fixed tests --- tests/Pest.php | 16 +++++++++++--- tests/Unit/Drivers/Cash/CreatedTest.php | 7 ++---- tests/Unit/Drivers/Outside/CreatedTest.php | 7 ++---- tests/Unit/Drivers/Outside/FailedTest.php | 9 +++----- tests/Unit/Drivers/Outside/RefundTest.php | 25 ++++++++-------------- tests/Unit/Drivers/Outside/VerifyTest.php | 9 +++----- 6 files changed, 32 insertions(+), 41 deletions(-) diff --git a/tests/Pest.php b/tests/Pest.php index daebc726..51503505 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -48,9 +48,19 @@ | */ -//expect()->extend('toBeOne', function () { -// return $this->toBe(1); -//}); +function assertHasCashbox(PaymentModel $payment): void +{ + expect(true)->toBeTrue( + $payment->cashbox()->exists() + ); +} + +function assertDoesntHaveCashbox(PaymentModel $payment): void +{ + expect(true)->toBeTrue( + $payment->cashbox()->doesntExist() + ); +} /* |-------------------------------------------------------------------------- diff --git a/tests/Unit/Drivers/Cash/CreatedTest.php b/tests/Unit/Drivers/Cash/CreatedTest.php index 21580912..ee427015 100644 --- a/tests/Unit/Drivers/Cash/CreatedTest.php +++ b/tests/Unit/Drivers/Cash/CreatedTest.php @@ -19,15 +19,12 @@ it('checks the create', function () { fakes(); - expect(paymentTable()->count())->toBe(0); + $payment = createPayment(TypeEnum::cash); - $payment = createPayment(TypeEnum::cash)->refresh(); - - expect($payment->price)->toBeInt(); expect($payment->type)->toBe(TypeEnum::cash); expect($payment->status)->toBe(StatusEnum::new); - expect(paymentTable()->count())->toBe(1); + assertHasCashbox($payment); Event::assertDispatched(CreatedEvent::class); Event::assertNotDispatched(FailedEvent::class); diff --git a/tests/Unit/Drivers/Outside/CreatedTest.php b/tests/Unit/Drivers/Outside/CreatedTest.php index 783a4c19..1928d879 100644 --- a/tests/Unit/Drivers/Outside/CreatedTest.php +++ b/tests/Unit/Drivers/Outside/CreatedTest.php @@ -18,15 +18,12 @@ it('checks the create', function () { fakes(); - expect(paymentTable()->count())->toBe(0); + $payment = createPayment(TypeEnum::outside); - $payment = createPayment(TypeEnum::outside)->refresh(); - - expect($payment->price)->toBeInt(); expect($payment->type)->toBe(TypeEnum::outside); expect($payment->status)->toBe(StatusEnum::new); - expect(paymentTable()->count())->toBe(1); + assertDoesntHaveCashbox($payment); Event::assertNotDispatched(CreatedEvent::class); Event::assertNotDispatched(FailedEvent::class); diff --git a/tests/Unit/Drivers/Outside/FailedTest.php b/tests/Unit/Drivers/Outside/FailedTest.php index 565b8c54..910b4ded 100644 --- a/tests/Unit/Drivers/Outside/FailedTest.php +++ b/tests/Unit/Drivers/Outside/FailedTest.php @@ -18,19 +18,16 @@ it('checks the failed', function () { fakes(); - expect(paymentTable()->count())->toBe(0); + $payment = createPayment(TypeEnum::outside); - $payment = createPayment(TypeEnum::outside)->refresh(); - - expect($payment->price)->toBeInt(); expect($payment->type)->toBe(TypeEnum::outside); expect($payment->status)->toBe(StatusEnum::new); $payment->update(['status' => StatusEnum::failed]); - expect($payment->refresh()->status)->toBe(StatusEnum::failed); + expect($payment->status)->toBe(StatusEnum::failed); - expect(paymentTable()->count())->toBe(1); + assertDoesntHaveCashbox($payment); Event::assertNotDispatched(CreatedEvent::class); Event::assertNotDispatched(FailedEvent::class); diff --git a/tests/Unit/Drivers/Outside/RefundTest.php b/tests/Unit/Drivers/Outside/RefundTest.php index da6f96b7..9dc8f022 100644 --- a/tests/Unit/Drivers/Outside/RefundTest.php +++ b/tests/Unit/Drivers/Outside/RefundTest.php @@ -18,23 +18,20 @@ it('checks the wait to refund', function () { fakes(); - expect(paymentTable()->count())->toBe(0); + $payment = createPayment(TypeEnum::outside); - $payment = createPayment(TypeEnum::outside)->refresh(); - - expect($payment->price)->toBeInt(); expect($payment->type)->toBe(TypeEnum::outside); expect($payment->status)->toBe(StatusEnum::new); $payment->update(['status' => StatusEnum::waitRefund]); - expect($payment->refresh()->status)->toBe(StatusEnum::waitRefund); - expect(paymentTable()->count())->toBe(1); + expect($payment->status)->toBe(StatusEnum::waitRefund); $payment->update(['status' => StatusEnum::refund]); - expect($payment->refresh()->status)->toBe(StatusEnum::refund); - expect(paymentTable()->count())->toBe(1); + expect($payment->status)->toBe(StatusEnum::refund); + + assertDoesntHaveCashbox($payment); Event::assertNotDispatched(CreatedEvent::class); Event::assertNotDispatched(FailedEvent::class); @@ -48,22 +45,18 @@ }); it('checks the refund', function () { - Event::fake(); - Queue::fake(); - - expect(paymentTable()->count())->toBe(0); + fakes(); - $payment = createPayment(TypeEnum::outside)->refresh(); + $payment = createPayment(TypeEnum::outside); - expect($payment->price)->toBeInt(); expect($payment->type)->toBe(TypeEnum::outside); expect($payment->status)->toBe(StatusEnum::new); $payment->update(['status' => StatusEnum::refund]); - expect($payment->refresh()->status)->toBe(StatusEnum::refund); + expect($payment->status)->toBe(StatusEnum::refund); - expect(paymentTable()->count())->toBe(1); + assertDoesntHaveCashbox($payment); Event::assertNotDispatched(CreatedEvent::class); Event::assertNotDispatched(FailedEvent::class); diff --git a/tests/Unit/Drivers/Outside/VerifyTest.php b/tests/Unit/Drivers/Outside/VerifyTest.php index 7631c811..c62bcaba 100644 --- a/tests/Unit/Drivers/Outside/VerifyTest.php +++ b/tests/Unit/Drivers/Outside/VerifyTest.php @@ -18,19 +18,16 @@ it('checks the verify', function () { fakes(); - expect(paymentTable()->count())->toBe(0); + $payment = createPayment(TypeEnum::outside); - $payment = createPayment(TypeEnum::outside)->refresh(); - - expect($payment->price)->toBeInt(); expect($payment->type)->toBe(TypeEnum::outside); expect($payment->status)->toBe(StatusEnum::new); $payment->update(['status' => StatusEnum::failed]); - expect($payment->refresh()->status)->toBe(StatusEnum::failed); + expect($payment->status)->toBe(StatusEnum::failed); - expect(paymentTable()->count())->toBe(1); + assertDoesntHaveCashbox($payment); Event::assertNotDispatched(CreatedEvent::class); Event::assertNotDispatched(FailedEvent::class); From 6c6bfd9c51931fe005fab87c253ef633569f99ce Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 14:02:15 +0300 Subject: [PATCH 062/164] Fixed a bug in migrations --- .../private/2021_05_26_133447_create_cashier_details_table.php | 2 +- .../2021_09_10_115126_create_cashier_increment_field.php | 2 +- ...617_change_cashier_details_table_add_operation_id_column.php | 2 +- .../private/2023_06_22_004000_drop_cashier_logs_table.php | 2 +- .../2023_07_08_172343_cashier_details_drop_morph_column.php | 2 +- .../2023_07_08_195624_cashier_details_rename_details_column.php | 2 +- .../2023_07_08_223554_cashier_details_create_status_column.php | 2 +- ...023_07_14_201238_rename_cashier_details_table_to_cashbox.php | 2 +- ...021_06_25_205531_change_payments_table_add_cashier_index.php | 2 +- .../2021_10_14_172234_change_payments_table_optimize_index.php | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php b/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php index eefe38d3..961a02ee 100644 --- a/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php +++ b/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php @@ -18,7 +18,7 @@ use Cashbox\Core\Concerns\Migrations\PrivateMigration; use Illuminate\Database\Schema\Blueprint; -new class extends PrivateMigration { +return new class extends PrivateMigration { public function up(): void { $this->connection()->create($this->table(), function (Blueprint $table) { diff --git a/src/Core/database/migrations/private/2021_09_10_115126_create_cashier_increment_field.php b/src/Core/database/migrations/private/2021_09_10_115126_create_cashier_increment_field.php index 5d551eca..b1012dd6 100644 --- a/src/Core/database/migrations/private/2021_09_10_115126_create_cashier_increment_field.php +++ b/src/Core/database/migrations/private/2021_09_10_115126_create_cashier_increment_field.php @@ -18,7 +18,7 @@ use Cashbox\Core\Concerns\Migrations\PrivateMigration; use Illuminate\Database\Schema\Blueprint; -new class extends PrivateMigration { +return new class extends PrivateMigration { public function up(): void { $this->connection()->table($this->table(), function (Blueprint $table) { diff --git a/src/Core/database/migrations/private/2021_10_12_125617_change_cashier_details_table_add_operation_id_column.php b/src/Core/database/migrations/private/2021_10_12_125617_change_cashier_details_table_add_operation_id_column.php index b9508116..75ca462b 100644 --- a/src/Core/database/migrations/private/2021_10_12_125617_change_cashier_details_table_add_operation_id_column.php +++ b/src/Core/database/migrations/private/2021_10_12_125617_change_cashier_details_table_add_operation_id_column.php @@ -18,7 +18,7 @@ use Cashbox\Core\Concerns\Migrations\PrivateMigration; use Illuminate\Database\Schema\Blueprint; -new class extends PrivateMigration { +return new class extends PrivateMigration { public function up(): void { $this->connection()->table($this->table(), function (Blueprint $table) { diff --git a/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php b/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php index e38cc1eb..c0b8322f 100644 --- a/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php +++ b/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php @@ -19,7 +19,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; -new class extends PrivateMigration { +return new class extends PrivateMigration { public function up(): void { $this->dropSchema(); diff --git a/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php b/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php index 2bd144cd..9ed5e0cd 100644 --- a/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php +++ b/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php @@ -19,7 +19,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\DB; -new class extends PrivateMigration { +return new class extends PrivateMigration { public function up(): void { $this->createColumn('payment_id', 'item_id'); diff --git a/src/Core/database/migrations/private/2023_07_08_195624_cashier_details_rename_details_column.php b/src/Core/database/migrations/private/2023_07_08_195624_cashier_details_rename_details_column.php index db0bd7c0..cc70295b 100644 --- a/src/Core/database/migrations/private/2023_07_08_195624_cashier_details_rename_details_column.php +++ b/src/Core/database/migrations/private/2023_07_08_195624_cashier_details_rename_details_column.php @@ -18,7 +18,7 @@ use Cashbox\Core\Concerns\Migrations\PrivateMigration; use Illuminate\Database\Schema\Blueprint; -new class extends PrivateMigration { +return new class extends PrivateMigration { public function up(): void { $this->connection()->table($this->table(), function (Blueprint $table) { diff --git a/src/Core/database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php b/src/Core/database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php index dfcb791a..0a794a0c 100644 --- a/src/Core/database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php +++ b/src/Core/database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php @@ -18,7 +18,7 @@ use Cashbox\Core\Concerns\Migrations\PrivateMigration; use Illuminate\Database\Schema\Blueprint; -new class extends PrivateMigration { +return new class extends PrivateMigration { public function up(): void { $this->connection()->table($this->table(), function (Blueprint $table) { diff --git a/src/Core/database/migrations/private/2023_07_14_201238_rename_cashier_details_table_to_cashbox.php b/src/Core/database/migrations/private/2023_07_14_201238_rename_cashier_details_table_to_cashbox.php index cea7a570..3aae70d3 100644 --- a/src/Core/database/migrations/private/2023_07_14_201238_rename_cashier_details_table_to_cashbox.php +++ b/src/Core/database/migrations/private/2023_07_14_201238_rename_cashier_details_table_to_cashbox.php @@ -4,7 +4,7 @@ use Cashbox\Core\Concerns\Migrations\PrivateMigration; -new class extends PrivateMigration { +return new class extends PrivateMigration { public function up(): void { if ($this->doesntSame() && $this->exists()) { diff --git a/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php b/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php index 96acef6a..78bd0e88 100644 --- a/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php +++ b/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php @@ -18,7 +18,7 @@ use Cashbox\Core\Concerns\Migrations\PublicMigration; use Illuminate\Database\Schema\Blueprint; -new class extends PublicMigration { +return new class extends PublicMigration { public function up(): void { $this->connection()->table($this->table(), function (Blueprint $table) { diff --git a/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php b/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php index 87506086..9908abc8 100644 --- a/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php +++ b/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php @@ -18,7 +18,7 @@ use Cashbox\Core\Concerns\Migrations\PublicMigration; use Illuminate\Database\Schema\Blueprint; -new class extends PublicMigration { +return new class extends PublicMigration { public function up(): void { $this->connection()->table($this->table(), function (Blueprint $table) { From e3e4412e5b5e76a6abe1b9a8f5abd9917e63e23b Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 14:02:57 +0300 Subject: [PATCH 063/164] Added a check before activating the mechanism for publishing internal files --- src/Core/src/Providers/ServiceProvider.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Core/src/Providers/ServiceProvider.php b/src/Core/src/Providers/ServiceProvider.php index 6d2c8ba4..44af27f4 100644 --- a/src/Core/src/Providers/ServiceProvider.php +++ b/src/Core/src/Providers/ServiceProvider.php @@ -36,6 +36,10 @@ public function register(): void protected function bootPublishes(): void { + if (! $this->app->runningInConsole()) { + return; + } + $this->publishes([ __DIR__ . '/../../config/cashbox.php' => $this->app->configPath('cashbox.php'), ], 'config'); From 6f72da9cd283a1fca9e5f3c179dad64194f9d403 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 14:03:13 +0300 Subject: [PATCH 064/164] Removed unnecessary service provider --- tests/Fixtures/Providers/TestServiceProvider.php | 15 --------------- tests/TestCase.php | 7 +++++-- 2 files changed, 5 insertions(+), 17 deletions(-) delete mode 100644 tests/Fixtures/Providers/TestServiceProvider.php diff --git a/tests/Fixtures/Providers/TestServiceProvider.php b/tests/Fixtures/Providers/TestServiceProvider.php deleted file mode 100644 index 5b4a6d91..00000000 --- a/tests/Fixtures/Providers/TestServiceProvider.php +++ /dev/null @@ -1,15 +0,0 @@ -loadMigrationsFrom(__DIR__ . '/../database/migrations'); - } -} diff --git a/tests/TestCase.php b/tests/TestCase.php index f8bb9ccd..e3f50cf1 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -16,7 +16,6 @@ use Tests\Fixtures\App\Enums\TypeEnum; use Tests\Fixtures\App\Models\PaymentModel; use Tests\Fixtures\Drivers\Cash\Payments\Cash; -use Tests\Fixtures\Providers\TestServiceProvider; abstract class TestCase extends BaseTestCase { @@ -26,7 +25,6 @@ protected function getPackageProviders($app): array { return [ LaravelDataServiceProvider::class, - TestServiceProvider::class, ServiceProvider::class, BindingServiceProvider::class, ObserverServiceProvider::class, @@ -54,4 +52,9 @@ protected function getEnvironmentSetUp($app): void 'resource' => Cash::class, ]); } + + protected function defineDatabaseMigrations(): void + { + $this->loadMigrationsFrom(__DIR__ . '/database'); + } } From 7b54b31d697400ea1cec549b9e6221684e3d905a Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 14:03:38 +0300 Subject: [PATCH 065/164] Test migrations moved to common test namespace --- .../2023_07_14_022222_create_payments_model.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/{Fixtures/database/migrations => database}/2023_07_14_022222_create_payments_model.php (100%) diff --git a/tests/Fixtures/database/migrations/2023_07_14_022222_create_payments_model.php b/tests/database/2023_07_14_022222_create_payments_model.php similarity index 100% rename from tests/Fixtures/database/migrations/2023_07_14_022222_create_payments_model.php rename to tests/database/2023_07_14_022222_create_payments_model.php From 3254c8f3afe50c0fdf098e34d13a07c9e8ae5f61 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 14:13:36 +0300 Subject: [PATCH 066/164] `.env` file added to git exceptions --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 5fd8d71f..12c0efc7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ vendor/ http-client.private.env.json +.env + *.bak *.cache *.clover From 8640f9af051e48fdad00d6ba153a02951528bc9c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 14:14:08 +0300 Subject: [PATCH 067/164] Fixed check for the existence of a model for payments when initializing the application --- src/Core/src/Providers/BaseProvider.php | 9 ++++++++- src/Core/src/Providers/BindingServiceProvider.php | 7 +++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Core/src/Providers/BaseProvider.php b/src/Core/src/Providers/BaseProvider.php index 5744b06b..35d6d38a 100644 --- a/src/Core/src/Providers/BaseProvider.php +++ b/src/Core/src/Providers/BaseProvider.php @@ -28,6 +28,13 @@ abstract class BaseProvider extends BaseServiceProvider protected function disabled(): bool { - return ! class_exists(static::payment()->model); + $class = $this->model(); + + return empty($class) || ! class_exists($class); + } + + protected function model(): ?string + { + return config('cashbox.payment.model'); } } diff --git a/src/Core/src/Providers/BindingServiceProvider.php b/src/Core/src/Providers/BindingServiceProvider.php index 8480cd0f..26e350e6 100644 --- a/src/Core/src/Providers/BindingServiceProvider.php +++ b/src/Core/src/Providers/BindingServiceProvider.php @@ -6,12 +6,15 @@ use Cashbox\Core\Data\Config\ConfigData; use Cashbox\Core\Exceptions\Internal\ConfigCannotBeEmptyException; -use Illuminate\Support\ServiceProvider as BaseServiceProvider; -class BindingServiceProvider extends BaseServiceProvider +class BindingServiceProvider extends BaseProvider { public function register(): void { + if ($this->disabled()) { + return; + } + $this->bindConfig(); } From dbd047c0b99d901cbd0c0a792e3054f61c58f48f Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 14:58:37 +0300 Subject: [PATCH 068/164] Fixed bug when initializing configuration --- src/Core/src/Providers/BindingServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/src/Providers/BindingServiceProvider.php b/src/Core/src/Providers/BindingServiceProvider.php index 26e350e6..f441ae55 100644 --- a/src/Core/src/Providers/BindingServiceProvider.php +++ b/src/Core/src/Providers/BindingServiceProvider.php @@ -9,7 +9,7 @@ class BindingServiceProvider extends BaseProvider { - public function register(): void + public function boot(): void { if ($this->disabled()) { return; From 38e5bf64e52cc10f6be911611f54ef29568b2a81 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 15:20:23 +0300 Subject: [PATCH 069/164] Migration optimization --- ...26_133447_create_cashier_details_table.php | 3 ++ ..._115126_create_cashier_increment_field.php | 28 ------------------- ..._details_table_add_operation_id_column.php | 28 ------------------- ...3_06_22_004000_drop_cashier_logs_table.php | 14 ---------- .../2023_07_16_145907_clearing_old_data.php | 21 ++++++++++++++ 5 files changed, 24 insertions(+), 70 deletions(-) delete mode 100644 src/Core/database/migrations/private/2021_09_10_115126_create_cashier_increment_field.php delete mode 100644 src/Core/database/migrations/private/2021_10_12_125617_change_cashier_details_table_add_operation_id_column.php create mode 100644 src/Core/database/migrations/private/2023_07_16_145907_clearing_old_data.php diff --git a/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php b/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php index 961a02ee..28d069c6 100644 --- a/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php +++ b/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php @@ -22,6 +22,8 @@ public function up(): void { $this->connection()->create($this->table(), function (Blueprint $table) { + $table->id(); + $table->string('item_type'); match ($this->primaryType()) { @@ -31,6 +33,7 @@ public function up(): void }; $table->string('external_id')->nullable(); + $table->string('operation_id')->nullable(); $table->json('details')->nullable(); diff --git a/src/Core/database/migrations/private/2021_09_10_115126_create_cashier_increment_field.php b/src/Core/database/migrations/private/2021_09_10_115126_create_cashier_increment_field.php deleted file mode 100644 index b1012dd6..00000000 --- a/src/Core/database/migrations/private/2021_09_10_115126_create_cashier_increment_field.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -use Cashbox\Core\Concerns\Migrations\PrivateMigration; -use Illuminate\Database\Schema\Blueprint; - -return new class extends PrivateMigration { - public function up(): void - { - $this->connection()->table($this->table(), function (Blueprint $table) { - $table->id()->first(); - }); - } -}; diff --git a/src/Core/database/migrations/private/2021_10_12_125617_change_cashier_details_table_add_operation_id_column.php b/src/Core/database/migrations/private/2021_10_12_125617_change_cashier_details_table_add_operation_id_column.php deleted file mode 100644 index 75ca462b..00000000 --- a/src/Core/database/migrations/private/2021_10_12_125617_change_cashier_details_table_add_operation_id_column.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -use Cashbox\Core\Concerns\Migrations\PrivateMigration; -use Illuminate\Database\Schema\Blueprint; - -return new class extends PrivateMigration { - public function up(): void - { - $this->connection()->table($this->table(), function (Blueprint $table) { - $table->string('operation_id')->nullable()->after('external_id'); - }); - } -}; diff --git a/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php b/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php index c0b8322f..e75ca9be 100644 --- a/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php +++ b/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php @@ -16,25 +16,11 @@ declare(strict_types=1); use Cashbox\Core\Concerns\Migrations\PrivateMigration; -use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends PrivateMigration { public function up(): void - { - $this->dropSchema(); - $this->cleanMigrations(); - } - - protected function dropSchema(): void { Schema::dropIfExists('cashier_logs'); } - - protected function cleanMigrations(): void - { - DB::table('migrations') - ->where('migration', '2021_09_10_120000_create_cashier_logs_table') - ->delete(); - } }; diff --git a/src/Core/database/migrations/private/2023_07_16_145907_clearing_old_data.php b/src/Core/database/migrations/private/2023_07_16_145907_clearing_old_data.php new file mode 100644 index 00000000..b8b03ff2 --- /dev/null +++ b/src/Core/database/migrations/private/2023_07_16_145907_clearing_old_data.php @@ -0,0 +1,21 @@ +whereIn('migration', $this->files) + ->delete(); + } +}; From 1fec12bf8dd796cf54d1450a8a364aea246276b4 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 15:20:53 +0300 Subject: [PATCH 070/164] Method name conflict issue fixed --- src/Core/src/Concerns/Config/Queue.php | 4 ++-- src/Core/src/Jobs/BaseJob.php | 4 ++-- src/Core/src/Services/Job.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Core/src/Concerns/Config/Queue.php b/src/Core/src/Concerns/Config/Queue.php index 9db205e1..e695b07b 100644 --- a/src/Core/src/Concerns/Config/Queue.php +++ b/src/Core/src/Concerns/Config/Queue.php @@ -27,7 +27,7 @@ trait Queue { use Drivers; - protected static function queue(): QueueData + protected static function queueConfig(): QueueData { return Config::queue(); } @@ -43,6 +43,6 @@ protected static function queueName(?Model $payment = null): QueueNameData return static::driverByModel($payment)->getQueue(); } - return static::queue()->name; + return static::queueConfig()->name; } } diff --git a/src/Core/src/Jobs/BaseJob.php b/src/Core/src/Jobs/BaseJob.php index d044bce3..bfd35ae9 100644 --- a/src/Core/src/Jobs/BaseJob.php +++ b/src/Core/src/Jobs/BaseJob.php @@ -53,8 +53,8 @@ public function __construct( public Model $payment, public bool $force = false ) { - $this->tries = static::queue()->tries; - $this->maxExceptions = static::queue()->exceptions; + $this->tries = static::queueConfig()->tries; + $this->maxExceptions = static::queueConfig()->exceptions; } public function handle(): void diff --git a/src/Core/src/Services/Job.php b/src/Core/src/Services/Job.php index b1a4e3fc..681e4564 100644 --- a/src/Core/src/Services/Job.php +++ b/src/Core/src/Services/Job.php @@ -88,7 +88,7 @@ public function force(bool $force = true): self protected function dispatch(string $job, ?string $queue, ?int $delay = null): void { dispatch(new $job($this->payment, $this->force)) - ->onConnection(static::queue()->connection) + ->onConnection(static::queueConfig()->connection) ->onQueue($queue) ->afterCommit() ->delay($delay); From 9819e6ffd7ae7f5efca48641f8675cf89be18d2c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 15:21:47 +0300 Subject: [PATCH 071/164] Added `doctrine/dbal` dependency --- composer.json | 1 + src/Core/composer.json | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 63e839f6..bd09859c 100644 --- a/composer.json +++ b/composer.json @@ -46,6 +46,7 @@ "php": "^8.1", "ext-json": "*", "archtechx/enums": "^0.3.2", + "doctrine/dbal": "^3.6", "dragon-code/contracts": "^2.20", "dragon-code/laravel-support": "^3.6", "dragon-code/simple-dto": "^2.7.1", diff --git a/src/Core/composer.json b/src/Core/composer.json index 23db224c..3f0410f7 100644 --- a/src/Core/composer.json +++ b/src/Core/composer.json @@ -43,8 +43,9 @@ "php": "^8.1", "ext-json": "*", "archtechx/enums": "^0.3.2", + "doctrine/dbal": "^3.6", "dragon-code/laravel-support": "^3.6", - "dragon-code/support": "^6.11.2", + "dragon-code/support": "^6.11.2", "guzzlehttp/guzzle": "^7.7", "illuminate/bus": "^10.15", "illuminate/console": "^10.15", From a847e2c152cc07e7cc67650adbdb2262c9e98177 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 15:22:04 +0300 Subject: [PATCH 072/164] Fixed error when getting driver configuration --- src/Core/src/Concerns/Config/Payment/Drivers.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Core/src/Concerns/Config/Payment/Drivers.php b/src/Core/src/Concerns/Config/Payment/Drivers.php index 8f41db79..3b4fe438 100644 --- a/src/Core/src/Concerns/Config/Payment/Drivers.php +++ b/src/Core/src/Concerns/Config/Payment/Drivers.php @@ -42,6 +42,12 @@ protected static function driver(int|string $name, Model $payment): DriverData */ protected static function driverByModel(Model $payment): DriverData { - return static::driver($payment->cashboxAttributeType(), $payment); + $type = $payment->cashboxAttributeType(); + + if ($name = array_search($type, Config::payment()->drivers)) { + return static::driver($name, $payment); + } + + throw new UnknownDriverConfigException($name, $payment->getKey()); } } From 276cb1a0d1765cdcdafd21f3eb7052aee3ee174c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 16:59:36 +0300 Subject: [PATCH 073/164] Cash payment driver ready to go --- composer.json | 20 ++++---- src/Cash/composer.json | 28 +++++------ src/Cash/src/Http/Requests/CreateRequest.php | 2 - src/Cash/src/Http/Requests/RefundRequest.php | 2 - src/Cash/src/Http/Requests/VerifyRequest.php | 2 - src/Cash/src/Http/Responses/Response.php | 18 ++++--- src/Core/composer.json | 18 +++---- src/Core/src/Billable.php | 7 +++ src/Core/src/Console/Commands/Command.php | 2 - src/Core/src/Console/Commands/Refund.php | 7 ++- src/Core/src/Console/Commands/Verify.php | 7 ++- src/Core/src/Http/Response.php | 11 +++-- src/Core/src/Jobs/BaseJob.php | 29 ++++++++---- src/Core/src/Jobs/StartJob.php | 6 +++ src/Core/src/Models/Details.php | 2 +- .../src/Observers/PaymentDetailsObserver.php | 33 ++++++++----- src/Core/src/Observers/PaymentObserver.php | 23 +++++++-- src/SberAuth/composer.json | 16 +++---- src/SberOnline/composer.json | 16 +++---- src/SberQrCode/composer.json | 16 +++---- src/TemplateDriver/composer.json | 16 +++---- src/TemplateDriverAuth/composer.json | 16 +++---- src/TinkoffAuth/composer.json | 16 +++---- src/TinkoffCredit/composer.json | 16 +++---- src/TinkoffOnline/composer.json | 16 +++---- src/TinkoffQrCode/composer.json | 16 +++---- tests/Pest.php | 14 +----- tests/Unit/Drivers/Cash/CreatedTest.php | 13 ++--- tests/Unit/Drivers/Cash/FailedTest.php | 7 --- tests/Unit/Drivers/Cash/RefundTest.php | 47 ++++++++++++++++++- tests/Unit/Drivers/Cash/VerifyTest.php | 40 +++++++++++++++- tests/Unit/Drivers/Outside/CreatedTest.php | 8 ---- tests/Unit/Drivers/Outside/FailedTest.php | 8 ---- tests/Unit/Drivers/Outside/RefundTest.php | 12 ----- tests/Unit/Drivers/Outside/VerifyTest.php | 8 ---- 35 files changed, 295 insertions(+), 223 deletions(-) delete mode 100644 tests/Unit/Drivers/Cash/FailedTest.php diff --git a/composer.json b/composer.json index bd09859c..7c2210fd 100644 --- a/composer.json +++ b/composer.json @@ -25,14 +25,6 @@ "source": "https://github.com/cashbox-laravel/foundation" }, "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "boosty", "url": "https://boosty.to/dragon-code" @@ -40,17 +32,24 @@ { "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" + }, + { + "type": "github", + "url": "https://github.com/sponsors/TheDragonCode" + }, + { + "type": "open_collective", + "url": "https://opencollective.com/dragon-code" } ], "require": { - "php": "^8.1", - "ext-json": "*", "archtechx/enums": "^0.3.2", "doctrine/dbal": "^3.6", "dragon-code/contracts": "^2.20", "dragon-code/laravel-support": "^3.6", "dragon-code/simple-dto": "^2.7.1", "dragon-code/support": "^6.11.2", + "ext-json": "*", "guzzlehttp/guzzle": "^7.7", "illuminate/bus": "^10.15", "illuminate/console": "^10.15", @@ -59,6 +58,7 @@ "illuminate/queue": "^10.15", "illuminate/support": "^10.15", "nesbot/carbon": "^2.68.1", + "php": "^8.1", "psr/http-message": "^2.0", "psr/log": "^3.0", "spatie/laravel-data": "^3.7", diff --git a/src/Cash/composer.json b/src/Cash/composer.json index ad32329a..2151df8f 100644 --- a/src/Cash/composer.json +++ b/src/Cash/composer.json @@ -4,10 +4,11 @@ "license": "MIT", "type": "library", "keywords": [ - "bank", "billing", + "cash", "cashier", - "cash" + "payment", + "payments" ], "authors": [ { @@ -21,14 +22,6 @@ "source": "https://github.com/cashbox-laravel/foundation" }, "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "boosty", "url": "https://boosty.to/dragon-code" @@ -36,12 +29,19 @@ { "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" + }, + { + "type": "github", + "url": "https://github.com/sponsors/TheDragonCode" + }, + { + "type": "open_collective", + "url": "https://opencollective.com/dragon-code" } ], "require": { "php": "^8.1", - "cashbox/core": "^2.5 || ^3.0", - "psr/http-message": "^2.0" + "cashbox/core": "^4.0" }, "minimum-stability": "stable", "prefer-stable": true, @@ -68,10 +68,6 @@ { "name": "cashbox/core", "url": "https://github.com/cashbox-laravel/core" - }, - { - "name": "psr/http-message", - "url": "https://github.com/php-fig/http-message" } ], "title": "Cash Driver" diff --git a/src/Cash/src/Http/Requests/CreateRequest.php b/src/Cash/src/Http/Requests/CreateRequest.php index 547a0a33..bc4ea030 100644 --- a/src/Cash/src/Http/Requests/CreateRequest.php +++ b/src/Cash/src/Http/Requests/CreateRequest.php @@ -24,8 +24,6 @@ class CreateRequest extends Request public function body(): array { return [ - 'external_id' => $this->resource->paymentId(), - 'status' => 'NEW', ]; } diff --git a/src/Cash/src/Http/Requests/RefundRequest.php b/src/Cash/src/Http/Requests/RefundRequest.php index 7830f258..d7921304 100644 --- a/src/Cash/src/Http/Requests/RefundRequest.php +++ b/src/Cash/src/Http/Requests/RefundRequest.php @@ -24,8 +24,6 @@ class RefundRequest extends Request public function body(): array { return [ - 'external_id' => $this->resource->paymentId(), - 'status' => 'REFUNDED', ]; } diff --git a/src/Cash/src/Http/Requests/VerifyRequest.php b/src/Cash/src/Http/Requests/VerifyRequest.php index 86544185..acefb1b5 100644 --- a/src/Cash/src/Http/Requests/VerifyRequest.php +++ b/src/Cash/src/Http/Requests/VerifyRequest.php @@ -24,8 +24,6 @@ class VerifyRequest extends Request public function body(): array { return [ - 'external_id' => $this->resource->paymentId(), - 'status' => 'PAID', ]; } diff --git a/src/Cash/src/Http/Responses/Response.php b/src/Cash/src/Http/Responses/Response.php index 9fd24f87..1ed08e4e 100644 --- a/src/Cash/src/Http/Responses/Response.php +++ b/src/Cash/src/Http/Responses/Response.php @@ -18,23 +18,29 @@ namespace Cashbox\Cash\Http\Responses; use Cashbox\Core\Concerns\Helpers\Identifiers; +use Cashbox\Core\Data\Models\InfoData; use Cashbox\Core\Http\Response as BaseData; +use Spatie\LaravelData\Attributes\MapName; +use Spatie\LaravelData\Mappers\SnakeCaseMapper; +#[MapName(SnakeCaseMapper::class)] class Response extends BaseData { use Identifiers; public ?string $status; - public int|string $paymentId; - - public function getExternalId(): ?string + public function getOperationId(): ?string { - return $this->paymentId; + return static::uuid(); } - public function getOperationId(): ?string + public function getInfo(): InfoData { - return static::uuid(); + return InfoData::from([ + 'externalId' => $this->getExternalId(), + 'operationId' => $this->getOperationId(), + 'status' => $this->status, + ]); } } diff --git a/src/Core/composer.json b/src/Core/composer.json index 3f0410f7..e0f9630a 100644 --- a/src/Core/composer.json +++ b/src/Core/composer.json @@ -22,14 +22,6 @@ "source": "https://github.com/cashbox-laravel/foundation" }, "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "boosty", "url": "https://boosty.to/dragon-code" @@ -37,6 +29,14 @@ { "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" + }, + { + "type": "github", + "url": "https://github.com/sponsors/TheDragonCode" + }, + { + "type": "open_collective", + "url": "https://opencollective.com/dragon-code" } ], "require": { @@ -45,7 +45,7 @@ "archtechx/enums": "^0.3.2", "doctrine/dbal": "^3.6", "dragon-code/laravel-support": "^3.6", - "dragon-code/support": "^6.11.2", + "dragon-code/support": "^6.11.2", "guzzlehttp/guzzle": "^7.7", "illuminate/bus": "^10.15", "illuminate/console": "^10.15", diff --git a/src/Core/src/Billable.php b/src/Core/src/Billable.php index 0c3a15f2..81881e5f 100644 --- a/src/Core/src/Billable.php +++ b/src/Core/src/Billable.php @@ -18,6 +18,7 @@ namespace Cashbox\Core; use Cashbox\Core\Concerns\Config\Payment\Attributes; +use Cashbox\Core\Concerns\Helpers\Jobs; use Cashbox\Core\Concerns\Repositories\Registry; use Cashbox\Core\Models\Details; use Cashbox\Core\Services\Driver; @@ -31,6 +32,7 @@ trait Billable { use Attributes; + use Jobs; use Registry; protected ?Driver $cashboxDriver = null; @@ -49,6 +51,11 @@ public function cashboxDriver(): Driver return $this->cashboxDriver = DriverManager::find($this); } + public function cashboxJob(bool $force = false): Services\Job + { + return static::job($this, $force); + } + public function cashboxAttributeType(): mixed { return $this->getAttribute( diff --git a/src/Core/src/Console/Commands/Command.php b/src/Core/src/Console/Commands/Command.php index 69d71fe3..e55e863f 100644 --- a/src/Core/src/Console/Commands/Command.php +++ b/src/Core/src/Console/Commands/Command.php @@ -21,7 +21,6 @@ use Cashbox\Core\Concerns\Config\Payment\Drivers; use Cashbox\Core\Concerns\Config\Payment\Payments; use Cashbox\Core\Concerns\Config\Payment\Statuses; -use Cashbox\Core\Concerns\Helpers\Jobs; use Closure; use DragonCode\LaravelSupport\Traits\InitModelHelper; use Illuminate\Console\Command as BaseCommand; @@ -35,7 +34,6 @@ abstract class Command extends BaseCommand use Attributes; use Drivers; use InitModelHelper; - use Jobs; use Payments; use Statuses; diff --git a/src/Core/src/Console/Commands/Refund.php b/src/Core/src/Console/Commands/Refund.php index 0c595510..3096c258 100644 --- a/src/Core/src/Console/Commands/Refund.php +++ b/src/Core/src/Console/Commands/Refund.php @@ -32,8 +32,13 @@ protected function getStatuses(): array return static::statuses()->toRefund(); } + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment + * + * @return void + */ protected function process(Model $payment): void { - static::job($payment, $this->hasForce())->refund(); + $payment->cashboxJob($this->hasForce())->refund(); } } diff --git a/src/Core/src/Console/Commands/Verify.php b/src/Core/src/Console/Commands/Verify.php index b3362969..98c52087 100644 --- a/src/Core/src/Console/Commands/Verify.php +++ b/src/Core/src/Console/Commands/Verify.php @@ -32,8 +32,13 @@ protected function getStatuses(): array return static::statuses()->inProgress(); } + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment + * + * @return void + */ protected function process(Model $payment): void { - static::job($payment, $this->hasForce())->verify(); + $payment->cashboxJob($this->hasForce())->verify(); } } diff --git a/src/Core/src/Http/Response.php b/src/Core/src/Http/Response.php index 08f81aa6..b121e43c 100644 --- a/src/Core/src/Http/Response.php +++ b/src/Core/src/Http/Response.php @@ -17,18 +17,21 @@ namespace Cashbox\Core\Http; +use Cashbox\Core\Data\Models\InfoData; use DragonCode\Support\Facades\Helpers\Arr; -use Spatie\LaravelData\Attributes\MapName; use Spatie\LaravelData\Data; -use Spatie\LaravelData\Mappers\SnakeCaseMapper; -#[MapName(SnakeCaseMapper::class)] abstract class Response extends Data { - abstract public function getExternalId(): ?string; + abstract public function getInfo(): InfoData; abstract public function getOperationId(): ?string; + public function getExternalId(): ?string + { + return null; + } + public function isEmpty(): bool { return Arr::of($this->toArray()) diff --git a/src/Core/src/Jobs/BaseJob.php b/src/Core/src/Jobs/BaseJob.php index bfd35ae9..55f43830 100644 --- a/src/Core/src/Jobs/BaseJob.php +++ b/src/Core/src/Jobs/BaseJob.php @@ -67,15 +67,8 @@ public function handle(): void return; } - $data = [ - 'external_id' => $response->getExternalId(), - 'operation_id' => $response->getOperationId(), - 'info' => $response, - ]; - - $this->payment->cashbox - ? $this->payment->cashbox->update($data) - : $this->payment->cashbox()->create($data); + $this->updateParent($this->prepareData($response)); + $this->finish(); } public function uniqueId(): int|string @@ -88,6 +81,24 @@ public function middleware(): array return [new RateLimitedWithRedis($this->getRateLimiter())]; } + protected function prepareData(Response $response): array + { + return [ + 'external_id' => $response->getExternalId(), + 'operation_id' => $response->getOperationId(), + 'info' => $response->getInfo(), + ]; + } + + protected function updateParent(array $data): void + { + $this->payment->cashbox + ? $this->payment->cashbox->update($data) + : $this->payment->cashbox()->create($data); + } + + protected function finish(): void {} + protected function driver(): Driver { return $this->payment->cashboxDriver(); diff --git a/src/Core/src/Jobs/StartJob.php b/src/Core/src/Jobs/StartJob.php index b2be1a55..42de3212 100644 --- a/src/Core/src/Jobs/StartJob.php +++ b/src/Core/src/Jobs/StartJob.php @@ -25,4 +25,10 @@ protected function request(): Response { return $this->driver()->start(); } + + protected function finish(): void + { + $this->payment->refresh(); + $this->payment->cashboxJob(true)->verify(); + } } diff --git a/src/Core/src/Models/Details.php b/src/Core/src/Models/Details.php index adb0821a..7fad3baa 100644 --- a/src/Core/src/Models/Details.php +++ b/src/Core/src/Models/Details.php @@ -67,6 +67,6 @@ public function parent(): Relation $key = $this->model()->primaryKey($payment); - return $this->belongsTo($payment, $key, 'payment_id'); + return $this->belongsTo($payment, 'payment_id', $key); } } diff --git a/src/Core/src/Observers/PaymentDetailsObserver.php b/src/Core/src/Observers/PaymentDetailsObserver.php index d9db93b5..e3d88d2f 100644 --- a/src/Core/src/Observers/PaymentDetailsObserver.php +++ b/src/Core/src/Observers/PaymentDetailsObserver.php @@ -19,6 +19,7 @@ use Cashbox\Core\Concerns\Config\Payment\Attributes; use Cashbox\Core\Concerns\Config\Payment\Payments; +use Cashbox\Core\Concerns\Events\Notifiable; use Cashbox\Core\Enums\StatusEnum; use Cashbox\Core\Models\Details; use Illuminate\Database\Eloquent\Model; @@ -26,8 +27,16 @@ class PaymentDetailsObserver { use Attributes; + use Notifiable; use Payments; + public function created(Details $model): void + { + if ($model->status === StatusEnum::new) { + static::event($model->parent, StatusEnum::new); + } + } + public function saving(Details $model): void { if ($model->isDirty('info') && $status = $model->info->status) { @@ -37,21 +46,23 @@ public function saving(Details $model): void public function saved(Details $model): void { - if ($model->wasChanged('status')) { - $this->updateStatus($model->parent, $model->status); - } + $this->updateStatus($model->parent, $model->status); } + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment + * @param \Cashbox\Core\Enums\StatusEnum $status + * + * @return void + */ protected function updateStatus(Model $payment, StatusEnum $status): void { - $value = static::payment()->status->fromEnum($status); - $field = static::attribute()->status; + $value = static::payment()->status->fromEnum($status); + $field = static::attribute()->status; + $current = $payment->cashboxAttributeStatus(); - $payment->update([$field => $value]); - } - - protected function statusToEnum(mixed $status): ?StatusEnum - { - return static::payment()->status->toEnum($status); + if ($current !== $value) { + $payment->update([$field => $value]); + } } } diff --git a/src/Core/src/Observers/PaymentObserver.php b/src/Core/src/Observers/PaymentObserver.php index e92840b5..a88d1ffd 100644 --- a/src/Core/src/Observers/PaymentObserver.php +++ b/src/Core/src/Observers/PaymentObserver.php @@ -19,7 +19,6 @@ use Cashbox\Core\Concerns\Config\Payment\Attributes; use Cashbox\Core\Concerns\Events\Notifiable; -use Cashbox\Core\Concerns\Helpers\Jobs; use Cashbox\Core\Concerns\Permissions\Allowable; use DragonCode\Support\Facades\Helpers\Arr; use Illuminate\Database\Eloquent\Model; @@ -28,7 +27,6 @@ class PaymentObserver { use Allowable; use Attributes; - use Jobs; use Notifiable; public function creating(Model $payment): void @@ -37,13 +35,23 @@ public function creating(Model $payment): void $payment->status = static::payment()->status->new; } + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment + * + * @return void + */ public function created(Model $payment): void { if ($this->authorizeType($payment)) { - static::job($payment)->start(); + $payment->cashboxJob()->start(); } } + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment + * + * @return void + */ public function updated(Model $payment): void { if (! $this->authorizeType($payment)) { @@ -51,7 +59,7 @@ public function updated(Model $payment): void } if ($this->wasChanged($payment)) { - static::job($payment)->verify(); + $payment->cashboxJob()->verify(); } if ($this->wasChangedStatus($payment)) { @@ -59,10 +67,15 @@ public function updated(Model $payment): void } } + /** + * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment + * + * @return void + */ public function restored(Model $payment): void { if ($this->authorizeType($payment)) { - static::job($payment)->retry(); + $payment->cashboxJob(true)->retry(); } } diff --git a/src/SberAuth/composer.json b/src/SberAuth/composer.json index c1528056..5181be5e 100644 --- a/src/SberAuth/composer.json +++ b/src/SberAuth/composer.json @@ -24,14 +24,6 @@ "source": "https://github.com/cashbox-laravel/foundation" }, "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "boosty", "url": "https://boosty.to/dragon-code" @@ -39,6 +31,14 @@ { "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" + }, + { + "type": "github", + "url": "https://github.com/sponsors/TheDragonCode" + }, + { + "type": "open_collective", + "url": "https://opencollective.com/dragon-code" } ], "require": { diff --git a/src/SberOnline/composer.json b/src/SberOnline/composer.json index f25bf331..d12ccfca 100644 --- a/src/SberOnline/composer.json +++ b/src/SberOnline/composer.json @@ -21,14 +21,6 @@ "source": "https://github.com/cashbox-laravel/foundation" }, "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "boosty", "url": "https://boosty.to/dragon-code" @@ -36,6 +28,14 @@ { "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" + }, + { + "type": "github", + "url": "https://github.com/sponsors/TheDragonCode" + }, + { + "type": "open_collective", + "url": "https://opencollective.com/dragon-code" } ], "require": { diff --git a/src/SberQrCode/composer.json b/src/SberQrCode/composer.json index 99268262..acd653ed 100644 --- a/src/SberQrCode/composer.json +++ b/src/SberQrCode/composer.json @@ -24,14 +24,6 @@ "source": "https://github.com/cashbox-laravel/foundation" }, "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "boosty", "url": "https://boosty.to/dragon-code" @@ -39,6 +31,14 @@ { "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" + }, + { + "type": "github", + "url": "https://github.com/sponsors/TheDragonCode" + }, + { + "type": "open_collective", + "url": "https://opencollective.com/dragon-code" } ], "require": { diff --git a/src/TemplateDriver/composer.json b/src/TemplateDriver/composer.json index 7a3fd257..9b3440c9 100644 --- a/src/TemplateDriver/composer.json +++ b/src/TemplateDriver/composer.json @@ -21,14 +21,6 @@ "source": "https://github.com/cashbox-laravel/foundation" }, "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "boosty", "url": "https://boosty.to/dragon-code" @@ -36,6 +28,14 @@ { "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" + }, + { + "type": "github", + "url": "https://github.com/sponsors/TheDragonCode" + }, + { + "type": "open_collective", + "url": "https://opencollective.com/dragon-code" } ], "require": { diff --git a/src/TemplateDriverAuth/composer.json b/src/TemplateDriverAuth/composer.json index 38726d97..5cf9b621 100644 --- a/src/TemplateDriverAuth/composer.json +++ b/src/TemplateDriverAuth/composer.json @@ -21,14 +21,6 @@ "source": "https://github.com/cashbox-laravel/foundation" }, "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "boosty", "url": "https://boosty.to/dragon-code" @@ -36,6 +28,14 @@ { "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" + }, + { + "type": "github", + "url": "https://github.com/sponsors/TheDragonCode" + }, + { + "type": "open_collective", + "url": "https://opencollective.com/dragon-code" } ], "require": { diff --git a/src/TinkoffAuth/composer.json b/src/TinkoffAuth/composer.json index c2b6a373..5e3e85c3 100644 --- a/src/TinkoffAuth/composer.json +++ b/src/TinkoffAuth/composer.json @@ -23,14 +23,6 @@ "source": "https://github.com/cashbox-laravel/foundation" }, "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "boosty", "url": "https://boosty.to/dragon-code" @@ -38,6 +30,14 @@ { "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" + }, + { + "type": "github", + "url": "https://github.com/sponsors/TheDragonCode" + }, + { + "type": "open_collective", + "url": "https://opencollective.com/dragon-code" } ], "require": { diff --git a/src/TinkoffCredit/composer.json b/src/TinkoffCredit/composer.json index e945bcfb..28f61416 100644 --- a/src/TinkoffCredit/composer.json +++ b/src/TinkoffCredit/composer.json @@ -22,14 +22,6 @@ "source": "https://github.com/cashbox-laravel/foundation" }, "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "boosty", "url": "https://boosty.to/dragon-code" @@ -37,6 +29,14 @@ { "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" + }, + { + "type": "github", + "url": "https://github.com/sponsors/TheDragonCode" + }, + { + "type": "open_collective", + "url": "https://opencollective.com/dragon-code" } ], "require": { diff --git a/src/TinkoffOnline/composer.json b/src/TinkoffOnline/composer.json index 7beae123..1ebabe6a 100644 --- a/src/TinkoffOnline/composer.json +++ b/src/TinkoffOnline/composer.json @@ -26,14 +26,6 @@ "source": "https://github.com/cashbox-laravel/foundation" }, "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "boosty", "url": "https://boosty.to/dragon-code" @@ -41,6 +33,14 @@ { "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" + }, + { + "type": "github", + "url": "https://github.com/sponsors/TheDragonCode" + }, + { + "type": "open_collective", + "url": "https://opencollective.com/dragon-code" } ], "require": { diff --git a/src/TinkoffQrCode/composer.json b/src/TinkoffQrCode/composer.json index 1b1b67b6..a597af16 100644 --- a/src/TinkoffQrCode/composer.json +++ b/src/TinkoffQrCode/composer.json @@ -25,14 +25,6 @@ "source": "https://github.com/cashbox-laravel/foundation" }, "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "boosty", "url": "https://boosty.to/dragon-code" @@ -40,6 +32,14 @@ { "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" + }, + { + "type": "github", + "url": "https://github.com/sponsors/TheDragonCode" + }, + { + "type": "open_collective", + "url": "https://opencollective.com/dragon-code" } ], "require": { diff --git a/tests/Pest.php b/tests/Pest.php index 51503505..89aa1c68 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -7,16 +7,12 @@ use Cashbox\Core\Events\SuccessEvent; use Cashbox\Core\Events\WaitRefundEvent; use Cashbox\Core\Facades\Config; -use Cashbox\Core\Jobs\RefundJob; -use Cashbox\Core\Jobs\StartJob; -use Cashbox\Core\Jobs\VerifyJob; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Facade; use Illuminate\Support\Facades\Http; -use Illuminate\Support\Facades\Queue; use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Support\DataProperty; use Tests\Fixtures\App\Enums\TypeEnum; @@ -115,7 +111,7 @@ function dataCast(Cast|string $cast, mixed $value, ?DataProperty $property = nul return $cast->cast($property, $value, $context); } -function fakes(bool $events = true, bool $queue = true, bool $http = true): void +function fakes(bool $events = true, bool $http = true): void { if ($events) { Event::fake([ @@ -127,14 +123,6 @@ function fakes(bool $events = true, bool $queue = true, bool $http = true): void ]); } - if ($queue) { - Queue::fake([ - StartJob::class, - VerifyJob::class, - RefundJob::class, - ]); - } - if ($http) { Http::fake(); } diff --git a/tests/Unit/Drivers/Cash/CreatedTest.php b/tests/Unit/Drivers/Cash/CreatedTest.php index ee427015..4090b51a 100644 --- a/tests/Unit/Drivers/Cash/CreatedTest.php +++ b/tests/Unit/Drivers/Cash/CreatedTest.php @@ -7,12 +7,8 @@ use Cashbox\Core\Events\RefundedEvent; use Cashbox\Core\Events\SuccessEvent; use Cashbox\Core\Events\WaitRefundEvent; -use Cashbox\Core\Jobs\RefundJob; -use Cashbox\Core\Jobs\StartJob; -use Cashbox\Core\Jobs\VerifyJob; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Http; -use Illuminate\Support\Facades\Queue; use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; @@ -26,15 +22,12 @@ assertHasCashbox($payment); - Event::assertDispatched(CreatedEvent::class); + Event::assertDispatchedTimes(CreatedEvent::class); + Event::assertDispatchedTimes(SuccessEvent::class); + Event::assertNotDispatched(FailedEvent::class); Event::assertNotDispatched(RefundedEvent::class); - Event::assertNotDispatched(SuccessEvent::class); Event::assertNotDispatched(WaitRefundEvent::class); - Queue::assertPushed(StartJob::class); - Queue::assertNotPushed(VerifyJob::class); - Queue::assertNotPushed(RefundJob::class); - Http::assertNothingSent(); }); diff --git a/tests/Unit/Drivers/Cash/FailedTest.php b/tests/Unit/Drivers/Cash/FailedTest.php deleted file mode 100644 index 0485940b..00000000 --- a/tests/Unit/Drivers/Cash/FailedTest.php +++ /dev/null @@ -1,7 +0,0 @@ -toBeTrue(); -}); diff --git a/tests/Unit/Drivers/Cash/RefundTest.php b/tests/Unit/Drivers/Cash/RefundTest.php index 0485940b..108bb4f7 100644 --- a/tests/Unit/Drivers/Cash/RefundTest.php +++ b/tests/Unit/Drivers/Cash/RefundTest.php @@ -2,6 +2,49 @@ declare(strict_types=1); -it('some', function () { - expect(true)->toBeTrue(); +use Cashbox\Core\Events\CreatedEvent; +use Cashbox\Core\Events\FailedEvent; +use Cashbox\Core\Events\RefundedEvent; +use Cashbox\Core\Events\SuccessEvent; +use Cashbox\Core\Events\WaitRefundEvent; +use Illuminate\Support\Facades\Event; +use Illuminate\Support\Facades\Http; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; + +it('checks the verify', function () { + fakes(); + + $payment = createPayment(TypeEnum::cash); + + expect($payment->type)->toBe(TypeEnum::cash); + expect($payment->status)->toBe(StatusEnum::new); + + assertHasCashbox($payment); + + // verify + $payment->refresh()->updateQuietly([ + 'status' => StatusEnum::new, + ]); + + $payment->cashboxJob()->verify(); + + $payment->refresh(); + expect($payment->status)->toBe(StatusEnum::success); + + // refund + $payment->refresh(); + $payment->cashboxJob()->refund(); + + $payment->refresh(); + expect($payment->status)->toBe(StatusEnum::refund); + + Event::assertDispatchedTimes(CreatedEvent::class); + Event::assertDispatchedTimes(SuccessEvent::class, 2); + Event::assertDispatchedTimes(RefundedEvent::class); + + Event::assertNotDispatched(FailedEvent::class); + Event::assertNotDispatched(WaitRefundEvent::class); + + Http::assertNothingSent(); }); diff --git a/tests/Unit/Drivers/Cash/VerifyTest.php b/tests/Unit/Drivers/Cash/VerifyTest.php index 0485940b..74001026 100644 --- a/tests/Unit/Drivers/Cash/VerifyTest.php +++ b/tests/Unit/Drivers/Cash/VerifyTest.php @@ -2,6 +2,42 @@ declare(strict_types=1); -it('some', function () { - expect(true)->toBeTrue(); +use Cashbox\Core\Events\CreatedEvent; +use Cashbox\Core\Events\FailedEvent; +use Cashbox\Core\Events\RefundedEvent; +use Cashbox\Core\Events\SuccessEvent; +use Cashbox\Core\Events\WaitRefundEvent; +use Illuminate\Support\Facades\Event; +use Illuminate\Support\Facades\Http; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; + +it('checks the verify', function () { + fakes(); + + $payment = createPayment(TypeEnum::cash); + + expect($payment->type)->toBe(TypeEnum::cash); + expect($payment->status)->toBe(StatusEnum::new); + + assertHasCashbox($payment); + + // verify + $payment->refresh()->updateQuietly([ + 'status' => StatusEnum::new, + ]); + + $payment->cashboxJob()->verify(); + + $payment->refresh(); + expect($payment->status)->toBe(StatusEnum::success); + + Event::assertDispatchedTimes(CreatedEvent::class); + Event::assertDispatchedTimes(SuccessEvent::class, 2); + + Event::assertNotDispatched(FailedEvent::class); + Event::assertNotDispatched(RefundedEvent::class); + Event::assertNotDispatched(WaitRefundEvent::class); + + Http::assertNothingSent(); }); diff --git a/tests/Unit/Drivers/Outside/CreatedTest.php b/tests/Unit/Drivers/Outside/CreatedTest.php index 1928d879..c1373155 100644 --- a/tests/Unit/Drivers/Outside/CreatedTest.php +++ b/tests/Unit/Drivers/Outside/CreatedTest.php @@ -7,11 +7,7 @@ use Cashbox\Core\Events\RefundedEvent; use Cashbox\Core\Events\SuccessEvent; use Cashbox\Core\Events\WaitRefundEvent; -use Cashbox\Core\Jobs\RefundJob; -use Cashbox\Core\Jobs\StartJob; -use Cashbox\Core\Jobs\VerifyJob; use Illuminate\Support\Facades\Event; -use Illuminate\Support\Facades\Queue; use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; @@ -30,8 +26,4 @@ Event::assertNotDispatched(RefundedEvent::class); Event::assertNotDispatched(SuccessEvent::class); Event::assertNotDispatched(WaitRefundEvent::class); - - Queue::assertNotPushed(StartJob::class); - Queue::assertNotPushed(VerifyJob::class); - Queue::assertNotPushed(RefundJob::class); }); diff --git a/tests/Unit/Drivers/Outside/FailedTest.php b/tests/Unit/Drivers/Outside/FailedTest.php index 910b4ded..b999082e 100644 --- a/tests/Unit/Drivers/Outside/FailedTest.php +++ b/tests/Unit/Drivers/Outside/FailedTest.php @@ -7,11 +7,7 @@ use Cashbox\Core\Events\RefundedEvent; use Cashbox\Core\Events\SuccessEvent; use Cashbox\Core\Events\WaitRefundEvent; -use Cashbox\Core\Jobs\RefundJob; -use Cashbox\Core\Jobs\StartJob; -use Cashbox\Core\Jobs\VerifyJob; use Illuminate\Support\Facades\Event; -use Illuminate\Support\Facades\Queue; use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; @@ -34,8 +30,4 @@ Event::assertNotDispatched(RefundedEvent::class); Event::assertNotDispatched(SuccessEvent::class); Event::assertNotDispatched(WaitRefundEvent::class); - - Queue::assertNotPushed(StartJob::class); - Queue::assertNotPushed(VerifyJob::class); - Queue::assertNotPushed(RefundJob::class); }); diff --git a/tests/Unit/Drivers/Outside/RefundTest.php b/tests/Unit/Drivers/Outside/RefundTest.php index 9dc8f022..99338826 100644 --- a/tests/Unit/Drivers/Outside/RefundTest.php +++ b/tests/Unit/Drivers/Outside/RefundTest.php @@ -7,11 +7,7 @@ use Cashbox\Core\Events\RefundedEvent; use Cashbox\Core\Events\SuccessEvent; use Cashbox\Core\Events\WaitRefundEvent; -use Cashbox\Core\Jobs\RefundJob; -use Cashbox\Core\Jobs\StartJob; -use Cashbox\Core\Jobs\VerifyJob; use Illuminate\Support\Facades\Event; -use Illuminate\Support\Facades\Queue; use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; @@ -38,10 +34,6 @@ Event::assertNotDispatched(RefundedEvent::class); Event::assertNotDispatched(SuccessEvent::class); Event::assertNotDispatched(WaitRefundEvent::class); - - Queue::assertNotPushed(StartJob::class); - Queue::assertNotPushed(VerifyJob::class); - Queue::assertNotPushed(RefundJob::class); }); it('checks the refund', function () { @@ -63,8 +55,4 @@ Event::assertNotDispatched(RefundedEvent::class); Event::assertNotDispatched(SuccessEvent::class); Event::assertNotDispatched(WaitRefundEvent::class); - - Queue::assertNotPushed(StartJob::class); - Queue::assertNotPushed(VerifyJob::class); - Queue::assertNotPushed(RefundJob::class); }); diff --git a/tests/Unit/Drivers/Outside/VerifyTest.php b/tests/Unit/Drivers/Outside/VerifyTest.php index c62bcaba..2452742a 100644 --- a/tests/Unit/Drivers/Outside/VerifyTest.php +++ b/tests/Unit/Drivers/Outside/VerifyTest.php @@ -7,11 +7,7 @@ use Cashbox\Core\Events\RefundedEvent; use Cashbox\Core\Events\SuccessEvent; use Cashbox\Core\Events\WaitRefundEvent; -use Cashbox\Core\Jobs\RefundJob; -use Cashbox\Core\Jobs\StartJob; -use Cashbox\Core\Jobs\VerifyJob; use Illuminate\Support\Facades\Event; -use Illuminate\Support\Facades\Queue; use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; @@ -34,8 +30,4 @@ Event::assertNotDispatched(RefundedEvent::class); Event::assertNotDispatched(SuccessEvent::class); Event::assertNotDispatched(WaitRefundEvent::class); - - Queue::assertNotPushed(StartJob::class); - Queue::assertNotPushed(VerifyJob::class); - Queue::assertNotPushed(RefundJob::class); }); From 97830e1d904888370a839cf0604275e73e710862 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 17:00:00 +0300 Subject: [PATCH 074/164] Fixed code-style --- app/Commands/Composer.php | 2 +- src/Cash/src/Exceptions/Exception.php | 2 +- src/Cash/src/Resources/CashResource.php | 4 +--- src/Core/src/Concerns/Config/Payment/Drivers.php | 2 -- src/Core/src/Concerns/Config/Queue.php | 2 -- src/Core/src/Concerns/Enums/From.php | 6 +++--- src/Core/src/Concerns/Events/Notifiable.php | 2 -- src/Core/src/Concerns/Transformers/EnumsTransformer.php | 2 +- src/Core/src/Console/Commands/Refund.php | 2 -- src/Core/src/Console/Commands/Verify.php | 2 -- src/Core/src/Observers/PaymentDetailsObserver.php | 3 --- src/Core/src/Observers/PaymentObserver.php | 6 ------ src/Core/src/Providers/RateLimiterServiceProvider.php | 2 -- src/Core/src/Services/Authorize.php | 7 ------- src/Core/src/Services/Driver.php | 3 ++- tests/Unit/Core/Facades/ConfigTest.php | 8 ++++---- 16 files changed, 13 insertions(+), 42 deletions(-) diff --git a/app/Commands/Composer.php b/app/Commands/Composer.php index 92600b4e..1fd20829 100644 --- a/app/Commands/Composer.php +++ b/app/Commands/Composer.php @@ -103,7 +103,7 @@ protected function copyToDriverIntersect(&$array, string $key): void protected function copyToMain($array, string $key): void { - $main = Arr::get($this->main, $key); + $main = Arr::get($this->main, $key); $driver = Arr::get($array, $key); $items = Arr::of($driver) diff --git a/src/Cash/src/Exceptions/Exception.php b/src/Cash/src/Exceptions/Exception.php index 51b59436..5e8d1bda 100644 --- a/src/Cash/src/Exceptions/Exception.php +++ b/src/Cash/src/Exceptions/Exception.php @@ -19,4 +19,4 @@ use Cashbox\Core\Services\Exception as BaseException; -class Exception extends BaseException { } +class Exception extends BaseException {} diff --git a/src/Cash/src/Resources/CashResource.php b/src/Cash/src/Resources/CashResource.php index 00a1521d..d08595d3 100644 --- a/src/Cash/src/Resources/CashResource.php +++ b/src/Cash/src/Resources/CashResource.php @@ -6,6 +6,4 @@ use Cashbox\Core\Resources\Resource; -abstract class CashResource extends Resource -{ -} +abstract class CashResource extends Resource {} diff --git a/src/Core/src/Concerns/Config/Payment/Drivers.php b/src/Core/src/Concerns/Config/Payment/Drivers.php index 3b4fe438..c46b1d67 100644 --- a/src/Core/src/Concerns/Config/Payment/Drivers.php +++ b/src/Core/src/Concerns/Config/Payment/Drivers.php @@ -37,8 +37,6 @@ protected static function driver(int|string $name, Model $payment): DriverData * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment * * @throws \Cashbox\Core\Exceptions\Internal\UnknownDriverConfigException - * - * @return \Cashbox\Core\Data\Config\DriverData */ protected static function driverByModel(Model $payment): DriverData { diff --git a/src/Core/src/Concerns/Config/Queue.php b/src/Core/src/Concerns/Config/Queue.php index e695b07b..74797477 100644 --- a/src/Core/src/Concerns/Config/Queue.php +++ b/src/Core/src/Concerns/Config/Queue.php @@ -34,8 +34,6 @@ protected static function queueConfig(): QueueData /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable|null $payment - * - * @return \Cashbox\Core\Data\Config\Queue\QueueNameData */ protected static function queueName(?Model $payment = null): QueueNameData { diff --git a/src/Core/src/Concerns/Enums/From.php b/src/Core/src/Concerns/Enums/From.php index 40c5b71a..5a82e863 100644 --- a/src/Core/src/Concerns/Enums/From.php +++ b/src/Core/src/Concerns/Enums/From.php @@ -32,7 +32,7 @@ public static function from(int|string $value): static throw new OutOfBoundsException($value); } - public static function tryFrom(int|string|BackedEnum $value): ?static + public static function tryFrom(BackedEnum|int|string $value): ?static { if ($value instanceof static) { return $value; @@ -55,7 +55,7 @@ protected static function prepareName(int|string $name): string return Str::lower((string) $name); } - protected function resolveName(int|string|BackedEnum $item): string + protected function resolveName(BackedEnum|int|string $item): string { if ($item instanceof BackedEnum) { return $item->name; @@ -64,7 +64,7 @@ protected function resolveName(int|string|BackedEnum $item): string return (string) $item; } - protected function resolveValue(int|string|BackedEnum $item): string + protected function resolveValue(BackedEnum|int|string $item): string { if ($item instanceof BackedEnum) { return $item->value; diff --git a/src/Core/src/Concerns/Events/Notifiable.php b/src/Core/src/Concerns/Events/Notifiable.php index 638e4e24..6b915f8f 100644 --- a/src/Core/src/Concerns/Events/Notifiable.php +++ b/src/Core/src/Concerns/Events/Notifiable.php @@ -48,8 +48,6 @@ protected static function eventWithDetect(Model $payment): void /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment - * - * @return \Cashbox\Core\Enums\StatusEnum */ protected static function detectEvent(Model $payment): StatusEnum { diff --git a/src/Core/src/Concerns/Transformers/EnumsTransformer.php b/src/Core/src/Concerns/Transformers/EnumsTransformer.php index eae74c9b..092ac5ca 100644 --- a/src/Core/src/Concerns/Transformers/EnumsTransformer.php +++ b/src/Core/src/Concerns/Transformers/EnumsTransformer.php @@ -21,7 +21,7 @@ trait EnumsTransformer { - protected static function transformFromEnum(int|string|BackedEnum $item): int|string + protected static function transformFromEnum(BackedEnum|int|string $item): int|string { if ($item instanceof BackedEnum) { return $item->value ?? $item->name; diff --git a/src/Core/src/Console/Commands/Refund.php b/src/Core/src/Console/Commands/Refund.php index 3096c258..e9d299a3 100644 --- a/src/Core/src/Console/Commands/Refund.php +++ b/src/Core/src/Console/Commands/Refund.php @@ -34,8 +34,6 @@ protected function getStatuses(): array /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment - * - * @return void */ protected function process(Model $payment): void { diff --git a/src/Core/src/Console/Commands/Verify.php b/src/Core/src/Console/Commands/Verify.php index 98c52087..bf238bcc 100644 --- a/src/Core/src/Console/Commands/Verify.php +++ b/src/Core/src/Console/Commands/Verify.php @@ -34,8 +34,6 @@ protected function getStatuses(): array /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment - * - * @return void */ protected function process(Model $payment): void { diff --git a/src/Core/src/Observers/PaymentDetailsObserver.php b/src/Core/src/Observers/PaymentDetailsObserver.php index e3d88d2f..da3576f1 100644 --- a/src/Core/src/Observers/PaymentDetailsObserver.php +++ b/src/Core/src/Observers/PaymentDetailsObserver.php @@ -51,9 +51,6 @@ public function saved(Details $model): void /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment - * @param \Cashbox\Core\Enums\StatusEnum $status - * - * @return void */ protected function updateStatus(Model $payment, StatusEnum $status): void { diff --git a/src/Core/src/Observers/PaymentObserver.php b/src/Core/src/Observers/PaymentObserver.php index a88d1ffd..7c3e6452 100644 --- a/src/Core/src/Observers/PaymentObserver.php +++ b/src/Core/src/Observers/PaymentObserver.php @@ -37,8 +37,6 @@ public function creating(Model $payment): void /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment - * - * @return void */ public function created(Model $payment): void { @@ -49,8 +47,6 @@ public function created(Model $payment): void /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment - * - * @return void */ public function updated(Model $payment): void { @@ -69,8 +65,6 @@ public function updated(Model $payment): void /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment - * - * @return void */ public function restored(Model $payment): void { diff --git a/src/Core/src/Providers/RateLimiterServiceProvider.php b/src/Core/src/Providers/RateLimiterServiceProvider.php index 407e5709..c44dcdac 100644 --- a/src/Core/src/Providers/RateLimiterServiceProvider.php +++ b/src/Core/src/Providers/RateLimiterServiceProvider.php @@ -58,8 +58,6 @@ protected function bootEnableLimit(): void /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment - * - * @return bool */ protected function isToday(Model $payment): bool { diff --git a/src/Core/src/Services/Authorize.php b/src/Core/src/Services/Authorize.php index 67ee7ebc..ddef82d3 100644 --- a/src/Core/src/Services/Authorize.php +++ b/src/Core/src/Services/Authorize.php @@ -54,8 +54,6 @@ public static function toRefund(Model $payment): bool /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment - * - * @return bool */ protected static function acceptType(Model $payment): bool { @@ -64,9 +62,6 @@ protected static function acceptType(Model $payment): bool /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment - * @param mixed $statuses - * - * @return bool */ protected static function acceptStatus(Model $payment, mixed $statuses): bool { @@ -75,8 +70,6 @@ protected static function acceptStatus(Model $payment, mixed $statuses): bool /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment - * - * @return bool */ protected static function hasDetails(Model $payment): bool { diff --git a/src/Core/src/Services/Driver.php b/src/Core/src/Services/Driver.php index 3d6b519b..ba59e369 100644 --- a/src/Core/src/Services/Driver.php +++ b/src/Core/src/Services/Driver.php @@ -42,7 +42,8 @@ abstract public function verify(): Response; public function __construct( protected Model $payment, protected readonly DriverData $data, - protected readonly Http $http = new Http() + protected readonly Http $http = new Http( + ) ) {} public function statuses(): Statuses diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 8b0c08b8..621e7b3b 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -157,12 +157,12 @@ function (array $main, array $driver, array $expected) { expect($item->getQueue()->refund)->toBe($expected['refund']); } )->with([ - 'filled' => [ + 'filled' => [ driverData('q1', 'q2', 'q3'), driverData('q4', 'q5', 'q6'), driverData('q4', 'q5', 'q6'), ], - 'partial' => [ + 'partial' => [ driverData('q1', 'q2', 'q3'), driverData('q4', null, null), driverData('q4', null, null), @@ -172,12 +172,12 @@ function (array $main, array $driver, array $expected) { [], driverData(null, null, null), ], - 'main empty' => [ + 'main empty' => [ [], driverData('q4', 'q5', 'q6'), driverData('q4', 'q5', 'q6'), ], - 'full empty' => [ + 'full empty' => [ [], [], driverData(null, null, null), From 5fa6059eff51a386ad527c156964186ea4ff1cee Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 18:31:27 +0300 Subject: [PATCH 075/164] Added data hash test --- src/Cash/src/Http/Responses/Response.php | 8 +- src/Core/src/Data/Models/InfoData.php | 2 + src/Core/src/Data/Signing/Token.php | 17 +++++ src/Core/src/Http/Request.php | 2 +- src/Core/src/Http/Response.php | 25 ++++++- src/Core/src/Resources/Resource.php | 2 +- src/Core/src/Services/Driver.php | 7 +- src/Core/src/Services/Sign.php | 26 +++++++ src/TinkoffAuth/src/Auth.php | 74 ------------------- src/TinkoffAuth/src/Constants/Keys.php | 2 +- src/TinkoffAuth/src/Resources/AccessToken.php | 48 ------------ src/TinkoffAuth/src/Services/Hash.php | 57 ++++++++++++++ src/TinkoffAuth/src/Sign.php | 49 ++++++++++++ src/TinkoffAuth/src/Support/Hash.php | 73 ------------------ tests/Unit/TinkoffAuth/HashTest.php | 32 ++++++++ 15 files changed, 218 insertions(+), 206 deletions(-) create mode 100644 src/Core/src/Data/Signing/Token.php create mode 100644 src/Core/src/Services/Sign.php delete mode 100644 src/TinkoffAuth/src/Auth.php delete mode 100644 src/TinkoffAuth/src/Resources/AccessToken.php create mode 100644 src/TinkoffAuth/src/Services/Hash.php create mode 100644 src/TinkoffAuth/src/Sign.php delete mode 100644 src/TinkoffAuth/src/Support/Hash.php create mode 100644 tests/Unit/TinkoffAuth/HashTest.php diff --git a/src/Cash/src/Http/Responses/Response.php b/src/Cash/src/Http/Responses/Response.php index 1ed08e4e..d5f9e246 100644 --- a/src/Cash/src/Http/Responses/Response.php +++ b/src/Cash/src/Http/Responses/Response.php @@ -40,7 +40,13 @@ public function getInfo(): InfoData return InfoData::from([ 'externalId' => $this->getExternalId(), 'operationId' => $this->getOperationId(), - 'status' => $this->status, + 'status' => $this->getStatus(), + 'extra' => $this->getExtra(), ]); } + + protected function getStatus(): ?string + { + return $this->status; + } } diff --git a/src/Core/src/Data/Models/InfoData.php b/src/Core/src/Data/Models/InfoData.php index 359f1600..9f1514e5 100644 --- a/src/Core/src/Data/Models/InfoData.php +++ b/src/Core/src/Data/Models/InfoData.php @@ -20,6 +20,8 @@ class InfoData extends Data public ?string $status; + public ?array $extra; + public function toJson($options = 0): string { return parent::toJson($this->flags()); diff --git a/src/Core/src/Data/Signing/Token.php b/src/Core/src/Data/Signing/Token.php new file mode 100644 index 00000000..7373ea36 --- /dev/null +++ b/src/Core/src/Data/Signing/Token.php @@ -0,0 +1,17 @@ +toArray()) - ->filter(fn (mixed $value) => $value !== null) - ->isEmpty(); + return empty($this->filter($this->toArray())); + } + + public function transform( + bool $transformValues = true, + WrapExecutionType $wrapExecutionType = WrapExecutionType::Disabled, + bool $mapPropertyNames = true, + ): array { + return $this->filter( + parent::transform($transformValues, $wrapExecutionType, $mapPropertyNames) + ); + } + + protected function getExtra(): ?array + { + return null; + } + + protected function filter(array $items): array + { + return Arr::filter($items, fn (mixed $value) => $value !== null); } } diff --git a/src/Core/src/Resources/Resource.php b/src/Core/src/Resources/Resource.php index fe3f85aa..e2fd9031 100644 --- a/src/Core/src/Resources/Resource.php +++ b/src/Core/src/Resources/Resource.php @@ -19,7 +19,7 @@ abstract public function currency(): CurrencyEnum; abstract public function sum(): int; public function __construct( - protected Model $payment + public Model $payment ) {} public function paymentId(): string diff --git a/src/Core/src/Services/Driver.php b/src/Core/src/Services/Driver.php index ba59e369..a9862772 100644 --- a/src/Core/src/Services/Driver.php +++ b/src/Core/src/Services/Driver.php @@ -41,9 +41,8 @@ abstract public function verify(): Response; public function __construct( protected Model $payment, - protected readonly DriverData $data, - protected readonly Http $http = new Http( - ) + public readonly DriverData $config, + protected readonly Http $http = new Http() ) {} public function statuses(): Statuses @@ -62,7 +61,7 @@ protected function request(string $request): Response protected function resource(): Resource { - $resource = $this->data->resource; + $resource = $this->config->resource; return new $resource($this->payment); } diff --git a/src/Core/src/Services/Sign.php b/src/Core/src/Services/Sign.php new file mode 100644 index 00000000..3f1451aa --- /dev/null +++ b/src/Core/src/Services/Sign.php @@ -0,0 +1,26 @@ +request->headers(); + } + + public function body(): array + { + return $this->request->body(); + } +} diff --git a/src/TinkoffAuth/src/Auth.php b/src/TinkoffAuth/src/Auth.php deleted file mode 100644 index 65cc4646..00000000 --- a/src/TinkoffAuth/src/Auth.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Cashbox\Tinkoff\Auth; - -use Cashbox\Tinkoff\Auth\Constants\Keys; -use Cashbox\Tinkoff\Auth\Resources\AccessToken; -use Cashbox\Tinkoff\Auth\Support\Hash; -use DragonCode\Contracts\Cashier\Auth\Auth as AuthContract; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\Model; -use DragonCode\Support\Concerns\Makeable; - -/** @method static Auth make(Model $model, Request $request, bool $hash = true) */ -class Auth implements AuthContract -{ - use Makeable; - - /** @var \DragonCode\Contracts\Cashier\Resources\Model */ - protected $model; - - /** @var \DragonCode\Contracts\Cashier\Http\Request */ - protected $request; - - /** @var bool */ - protected $hash; - - public function __construct(Model $model, Request $request, bool $hash = true, array $extra = []) - { - $this->model = $model; - $this->request = $request; - $this->hash = $hash; - } - - public function headers(): array - { - return $this->request->getRawHeaders(); - } - - public function body(): array - { - $token = $this->getAccessToken(); - - return array_merge($this->request->getRawBody(), [ - Keys::TERMINAL => $token->getClientId(), - Keys::TOKEN => $token->getAccessToken(), - ]); - } - - public function refresh(): void {} - - protected function getAccessToken(): AccessToken - { - return Hash::make()->get( - $this->model, - $this->request->getRawBody(), - $this->hash - ); - } -} diff --git a/src/TinkoffAuth/src/Constants/Keys.php b/src/TinkoffAuth/src/Constants/Keys.php index 5623ab1e..26685dc1 100644 --- a/src/TinkoffAuth/src/Constants/Keys.php +++ b/src/TinkoffAuth/src/Constants/Keys.php @@ -19,7 +19,7 @@ class Keys { + public const PASSWORD = 'Password'; public const TERMINAL = 'TerminalKey'; public const TOKEN = 'Token'; - public const PASSWORD = 'Password'; } diff --git a/src/TinkoffAuth/src/Resources/AccessToken.php b/src/TinkoffAuth/src/Resources/AccessToken.php deleted file mode 100644 index a1d1fb52..00000000 --- a/src/TinkoffAuth/src/Resources/AccessToken.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Cashbox\Tinkoff\Auth\Resources; - -use Cashbox\Tinkoff\Auth\Constants\Keys; -use DragonCode\Contracts\Cashier\Resources\AccessToken as AccessTokenContract; -use DragonCode\SimpleDataTransferObject\DataTransferObject; -use Illuminate\Support\Carbon; - -class AccessToken extends DataTransferObject implements AccessTokenContract -{ - protected $client_id; - - protected $access_token; - - protected $map = [ - Keys::TERMINAL => 'client_id', - Keys::TOKEN => 'access_token', - ]; - - public function getClientId(): string - { - return $this->client_id; - } - - public function getAccessToken(): string - { - return $this->access_token; - } - - public function getExpiresIn(): Carbon - { - return Carbon::now()->addDay(); - } -} diff --git a/src/TinkoffAuth/src/Services/Hash.php b/src/TinkoffAuth/src/Services/Hash.php new file mode 100644 index 00000000..97225237 --- /dev/null +++ b/src/TinkoffAuth/src/Services/Hash.php @@ -0,0 +1,57 @@ +set(Keys::TERMINAL, $clientId) + ->set(Keys::PASSWORD, $clientSecret) + ->ksort() + ->values() + ->toArray(); + } + + protected static function data(string $clientId, string $clientSecret, ?DateTimeInterface $expiresIn = null): Token + { + $expiresIn ??= Carbon::now()->addDay(); + + return Token::from(compact('clientId', 'clientSecret', 'expiresIn')); + } +} diff --git a/src/TinkoffAuth/src/Sign.php b/src/TinkoffAuth/src/Sign.php new file mode 100644 index 00000000..dc96d7c4 --- /dev/null +++ b/src/TinkoffAuth/src/Sign.php @@ -0,0 +1,49 @@ +hash(); + + return array_merge($this->request->body(), [ + Keys::TERMINAL => $token->clientId, + Keys::TOKEN => $token->clientSecret, + ]); + } + + protected function hash(): Token + { + return Hash::get( + $this->clientId(), + $this->clientSecret(), + $this->request->body(), + $this->hash + ); + } + + protected function clientId(): string + { + return $this->credentials()->clientId; + } + + protected function clientSecret(): string + { + return $this->credentials()->clientSecret; + } + + protected function credentials(): CredentialsData + { + return $this->request->resource->payment->cashboxDriver()->config->credentials; + } +} diff --git a/src/TinkoffAuth/src/Support/Hash.php b/src/TinkoffAuth/src/Support/Hash.php deleted file mode 100644 index 75b34025..00000000 --- a/src/TinkoffAuth/src/Support/Hash.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Cashbox\Tinkoff\Auth\Support; - -use Cashbox\Tinkoff\Auth\Constants\Keys; -use Cashbox\Tinkoff\Auth\Resources\AccessToken; -use DragonCode\Contracts\Cashier\Resources\Model; -use DragonCode\Support\Concerns\Makeable; -use DragonCode\Support\Facades\Helpers\Ables\Arrayable; - -class Hash -{ - use Makeable; - - public function get(Model $model, array $data, bool $hash = true): AccessToken - { - return $this->makeToken($model->getClientId(), $model->getClientSecret(), $data, $hash); - } - - protected function makeToken(string $client_id, string $secret, array $data, bool $hash): AccessToken - { - return $hash - ? $this->hashed($client_id, $secret, $data) - : $this->basic($client_id, $secret); - } - - protected function basic(string $client_id, string $secret): AccessToken - { - return $this->items($client_id, $secret); - } - - protected function hashed(string $client_id, string $secret, array $data): AccessToken - { - $hash = $this->hash($client_id, $secret, $data); - - return $this->items($client_id, $hash); - } - - protected function hash(string $client_id, string $secret, array $data): string - { - $items = $this->prepare($client_id, $secret, $data); - - return hash('sha256', implode('', $items)); - } - - protected function prepare(string $client_id, string $secret, array $data): array - { - return Arrayable::of($data) - ->set(Keys::TERMINAL, $client_id) - ->set(Keys::PASSWORD, $secret) - ->ksort() - ->values() - ->get(); - } - - protected function items(string $client_id, string $access_token): AccessToken - { - return AccessToken::make(compact('client_id', 'access_token')); - } -} diff --git a/tests/Unit/TinkoffAuth/HashTest.php b/tests/Unit/TinkoffAuth/HashTest.php new file mode 100644 index 00000000..4b85b52c --- /dev/null +++ b/tests/Unit/TinkoffAuth/HashTest.php @@ -0,0 +1,32 @@ + 'qwe', + 'field2' => 'rty', + ], false); + + expect($hashed->clientId)->toBe($clientId); + expect($hashed->clientSecret)->toBe($clientSecret); +}); + +it('checks the hashed data', function (array $data) { + $clientId = 'foo'; + $clientSecret = 'bar'; + $hash = '53ed3ed16f10e22841fab015a863170d14fa551e9d2b2c411d1c0570caa69c99'; + + $hashed = Hash::get($clientId, $clientSecret, $data, true); + + expect($hashed->clientId)->toBe($clientId); + expect($hashed->clientSecret)->toBe($hash); +})->with([ + [['field1' => 'qwe', 'field2' => 'rty']], + [['field2' => 'rty', 'field1' => 'qwe']], +]); From cf7e21017b3b85b88a001844a424238fc9e1bb85 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 20:05:40 +0300 Subject: [PATCH 076/164] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index b388d309..9033697a 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). From 7f70ea3c46cee5e5f64fdcee183f4b0f92e6b194 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 20:06:23 +0300 Subject: [PATCH 077/164] Update README.md --- .templates/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/.templates/README.md b/.templates/README.md index d436a664..10fe369e 100644 --- a/.templates/README.md +++ b/.templates/README.md @@ -32,7 +32,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). From 528a07b9ffc5b56a955a4ca3f2a2139119b4ee4c Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sun, 16 Jul 2023 17:06:52 +0000 Subject: [PATCH 078/164] Updated readme files --- src/Cash/README.md | 1 - src/Core/README.md | 1 - src/SberAuth/README.md | 1 - src/SberOnline/README.md | 1 - src/SberQrCode/README.md | 1 - src/TemplateDriver/README.md | 1 - src/TemplateDriverAuth/README.md | 1 - src/TinkoffAuth/README.md | 1 - src/TinkoffCredit/README.md | 1 - src/TinkoffOnline/README.md | 1 - src/TinkoffQrCode/README.md | 1 - 11 files changed, 11 deletions(-) diff --git a/src/Cash/README.md b/src/Cash/README.md index 59998b9e..d3684fef 100644 --- a/src/Cash/README.md +++ b/src/Cash/README.md @@ -32,7 +32,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). diff --git a/src/Core/README.md b/src/Core/README.md index d9cf2b75..ce1e60a8 100644 --- a/src/Core/README.md +++ b/src/Core/README.md @@ -32,7 +32,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). diff --git a/src/SberAuth/README.md b/src/SberAuth/README.md index 2424161a..3516ea10 100644 --- a/src/SberAuth/README.md +++ b/src/SberAuth/README.md @@ -32,7 +32,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). diff --git a/src/SberOnline/README.md b/src/SberOnline/README.md index 4dc9980f..18ce4df8 100644 --- a/src/SberOnline/README.md +++ b/src/SberOnline/README.md @@ -32,7 +32,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). diff --git a/src/SberQrCode/README.md b/src/SberQrCode/README.md index ffd4f153..566dfa43 100644 --- a/src/SberQrCode/README.md +++ b/src/SberQrCode/README.md @@ -32,7 +32,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). diff --git a/src/TemplateDriver/README.md b/src/TemplateDriver/README.md index d3b5c76c..e42aebdc 100644 --- a/src/TemplateDriver/README.md +++ b/src/TemplateDriver/README.md @@ -32,7 +32,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). diff --git a/src/TemplateDriverAuth/README.md b/src/TemplateDriverAuth/README.md index 2a933867..e9cd96dc 100644 --- a/src/TemplateDriverAuth/README.md +++ b/src/TemplateDriverAuth/README.md @@ -32,7 +32,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). diff --git a/src/TinkoffAuth/README.md b/src/TinkoffAuth/README.md index 7210c797..a9b836b9 100644 --- a/src/TinkoffAuth/README.md +++ b/src/TinkoffAuth/README.md @@ -32,7 +32,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). diff --git a/src/TinkoffCredit/README.md b/src/TinkoffCredit/README.md index 533fff74..39ba67d3 100644 --- a/src/TinkoffCredit/README.md +++ b/src/TinkoffCredit/README.md @@ -32,7 +32,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). diff --git a/src/TinkoffOnline/README.md b/src/TinkoffOnline/README.md index 36468d18..7b439cb6 100644 --- a/src/TinkoffOnline/README.md +++ b/src/TinkoffOnline/README.md @@ -32,7 +32,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). diff --git a/src/TinkoffQrCode/README.md b/src/TinkoffQrCode/README.md index 7e4df0a6..32b20065 100644 --- a/src/TinkoffQrCode/README.md +++ b/src/TinkoffQrCode/README.md @@ -32,7 +32,6 @@ We also have Telegram channels where we post announcements: - [English](https://t.me/dragon_code_news_en) - [Русский](https://t.me/dragon_code_news) -- [Український](https://t.me/dragon_code_news_ua) You can also select the news channels you need from the [Telegram folder](https://t.me/addlist/FKmP70KKc7g2ZWMy). From c0650566e06b7c94b1ba952353efb02fb4ce2f20 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 22:25:07 +0300 Subject: [PATCH 079/164] Small refactoring --- src/TinkoffAuth/src/Services/Hash.php | 7 ++++--- tests/Unit/TinkoffAuth/HashTest.php | 11 ++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/TinkoffAuth/src/Services/Hash.php b/src/TinkoffAuth/src/Services/Hash.php index 97225237..e931159a 100644 --- a/src/TinkoffAuth/src/Services/Hash.php +++ b/src/TinkoffAuth/src/Services/Hash.php @@ -35,17 +35,18 @@ protected static function make(string $clientId, string $clientSecret, array $da { $items = static::resolve($clientId, $clientSecret, $data); - return hash('sha256', implode('', $items)); + return hash('sha256', $items); } - protected static function resolve(string $clientId, string $clientSecret, array $data): array + protected static function resolve(string $clientId, string $clientSecret, array $data): string { return Arr::of($data) ->set(Keys::TERMINAL, $clientId) ->set(Keys::PASSWORD, $clientSecret) ->ksort() ->values() - ->toArray(); + ->implode('') + ->toString(); } protected static function data(string $clientId, string $clientSecret, ?DateTimeInterface $expiresIn = null): Token diff --git a/tests/Unit/TinkoffAuth/HashTest.php b/tests/Unit/TinkoffAuth/HashTest.php index 4b85b52c..6ac173f2 100644 --- a/tests/Unit/TinkoffAuth/HashTest.php +++ b/tests/Unit/TinkoffAuth/HashTest.php @@ -11,6 +11,7 @@ $hashed = Hash::get($clientId, $clientSecret, [ 'field1' => 'qwe', 'field2' => 'rty', + 'field3' => 'asd', ], false); expect($hashed->clientId)->toBe($clientId); @@ -20,13 +21,17 @@ it('checks the hashed data', function (array $data) { $clientId = 'foo'; $clientSecret = 'bar'; - $hash = '53ed3ed16f10e22841fab015a863170d14fa551e9d2b2c411d1c0570caa69c99'; + $hash = '7959ae1ec20a02490d8d2f01d3704a2543e70c43cbe0c672209741263ef8048f'; $hashed = Hash::get($clientId, $clientSecret, $data, true); expect($hashed->clientId)->toBe($clientId); expect($hashed->clientSecret)->toBe($hash); })->with([ - [['field1' => 'qwe', 'field2' => 'rty']], - [['field2' => 'rty', 'field1' => 'qwe']], + [['field1' => 'qwe', 'field2' => 'rty', 'field3' => 'asd']], + [['field1' => 'qwe', 'field3' => 'asd', 'field2' => 'rty']], + [['field2' => 'rty', 'field1' => 'qwe', 'field3' => 'asd']], + [['field2' => 'rty', 'field3' => 'asd', 'field1' => 'qwe']], + [['field3' => 'asd', 'field1' => 'qwe', 'field2' => 'rty']], + [['field3' => 'asd', 'field2' => 'rty', 'field1' => 'qwe']], ]); From 011179f5fa2aba7622737bf3e19e45d890d40221 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 23:00:08 +0300 Subject: [PATCH 080/164] Added a link to the donation system --- composer.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/composer.json b/composer.json index 7c2210fd..340a8f96 100644 --- a/composer.json +++ b/composer.json @@ -40,6 +40,10 @@ { "type": "open_collective", "url": "https://opencollective.com/dragon-code" + }, + { + "type": "donationalerts", + "url": "https://www.donationalerts.com/r/dragon_code" } ], "require": { From 6e634dca8d38f5048457666c23868a26ce218aa9 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 23:00:38 +0300 Subject: [PATCH 081/164] Fixed placement of Tinkoff authorization test file --- tests/Unit/{ => Drivers}/TinkoffAuth/HashTest.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/Unit/{ => Drivers}/TinkoffAuth/HashTest.php (100%) diff --git a/tests/Unit/TinkoffAuth/HashTest.php b/tests/Unit/Drivers/TinkoffAuth/HashTest.php similarity index 100% rename from tests/Unit/TinkoffAuth/HashTest.php rename to tests/Unit/Drivers/TinkoffAuth/HashTest.php From e7bcafaa082346cac35fc0aa32596070e1fc83f5 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 23:07:22 +0300 Subject: [PATCH 082/164] Console commands renamed --- src/Core/src/Console/Commands/Refund.php | 4 ++-- src/Core/src/Console/Commands/Verify.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Core/src/Console/Commands/Refund.php b/src/Core/src/Console/Commands/Refund.php index e9d299a3..2160f4cb 100644 --- a/src/Core/src/Console/Commands/Refund.php +++ b/src/Core/src/Console/Commands/Refund.php @@ -20,10 +20,10 @@ use Illuminate\Database\Eloquent\Model; use Symfony\Component\Console\Attribute\AsCommand; -#[AsCommand('cashier:refund')] +#[AsCommand('cashbox:refund')] class Refund extends Command { - protected $signature = 'cashier:refund {paymentId?} {--force}'; + protected $signature = 'cashbox:refund {paymentId?} {--force}'; protected $description = 'Refunds all payment transactions'; diff --git a/src/Core/src/Console/Commands/Verify.php b/src/Core/src/Console/Commands/Verify.php index bf238bcc..6e91879c 100644 --- a/src/Core/src/Console/Commands/Verify.php +++ b/src/Core/src/Console/Commands/Verify.php @@ -20,10 +20,10 @@ use Illuminate\Database\Eloquent\Model; use Symfony\Component\Console\Attribute\AsCommand; -#[AsCommand('cashier:verify')] +#[AsCommand('cashbox:verify')] class Verify extends Command { - protected $signature = 'cashier:verify {paymentId?} {--force}'; + protected $signature = 'cashbox:verify {paymentId?} {--force}'; protected $description = 'Verifies the status of a bank transaction'; From 4a58f6f3468595e01adf6c84ce42a777250bafb8 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 23:16:09 +0300 Subject: [PATCH 083/164] Added tests for the verification console command --- src/Core/src/Console/Commands/Command.php | 2 +- tests/Pest.php | 13 ++-- tests/Unit/Core/Console/RefundTest.php | 9 +++ tests/Unit/Core/Console/VerifyTest.php | 74 +++++++++++++++++++++++ 4 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 tests/Unit/Core/Console/RefundTest.php create mode 100644 tests/Unit/Core/Console/VerifyTest.php diff --git a/src/Core/src/Console/Commands/Command.php b/src/Core/src/Console/Commands/Command.php index e55e863f..fec9a3ca 100644 --- a/src/Core/src/Console/Commands/Command.php +++ b/src/Core/src/Console/Commands/Command.php @@ -58,7 +58,7 @@ protected function ran(): void protected function payments(Closure $callback): void { $this->builder() - ->with('cashier.parent') + ->with('cashbox.parent') ->where(static::attribute()->type, $this->getTypes()) ->where(static::attribute()->status, $this->getStatuses()) ->when($this->getPaymentId(), fn (Builder $builder, int|string $id) => $builder diff --git a/tests/Pest.php b/tests/Pest.php index 89aa1c68..a1c0181c 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -7,9 +7,8 @@ use Cashbox\Core\Events\SuccessEvent; use Cashbox\Core\Events\WaitRefundEvent; use Cashbox\Core\Facades\Config; -use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\App; -use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Facade; use Illuminate\Support\Facades\Http; @@ -69,6 +68,11 @@ function assertDoesntHaveCashbox(PaymentModel $payment): void | */ +function artisan(string $command, array $parameters = []): void +{ + Artisan::call($command, $parameters); +} + function forget(string $class, Facade|string|null $facade = null): void { if ($facade) { @@ -90,11 +94,6 @@ function createPayment(TypeEnum $type, ?int $price = null): PaymentModel return PaymentModel::create(compact('type', 'price')); } -function paymentTable(): Builder -{ - return DB::table('payments'); -} - function fakeDataProperty(): DataProperty { $reflection = new ReflectionProperty(FakeData::class, 'foo'); diff --git a/tests/Unit/Core/Console/RefundTest.php b/tests/Unit/Core/Console/RefundTest.php new file mode 100644 index 00000000..34859f5c --- /dev/null +++ b/tests/Unit/Core/Console/RefundTest.php @@ -0,0 +1,9 @@ +refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment4->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment5->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment6->refresh()->updateQuietly(['status' => StatusEnum::new]); + + fakes(); + + artisan(Verify::class); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertDispatchedTimes(SuccessEvent::class, 4); + + expect($payment1->refresh()->status)->toBe(StatusEnum::new); + expect($payment2->refresh()->status)->toBe(StatusEnum::new); + expect($payment3->refresh()->status)->toBe(StatusEnum::success); + expect($payment4->refresh()->status)->toBe(StatusEnum::success); + expect($payment5->refresh()->status)->toBe(StatusEnum::success); + expect($payment6->refresh()->status)->toBe(StatusEnum::success); +}); + +it('partial verification', function () { + fakes(); + + $payment1 = createPayment(TypeEnum::outside); + $payment2 = createPayment(TypeEnum::outside); + $payment3 = createPayment(TypeEnum::cash); + $payment4 = createPayment(TypeEnum::cash); + $payment5 = createPayment(TypeEnum::cash); + $payment6 = createPayment(TypeEnum::cash); + + Event::assertDispatchedTimes(CreatedEvent::class, 4); + Event::assertDispatchedTimes(SuccessEvent::class, 4); + + $payment5->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment6->refresh()->updateQuietly(['status' => StatusEnum::new]); + + fakes(); + + artisan(Verify::class); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertDispatchedTimes(SuccessEvent::class, 2); + + expect($payment1->refresh()->status)->toBe(StatusEnum::new); + expect($payment2->refresh()->status)->toBe(StatusEnum::new); + expect($payment3->refresh()->status)->toBe(StatusEnum::success); + expect($payment4->refresh()->status)->toBe(StatusEnum::success); + expect($payment5->refresh()->status)->toBe(StatusEnum::success); + expect($payment6->refresh()->status)->toBe(StatusEnum::success); +}); From 205cd0e64cc0f4d87c74e95feeffc2e5ac4038b7 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 23:17:53 +0300 Subject: [PATCH 084/164] Removed verification timing block --- src/Core/config/cashbox.php | 35 ------------------------- src/Core/src/Data/Config/ConfigData.php | 7 ----- src/Core/src/Data/Config/VerifyData.php | 31 ---------------------- src/Core/src/Facades/Config.php | 2 -- tests/Unit/Core/Facades/ConfigTest.php | 15 +++-------- 5 files changed, 4 insertions(+), 86 deletions(-) delete mode 100644 src/Core/src/Data/Config/VerifyData.php diff --git a/src/Core/config/cashbox.php b/src/Core/config/cashbox.php index 7028f1e2..435491df 100644 --- a/src/Core/config/cashbox.php +++ b/src/Core/config/cashbox.php @@ -264,41 +264,6 @@ ], ], - /* - |-------------------------------------------------------------------------- - | Verify Requests - |-------------------------------------------------------------------------- - | - | This parameter of settings is responsible for the duration of the requests. - | - */ - - 'verify' => [ - /* - |-------------------------------------------------------------------------- - | Delay - |-------------------------------------------------------------------------- - | - | This setting determines the number of seconds to pause before - | re-verifying the payment status. - | - */ - - 'delay' => 3, - - /* - |-------------------------------------------------------------------------- - | Timeout - |-------------------------------------------------------------------------- - | - | This setting determines the number of seconds after which you need to - | stop trying to verify the status of the payment. - | - */ - - 'timeout' => 600, - ], - /* |-------------------------------------------------------------------------- | Auto Refund diff --git a/src/Core/src/Data/Config/ConfigData.php b/src/Core/src/Data/Config/ConfigData.php index 9d6f075c..b418a004 100644 --- a/src/Core/src/Data/Config/ConfigData.php +++ b/src/Core/src/Data/Config/ConfigData.php @@ -37,8 +37,6 @@ class ConfigData extends Data public QueueData $queue; - public VerifyData $verify; - #[MapInputName('auto_refund')] public RefundData $refund; @@ -65,11 +63,6 @@ public function queue(): QueueData return $this->queue; } - public function verify(): VerifyData - { - return $this->verify; - } - public function refund(): RefundData { return $this->refund; diff --git a/src/Core/src/Data/Config/VerifyData.php b/src/Core/src/Data/Config/VerifyData.php deleted file mode 100644 index 7d0c97d5..00000000 --- a/src/Core/src/Data/Config/VerifyData.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Data\Config; - -use Cashbox\Core\Data\Casts\NumberCast; -use Spatie\LaravelData\Attributes\WithCast; -use Spatie\LaravelData\Data; - -class VerifyData extends Data -{ - #[WithCast(NumberCast::class, min: 0, max: 60)] - public int $delay; - - #[WithCast(NumberCast::class, min: 0, max: 30)] - public int $timeout; -} diff --git a/src/Core/src/Facades/Config.php b/src/Core/src/Facades/Config.php index 34343307..291300ad 100644 --- a/src/Core/src/Facades/Config.php +++ b/src/Core/src/Facades/Config.php @@ -24,7 +24,6 @@ use Cashbox\Core\Data\Config\Payment\PaymentData; use Cashbox\Core\Data\Config\Queue\QueueData; use Cashbox\Core\Data\Config\RefundData; -use Cashbox\Core\Data\Config\VerifyData; use Illuminate\Support\Facades\Facade; /** @@ -35,7 +34,6 @@ * @method static PaymentData payment() * @method static QueueData queue() * @method static RefundData refund() - * @method static VerifyData verify() */ class Config extends Facade { diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 621e7b3b..0da92140 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -79,13 +79,6 @@ expect($data->name->refund)->toBeNull(); }); -it('checks the verify block', function () { - $data = Config::verify(); - - expect($data->delay)->toBe(3); - expect($data->timeout)->toBe(30); -}); - it('checks the refund block', function () { forgetConfig(); @@ -157,12 +150,12 @@ function (array $main, array $driver, array $expected) { expect($item->getQueue()->refund)->toBe($expected['refund']); } )->with([ - 'filled' => [ + 'filled' => [ driverData('q1', 'q2', 'q3'), driverData('q4', 'q5', 'q6'), driverData('q4', 'q5', 'q6'), ], - 'partial' => [ + 'partial' => [ driverData('q1', 'q2', 'q3'), driverData('q4', null, null), driverData('q4', null, null), @@ -172,12 +165,12 @@ function (array $main, array $driver, array $expected) { [], driverData(null, null, null), ], - 'main empty' => [ + 'main empty' => [ [], driverData('q4', 'q5', 'q6'), driverData('q4', 'q5', 'q6'), ], - 'full empty' => [ + 'full empty' => [ [], [], driverData(null, null, null), From 6d16788037e5df614d3c0400090620dafd2599b5 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 23:47:31 +0300 Subject: [PATCH 085/164] Fixed auto-refund --- src/Core/src/Services/Authorize.php | 6 ++--- tests/Unit/Drivers/Cash/RefundTest.php | 37 +++++++++++++++++++------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/Core/src/Services/Authorize.php b/src/Core/src/Services/Authorize.php index ddef82d3..7fa119b2 100644 --- a/src/Core/src/Services/Authorize.php +++ b/src/Core/src/Services/Authorize.php @@ -41,15 +41,13 @@ public static function toStart(Model $payment): bool public static function toVerify(Model $payment): bool { return static::acceptType($payment) - && static::acceptStatus($payment, static::statuses()->inProgress()) - && static::hasDetails($payment); + && static::acceptStatus($payment, static::statuses()->inProgress()); } public static function toRefund(Model $payment): bool { return static::acceptType($payment) - && static::acceptStatus($payment, static::statuses()->toRefund()) - && static::hasDetails($payment); + && static::acceptStatus($payment, static::statuses()->toRefund()); } /** diff --git a/tests/Unit/Drivers/Cash/RefundTest.php b/tests/Unit/Drivers/Cash/RefundTest.php index 108bb4f7..823197ea 100644 --- a/tests/Unit/Drivers/Cash/RefundTest.php +++ b/tests/Unit/Drivers/Cash/RefundTest.php @@ -12,7 +12,7 @@ use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; -it('checks the verify', function () { +it('checks the manual refund', function () { fakes(); $payment = createPayment(TypeEnum::cash); @@ -22,13 +22,6 @@ assertHasCashbox($payment); - // verify - $payment->refresh()->updateQuietly([ - 'status' => StatusEnum::new, - ]); - - $payment->cashboxJob()->verify(); - $payment->refresh(); expect($payment->status)->toBe(StatusEnum::success); @@ -40,7 +33,33 @@ expect($payment->status)->toBe(StatusEnum::refund); Event::assertDispatchedTimes(CreatedEvent::class); - Event::assertDispatchedTimes(SuccessEvent::class, 2); + Event::assertDispatchedTimes(SuccessEvent::class); + Event::assertDispatchedTimes(RefundedEvent::class); + + Event::assertNotDispatched(FailedEvent::class); + Event::assertNotDispatched(WaitRefundEvent::class); + + Http::assertNothingSent(); +}); + +it('checks the auto refund', function () { + fakes(); + forgetConfig(); + + config(['cashbox.auto_refund.enabled' => true]); + + $payment = createPayment(TypeEnum::cash); + + expect($payment->type)->toBe(TypeEnum::cash); + expect($payment->status)->toBe(StatusEnum::new); + + assertHasCashbox($payment); + + $payment->refresh(); + expect($payment->status)->toBe(StatusEnum::refund); + + Event::assertDispatchedTimes(CreatedEvent::class); + Event::assertDispatchedTimes(SuccessEvent::class); Event::assertDispatchedTimes(RefundedEvent::class); Event::assertNotDispatched(FailedEvent::class); From 89510f676785330b62b2bf1cafd65b5478b4d2df Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 16 Jul 2023 23:54:35 +0300 Subject: [PATCH 086/164] Added refund verification tests --- tests/Unit/Core/Console/RefundTest.php | 73 ++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/tests/Unit/Core/Console/RefundTest.php b/tests/Unit/Core/Console/RefundTest.php index 34859f5c..51615aee 100644 --- a/tests/Unit/Core/Console/RefundTest.php +++ b/tests/Unit/Core/Console/RefundTest.php @@ -2,8 +2,73 @@ declare(strict_types=1); -namespace Tests\Unit\Core\Console; +use Cashbox\Core\Console\Commands\Verify; +use Cashbox\Core\Events\CreatedEvent; +use Cashbox\Core\Events\SuccessEvent; +use Illuminate\Support\Facades\Event; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; -class RefundTest -{ -} +it('full check', function () { + fakes(); + + $payment1 = createPayment(TypeEnum::outside); + $payment2 = createPayment(TypeEnum::outside); + $payment3 = createPayment(TypeEnum::cash); + $payment4 = createPayment(TypeEnum::cash); + $payment5 = createPayment(TypeEnum::cash); + $payment6 = createPayment(TypeEnum::cash); + + Event::assertDispatchedTimes(CreatedEvent::class, 4); + Event::assertDispatchedTimes(SuccessEvent::class, 4); + + $payment3->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment4->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment5->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment6->refresh()->updateQuietly(['status' => StatusEnum::new]); + + fakes(); + + artisan(Verify::class); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertDispatchedTimes(SuccessEvent::class, 4); + + expect($payment1->refresh()->status)->toBe(StatusEnum::new); + expect($payment2->refresh()->status)->toBe(StatusEnum::new); + expect($payment3->refresh()->status)->toBe(StatusEnum::success); + expect($payment4->refresh()->status)->toBe(StatusEnum::success); + expect($payment5->refresh()->status)->toBe(StatusEnum::success); + expect($payment6->refresh()->status)->toBe(StatusEnum::success); +}); + +it('partial verification', function () { + fakes(); + + $payment1 = createPayment(TypeEnum::outside); + $payment2 = createPayment(TypeEnum::outside); + $payment3 = createPayment(TypeEnum::cash); + $payment4 = createPayment(TypeEnum::cash); + $payment5 = createPayment(TypeEnum::cash); + $payment6 = createPayment(TypeEnum::cash); + + Event::assertDispatchedTimes(CreatedEvent::class, 4); + Event::assertDispatchedTimes(SuccessEvent::class, 4); + + $payment5->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment6->refresh()->updateQuietly(['status' => StatusEnum::new]); + + fakes(); + + artisan(Verify::class); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertDispatchedTimes(SuccessEvent::class, 2); + + expect($payment1->refresh()->status)->toBe(StatusEnum::new); + expect($payment2->refresh()->status)->toBe(StatusEnum::new); + expect($payment3->refresh()->status)->toBe(StatusEnum::success); + expect($payment4->refresh()->status)->toBe(StatusEnum::success); + expect($payment5->refresh()->status)->toBe(StatusEnum::success); + expect($payment6->refresh()->status)->toBe(StatusEnum::success); +}); From 2a4b2c5612a6ce13e69592388241a89270de9a56 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 17 Jul 2023 00:00:06 +0300 Subject: [PATCH 087/164] Fixed handling of console command arguments --- src/Core/src/Console/Commands/Command.php | 6 +++--- src/Core/src/Console/Commands/Refund.php | 2 +- src/Core/src/Console/Commands/Verify.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Core/src/Console/Commands/Command.php b/src/Core/src/Console/Commands/Command.php index fec9a3ca..8ff6bd83 100644 --- a/src/Core/src/Console/Commands/Command.php +++ b/src/Core/src/Console/Commands/Command.php @@ -99,13 +99,13 @@ protected function hasForce(): bool return true; } - return $this->hasOption(' paymentId'); + return $this->hasArgument('payment'); } protected function getPaymentId(): int|string|null { - if ($this->hasOption(' paymentId')) { - return $this->option('paymentId'); + if ($this->hasArgument('payment')) { + return $this->argument('payment'); } return null; diff --git a/src/Core/src/Console/Commands/Refund.php b/src/Core/src/Console/Commands/Refund.php index 2160f4cb..42342c7b 100644 --- a/src/Core/src/Console/Commands/Refund.php +++ b/src/Core/src/Console/Commands/Refund.php @@ -23,7 +23,7 @@ #[AsCommand('cashbox:refund')] class Refund extends Command { - protected $signature = 'cashbox:refund {paymentId?} {--force}'; + protected $signature = 'cashbox:refund {payment?} {--force}'; protected $description = 'Refunds all payment transactions'; diff --git a/src/Core/src/Console/Commands/Verify.php b/src/Core/src/Console/Commands/Verify.php index 6e91879c..787bb6e8 100644 --- a/src/Core/src/Console/Commands/Verify.php +++ b/src/Core/src/Console/Commands/Verify.php @@ -23,7 +23,7 @@ #[AsCommand('cashbox:verify')] class Verify extends Command { - protected $signature = 'cashbox:verify {paymentId?} {--force}'; + protected $signature = 'cashbox:verify {payment?} {--force}'; protected $description = 'Verifies the status of a bank transaction'; From f4db1dffee4608f3992a39ffff7c52bf918e97da Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 17 Jul 2023 00:00:23 +0300 Subject: [PATCH 088/164] Added tests for verification and refund of payments by ID --- tests/Unit/Core/Console/RefundTest.php | 38 ++++++++++++++++++++++++++ tests/Unit/Core/Console/VerifyTest.php | 35 ++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/tests/Unit/Core/Console/RefundTest.php b/tests/Unit/Core/Console/RefundTest.php index 51615aee..359bceb6 100644 --- a/tests/Unit/Core/Console/RefundTest.php +++ b/tests/Unit/Core/Console/RefundTest.php @@ -2,8 +2,10 @@ declare(strict_types=1); +use Cashbox\Core\Console\Commands\Refund; use Cashbox\Core\Console\Commands\Verify; use Cashbox\Core\Events\CreatedEvent; +use Cashbox\Core\Events\RefundedEvent; use Cashbox\Core\Events\SuccessEvent; use Illuminate\Support\Facades\Event; use Tests\Fixtures\App\Enums\StatusEnum; @@ -72,3 +74,39 @@ expect($payment5->refresh()->status)->toBe(StatusEnum::success); expect($payment6->refresh()->status)->toBe(StatusEnum::success); }); + +it('refund by ID', function () { + fakes(); + + $payment1 = createPayment(TypeEnum::outside); + $payment2 = createPayment(TypeEnum::outside); + $payment3 = createPayment(TypeEnum::cash); + $payment4 = createPayment(TypeEnum::cash); + $payment5 = createPayment(TypeEnum::cash); + $payment6 = createPayment(TypeEnum::cash); + + Event::assertDispatchedTimes(CreatedEvent::class, 4); + Event::assertDispatchedTimes(SuccessEvent::class, 4); + + $payment3->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment4->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment5->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment6->refresh()->updateQuietly(['status' => StatusEnum::new]); + + fakes(); + + artisan(Refund::class, [ + 'payment' => $payment4->id, + ]); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertDispatchedTimes(SuccessEvent::class); + Event::assertDispatchedTimes(RefundedEvent::class); + + expect($payment1->refresh()->status)->toBe(StatusEnum::new); + expect($payment2->refresh()->status)->toBe(StatusEnum::new); + expect($payment3->refresh()->status)->toBe(StatusEnum::new); + expect($payment4->refresh()->status)->toBe(StatusEnum::refund); + expect($payment5->refresh()->status)->toBe(StatusEnum::new); + expect($payment6->refresh()->status)->toBe(StatusEnum::new); +}); diff --git a/tests/Unit/Core/Console/VerifyTest.php b/tests/Unit/Core/Console/VerifyTest.php index 51615aee..9db590c3 100644 --- a/tests/Unit/Core/Console/VerifyTest.php +++ b/tests/Unit/Core/Console/VerifyTest.php @@ -72,3 +72,38 @@ expect($payment5->refresh()->status)->toBe(StatusEnum::success); expect($payment6->refresh()->status)->toBe(StatusEnum::success); }); + +it('verify by ID', function () { + fakes(); + + $payment1 = createPayment(TypeEnum::outside); + $payment2 = createPayment(TypeEnum::outside); + $payment3 = createPayment(TypeEnum::cash); + $payment4 = createPayment(TypeEnum::cash); + $payment5 = createPayment(TypeEnum::cash); + $payment6 = createPayment(TypeEnum::cash); + + Event::assertDispatchedTimes(CreatedEvent::class, 4); + Event::assertDispatchedTimes(SuccessEvent::class, 4); + + $payment3->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment4->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment5->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment6->refresh()->updateQuietly(['status' => StatusEnum::new]); + + fakes(); + + artisan(Verify::class, [ + 'payment' => $payment4->id, + ]); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertDispatchedTimes(SuccessEvent::class); + + expect($payment1->refresh()->status)->toBe(StatusEnum::new); + expect($payment2->refresh()->status)->toBe(StatusEnum::new); + expect($payment3->refresh()->status)->toBe(StatusEnum::new); + expect($payment4->refresh()->status)->toBe(StatusEnum::success); + expect($payment5->refresh()->status)->toBe(StatusEnum::new); + expect($payment6->refresh()->status)->toBe(StatusEnum::new); +}); From b95ca93239f7db4990fc863142a15e5bbe1fffce Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 17 Jul 2023 00:02:29 +0300 Subject: [PATCH 089/164] Renamed hash test headers --- tests/Unit/Drivers/TinkoffAuth/HashTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Unit/Drivers/TinkoffAuth/HashTest.php b/tests/Unit/Drivers/TinkoffAuth/HashTest.php index 6ac173f2..ea5dac90 100644 --- a/tests/Unit/Drivers/TinkoffAuth/HashTest.php +++ b/tests/Unit/Drivers/TinkoffAuth/HashTest.php @@ -4,7 +4,7 @@ use Cashbox\Tinkoff\Auth\Services\Hash; -it('checks the basic data', function () { +it('basic data', function () { $clientId = 'foo'; $clientSecret = 'bar'; @@ -18,7 +18,7 @@ expect($hashed->clientSecret)->toBe($clientSecret); }); -it('checks the hashed data', function (array $data) { +it('hashed data', function (array $data) { $clientId = 'foo'; $clientSecret = 'bar'; $hash = '7959ae1ec20a02490d8d2f01d3704a2543e70c43cbe0c672209741263ef8048f'; From 095dddc13c32be1c293f3a5da6820fe553766944 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 17 Jul 2023 00:02:55 +0300 Subject: [PATCH 090/164] Normalized `composer.json` --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 340a8f96..33a33fc0 100644 --- a/composer.json +++ b/composer.json @@ -47,13 +47,14 @@ } ], "require": { + "php": "^8.1", + "ext-json": "*", "archtechx/enums": "^0.3.2", "doctrine/dbal": "^3.6", "dragon-code/contracts": "^2.20", "dragon-code/laravel-support": "^3.6", "dragon-code/simple-dto": "^2.7.1", "dragon-code/support": "^6.11.2", - "ext-json": "*", "guzzlehttp/guzzle": "^7.7", "illuminate/bus": "^10.15", "illuminate/console": "^10.15", @@ -62,7 +63,6 @@ "illuminate/queue": "^10.15", "illuminate/support": "^10.15", "nesbot/carbon": "^2.68.1", - "php": "^8.1", "psr/http-message": "^2.0", "psr/log": "^3.0", "spatie/laravel-data": "^3.7", From cc018dc6e2e1b890f04d2bf1f633c852d56d8ad4 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 17 Jul 2023 00:04:43 +0300 Subject: [PATCH 091/164] Disabled extra trait --- src/Core/src/Billable.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Core/src/Billable.php b/src/Core/src/Billable.php index 81881e5f..5600d7bc 100644 --- a/src/Core/src/Billable.php +++ b/src/Core/src/Billable.php @@ -19,7 +19,6 @@ use Cashbox\Core\Concerns\Config\Payment\Attributes; use Cashbox\Core\Concerns\Helpers\Jobs; -use Cashbox\Core\Concerns\Repositories\Registry; use Cashbox\Core\Models\Details; use Cashbox\Core\Services\Driver; use Cashbox\Core\Services\DriverManager; @@ -33,7 +32,6 @@ trait Billable { use Attributes; use Jobs; - use Registry; protected ?Driver $cashboxDriver = null; From 1017f7530fdce8712e719ddb7a3c4171744c3909 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 17 Jul 2023 00:06:33 +0300 Subject: [PATCH 092/164] Added `config` suffix to trait methods to eliminate possible collision --- ..._07_08_172343_cashier_details_drop_morph_column.php | 6 +++--- ..._205531_change_payments_table_add_cashier_index.php | 6 +++--- ..._14_172234_change_payments_table_optimize_index.php | 10 +++++----- src/Core/src/Billable.php | 6 +++--- src/Core/src/Concerns/Config/Details.php | 2 +- src/Core/src/Concerns/Config/Payment/Attributes.php | 2 +- src/Core/src/Concerns/Config/Payment/Payments.php | 2 +- src/Core/src/Concerns/Config/Payment/Statuses.php | 2 +- src/Core/src/Concerns/Config/Refund.php | 2 +- src/Core/src/Concerns/Events/Notifiable.php | 2 +- src/Core/src/Concerns/Migrations/PrivateMigration.php | 10 +++++----- src/Core/src/Concerns/Migrations/PublicMigration.php | 4 ++-- src/Core/src/Console/Commands/Command.php | 10 +++++----- src/Core/src/Console/Commands/Refund.php | 2 +- src/Core/src/Console/Commands/Verify.php | 2 +- src/Core/src/Models/Details.php | 4 ++-- src/Core/src/Observers/PaymentDetailsObserver.php | 4 ++-- src/Core/src/Observers/PaymentObserver.php | 8 ++++---- src/Core/src/Providers/ObserverServiceProvider.php | 2 +- src/Core/src/Services/Authorize.php | 6 +++--- src/Core/src/Services/Job.php | 4 ++-- src/Core/src/Services/Statuses.php | 2 +- 22 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php b/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php index 9ed5e0cd..6b0804d5 100644 --- a/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php +++ b/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php @@ -30,7 +30,7 @@ public function up(): void protected function createColumn(string $name, string $after): void { $this->connection()->table($this->table(), function (Blueprint $table) use ($name, $after) { - $table->foreignIdFor(static::payment()->model, $name) + $table->foreignIdFor(static::paymentConfig()->model, $name) ->after($after) ->constrained($this->primaryTable(), $this->primaryKey()) ->cascadeOnDelete(); @@ -46,8 +46,8 @@ protected function dropColumns(string $name): void protected function moveData(string $from, string $to): void { - DB::connection(self::details()->connection) - ->table(self::details()->table) + DB::connection(self::detailsConfig()->connection) + ->table(self::detailsConfig()->table) ->update([$to => DB::raw($from)]); } }; diff --git a/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php b/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php index 78bd0e88..6b143034 100644 --- a/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php +++ b/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php @@ -29,9 +29,9 @@ public function up(): void protected function fields(): array { return [ - self::attribute()->type, - self::attribute()->status, - self::attribute()->createdAt, + self::attributeConfig()->type, + self::attributeConfig()->status, + self::attributeConfig()->createdAt, ]; } }; diff --git a/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php b/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php index 9908abc8..9c7e47bd 100644 --- a/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php +++ b/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php @@ -30,17 +30,17 @@ public function up(): void protected function oldFields(): array { return [ - self::attribute()->type, - self::attribute()->status, - self::attribute()->createdAt, + self::attributeConfig()->type, + self::attributeConfig()->status, + self::attributeConfig()->createdAt, ]; } protected function newFields(): array { return [ - self::attribute()->type, - self::attribute()->status, + self::attributeConfig()->type, + self::attributeConfig()->status, ]; } }; diff --git a/src/Core/src/Billable.php b/src/Core/src/Billable.php index 5600d7bc..20bd1e1d 100644 --- a/src/Core/src/Billable.php +++ b/src/Core/src/Billable.php @@ -57,21 +57,21 @@ public function cashboxJob(bool $force = false): Services\Job public function cashboxAttributeType(): mixed { return $this->getAttribute( - static::attribute()->type + static::attributeConfig()->type ); } public function cashboxAttributeStatus(): mixed { return $this->getAttribute( - static::attribute()->status + static::attributeConfig()->status ); } public function cashboxAttributeCreatedAt(): DateTimeInterface { return $this->getAttribute( - static::attribute()->createdAt + static::attributeConfig()->createdAt ); } } diff --git a/src/Core/src/Concerns/Config/Details.php b/src/Core/src/Concerns/Config/Details.php index 8c4384bb..8abdce57 100644 --- a/src/Core/src/Concerns/Config/Details.php +++ b/src/Core/src/Concerns/Config/Details.php @@ -22,7 +22,7 @@ trait Details { - protected static function details(): DetailsData + protected static function detailsConfig(): DetailsData { return Config::details(); } diff --git a/src/Core/src/Concerns/Config/Payment/Attributes.php b/src/Core/src/Concerns/Config/Payment/Attributes.php index f90c2f69..e3874350 100644 --- a/src/Core/src/Concerns/Config/Payment/Attributes.php +++ b/src/Core/src/Concerns/Config/Payment/Attributes.php @@ -22,7 +22,7 @@ trait Attributes { - protected static function attribute(): AttributeData + protected static function attributeConfig(): AttributeData { return Config::payment()->attribute; } diff --git a/src/Core/src/Concerns/Config/Payment/Payments.php b/src/Core/src/Concerns/Config/Payment/Payments.php index 0e700254..c29bd0f8 100644 --- a/src/Core/src/Concerns/Config/Payment/Payments.php +++ b/src/Core/src/Concerns/Config/Payment/Payments.php @@ -22,7 +22,7 @@ trait Payments { - protected static function payment(): PaymentData + protected static function paymentConfig(): PaymentData { return Config::payment(); } diff --git a/src/Core/src/Concerns/Config/Payment/Statuses.php b/src/Core/src/Concerns/Config/Payment/Statuses.php index 69614b04..484d5714 100644 --- a/src/Core/src/Concerns/Config/Payment/Statuses.php +++ b/src/Core/src/Concerns/Config/Payment/Statuses.php @@ -22,7 +22,7 @@ trait Statuses { - protected static function statuses(): StatusData + protected static function statusConfig(): StatusData { return Config::payment()->status; } diff --git a/src/Core/src/Concerns/Config/Refund.php b/src/Core/src/Concerns/Config/Refund.php index 0ceda5e1..742e49a2 100644 --- a/src/Core/src/Concerns/Config/Refund.php +++ b/src/Core/src/Concerns/Config/Refund.php @@ -22,7 +22,7 @@ trait Refund { - public static function autoRefund(): RefundData + public static function autoRefundConfig(): RefundData { return Config::refund(); } diff --git a/src/Core/src/Concerns/Events/Notifiable.php b/src/Core/src/Concerns/Events/Notifiable.php index 6b915f8f..152bdd1f 100644 --- a/src/Core/src/Concerns/Events/Notifiable.php +++ b/src/Core/src/Concerns/Events/Notifiable.php @@ -51,7 +51,7 @@ protected static function eventWithDetect(Model $payment): void */ protected static function detectEvent(Model $payment): StatusEnum { - return static::payment()->status->toEnum( + return static::paymentConfig()->status->toEnum( $payment->cashboxAttributeStatus() ); } diff --git a/src/Core/src/Concerns/Migrations/PrivateMigration.php b/src/Core/src/Concerns/Migrations/PrivateMigration.php index 6b913222..83fd1ddd 100644 --- a/src/Core/src/Concerns/Migrations/PrivateMigration.php +++ b/src/Core/src/Concerns/Migrations/PrivateMigration.php @@ -32,32 +32,32 @@ abstract class PrivateMigration extends Migration protected function connection(): Builder { - return Schema::connection(static::details()->connection); + return Schema::connection(static::detailsConfig()->connection); } protected function table(): string { - return static::details()->table; + return static::detailsConfig()->table; } protected function primaryTable(): string { return $this->model()->table( - static::payment()->model + static::paymentConfig()->model ); } protected function primaryType(): string { return $this->model()->primaryKeyType( - static::payment()->model + static::paymentConfig()->model ); } protected function primaryKey(): string { return $this->model()->primaryKey( - static::payment()->model + static::paymentConfig()->model ); } } diff --git a/src/Core/src/Concerns/Migrations/PublicMigration.php b/src/Core/src/Concerns/Migrations/PublicMigration.php index df208804..6dae7e58 100644 --- a/src/Core/src/Concerns/Migrations/PublicMigration.php +++ b/src/Core/src/Concerns/Migrations/PublicMigration.php @@ -38,14 +38,14 @@ protected function connection(): Builder protected function modelConnection(): ?string { return $this->model()->connection( - static::payment()->model + static::paymentConfig()->model ); } protected function table(): string { return $this->model()->table( - static::payment()->model + static::paymentConfig()->model ); } } diff --git a/src/Core/src/Console/Commands/Command.php b/src/Core/src/Console/Commands/Command.php index 8ff6bd83..6a0b76dd 100644 --- a/src/Core/src/Console/Commands/Command.php +++ b/src/Core/src/Console/Commands/Command.php @@ -59,8 +59,8 @@ protected function payments(Closure $callback): void { $this->builder() ->with('cashbox.parent') - ->where(static::attribute()->type, $this->getTypes()) - ->where(static::attribute()->status, $this->getStatuses()) + ->where(static::attributeConfig()->type, $this->getTypes()) + ->where(static::attributeConfig()->status, $this->getStatuses()) ->when($this->getPaymentId(), fn (Builder $builder, int|string $id) => $builder ->where($this->modelKey(), $id) ) @@ -70,21 +70,21 @@ protected function payments(Closure $callback): void protected function builder(): Builder { return $this->model()->query( - static::payment()->model + static::paymentConfig()->model ); } protected function modelKey(): string { return $this->model()->primaryKey( - static::payment()->model + static::paymentConfig()->model ); } protected function getTypes(): array { return array_values( - static::payment()->drivers + static::paymentConfig()->drivers ); } diff --git a/src/Core/src/Console/Commands/Refund.php b/src/Core/src/Console/Commands/Refund.php index 42342c7b..c52ceefa 100644 --- a/src/Core/src/Console/Commands/Refund.php +++ b/src/Core/src/Console/Commands/Refund.php @@ -29,7 +29,7 @@ class Refund extends Command protected function getStatuses(): array { - return static::statuses()->toRefund(); + return static::statusConfig()->toRefund(); } /** diff --git a/src/Core/src/Console/Commands/Verify.php b/src/Core/src/Console/Commands/Verify.php index 787bb6e8..616fcfb6 100644 --- a/src/Core/src/Console/Commands/Verify.php +++ b/src/Core/src/Console/Commands/Verify.php @@ -29,7 +29,7 @@ class Verify extends Command protected function getStatuses(): array { - return static::statuses()->inProgress(); + return static::statusConfig()->inProgress(); } /** diff --git a/src/Core/src/Models/Details.php b/src/Core/src/Models/Details.php index 7fad3baa..33edbb6b 100644 --- a/src/Core/src/Models/Details.php +++ b/src/Core/src/Models/Details.php @@ -55,8 +55,8 @@ class Details extends Model public function __construct(array $attributes = []) { - $this->setConnection(static::details()->connection); - $this->setTable(static::details()->table); + $this->setConnection(static::detailsConfig()->connection); + $this->setTable(static::detailsConfig()->table); parent::__construct($attributes); } diff --git a/src/Core/src/Observers/PaymentDetailsObserver.php b/src/Core/src/Observers/PaymentDetailsObserver.php index da3576f1..98cf409f 100644 --- a/src/Core/src/Observers/PaymentDetailsObserver.php +++ b/src/Core/src/Observers/PaymentDetailsObserver.php @@ -54,8 +54,8 @@ public function saved(Details $model): void */ protected function updateStatus(Model $payment, StatusEnum $status): void { - $value = static::payment()->status->fromEnum($status); - $field = static::attribute()->status; + $value = static::paymentConfig()->status->fromEnum($status); + $field = static::attributeConfig()->status; $current = $payment->cashboxAttributeStatus(); if ($current !== $value) { diff --git a/src/Core/src/Observers/PaymentObserver.php b/src/Core/src/Observers/PaymentObserver.php index 7c3e6452..66fe014f 100644 --- a/src/Core/src/Observers/PaymentObserver.php +++ b/src/Core/src/Observers/PaymentObserver.php @@ -32,7 +32,7 @@ class PaymentObserver public function creating(Model $payment): void { // Collision elimination when creating a model using the default value from the database. - $payment->status = static::payment()->status->new; + $payment->status = static::paymentConfig()->status->new; } /** @@ -76,7 +76,7 @@ public function restored(Model $payment): void protected function wasChangedStatus(Model $payment): bool { return $payment->wasChanged( - static::attribute()->status + static::attributeConfig()->status ); } @@ -90,8 +90,8 @@ protected function wasChanged(Model $payment): bool protected function exceptFields(Model $payment): array { return Arr::of($payment->getChanges())->except([ - static::attribute()->status, - static::attribute()->createdAt, + static::attributeConfig()->status, + static::attributeConfig()->createdAt, ])->keys()->toArray(); } } diff --git a/src/Core/src/Providers/ObserverServiceProvider.php b/src/Core/src/Providers/ObserverServiceProvider.php index 9b7515e7..47e58fad 100644 --- a/src/Core/src/Providers/ObserverServiceProvider.php +++ b/src/Core/src/Providers/ObserverServiceProvider.php @@ -35,7 +35,7 @@ public function boot(): void protected function bootPayment(): void { - $model = static::payment()->model; + $model = static::paymentConfig()->model; $model::observe(PaymentObserver::class); } diff --git a/src/Core/src/Services/Authorize.php b/src/Core/src/Services/Authorize.php index 7fa119b2..7852a897 100644 --- a/src/Core/src/Services/Authorize.php +++ b/src/Core/src/Services/Authorize.php @@ -34,20 +34,20 @@ public static function type(Model $payment): bool public static function toStart(Model $payment): bool { return static::acceptType($payment) - && static::acceptStatus($payment, static::statuses()->new) + && static::acceptStatus($payment, static::statusConfig()->new) && static::doesntHaveDetails($payment); } public static function toVerify(Model $payment): bool { return static::acceptType($payment) - && static::acceptStatus($payment, static::statuses()->inProgress()); + && static::acceptStatus($payment, static::statusConfig()->inProgress()); } public static function toRefund(Model $payment): bool { return static::acceptType($payment) - && static::acceptStatus($payment, static::statuses()->toRefund()); + && static::acceptStatus($payment, static::statusConfig()->toRefund()); } /** diff --git a/src/Core/src/Services/Job.php b/src/Core/src/Services/Job.php index 681e4564..6cbf12ae 100644 --- a/src/Core/src/Services/Job.php +++ b/src/Core/src/Services/Job.php @@ -52,8 +52,8 @@ public function start(): void if ($this->authorizeToStart()) { $this->dispatch(StartJob::class, $this->detectQueue()->start); - if (static::autoRefund()->enabled) { - $this->refund(static::autoRefund()->delay); + if (static::autoRefundConfig()->enabled) { + $this->refund(static::autoRefundConfig()->delay); } } } diff --git a/src/Core/src/Services/Statuses.php b/src/Core/src/Services/Statuses.php index 36afc0cd..30a3e0c0 100644 --- a/src/Core/src/Services/Statuses.php +++ b/src/Core/src/Services/Statuses.php @@ -113,7 +113,7 @@ protected function hasCashbox(array $statuses, ?StatusEnum $status): bool protected function hasModel(array|string $statuses, StatusEnum $status): bool { $statuses = Arr::of((array) $statuses) - ->map(fn (mixed $value) => static::payment()->status->fromEnum($status)) + ->map(fn (mixed $value) => static::paymentConfig()->status->fromEnum($status)) ->toArray(); return $this->has($status, $statuses); From 26e23b8976a739208e4139f981f5c580a9feff2f Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 17 Jul 2023 00:52:55 +0300 Subject: [PATCH 093/164] Removed `--compact` option when running tests in GitHub Actions --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 26a9adec..84c5bc70 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,7 +44,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --parallel --compact --colors=always + run: vendor/bin/pest --parallel --colors=always env: DB_CONNECTION: mysql DB_USERNAME: root @@ -90,7 +90,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --parallel --compact --colors=always + run: vendor/bin/pest --parallel --colors=always env: DB_CONNECTION: mysql DB_USERNAME: root @@ -137,7 +137,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --parallel --compact --colors=always + run: vendor/bin/pest --parallel --colors=always env: DB_CONNECTION: pgsql DB_PASSWORD: password @@ -182,7 +182,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --parallel --compact --colors=always + run: vendor/bin/pest --parallel --colors=always env: DB_CONNECTION: sqlsrv DB_DATABASE: master From 86f53a6c148f791bf2ea4d2a0c0dd3a8940dfca6 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 17 Jul 2023 01:34:11 +0300 Subject: [PATCH 094/164] Fixed refund processing --- src/Core/src/Console/Commands/Command.php | 18 ++-- src/Core/src/Console/Commands/Refund.php | 25 +++++ tests/Unit/Core/Console/RefundTest.php | 111 ++++++++++++++++------ tests/Unit/Core/Console/VerifyTest.php | 2 +- 4 files changed, 119 insertions(+), 37 deletions(-) diff --git a/src/Core/src/Console/Commands/Command.php b/src/Core/src/Console/Commands/Command.php index 6a0b76dd..7ca8e91a 100644 --- a/src/Core/src/Console/Commands/Command.php +++ b/src/Core/src/Console/Commands/Command.php @@ -59,11 +59,12 @@ protected function payments(Closure $callback): void { $this->builder() ->with('cashbox.parent') - ->where(static::attributeConfig()->type, $this->getTypes()) - ->where(static::attributeConfig()->status, $this->getStatuses()) + ->whereIn(static::attributeConfig()->type, $this->getTypes()) + ->whereIn(static::attributeConfig()->status, $this->getStatuses()) ->when($this->getPaymentId(), fn (Builder $builder, int|string $id) => $builder ->where($this->modelKey(), $id) ) + ->when(! empty($this->condition()), fn (Builder $builder) => $this->condition()($builder)) ->chunkById($this->size, $callback); } @@ -74,6 +75,11 @@ protected function builder(): Builder ); } + protected function condition(): ?Closure + { + return null; + } + protected function modelKey(): string { return $this->model()->primaryKey( @@ -95,17 +101,17 @@ protected function action(): string protected function hasForce(): bool { - if ($this->hasOption('force') && $this->option('force')) { + if ($this->option('force')) { return true; } - return $this->hasArgument('payment'); + return ! empty($this->argument('payment')); } protected function getPaymentId(): int|string|null { - if ($this->hasArgument('payment')) { - return $this->argument('payment'); + if ($id = $this->argument('payment')) { + return $id; } return null; diff --git a/src/Core/src/Console/Commands/Refund.php b/src/Core/src/Console/Commands/Refund.php index c52ceefa..a4b2f135 100644 --- a/src/Core/src/Console/Commands/Refund.php +++ b/src/Core/src/Console/Commands/Refund.php @@ -17,16 +17,34 @@ namespace Cashbox\Core\Console\Commands; +use Carbon\Carbon; +use Cashbox\Core\Concerns\Config\Refund as RefundConfig; +use Closure; +use DateTimeInterface; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand('cashbox:refund')] class Refund extends Command { + use RefundConfig; + protected $signature = 'cashbox:refund {payment?} {--force}'; protected $description = 'Refunds all payment transactions'; + protected function condition(): ?Closure + { + if ($this->hasForce()) { + return null; + } + + return function (Builder $builder) { + return $builder->where(static::attributeConfig()->createdAt, '<=', $this->createdBefore()); + }; + } + protected function getStatuses(): array { return static::statusConfig()->toRefund(); @@ -39,4 +57,11 @@ protected function process(Model $payment): void { $payment->cashboxJob($this->hasForce())->refund(); } + + protected function createdBefore(): DateTimeInterface + { + return Carbon::now()->subSeconds( + static::autoRefundConfig()->delay + ); + } } diff --git a/tests/Unit/Core/Console/RefundTest.php b/tests/Unit/Core/Console/RefundTest.php index 359bceb6..5ba0da7f 100644 --- a/tests/Unit/Core/Console/RefundTest.php +++ b/tests/Unit/Core/Console/RefundTest.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Cashbox\Core\Console\Commands\Refund; -use Cashbox\Core\Console\Commands\Verify; use Cashbox\Core\Events\CreatedEvent; use Cashbox\Core\Events\RefundedEvent; use Cashbox\Core\Events\SuccessEvent; @@ -11,7 +10,7 @@ use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; -it('full check', function () { +it('full refund', function () { fakes(); $payment1 = createPayment(TypeEnum::outside); @@ -24,17 +23,9 @@ Event::assertDispatchedTimes(CreatedEvent::class, 4); Event::assertDispatchedTimes(SuccessEvent::class, 4); - $payment3->refresh()->updateQuietly(['status' => StatusEnum::new]); - $payment4->refresh()->updateQuietly(['status' => StatusEnum::new]); - $payment5->refresh()->updateQuietly(['status' => StatusEnum::new]); - $payment6->refresh()->updateQuietly(['status' => StatusEnum::new]); - fakes(); - artisan(Verify::class); - - Event::assertNotDispatched(CreatedEvent::class); - Event::assertDispatchedTimes(SuccessEvent::class, 4); + artisan(Refund::class); expect($payment1->refresh()->status)->toBe(StatusEnum::new); expect($payment2->refresh()->status)->toBe(StatusEnum::new); @@ -42,6 +33,33 @@ expect($payment4->refresh()->status)->toBe(StatusEnum::success); expect($payment5->refresh()->status)->toBe(StatusEnum::success); expect($payment6->refresh()->status)->toBe(StatusEnum::success); + + $payment1->refresh()->created_at = now()->subHour(); + $payment2->refresh()->created_at = now()->subHour(); + $payment3->refresh()->created_at = now()->subHour(); + $payment4->refresh()->created_at = now()->subHour(); + $payment5->refresh()->created_at = now()->subHour(); + $payment6->refresh()->created_at = now()->subHour(); + + $payment1->save(); + $payment2->save(); + $payment3->save(); + $payment4->save(); + $payment5->save(); + $payment6->save(); + + artisan(Refund::class); + + expect($payment1->refresh()->status)->toBe(StatusEnum::new); + expect($payment2->refresh()->status)->toBe(StatusEnum::new); + expect($payment3->refresh()->status)->toBe(StatusEnum::refund); + expect($payment4->refresh()->status)->toBe(StatusEnum::refund); + expect($payment5->refresh()->status)->toBe(StatusEnum::refund); + expect($payment6->refresh()->status)->toBe(StatusEnum::refund); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertNotDispatched(SuccessEvent::class); + Event::assertDispatchedTimes(RefundedEvent::class, 4); }); it('partial verification', function () { @@ -57,22 +75,29 @@ Event::assertDispatchedTimes(CreatedEvent::class, 4); Event::assertDispatchedTimes(SuccessEvent::class, 4); - $payment5->refresh()->updateQuietly(['status' => StatusEnum::new]); - $payment6->refresh()->updateQuietly(['status' => StatusEnum::new]); + $payment3->refresh()->created_at = now()->subHour(); + $payment4->refresh()->created_at = now()->subHour(); - fakes(); + $payment3->save(); + $payment4->save(); - artisan(Verify::class); + $payment5->refresh()->updateQuietly(['status' => StatusEnum::refund]); + $payment6->refresh()->updateQuietly(['status' => StatusEnum::refund]); - Event::assertNotDispatched(CreatedEvent::class); - Event::assertDispatchedTimes(SuccessEvent::class, 2); + fakes(); + + artisan(Refund::class); expect($payment1->refresh()->status)->toBe(StatusEnum::new); expect($payment2->refresh()->status)->toBe(StatusEnum::new); - expect($payment3->refresh()->status)->toBe(StatusEnum::success); - expect($payment4->refresh()->status)->toBe(StatusEnum::success); - expect($payment5->refresh()->status)->toBe(StatusEnum::success); - expect($payment6->refresh()->status)->toBe(StatusEnum::success); + expect($payment3->refresh()->status)->toBe(StatusEnum::refund); + expect($payment4->refresh()->status)->toBe(StatusEnum::refund); + expect($payment5->refresh()->status)->toBe(StatusEnum::refund); + expect($payment6->refresh()->status)->toBe(StatusEnum::refund); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertNotDispatched(SuccessEvent::class); + Event::assertDispatchedTimes(RefundedEvent::class, 2); }); it('refund by ID', function () { @@ -88,11 +113,6 @@ Event::assertDispatchedTimes(CreatedEvent::class, 4); Event::assertDispatchedTimes(SuccessEvent::class, 4); - $payment3->refresh()->updateQuietly(['status' => StatusEnum::new]); - $payment4->refresh()->updateQuietly(['status' => StatusEnum::new]); - $payment5->refresh()->updateQuietly(['status' => StatusEnum::new]); - $payment6->refresh()->updateQuietly(['status' => StatusEnum::new]); - fakes(); artisan(Refund::class, [ @@ -100,13 +120,44 @@ ]); Event::assertNotDispatched(CreatedEvent::class); - Event::assertDispatchedTimes(SuccessEvent::class); + Event::assertNotDispatched(SuccessEvent::class); Event::assertDispatchedTimes(RefundedEvent::class); expect($payment1->refresh()->status)->toBe(StatusEnum::new); expect($payment2->refresh()->status)->toBe(StatusEnum::new); - expect($payment3->refresh()->status)->toBe(StatusEnum::new); + expect($payment3->refresh()->status)->toBe(StatusEnum::success); + expect($payment4->refresh()->status)->toBe(StatusEnum::refund); + expect($payment5->refresh()->status)->toBe(StatusEnum::success); + expect($payment6->refresh()->status)->toBe(StatusEnum::success); +}); + +it('with force option', function () { + fakes(); + + $payment1 = createPayment(TypeEnum::outside); + $payment2 = createPayment(TypeEnum::outside); + $payment3 = createPayment(TypeEnum::cash); + $payment4 = createPayment(TypeEnum::cash); + $payment5 = createPayment(TypeEnum::cash); + $payment6 = createPayment(TypeEnum::cash); + + Event::assertDispatchedTimes(CreatedEvent::class, 4); + Event::assertDispatchedTimes(SuccessEvent::class, 4); + + fakes(); + + artisan(Refund::class, [ + '--force' => true, + ]); + + expect($payment1->refresh()->status)->toBe(StatusEnum::new); + expect($payment2->refresh()->status)->toBe(StatusEnum::new); + expect($payment3->refresh()->status)->toBe(StatusEnum::refund); expect($payment4->refresh()->status)->toBe(StatusEnum::refund); - expect($payment5->refresh()->status)->toBe(StatusEnum::new); - expect($payment6->refresh()->status)->toBe(StatusEnum::new); + expect($payment5->refresh()->status)->toBe(StatusEnum::refund); + expect($payment6->refresh()->status)->toBe(StatusEnum::refund); + + Event::assertNotDispatched(CreatedEvent::class); + Event::assertNotDispatched(SuccessEvent::class); + Event::assertDispatchedTimes(RefundedEvent::class, 4); }); diff --git a/tests/Unit/Core/Console/VerifyTest.php b/tests/Unit/Core/Console/VerifyTest.php index 9db590c3..1ba3fe77 100644 --- a/tests/Unit/Core/Console/VerifyTest.php +++ b/tests/Unit/Core/Console/VerifyTest.php @@ -9,7 +9,7 @@ use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; -it('full check', function () { +it('full verification', function () { fakes(); $payment1 = createPayment(TypeEnum::outside); From ee92b72dbea487b2f0f93b7af544a22f8b98476f Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 17 Jul 2023 02:31:38 +0300 Subject: [PATCH 095/164] Preparing to implement the Tinkoff Credit driver --- .../External/BankInternalErrorException.php | 9 ++ .../External/BuyerNotFoundClientException.php | 9 ++ .../External/CardHasStolenException.php | 9 ++ .../ContactTheSellerClientException.php | 9 ++ .../External/IncorrectSumException.php | 9 ++ .../InsufficientFundsCardException.php | 9 ++ .../External/InvalidCardException.php | 9 ++ .../External/PaymentCompletedException.php | 9 ++ .../PaymentTypeNotAvailableException.php | 9 ++ .../External/TooManyRequestsException.php | 9 ++ .../External/TryAgainLaterClientException.php | 9 ++ src/TinkoffCredit/src/Driver.php | 38 +++---- .../src/Exceptions/Exception.php | 87 ++++++++++++++ ...ption.php => PaymentNotFoundException.php} | 8 +- ...eption.php => RefundDeclinedException.php} | 8 +- src/TinkoffCredit/src/Exceptions/Manager.php | 106 ------------------ .../src/Http/Resources/Response.php | 42 +++++++ .../src/{Helpers => Services}/Statuses.php | 18 +-- tests/Fixtures/App/Enums/TypeEnum.php | 6 +- .../{Drivers/Cash => }/Payments/Cash.php | 2 +- tests/Fixtures/Payments/Tinkoff.php | 21 ++++ tests/Pest.php | 8 ++ tests/TestCase.php | 14 ++- tests/Unit/Core/Facades/ConfigTest.php | 5 +- .../Drivers/TinkoffCredit/CreatedTest.php | 45 ++++++++ .../Unit/Drivers/TinkoffCredit/RefundTest.php | 47 ++++++++ .../Unit/Drivers/TinkoffCredit/VerifyTest.php | 58 ++++++++++ 27 files changed, 451 insertions(+), 161 deletions(-) create mode 100644 src/Core/src/Exceptions/External/BankInternalErrorException.php create mode 100644 src/Core/src/Exceptions/External/BuyerNotFoundClientException.php create mode 100644 src/Core/src/Exceptions/External/CardHasStolenException.php create mode 100644 src/Core/src/Exceptions/External/ContactTheSellerClientException.php create mode 100644 src/Core/src/Exceptions/External/IncorrectSumException.php create mode 100644 src/Core/src/Exceptions/External/InsufficientFundsCardException.php create mode 100644 src/Core/src/Exceptions/External/InvalidCardException.php create mode 100644 src/Core/src/Exceptions/External/PaymentCompletedException.php create mode 100644 src/Core/src/Exceptions/External/PaymentTypeNotAvailableException.php create mode 100644 src/Core/src/Exceptions/External/TooManyRequestsException.php create mode 100644 src/Core/src/Exceptions/External/TryAgainLaterClientException.php create mode 100644 src/TinkoffCredit/src/Exceptions/Exception.php rename src/TinkoffCredit/src/Exceptions/Http/{NotFoundException.php => PaymentNotFoundException.php} (69%) rename src/TinkoffCredit/src/Exceptions/Http/{CancelDeniedException.php => RefundDeclinedException.php} (69%) delete mode 100644 src/TinkoffCredit/src/Exceptions/Manager.php create mode 100644 src/TinkoffCredit/src/Http/Resources/Response.php rename src/TinkoffCredit/src/{Helpers => Services}/Statuses.php (65%) rename tests/Fixtures/{Drivers/Cash => }/Payments/Cash.php (87%) create mode 100644 tests/Fixtures/Payments/Tinkoff.php create mode 100644 tests/Unit/Drivers/TinkoffCredit/CreatedTest.php create mode 100644 tests/Unit/Drivers/TinkoffCredit/RefundTest.php create mode 100644 tests/Unit/Drivers/TinkoffCredit/VerifyTest.php diff --git a/src/Core/src/Exceptions/External/BankInternalErrorException.php b/src/Core/src/Exceptions/External/BankInternalErrorException.php new file mode 100644 index 00000000..76810ff2 --- /dev/null +++ b/src/Core/src/Exceptions/External/BankInternalErrorException.php @@ -0,0 +1,9 @@ +model); - - return $this->request($request, Created::class); + return $this->request(CreateRequest::class); } - public function check(): Response + public function refund(): BaseInfoData { - $request = GetState::make($this->model); - - return $this->request($request, State::class); + return $this->request(RefundRequest::class); } - public function refund(): Response + public function verify(): BaseInfoData { - $request = Cancel::make($this->model); - - return $this->request($request, Refund::class); + return $this->request(VerifyRequest::class); } } diff --git a/src/TinkoffCredit/src/Exceptions/Exception.php b/src/TinkoffCredit/src/Exceptions/Exception.php new file mode 100644 index 00000000..c759a24d --- /dev/null +++ b/src/TinkoffCredit/src/Exceptions/Exception.php @@ -0,0 +1,87 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://github.com/cashbox-laravel/foundation + */ + +namespace Cashbox\Tinkoff\Credit\Exceptions; + +use Cashbox\Core\Exceptions\External\BankInternalErrorException; +use Cashbox\Core\Exceptions\External\BuyerNotFoundClientException; +use Cashbox\Core\Exceptions\External\CardHasStolenException; +use Cashbox\Core\Exceptions\External\ContactTheSellerClientException; +use Cashbox\Core\Exceptions\External\IncorrectSumException; +use Cashbox\Core\Exceptions\External\InsufficientFundsCardException; +use Cashbox\Core\Exceptions\External\InvalidCardException; +use Cashbox\Core\Exceptions\External\PaymentCompletedException; +use Cashbox\Core\Exceptions\External\PaymentTypeNotAvailableException; +use Cashbox\Core\Exceptions\External\TooManyRequestsException; +use Cashbox\Core\Exceptions\External\TryAgainLaterClientException; +use Cashbox\Core\Services\Exception as BaseException; +use Cashbox\Tinkoff\Credit\Exceptions\Http\PaymentNotFoundException; +use Cashbox\Tinkoff\Credit\Exceptions\Http\RefundDeclinedException; + +class Exception extends BaseException +{ + protected array $codes = [ + 7 => BuyerNotFoundClientException::class, + 53 => ContactTheSellerClientException::class, + 99 => RefundDeclinedException::class, + 100 => TryAgainLaterClientException::class, + 102 => RefundDeclinedException::class, + 103 => TryAgainLaterClientException::class, + 119 => TooManyRequestsException::class, + 403 => RefundDeclinedException::class, + 404 => PaymentNotFoundException::class, + 604 => RefundDeclinedException::class, + 620 => IncorrectSumException::class, + 623 => PaymentCompletedException::class, + 642 => InvalidCardException::class, + 1004 => CardHasStolenException::class, + 1005 => RefundDeclinedException::class, + 1007 => CardHasStolenException::class, + 1008 => RefundDeclinedException::class, + 1012 => RefundDeclinedException::class, + 1013 => TryAgainLaterClientException::class, + 1014 => InvalidCardException::class, + 1015 => TryAgainLaterClientException::class, + 1019 => RefundDeclinedException::class, + 1030 => TryAgainLaterClientException::class, + 1033 => InvalidCardException::class, + 1034 => TryAgainLaterClientException::class, + 1039 => RefundDeclinedException::class, + 1041 => CardHasStolenException::class, + 1043 => CardHasStolenException::class, + 1051 => InsufficientFundsCardException::class, + 1053 => RefundDeclinedException::class, + 1054 => InvalidCardException::class, + 1057 => InvalidCardException::class, + 1058 => InvalidCardException::class, + 1059 => CardHasStolenException::class, + 1061 => InvalidCardException::class, + 1062 => InvalidCardException::class, + 1063 => InvalidCardException::class, + 1064 => IncorrectSumException::class, + 1065 => RefundDeclinedException::class, + 1076 => RefundDeclinedException::class, + 1089 => TryAgainLaterClientException::class, + 1091 => TryAgainLaterClientException::class, + 1092 => RefundDeclinedException::class, + 1093 => CardHasStolenException::class, + 1094 => BankInternalErrorException::class, + 1096 => TryAgainLaterClientException::class, + 3001 => PaymentTypeNotAvailableException::class, + 9999 => BankInternalErrorException::class, + ]; + + protected array $reasonKeys = ['Message', 'Data', 'errors']; +} diff --git a/src/TinkoffCredit/src/Exceptions/Http/NotFoundException.php b/src/TinkoffCredit/src/Exceptions/Http/PaymentNotFoundException.php similarity index 69% rename from src/TinkoffCredit/src/Exceptions/Http/NotFoundException.php rename to src/TinkoffCredit/src/Exceptions/Http/PaymentNotFoundException.php index b4074ae2..dcd1ae28 100644 --- a/src/TinkoffCredit/src/Exceptions/Http/NotFoundException.php +++ b/src/TinkoffCredit/src/Exceptions/Http/PaymentNotFoundException.php @@ -15,11 +15,11 @@ namespace Cashbox\Tinkoff\Credit\Exceptions\Http; -use Cashbox\Core\Exceptions\Http\BaseException; +use Cashbox\Core\Exceptions\BaseException; -class NotFoundException extends BaseException +class PaymentNotFoundException extends BaseException { - protected $status_code = 404; + protected int $statusCode = 404; - protected $reason = 'Payment not found'; + protected string $reason = 'Payment not found'; } diff --git a/src/TinkoffCredit/src/Exceptions/Http/CancelDeniedException.php b/src/TinkoffCredit/src/Exceptions/Http/RefundDeclinedException.php similarity index 69% rename from src/TinkoffCredit/src/Exceptions/Http/CancelDeniedException.php rename to src/TinkoffCredit/src/Exceptions/Http/RefundDeclinedException.php index d6cc6af1..4d5e6352 100644 --- a/src/TinkoffCredit/src/Exceptions/Http/CancelDeniedException.php +++ b/src/TinkoffCredit/src/Exceptions/Http/RefundDeclinedException.php @@ -15,11 +15,11 @@ namespace Cashbox\Tinkoff\Credit\Exceptions\Http; -use Cashbox\Core\Exceptions\Http\BaseException; +use Cashbox\Core\Exceptions\BaseException; -class CancelDeniedException extends BaseException +class RefundDeclinedException extends BaseException { - protected $status_code = 403; + protected int $statusCode = 403; - protected $reason = 'Payment not found'; + protected string $reason = 'Refund declined'; } diff --git a/src/TinkoffCredit/src/Exceptions/Manager.php b/src/TinkoffCredit/src/Exceptions/Manager.php deleted file mode 100644 index 40693932..00000000 --- a/src/TinkoffCredit/src/Exceptions/Manager.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -namespace Cashbox\Tinkoff\Credit\Exceptions; - -use Cashbox\Core\Exceptions\Http\BankInternalErrorException; -use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; -use Cashbox\Core\Exceptions\Http\CardHasStolenException; -use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; -use Cashbox\Core\Exceptions\Http\InsufficientFundsCardException; -use Cashbox\Core\Exceptions\Http\InvalidCardException; -use Cashbox\Core\Exceptions\Http\PaymentCompletedException; -use Cashbox\Core\Exceptions\Http\PaymentDeclinedException; -use Cashbox\Core\Exceptions\Http\PaymentTypeNotAvailableException; -use Cashbox\Core\Exceptions\Http\SumException; -use Cashbox\Core\Exceptions\Http\TooManyRequestsException; -use Cashbox\Core\Exceptions\Http\TryAgainLaterClientException; -use Cashbox\Core\Exceptions\Manager as ExceptionManager; -use Cashbox\Tinkoff\Credit\Exceptions\Http\CancelDeniedException; -use Cashbox\Tinkoff\Credit\Exceptions\Http\NotFoundException; -use Illuminate\Support\Arr; - -class Manager extends ExceptionManager -{ - protected $codes = [ - 7 => BuyerNotFoundClientException::class, - 53 => ContactTheSellerClientException::class, - 99 => PaymentDeclinedException::class, - 100 => TryAgainLaterClientException::class, - 102 => PaymentDeclinedException::class, - 103 => TryAgainLaterClientException::class, - 119 => TooManyRequestsException::class, - 403 => CancelDeniedException::class, - 404 => NotFoundException::class, - 604 => PaymentDeclinedException::class, - 620 => SumException::class, - 623 => PaymentCompletedException::class, - 642 => InvalidCardException::class, - 1004 => CardHasStolenException::class, - 1005 => PaymentDeclinedException::class, - 1007 => CardHasStolenException::class, - 1008 => PaymentDeclinedException::class, - 1012 => PaymentDeclinedException::class, - 1013 => TryAgainLaterClientException::class, - 1014 => InvalidCardException::class, - 1015 => TryAgainLaterClientException::class, - 1019 => PaymentDeclinedException::class, - 1030 => TryAgainLaterClientException::class, - 1033 => InvalidCardException::class, - 1034 => TryAgainLaterClientException::class, - 1039 => PaymentDeclinedException::class, - 1041 => CardHasStolenException::class, - 1043 => CardHasStolenException::class, - 1051 => InsufficientFundsCardException::class, - 1053 => PaymentDeclinedException::class, - 1054 => InvalidCardException::class, - 1057 => InvalidCardException::class, - 1058 => InvalidCardException::class, - 1059 => CardHasStolenException::class, - 1061 => InvalidCardException::class, - 1062 => InvalidCardException::class, - 1063 => InvalidCardException::class, - 1064 => SumException::class, - 1065 => PaymentDeclinedException::class, - 1076 => PaymentDeclinedException::class, - 1089 => TryAgainLaterClientException::class, - 1091 => TryAgainLaterClientException::class, - 1092 => PaymentDeclinedException::class, - 1093 => CardHasStolenException::class, - 1094 => BankInternalErrorException::class, - 1096 => TryAgainLaterClientException::class, - 3001 => PaymentTypeNotAvailableException::class, - 9999 => BankInternalErrorException::class, - ]; - - protected $reason_keys = ['Message', 'Data', 'errors']; - - protected function getReason(array $response): ?string - { - foreach ($this->reason_keys as $key) { - if ($value = Arr::get($response, $key)) { - if (is_string($value)) { - return $value; - } - - if (is_array($value)) { - return Arr::first($value); - } - } - } - - return ! empty($response) ? Arr::first($response) : null; - } -} diff --git a/src/TinkoffCredit/src/Http/Resources/Response.php b/src/TinkoffCredit/src/Http/Resources/Response.php new file mode 100644 index 00000000..0ca29543 --- /dev/null +++ b/src/TinkoffCredit/src/Http/Resources/Response.php @@ -0,0 +1,42 @@ + $this->getExternalId(), + 'operationId' => $this->getOperationId(), + 'status' => $this->getStatus(), + 'extra' => $this->getExtra(), + ]); + } + + protected function getExtra(): ?array + { + return [ + 'url' => $this->url, + ]; + } + + protected function getStatus(): ?string + { + return $this->status; + } +} diff --git a/src/TinkoffCredit/src/Helpers/Statuses.php b/src/TinkoffCredit/src/Services/Statuses.php similarity index 65% rename from src/TinkoffCredit/src/Helpers/Statuses.php rename to src/TinkoffCredit/src/Services/Statuses.php index bc20678f..d6a4fbbe 100644 --- a/src/TinkoffCredit/src/Helpers/Statuses.php +++ b/src/TinkoffCredit/src/Services/Statuses.php @@ -13,23 +13,15 @@ * @see https://github.com/cashbox-laravel/foundation */ -namespace Cashbox\Tinkoff\Credit\Helpers; +namespace Cashbox\Tinkoff\Credit\Services; use Cashbox\Core\Services\Statuses as BaseStatus; class Statuses extends BaseStatus { - public const NEW = [ - 'NEW', - ]; + public const FAILED = ['REJECTED']; + public const NEW = ['NEW']; + public const REFUNDED = ['CANCELED']; public const REFUNDING = []; - public const REFUNDED = [ - 'CANCELED', - ]; - public const FAILED = [ - 'REJECTED', - ]; - public const SUCCESS = [ - 'APPROVED', - ]; + public const SUCCESS = ['APPROVED']; } diff --git a/tests/Fixtures/App/Enums/TypeEnum.php b/tests/Fixtures/App/Enums/TypeEnum.php index e44acfc2..04d2721b 100644 --- a/tests/Fixtures/App/Enums/TypeEnum.php +++ b/tests/Fixtures/App/Enums/TypeEnum.php @@ -9,11 +9,13 @@ /** * @method static string cash() * @method static string outside() + * @method static string tinkoffCredit() */ enum TypeEnum: string { use InvokableCases; - case cash = 'cash'; - case outside = 'outside'; + case cash = 'cash'; + case outside = 'outside'; + case tinkoffCredit = 'tinkoff_credit'; } diff --git a/tests/Fixtures/Drivers/Cash/Payments/Cash.php b/tests/Fixtures/Payments/Cash.php similarity index 87% rename from tests/Fixtures/Drivers/Cash/Payments/Cash.php rename to tests/Fixtures/Payments/Cash.php index 97b0616e..30a97115 100644 --- a/tests/Fixtures/Drivers/Cash/Payments/Cash.php +++ b/tests/Fixtures/Payments/Cash.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Tests\Fixtures\Drivers\Cash\Payments; +namespace Tests\Fixtures\Payments; use Cashbox\Cash\Resources\CashResource; use Cashbox\Core\Enums\CurrencyEnum; diff --git a/tests/Fixtures/Payments/Tinkoff.php b/tests/Fixtures/Payments/Tinkoff.php new file mode 100644 index 00000000..8d81bb8a --- /dev/null +++ b/tests/Fixtures/Payments/Tinkoff.php @@ -0,0 +1,21 @@ +payment->price; + } +} diff --git a/tests/Pest.php b/tests/Pest.php index a1c0181c..a00224ff 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -12,6 +12,7 @@ use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Facade; use Illuminate\Support\Facades\Http; +use Illuminate\Support\Str; use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Support\DataProperty; use Tests\Fixtures\App\Enums\TypeEnum; @@ -57,6 +58,13 @@ function assertDoesntHaveCashbox(PaymentModel $payment): void ); } +function assertIsUrl(string $value): void +{ + expect(true)->toBeTrue( + Str::isUrl($value) + ); +} + /* |-------------------------------------------------------------------------- | Functions diff --git a/tests/TestCase.php b/tests/TestCase.php index e3f50cf1..8662604d 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,20 +2,22 @@ namespace Tests; -use Cashbox\Cash\Driver; +use Cashbox\Cash\Driver as CashDriver; use Cashbox\Core\Enums\AttributeEnum; use Cashbox\Core\Enums\StatusEnum; use Cashbox\Core\Providers\BindingServiceProvider; use Cashbox\Core\Providers\ObserverServiceProvider; use Cashbox\Core\Providers\RateLimiterServiceProvider; use Cashbox\Core\Providers\ServiceProvider; +use Cashbox\Tinkoff\Credit\Driver as TinkoffCreditDriver; use Illuminate\Foundation\Testing\RefreshDatabase; use Orchestra\Testbench\TestCase as BaseTestCase; use Spatie\LaravelData\LaravelDataServiceProvider; use Tests\Fixtures\App\Enums\StatusEnum as TestStatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; use Tests\Fixtures\App\Models\PaymentModel; -use Tests\Fixtures\Drivers\Cash\Payments\Cash; +use Tests\Fixtures\Payments\Cash; +use Tests\Fixtures\Payments\Tinkoff; abstract class TestCase extends BaseTestCase { @@ -46,11 +48,17 @@ protected function getEnvironmentSetUp($app): void $app['config']->set('cashbox.payment.status.' . StatusEnum::failed(), TestStatusEnum::failed); $app['config']->set('cashbox.payment.drivers.' . TypeEnum::cash(), TypeEnum::cash); + $app['config']->set('cashbox.payment.drivers.' . TypeEnum::tinkoffCredit(), TypeEnum::tinkoffCredit); $app['config']->set('cashbox.drivers.' . TypeEnum::cash(), [ - 'driver' => Driver::class, + 'driver' => CashDriver::class, 'resource' => Cash::class, ]); + + $app['config']->set('cashbox.drivers.' . TypeEnum::tinkoffCredit(), [ + 'driver' => TinkoffCreditDriver::class, + 'resource' => Tinkoff::class, + ]); } protected function defineDatabaseMigrations(): void diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 0da92140..8bfbd1f4 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -2,7 +2,6 @@ declare(strict_types=1); -use Cashbox\Cash\Driver as CashDriver; use Cashbox\Core\Exceptions\Internal\ConfigCannotBeEmptyException; use Cashbox\Core\Exceptions\Internal\IncorrectDriverException; use Cashbox\Core\Exceptions\Internal\IncorrectResourceException; @@ -13,7 +12,7 @@ use Tests\Fixtures\App\Enums\TypeEnum; use Tests\Fixtures\App\Models\PaymentModel; use Tests\Fixtures\Data\FakeData; -use Tests\Fixtures\Drivers\Cash\Payments\Cash; +use Tests\Fixtures\Payments\Cash; it('should return an error when running an empty config file', function () { forgetConfig(); @@ -95,7 +94,7 @@ // cash $cash = Config::driver(TypeEnum::cash()); - expect($cash->driver)->toBe(CashDriver::class); + expect($cash->driver)->toBe(Driver::class); expect($cash->resource)->toBe(Cash::class); expect($cash->credentials)->toBeNull(); expect($cash->queue)->toBeNull(); diff --git a/tests/Unit/Drivers/TinkoffCredit/CreatedTest.php b/tests/Unit/Drivers/TinkoffCredit/CreatedTest.php new file mode 100644 index 00000000..da724d7c --- /dev/null +++ b/tests/Unit/Drivers/TinkoffCredit/CreatedTest.php @@ -0,0 +1,45 @@ +type)->toBe(TypeEnum::tinkoffCredit); + expect($payment->status)->toBe(StatusEnum::new); + + assertHasCashbox($payment); + + $payment->refresh(); + + expect(StatusEnum::new)->toBe( + $payment->cashboxDriver()->statuses()->detect($payment->cashbox->info->status) + ); + + expect($payment->cashbox->info->externalId)->toBeString()->toMatch( + '/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/' + ); + + assertIsUrl($payment->cashbox->info->extra['url']); + + Event::assertDispatchedTimes(CreatedEvent::class); + + Event::assertNotDispatched(SuccessEvent::class); + Event::assertNotDispatched(FailedEvent::class); + Event::assertNotDispatched(RefundedEvent::class); + Event::assertNotDispatched(WaitRefundEvent::class); + + Http::assertNothingSent(); +}); diff --git a/tests/Unit/Drivers/TinkoffCredit/RefundTest.php b/tests/Unit/Drivers/TinkoffCredit/RefundTest.php new file mode 100644 index 00000000..96b173c7 --- /dev/null +++ b/tests/Unit/Drivers/TinkoffCredit/RefundTest.php @@ -0,0 +1,47 @@ +type)->toBe(TypeEnum::tinkoffCredit); + expect($payment->status)->toBe(StatusEnum::new); + + assertHasCashbox($payment); + + throw new Exception('TODO: change a test'); + + $payment->refresh(); + + expect(StatusEnum::new)->toBe( + $payment->cashboxDriver()->statuses()->detect($payment->cashbox->info->status) + ); + + expect($payment->cashbox->info->externalId)->toBeString()->toMatch( + '/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/' + ); + + assertIsUrl($payment->cashbox->info->extra['url']); + + Event::assertDispatchedTimes(CreatedEvent::class); + + Event::assertNotDispatched(SuccessEvent::class); + Event::assertNotDispatched(FailedEvent::class); + Event::assertNotDispatched(RefundedEvent::class); + Event::assertNotDispatched(WaitRefundEvent::class); + + Http::assertNothingSent(); +}); diff --git a/tests/Unit/Drivers/TinkoffCredit/VerifyTest.php b/tests/Unit/Drivers/TinkoffCredit/VerifyTest.php new file mode 100644 index 00000000..4ab8332c --- /dev/null +++ b/tests/Unit/Drivers/TinkoffCredit/VerifyTest.php @@ -0,0 +1,58 @@ +type)->toBe(TypeEnum::tinkoffCredit); + expect($payment->status)->toBe(StatusEnum::new); + + assertHasCashbox($payment); + + expect(StatusEnum::new)->toBe( + $payment->cashboxDriver()->statuses()->detect($payment->cashbox->info->status) + ); + + expect($payment->cashbox->info->externalId)->toBeString()->toMatch( + '/^demo-\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/' + ); + + assertIsUrl($payment->cashbox->info->extra['url']); + + // verify + $payment->cashboxJob()->verify(); + + $payment->refresh(); + + expect(StatusEnum::new)->toBe( + $payment->cashboxDriver()->statuses()->detect($payment->cashbox->info->status) + ); + + expect($payment->cashbox->info->externalId)->toBeString()->toMatch( + '/^\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b$/' + ); + + assertIsUrl($payment->cashbox->info->extra['url']); + + Event::assertDispatchedTimes(CreatedEvent::class); + Event::assertDispatchedTimes(SuccessEvent::class, 2); + + Event::assertNotDispatched(FailedEvent::class); + Event::assertNotDispatched(RefundedEvent::class); + Event::assertNotDispatched(WaitRefundEvent::class); + + Http::assertNothingSent(); +}); From 1ca53650ef47db242c49b939278f46eee8716c7c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 17 Jul 2023 17:24:00 +0300 Subject: [PATCH 096/164] Fixed tests.yml --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 84c5bc70..1975196b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -44,7 +44,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --parallel --colors=always + run: vendor/bin/pest --parallel --ansi env: DB_CONNECTION: mysql DB_USERNAME: root @@ -90,7 +90,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --parallel --colors=always + run: vendor/bin/pest --parallel --ansi env: DB_CONNECTION: mysql DB_USERNAME: root @@ -137,7 +137,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --parallel --colors=always + run: vendor/bin/pest --parallel --ansi env: DB_CONNECTION: pgsql DB_PASSWORD: password @@ -182,7 +182,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --parallel --colors=always + run: vendor/bin/pest --parallel --ansi env: DB_CONNECTION: sqlsrv DB_DATABASE: master From 3644893ae428716d364c40d1deae3c5a98e04687 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 17 Jul 2023 17:36:59 +0300 Subject: [PATCH 097/164] Updated templates for GitHub --- .github/ISSUE_TEMPLATE/1_Bug_report.md | 28 --------- .github/ISSUE_TEMPLATE/1_bug_report.yml | 64 ++++++++++++++++++++ .github/ISSUE_TEMPLATE/2_Feature_request.md | 9 --- .github/ISSUE_TEMPLATE/2_feature_request.yml | 10 +++ .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 4 ++ 6 files changed, 79 insertions(+), 38 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/1_Bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/1_bug_report.yml delete mode 100644 .github/ISSUE_TEMPLATE/2_Feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/2_feature_request.yml diff --git a/.github/ISSUE_TEMPLATE/1_Bug_report.md b/.github/ISSUE_TEMPLATE/1_Bug_report.md deleted file mode 100644 index da61b78f..00000000 --- a/.github/ISSUE_TEMPLATE/1_Bug_report.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -name: "Bug report" -about: "Report something that's broken" ---- - - - - -- Cashier Version: #.#.# -- Cashier Driver & Version: -- PHP Version: #.#.# -- Laravel/Lumen Framework Version: #.#.# -- Database Driver & Version: - -### Description: - - -### Steps To Reproduce: - - -### Execution result: - -
- Show result - - // paste result here - -
diff --git a/.github/ISSUE_TEMPLATE/1_bug_report.yml b/.github/ISSUE_TEMPLATE/1_bug_report.yml new file mode 100644 index 00000000..84be752e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/1_bug_report.yml @@ -0,0 +1,64 @@ +name: Bug Report +description: Report something that's broken. +body: + + - type: markdown + attributes: + value: "Before submitting your report, + [please ensure your Cashbox version is still supported](https://cashbox-laravel.github.io/docs#support-policy)." + + - type: input + attributes: + label: Cashbox Version + description: Provide the Cashbox version that you are using. + placeholder: 4.0.0 + validations: + required: true + + - type: input + attributes: + label: Cashbox Driver + description: If applicable, provide the database driver and version you are using. + placeholder: Cash + validations: + required: false + + - type: input + attributes: + label: Laravel Version + description: Provide the Laravel version that you are using. + placeholder: 10.15.0 + validations: + required: true + + - type: input + attributes: + label: PHP Version + description: Provide the PHP version that you are using. + placeholder: 8.1.4 + validations: + required: true + + - type: input + attributes: + label: Database Driver & Version + description: If applicable, provide the database driver and version you are using. + placeholder: MySQL 8.0.31 for macOS 13.0 on arm64 (Homebrew) + validations: + required: false + + - type: textarea + attributes: + label: Description + description: Provide a detailed description of the issue you are facing. + validations: + required: true + + - type: textarea + attributes: + label: Steps To Reproduce + description: "Provide detailed steps to reproduce your issue. + If necessary, please provide a GitHub repository to demonstrate your issue using + `laravel new bug-report --github=\"--public\"`." + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/2_Feature_request.md b/.github/ISSUE_TEMPLATE/2_Feature_request.md deleted file mode 100644 index 68c41caa..00000000 --- a/.github/ISSUE_TEMPLATE/2_Feature_request.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -name: "Feature request" -about: "New functionality proposal." ---- - - - - -### Description: diff --git a/.github/ISSUE_TEMPLATE/2_feature_request.yml b/.github/ISSUE_TEMPLATE/2_feature_request.yml new file mode 100644 index 00000000..ecc2bd4a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/2_feature_request.yml @@ -0,0 +1,10 @@ +name: Feature request +description: New functionality proposal. +body: + + - type: textarea + attributes: + label: Description + description: Provide a detailed description of the issue you are facing. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 03b1cefc..f0e1837b 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: false contact_links: - name: Support Questions & Other - url: https://github.com/andrey-helldar/cashier/discussions + url: https://github.com/orgs/cashbox-laravel/discussions about: Discuss any issues related to the application or templates working with it. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 8efa1cb9..1841ba2a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,4 +1,8 @@ diff --git a/docs/docs/.vuepress/styles/_fonts.scss b/docs/docs/.vuepress/styles/_fonts.scss index 442e3fa2..fdda966d 100644 --- a/docs/docs/.vuepress/styles/_fonts.scss +++ b/docs/docs/.vuepress/styles/_fonts.scss @@ -1,4 +1,18 @@ +/*!* + * This file is part of the "cashbox/foundation" project. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @author Andrey Helldar + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + + /*!* * This file is part of the "cashbox/foundation" project. * diff --git a/docs/docs/.vuepress/styles/index.scss b/docs/docs/.vuepress/styles/index.scss index 984c8f3d..a141d1d9 100644 --- a/docs/docs/.vuepress/styles/index.scss +++ b/docs/docs/.vuepress/styles/index.scss @@ -1,4 +1,18 @@ +/*!* + * This file is part of the "cashbox/foundation" project. + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @author Andrey Helldar + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + + /*!* * This file is part of the "cashbox/foundation" project. * diff --git a/phpunit.xml b/phpunit.xml index a5622d2a..e800b5a2 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -9,7 +9,7 @@ ~ @copyright 2023 Andrey Helldar ~ @license MIT ~ - ~ @see https://github.com/cashbox-laravel/foundation + ~ @see https://cashbox.city --> + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Cash\Resources; diff --git a/src/Cash/src/Services/Exception.php b/src/Cash/src/Services/Exception.php index ed0417e1..930eda16 100644 --- a/src/Cash/src/Services/Exception.php +++ b/src/Cash/src/Services/Exception.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Cash/src/Services/Statuses.php b/src/Cash/src/Services/Statuses.php index 2baa6486..922620c3 100644 --- a/src/Cash/src/Services/Statuses.php +++ b/src/Cash/src/Services/Statuses.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/config/cashbox.php b/src/Core/config/cashbox.php index 435491df..3f1f7b69 100644 --- a/src/Core/config/cashbox.php +++ b/src/Core/config/cashbox.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php b/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php index 28d069c6..f37bb652 100644 --- a/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php +++ b/src/Core/database/migrations/private/2021_05_26_133447_create_cashier_details_table.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php b/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php index e75ca9be..a54674b2 100644 --- a/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php +++ b/src/Core/database/migrations/private/2023_06_22_004000_drop_cashier_logs_table.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php b/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php index 6b0804d5..72216822 100644 --- a/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php +++ b/src/Core/database/migrations/private/2023_07_08_172343_cashier_details_drop_morph_column.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/database/migrations/private/2023_07_08_195624_cashier_details_rename_details_column.php b/src/Core/database/migrations/private/2023_07_08_195624_cashier_details_rename_details_column.php index cc70295b..a5a0e044 100644 --- a/src/Core/database/migrations/private/2023_07_08_195624_cashier_details_rename_details_column.php +++ b/src/Core/database/migrations/private/2023_07_08_195624_cashier_details_rename_details_column.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php b/src/Core/database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php index 0a794a0c..3da8a291 100644 --- a/src/Core/database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php +++ b/src/Core/database/migrations/private/2023_07_08_223554_cashier_details_create_status_column.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/database/migrations/private/2023_07_14_201238_rename_cashier_details_table_to_cashbox.php b/src/Core/database/migrations/private/2023_07_14_201238_rename_cashier_details_table_to_cashbox.php index 3aae70d3..84ae8e74 100644 --- a/src/Core/database/migrations/private/2023_07_14_201238_rename_cashier_details_table_to_cashbox.php +++ b/src/Core/database/migrations/private/2023_07_14_201238_rename_cashier_details_table_to_cashbox.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Concerns\Migrations\PrivateMigration; diff --git a/src/Core/database/migrations/private/2023_07_16_145907_clearing_old_data.php b/src/Core/database/migrations/private/2023_07_16_145907_clearing_old_data.php index b8b03ff2..348af60b 100644 --- a/src/Core/database/migrations/private/2023_07_16_145907_clearing_old_data.php +++ b/src/Core/database/migrations/private/2023_07_16_145907_clearing_old_data.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Concerns\Migrations\PrivateMigration; diff --git a/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php b/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php index 6b143034..c956ab6f 100644 --- a/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php +++ b/src/Core/database/migrations/public/2021_06_25_205531_change_payments_table_add_cashier_index.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php b/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php index 9c7e47bd..43296c89 100644 --- a/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php +++ b/src/Core/database/migrations/public/2021_10_14_172234_change_payments_table_optimize_index.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/phpunit.xml b/src/Core/phpunit.xml index 79fa0bf8..fb114a8f 100644 --- a/src/Core/phpunit.xml +++ b/src/Core/phpunit.xml @@ -9,7 +9,7 @@ ~ @copyright 2023 Andrey Helldar ~ @license MIT ~ - ~ @see https://github.com/cashbox-laravel/foundation + ~ @see https://cashbox.city --> + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Concerns\Helpers; diff --git a/src/Core/src/Concerns/Helpers/Jobs.php b/src/Core/src/Concerns/Helpers/Jobs.php index 846ca64c..98bd4b69 100644 --- a/src/Core/src/Concerns/Helpers/Jobs.php +++ b/src/Core/src/Concerns/Helpers/Jobs.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Concerns/Helpers/Logging.php b/src/Core/src/Concerns/Helpers/Logging.php index 74766e1f..82147ce2 100644 --- a/src/Core/src/Concerns/Helpers/Logging.php +++ b/src/Core/src/Concerns/Helpers/Logging.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Concerns/Helpers/Validatable.php b/src/Core/src/Concerns/Helpers/Validatable.php index d8b79ca4..6e4c1fac 100644 --- a/src/Core/src/Concerns/Helpers/Validatable.php +++ b/src/Core/src/Concerns/Helpers/Validatable.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Concerns/Migrations/PrivateMigration.php b/src/Core/src/Concerns/Migrations/PrivateMigration.php index 83fd1ddd..0bc67b4b 100644 --- a/src/Core/src/Concerns/Migrations/PrivateMigration.php +++ b/src/Core/src/Concerns/Migrations/PrivateMigration.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Concerns/Migrations/PublicMigration.php b/src/Core/src/Concerns/Migrations/PublicMigration.php index 6dae7e58..53e72cfb 100644 --- a/src/Core/src/Concerns/Migrations/PublicMigration.php +++ b/src/Core/src/Concerns/Migrations/PublicMigration.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Concerns/Permissions/Allowable.php b/src/Core/src/Concerns/Permissions/Allowable.php index 4e70cb9e..f6ce5f72 100644 --- a/src/Core/src/Concerns/Permissions/Allowable.php +++ b/src/Core/src/Concerns/Permissions/Allowable.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Concerns/Repositories/Registry.php b/src/Core/src/Concerns/Repositories/Registry.php index ff30ae1f..ed0ca678 100644 --- a/src/Core/src/Concerns/Repositories/Registry.php +++ b/src/Core/src/Concerns/Repositories/Registry.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Concerns\Repositories; diff --git a/src/Core/src/Concerns/Transformers/EnumsTransformer.php b/src/Core/src/Concerns/Transformers/EnumsTransformer.php index 092ac5ca..a8e276ce 100644 --- a/src/Core/src/Concerns/Transformers/EnumsTransformer.php +++ b/src/Core/src/Concerns/Transformers/EnumsTransformer.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Console/Commands/Command.php b/src/Core/src/Console/Commands/Command.php index 7ca8e91a..9764f78a 100644 --- a/src/Core/src/Console/Commands/Command.php +++ b/src/Core/src/Console/Commands/Command.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Console/Commands/Refund.php b/src/Core/src/Console/Commands/Refund.php index a4b2f135..2ec568cf 100644 --- a/src/Core/src/Console/Commands/Refund.php +++ b/src/Core/src/Console/Commands/Refund.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Console/Commands/Verify.php b/src/Core/src/Console/Commands/Verify.php index 616fcfb6..06d45da9 100644 --- a/src/Core/src/Console/Commands/Verify.php +++ b/src/Core/src/Console/Commands/Verify.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Casts/FromEnumCast.php b/src/Core/src/Data/Casts/FromEnumCast.php index f305416d..3139364d 100644 --- a/src/Core/src/Data/Casts/FromEnumCast.php +++ b/src/Core/src/Data/Casts/FromEnumCast.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ namespace Cashbox\Core\Data\Casts; diff --git a/src/Core/src/Data/Casts/Instances/InstanceOfCast.php b/src/Core/src/Data/Casts/Instances/InstanceOfCast.php index 329fea6a..1f5a0d31 100644 --- a/src/Core/src/Data/Casts/Instances/InstanceOfCast.php +++ b/src/Core/src/Data/Casts/Instances/InstanceOfCast.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Casts/NumberCast.php b/src/Core/src/Data/Casts/NumberCast.php index 161c2f8d..cfaf1a2f 100644 --- a/src/Core/src/Data/Casts/NumberCast.php +++ b/src/Core/src/Data/Casts/NumberCast.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ namespace Cashbox\Core\Data\Casts; diff --git a/src/Core/src/Data/Config/ConfigData.php b/src/Core/src/Data/Config/ConfigData.php index b418a004..ccfc9bd5 100644 --- a/src/Core/src/Data/Config/ConfigData.php +++ b/src/Core/src/Data/Config/ConfigData.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Config/DetailsData.php b/src/Core/src/Data/Config/DetailsData.php index 0b297948..080e26aa 100644 --- a/src/Core/src/Data/Config/DetailsData.php +++ b/src/Core/src/Data/Config/DetailsData.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Config/DriverData.php b/src/Core/src/Data/Config/DriverData.php index 69ef367a..b264d44c 100644 --- a/src/Core/src/Data/Config/DriverData.php +++ b/src/Core/src/Data/Config/DriverData.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Config/Drivers/CredentialsData.php b/src/Core/src/Data/Config/Drivers/CredentialsData.php index a7881db1..9db5918d 100644 --- a/src/Core/src/Data/Config/Drivers/CredentialsData.php +++ b/src/Core/src/Data/Config/Drivers/CredentialsData.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Config/LogsData.php b/src/Core/src/Data/Config/LogsData.php index 16a17f8a..6c2d6bf2 100644 --- a/src/Core/src/Data/Config/LogsData.php +++ b/src/Core/src/Data/Config/LogsData.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Config/Payment/AttributeData.php b/src/Core/src/Data/Config/Payment/AttributeData.php index 11cdf10c..d6b6dd7b 100644 --- a/src/Core/src/Data/Config/Payment/AttributeData.php +++ b/src/Core/src/Data/Config/Payment/AttributeData.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Config/Payment/PaymentData.php b/src/Core/src/Data/Config/Payment/PaymentData.php index 29732e6e..63c66291 100644 --- a/src/Core/src/Data/Config/Payment/PaymentData.php +++ b/src/Core/src/Data/Config/Payment/PaymentData.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Config/Payment/StatusData.php b/src/Core/src/Data/Config/Payment/StatusData.php index e5f099bf..bb34ea3e 100644 --- a/src/Core/src/Data/Config/Payment/StatusData.php +++ b/src/Core/src/Data/Config/Payment/StatusData.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Config/Queue/QueueData.php b/src/Core/src/Data/Config/Queue/QueueData.php index a59ab217..38e8604a 100644 --- a/src/Core/src/Data/Config/Queue/QueueData.php +++ b/src/Core/src/Data/Config/Queue/QueueData.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Config/Queue/QueueNameData.php b/src/Core/src/Data/Config/Queue/QueueNameData.php index 5c114fff..35d911f5 100644 --- a/src/Core/src/Data/Config/Queue/QueueNameData.php +++ b/src/Core/src/Data/Config/Queue/QueueNameData.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Config/RefundData.php b/src/Core/src/Data/Config/RefundData.php index 5356aba7..d02a8111 100644 --- a/src/Core/src/Data/Config/RefundData.php +++ b/src/Core/src/Data/Config/RefundData.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Data/Models/InfoData.php b/src/Core/src/Data/Models/InfoData.php index 26415b29..9e392a9f 100644 --- a/src/Core/src/Data/Models/InfoData.php +++ b/src/Core/src/Data/Models/InfoData.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Data\Models; diff --git a/src/Core/src/Data/Signing/Token.php b/src/Core/src/Data/Signing/Token.php index 7373ea36..cf025d03 100644 --- a/src/Core/src/Data/Signing/Token.php +++ b/src/Core/src/Data/Signing/Token.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Data\Signing; diff --git a/src/Core/src/Enums/AttributeEnum.php b/src/Core/src/Enums/AttributeEnum.php index c61feae0..dec0e3a1 100644 --- a/src/Core/src/Enums/AttributeEnum.php +++ b/src/Core/src/Enums/AttributeEnum.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Enums/CurrencyEnum.php b/src/Core/src/Enums/CurrencyEnum.php index 70b7ab23..df643a3d 100644 --- a/src/Core/src/Enums/CurrencyEnum.php +++ b/src/Core/src/Enums/CurrencyEnum.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Enums/HttpMethodEnum.php b/src/Core/src/Enums/HttpMethodEnum.php index a480b782..7b68f616 100644 --- a/src/Core/src/Enums/HttpMethodEnum.php +++ b/src/Core/src/Enums/HttpMethodEnum.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Enums; diff --git a/src/Core/src/Enums/RateLimiterEnum.php b/src/Core/src/Enums/RateLimiterEnum.php index d8db1fc3..a641767a 100644 --- a/src/Core/src/Enums/RateLimiterEnum.php +++ b/src/Core/src/Enums/RateLimiterEnum.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Enums/StatusEnum.php b/src/Core/src/Enums/StatusEnum.php index 2105f1d7..9eaf7a5e 100644 --- a/src/Core/src/Enums/StatusEnum.php +++ b/src/Core/src/Enums/StatusEnum.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Events/BaseEvent.php b/src/Core/src/Events/BaseEvent.php index 07819119..24deb670 100644 --- a/src/Core/src/Events/BaseEvent.php +++ b/src/Core/src/Events/BaseEvent.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Events/PaymentCreatedEvent.php b/src/Core/src/Events/PaymentCreatedEvent.php index c19972df..ba4f0715 100644 --- a/src/Core/src/Events/PaymentCreatedEvent.php +++ b/src/Core/src/Events/PaymentCreatedEvent.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Events/PaymentFailedEvent.php b/src/Core/src/Events/PaymentFailedEvent.php index 70cead6d..3da1aece 100644 --- a/src/Core/src/Events/PaymentFailedEvent.php +++ b/src/Core/src/Events/PaymentFailedEvent.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Events/PaymentRefundedEvent.php b/src/Core/src/Events/PaymentRefundedEvent.php index 6c36664a..c6348616 100644 --- a/src/Core/src/Events/PaymentRefundedEvent.php +++ b/src/Core/src/Events/PaymentRefundedEvent.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Events/PaymentSuccessEvent.php b/src/Core/src/Events/PaymentSuccessEvent.php index 51729041..c0197873 100644 --- a/src/Core/src/Events/PaymentSuccessEvent.php +++ b/src/Core/src/Events/PaymentSuccessEvent.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Events/PaymentWaitRefundEvent.php b/src/Core/src/Events/PaymentWaitRefundEvent.php index ea81ff87..cf167452 100644 --- a/src/Core/src/Events/PaymentWaitRefundEvent.php +++ b/src/Core/src/Events/PaymentWaitRefundEvent.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Exceptions/BaseException.php b/src/Core/src/Exceptions/BaseException.php index 82d95554..7205081f 100644 --- a/src/Core/src/Exceptions/BaseException.php +++ b/src/Core/src/Exceptions/BaseException.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Exceptions/External/BadRequestClientException.php b/src/Core/src/Exceptions/External/BadRequestClientException.php index 91b5e7db..ed3a5787 100644 --- a/src/Core/src/Exceptions/External/BadRequestClientException.php +++ b/src/Core/src/Exceptions/External/BadRequestClientException.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Exceptions/External/BankInternalErrorException.php b/src/Core/src/Exceptions/External/BankInternalErrorException.php index 7da1b06e..c70e41e0 100644 --- a/src/Core/src/Exceptions/External/BankInternalErrorException.php +++ b/src/Core/src/Exceptions/External/BankInternalErrorException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/External/BuyerNotFoundClientException.php b/src/Core/src/Exceptions/External/BuyerNotFoundClientException.php index dae3d831..a73d9088 100644 --- a/src/Core/src/Exceptions/External/BuyerNotFoundClientException.php +++ b/src/Core/src/Exceptions/External/BuyerNotFoundClientException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/External/CardHasStolenException.php b/src/Core/src/Exceptions/External/CardHasStolenException.php index e89db964..9c59225f 100644 --- a/src/Core/src/Exceptions/External/CardHasStolenException.php +++ b/src/Core/src/Exceptions/External/CardHasStolenException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/External/ContactTheSellerClientException.php b/src/Core/src/Exceptions/External/ContactTheSellerClientException.php index 163df14e..8e4c9967 100644 --- a/src/Core/src/Exceptions/External/ContactTheSellerClientException.php +++ b/src/Core/src/Exceptions/External/ContactTheSellerClientException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/External/EmptyResponseException.php b/src/Core/src/Exceptions/External/EmptyResponseException.php index f71248d6..1a84ec5a 100644 --- a/src/Core/src/Exceptions/External/EmptyResponseException.php +++ b/src/Core/src/Exceptions/External/EmptyResponseException.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Exceptions/External/IncorrectSumException.php b/src/Core/src/Exceptions/External/IncorrectSumException.php index d27aca5e..77f50625 100644 --- a/src/Core/src/Exceptions/External/IncorrectSumException.php +++ b/src/Core/src/Exceptions/External/IncorrectSumException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/External/InsufficientFundsCardException.php b/src/Core/src/Exceptions/External/InsufficientFundsCardException.php index 6d453a19..b8787404 100644 --- a/src/Core/src/Exceptions/External/InsufficientFundsCardException.php +++ b/src/Core/src/Exceptions/External/InsufficientFundsCardException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/External/InvalidCardException.php b/src/Core/src/Exceptions/External/InvalidCardException.php index 176c4f8e..f11b5d7a 100644 --- a/src/Core/src/Exceptions/External/InvalidCardException.php +++ b/src/Core/src/Exceptions/External/InvalidCardException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/External/PaymentCompletedException.php b/src/Core/src/Exceptions/External/PaymentCompletedException.php index fd34b7a8..b6d65ccd 100644 --- a/src/Core/src/Exceptions/External/PaymentCompletedException.php +++ b/src/Core/src/Exceptions/External/PaymentCompletedException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/External/PaymentDeclinedException.php b/src/Core/src/Exceptions/External/PaymentDeclinedException.php index ba10fd71..1e7c1868 100644 --- a/src/Core/src/Exceptions/External/PaymentDeclinedException.php +++ b/src/Core/src/Exceptions/External/PaymentDeclinedException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/External/PaymentTypeNotAvailableException.php b/src/Core/src/Exceptions/External/PaymentTypeNotAvailableException.php index edbe996d..7216907d 100644 --- a/src/Core/src/Exceptions/External/PaymentTypeNotAvailableException.php +++ b/src/Core/src/Exceptions/External/PaymentTypeNotAvailableException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/External/TooManyRequestsException.php b/src/Core/src/Exceptions/External/TooManyRequestsException.php index 03bad42e..f7c33feb 100644 --- a/src/Core/src/Exceptions/External/TooManyRequestsException.php +++ b/src/Core/src/Exceptions/External/TooManyRequestsException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/External/TransactionNotFoundException.php b/src/Core/src/Exceptions/External/TransactionNotFoundException.php index cb13c3c1..cbf4e4ef 100644 --- a/src/Core/src/Exceptions/External/TransactionNotFoundException.php +++ b/src/Core/src/Exceptions/External/TransactionNotFoundException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/External/TryAgainLaterClientException.php b/src/Core/src/Exceptions/External/TryAgainLaterClientException.php index 4eb78cd5..35d65ef0 100644 --- a/src/Core/src/Exceptions/External/TryAgainLaterClientException.php +++ b/src/Core/src/Exceptions/External/TryAgainLaterClientException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\External; diff --git a/src/Core/src/Exceptions/Internal/ConfigCannotBeEmptyException.php b/src/Core/src/Exceptions/Internal/ConfigCannotBeEmptyException.php index f1a2ae51..b944c23d 100644 --- a/src/Core/src/Exceptions/Internal/ConfigCannotBeEmptyException.php +++ b/src/Core/src/Exceptions/Internal/ConfigCannotBeEmptyException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\Internal; diff --git a/src/Core/src/Exceptions/Internal/IncorrectDriverException.php b/src/Core/src/Exceptions/Internal/IncorrectDriverException.php index e9b676aa..8cd485cf 100644 --- a/src/Core/src/Exceptions/Internal/IncorrectDriverException.php +++ b/src/Core/src/Exceptions/Internal/IncorrectDriverException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\Internal; diff --git a/src/Core/src/Exceptions/Internal/IncorrectModelException.php b/src/Core/src/Exceptions/Internal/IncorrectModelException.php index caaa103e..f29088a4 100644 --- a/src/Core/src/Exceptions/Internal/IncorrectModelException.php +++ b/src/Core/src/Exceptions/Internal/IncorrectModelException.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Exceptions/Internal/IncorrectResourceException.php b/src/Core/src/Exceptions/Internal/IncorrectResourceException.php index f176c4df..01facd65 100644 --- a/src/Core/src/Exceptions/Internal/IncorrectResourceException.php +++ b/src/Core/src/Exceptions/Internal/IncorrectResourceException.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Exceptions\Internal; diff --git a/src/Core/src/Exceptions/Internal/UnknownDriverConfigException.php b/src/Core/src/Exceptions/Internal/UnknownDriverConfigException.php index be182c93..4a245186 100644 --- a/src/Core/src/Exceptions/Internal/UnknownDriverConfigException.php +++ b/src/Core/src/Exceptions/Internal/UnknownDriverConfigException.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Facades/Config.php b/src/Core/src/Facades/Config.php index 291300ad..9c5c8e66 100644 --- a/src/Core/src/Facades/Config.php +++ b/src/Core/src/Facades/Config.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Http/Request.php b/src/Core/src/Http/Request.php index d491b6c5..7799c937 100644 --- a/src/Core/src/Http/Request.php +++ b/src/Core/src/Http/Request.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Http/Response.php b/src/Core/src/Http/Response.php index 25279fa8..ab1a9db0 100644 --- a/src/Core/src/Http/Response.php +++ b/src/Core/src/Http/Response.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Jobs/BaseJob.php b/src/Core/src/Jobs/BaseJob.php index 638ae258..e907e265 100644 --- a/src/Core/src/Jobs/BaseJob.php +++ b/src/Core/src/Jobs/BaseJob.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Jobs/RefundJob.php b/src/Core/src/Jobs/RefundJob.php index fc334d78..6f8d168c 100644 --- a/src/Core/src/Jobs/RefundJob.php +++ b/src/Core/src/Jobs/RefundJob.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Jobs/StartJob.php b/src/Core/src/Jobs/StartJob.php index 1f6bb0f2..2409952e 100644 --- a/src/Core/src/Jobs/StartJob.php +++ b/src/Core/src/Jobs/StartJob.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Jobs/VerifyJob.php b/src/Core/src/Jobs/VerifyJob.php index 3d02086b..5273dd1d 100644 --- a/src/Core/src/Jobs/VerifyJob.php +++ b/src/Core/src/Jobs/VerifyJob.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Models/Details.php b/src/Core/src/Models/Details.php index 33edbb6b..2073747d 100644 --- a/src/Core/src/Models/Details.php +++ b/src/Core/src/Models/Details.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Observers/PaymentDetailsObserver.php b/src/Core/src/Observers/PaymentDetailsObserver.php index 5e248418..2a1f5f16 100644 --- a/src/Core/src/Observers/PaymentDetailsObserver.php +++ b/src/Core/src/Observers/PaymentDetailsObserver.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Observers/PaymentObserver.php b/src/Core/src/Observers/PaymentObserver.php index b450c958..2a6bf55b 100644 --- a/src/Core/src/Observers/PaymentObserver.php +++ b/src/Core/src/Observers/PaymentObserver.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Providers/BaseProvider.php b/src/Core/src/Providers/BaseProvider.php index 35d6d38a..04808f6b 100644 --- a/src/Core/src/Providers/BaseProvider.php +++ b/src/Core/src/Providers/BaseProvider.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Providers/BindingServiceProvider.php b/src/Core/src/Providers/BindingServiceProvider.php index f441ae55..42d1a6e5 100644 --- a/src/Core/src/Providers/BindingServiceProvider.php +++ b/src/Core/src/Providers/BindingServiceProvider.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Providers; diff --git a/src/Core/src/Providers/ObserverServiceProvider.php b/src/Core/src/Providers/ObserverServiceProvider.php index 47e58fad..6df02367 100644 --- a/src/Core/src/Providers/ObserverServiceProvider.php +++ b/src/Core/src/Providers/ObserverServiceProvider.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Providers/RateLimiterServiceProvider.php b/src/Core/src/Providers/RateLimiterServiceProvider.php index c44dcdac..a6344603 100644 --- a/src/Core/src/Providers/RateLimiterServiceProvider.php +++ b/src/Core/src/Providers/RateLimiterServiceProvider.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Providers/ServiceProvider.php b/src/Core/src/Providers/ServiceProvider.php index 44af27f4..045ed67a 100644 --- a/src/Core/src/Providers/ServiceProvider.php +++ b/src/Core/src/Providers/ServiceProvider.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Resources/Resource.php b/src/Core/src/Resources/Resource.php index f934efaf..309b8d4d 100644 --- a/src/Core/src/Resources/Resource.php +++ b/src/Core/src/Resources/Resource.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Resources; diff --git a/src/Core/src/Services/Authorize.php b/src/Core/src/Services/Authorize.php index 7852a897..67ce8512 100644 --- a/src/Core/src/Services/Authorize.php +++ b/src/Core/src/Services/Authorize.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Services/Driver.php b/src/Core/src/Services/Driver.php index a0c3affb..023b6508 100644 --- a/src/Core/src/Services/Driver.php +++ b/src/Core/src/Services/Driver.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Services/DriverManager.php b/src/Core/src/Services/DriverManager.php index 4e0837b2..6e4730da 100644 --- a/src/Core/src/Services/DriverManager.php +++ b/src/Core/src/Services/DriverManager.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Services/Exception.php b/src/Core/src/Services/Exception.php index 00b7dee1..600fc305 100644 --- a/src/Core/src/Services/Exception.php +++ b/src/Core/src/Services/Exception.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Services/Http.php b/src/Core/src/Services/Http.php index a3fe17c6..194bca7a 100644 --- a/src/Core/src/Services/Http.php +++ b/src/Core/src/Services/Http.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Services/Job.php b/src/Core/src/Services/Job.php index 6cbf12ae..08b8c0a8 100644 --- a/src/Core/src/Services/Job.php +++ b/src/Core/src/Services/Job.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Services/Sign.php b/src/Core/src/Services/Sign.php index f616772b..2f48a924 100644 --- a/src/Core/src/Services/Sign.php +++ b/src/Core/src/Services/Sign.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Services; diff --git a/src/Core/src/Services/Statuses.php b/src/Core/src/Services/Statuses.php index f4930f1f..f0abf6fa 100644 --- a/src/Core/src/Services/Statuses.php +++ b/src/Core/src/Services/Statuses.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Services/Validator.php b/src/Core/src/Services/Validator.php index e9508e11..ad124c48 100644 --- a/src/Core/src/Services/Validator.php +++ b/src/Core/src/Services/Validator.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ declare(strict_types=1); diff --git a/src/Core/src/Support/Arr.php b/src/Core/src/Support/Arr.php index 0dca40d7..683bdb38 100644 --- a/src/Core/src/Support/Arr.php +++ b/src/Core/src/Support/Arr.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Core\Support; diff --git a/src/SberAuth/phpunit.xml b/src/SberAuth/phpunit.xml index 79fa0bf8..fb114a8f 100644 --- a/src/SberAuth/phpunit.xml +++ b/src/SberAuth/phpunit.xml @@ -9,7 +9,7 @@ ~ @copyright 2023 Andrey Helldar ~ @license MIT ~ - ~ @see https://github.com/cashbox-laravel/foundation + ~ @see https://cashbox.city --> + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Auth\Services; diff --git a/src/TinkoffAuth/src/Sign.php b/src/TinkoffAuth/src/Sign.php index ccdb1884..ff3cf53c 100644 --- a/src/TinkoffAuth/src/Sign.php +++ b/src/TinkoffAuth/src/Sign.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Auth; diff --git a/src/TinkoffCredit/phpunit.xml b/src/TinkoffCredit/phpunit.xml index 79fa0bf8..fb114a8f 100644 --- a/src/TinkoffCredit/phpunit.xml +++ b/src/TinkoffCredit/phpunit.xml @@ -9,7 +9,7 @@ ~ @copyright 2023 Andrey Helldar ~ @license MIT ~ - ~ @see https://github.com/cashbox-laravel/foundation + ~ @see https://cashbox.city --> + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Credit\Data\Casts; diff --git a/src/TinkoffCredit/src/Data/ContactData.php b/src/TinkoffCredit/src/Data/ContactData.php index fe8cec63..6b290614 100644 --- a/src/TinkoffCredit/src/Data/ContactData.php +++ b/src/TinkoffCredit/src/Data/ContactData.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Credit\Data; diff --git a/src/TinkoffCredit/src/Data/ContactFioData.php b/src/TinkoffCredit/src/Data/ContactFioData.php index e546ef82..496975be 100644 --- a/src/TinkoffCredit/src/Data/ContactFioData.php +++ b/src/TinkoffCredit/src/Data/ContactFioData.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Credit\Data; diff --git a/src/TinkoffCredit/src/Data/ProductData.php b/src/TinkoffCredit/src/Data/ProductData.php index 6c0ce5c3..2f77df30 100644 --- a/src/TinkoffCredit/src/Data/ProductData.php +++ b/src/TinkoffCredit/src/Data/ProductData.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Credit\Data; diff --git a/src/TinkoffCredit/src/Driver.php b/src/TinkoffCredit/src/Driver.php index 3c8fd022..243f30d2 100644 --- a/src/TinkoffCredit/src/Driver.php +++ b/src/TinkoffCredit/src/Driver.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ namespace Cashbox\Tinkoff\Credit; diff --git a/src/TinkoffCredit/src/Http/Requests/BaseRequest.php b/src/TinkoffCredit/src/Http/Requests/BaseRequest.php index c938db3b..7271bfc1 100644 --- a/src/TinkoffCredit/src/Http/Requests/BaseRequest.php +++ b/src/TinkoffCredit/src/Http/Requests/BaseRequest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Credit\Http\Requests; diff --git a/src/TinkoffCredit/src/Http/Requests/CancelRequest.php b/src/TinkoffCredit/src/Http/Requests/CancelRequest.php index bbe07ba1..759bf20f 100644 --- a/src/TinkoffCredit/src/Http/Requests/CancelRequest.php +++ b/src/TinkoffCredit/src/Http/Requests/CancelRequest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Credit\Http\Requests; diff --git a/src/TinkoffCredit/src/Http/Requests/CommitRequest.php b/src/TinkoffCredit/src/Http/Requests/CommitRequest.php index 38f5d2cb..80b40dc8 100644 --- a/src/TinkoffCredit/src/Http/Requests/CommitRequest.php +++ b/src/TinkoffCredit/src/Http/Requests/CommitRequest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Credit\Http\Requests; diff --git a/src/TinkoffCredit/src/Http/Requests/CreateRequest.php b/src/TinkoffCredit/src/Http/Requests/CreateRequest.php index 5bc093eb..b25680d8 100644 --- a/src/TinkoffCredit/src/Http/Requests/CreateRequest.php +++ b/src/TinkoffCredit/src/Http/Requests/CreateRequest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Credit\Http\Requests; diff --git a/src/TinkoffCredit/src/Http/Requests/GetStateRequest.php b/src/TinkoffCredit/src/Http/Requests/GetStateRequest.php index 8e1c4d41..dd2b9a69 100644 --- a/src/TinkoffCredit/src/Http/Requests/GetStateRequest.php +++ b/src/TinkoffCredit/src/Http/Requests/GetStateRequest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Credit\Http\Requests; diff --git a/src/TinkoffCredit/src/Http/Responses/CreatedResponse.php b/src/TinkoffCredit/src/Http/Responses/CreatedResponse.php index fb3bbb0e..8fe1f8d9 100644 --- a/src/TinkoffCredit/src/Http/Responses/CreatedResponse.php +++ b/src/TinkoffCredit/src/Http/Responses/CreatedResponse.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Credit\Http\Responses; diff --git a/src/TinkoffCredit/src/Http/Responses/Response.php b/src/TinkoffCredit/src/Http/Responses/Response.php index f68cc637..1d33c855 100644 --- a/src/TinkoffCredit/src/Http/Responses/Response.php +++ b/src/TinkoffCredit/src/Http/Responses/Response.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Credit\Http\Responses; diff --git a/src/TinkoffCredit/src/Resources/TinkoffCreditResource.php b/src/TinkoffCredit/src/Resources/TinkoffCreditResource.php index 9bf2840e..590eaf0b 100644 --- a/src/TinkoffCredit/src/Resources/TinkoffCreditResource.php +++ b/src/TinkoffCredit/src/Resources/TinkoffCreditResource.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Credit\Resources; diff --git a/src/TinkoffCredit/src/Services/Exception.php b/src/TinkoffCredit/src/Services/Exception.php index d75718bb..c05e4ccb 100644 --- a/src/TinkoffCredit/src/Services/Exception.php +++ b/src/TinkoffCredit/src/Services/Exception.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ namespace Cashbox\Tinkoff\Credit\Services; diff --git a/src/TinkoffCredit/src/Services/Statuses.php b/src/TinkoffCredit/src/Services/Statuses.php index ad72a931..1a1a267b 100644 --- a/src/TinkoffCredit/src/Services/Statuses.php +++ b/src/TinkoffCredit/src/Services/Statuses.php @@ -10,7 +10,7 @@ * @copyright 2023 Andrey Helldar * @license MIT * - * @see https://github.com/cashbox-laravel/foundation + * @see https://cashbox.city */ namespace Cashbox\Tinkoff\Credit\Services; diff --git a/src/TinkoffOnline/phpunit.xml b/src/TinkoffOnline/phpunit.xml index 79fa0bf8..fb114a8f 100644 --- a/src/TinkoffOnline/phpunit.xml +++ b/src/TinkoffOnline/phpunit.xml @@ -9,7 +9,7 @@ ~ @copyright 2023 Andrey Helldar ~ @license MIT ~ - ~ @see https://github.com/cashbox-laravel/foundation + ~ @see https://cashbox.city --> + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Online\Http\Requests; diff --git a/src/TinkoffOnline/src/Http/Requests/CancelRequest.php b/src/TinkoffOnline/src/Http/Requests/CancelRequest.php index 14210de5..4b7f8bc6 100644 --- a/src/TinkoffOnline/src/Http/Requests/CancelRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/CancelRequest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Online\Http\Requests; diff --git a/src/TinkoffOnline/src/Http/Requests/CreateRequest.php b/src/TinkoffOnline/src/Http/Requests/CreateRequest.php index 1742c286..86b62298 100644 --- a/src/TinkoffOnline/src/Http/Requests/CreateRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/CreateRequest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Online\Http\Requests; diff --git a/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php b/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php index fafe6fc2..b6b09792 100644 --- a/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Online\Http\Requests; diff --git a/src/TinkoffOnline/src/Http/Responses/Response.php b/src/TinkoffOnline/src/Http/Responses/Response.php index a160e04c..079aa397 100644 --- a/src/TinkoffOnline/src/Http/Responses/Response.php +++ b/src/TinkoffOnline/src/Http/Responses/Response.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Online\Http\Responses; diff --git a/src/TinkoffOnline/src/Resources/TinkoffOnlineResource.php b/src/TinkoffOnline/src/Resources/TinkoffOnlineResource.php index d99b92f4..c48f110e 100644 --- a/src/TinkoffOnline/src/Resources/TinkoffOnlineResource.php +++ b/src/TinkoffOnline/src/Resources/TinkoffOnlineResource.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Online\Resources; diff --git a/src/TinkoffOnline/src/Services/Exception.php b/src/TinkoffOnline/src/Services/Exception.php index 2080ad0e..19ae21cc 100644 --- a/src/TinkoffOnline/src/Services/Exception.php +++ b/src/TinkoffOnline/src/Services/Exception.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Online\Services; diff --git a/src/TinkoffOnline/src/Services/Statuses.php b/src/TinkoffOnline/src/Services/Statuses.php index 85672827..7e64c032 100644 --- a/src/TinkoffOnline/src/Services/Statuses.php +++ b/src/TinkoffOnline/src/Services/Statuses.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Cashbox\Tinkoff\Online\Services; diff --git a/src/TinkoffQrCode/phpunit.xml b/src/TinkoffQrCode/phpunit.xml index 79fa0bf8..fb114a8f 100644 --- a/src/TinkoffQrCode/phpunit.xml +++ b/src/TinkoffQrCode/phpunit.xml @@ -9,7 +9,7 @@ ~ @copyright 2023 Andrey Helldar ~ @license MIT ~ - ~ @see https://github.com/cashbox-laravel/foundation + ~ @see https://cashbox.city --> + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Tests\Fixtures\App\Enums; diff --git a/tests/Fixtures/App/Enums/TypeEnum.php b/tests/Fixtures/App/Enums/TypeEnum.php index 4c8045ec..5106907e 100644 --- a/tests/Fixtures/App/Enums/TypeEnum.php +++ b/tests/Fixtures/App/Enums/TypeEnum.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Tests\Fixtures\App\Enums; diff --git a/tests/Fixtures/App/Models/Factories/PaymentModelFactory.php b/tests/Fixtures/App/Models/Factories/PaymentModelFactory.php index 0936bce4..93eafda4 100644 --- a/tests/Fixtures/App/Models/Factories/PaymentModelFactory.php +++ b/tests/Fixtures/App/Models/Factories/PaymentModelFactory.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Tests\Fixtures\App\Models\Factories; diff --git a/tests/Fixtures/App/Models/PaymentModel.php b/tests/Fixtures/App/Models/PaymentModel.php index 17ec2743..1be4cf72 100644 --- a/tests/Fixtures/App/Models/PaymentModel.php +++ b/tests/Fixtures/App/Models/PaymentModel.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Tests\Fixtures\App\Models; diff --git a/tests/Fixtures/Data/FakeData.php b/tests/Fixtures/Data/FakeData.php index 8d3bfb05..01168c2d 100644 --- a/tests/Fixtures/Data/FakeData.php +++ b/tests/Fixtures/Data/FakeData.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Tests\Fixtures\Data; diff --git a/tests/Fixtures/Payments/Cash.php b/tests/Fixtures/Payments/Cash.php index 30a97115..f090754a 100644 --- a/tests/Fixtures/Payments/Cash.php +++ b/tests/Fixtures/Payments/Cash.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Tests\Fixtures\Payments; diff --git a/tests/Fixtures/Payments/TinkoffCredit.php b/tests/Fixtures/Payments/TinkoffCredit.php index c055c030..35a4e8c4 100644 --- a/tests/Fixtures/Payments/TinkoffCredit.php +++ b/tests/Fixtures/Payments/TinkoffCredit.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Tests\Fixtures\Payments; diff --git a/tests/Fixtures/Payments/TinkoffOnline.php b/tests/Fixtures/Payments/TinkoffOnline.php index 8e4c5310..dca2fe94 100644 --- a/tests/Fixtures/Payments/TinkoffOnline.php +++ b/tests/Fixtures/Payments/TinkoffOnline.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); namespace Tests\Fixtures\Payments; diff --git a/tests/Helpers/Asserts.php b/tests/Helpers/Asserts.php index 329d5f6d..8344ae4f 100644 --- a/tests/Helpers/Asserts.php +++ b/tests/Helpers/Asserts.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Illuminate\Support\Str; diff --git a/tests/Helpers/Data.php b/tests/Helpers/Data.php index 01beffe1..bd5d1ed0 100644 --- a/tests/Helpers/Data.php +++ b/tests/Helpers/Data.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Spatie\LaravelData\Casts\Cast; diff --git a/tests/Helpers/Fakes.php b/tests/Helpers/Fakes.php index 644cd4f5..f5cb9ce8 100644 --- a/tests/Helpers/Fakes.php +++ b/tests/Helpers/Fakes.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Events\PaymentCreatedEvent; diff --git a/tests/Helpers/Forget.php b/tests/Helpers/Forget.php index 4f4a5955..3ed5422b 100644 --- a/tests/Helpers/Forget.php +++ b/tests/Helpers/Forget.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Data\Config\ConfigData; diff --git a/tests/Helpers/Http/Tinkoff/Credit.php b/tests/Helpers/Http/Tinkoff/Credit.php index 8a52de40..5d7feb9b 100644 --- a/tests/Helpers/Http/Tinkoff/Credit.php +++ b/tests/Helpers/Http/Tinkoff/Credit.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Illuminate\Support\Facades\Http; diff --git a/tests/Helpers/Http/Tinkoff/Online.php b/tests/Helpers/Http/Tinkoff/Online.php index 2132648a..da91f5f2 100644 --- a/tests/Helpers/Http/Tinkoff/Online.php +++ b/tests/Helpers/Http/Tinkoff/Online.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Illuminate\Support\Facades\Http; diff --git a/tests/Helpers/Models.php b/tests/Helpers/Models.php index b3ca8fe1..93d45f9d 100644 --- a/tests/Helpers/Models.php +++ b/tests/Helpers/Models.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Illuminate\Database\Eloquent\Model; diff --git a/tests/Pest.php b/tests/Pest.php index 3124f760..d3450084 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + use Illuminate\Support\Facades\Artisan; use Tests\TestCase; diff --git a/tests/TestCase.php b/tests/TestCase.php index 903c3c83..0ceb5c59 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + namespace Tests; use Cashbox\Cash\Driver as CashDriver; diff --git a/tests/Unit/Core/Console/RefundTest.php b/tests/Unit/Core/Console/RefundTest.php index 6adae1ed..b9a00b28 100644 --- a/tests/Unit/Core/Console/RefundTest.php +++ b/tests/Unit/Core/Console/RefundTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Console\Commands\Refund; diff --git a/tests/Unit/Core/Console/VerifyTest.php b/tests/Unit/Core/Console/VerifyTest.php index 2021c1fa..f595c79c 100644 --- a/tests/Unit/Core/Console/VerifyTest.php +++ b/tests/Unit/Core/Console/VerifyTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Console\Commands\Verify; diff --git a/tests/Unit/Core/Data/Casts/FromEnumCastTest.php b/tests/Unit/Core/Data/Casts/FromEnumCastTest.php index 501ac23d..18ec866f 100644 --- a/tests/Unit/Core/Data/Casts/FromEnumCastTest.php +++ b/tests/Unit/Core/Data/Casts/FromEnumCastTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Data\Casts\FromEnumCast; diff --git a/tests/Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php b/tests/Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php index c28ebd56..4565e246 100644 --- a/tests/Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php +++ b/tests/Unit/Core/Data/Casts/Instances/InstanceOfCastTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Billable; diff --git a/tests/Unit/Core/Data/Casts/NumberCastTest.php b/tests/Unit/Core/Data/Casts/NumberCastTest.php index 3dca6bef..480dd92a 100644 --- a/tests/Unit/Core/Data/Casts/NumberCastTest.php +++ b/tests/Unit/Core/Data/Casts/NumberCastTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Data\Casts\NumberCast; diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index a7000ab7..57d9da99 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Cash\Driver as CashDriver; diff --git a/tests/Unit/Core/Support/ArrTest.php b/tests/Unit/Core/Support/ArrTest.php index 593d2bde..b70d5bc6 100644 --- a/tests/Unit/Core/Support/ArrTest.php +++ b/tests/Unit/Core/Support/ArrTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Support\Arr; diff --git a/tests/Unit/Drivers/Cash/CreatedTest.php b/tests/Unit/Drivers/Cash/CreatedTest.php index f8860ecc..d97e637a 100644 --- a/tests/Unit/Drivers/Cash/CreatedTest.php +++ b/tests/Unit/Drivers/Cash/CreatedTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Events\PaymentCreatedEvent; diff --git a/tests/Unit/Drivers/Cash/RefundTest.php b/tests/Unit/Drivers/Cash/RefundTest.php index 946dc175..113a0a8c 100644 --- a/tests/Unit/Drivers/Cash/RefundTest.php +++ b/tests/Unit/Drivers/Cash/RefundTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Events\PaymentCreatedEvent; diff --git a/tests/Unit/Drivers/Cash/VerifyTest.php b/tests/Unit/Drivers/Cash/VerifyTest.php index 77e775c1..105d4e03 100644 --- a/tests/Unit/Drivers/Cash/VerifyTest.php +++ b/tests/Unit/Drivers/Cash/VerifyTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Events\PaymentCreatedEvent; diff --git a/tests/Unit/Drivers/Outside/CreatedTest.php b/tests/Unit/Drivers/Outside/CreatedTest.php index fb113c81..cabdfaf0 100644 --- a/tests/Unit/Drivers/Outside/CreatedTest.php +++ b/tests/Unit/Drivers/Outside/CreatedTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Events\PaymentCreatedEvent; diff --git a/tests/Unit/Drivers/Outside/FailedTest.php b/tests/Unit/Drivers/Outside/FailedTest.php index cc44606c..b6a5cc66 100644 --- a/tests/Unit/Drivers/Outside/FailedTest.php +++ b/tests/Unit/Drivers/Outside/FailedTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Events\PaymentCreatedEvent; diff --git a/tests/Unit/Drivers/Outside/RefundTest.php b/tests/Unit/Drivers/Outside/RefundTest.php index ddcc60ac..bcbbb377 100644 --- a/tests/Unit/Drivers/Outside/RefundTest.php +++ b/tests/Unit/Drivers/Outside/RefundTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Events\PaymentCreatedEvent; diff --git a/tests/Unit/Drivers/Outside/VerifyTest.php b/tests/Unit/Drivers/Outside/VerifyTest.php index af1cb59c..0750e71f 100644 --- a/tests/Unit/Drivers/Outside/VerifyTest.php +++ b/tests/Unit/Drivers/Outside/VerifyTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Events\PaymentCreatedEvent; diff --git a/tests/Unit/Drivers/TinkoffAuth/HashTest.php b/tests/Unit/Drivers/TinkoffAuth/HashTest.php index ea5dac90..19750a88 100644 --- a/tests/Unit/Drivers/TinkoffAuth/HashTest.php +++ b/tests/Unit/Drivers/TinkoffAuth/HashTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Tinkoff\Auth\Services\Hash; diff --git a/tests/Unit/Drivers/TinkoffCredit/CreatedTest.php b/tests/Unit/Drivers/TinkoffCredit/CreatedTest.php index 870d246c..4aa46eec 100644 --- a/tests/Unit/Drivers/TinkoffCredit/CreatedTest.php +++ b/tests/Unit/Drivers/TinkoffCredit/CreatedTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Enums\StatusEnum; diff --git a/tests/Unit/Drivers/TinkoffCredit/RefundTest.php b/tests/Unit/Drivers/TinkoffCredit/RefundTest.php index 6c5c284d..b913ed01 100644 --- a/tests/Unit/Drivers/TinkoffCredit/RefundTest.php +++ b/tests/Unit/Drivers/TinkoffCredit/RefundTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Console\Commands\Refund; diff --git a/tests/Unit/Drivers/TinkoffCredit/VerifyTest.php b/tests/Unit/Drivers/TinkoffCredit/VerifyTest.php index 6ddc33db..666c8d2a 100644 --- a/tests/Unit/Drivers/TinkoffCredit/VerifyTest.php +++ b/tests/Unit/Drivers/TinkoffCredit/VerifyTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Console\Commands\Verify; diff --git a/tests/Unit/Drivers/TinkoffOnline/CreatedTest.php b/tests/Unit/Drivers/TinkoffOnline/CreatedTest.php index 0b854071..9176bed5 100644 --- a/tests/Unit/Drivers/TinkoffOnline/CreatedTest.php +++ b/tests/Unit/Drivers/TinkoffOnline/CreatedTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Enums\StatusEnum; diff --git a/tests/Unit/Drivers/TinkoffOnline/RefundTest.php b/tests/Unit/Drivers/TinkoffOnline/RefundTest.php index 92a81e09..b746afa4 100644 --- a/tests/Unit/Drivers/TinkoffOnline/RefundTest.php +++ b/tests/Unit/Drivers/TinkoffOnline/RefundTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Console\Commands\Refund; diff --git a/tests/Unit/Drivers/TinkoffOnline/VerifyTest.php b/tests/Unit/Drivers/TinkoffOnline/VerifyTest.php index 18397ccb..f30fd64c 100644 --- a/tests/Unit/Drivers/TinkoffOnline/VerifyTest.php +++ b/tests/Unit/Drivers/TinkoffOnline/VerifyTest.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Cashbox\Core\Console\Commands\Verify; diff --git a/tests/database/2023_07_14_022222_create_payments_model.php b/tests/database/2023_07_14_022222_create_payments_model.php index e3215e05..fba40d80 100644 --- a/tests/database/2023_07_14_022222_create_payments_model.php +++ b/tests/database/2023_07_14_022222_create_payments_model.php @@ -1,5 +1,18 @@ + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + declare(strict_types=1); use Illuminate\Database\Migrations\Migration; From cf9d6e7ea8f0016b4c05a44c1e10cc70cf9967be Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 3 Aug 2023 22:16:23 +0300 Subject: [PATCH 129/164] Added tests for the Tinkoff Online driver --- src/Core/src/Http/Request.php | 2 +- src/Core/src/Services/Sign.php | 2 + src/TinkoffAuth/src/Sign.php | 10 +--- src/TinkoffOnline/src/Driver.php | 3 ++ .../src/Http/Requests/BaseRequest.php | 14 ------ .../src/Http/Requests/CancelRequest.php | 2 +- .../src/Http/Requests/GetStateRequest.php | 2 +- tests/Helpers/Http/Tinkoff/Online.php | 47 ++++++++++++------- .../Cash/{CreatedTest.php => CreateTest.php} | 0 .../{CreatedTest.php => CreateTest.php} | 0 .../{CreatedTest.php => CreateTest.php} | 0 .../{CreatedTest.php => CreateTest.php} | 17 +++---- .../Unit/Drivers/TinkoffOnline/RefundTest.php | 2 +- .../Unit/Drivers/TinkoffOnline/VerifyTest.php | 2 +- 14 files changed, 47 insertions(+), 56 deletions(-) rename tests/Unit/Drivers/Cash/{CreatedTest.php => CreateTest.php} (100%) rename tests/Unit/Drivers/Outside/{CreatedTest.php => CreateTest.php} (100%) rename tests/Unit/Drivers/TinkoffCredit/{CreatedTest.php => CreateTest.php} (100%) rename tests/Unit/Drivers/TinkoffOnline/{CreatedTest.php => CreateTest.php} (79%) diff --git a/src/Core/src/Http/Request.php b/src/Core/src/Http/Request.php index 7799c937..17e90328 100644 --- a/src/Core/src/Http/Request.php +++ b/src/Core/src/Http/Request.php @@ -78,6 +78,6 @@ public function sign(): ?Sign return $this->auth; } - return $this->auth = new $this->auth($this, $this->secure); + return $this->auth = new $this->auth($this, $this->resource->config, $this->secure); } } diff --git a/src/Core/src/Services/Sign.php b/src/Core/src/Services/Sign.php index 2f48a924..632ec2a0 100644 --- a/src/Core/src/Services/Sign.php +++ b/src/Core/src/Services/Sign.php @@ -17,12 +17,14 @@ namespace Cashbox\Core\Services; +use Cashbox\Core\Data\Config\DriverData; use Cashbox\Core\Http\Request; abstract class Sign { public function __construct( protected readonly Request $request, + protected readonly DriverData $config, protected readonly bool $secure = true ) {} diff --git a/src/TinkoffAuth/src/Sign.php b/src/TinkoffAuth/src/Sign.php index ff3cf53c..57483bd0 100644 --- a/src/TinkoffAuth/src/Sign.php +++ b/src/TinkoffAuth/src/Sign.php @@ -17,7 +17,6 @@ namespace Cashbox\Tinkoff\Auth; -use Cashbox\Core\Data\Config\Drivers\CredentialsData; use Cashbox\Core\Data\Signing\Token; use Cashbox\Core\Services\Sign as BaseSign; use Cashbox\Tinkoff\Auth\Constants\Keys; @@ -47,16 +46,11 @@ protected function hash(): Token protected function clientId(): string { - return $this->credentials()->clientId; + return $this->config->credentials->clientId; } protected function clientSecret(): string { - return $this->credentials()->clientSecret; - } - - protected function credentials(): CredentialsData - { - return $this->request->resource->payment->cashboxDriver()->config->credentials; + return $this->config->credentials->clientSecret; } } diff --git a/src/TinkoffOnline/src/Driver.php b/src/TinkoffOnline/src/Driver.php index da473364..647d0bac 100644 --- a/src/TinkoffOnline/src/Driver.php +++ b/src/TinkoffOnline/src/Driver.php @@ -24,6 +24,9 @@ use Cashbox\Tinkoff\Online\Services\Exception; use Cashbox\Tinkoff\Online\Services\Statuses; +/** + * @see https://www.tinkoff.ru/kassa/develop/api/payments/ + */ class Driver extends BaseDriver { protected string $statuses = Statuses::class; diff --git a/src/TinkoffOnline/src/Http/Requests/BaseRequest.php b/src/TinkoffOnline/src/Http/Requests/BaseRequest.php index 8d173be7..8c227f2d 100644 --- a/src/TinkoffOnline/src/Http/Requests/BaseRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/BaseRequest.php @@ -27,20 +27,6 @@ abstract class BaseRequest extends Request protected BaseSign|string|null $auth = Sign::class; - public function options(): array - { - //if ($this->hash) { - // return [ - // 'auth' => [ - // $this->clientId(), - // $this->clientSecret(), - // ], - // ]; - //} - - return []; - } - protected function clientId(): string { return $this->resource->config->credentials->clientId; diff --git a/src/TinkoffOnline/src/Http/Requests/CancelRequest.php b/src/TinkoffOnline/src/Http/Requests/CancelRequest.php index 4b7f8bc6..2c5f04ad 100644 --- a/src/TinkoffOnline/src/Http/Requests/CancelRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/CancelRequest.php @@ -24,7 +24,7 @@ class CancelRequest extends BaseRequest public function body(): array { return [ - 'PaymentId' => $this->resource->externalId(), + 'PaymentId' => $this->resource->payment->cashbox->external_id, 'Amount' => $this->resource->sum(), ]; } diff --git a/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php b/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php index b6b09792..48a622f9 100644 --- a/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php @@ -24,7 +24,7 @@ class GetStateRequest extends BaseRequest public function body(): array { return [ - 'PaymentId' => $this->resource->externalId(), + 'PaymentId' => $this->resource->payment->cashbox->external_id, ]; } } diff --git a/tests/Helpers/Http/Tinkoff/Online.php b/tests/Helpers/Http/Tinkoff/Online.php index da91f5f2..d003e0ac 100644 --- a/tests/Helpers/Http/Tinkoff/Online.php +++ b/tests/Helpers/Http/Tinkoff/Online.php @@ -17,30 +17,41 @@ use Illuminate\Support\Facades\Http; -function fakeTinkoffOnlineHttp(string $info = 'signed'): void +function fakeTinkoffOnlineHttp(string $info = 'CONFIRMED'): void { Http::fake([ - 'https://forma.tinkoff.ru/api/partners/v2/orders/create-demo' => Http::response([ - 'id' => fake()->uuid, - 'link' => fake()->imageUrl, + 'https://securepay.tinkoff.ru/v2/Init' => Http::response([ + 'Success' => true, + 'ErrorCode' => 0, + 'TerminalKey' => fake()->word, + 'Status' => 'NEW', + 'PaymentId' => fake()->randomNumber(), + 'OrderId' => fake()->randomNumber(), + 'Amount' => fake()->randomNumber(), + 'PaymentURL' => fake()->imageUrl, ]), - 'https://forma.tinkoff.ru/api/partners/v2/orders/*/info' => Http::response([ - 'id' => fake()->uuid, - 'status' => $info, - 'created_at' => fake()->unixTime, + 'https://securepay.tinkoff.ru/v2/GetState' => Http::response([ + 'Success' => true, + 'ErrorCode' => 0, + 'Message' => 'OK', + 'TerminalKey' => fake()->word, + 'Status' => $info, + 'PaymentId' => fake()->randomNumber(), + 'OrderId' => fake()->randomNumber(), + 'Amount' => fake()->randomNumber(), ]), - 'https://forma.tinkoff.ru/api/partners/v2/orders/*/commit' => Http::response([ - 'id' => fake()->uuid, - 'status' => 'approved', - 'created_at' => fake()->unixTime, - ]), - - 'https://forma.tinkoff.ru/api/partners/v2/orders/*/cancel' => Http::response([ - 'id' => fake()->uuid, - 'status' => 'canceled', - 'created_at' => fake()->unixTime, + 'https://securepay.tinkoff.ru/v2/Cancel' => Http::response([ + 'Success' => true, + 'ErrorCode' => 0, + 'Message' => 'OK', + 'TerminalKey' => fake()->word, + 'Status' => 'REFUNDED', + 'PaymentId' => fake()->randomNumber(), + 'OrderId' => fake()->randomNumber(), + 'OriginalAmount' => fake()->randomNumber(), + 'NewAmount' => 0, ]), ]); } diff --git a/tests/Unit/Drivers/Cash/CreatedTest.php b/tests/Unit/Drivers/Cash/CreateTest.php similarity index 100% rename from tests/Unit/Drivers/Cash/CreatedTest.php rename to tests/Unit/Drivers/Cash/CreateTest.php diff --git a/tests/Unit/Drivers/Outside/CreatedTest.php b/tests/Unit/Drivers/Outside/CreateTest.php similarity index 100% rename from tests/Unit/Drivers/Outside/CreatedTest.php rename to tests/Unit/Drivers/Outside/CreateTest.php diff --git a/tests/Unit/Drivers/TinkoffCredit/CreatedTest.php b/tests/Unit/Drivers/TinkoffCredit/CreateTest.php similarity index 100% rename from tests/Unit/Drivers/TinkoffCredit/CreatedTest.php rename to tests/Unit/Drivers/TinkoffCredit/CreateTest.php diff --git a/tests/Unit/Drivers/TinkoffOnline/CreatedTest.php b/tests/Unit/Drivers/TinkoffOnline/CreateTest.php similarity index 79% rename from tests/Unit/Drivers/TinkoffOnline/CreatedTest.php rename to tests/Unit/Drivers/TinkoffOnline/CreateTest.php index 9176bed5..657cafa5 100644 --- a/tests/Unit/Drivers/TinkoffOnline/CreatedTest.php +++ b/tests/Unit/Drivers/TinkoffOnline/CreateTest.php @@ -15,32 +15,29 @@ declare(strict_types=1); -use Cashbox\Core\Enums\StatusEnum; use Cashbox\Core\Events\PaymentCreatedEvent; use Cashbox\Core\Events\PaymentFailedEvent; use Cashbox\Core\Events\PaymentRefundedEvent; use Cashbox\Core\Events\PaymentSuccessEvent; use Cashbox\Core\Events\PaymentWaitRefundEvent; use Illuminate\Support\Facades\Event; -use Tests\Fixtures\App\Enums\StatusEnum as AppStatusEnum; +use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; it('checks the progress', function () { fakeEvents(); - fakeTinkoffOnlineHttp('new'); + fakeTinkoffOnlineHttp('NEW'); $payment = createPayment(TypeEnum::tinkoffOnline); expect($payment->type)->toBe(TypeEnum::tinkoffOnline); - expect($payment->status)->toBe(AppStatusEnum::new); + expect($payment->status)->toBe(StatusEnum::new); expect($payment)->toBeHasCashbox(); $payment->refresh(); - expect(StatusEnum::new)->toBe( - $payment->cashboxDriver()->statuses()->detect($payment->cashbox->info->status) - ); + expect($payment)->toBeStatus(StatusEnum::new); expect($payment->cashbox->info->extra['url'])->toBeUrl(); @@ -59,15 +56,13 @@ $payment = createPayment(TypeEnum::tinkoffOnline); expect($payment->type)->toBe(TypeEnum::tinkoffOnline); - expect($payment->status)->toBe(AppStatusEnum::new); + expect($payment->status)->toBe(StatusEnum::new); expect($payment)->toBeHasCashbox(); $payment->refresh(); - expect(StatusEnum::success)->toBe( - $payment->cashboxDriver()->statuses()->detect($payment->cashbox->info->status) - ); + expect($payment)->toBeStatus(StatusEnum::success); expect($payment->cashbox->info->extra['url'])->toBeUrl(); diff --git a/tests/Unit/Drivers/TinkoffOnline/RefundTest.php b/tests/Unit/Drivers/TinkoffOnline/RefundTest.php index b746afa4..50f2719e 100644 --- a/tests/Unit/Drivers/TinkoffOnline/RefundTest.php +++ b/tests/Unit/Drivers/TinkoffOnline/RefundTest.php @@ -25,7 +25,7 @@ it('refund for new', function () { fakeEvents(); - fakeTinkoffOnlineHttp('new'); + fakeTinkoffOnlineHttp('NEW'); $payment = createPayment(TypeEnum::tinkoffOnline); diff --git a/tests/Unit/Drivers/TinkoffOnline/VerifyTest.php b/tests/Unit/Drivers/TinkoffOnline/VerifyTest.php index f30fd64c..3402b272 100644 --- a/tests/Unit/Drivers/TinkoffOnline/VerifyTest.php +++ b/tests/Unit/Drivers/TinkoffOnline/VerifyTest.php @@ -24,7 +24,7 @@ it('verify for new', function () { fakeEvents(); - fakeTinkoffOnlineHttp('new'); + fakeTinkoffOnlineHttp('NEW'); $payment = createPayment(TypeEnum::tinkoffOnline); From 444c6877c7207a6a52ace50d79d3b353b39db9d9 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 3 Aug 2023 22:32:32 +0300 Subject: [PATCH 130/164] Fixed tests --- src/Core/src/Resources/Resource.php | 3 +-- tests/Fixtures/Payments/Cash.php | 4 ++-- tests/Fixtures/Payments/TinkoffCredit.php | 5 +++-- tests/Fixtures/Payments/TinkoffOnline.php | 4 ++-- tests/Unit/Core/Facades/ConfigTest.php | 9 +++++---- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/Core/src/Resources/Resource.php b/src/Core/src/Resources/Resource.php index 309b8d4d..5481589b 100644 --- a/src/Core/src/Resources/Resource.php +++ b/src/Core/src/Resources/Resource.php @@ -18,7 +18,6 @@ namespace Cashbox\Core\Resources; use Cashbox\Core\Data\Config\DriverData; -use Cashbox\Core\Enums\CurrencyEnum; use Illuminate\Database\Eloquent\Model; /** @@ -26,7 +25,7 @@ */ abstract class Resource { - abstract public function currency(): CurrencyEnum; + abstract public function currency(): int; abstract public function sum(): int; diff --git a/tests/Fixtures/Payments/Cash.php b/tests/Fixtures/Payments/Cash.php index f090754a..241e818b 100644 --- a/tests/Fixtures/Payments/Cash.php +++ b/tests/Fixtures/Payments/Cash.php @@ -22,9 +22,9 @@ class Cash extends CashResource { - public function currency(): CurrencyEnum + public function currency(): int { - return CurrencyEnum::USD; + return CurrencyEnum::USD->value; } public function sum(): int diff --git a/tests/Fixtures/Payments/TinkoffCredit.php b/tests/Fixtures/Payments/TinkoffCredit.php index 35a4e8c4..ef5a45f6 100644 --- a/tests/Fixtures/Payments/TinkoffCredit.php +++ b/tests/Fixtures/Payments/TinkoffCredit.php @@ -24,9 +24,9 @@ class TinkoffCredit extends TinkoffCreditResource { - public function currency(): CurrencyEnum + public function currency(): int { - return CurrencyEnum::USD; + return CurrencyEnum::USD->value; } public function sum(): int @@ -42,6 +42,7 @@ public function contact(): ?ContactData 'middleName' => fake()->firstName, 'lastName' => fake()->lastName, ], + 'mobilePhone' => '1234567890', 'email' => fake()->safeEmail, ]); diff --git a/tests/Fixtures/Payments/TinkoffOnline.php b/tests/Fixtures/Payments/TinkoffOnline.php index dca2fe94..8c4cb46f 100644 --- a/tests/Fixtures/Payments/TinkoffOnline.php +++ b/tests/Fixtures/Payments/TinkoffOnline.php @@ -24,9 +24,9 @@ class TinkoffOnline extends TinkoffOnlineResource { - public function currency(): CurrencyEnum + public function currency(): int { - return CurrencyEnum::USD; + return CurrencyEnum::USD->value; } public function sum(): int diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 57d9da99..ae475ed0 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -63,6 +63,7 @@ expect($data->drivers)->toBe([ TypeEnum::cash() => TypeEnum::cash, TypeEnum::tinkoffCredit() => TypeEnum::tinkoffCredit, + TypeEnum::tinkoffOnline() => TypeEnum::tinkoffOnline, ]); }); @@ -164,12 +165,12 @@ function (array $main, array $driver, array $expected) { expect($item->getQueue()->refund)->toBe($expected['refund']); } )->with([ - 'filled' => [ + 'filled' => [ driverData('q1', 'q2', 'q3'), driverData('q4', 'q5', 'q6'), driverData('q4', 'q5', 'q6'), ], - 'partial' => [ + 'partial' => [ driverData('q1', 'q2', 'q3'), driverData('q4', null, null), driverData('q4', null, null), @@ -179,12 +180,12 @@ function (array $main, array $driver, array $expected) { [], driverData(null, null, null), ], - 'main empty' => [ + 'main empty' => [ [], driverData('q4', 'q5', 'q6'), driverData('q4', 'q5', 'q6'), ], - 'full empty' => [ + 'full empty' => [ [], [], driverData(null, null, null), From 90fd3182f2fcd0d51922f197cdcb8de750c02077 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 3 Aug 2023 22:49:30 +0300 Subject: [PATCH 131/164] Refactored Tinkoff QR Code driver --- src/Core/src/Http/Request.php | 3 +- src/Core/src/Services/Driver.php | 4 +- src/TinkoffQrCode/src/Driver.php | 64 +++++-------- src/TinkoffQrCode/src/Helpers/Statuses.php | 43 --------- .../src/{ => Http}/Requests/BaseRequest.php | 21 ++--- .../Requests/CancelRequest.php} | 13 ++- .../Requests/CreateRequest.php} | 20 ++-- .../Requests/GetQrRequest.php} | 12 ++- .../Requests/GetStateRequest.php} | 10 +- .../src/Http/Responses/Response.php | 67 ++++++++++++++ src/TinkoffQrCode/src/Requests/Init.php | 36 -------- .../src/Resources/TinkoffQrCodeResource.php | 42 +++++++++ src/TinkoffQrCode/src/Responses/Init.php | 29 ------ src/TinkoffQrCode/src/Responses/QrCode.php | 43 --------- src/TinkoffQrCode/src/Responses/Refund.php | 29 ------ src/TinkoffQrCode/src/Responses/State.php | 34 ------- .../Manager.php => Services/Exception.php} | 45 +++++---- src/TinkoffQrCode/src/Services/Statuses.php | 29 ++++++ tests/Fixtures/App/Enums/TypeEnum.php | 2 + tests/Fixtures/Payments/TinkoffQrCode.php | 62 +++++++++++++ tests/Helpers/Http/Tinkoff/QrCode.php | 57 ++++++++++++ tests/Pest.php | 1 + tests/TestCase.php | 17 ++++ tests/Unit/Core/Facades/ConfigTest.php | 1 + .../Unit/Drivers/TinkoffQrCode/CreateTest.php | 75 +++++++++++++++ .../Unit/Drivers/TinkoffQrCode/RefundTest.php | 92 +++++++++++++++++++ .../Unit/Drivers/TinkoffQrCode/VerifyTest.php | 67 ++++++++++++++ 27 files changed, 597 insertions(+), 321 deletions(-) delete mode 100644 src/TinkoffQrCode/src/Helpers/Statuses.php rename src/TinkoffQrCode/src/{ => Http}/Requests/BaseRequest.php (50%) rename src/TinkoffQrCode/src/{Requests/Cancel.php => Http/Requests/CancelRequest.php} (57%) rename src/TinkoffQrCode/src/{Resources/Details.php => Http/Requests/CreateRequest.php} (52%) rename src/TinkoffQrCode/src/{Requests/GetState.php => Http/Requests/GetQrRequest.php} (61%) rename src/TinkoffQrCode/src/{Requests/GetQR.php => Http/Requests/GetStateRequest.php} (62%) create mode 100644 src/TinkoffQrCode/src/Http/Responses/Response.php delete mode 100644 src/TinkoffQrCode/src/Requests/Init.php create mode 100644 src/TinkoffQrCode/src/Resources/TinkoffQrCodeResource.php delete mode 100644 src/TinkoffQrCode/src/Responses/Init.php delete mode 100644 src/TinkoffQrCode/src/Responses/QrCode.php delete mode 100644 src/TinkoffQrCode/src/Responses/Refund.php delete mode 100644 src/TinkoffQrCode/src/Responses/State.php rename src/TinkoffQrCode/src/{Exceptions/Manager.php => Services/Exception.php} (65%) create mode 100644 src/TinkoffQrCode/src/Services/Statuses.php create mode 100644 tests/Fixtures/Payments/TinkoffQrCode.php create mode 100644 tests/Helpers/Http/Tinkoff/QrCode.php create mode 100644 tests/Unit/Drivers/TinkoffQrCode/CreateTest.php create mode 100644 tests/Unit/Drivers/TinkoffQrCode/RefundTest.php create mode 100644 tests/Unit/Drivers/TinkoffQrCode/VerifyTest.php diff --git a/src/Core/src/Http/Request.php b/src/Core/src/Http/Request.php index 17e90328..5bad7f64 100644 --- a/src/Core/src/Http/Request.php +++ b/src/Core/src/Http/Request.php @@ -46,7 +46,8 @@ abstract class Request abstract public function body(): array; public function __construct( - public readonly Resource $resource + public readonly Resource $resource, + public readonly ?string $externalId = null ) {} public function url(): ?string diff --git a/src/Core/src/Services/Driver.php b/src/Core/src/Services/Driver.php index 023b6508..a73b3220 100644 --- a/src/Core/src/Services/Driver.php +++ b/src/Core/src/Services/Driver.php @@ -50,9 +50,9 @@ public function statuses(): Statuses return $this->resolve($this->statuses, $this->payment); } - protected function request(string $request, ?string $response = null): Response + protected function request(string $request, ?string $response = null, ?string $externalId = null): Response { - $data = $this->call($request, 'make', $this->resource()); + $data = $this->call($request, 'make', $this->resource(), $externalId); $content = $this->http->send($data, $this->resolveException()); diff --git a/src/TinkoffQrCode/src/Driver.php b/src/TinkoffQrCode/src/Driver.php index e852b458..7dcc5782 100644 --- a/src/TinkoffQrCode/src/Driver.php +++ b/src/TinkoffQrCode/src/Driver.php @@ -15,63 +15,41 @@ namespace Cashbox\Tinkoff\QrCode; -use Cashbox\Core\Facades\Helpers\Model; +use Cashbox\Core\Http\Response as BaseResponse; use Cashbox\Core\Services\Driver as BaseDriver; -use Cashbox\Tinkoff\QrCode\Exceptions\Manager; -use Cashbox\Tinkoff\QrCode\Helpers\Statuses; -use Cashbox\Tinkoff\QrCode\Requests\Cancel; -use Cashbox\Tinkoff\QrCode\Requests\GetQR; -use Cashbox\Tinkoff\QrCode\Requests\GetState; -use Cashbox\Tinkoff\QrCode\Requests\Init; -use Cashbox\Tinkoff\QrCode\Resources\Details; -use Cashbox\Tinkoff\QrCode\Responses\QrCode; -use Cashbox\Tinkoff\QrCode\Responses\Refund; -use Cashbox\Tinkoff\QrCode\Responses\State; -use DragonCode\Contracts\Cashier\Http\Response; +use Cashbox\Tinkoff\QrCode\Http\Requests\CancelRequest; +use Cashbox\Tinkoff\QrCode\Http\Requests\CreateRequest; +use Cashbox\Tinkoff\QrCode\Http\Requests\GetQrRequest; +use Cashbox\Tinkoff\QrCode\Http\Requests\GetStateRequest; +use Cashbox\Tinkoff\QrCode\Http\Responses\Response; +use Cashbox\Tinkoff\QrCode\Services\Exception; +use Cashbox\Tinkoff\QrCode\Services\Statuses; +/** + * @see https://www.tinkoff.ru/kassa/develop/api/payments/ + */ class Driver extends BaseDriver { - protected $exception = Manager::class; + protected string $statuses = Statuses::class; - protected $statuses = Statuses::class; + protected string $exception = Exception::class; - protected $details = Details::class; + protected string $response = Response::class; - public function start(): Response + public function start(): BaseResponse { - $this->init(); + $response = $this->request(CreateRequest::class); - $request = GetQR::make($this->model); - - return $this->request($request, QrCode::class); + return $this->request(GetQrRequest::class, externalId: $response->getExternalId()); } - public function check(): Response + public function verify(): BaseResponse { - $request = GetState::make($this->model); - - return $this->request($request, State::class); + return $this->request(GetStateRequest::class); } - public function refund(): Response + public function refund(): BaseResponse { - $request = Cancel::make($this->model); - - return $this->request($request, Refund::class); - } - - protected function init(): void - { - $request = Init::make($this->model); - - $response = $this->request($request, Responses\Init::class); - - $external_id = $response->getExternalId(); - - $details = $this->details($response->toArray()); - - Model::updateOrCreate($this->payment, compact('external_id', 'details')); - - $this->payment->refresh(); + return $this->request(CancelRequest::class); } } diff --git a/src/TinkoffQrCode/src/Helpers/Statuses.php b/src/TinkoffQrCode/src/Helpers/Statuses.php deleted file mode 100644 index 537ba52d..00000000 --- a/src/TinkoffQrCode/src/Helpers/Statuses.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -namespace Cashbox\Tinkoff\QrCode\Helpers; - -use Cashbox\Core\Services\Statuses as BaseStatus; - -class Statuses extends BaseStatus -{ - public const NEW = [ - 'FORM_SHOWED', - 'NEW', - ]; - public const REFUNDING = [ - 'REFUNDING', - ]; - public const REFUNDED = [ - 'PARTIAL_REFUNDED', - 'REFUNDED', - 'REVERSED', - ]; - public const FAILED = [ - 'ATTEMPTS_EXPIRED', - 'CANCELED', - 'DEADLINE_EXPIRED', - 'REJECTED', - ]; - public const SUCCESS = [ - 'CONFIRMED', - ]; -} diff --git a/src/TinkoffQrCode/src/Requests/BaseRequest.php b/src/TinkoffQrCode/src/Http/Requests/BaseRequest.php similarity index 50% rename from src/TinkoffQrCode/src/Requests/BaseRequest.php rename to src/TinkoffQrCode/src/Http/Requests/BaseRequest.php index a8e4d3e0..08b3163e 100644 --- a/src/TinkoffQrCode/src/Requests/BaseRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/BaseRequest.php @@ -15,28 +15,25 @@ declare(strict_types=1); -namespace Cashbox\Tinkoff\QrCode\Requests; +namespace Cashbox\Tinkoff\QrCode\Http\Requests; use Cashbox\Core\Http\Request; -use Cashbox\Core\Support\URI; -use Cashbox\Tinkoff\Auth\Auth; +use Cashbox\Core\Services\Sign as BaseSign; +use Cashbox\Tinkoff\Auth\Sign; abstract class BaseRequest extends Request { - protected $host = 'https://securepay.tinkoff.ru'; + protected string $productionHost = 'https://securepay.tinkoff.ru'; - protected $auth = Auth::class; + protected BaseSign|string|null $auth = Sign::class; - public function getRawHeaders(): array + protected function clientId(): string { - return [ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ]; + return $this->resource->config->credentials->clientId; } - protected function getUriBuilder(): URI + protected function clientSecret(): string { - return URI::make($this->host, null); + return $this->resource->config->credentials->clientSecret; } } diff --git a/src/TinkoffQrCode/src/Requests/Cancel.php b/src/TinkoffQrCode/src/Http/Requests/CancelRequest.php similarity index 57% rename from src/TinkoffQrCode/src/Requests/Cancel.php rename to src/TinkoffQrCode/src/Http/Requests/CancelRequest.php index 2375e2ac..ae226d52 100644 --- a/src/TinkoffQrCode/src/Requests/Cancel.php +++ b/src/TinkoffQrCode/src/Http/Requests/CancelRequest.php @@ -15,18 +15,17 @@ declare(strict_types=1); -namespace Cashbox\Tinkoff\QrCode\Requests; +namespace Cashbox\Tinkoff\QrCode\Http\Requests; -class Cancel extends BaseRequest +class CancelRequest extends BaseRequest { - protected $path = '/v2/Cancel'; + protected string $productionUri = '/v2/Cancel'; - public function getRawBody(): array + public function body(): array { return [ - 'PaymentId' => $this->model->getExternalId(), - - 'Amount' => $this->model->getSum(), + 'PaymentId' => $this->resource->payment->cashbox->external_id, + 'Amount' => $this->resource->sum(), ]; } } diff --git a/src/TinkoffQrCode/src/Resources/Details.php b/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php similarity index 52% rename from src/TinkoffQrCode/src/Resources/Details.php rename to src/TinkoffQrCode/src/Http/Requests/CreateRequest.php index cc424359..3703a5b6 100644 --- a/src/TinkoffQrCode/src/Resources/Details.php +++ b/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php @@ -15,24 +15,20 @@ declare(strict_types=1); -namespace Cashbox\Tinkoff\QrCode\Resources; +namespace Cashbox\Tinkoff\QrCode\Http\Requests; -use Cashbox\Core\Resources\Details as BaseDetails; - -class Details extends BaseDetails +class CreateRequest extends BaseRequest { - protected $url; + protected string $productionUri = '/v2/Init'; - public function getUrl(): ?string - { - return $this->url; - } + protected bool $secure = false; - public function toArray(): array + public function body(): array { return [ - 'status' => $this->status, - 'url' => $this->url, + 'OrderId' => $this->resource->paymentId(), + 'Amount' => $this->resource->sum(), + 'Currency' => $this->resource->currency(), ]; } } diff --git a/src/TinkoffQrCode/src/Requests/GetState.php b/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php similarity index 61% rename from src/TinkoffQrCode/src/Requests/GetState.php rename to src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php index 912e75d0..bcfd813e 100644 --- a/src/TinkoffQrCode/src/Requests/GetState.php +++ b/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php @@ -15,16 +15,18 @@ declare(strict_types=1); -namespace Cashbox\Tinkoff\QrCode\Requests; +namespace Cashbox\Tinkoff\QrCode\Http\Requests; -class GetState extends BaseRequest +class GetQrRequest extends BaseRequest { - protected $path = '/v2/GetState'; + protected string $productionUri = '/v2/GetQr'; - public function getRawBody(): array + public function body(): array { return [ - 'PaymentId' => $this->model->getExternalId(), + 'PaymentId' => $this->externalId, + + 'DataType' => 'PAYLOAD', ]; } } diff --git a/src/TinkoffQrCode/src/Requests/GetQR.php b/src/TinkoffQrCode/src/Http/Requests/GetStateRequest.php similarity index 62% rename from src/TinkoffQrCode/src/Requests/GetQR.php rename to src/TinkoffQrCode/src/Http/Requests/GetStateRequest.php index c8a92dda..b62d1082 100644 --- a/src/TinkoffQrCode/src/Requests/GetQR.php +++ b/src/TinkoffQrCode/src/Http/Requests/GetStateRequest.php @@ -15,16 +15,16 @@ declare(strict_types=1); -namespace Cashbox\Tinkoff\QrCode\Requests; +namespace Cashbox\Tinkoff\QrCode\Http\Requests; -class GetQR extends BaseRequest +class GetStateRequest extends BaseRequest { - protected $path = '/v2/GetQr'; + protected string $productionUri = '/v2/GetState'; - public function getRawBody(): array + public function body(): array { return [ - 'PaymentId' => $this->model->getExternalId(), + 'PaymentId' => $this->resource->payment->cashbox->external_id, ]; } } diff --git a/src/TinkoffQrCode/src/Http/Responses/Response.php b/src/TinkoffQrCode/src/Http/Responses/Response.php new file mode 100644 index 00000000..9371627a --- /dev/null +++ b/src/TinkoffQrCode/src/Http/Responses/Response.php @@ -0,0 +1,67 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Tinkoff\QrCode\Http\Responses; + +use Cashbox\Core\Data\Models\InfoData; +use Cashbox\Core\Http\Response as BaseResponse; +use Spatie\LaravelData\Attributes\MapInputName; + +class Response extends BaseResponse +{ + #[MapInputName('Status')] + public ?string $status; + + #[MapInputName('Data')] + public ?string $url; + + #[MapInputName('PaymentId')] + public string $externalId; + + public function getOperationId(): ?string + { + return null; + } + + public function getInfo(): InfoData + { + return InfoData::from([ + 'externalId' => $this->getExternalId(), + 'operationId' => $this->getOperationId(), + 'status' => $this->getStatus(), + 'extra' => $this->getExtra(), + ]); + } + + public function getExternalId(): ?string + { + return $this->externalId; + } + + protected function getExtra(): array + { + return [ + 'status' => $this->status, + 'url' => $this->url, + ]; + } + + protected function getStatus(): ?string + { + return $this->status; + } +} diff --git a/src/TinkoffQrCode/src/Requests/Init.php b/src/TinkoffQrCode/src/Requests/Init.php deleted file mode 100644 index db9d4e36..00000000 --- a/src/TinkoffQrCode/src/Requests/Init.php +++ /dev/null @@ -1,36 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Tinkoff\QrCode\Requests; - -class Init extends BaseRequest -{ - protected $path = '/v2/Init'; - - protected $secure = false; - - public function getRawBody(): array - { - return [ - 'OrderId' => $this->model->getPaymentId(), - - 'Amount' => $this->model->getSum(), - - 'Currency' => $this->model->getCurrency(), - ]; - } -} diff --git a/src/TinkoffQrCode/src/Resources/TinkoffQrCodeResource.php b/src/TinkoffQrCode/src/Resources/TinkoffQrCodeResource.php new file mode 100644 index 00000000..dcfcc8ef --- /dev/null +++ b/src/TinkoffQrCode/src/Resources/TinkoffQrCodeResource.php @@ -0,0 +1,42 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Tinkoff\QrCode\Resources; + +use Cashbox\Core\Resources\Resource; +use Cashbox\Tinkoff\Credit\Data\ContactData; +use Cashbox\Tinkoff\Credit\Data\ProductData; + +abstract class TinkoffQrCodeResource extends Resource +{ + abstract public function contact(): ?ContactData; + + /** + * @return array + */ + abstract public function productItems(): array; + + public function shopId(): string + { + return $this->config->credentials->clientId; + } + + public function showCaseId(): ?string + { + return $this->config->credentials->extra['showcase_id'] ?? null; + } +} diff --git a/src/TinkoffQrCode/src/Responses/Init.php b/src/TinkoffQrCode/src/Responses/Init.php deleted file mode 100644 index f3fe760f..00000000 --- a/src/TinkoffQrCode/src/Responses/Init.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Tinkoff\QrCode\Responses; - -use Cashbox\Core\Http\Response; - -class Init extends Response -{ - protected $map = [ - self::KEY_EXTERNAL_ID => 'PaymentId', - - self::KEY_STATUS => 'Status', - ]; -} diff --git a/src/TinkoffQrCode/src/Responses/QrCode.php b/src/TinkoffQrCode/src/Responses/QrCode.php deleted file mode 100644 index 8658e85b..00000000 --- a/src/TinkoffQrCode/src/Responses/QrCode.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Tinkoff\QrCode\Responses; - -use Cashbox\Core\Http\Response; - -class QrCode extends Response -{ - public const KEY_URL = 'url'; - - protected $map = [ - self::KEY_EXTERNAL_ID => 'PaymentId', - - self::KEY_STATUS => 'Status', - - self::KEY_URL => 'Data', - ]; - - public function getUrl(): ?string - { - return $this->value(self::KEY_URL); - } - - public function isEmpty(): bool - { - return empty($this->getExternalId()) || empty($this->getUrl()); - } -} diff --git a/src/TinkoffQrCode/src/Responses/Refund.php b/src/TinkoffQrCode/src/Responses/Refund.php deleted file mode 100644 index e8ed180a..00000000 --- a/src/TinkoffQrCode/src/Responses/Refund.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Tinkoff\QrCode\Responses; - -use Cashbox\Core\Http\Response; - -class Refund extends Response -{ - protected $map = [ - self::KEY_EXTERNAL_ID => 'PaymentId', - - self::KEY_STATUS => 'Status', - ]; -} diff --git a/src/TinkoffQrCode/src/Responses/State.php b/src/TinkoffQrCode/src/Responses/State.php deleted file mode 100644 index 448937a7..00000000 --- a/src/TinkoffQrCode/src/Responses/State.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Tinkoff\QrCode\Responses; - -use Cashbox\Core\Http\Response; - -class State extends Response -{ - protected $map = [ - self::KEY_EXTERNAL_ID => 'PaymentId', - - self::KEY_STATUS => 'Status', - ]; - - public function isEmpty(): bool - { - return empty($this->getExternalId()) || empty($this->getStatus()); - } -} diff --git a/src/TinkoffQrCode/src/Exceptions/Manager.php b/src/TinkoffQrCode/src/Services/Exception.php similarity index 65% rename from src/TinkoffQrCode/src/Exceptions/Manager.php rename to src/TinkoffQrCode/src/Services/Exception.php index 4138b34c..1f97b10f 100644 --- a/src/TinkoffQrCode/src/Exceptions/Manager.php +++ b/src/TinkoffQrCode/src/Services/Exception.php @@ -13,25 +13,28 @@ * @see https://cashbox.city */ -namespace Cashbox\Tinkoff\QrCode\Exceptions; +declare(strict_types=1); -use Cashbox\Core\Exceptions\Http\BankInternalErrorException; -use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; -use Cashbox\Core\Exceptions\Http\CardHasStolenException; -use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; -use Cashbox\Core\Exceptions\Http\InsufficientFundsCardException; -use Cashbox\Core\Exceptions\Http\InvalidCardException; -use Cashbox\Core\Exceptions\Http\PaymentCompletedException; -use Cashbox\Core\Exceptions\Http\PaymentDeclinedException; -use Cashbox\Core\Exceptions\Http\PaymentTypeNotAvailableException; -use Cashbox\Core\Exceptions\Http\SumException; -use Cashbox\Core\Exceptions\Http\TooManyRequestsException; -use Cashbox\Core\Exceptions\Http\TryAgainLaterClientException; -use Cashbox\Core\Exceptions\Manager as ExceptionManager; +namespace Cashbox\Tinkoff\QrCode\Services; -class Manager extends ExceptionManager +use Cashbox\Core\Exceptions\External\BankInternalErrorException; +use Cashbox\Core\Exceptions\External\BuyerNotFoundClientException; +use Cashbox\Core\Exceptions\External\CardHasStolenException; +use Cashbox\Core\Exceptions\External\ContactTheSellerClientException; +use Cashbox\Core\Exceptions\External\IncorrectSumException; +use Cashbox\Core\Exceptions\External\InsufficientFundsCardException; +use Cashbox\Core\Exceptions\External\InvalidCardException; +use Cashbox\Core\Exceptions\External\PaymentCompletedException; +use Cashbox\Core\Exceptions\External\PaymentDeclinedException; +use Cashbox\Core\Exceptions\External\PaymentTypeNotAvailableException; +use Cashbox\Core\Exceptions\External\TooManyRequestsException; +use Cashbox\Core\Exceptions\External\TransactionNotFoundException; +use Cashbox\Core\Exceptions\External\TryAgainLaterClientException; +use Cashbox\Core\Services\Exception as BaseException; + +class Exception extends BaseException { - protected $codes = [ + protected array $codes = [ 7 => BuyerNotFoundClientException::class, 53 => ContactTheSellerClientException::class, 99 => PaymentDeclinedException::class, @@ -39,8 +42,10 @@ class Manager extends ExceptionManager 102 => PaymentDeclinedException::class, 103 => TryAgainLaterClientException::class, 119 => TooManyRequestsException::class, + 403 => PaymentDeclinedException::class, + 404 => TransactionNotFoundException::class, 604 => PaymentDeclinedException::class, - 620 => SumException::class, + 620 => IncorrectSumException::class, 623 => PaymentCompletedException::class, 642 => InvalidCardException::class, 1004 => CardHasStolenException::class, @@ -67,7 +72,7 @@ class Manager extends ExceptionManager 1061 => InvalidCardException::class, 1062 => InvalidCardException::class, 1063 => InvalidCardException::class, - 1064 => SumException::class, + 1064 => IncorrectSumException::class, 1065 => PaymentDeclinedException::class, 1076 => PaymentDeclinedException::class, 1089 => TryAgainLaterClientException::class, @@ -80,7 +85,7 @@ class Manager extends ExceptionManager 9999 => BankInternalErrorException::class, ]; - protected $code_keys = ['ErrorCode']; + protected array $codeKeys = ['ErrorCode']; - protected $reason_keys = ['Details', 'Message']; + protected array $reasonKeys = ['Details', 'Message']; } diff --git a/src/TinkoffQrCode/src/Services/Statuses.php b/src/TinkoffQrCode/src/Services/Statuses.php new file mode 100644 index 00000000..8e2db840 --- /dev/null +++ b/src/TinkoffQrCode/src/Services/Statuses.php @@ -0,0 +1,29 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Tinkoff\QrCode\Services; + +use Cashbox\Core\Services\Statuses as BaseStatus; + +class Statuses extends BaseStatus +{ + public const FAILED = ['ATTEMPTS_EXPIRED', 'CANCELED', 'DEADLINE_EXPIRED', 'REJECTED']; + public const NEW = ['FORM_SHOWED', 'NEW']; + public const REFUNDED = ['PARTIAL_REFUNDED', 'REFUNDED', 'REVERSED']; + public const REFUNDING = ['REFUNDING']; + public const SUCCESS = ['CONFIRMED']; +} diff --git a/tests/Fixtures/App/Enums/TypeEnum.php b/tests/Fixtures/App/Enums/TypeEnum.php index 5106907e..ee41d019 100644 --- a/tests/Fixtures/App/Enums/TypeEnum.php +++ b/tests/Fixtures/App/Enums/TypeEnum.php @@ -24,6 +24,7 @@ * @method static string outside() * @method static string tinkoffCredit() * @method static string tinkoffOnline() + * @method static string tinkoffQrCode() */ enum TypeEnum: string { @@ -33,4 +34,5 @@ enum TypeEnum: string case outside = 'outside'; case tinkoffCredit = 'tinkoff_credit'; case tinkoffOnline = 'tinkoff_online'; + case tinkoffQrCode = 'tinkoff_qr'; } diff --git a/tests/Fixtures/Payments/TinkoffQrCode.php b/tests/Fixtures/Payments/TinkoffQrCode.php new file mode 100644 index 00000000..33b5559d --- /dev/null +++ b/tests/Fixtures/Payments/TinkoffQrCode.php @@ -0,0 +1,62 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Tests\Fixtures\Payments; + +use Cashbox\Core\Enums\CurrencyEnum; +use Cashbox\Tinkoff\Credit\Data\ContactData; +use Cashbox\Tinkoff\Credit\Data\ProductData; +use Cashbox\Tinkoff\QrCode\Resources\TinkoffQrCodeResource; + +class TinkoffQrCode extends TinkoffQrCodeResource +{ + public function currency(): int + { + return CurrencyEnum::USD->value; + } + + public function sum(): int + { + return $this->payment->price; + } + + public function contact(): ?ContactData + { + return ContactData::from([ + 'fio' => [ + 'firstName' => fake()->firstName, + 'middleName' => fake()->firstName, + 'lastName' => fake()->lastName, + ], + 'mobilePhone' => '1234567890', + 'email' => fake()->safeEmail, + ]); + } + + public function productItems(): array + { + return [ + ProductData::from([ + 'name' => fake()->words(2, true), + 'quantity' => fake()->numberBetween(1, 10), + 'price' => $this->payment->price, + 'category' => fake()->creditCardType, + 'vendorCode' => fake()->randomLetter(), + ]), + ]; + } +} diff --git a/tests/Helpers/Http/Tinkoff/QrCode.php b/tests/Helpers/Http/Tinkoff/QrCode.php new file mode 100644 index 00000000..c3d5a14a --- /dev/null +++ b/tests/Helpers/Http/Tinkoff/QrCode.php @@ -0,0 +1,57 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Illuminate\Support\Facades\Http; + +function fakeTinkoffQrCodeHttp(string $info = 'CONFIRMED'): void +{ + Http::fake([ + 'https://securepay.tinkoff.ru/v2/Init' => Http::response([ + 'Success' => true, + 'ErrorCode' => 0, + 'TerminalKey' => fake()->word, + 'Status' => 'NEW', + 'PaymentId' => fake()->randomNumber(), + 'OrderId' => fake()->randomNumber(), + 'Amount' => fake()->randomNumber(), + 'PaymentURL' => fake()->imageUrl, + ]), + + 'https://securepay.tinkoff.ru/v2/GetState' => Http::response([ + 'Success' => true, + 'ErrorCode' => 0, + 'Message' => 'OK', + 'TerminalKey' => fake()->word, + 'Status' => $info, + 'PaymentId' => fake()->randomNumber(), + 'OrderId' => fake()->randomNumber(), + 'Amount' => fake()->randomNumber(), + ]), + + 'https://securepay.tinkoff.ru/v2/Cancel' => Http::response([ + 'Success' => true, + 'ErrorCode' => 0, + 'Message' => 'OK', + 'TerminalKey' => fake()->word, + 'Status' => 'REFUNDED', + 'PaymentId' => fake()->randomNumber(), + 'OrderId' => fake()->randomNumber(), + 'OriginalAmount' => fake()->randomNumber(), + 'NewAmount' => 0, + ]), + ]); +} diff --git a/tests/Pest.php b/tests/Pest.php index d3450084..3f4f19dc 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -33,6 +33,7 @@ uses(TestCase::class)->group('tinkoff-auth')->in('Unit/Drivers/TinkoffAuth'); uses(TestCase::class)->group('tinkoff-credit')->in('Unit/Drivers/TinkoffCredit'); uses(TestCase::class)->group('tinkoff-online')->in('Unit/Drivers/TinkoffOnline'); +uses(TestCase::class)->group('tinkoff-qr')->in('Unit/Drivers/TinkoffQrCode'); /* |-------------------------------------------------------------------------- diff --git a/tests/TestCase.php b/tests/TestCase.php index 0ceb5c59..a38a29da 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -24,6 +24,7 @@ use Cashbox\Core\Providers\ServiceProvider; use Cashbox\Tinkoff\Credit\Driver as TinkoffCreditDriver; use Cashbox\Tinkoff\Online\Driver as TinkoffOnlineDriver; +use Cashbox\Tinkoff\QrCode\Driver as TinkoffQrCodeDriver; use Illuminate\Foundation\Application; use Illuminate\Foundation\Testing\RefreshDatabase; use Orchestra\Testbench\TestCase as BaseTestCase; @@ -34,6 +35,7 @@ use Tests\Fixtures\Payments\Cash; use Tests\Fixtures\Payments\TinkoffCredit; use Tests\Fixtures\Payments\TinkoffOnline; +use Tests\Fixtures\Payments\TinkoffQrCode; abstract class TestCase extends BaseTestCase { @@ -88,6 +90,7 @@ protected function setUpDrivers(Application $app): void $this->setUpCashDriver($app); $this->setUpTinkoffCreditDriver($app); $this->setUpTinkoffOnlineDriver($app); + $this->setUpTinkoffQrCodeDriver($app); } protected function setUpCashDriver(Application $app): void @@ -134,4 +137,18 @@ protected function setUpTinkoffOnlineDriver(Application $app): void ], ]); } + + protected function setUpTinkoffQrCodeDriver(Application $app): void + { + $app['config']->set('cashbox.payment.drivers.' . TypeEnum::tinkoffQrCode(), TypeEnum::tinkoffQrCode); + + $app['config']->set('cashbox.drivers.' . TypeEnum::tinkoffQrCode(), [ + 'driver' => TinkoffQrCodeDriver::class, + 'resource' => TinkoffQrCode::class, + 'credentials' => [ + 'client_id' => fake()->randomLetter, + 'client_secret' => fake()->password, + ], + ]); + } } diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index ae475ed0..46bd2699 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -64,6 +64,7 @@ TypeEnum::cash() => TypeEnum::cash, TypeEnum::tinkoffCredit() => TypeEnum::tinkoffCredit, TypeEnum::tinkoffOnline() => TypeEnum::tinkoffOnline, + TypeEnum::tinkoffQrCode() => TypeEnum::tinkoffQrCode, ]); }); diff --git a/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php b/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php new file mode 100644 index 00000000..c60c05df --- /dev/null +++ b/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php @@ -0,0 +1,75 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Cashbox\Core\Events\PaymentCreatedEvent; +use Cashbox\Core\Events\PaymentFailedEvent; +use Cashbox\Core\Events\PaymentRefundedEvent; +use Cashbox\Core\Events\PaymentSuccessEvent; +use Cashbox\Core\Events\PaymentWaitRefundEvent; +use Illuminate\Support\Facades\Event; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; + +it('checks the progress', function () { + fakeEvents(); + fakeTinkoffQrCodeHttp('NEW'); + + $payment = createPayment(TypeEnum::tinkoffOnline); + + expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->status)->toBe(StatusEnum::new); + + expect($payment)->toBeHasCashbox(); + + $payment->refresh(); + + expect($payment)->toBeStatus(StatusEnum::new); + + expect($payment->cashbox->info->extra['url'])->toBeUrl(); + + Event::assertDispatchedTimes(PaymentCreatedEvent::class); + + Event::assertNotDispatched(PaymentSuccessEvent::class); + Event::assertNotDispatched(PaymentFailedEvent::class); + Event::assertNotDispatched(PaymentRefundedEvent::class); + Event::assertNotDispatched(PaymentWaitRefundEvent::class); +}); + +it('checks the success', function () { + fakeEvents(); + fakeTinkoffQrCodeHttp(); + + $payment = createPayment(TypeEnum::tinkoffOnline); + + expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->status)->toBe(StatusEnum::new); + + expect($payment)->toBeHasCashbox(); + + $payment->refresh(); + + expect($payment)->toBeStatus(StatusEnum::success); + + expect($payment->cashbox->info->extra['url'])->toBeUrl(); + + Event::assertDispatchedTimes(PaymentCreatedEvent::class); + + Event::assertDispatchedTimes(PaymentSuccessEvent::class, 1); + Event::assertNotDispatched(PaymentFailedEvent::class); + Event::assertNotDispatched(PaymentRefundedEvent::class); + Event::assertNotDispatched(PaymentWaitRefundEvent::class); +}); diff --git a/tests/Unit/Drivers/TinkoffQrCode/RefundTest.php b/tests/Unit/Drivers/TinkoffQrCode/RefundTest.php new file mode 100644 index 00000000..f035da2e --- /dev/null +++ b/tests/Unit/Drivers/TinkoffQrCode/RefundTest.php @@ -0,0 +1,92 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Cashbox\Core\Console\Commands\Refund; +use Cashbox\Core\Events\PaymentCreatedEvent; +use Cashbox\Core\Events\PaymentRefundedEvent; +use Cashbox\Core\Events\PaymentSuccessEvent; +use Illuminate\Support\Facades\Event; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; + +it('refund for new', function () { + fakeEvents(); + fakeTinkoffQrCodeHttp('NEW'); + + $payment = createPayment(TypeEnum::tinkoffOnline); + + expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->status)->toBe(StatusEnum::new); + + expect($payment)->toBeHasCashbox(); + + Event::assertDispatchedTimes(PaymentCreatedEvent::class); + Event::assertDispatchedTimes(PaymentSuccessEvent::class, 0); + + fakeEvents(); + + artisan(Refund::class); + + // time has not yet come to refund. + expect($payment)->toBeStatus(StatusEnum::new); + + Event::assertNothingDispatched(); + + subHour($payment); + + fakeEvents(); + + artisan(Refund::class); + + expect($payment)->toBeStatus(StatusEnum::refund); + + Event::assertDispatchedTimes(PaymentRefundedEvent::class); +}); + +it('refund for success', function () { + fakeEvents(); + fakeTinkoffQrCodeHttp(); + + $payment = createPayment(TypeEnum::tinkoffOnline); + + expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->status)->toBe(StatusEnum::new); + + expect($payment)->toBeHasCashbox(); + + Event::assertDispatchedTimes(PaymentCreatedEvent::class); + Event::assertDispatchedTimes(PaymentSuccessEvent::class); + + fakeEvents(); + + artisan(Refund::class); + + // time has not yet come to refund. + expect($payment)->toBeStatus(StatusEnum::success); + + Event::assertNothingDispatched(); + + subHour($payment); + + fakeEvents(); + + artisan(Refund::class); + + expect($payment)->toBeStatus(StatusEnum::refund); + + Event::assertDispatchedTimes(PaymentRefundedEvent::class); +}); diff --git a/tests/Unit/Drivers/TinkoffQrCode/VerifyTest.php b/tests/Unit/Drivers/TinkoffQrCode/VerifyTest.php new file mode 100644 index 00000000..e94b5e02 --- /dev/null +++ b/tests/Unit/Drivers/TinkoffQrCode/VerifyTest.php @@ -0,0 +1,67 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Cashbox\Core\Console\Commands\Verify; +use Cashbox\Core\Events\PaymentCreatedEvent; +use Cashbox\Core\Events\PaymentSuccessEvent; +use Illuminate\Support\Facades\Event; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; + +it('verify for new', function () { + fakeEvents(); + fakeTinkoffQrCodeHttp('NEW'); + + $payment = createPayment(TypeEnum::tinkoffOnline); + + expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->status)->toBe(StatusEnum::new); + + expect($payment)->toBeHasCashbox(); + + Event::assertDispatchedTimes(PaymentCreatedEvent::class); + Event::assertDispatchedTimes(PaymentSuccessEvent::class, 0); + + fakeEvents(); + + artisan(Verify::class); + + expect($payment)->toBeStatus(StatusEnum::new); + + Event::assertNothingDispatched(); +}); + +it('refund for success', function () { + fakeEvents(); + fakeTinkoffQrCodeHttp(); + + $payment = createPayment(TypeEnum::tinkoffOnline); + + expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->status)->toBe(StatusEnum::new); + + expect($payment)->toBeHasCashbox(); + + Event::assertDispatchedTimes(PaymentCreatedEvent::class); + Event::assertDispatchedTimes(PaymentSuccessEvent::class); + + fakeEvents(); + + artisan(Verify::class); + + Event::assertNothingDispatched(); +}); From d154146293cf1e48cc8f5e76fcff3492196c6e2e Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 4 Aug 2023 01:37:30 +0300 Subject: [PATCH 132/164] Added Sber Auth driver --- composer.json | 1 + src/Core/src/Services/Sign.php | 3 +- src/SberAuth/composer.json | 1 + src/SberAuth/src/Auth.php | 83 ------------------ src/SberAuth/src/Exceptions/Manager.php | 28 ------- src/SberAuth/src/Facades/Cache.php | 35 -------- src/SberAuth/src/Http/Request.php | 91 -------------------- src/SberAuth/src/Objects/Query.php | 38 --------- src/SberAuth/src/Resources/AccessToken.php | 51 ----------- src/SberAuth/src/Services/Hash.php | 64 ++++++++++++++ src/SberAuth/src/Services/Http.php | 87 +++++++++++++++++++ src/SberAuth/src/Services/Identifier.php | 38 +++++++++ src/SberAuth/src/Sign.php | 61 ++++++++++++++ src/SberAuth/src/Support/Cache.php | 98 ---------------------- src/SberAuth/src/Support/Hash.php | 83 ------------------ src/TinkoffAuth/src/Sign.php | 4 +- 16 files changed, 256 insertions(+), 510 deletions(-) delete mode 100644 src/SberAuth/src/Auth.php delete mode 100644 src/SberAuth/src/Exceptions/Manager.php delete mode 100644 src/SberAuth/src/Facades/Cache.php delete mode 100644 src/SberAuth/src/Http/Request.php delete mode 100644 src/SberAuth/src/Objects/Query.php delete mode 100644 src/SberAuth/src/Resources/AccessToken.php create mode 100644 src/SberAuth/src/Services/Hash.php create mode 100644 src/SberAuth/src/Services/Http.php create mode 100644 src/SberAuth/src/Services/Identifier.php create mode 100644 src/SberAuth/src/Sign.php delete mode 100644 src/SberAuth/src/Support/Cache.php delete mode 100644 src/SberAuth/src/Support/Hash.php diff --git a/composer.json b/composer.json index f83c259a..176f5cad 100644 --- a/composer.json +++ b/composer.json @@ -52,6 +52,7 @@ "archtechx/enums": "^0.3.2", "doctrine/dbal": "^3.6", "dragon-code/contracts": "^2.20", + "dragon-code/laravel-cache": "^3.9", "dragon-code/laravel-support": "^3.6", "dragon-code/simple-dto": "^2.7.1", "dragon-code/support": "^6.11.2", diff --git a/src/Core/src/Services/Sign.php b/src/Core/src/Services/Sign.php index 632ec2a0..b7a390f8 100644 --- a/src/Core/src/Services/Sign.php +++ b/src/Core/src/Services/Sign.php @@ -25,7 +25,8 @@ abstract class Sign public function __construct( protected readonly Request $request, protected readonly DriverData $config, - protected readonly bool $secure = true + protected readonly bool $secure = true, + protected readonly array $extra = [] ) {} public function headers(): array diff --git a/src/SberAuth/composer.json b/src/SberAuth/composer.json index 59ff1072..e3b9e23a 100644 --- a/src/SberAuth/composer.json +++ b/src/SberAuth/composer.json @@ -46,6 +46,7 @@ "ext-json": "*", "cashbox/core": "^3.0", "dragon-code/contracts": "^2.20", + "dragon-code/laravel-cache": "^3.9", "dragon-code/simple-dto": "^2.7.1", "dragon-code/support": "^6.11.2", "illuminate/support": "^10.15" diff --git a/src/SberAuth/src/Auth.php b/src/SberAuth/src/Auth.php deleted file mode 100644 index d9a11f6e..00000000 --- a/src/SberAuth/src/Auth.php +++ /dev/null @@ -1,83 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Sber\Auth; - -use Cashbox\Core\Facades\Helpers\Unique; -use Cashbox\Sber\Auth\Support\Hash; -use DragonCode\Contracts\Cashier\Auth\Auth as AuthContract; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\AccessToken; -use DragonCode\Contracts\Cashier\Resources\Model; -use DragonCode\Support\Concerns\Makeable; -use DragonCode\Support\Facades\Helpers\Arr; - -/** @method static Auth make(Model $model, Request $request, bool $hash = true, array $extra = []) */ -class Auth implements AuthContract -{ - use Makeable; - - /** @var \DragonCode\Contracts\Cashier\Resources\Model */ - protected $model; - - /** @var \DragonCode\Contracts\Cashier\Http\Request */ - protected $request; - - /** @var string */ - protected $scope; - - public function __construct(Model $model, Request $request, bool $hash = true, array $extra = []) - { - $this->model = $model; - $this->request = $request; - - $this->scope = Arr::get($extra, 'scope'); - } - - public function headers(): array - { - $token = $this->getAccessToken(); - - return array_merge($this->request->getRawHeaders(), [ - 'X-IBM-Client-Id' => $this->model->getClientId(), - - 'Authorization' => 'Bearer ' . $token->getAccessToken(), - - 'x-Introspect-RqUID' => $this->uniqueId(), - ]); - } - - public function body(): array - { - return $this->request->getRawBody(); - } - - public function refresh(): void - { - Hash::make()->forget($this->model, $this->scope); - } - - protected function getAccessToken(): AccessToken - { - return Hash::make()->get($this->model, $this->request->uri(), $this->scope); - } - - protected function uniqueId(): string - { - return Unique::id(); - } -} diff --git a/src/SberAuth/src/Exceptions/Manager.php b/src/SberAuth/src/Exceptions/Manager.php deleted file mode 100644 index 289ebd0b..00000000 --- a/src/SberAuth/src/Exceptions/Manager.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -namespace Cashbox\Sber\Auth\Exceptions; - -use Cashbox\Core\Exceptions\Http\UnauthorizedException; -use Cashbox\Core\Exceptions\Manager as ExceptionManager; - -class Manager extends ExceptionManager -{ - protected $codes = [ - 401 => UnauthorizedException::class, - ]; - - protected $code_keys = ['httpCode']; -} diff --git a/src/SberAuth/src/Facades/Cache.php b/src/SberAuth/src/Facades/Cache.php deleted file mode 100644 index c8044d90..00000000 --- a/src/SberAuth/src/Facades/Cache.php +++ /dev/null @@ -1,35 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Sber\Auth\Facades; - -use Cashbox\Sber\Auth\Objects\Query; -use Cashbox\Sber\Auth\Resources\AccessToken; -use Cashbox\Sber\Auth\Support\Cache as Support; -use Illuminate\Support\Facades\Facade; - -/** - * @method static AccessToken get(Query $client, callable $request) - * @method static void forget(Query $client) - */ -class Cache extends Facade -{ - protected static function getFacadeAccessor() - { - return Support::class; - } -} diff --git a/src/SberAuth/src/Http/Request.php b/src/SberAuth/src/Http/Request.php deleted file mode 100644 index 138355b6..00000000 --- a/src/SberAuth/src/Http/Request.php +++ /dev/null @@ -1,91 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Sber\Auth\Http; - -use Cashbox\Core\Facades\Config\Main; -use Cashbox\Core\Http\Request as BaseRequest; -use DragonCode\Contracts\Cashier\Resources\Model; - -/** - * @method static Request make(Model $model) - */ -class Request extends BaseRequest -{ - protected $path = 'ru/prod/tokens/v2/oauth'; - - protected $grant_type = 'client_credentials'; - - protected $scope; - - public function setHost(string $host): self - { - $this->production_host = $host; - $this->dev_host = $host; - - return $this; - } - - public function setScope(string $scope): self - { - $this->scope = $scope; - - return $this; - } - - public function getRawHeaders(): array - { - return [ - 'Accept' => 'application/json', - - 'Content-Type' => 'application/x-www-form-urlencoded', - - 'X-IBM-Client-Id' => $this->model->getClientId(), - - 'Authorization' => 'Basic ' . $this->authorization(), - - 'RqUID' => $this->model->getUniqueId(true), - ]; - } - - public function getRawBody(): array - { - return [ - 'grant_type' => $this->grant_type, - 'scope' => $this->scope, - ]; - } - - public function getHttpOptions(): array - { - if (Main::isProduction()) { - return [ - 'cert' => [ - $this->model->getCertificatePath(), - $this->model->getCertificatePassword(), - ], - ]; - } - - return []; - } - - protected function authorization(): string - { - return base64_encode($this->model->getClientId() . ':' . $this->model->getClientSecret()); - } -} diff --git a/src/SberAuth/src/Objects/Query.php b/src/SberAuth/src/Objects/Query.php deleted file mode 100644 index 780e1ce3..00000000 --- a/src/SberAuth/src/Objects/Query.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Sber\Auth\Objects; - -use DragonCode\Contracts\Cashier\Resources\Model; -use DragonCode\SimpleDataTransferObject\DataTransferObject; - -class Query extends DataTransferObject -{ - protected $model; - - protected $scope; - - public function getModel(): Model - { - return $this->model; - } - - public function getScope(): string - { - return $this->scope; - } -} diff --git a/src/SberAuth/src/Resources/AccessToken.php b/src/SberAuth/src/Resources/AccessToken.php deleted file mode 100644 index 7f2e7daa..00000000 --- a/src/SberAuth/src/Resources/AccessToken.php +++ /dev/null @@ -1,51 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -namespace Cashbox\Sber\Auth\Resources; - -use Cashbox\Sber\Auth\Constants\Keys; -use DragonCode\Contracts\Cashier\Resources\AccessToken as AccessTokenContract; -use DragonCode\SimpleDataTransferObject\DataTransferObject; -use Illuminate\Support\Carbon; - -class AccessToken extends DataTransferObject implements AccessTokenContract -{ - protected $client_id; - - protected $access_token; - - protected $expires_in; - - protected $map = [ - Keys::CLIENT_ID => 'client_id', - Keys::TOKEN => 'access_token', - Keys::EXPIRES_IN => 'expires_in', - ]; - - public function getClientId(): string - { - return $this->client_id; - } - - public function getAccessToken(): string - { - return $this->access_token; - } - - public function getExpiresIn(): Carbon - { - return Carbon::now()->addSeconds($this->expires_in); - } -} diff --git a/src/SberAuth/src/Services/Hash.php b/src/SberAuth/src/Services/Hash.php new file mode 100644 index 00000000..1dbcabdb --- /dev/null +++ b/src/SberAuth/src/Services/Hash.php @@ -0,0 +1,64 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Sber\Auth\Services; + +use Carbon\Carbon; +use Cashbox\Core\Data\Config\Drivers\CredentialsData; +use Cashbox\Core\Data\Signing\Token; +use DragonCode\Cache\Services\Cache; + +class Hash +{ + public static function get(CredentialsData $credentials, string $paymentId, string $url, ?string $scope): Token + { + $cache = static::cache($credentials->clientId, $paymentId, $scope); + + if ($cache->has()) { + return $cache->get(); + } + + $response = static::request($credentials, $paymentId, $url, $scope); + + return $cache->ttl($response->expiresIn)->remember(fn () => $response); + } + + protected static function cache(mixed ...$keys): Cache + { + return Cache::make()->key(static::class, $keys); + } + + protected static function request( + CredentialsData $credentials, + string $paymentId, + string $url, + ?string $scope + ): Token { + $response = Http::get($credentials, $paymentId, $url, $scope); + + return Token::from([ + 'clientId' => $response['client_id'], + 'clientSecret' => $response['access_token'], + 'expiresIn' => static::expiresIn($response['expires_in']), + ]); + } + + protected static function expiresIn(int $seconds): Carbon + { + return Carbon::now()->addSeconds($seconds); + } +} diff --git a/src/SberAuth/src/Services/Http.php b/src/SberAuth/src/Services/Http.php new file mode 100644 index 00000000..2730a3c9 --- /dev/null +++ b/src/SberAuth/src/Services/Http.php @@ -0,0 +1,87 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Sber\Auth\Services; + +use Cashbox\Core\Concerns\Config\Application; +use Cashbox\Core\Data\Config\Drivers\CredentialsData; +use DragonCode\Support\Facades\Http\Url; +use Illuminate\Http\Client\PendingRequest; +use Illuminate\Support\Facades\Http as Client; + +class Http +{ + use Application; + + protected static string $uri = 'ru/prod/tokens/v2/oauth'; + + protected static string $grantType = 'client_credentials'; + + protected static int $retryTimes = 5; + + protected static int $retrySleep = 300; + + public static function get(CredentialsData $credentials, string $paymentId, string $url, ?string $scope): array + { + return Client::baseUrl(static::host($url)) + ->withHeader('X-IBM-Client-Id', $credentials->clientId) + ->withHeader('RqUID', static::generateId($paymentId)) + ->withHeader('Authorization', static::authorization($credentials)) + ->when(static::isProduction(), fn (PendingRequest $request) => $request->mergeOptions( + static::certificate($credentials) + )) + ->retry(static::$retryTimes, static::$retrySleep) + ->acceptJson() + ->asForm() + ->throw() + ->post(static::$uri, static::data($scope)) + ->json(); + } + + protected static function data(?string $scope): array + { + return [ + 'grant_type' => static::$grantType, + 'scope' => $scope, + ]; + } + + protected static function certificate(CredentialsData $credentials): array + { + return [ + 'cert' => [ + $credentials->extra['certificate_path'], + $credentials->extra['certificate_password'], + ], + ]; + } + + protected static function authorization(CredentialsData $credentials): string + { + return base64_encode($credentials->clientId . ':' . $credentials->clientSecret); + } + + protected static function host(string $url): string + { + return Url::parse($url)->getBaseUrl(); + } + + protected static function generateId(string $paymentId): string + { + return Identifier::getStatic($paymentId); + } +} diff --git a/src/SberAuth/src/Services/Identifier.php b/src/SberAuth/src/Services/Identifier.php new file mode 100644 index 00000000..c31bac5e --- /dev/null +++ b/src/SberAuth/src/Services/Identifier.php @@ -0,0 +1,38 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Sber\Auth\Services; + +use DragonCode\Cache\Services\Cache; +use Illuminate\Support\Str; + +class Identifier +{ + protected static int $ttl = 60; + + public static function getUnique(): string + { + return Str::uuid()->toString(); + } + + public static function getStatic(mixed $key): string + { + return Cache::make()->ttl(static::$ttl)->key(static::class, $key)->remember( + fn () => static::getUnique() + ); + } +} diff --git a/src/SberAuth/src/Sign.php b/src/SberAuth/src/Sign.php new file mode 100644 index 00000000..896fcb3e --- /dev/null +++ b/src/SberAuth/src/Sign.php @@ -0,0 +1,61 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Sber\Auth; + +use Cashbox\Core\Data\Signing\Token; +use Cashbox\Core\Services\Sign as BaseSign; +use Cashbox\Sber\Auth\Services\Hash; +use Cashbox\Sber\Auth\Services\Identifier; +use Illuminate\Support\Arr; + +class Sign extends BaseSign +{ + public function headers(): array + { + return array_merge(parent::headers(), [ + 'X-IBM-Client-Id' => $this->config->credentials->clientId, + 'x-Introspect-RqUID' => $this->uniqueId(), + 'Authorization' => $this->bearer(), + ]); + } + + protected function bearer(): string + { + return 'Bearer ' . $this->token()->clientSecret; + } + + protected function token(): Token + { + return Hash::get( + $this->config->credentials, + $this->request->resource->paymentId(), + $this->extra('url'), + $this->extra('scope'), + ); + } + + protected function uniqueId(): string + { + return Identifier::getUnique(); + } + + protected function extra(string $key): mixed + { + return Arr::get($this->extra, $key); + } +} diff --git a/src/SberAuth/src/Support/Cache.php b/src/SberAuth/src/Support/Cache.php deleted file mode 100644 index 8bcdd577..00000000 --- a/src/SberAuth/src/Support/Cache.php +++ /dev/null @@ -1,98 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Sber\Auth\Support; - -use Cashbox\Sber\Auth\Objects\Query; -use Cashbox\Sber\Auth\Resources\AccessToken; -use DateTimeInterface; -use Illuminate\Support\Collection; -use Illuminate\Support\Facades\Cache as Repository; - -class Cache -{ - public function get(Query $query, callable $request): AccessToken - { - $key = $this->key($query); - - if ($this->doesnt($key)) { - $response = $this->request($query, $request); - - $this->set($key, $response->getExpiresIn(), $response->getAccessToken()); - - return $response; - } - - return $this->from($key, $query); - } - - public function forget(Query $query): void - { - $key = $this->key($query); - - if ($this->exists($key)) { - Repository::forget($key); - } - } - - protected function exists(string $key): bool - { - return Repository::has($key); - } - - protected function doesnt(string $key): bool - { - return ! $this->exists($key); - } - - protected function from(string $key, Query $client): AccessToken - { - $client_id = $client->getModel()->getClientId(); - - $access_token = Repository::get($key); - - return AccessToken::make(compact('client_id', 'access_token')); - } - - protected function set(string $key, DateTimeInterface $ttl, string $token): void - { - Repository::put($key, $token, $ttl); - } - - protected function request(Query $client, callable $request): AccessToken - { - return $request($client); - } - - protected function key(Query $query): string - { - return $this->compact([ - self::class, - $query->getModel()->getClientId(), - $query->getModel()->getPaymentId(), - $query->getScope(), - ]); - } - - protected function compact(array $values): string - { - return Collection::make($values) - ->map(static function ($value) { - return md5($value); - })->implode('::'); - } -} diff --git a/src/SberAuth/src/Support/Hash.php b/src/SberAuth/src/Support/Hash.php deleted file mode 100644 index bac9c902..00000000 --- a/src/SberAuth/src/Support/Hash.php +++ /dev/null @@ -1,83 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -namespace Cashbox\Sber\Auth\Support; - -use Cashbox\Core\Facades\Helpers\Http; -use Cashbox\Sber\Auth\Constants\Keys; -use Cashbox\Sber\Auth\Exceptions\Manager as ExceptionManager; -use Cashbox\Sber\Auth\Facades\Cache as CacheRepository; -use Cashbox\Sber\Auth\Http\Request; -use Cashbox\Sber\Auth\Objects\Query; -use Cashbox\Sber\Auth\Resources\AccessToken; -use DragonCode\Contracts\Cashier\Http\Request as RequestContract; -use DragonCode\Contracts\Cashier\Resources\Model; -use DragonCode\Contracts\Exceptions\Manager; -use DragonCode\Contracts\Http\Builder; -use DragonCode\Support\Concerns\Makeable; - -class Hash -{ - use Makeable; - - public function get(Model $model, Builder $uri, string $scope): AccessToken - { - $query = $this->query($model, $scope); - - return CacheRepository::get($query, function (Query $query) use ($uri) { - $request = $this->request($query->getModel(), $uri, $query->getScope()); - - $response = $this->post($request); - - return $this->makeToken(array_merge($response, [ - Keys::CLIENT_ID => $query->getModel()->getClientId(), - ])); - }); - } - - public function forget(Model $model, string $scope): void - { - $query = $this->query($model, $scope); - - CacheRepository::forget($query); - } - - protected function post(RequestContract $request): array - { - return Http::post($request, $this->exceptions()); - } - - protected function query(Model $model, string $scope): Query - { - return Query::make(compact('model', 'scope')); - } - - protected function request(Model $model, Builder $uri, string $scope): RequestContract - { - return Request::make($model) - ->setHost($uri->getBaseUrl()) - ->setScope($scope); - } - - protected function makeToken(array $response): AccessToken - { - return AccessToken::make($response); - } - - protected function exceptions(): Manager - { - return new ExceptionManager(); - } -} diff --git a/src/TinkoffAuth/src/Sign.php b/src/TinkoffAuth/src/Sign.php index 57483bd0..4005412f 100644 --- a/src/TinkoffAuth/src/Sign.php +++ b/src/TinkoffAuth/src/Sign.php @@ -26,7 +26,7 @@ class Sign extends BaseSign { public function body(): array { - $token = $this->hash(); + $token = $this->token(); return array_merge($this->request->body(), [ Keys::TERMINAL => $token->clientId, @@ -34,7 +34,7 @@ public function body(): array ]); } - protected function hash(): Token + protected function token(): Token { return Hash::get( $this->clientId(), From 8476f29442d8ad175d1ea6d799daa0e24724f81c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 4 Aug 2023 01:37:46 +0300 Subject: [PATCH 133/164] Adding tests for the Sber Auth driver --- tests/Fixtures/App/Enums/TypeEnum.php | 2 + tests/Fixtures/Payments/SberAuth.php | 34 ++++++++++++ tests/Fixtures/Requests/SberAuthRequest.php | 35 +++++++++++++ .../Helpers/Http/Sber/auth.php | 14 +++-- .../Http/Tinkoff/{Credit.php => credit.php} | 0 .../Http/Tinkoff/{Online.php => online.php} | 0 .../Http/Tinkoff/{QrCode.php => qr-code.php} | 0 tests/Helpers/{Asserts.php => asserts.php} | 0 tests/Helpers/auth.php | 35 +++++++++++++ tests/Helpers/{Data.php => data.php} | 0 tests/Helpers/{Fakes.php => fakes.php} | 0 tests/Helpers/{Forget.php => forget.php} | 0 tests/Helpers/{Models.php => models.php} | 0 tests/Pest.php | 3 ++ tests/TestCase.php | 15 ++++++ tests/Unit/Core/Facades/ConfigTest.php | 1 + tests/Unit/Drivers/SberAuth/HashTest.php | 52 +++++++++++++++++++ tests/Unit/Drivers/SberAuth/SignTest.php | 36 +++++++++++++ 18 files changed, 222 insertions(+), 5 deletions(-) create mode 100644 tests/Fixtures/Payments/SberAuth.php create mode 100644 tests/Fixtures/Requests/SberAuthRequest.php rename src/SberAuth/src/Constants/Keys.php => tests/Helpers/Http/Sber/auth.php (57%) rename tests/Helpers/Http/Tinkoff/{Credit.php => credit.php} (100%) rename tests/Helpers/Http/Tinkoff/{Online.php => online.php} (100%) rename tests/Helpers/Http/Tinkoff/{QrCode.php => qr-code.php} (100%) rename tests/Helpers/{Asserts.php => asserts.php} (100%) create mode 100644 tests/Helpers/auth.php rename tests/Helpers/{Data.php => data.php} (100%) rename tests/Helpers/{Fakes.php => fakes.php} (100%) rename tests/Helpers/{Forget.php => forget.php} (100%) rename tests/Helpers/{Models.php => models.php} (100%) create mode 100644 tests/Unit/Drivers/SberAuth/HashTest.php create mode 100644 tests/Unit/Drivers/SberAuth/SignTest.php diff --git a/tests/Fixtures/App/Enums/TypeEnum.php b/tests/Fixtures/App/Enums/TypeEnum.php index ee41d019..5bbbf4b4 100644 --- a/tests/Fixtures/App/Enums/TypeEnum.php +++ b/tests/Fixtures/App/Enums/TypeEnum.php @@ -25,6 +25,7 @@ * @method static string tinkoffCredit() * @method static string tinkoffOnline() * @method static string tinkoffQrCode() + * @method static string sberQrCode() */ enum TypeEnum: string { @@ -35,4 +36,5 @@ enum TypeEnum: string case tinkoffCredit = 'tinkoff_credit'; case tinkoffOnline = 'tinkoff_online'; case tinkoffQrCode = 'tinkoff_qr'; + case sberQrCode = 'sber_qr'; } diff --git a/tests/Fixtures/Payments/SberAuth.php b/tests/Fixtures/Payments/SberAuth.php new file mode 100644 index 00000000..1c9df1e5 --- /dev/null +++ b/tests/Fixtures/Payments/SberAuth.php @@ -0,0 +1,34 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Tests\Fixtures\Payments; + +use Cashbox\Core\Enums\CurrencyEnum; +use Cashbox\Core\Resources\Resource; + +class SberAuth extends Resource +{ + public function currency(): int + { + return CurrencyEnum::USD->value; + } + + public function sum(): int + { + return 1000; + } +} diff --git a/tests/Fixtures/Requests/SberAuthRequest.php b/tests/Fixtures/Requests/SberAuthRequest.php new file mode 100644 index 00000000..8fc2d2e2 --- /dev/null +++ b/tests/Fixtures/Requests/SberAuthRequest.php @@ -0,0 +1,35 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Tests\Fixtures\Requests; + +use Cashbox\Core\Http\Request; + +class SberAuthRequest extends Request +{ + protected string $productionHost = 'https://example.com'; + + protected string $productionUri = 'ru/prod/tokens/v2/oauth'; + + public function body(): array + { + return [ + 'OrderId' => '1234567890', + 'Amount' => 1000, + ]; + } +} diff --git a/src/SberAuth/src/Constants/Keys.php b/tests/Helpers/Http/Sber/auth.php similarity index 57% rename from src/SberAuth/src/Constants/Keys.php rename to tests/Helpers/Http/Sber/auth.php index cb10b30b..5a7f3c07 100644 --- a/src/SberAuth/src/Constants/Keys.php +++ b/tests/Helpers/Http/Sber/auth.php @@ -15,11 +15,15 @@ declare(strict_types=1); -namespace Cashbox\Sber\Auth\Constants; +use Illuminate\Support\Facades\Http; -class Keys +function fakeSberAuth(): void { - public const CLIENT_ID = 'client_id'; - public const TOKEN = 'access_token'; - public const EXPIRES_IN = 'expires_in'; + Http::fake([ + '*/ru/prod/tokens/v2/oauth' => Http::response([ + 'client_id' => 'qwerty', + 'access_token' => 'foobar123', + 'expires_in' => 60, + ]), + ]); } diff --git a/tests/Helpers/Http/Tinkoff/Credit.php b/tests/Helpers/Http/Tinkoff/credit.php similarity index 100% rename from tests/Helpers/Http/Tinkoff/Credit.php rename to tests/Helpers/Http/Tinkoff/credit.php diff --git a/tests/Helpers/Http/Tinkoff/Online.php b/tests/Helpers/Http/Tinkoff/online.php similarity index 100% rename from tests/Helpers/Http/Tinkoff/Online.php rename to tests/Helpers/Http/Tinkoff/online.php diff --git a/tests/Helpers/Http/Tinkoff/QrCode.php b/tests/Helpers/Http/Tinkoff/qr-code.php similarity index 100% rename from tests/Helpers/Http/Tinkoff/QrCode.php rename to tests/Helpers/Http/Tinkoff/qr-code.php diff --git a/tests/Helpers/Asserts.php b/tests/Helpers/asserts.php similarity index 100% rename from tests/Helpers/Asserts.php rename to tests/Helpers/asserts.php diff --git a/tests/Helpers/auth.php b/tests/Helpers/auth.php new file mode 100644 index 00000000..be910852 --- /dev/null +++ b/tests/Helpers/auth.php @@ -0,0 +1,35 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Cashbox\Sber\Auth\Sign; +use Tests\Fixtures\App\Models\PaymentModel; +use Tests\Fixtures\Payments\SberAuth; +use Tests\Fixtures\Requests\SberAuthRequest; + +function sberSign(PaymentModel $payment): Sign +{ + $config = $payment->cashboxDriver()->config; + + return new Sign( + request: new SberAuthRequest(new SberAuth($payment, $config)), + config : $config, + extra : [ + 'url' => 'https://via.placeholder.com/640x480.png/00eecc?text=consequatur', + 'scope' => 'https://api.sberbank.ru/order.create', + ] + ); +} diff --git a/tests/Helpers/Data.php b/tests/Helpers/data.php similarity index 100% rename from tests/Helpers/Data.php rename to tests/Helpers/data.php diff --git a/tests/Helpers/Fakes.php b/tests/Helpers/fakes.php similarity index 100% rename from tests/Helpers/Fakes.php rename to tests/Helpers/fakes.php diff --git a/tests/Helpers/Forget.php b/tests/Helpers/forget.php similarity index 100% rename from tests/Helpers/Forget.php rename to tests/Helpers/forget.php diff --git a/tests/Helpers/Models.php b/tests/Helpers/models.php similarity index 100% rename from tests/Helpers/Models.php rename to tests/Helpers/models.php diff --git a/tests/Pest.php b/tests/Pest.php index 3f4f19dc..09c46308 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -30,11 +30,14 @@ uses(TestCase::class)->group('core')->in('Unit/Core'); uses(TestCase::class)->group('cash')->in('Unit/Drivers/Cash'); uses(TestCase::class)->group('outside')->in('Unit/Drivers/Outside'); + uses(TestCase::class)->group('tinkoff-auth')->in('Unit/Drivers/TinkoffAuth'); uses(TestCase::class)->group('tinkoff-credit')->in('Unit/Drivers/TinkoffCredit'); uses(TestCase::class)->group('tinkoff-online')->in('Unit/Drivers/TinkoffOnline'); uses(TestCase::class)->group('tinkoff-qr')->in('Unit/Drivers/TinkoffQrCode'); +uses(TestCase::class)->group('sber-auth')->in('Unit/Drivers/SberAuth'); + /* |-------------------------------------------------------------------------- | Functions diff --git a/tests/TestCase.php b/tests/TestCase.php index a38a29da..e6ea1fb2 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -91,6 +91,7 @@ protected function setUpDrivers(Application $app): void $this->setUpTinkoffCreditDriver($app); $this->setUpTinkoffOnlineDriver($app); $this->setUpTinkoffQrCodeDriver($app); + $this->setUpSberQrCodeDriver($app); } protected function setUpCashDriver(Application $app): void @@ -151,4 +152,18 @@ protected function setUpTinkoffQrCodeDriver(Application $app): void ], ]); } + + protected function setUpSberQrCodeDriver(Application $app): void + { + $app['config']->set('cashbox.payment.drivers.' . TypeEnum::sberQrCode(), TypeEnum::sberQrCode); + + $app['config']->set('cashbox.drivers.' . TypeEnum::sberQrCode(), [ + 'driver' => TinkoffQrCodeDriver::class, + 'resource' => TinkoffQrCode::class, + 'credentials' => [ + 'client_id' => 'qwerty', + 'client_secret' => 'qwerty123', + ], + ]); + } } diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 46bd2699..ad980036 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -65,6 +65,7 @@ TypeEnum::tinkoffCredit() => TypeEnum::tinkoffCredit, TypeEnum::tinkoffOnline() => TypeEnum::tinkoffOnline, TypeEnum::tinkoffQrCode() => TypeEnum::tinkoffQrCode, + TypeEnum::sberQrCode() => TypeEnum::sberQrCode, ]); }); diff --git a/tests/Unit/Drivers/SberAuth/HashTest.php b/tests/Unit/Drivers/SberAuth/HashTest.php new file mode 100644 index 00000000..ca625cf7 --- /dev/null +++ b/tests/Unit/Drivers/SberAuth/HashTest.php @@ -0,0 +1,52 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Cashbox\Core\Data\Config\Drivers\CredentialsData; +use Cashbox\Sber\Auth\Services\Hash; +use Illuminate\Http\Client\Request; +use Illuminate\Support\Facades\Http; +use Illuminate\Support\Str; + +it('validates the authorization request', function () { + fakeSberAuth(); + + $credentials = CredentialsData::from([ + 'clientId' => 'qwerty', + 'clientSecret' => 'qwerty123', + ]); + + $service = Hash::get($credentials, '1234567890', 'https://example.com', 'create'); + + expect($service->clientId)->toBe('qwerty'); + expect($service->clientSecret)->toBe('foobar123'); + expect($service->expiresIn->getTimestamp())->toBe(now()->addSeconds(60)->timestamp); + + Http::assertSent(function (Request $request) { + $data = [ + 'grant_type' => 'client_credentials', + 'scope' => 'create', + ]; + + return $request->hasHeader('X-IBM-Client-Id', 'qwerty') + && $request->hasHeader('Authorization', base64_encode('qwerty:qwerty123')) + && $request->hasHeader('RqUID') + && $request->hasHeader('Accept', 'application/json') + && $request->hasHeader('Content-Type', 'application/x-www-form-urlencoded') + && $request->data() === $data + && Str::is('*/ru/prod/tokens/v2/oauth', $request->url()); + }); +}); diff --git a/tests/Unit/Drivers/SberAuth/SignTest.php b/tests/Unit/Drivers/SberAuth/SignTest.php new file mode 100644 index 00000000..5836e82c --- /dev/null +++ b/tests/Unit/Drivers/SberAuth/SignTest.php @@ -0,0 +1,36 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Tests\Fixtures\App\Enums\TypeEnum; + +it('should check authorization', function () { + fakeSberAuth(); + + $payment = createPayment(TypeEnum::sberQrCode); + + $sign = sberSign($payment); + + expect($sign->headers())->toBe([ + 'X-IBM-Client-Id' => 'qwerty', + 'x-Introspect-RqUID' => 'uniqueId', + 'Authorization' => 'Bearer qwerty123', + ]); + + expect($sign->options())->toBe([]); + + expect($sign->body())->toBe([]); +}); From 0c01442e0751655bc9379472aaadb8bf7a84e85c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 4 Aug 2023 01:38:15 +0300 Subject: [PATCH 134/164] Fixed code-style --- src/Core/src/Services/Driver.php | 3 ++- src/Core/src/Services/Http.php | 2 +- src/TinkoffCredit/src/Services/Exception.php | 2 +- tests/Fixtures/Payments/TinkoffOnline.php | 2 +- tests/Fixtures/Payments/TinkoffQrCode.php | 2 +- tests/TestCase.php | 2 +- tests/Unit/Core/Facades/ConfigTest.php | 8 ++++---- tests/Unit/Drivers/SberAuth/HashTest.php | 2 +- 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Core/src/Services/Driver.php b/src/Core/src/Services/Driver.php index a73b3220..915a6435 100644 --- a/src/Core/src/Services/Driver.php +++ b/src/Core/src/Services/Driver.php @@ -42,7 +42,8 @@ abstract public function verify(): Response; public function __construct( protected Model $payment, public readonly DriverData $config, - protected readonly Http $http = new Http() + protected readonly Http $http = new Http( + ) ) {} public function statuses(): Statuses diff --git a/src/Core/src/Services/Http.php b/src/Core/src/Services/Http.php index 194bca7a..54e5a82e 100644 --- a/src/Core/src/Services/Http.php +++ b/src/Core/src/Services/Http.php @@ -42,7 +42,7 @@ public function send(Request $request, Exception $exception): array url : $request->url(), headers: $request->sign()?->headers() ?? $request->headers(), options: $request->sign()?->options() ?? $request->options(), - data : $request->sign()?->body() ?? $request->body() + data : $request->sign()?->body() ?? $request->body() ); static::log($request, $response); diff --git a/src/TinkoffCredit/src/Services/Exception.php b/src/TinkoffCredit/src/Services/Exception.php index c05e4ccb..0bda48c2 100644 --- a/src/TinkoffCredit/src/Services/Exception.php +++ b/src/TinkoffCredit/src/Services/Exception.php @@ -23,8 +23,8 @@ use Cashbox\Core\Exceptions\External\InsufficientFundsCardException; use Cashbox\Core\Exceptions\External\InvalidCardException; use Cashbox\Core\Exceptions\External\PaymentCompletedException; -use Cashbox\Core\Exceptions\External\PaymentTypeNotAvailableException; use Cashbox\Core\Exceptions\External\PaymentDeclinedException; +use Cashbox\Core\Exceptions\External\PaymentTypeNotAvailableException; use Cashbox\Core\Exceptions\External\TooManyRequestsException; use Cashbox\Core\Exceptions\External\TransactionNotFoundException; use Cashbox\Core\Exceptions\External\TryAgainLaterClientException; diff --git a/tests/Fixtures/Payments/TinkoffOnline.php b/tests/Fixtures/Payments/TinkoffOnline.php index 8c4cb46f..e7d5cca2 100644 --- a/tests/Fixtures/Payments/TinkoffOnline.php +++ b/tests/Fixtures/Payments/TinkoffOnline.php @@ -37,7 +37,7 @@ public function sum(): int public function contact(): ?ContactData { return ContactData::from([ - 'fio' => [ + 'fio' => [ 'firstName' => fake()->firstName, 'middleName' => fake()->firstName, 'lastName' => fake()->lastName, diff --git a/tests/Fixtures/Payments/TinkoffQrCode.php b/tests/Fixtures/Payments/TinkoffQrCode.php index 33b5559d..0ad0d731 100644 --- a/tests/Fixtures/Payments/TinkoffQrCode.php +++ b/tests/Fixtures/Payments/TinkoffQrCode.php @@ -37,7 +37,7 @@ public function sum(): int public function contact(): ?ContactData { return ContactData::from([ - 'fio' => [ + 'fio' => [ 'firstName' => fake()->firstName, 'middleName' => fake()->firstName, 'lastName' => fake()->lastName, diff --git a/tests/TestCase.php b/tests/TestCase.php index e6ea1fb2..37ff0217 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -113,7 +113,7 @@ protected function setUpTinkoffCreditDriver(Application $app): void 'resource' => TinkoffCredit::class, 'credentials' => [ // shopId - 'client_id' => fake()->randomLetter, + 'client_id' => fake()->randomLetter, // password 'client_secret' => fake()->password, diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index ad980036..1648f059 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -167,12 +167,12 @@ function (array $main, array $driver, array $expected) { expect($item->getQueue()->refund)->toBe($expected['refund']); } )->with([ - 'filled' => [ + 'filled' => [ driverData('q1', 'q2', 'q3'), driverData('q4', 'q5', 'q6'), driverData('q4', 'q5', 'q6'), ], - 'partial' => [ + 'partial' => [ driverData('q1', 'q2', 'q3'), driverData('q4', null, null), driverData('q4', null, null), @@ -182,12 +182,12 @@ function (array $main, array $driver, array $expected) { [], driverData(null, null, null), ], - 'main empty' => [ + 'main empty' => [ [], driverData('q4', 'q5', 'q6'), driverData('q4', 'q5', 'q6'), ], - 'full empty' => [ + 'full empty' => [ [], [], driverData(null, null, null), diff --git a/tests/Unit/Drivers/SberAuth/HashTest.php b/tests/Unit/Drivers/SberAuth/HashTest.php index ca625cf7..0194acc6 100644 --- a/tests/Unit/Drivers/SberAuth/HashTest.php +++ b/tests/Unit/Drivers/SberAuth/HashTest.php @@ -46,7 +46,7 @@ && $request->hasHeader('RqUID') && $request->hasHeader('Accept', 'application/json') && $request->hasHeader('Content-Type', 'application/x-www-form-urlencoded') - && $request->data() === $data + && $data === $request->data() && Str::is('*/ru/prod/tokens/v2/oauth', $request->url()); }); }); From 87ee434ac30636bdae6d6935692abf9d13cc42b7 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 4 Aug 2023 20:24:02 +0300 Subject: [PATCH 135/164] Fixed a request processing error when the bank returns status code 200 with a text description of errors --- src/Core/src/Services/Exception.php | 34 +++++++++++++++++ src/Core/src/Services/Http.php | 17 +-------- src/TinkoffOnline/src/Services/Exception.php | 2 + src/TinkoffQrCode/src/Services/Exception.php | 2 + tests/Helpers/Http/Tinkoff/online.php | 26 +++++++++++++ tests/Helpers/Http/Tinkoff/qr-code.php | 37 +++++++++++++++++++ .../Unit/Drivers/TinkoffOnline/CreateTest.php | 8 ++++ .../Unit/Drivers/TinkoffQrCode/CreateTest.php | 16 ++++++-- .../Unit/Drivers/TinkoffQrCode/RefundTest.php | 8 ++-- .../Unit/Drivers/TinkoffQrCode/VerifyTest.php | 8 ++-- 10 files changed, 131 insertions(+), 27 deletions(-) diff --git a/src/Core/src/Services/Exception.php b/src/Core/src/Services/Exception.php index 600fc305..7d77a7f1 100644 --- a/src/Core/src/Services/Exception.php +++ b/src/Core/src/Services/Exception.php @@ -18,17 +18,37 @@ namespace Cashbox\Core\Services; use Cashbox\Core\Exceptions\External\BadRequestClientException; +use Illuminate\Http\Client\Response; +use Illuminate\Support\Arr; abstract class Exception { protected array $codes = []; + /** + * Can be: + * ['Success'] // also as ['Success' => false] + * ['Success' => false] + * ['Success' => 0] + * ['Status' => 'error'] + * + * @var array + */ + protected array $failedKey = []; + protected array $codeKeys = ['StatusCode', 'Code']; protected array $reasonKeys = ['Message', 'Data']; protected string $default = BadRequestClientException::class; + public function throwIf(Response $response): void + { + if ($response->failed() || $this->hasFailed($response->json())) { + $this->throw((string) $response->effectiveUri(), $response->status(), $response->json()); + } + } + public function throw(string $uri, int $statusCode, array $content): void { $code = $this->getCode($statusCode, $content); @@ -38,6 +58,20 @@ public function throw(string $uri, int $statusCode, array $content): void throw new $exception($uri, $reason); } + protected function hasFailed(array $data): bool + { + foreach ($this->failedKey as $k => $v) { + $key = is_numeric($k) ? $v : $k; + $value = is_numeric($k) ? false : $v; + + if (Arr::get($data, $key) == $value) { + return true; + } + } + + return false; + } + protected function getCode(int $statusCode, array $content): int { foreach ($this->codeKeys as $key) { diff --git a/src/Core/src/Services/Http.php b/src/Core/src/Services/Http.php index 54e5a82e..e7ef0796 100644 --- a/src/Core/src/Services/Http.php +++ b/src/Core/src/Services/Http.php @@ -42,12 +42,12 @@ public function send(Request $request, Exception $exception): array url : $request->url(), headers: $request->sign()?->headers() ?? $request->headers(), options: $request->sign()?->options() ?? $request->options(), - data : $request->sign()?->body() ?? $request->body() + data : $request->sign()?->body() ?? $request->body() ); static::log($request, $response); - $this->throwIf($response, $exception); + $exception->throwIf($response); return $response->json(); } @@ -66,17 +66,4 @@ protected function request( ->asJson() ->send($method->value, $url, $data); } - - protected function throwIf(Response $response, Exception $exception): void - { - if ($response->successful()) { - return; - } - - $exception->throw( - (string) $response->effectiveUri(), - $response->status(), - $response->json() - ); - } } diff --git a/src/TinkoffOnline/src/Services/Exception.php b/src/TinkoffOnline/src/Services/Exception.php index 19ae21cc..86a9e49f 100644 --- a/src/TinkoffOnline/src/Services/Exception.php +++ b/src/TinkoffOnline/src/Services/Exception.php @@ -85,6 +85,8 @@ class Exception extends BaseException 9999 => BankInternalErrorException::class, ]; + protected array $failedKey = ['Success']; + protected array $codeKeys = ['ErrorCode']; protected array $reasonKeys = ['Details', 'Message']; diff --git a/src/TinkoffQrCode/src/Services/Exception.php b/src/TinkoffQrCode/src/Services/Exception.php index 1f97b10f..6e9d6a5b 100644 --- a/src/TinkoffQrCode/src/Services/Exception.php +++ b/src/TinkoffQrCode/src/Services/Exception.php @@ -85,6 +85,8 @@ class Exception extends BaseException 9999 => BankInternalErrorException::class, ]; + protected array $failedKey = ['Success']; + protected array $codeKeys = ['ErrorCode']; protected array $reasonKeys = ['Details', 'Message']; diff --git a/tests/Helpers/Http/Tinkoff/online.php b/tests/Helpers/Http/Tinkoff/online.php index d003e0ac..f824fdb7 100644 --- a/tests/Helpers/Http/Tinkoff/online.php +++ b/tests/Helpers/Http/Tinkoff/online.php @@ -55,3 +55,29 @@ function fakeTinkoffOnlineHttp(string $info = 'CONFIRMED'): void ]), ]); } + +function fakeTinkoffOnlineInvalidHttp(): void +{ + Http::fake([ + 'https://securepay.tinkoff.ru/v2/Init' => Http::response([ + 'Success' => false, + 'ErrorCode' => '501', + 'Message' => 'Неверные параметры.', + 'Details' => 'Терминал не найден.', + ]), + + 'https://securepay.tinkoff.ru/v2/GetState' => Http::response([ + 'Success' => false, + 'ErrorCode' => '501', + 'Message' => 'Неверные параметры.', + 'Details' => 'Терминал не найден.', + ]), + + 'https://securepay.tinkoff.ru/v2/Cancel' => Http::response([ + 'Success' => false, + 'ErrorCode' => '501', + 'Message' => 'Неверные параметры.', + 'Details' => 'Терминал не найден.', + ]), + ]); +} diff --git a/tests/Helpers/Http/Tinkoff/qr-code.php b/tests/Helpers/Http/Tinkoff/qr-code.php index c3d5a14a..9c583516 100644 --- a/tests/Helpers/Http/Tinkoff/qr-code.php +++ b/tests/Helpers/Http/Tinkoff/qr-code.php @@ -42,6 +42,17 @@ function fakeTinkoffQrCodeHttp(string $info = 'CONFIRMED'): void 'Amount' => fake()->randomNumber(), ]), + 'https://securepay.tinkoff.ru/v2/GetQr' => Http::response([ + 'Success' => true, + 'ErrorCode' => 0, + 'Message' => 'OK', + 'TerminalKey' => fake()->word, + 'Status' => $info, + 'PaymentId' => fake()->randomNumber(), + 'OrderId' => fake()->randomNumber(), + 'Amount' => fake()->randomNumber(), + ]), + 'https://securepay.tinkoff.ru/v2/Cancel' => Http::response([ 'Success' => true, 'ErrorCode' => 0, @@ -55,3 +66,29 @@ function fakeTinkoffQrCodeHttp(string $info = 'CONFIRMED'): void ]), ]); } + +function fakeTinkoffQrCodeInvalidHttp(): void +{ + Http::fake([ + 'https://securepay.tinkoff.ru/v2/Init' => Http::response([ + 'Success' => false, + 'ErrorCode' => '501', + 'Message' => 'Неверные параметры.', + 'Details' => 'Терминал не найден.', + ]), + + 'https://securepay.tinkoff.ru/v2/GetState' => Http::response([ + 'Success' => false, + 'ErrorCode' => '501', + 'Message' => 'Неверные параметры.', + 'Details' => 'Терминал не найден.', + ]), + + 'https://securepay.tinkoff.ru/v2/Cancel' => Http::response([ + 'Success' => false, + 'ErrorCode' => '501', + 'Message' => 'Неверные параметры.', + 'Details' => 'Терминал не найден.', + ]), + ]); +} diff --git a/tests/Unit/Drivers/TinkoffOnline/CreateTest.php b/tests/Unit/Drivers/TinkoffOnline/CreateTest.php index 657cafa5..061b7688 100644 --- a/tests/Unit/Drivers/TinkoffOnline/CreateTest.php +++ b/tests/Unit/Drivers/TinkoffOnline/CreateTest.php @@ -20,6 +20,7 @@ use Cashbox\Core\Events\PaymentRefundedEvent; use Cashbox\Core\Events\PaymentSuccessEvent; use Cashbox\Core\Events\PaymentWaitRefundEvent; +use Cashbox\Core\Exceptions\External\BadRequestClientException; use Illuminate\Support\Facades\Event; use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; @@ -73,3 +74,10 @@ Event::assertNotDispatched(PaymentRefundedEvent::class); Event::assertNotDispatched(PaymentWaitRefundEvent::class); }); + +it('checks for invalid parameters being passed', function () { + fakeEvents(); + fakeTinkoffOnlineInvalidHttp(); + + createPayment(TypeEnum::tinkoffOnline); +})->expectException(BadRequestClientException::class); diff --git a/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php b/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php index c60c05df..725b90ab 100644 --- a/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php +++ b/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php @@ -20,6 +20,7 @@ use Cashbox\Core\Events\PaymentRefundedEvent; use Cashbox\Core\Events\PaymentSuccessEvent; use Cashbox\Core\Events\PaymentWaitRefundEvent; +use Cashbox\Core\Exceptions\External\BadRequestClientException; use Illuminate\Support\Facades\Event; use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; @@ -28,9 +29,9 @@ fakeEvents(); fakeTinkoffQrCodeHttp('NEW'); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::tinkoffQrCode); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->type)->toBe(TypeEnum::tinkoffQrCode); expect($payment->status)->toBe(StatusEnum::new); expect($payment)->toBeHasCashbox(); @@ -53,9 +54,9 @@ fakeEvents(); fakeTinkoffQrCodeHttp(); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::tinkoffQrCode); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->type)->toBe(TypeEnum::tinkoffQrCode); expect($payment->status)->toBe(StatusEnum::new); expect($payment)->toBeHasCashbox(); @@ -73,3 +74,10 @@ Event::assertNotDispatched(PaymentRefundedEvent::class); Event::assertNotDispatched(PaymentWaitRefundEvent::class); }); + +it('checks for invalid parameters being passed', function () { + fakeEvents(); + fakeTinkoffQrCodeInvalidHttp(); + + createPayment(TypeEnum::tinkoffQrCode); +})->expectException(BadRequestClientException::class); diff --git a/tests/Unit/Drivers/TinkoffQrCode/RefundTest.php b/tests/Unit/Drivers/TinkoffQrCode/RefundTest.php index f035da2e..950f3274 100644 --- a/tests/Unit/Drivers/TinkoffQrCode/RefundTest.php +++ b/tests/Unit/Drivers/TinkoffQrCode/RefundTest.php @@ -27,9 +27,9 @@ fakeEvents(); fakeTinkoffQrCodeHttp('NEW'); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::tinkoffQrCode); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->type)->toBe(TypeEnum::tinkoffQrCode); expect($payment->status)->toBe(StatusEnum::new); expect($payment)->toBeHasCashbox(); @@ -61,9 +61,9 @@ fakeEvents(); fakeTinkoffQrCodeHttp(); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::tinkoffQrCode); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->type)->toBe(TypeEnum::tinkoffQrCode); expect($payment->status)->toBe(StatusEnum::new); expect($payment)->toBeHasCashbox(); diff --git a/tests/Unit/Drivers/TinkoffQrCode/VerifyTest.php b/tests/Unit/Drivers/TinkoffQrCode/VerifyTest.php index e94b5e02..04346242 100644 --- a/tests/Unit/Drivers/TinkoffQrCode/VerifyTest.php +++ b/tests/Unit/Drivers/TinkoffQrCode/VerifyTest.php @@ -26,9 +26,9 @@ fakeEvents(); fakeTinkoffQrCodeHttp('NEW'); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::tinkoffQrCode); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->type)->toBe(TypeEnum::tinkoffQrCode); expect($payment->status)->toBe(StatusEnum::new); expect($payment)->toBeHasCashbox(); @@ -49,9 +49,9 @@ fakeEvents(); fakeTinkoffQrCodeHttp(); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::tinkoffQrCode); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->type)->toBe(TypeEnum::tinkoffQrCode); expect($payment->status)->toBe(StatusEnum::new); expect($payment)->toBeHasCashbox(); From 2486006e91420c6701313679592416cff8143d6b Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 4 Aug 2023 22:49:13 +0300 Subject: [PATCH 136/164] Fixed Tinkoff QR Code driver --- src/Core/src/Http/Request.php | 2 +- src/Core/src/Services/Driver.php | 11 +++++++---- src/TinkoffQrCode/src/Driver.php | 2 +- src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php | 2 +- tests/Helpers/Http/Tinkoff/qr-code.php | 6 ++---- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Core/src/Http/Request.php b/src/Core/src/Http/Request.php index 5bad7f64..5569061e 100644 --- a/src/Core/src/Http/Request.php +++ b/src/Core/src/Http/Request.php @@ -47,7 +47,7 @@ abstract public function body(): array; public function __construct( public readonly Resource $resource, - public readonly ?string $externalId = null + public readonly ?Response $response = null ) {} public function url(): ?string diff --git a/src/Core/src/Services/Driver.php b/src/Core/src/Services/Driver.php index 915a6435..2ee663a4 100644 --- a/src/Core/src/Services/Driver.php +++ b/src/Core/src/Services/Driver.php @@ -42,8 +42,7 @@ abstract public function verify(): Response; public function __construct( protected Model $payment, public readonly DriverData $config, - protected readonly Http $http = new Http( - ) + protected readonly Http $http = new Http() ) {} public function statuses(): Statuses @@ -51,12 +50,16 @@ public function statuses(): Statuses return $this->resolve($this->statuses, $this->payment); } - protected function request(string $request, ?string $response = null, ?string $externalId = null): Response + protected function request(string $request, ?string $response = null, ?Response $prev = null): Response { - $data = $this->call($request, 'make', $this->resource(), $externalId); + $data = $this->call($request, 'make', $this->resource(), $prev); $content = $this->http->send($data, $this->resolveException()); + if ($prev !== null) { + $content = array_merge($prev->toArray(), $content); + } + return $this->call($response ?? $this->response, 'from', $content); } diff --git a/src/TinkoffQrCode/src/Driver.php b/src/TinkoffQrCode/src/Driver.php index 7dcc5782..a2d43ae9 100644 --- a/src/TinkoffQrCode/src/Driver.php +++ b/src/TinkoffQrCode/src/Driver.php @@ -40,7 +40,7 @@ public function start(): BaseResponse { $response = $this->request(CreateRequest::class); - return $this->request(GetQrRequest::class, externalId: $response->getExternalId()); + return $this->request(GetQrRequest::class, prev: $response); } public function verify(): BaseResponse diff --git a/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php b/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php index bcfd813e..d5931f49 100644 --- a/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php @@ -24,7 +24,7 @@ class GetQrRequest extends BaseRequest public function body(): array { return [ - 'PaymentId' => $this->externalId, + 'PaymentId' => $this->response->getExternalId(), 'DataType' => 'PAYLOAD', ]; diff --git a/tests/Helpers/Http/Tinkoff/qr-code.php b/tests/Helpers/Http/Tinkoff/qr-code.php index 9c583516..144428a1 100644 --- a/tests/Helpers/Http/Tinkoff/qr-code.php +++ b/tests/Helpers/Http/Tinkoff/qr-code.php @@ -45,12 +45,10 @@ function fakeTinkoffQrCodeHttp(string $info = 'CONFIRMED'): void 'https://securepay.tinkoff.ru/v2/GetQr' => Http::response([ 'Success' => true, 'ErrorCode' => 0, - 'Message' => 'OK', 'TerminalKey' => fake()->word, - 'Status' => $info, - 'PaymentId' => fake()->randomNumber(), 'OrderId' => fake()->randomNumber(), - 'Amount' => fake()->randomNumber(), + 'PaymentId' => fake()->randomNumber(), + 'Data' => fake()->imageUrl, ]), 'https://securepay.tinkoff.ru/v2/Cancel' => Http::response([ From 9ef12f25b3a878c99d494ec4f4c25c26604b54bf Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 4 Aug 2023 23:11:22 +0300 Subject: [PATCH 137/164] Exceptions renamed --- ...eption.php => BadRequestHttpException.php} | 2 +- .../External/BankInternalErrorException.php | 20 -------------- .../External/BuyerNotFoundClientException.php | 20 -------------- ...ion.php => BuyerNotFoundHttpException.php} | 4 +-- .../External/CardHasStolenException.php | 20 -------------- .../External/CardHasStolenHttpException.php | 27 +++++++++++++++++++ .../ContactTheSellerClientException.php | 20 -------------- .../ContactTheSellerHttpException.php | 27 +++++++++++++++++++ ...ion.php => EmptyResponseHttpException.php} | 4 +-- .../External/IncorrectSumException.php | 20 -------------- ...tion.php => IncorrectSumHttpException.php} | 6 ++--- .../InsufficientFundsCardException.php | 20 -------------- .../InsufficientFundsCardHttpException.php | 27 +++++++++++++++++++ .../External/InvalidCardException.php | 20 -------------- .../External/InvalidCardHttpException.php | 27 +++++++++++++++++++ .../External/MethodNotFoundHttpException.php | 27 +++++++++++++++++++ .../External/PaymentCompletedException.php | 20 -------------- .../PaymentCompletedHttpException.php | 27 +++++++++++++++++++ .../External/PaymentDeclinedHttpException.php | 27 +++++++++++++++++++ .../PaymentTypeNotAvailableException.php | 20 -------------- .../PaymentTypeNotAvailableHttpException.php | 27 +++++++++++++++++++ .../External/TooManyRequestsException.php | 20 -------------- .../External/TooManyRequestsHttpException.php | 27 +++++++++++++++++++ .../TransactionNotFoundHttpException.php | 27 +++++++++++++++++++ .../External/TryAgainLaterClientException.php | 20 -------------- .../TryAgainLaterClientHttpException.php | 27 +++++++++++++++++++ src/Core/src/Jobs/BaseJob.php | 4 +-- src/Core/src/Services/Exception.php | 4 +-- 28 files changed, 309 insertions(+), 232 deletions(-) rename src/Core/src/Exceptions/External/{BadRequestClientException.php => BadRequestHttpException.php} (90%) delete mode 100644 src/Core/src/Exceptions/External/BankInternalErrorException.php delete mode 100644 src/Core/src/Exceptions/External/BuyerNotFoundClientException.php rename src/Core/src/Exceptions/External/{TransactionNotFoundException.php => BuyerNotFoundHttpException.php} (82%) delete mode 100644 src/Core/src/Exceptions/External/CardHasStolenException.php create mode 100644 src/Core/src/Exceptions/External/CardHasStolenHttpException.php delete mode 100644 src/Core/src/Exceptions/External/ContactTheSellerClientException.php create mode 100644 src/Core/src/Exceptions/External/ContactTheSellerHttpException.php rename src/Core/src/Exceptions/External/{EmptyResponseException.php => EmptyResponseHttpException.php} (85%) delete mode 100644 src/Core/src/Exceptions/External/IncorrectSumException.php rename src/Core/src/Exceptions/External/{PaymentDeclinedException.php => IncorrectSumHttpException.php} (76%) delete mode 100644 src/Core/src/Exceptions/External/InsufficientFundsCardException.php create mode 100644 src/Core/src/Exceptions/External/InsufficientFundsCardHttpException.php delete mode 100644 src/Core/src/Exceptions/External/InvalidCardException.php create mode 100644 src/Core/src/Exceptions/External/InvalidCardHttpException.php create mode 100644 src/Core/src/Exceptions/External/MethodNotFoundHttpException.php delete mode 100644 src/Core/src/Exceptions/External/PaymentCompletedException.php create mode 100644 src/Core/src/Exceptions/External/PaymentCompletedHttpException.php create mode 100644 src/Core/src/Exceptions/External/PaymentDeclinedHttpException.php delete mode 100644 src/Core/src/Exceptions/External/PaymentTypeNotAvailableException.php create mode 100644 src/Core/src/Exceptions/External/PaymentTypeNotAvailableHttpException.php delete mode 100644 src/Core/src/Exceptions/External/TooManyRequestsException.php create mode 100644 src/Core/src/Exceptions/External/TooManyRequestsHttpException.php create mode 100644 src/Core/src/Exceptions/External/TransactionNotFoundHttpException.php delete mode 100644 src/Core/src/Exceptions/External/TryAgainLaterClientException.php create mode 100644 src/Core/src/Exceptions/External/TryAgainLaterClientHttpException.php diff --git a/src/Core/src/Exceptions/External/BadRequestClientException.php b/src/Core/src/Exceptions/External/BadRequestHttpException.php similarity index 90% rename from src/Core/src/Exceptions/External/BadRequestClientException.php rename to src/Core/src/Exceptions/External/BadRequestHttpException.php index ed3a5787..b2f6518f 100644 --- a/src/Core/src/Exceptions/External/BadRequestClientException.php +++ b/src/Core/src/Exceptions/External/BadRequestHttpException.php @@ -19,7 +19,7 @@ use Cashbox\Core\Exceptions\BaseException; -class BadRequestClientException extends BaseException +class BadRequestHttpException extends BaseException { protected int $statusCode = 400; diff --git a/src/Core/src/Exceptions/External/BankInternalErrorException.php b/src/Core/src/Exceptions/External/BankInternalErrorException.php deleted file mode 100644 index c70e41e0..00000000 --- a/src/Core/src/Exceptions/External/BankInternalErrorException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Exceptions\External; - -class BankInternalErrorException {} diff --git a/src/Core/src/Exceptions/External/BuyerNotFoundClientException.php b/src/Core/src/Exceptions/External/BuyerNotFoundClientException.php deleted file mode 100644 index a73d9088..00000000 --- a/src/Core/src/Exceptions/External/BuyerNotFoundClientException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Exceptions\External; - -class BuyerNotFoundClientException {} diff --git a/src/Core/src/Exceptions/External/TransactionNotFoundException.php b/src/Core/src/Exceptions/External/BuyerNotFoundHttpException.php similarity index 82% rename from src/Core/src/Exceptions/External/TransactionNotFoundException.php rename to src/Core/src/Exceptions/External/BuyerNotFoundHttpException.php index cbf4e4ef..6d3cc91a 100644 --- a/src/Core/src/Exceptions/External/TransactionNotFoundException.php +++ b/src/Core/src/Exceptions/External/BuyerNotFoundHttpException.php @@ -19,9 +19,9 @@ use Cashbox\Core\Exceptions\BaseException; -class TransactionNotFoundException extends BaseException +class BuyerNotFoundHttpException extends BaseException { protected int $statusCode = 404; - protected string $reason = 'Not Found'; + protected string $reason = 'Buyer Not Found'; } diff --git a/src/Core/src/Exceptions/External/CardHasStolenException.php b/src/Core/src/Exceptions/External/CardHasStolenException.php deleted file mode 100644 index 9c59225f..00000000 --- a/src/Core/src/Exceptions/External/CardHasStolenException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Exceptions\External; - -class CardHasStolenException {} diff --git a/src/Core/src/Exceptions/External/CardHasStolenHttpException.php b/src/Core/src/Exceptions/External/CardHasStolenHttpException.php new file mode 100644 index 00000000..94bc9e03 --- /dev/null +++ b/src/Core/src/Exceptions/External/CardHasStolenHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class CardHasStolenHttpException extends BaseException +{ + protected int $statusCode = 451; + + protected string $reason = 'Card Has Stolen!'; +} diff --git a/src/Core/src/Exceptions/External/ContactTheSellerClientException.php b/src/Core/src/Exceptions/External/ContactTheSellerClientException.php deleted file mode 100644 index 8e4c9967..00000000 --- a/src/Core/src/Exceptions/External/ContactTheSellerClientException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Exceptions\External; - -class ContactTheSellerClientException {} diff --git a/src/Core/src/Exceptions/External/ContactTheSellerHttpException.php b/src/Core/src/Exceptions/External/ContactTheSellerHttpException.php new file mode 100644 index 00000000..a3f2341b --- /dev/null +++ b/src/Core/src/Exceptions/External/ContactTheSellerHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class ContactTheSellerHttpException extends BaseException +{ + protected int $statusCode = 428; + + protected string $reason = 'Contact The Seller'; +} diff --git a/src/Core/src/Exceptions/External/EmptyResponseException.php b/src/Core/src/Exceptions/External/EmptyResponseHttpException.php similarity index 85% rename from src/Core/src/Exceptions/External/EmptyResponseException.php rename to src/Core/src/Exceptions/External/EmptyResponseHttpException.php index 1a84ec5a..dc36fe05 100644 --- a/src/Core/src/Exceptions/External/EmptyResponseException.php +++ b/src/Core/src/Exceptions/External/EmptyResponseHttpException.php @@ -19,9 +19,9 @@ use Cashbox\Core\Exceptions\BaseException; -class EmptyResponseException extends BaseException +class EmptyResponseHttpException extends BaseException { - protected int $statusCode = 400; + protected int $statusCode = 411; protected string $reason = 'Bank API returned an empty response body.'; } diff --git a/src/Core/src/Exceptions/External/IncorrectSumException.php b/src/Core/src/Exceptions/External/IncorrectSumException.php deleted file mode 100644 index 77f50625..00000000 --- a/src/Core/src/Exceptions/External/IncorrectSumException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Exceptions\External; - -class IncorrectSumException {} diff --git a/src/Core/src/Exceptions/External/PaymentDeclinedException.php b/src/Core/src/Exceptions/External/IncorrectSumHttpException.php similarity index 76% rename from src/Core/src/Exceptions/External/PaymentDeclinedException.php rename to src/Core/src/Exceptions/External/IncorrectSumHttpException.php index 1e7c1868..76c93c59 100644 --- a/src/Core/src/Exceptions/External/PaymentDeclinedException.php +++ b/src/Core/src/Exceptions/External/IncorrectSumHttpException.php @@ -19,9 +19,9 @@ use Cashbox\Core\Exceptions\BaseException; -class PaymentDeclinedException extends BaseException +class IncorrectSumHttpException extends BaseException { - protected int $statusCode = 403; + protected int $statusCode = 406; - protected string $reason = 'Payment declined'; + protected string $reason = 'Incorrect Sum'; } diff --git a/src/Core/src/Exceptions/External/InsufficientFundsCardException.php b/src/Core/src/Exceptions/External/InsufficientFundsCardException.php deleted file mode 100644 index b8787404..00000000 --- a/src/Core/src/Exceptions/External/InsufficientFundsCardException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Exceptions\External; - -class InsufficientFundsCardException {} diff --git a/src/Core/src/Exceptions/External/InsufficientFundsCardHttpException.php b/src/Core/src/Exceptions/External/InsufficientFundsCardHttpException.php new file mode 100644 index 00000000..fcb74d54 --- /dev/null +++ b/src/Core/src/Exceptions/External/InsufficientFundsCardHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class InsufficientFundsCardHttpException extends BaseException +{ + protected int $statusCode = 402; + + protected string $reason = 'Insufficient Funds Card'; +} diff --git a/src/Core/src/Exceptions/External/InvalidCardException.php b/src/Core/src/Exceptions/External/InvalidCardException.php deleted file mode 100644 index f11b5d7a..00000000 --- a/src/Core/src/Exceptions/External/InvalidCardException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Exceptions\External; - -class InvalidCardException {} diff --git a/src/Core/src/Exceptions/External/InvalidCardHttpException.php b/src/Core/src/Exceptions/External/InvalidCardHttpException.php new file mode 100644 index 00000000..afb5990f --- /dev/null +++ b/src/Core/src/Exceptions/External/InvalidCardHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class InvalidCardHttpException extends BaseException +{ + protected int $statusCode = 406; + + protected string $reason = 'Invalid Card'; +} diff --git a/src/Core/src/Exceptions/External/MethodNotFoundHttpException.php b/src/Core/src/Exceptions/External/MethodNotFoundHttpException.php new file mode 100644 index 00000000..2a2d1089 --- /dev/null +++ b/src/Core/src/Exceptions/External/MethodNotFoundHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class MethodNotFoundHttpException extends BaseException +{ + protected int $statusCode = 405; + + protected string $reason = 'Method Not Found'; +} diff --git a/src/Core/src/Exceptions/External/PaymentCompletedException.php b/src/Core/src/Exceptions/External/PaymentCompletedException.php deleted file mode 100644 index b6d65ccd..00000000 --- a/src/Core/src/Exceptions/External/PaymentCompletedException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Exceptions\External; - -class PaymentCompletedException {} diff --git a/src/Core/src/Exceptions/External/PaymentCompletedHttpException.php b/src/Core/src/Exceptions/External/PaymentCompletedHttpException.php new file mode 100644 index 00000000..8a0a7e7c --- /dev/null +++ b/src/Core/src/Exceptions/External/PaymentCompletedHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class PaymentCompletedHttpException extends BaseException +{ + protected int $statusCode = 409; + + protected string $reason = 'Payment Completed'; +} diff --git a/src/Core/src/Exceptions/External/PaymentDeclinedHttpException.php b/src/Core/src/Exceptions/External/PaymentDeclinedHttpException.php new file mode 100644 index 00000000..9583aaa4 --- /dev/null +++ b/src/Core/src/Exceptions/External/PaymentDeclinedHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class PaymentDeclinedHttpException extends BaseException +{ + protected int $statusCode = 409; + + protected string $reason = 'Payment Declined'; +} diff --git a/src/Core/src/Exceptions/External/PaymentTypeNotAvailableException.php b/src/Core/src/Exceptions/External/PaymentTypeNotAvailableException.php deleted file mode 100644 index 7216907d..00000000 --- a/src/Core/src/Exceptions/External/PaymentTypeNotAvailableException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Exceptions\External; - -class PaymentTypeNotAvailableException {} diff --git a/src/Core/src/Exceptions/External/PaymentTypeNotAvailableHttpException.php b/src/Core/src/Exceptions/External/PaymentTypeNotAvailableHttpException.php new file mode 100644 index 00000000..29963c85 --- /dev/null +++ b/src/Core/src/Exceptions/External/PaymentTypeNotAvailableHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class PaymentTypeNotAvailableHttpException extends BaseException +{ + protected int $statusCode = 404; + + protected string $reason = 'Payment Type Not Available'; +} diff --git a/src/Core/src/Exceptions/External/TooManyRequestsException.php b/src/Core/src/Exceptions/External/TooManyRequestsException.php deleted file mode 100644 index f7c33feb..00000000 --- a/src/Core/src/Exceptions/External/TooManyRequestsException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Exceptions\External; - -class TooManyRequestsException {} diff --git a/src/Core/src/Exceptions/External/TooManyRequestsHttpException.php b/src/Core/src/Exceptions/External/TooManyRequestsHttpException.php new file mode 100644 index 00000000..bd66efcc --- /dev/null +++ b/src/Core/src/Exceptions/External/TooManyRequestsHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class TooManyRequestsHttpException extends BaseException +{ + protected int $statusCode = 429; + + protected string $reason = 'Too Many Requests'; +} diff --git a/src/Core/src/Exceptions/External/TransactionNotFoundHttpException.php b/src/Core/src/Exceptions/External/TransactionNotFoundHttpException.php new file mode 100644 index 00000000..fbd45c67 --- /dev/null +++ b/src/Core/src/Exceptions/External/TransactionNotFoundHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class TransactionNotFoundHttpException extends BaseException +{ + protected int $statusCode = 404; + + protected string $reason = 'Transaction Not Found'; +} diff --git a/src/Core/src/Exceptions/External/TryAgainLaterClientException.php b/src/Core/src/Exceptions/External/TryAgainLaterClientException.php deleted file mode 100644 index 35d65ef0..00000000 --- a/src/Core/src/Exceptions/External/TryAgainLaterClientException.php +++ /dev/null @@ -1,20 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Core\Exceptions\External; - -class TryAgainLaterClientException {} diff --git a/src/Core/src/Exceptions/External/TryAgainLaterClientHttpException.php b/src/Core/src/Exceptions/External/TryAgainLaterClientHttpException.php new file mode 100644 index 00000000..fd65e54f --- /dev/null +++ b/src/Core/src/Exceptions/External/TryAgainLaterClientHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class TryAgainLaterClientHttpException extends BaseException +{ + protected int $statusCode = 425; + + protected string $reason = 'Try Again Later'; +} diff --git a/src/Core/src/Jobs/BaseJob.php b/src/Core/src/Jobs/BaseJob.php index e907e265..9765567d 100644 --- a/src/Core/src/Jobs/BaseJob.php +++ b/src/Core/src/Jobs/BaseJob.php @@ -21,7 +21,7 @@ use Cashbox\Core\Concerns\Config\Queue; use Cashbox\Core\Data\Models\InfoData; use Cashbox\Core\Enums\RateLimiterEnum; -use Cashbox\Core\Exceptions\External\EmptyResponseException; +use Cashbox\Core\Exceptions\External\EmptyResponseHttpException; use Cashbox\Core\Http\Response; use Cashbox\Core\Services\Driver; use Cashbox\Core\Support\Arr; @@ -64,7 +64,7 @@ public function handle(): void $response = $this->request(); if ($response->isEmpty()) { - $this->fail(new EmptyResponseException()); + $this->fail(new EmptyResponseHttpException()); return; } diff --git a/src/Core/src/Services/Exception.php b/src/Core/src/Services/Exception.php index 7d77a7f1..37046409 100644 --- a/src/Core/src/Services/Exception.php +++ b/src/Core/src/Services/Exception.php @@ -17,7 +17,7 @@ namespace Cashbox\Core\Services; -use Cashbox\Core\Exceptions\External\BadRequestClientException; +use Cashbox\Core\Exceptions\External\BadRequestHttpException; use Illuminate\Http\Client\Response; use Illuminate\Support\Arr; @@ -40,7 +40,7 @@ abstract class Exception protected array $reasonKeys = ['Message', 'Data']; - protected string $default = BadRequestClientException::class; + protected string $default = BadRequestHttpException::class; public function throwIf(Response $response): void { From c701d3c980d0a8af36ac1eb853e537c03e91b650 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Fri, 4 Aug 2023 23:11:35 +0300 Subject: [PATCH 138/164] Added new exceptions --- .../BankInternalErrorHttpException.php | 27 +++++++++++++++++++ .../External/UnauthorizedHttpException.php | 27 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/Core/src/Exceptions/External/BankInternalErrorHttpException.php create mode 100644 src/Core/src/Exceptions/External/UnauthorizedHttpException.php diff --git a/src/Core/src/Exceptions/External/BankInternalErrorHttpException.php b/src/Core/src/Exceptions/External/BankInternalErrorHttpException.php new file mode 100644 index 00000000..8d982f0b --- /dev/null +++ b/src/Core/src/Exceptions/External/BankInternalErrorHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class BankInternalErrorHttpException extends BaseException +{ + protected int $statusCode = 400; + + protected string $reason = 'Bank internal error'; +} diff --git a/src/Core/src/Exceptions/External/UnauthorizedHttpException.php b/src/Core/src/Exceptions/External/UnauthorizedHttpException.php new file mode 100644 index 00000000..8cb973fb --- /dev/null +++ b/src/Core/src/Exceptions/External/UnauthorizedHttpException.php @@ -0,0 +1,27 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Core\Exceptions\External; + +use Cashbox\Core\Exceptions\BaseException; + +class UnauthorizedHttpException extends BaseException +{ + protected int $statusCode = 401; + + protected string $reason = 'Unauthorized'; +} From df1fa94dfb6a568ae7431afaf0f75c58eba1ae55 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 5 Aug 2023 01:15:26 +0300 Subject: [PATCH 139/164] Prepare Sber QR Driver --- src/Core/src/Http/Request.php | 13 +- src/Core/src/Http/Response.php | 15 ++- src/Core/src/Services/{Sign.php => Auth.php} | 2 +- .../src/Services/Identifier.php | 2 +- src/SberAuth/src/{Sign.php => Auth.php} | 6 +- src/SberAuth/src/Services/Http.php | 1 + src/SberQrCode/requests/.gitignore | 1 - src/SberQrCode/requests/auth.http | 8 -- src/SberQrCode/requests/create.http | 17 --- src/SberQrCode/requests/http-client.env.json | 22 ---- src/SberQrCode/src/Constants/Body.php | 20 +-- .../src/Constants/{Scopes.php => Scope.php} | 4 +- src/SberQrCode/src/Driver.php | 44 +++---- src/SberQrCode/src/Exceptions/Manager.php | 49 ------- .../src/Http/Requests/BaseRequest.php | 54 ++++++++ .../src/Http/Requests/CancelRequest.php | 50 +++++++ .../src/Http/Requests/CreateRequest.php | 47 +++++++ .../Requests/StatusRequest.php} | 21 +-- .../Responses/QrCodeResponse.php} | 25 ++-- .../src/Http/Responses/Response.php | 33 +++++ src/SberQrCode/src/Requests/BaseRequest.php | 72 ----------- src/SberQrCode/src/Requests/Cancel.php | 56 -------- src/SberQrCode/src/Requests/Create.php | 46 ------- src/SberQrCode/src/Resources/Model.php | 29 ----- .../src/Resources/SberQrCodeResource.php | 49 +++++++ src/SberQrCode/src/Responses/Cancel.php | 36 ------ src/SberQrCode/src/Responses/QrCode.php | 43 ------ src/SberQrCode/src/Responses/Status.php | 36 ------ src/SberQrCode/src/Services/Exception.php | 42 ++++++ .../src/{Helpers => Services}/Statuses.php | 20 +-- src/TinkoffAuth/src/{Sign.php => Auth.php} | 4 +- .../src/Http/Responses/Response.php | 16 --- src/TinkoffCredit/src/Services/Exception.php | 122 +++++++++--------- .../src/Http/Requests/BaseRequest.php | 6 +- .../src/Http/Responses/Response.php | 16 --- src/TinkoffOnline/src/Services/Exception.php | 122 +++++++++--------- .../src/Http/Requests/BaseRequest.php | 6 +- .../src/Http/Responses/Response.php | 16 --- src/TinkoffQrCode/src/Services/Exception.php | 122 +++++++++--------- tests/Helpers/auth.php | 6 +- tests/Unit/Drivers/SberAuth/SignTest.php | 2 +- .../Unit/Drivers/TinkoffOnline/CreateTest.php | 4 +- .../Unit/Drivers/TinkoffQrCode/CreateTest.php | 4 +- 43 files changed, 561 insertions(+), 748 deletions(-) rename src/Core/src/Services/{Sign.php => Auth.php} (97%) rename src/{SberAuth => Core}/src/Services/Identifier.php (95%) rename src/SberAuth/src/{Sign.php => Auth.php} (92%) delete mode 100644 src/SberQrCode/requests/.gitignore delete mode 100644 src/SberQrCode/requests/auth.http delete mode 100644 src/SberQrCode/requests/create.http delete mode 100644 src/SberQrCode/requests/http-client.env.json rename src/SberQrCode/src/Constants/{Scopes.php => Scope.php} (97%) delete mode 100644 src/SberQrCode/src/Exceptions/Manager.php create mode 100644 src/SberQrCode/src/Http/Requests/BaseRequest.php create mode 100644 src/SberQrCode/src/Http/Requests/CancelRequest.php create mode 100644 src/SberQrCode/src/Http/Requests/CreateRequest.php rename src/SberQrCode/src/{Requests/Status.php => Http/Requests/StatusRequest.php} (59%) rename src/SberQrCode/src/{Resources/Details.php => Http/Responses/QrCodeResponse.php} (50%) create mode 100644 src/SberQrCode/src/Http/Responses/Response.php delete mode 100644 src/SberQrCode/src/Requests/BaseRequest.php delete mode 100644 src/SberQrCode/src/Requests/Cancel.php delete mode 100644 src/SberQrCode/src/Requests/Create.php delete mode 100644 src/SberQrCode/src/Resources/Model.php create mode 100644 src/SberQrCode/src/Resources/SberQrCodeResource.php delete mode 100644 src/SberQrCode/src/Responses/Cancel.php delete mode 100644 src/SberQrCode/src/Responses/QrCode.php delete mode 100644 src/SberQrCode/src/Responses/Status.php create mode 100644 src/SberQrCode/src/Services/Exception.php rename src/SberQrCode/src/{Helpers => Services}/Statuses.php (63%) rename src/TinkoffAuth/src/{Sign.php => Auth.php} (94%) diff --git a/src/Core/src/Http/Request.php b/src/Core/src/Http/Request.php index 5569061e..cef8d491 100644 --- a/src/Core/src/Http/Request.php +++ b/src/Core/src/Http/Request.php @@ -20,7 +20,7 @@ use Cashbox\Core\Concerns\Config\Application; use Cashbox\Core\Enums\HttpMethodEnum; use Cashbox\Core\Resources\Resource; -use Cashbox\Core\Services\Sign; +use Cashbox\Core\Services\Auth; use DragonCode\Support\Concerns\Makeable; use DragonCode\Support\Facades\Http\Url; @@ -41,7 +41,7 @@ abstract class Request protected bool $secure = true; - protected Sign|string|null $auth = null; + protected Auth|string|null $auth = null; abstract public function body(): array; @@ -73,12 +73,17 @@ public function method(): HttpMethodEnum return $this->method; } - public function sign(): ?Sign + public function sign(): ?Auth { if (! is_string($this->auth)) { return $this->auth; } - return $this->auth = new $this->auth($this, $this->resource->config, $this->secure); + return $this->auth = new $this->auth($this, $this->resource->config, $this->secure, $this->authExtra()); + } + + protected function authExtra(): array + { + return []; } } diff --git a/src/Core/src/Http/Response.php b/src/Core/src/Http/Response.php index ab1a9db0..468ccf23 100644 --- a/src/Core/src/Http/Response.php +++ b/src/Core/src/Http/Response.php @@ -24,9 +24,20 @@ abstract class Response extends Data { - abstract public function getInfo(): InfoData; + public function getInfo(): InfoData + { + return InfoData::from([ + 'externalId' => $this->getExternalId(), + 'operationId' => $this->getOperationId(), + 'status' => $this->getStatus(), + 'extra' => $this->getExtra(), + ]); + } - abstract public function getOperationId(): ?string; + public function getOperationId(): ?string + { + return null; + } public function getExternalId(): ?string { diff --git a/src/Core/src/Services/Sign.php b/src/Core/src/Services/Auth.php similarity index 97% rename from src/Core/src/Services/Sign.php rename to src/Core/src/Services/Auth.php index b7a390f8..b566a01e 100644 --- a/src/Core/src/Services/Sign.php +++ b/src/Core/src/Services/Auth.php @@ -20,7 +20,7 @@ use Cashbox\Core\Data\Config\DriverData; use Cashbox\Core\Http\Request; -abstract class Sign +abstract class Auth { public function __construct( protected readonly Request $request, diff --git a/src/SberAuth/src/Services/Identifier.php b/src/Core/src/Services/Identifier.php similarity index 95% rename from src/SberAuth/src/Services/Identifier.php rename to src/Core/src/Services/Identifier.php index c31bac5e..d0e21e87 100644 --- a/src/SberAuth/src/Services/Identifier.php +++ b/src/Core/src/Services/Identifier.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Cashbox\Sber\Auth\Services; +namespace Cashbox\Core\Services; use DragonCode\Cache\Services\Cache; use Illuminate\Support\Str; diff --git a/src/SberAuth/src/Sign.php b/src/SberAuth/src/Auth.php similarity index 92% rename from src/SberAuth/src/Sign.php rename to src/SberAuth/src/Auth.php index 896fcb3e..357bd29b 100644 --- a/src/SberAuth/src/Sign.php +++ b/src/SberAuth/src/Auth.php @@ -18,12 +18,12 @@ namespace Cashbox\Sber\Auth; use Cashbox\Core\Data\Signing\Token; -use Cashbox\Core\Services\Sign as BaseSign; +use Cashbox\Core\Services\Auth as BaseAuth; +use Cashbox\Core\Services\Identifier; use Cashbox\Sber\Auth\Services\Hash; -use Cashbox\Sber\Auth\Services\Identifier; use Illuminate\Support\Arr; -class Sign extends BaseSign +class Auth extends BaseAuth { public function headers(): array { diff --git a/src/SberAuth/src/Services/Http.php b/src/SberAuth/src/Services/Http.php index 2730a3c9..29e05083 100644 --- a/src/SberAuth/src/Services/Http.php +++ b/src/SberAuth/src/Services/Http.php @@ -19,6 +19,7 @@ use Cashbox\Core\Concerns\Config\Application; use Cashbox\Core\Data\Config\Drivers\CredentialsData; +use Cashbox\Core\Services\Identifier; use DragonCode\Support\Facades\Http\Url; use Illuminate\Http\Client\PendingRequest; use Illuminate\Support\Facades\Http as Client; diff --git a/src/SberQrCode/requests/.gitignore b/src/SberQrCode/requests/.gitignore deleted file mode 100644 index 95914b98..00000000 --- a/src/SberQrCode/requests/.gitignore +++ /dev/null @@ -1 +0,0 @@ -http-client.private.env.json diff --git a/src/SberQrCode/requests/auth.http b/src/SberQrCode/requests/auth.http deleted file mode 100644 index 5bce74d1..00000000 --- a/src/SberQrCode/requests/auth.http +++ /dev/null @@ -1,8 +0,0 @@ -POST {{host}}/ru/prod/tokens/v2/oauth -Accept: application/json -Content-Type: application/x-www-form-urlencoded -X-IBM-Client-Id: {{client_id}} -RqUID: {{unique_id}} -Authorization: Basic {{client_hash}} - -grant_type=client_credentials&scope=https://api.sberbank.ru/order.create diff --git a/src/SberQrCode/requests/create.http b/src/SberQrCode/requests/create.http deleted file mode 100644 index a6e75eaf..00000000 --- a/src/SberQrCode/requests/create.http +++ /dev/null @@ -1,17 +0,0 @@ -POST {{host}}/ru/prod/tokens/v2/oauth -Accept: application/json -Content-Type: application/json -X-IBM-Client-Id: {{client_id}} -RqUID: {{unique_id}} -Authorization: Bearer {{access_token}} - -{ - "rq_uid": "{{unique_id}}", - "rq_tm": "2021-08-23T17:59:00Z", - "member_id": "{{member_id}}", - "id_qr": "{{terminal_id}}", - "order_number": "1234", - "order_sum": 100, - "order_create_date": "2021-08-23T17:59:00Z", - "currency": "643" -} diff --git a/src/SberQrCode/requests/http-client.env.json b/src/SberQrCode/requests/http-client.env.json deleted file mode 100644 index 4cbf1ad2..00000000 --- a/src/SberQrCode/requests/http-client.env.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "dev": { - "host": "https://dev.api.sberbank.ru", - "client_id": "", - "client_secret": "", - "client_hash": "", - "member_id": "", - "terminal_id": "", - "unique_id": "c6cf60f8368c3d921b17b49e353f2dee", - "access_token": "" - }, - "production": { - "host": "https://api.sberbank.ru", - "client_id": "", - "client_secret": "", - "client_hash": "", - "member_id": "", - "terminal_id": "", - "unique_id": "c6cf60f8368c3d921b17b49e353f2dee", - "access_token": "" - } -} diff --git a/src/SberQrCode/src/Constants/Body.php b/src/SberQrCode/src/Constants/Body.php index 6c450dcf..c084140a 100644 --- a/src/SberQrCode/src/Constants/Body.php +++ b/src/SberQrCode/src/Constants/Body.php @@ -17,18 +17,18 @@ class Body { - public const REQUEST_ID = 'rq_uid'; - public const REQUEST_TIME = 'rq_tm'; - public const MEMBER_ID = 'member_id'; - public const TERMINAL_ID = 'id_qr'; + public const AUTH_CODE = 'auth_code'; + public const CANCEL_SUM = 'cancel_operation_sum'; public const EXTERNAL_ID = 'order_id'; + public const MEMBER_ID = 'member_id'; + public const OPERATION_CURRENCY = 'operation_currency'; + public const OPERATION_ID = 'operation_id'; + public const ORDER_CREATED_AT = 'order_create_date'; + public const ORDER_CURRENCY = 'currency'; public const ORDER_ID = 'order_number'; public const ORDER_SUM = 'order_sum'; - public const ORDER_CURRENCY = 'currency'; - public const ORDER_CREATED_AT = 'order_create_date'; - public const OPERATION_ID = 'operation_id'; - public const OPERATION_CURRENCY = 'operation_currency'; - public const AUTH_CODE = 'auth_code'; - public const CANCEL_SUM = 'cancel_operation_sum'; + public const REQUEST_ID = 'rq_uid'; + public const REQUEST_TIME = 'rq_tm'; public const SCOPE = 'scope'; + public const TERMINAL_ID = 'id_qr'; } diff --git a/src/SberQrCode/src/Constants/Scopes.php b/src/SberQrCode/src/Constants/Scope.php similarity index 97% rename from src/SberQrCode/src/Constants/Scopes.php rename to src/SberQrCode/src/Constants/Scope.php index 9734e7e2..0b56dbf2 100644 --- a/src/SberQrCode/src/Constants/Scopes.php +++ b/src/SberQrCode/src/Constants/Scope.php @@ -15,9 +15,9 @@ namespace Cashbox\Sber\QrCode\Constants; -class Scopes +class Scope { + public const CANCEL = 'https://api.sberbank.ru/order.cancel'; public const CREATE = 'https://api.sberbank.ru/order.create'; public const STATUS = 'https://api.sberbank.ru/order.status'; - public const CANCEL = 'https://api.sberbank.ru/order.cancel'; } diff --git a/src/SberQrCode/src/Driver.php b/src/SberQrCode/src/Driver.php index b3df3989..25d5e161 100644 --- a/src/SberQrCode/src/Driver.php +++ b/src/SberQrCode/src/Driver.php @@ -13,46 +13,40 @@ * @see https://cashbox.city */ +declare(strict_types=1); + namespace Cashbox\Sber\QrCode; +use Cashbox\Core\Http\Response as BaseResponse; use Cashbox\Core\Services\Driver as BaseDriver; -use Cashbox\Sber\QrCode\Exceptions\Manager; -use Cashbox\Sber\QrCode\Helpers\Statuses; -use Cashbox\Sber\QrCode\Requests\Cancel; -use Cashbox\Sber\QrCode\Requests\Create; -use Cashbox\Sber\QrCode\Requests\Status; -use Cashbox\Sber\QrCode\Resources\Details; -use Cashbox\Sber\QrCode\Responses\Cancel as CancelResponse; -use Cashbox\Sber\QrCode\Responses\QrCode; -use Cashbox\Sber\QrCode\Responses\Status as StatusResponse; -use DragonCode\Contracts\Cashier\Http\Response; +use Cashbox\Sber\QrCode\Http\Requests\CancelRequest; +use Cashbox\Sber\QrCode\Http\Requests\CreateRequest; +use Cashbox\Sber\QrCode\Http\Requests\StatusRequest; +use Cashbox\Sber\QrCode\Http\Responses\QrCodeResponse; +use Cashbox\Sber\QrCode\Http\Responses\Response; +use Cashbox\Sber\QrCode\Services\Exception; +use Cashbox\Sber\QrCode\Services\Statuses; class Driver extends BaseDriver { - protected $exception = Manager::class; + protected string $statuses = Statuses::class; - protected $statuses = Statuses::class; + protected string $exception = Exception::class; - protected $details = Details::class; + protected string $response = Response::class; - public function start(): Response + public function start(): BaseResponse { - $request = Create::make($this->model); - - return $this->request($request, QrCode::class); + return $this->request(CreateRequest::class, QrCodeResponse::class); } - public function check(): Response + public function verify(): BaseResponse { - $request = Status::make($this->model); - - return $this->request($request, StatusResponse::class); + return $this->request(StatusRequest::class); } - public function refund(): Response + public function refund(): BaseResponse { - $request = Cancel::make($this->model); - - return $this->request($request, CancelResponse::class); + return $this->request(CancelRequest::class); } } diff --git a/src/SberQrCode/src/Exceptions/Manager.php b/src/SberQrCode/src/Exceptions/Manager.php deleted file mode 100644 index 82dbbb3e..00000000 --- a/src/SberQrCode/src/Exceptions/Manager.php +++ /dev/null @@ -1,49 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -namespace Cashbox\Sber\QrCode\Exceptions; - -use Cashbox\Core\Exceptions\Http\BadRequestClientException; -use Cashbox\Core\Exceptions\Http\BankInternalErrorException; -use Cashbox\Core\Exceptions\Http\MethodNotFoundException; -use Cashbox\Core\Exceptions\Http\TooManyRequestsException; -use Cashbox\Core\Exceptions\Http\UnauthorizedException; -use Cashbox\Core\Exceptions\Manager as ExceptionManager; - -class Manager extends ExceptionManager -{ - protected $codes = [ - 400 => BadRequestClientException::class, - 401 => UnauthorizedException::class, - 405 => MethodNotFoundException::class, - 429 => TooManyRequestsException::class, - - 500 => BankInternalErrorException::class, - 503 => BankInternalErrorException::class, - ]; - - protected $code_keys = ['httpCode', 'status.error_code']; - - protected $success_keys = []; - - protected $reason_keys = ['moreInformation', 'httpMessage', 'Message', 'status.error_description']; - - protected function isFailedContentCode(array $response): bool - { - $code = $this->getCodeByResponseContent($response); - - return ! is_null($code) && $code !== 0; - } -} diff --git a/src/SberQrCode/src/Http/Requests/BaseRequest.php b/src/SberQrCode/src/Http/Requests/BaseRequest.php new file mode 100644 index 00000000..d78c923d --- /dev/null +++ b/src/SberQrCode/src/Http/Requests/BaseRequest.php @@ -0,0 +1,54 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Sber\QrCode\Http\Requests; + +use Carbon\Carbon; +use Cashbox\Core\Concerns\Config\Application; +use Cashbox\Core\Http\Request; +use Cashbox\Core\Services\Auth; +use Cashbox\Core\Services\Identifier; +use Cashbox\Sber\Auth\Auth as SberAuth; + +abstract class BaseRequest extends Request +{ + use Application; + + protected string $productionHost = 'https://api.sberbank.ru'; + + protected Auth|string|null $auth = SberAuth::class; + + public function options(): array + { + return [ + 'cert' => [ + $this->resource->config->credentials->extra['certificate_path'], + $this->resource->config->credentials->extra['certificate_password'], + ], + ]; + } + + protected function uniqueId(): string + { + return Identifier::getUnique(); + } + + protected function currentTime(): string + { + return Carbon::now()->setTimezone('UTC')->format('Y-m-d\TH:i:s\Z'); + } +} diff --git a/src/SberQrCode/src/Http/Requests/CancelRequest.php b/src/SberQrCode/src/Http/Requests/CancelRequest.php new file mode 100644 index 00000000..075de336 --- /dev/null +++ b/src/SberQrCode/src/Http/Requests/CancelRequest.php @@ -0,0 +1,50 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Sber\QrCode\Http\Requests; + +use Cashbox\Sber\QrCode\Constants\Body; +use Cashbox\Sber\QrCode\Constants\Scope; + +class CancelRequest extends BaseRequest +{ + protected string $productionUri = '/ru/prod/order/v1/cancel'; + + public function body(): array + { + return [ + Body::REQUEST_ID => $this->uniqueId(), + Body::REQUEST_TIME => $this->currentTime(), + + Body::TERMINAL_ID => $this->resource->terminalId(), + + Body::EXTERNAL_ID => $this->resource->externalId(), + Body::OPERATION_ID => $this->resource->operationId(), + + Body::OPERATION_CURRENCY => $this->resource->currency(), + + Body::AUTH_CODE => (string) $this->resource->sum(), + + Body::CANCEL_SUM => $this->resource->sum(), + ]; + } + + protected function authExtra(): array + { + return [Body::SCOPE => Scope::CANCEL]; + } +} diff --git a/src/SberQrCode/src/Http/Requests/CreateRequest.php b/src/SberQrCode/src/Http/Requests/CreateRequest.php new file mode 100644 index 00000000..25ab9b91 --- /dev/null +++ b/src/SberQrCode/src/Http/Requests/CreateRequest.php @@ -0,0 +1,47 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Sber\QrCode\Http\Requests; + +use Cashbox\Sber\QrCode\Constants\Body; +use Cashbox\Sber\QrCode\Constants\Scope; + +class CreateRequest extends BaseRequest +{ + protected string $productionUri = '/ru/prod/order/v1/creation'; + + public function body(): array + { + return [ + Body::REQUEST_ID => $this->uniqueId(), + Body::REQUEST_TIME => $this->currentTime(), + + Body::MEMBER_ID => $this->resource->memberId(), + Body::TERMINAL_ID => $this->resource->terminalId(), + + Body::ORDER_ID => $this->resource->paymentId(), + Body::ORDER_SUM => $this->resource->sum(), + Body::ORDER_CURRENCY => $this->resource->currency(), + Body::ORDER_CREATED_AT => $this->resource->createdAt(), + ]; + } + + protected function authExtra(): array + { + return [Body::SCOPE => Scope::CREATE]; + } +} diff --git a/src/SberQrCode/src/Requests/Status.php b/src/SberQrCode/src/Http/Requests/StatusRequest.php similarity index 59% rename from src/SberQrCode/src/Requests/Status.php rename to src/SberQrCode/src/Http/Requests/StatusRequest.php index a00c6f45..dc369dd6 100644 --- a/src/SberQrCode/src/Requests/Status.php +++ b/src/SberQrCode/src/Http/Requests/StatusRequest.php @@ -15,26 +15,27 @@ declare(strict_types=1); -namespace Cashbox\Sber\QrCode\Requests; +namespace Cashbox\Sber\QrCode\Http\Requests; use Cashbox\Sber\QrCode\Constants\Body; -use Cashbox\Sber\QrCode\Constants\Scopes; +use Cashbox\Sber\QrCode\Constants\Scope; -class Status extends BaseRequest +class StatusRequest extends BaseRequest { - protected $path = '/ru/prod/order/v1/status'; + protected string $productionUri = '/ru/prod/order/v1/status'; - protected $auth_extra = [ - Body::SCOPE => Scopes::STATUS, - ]; - - public function getRawBody(): array + public function body(): array { return [ Body::REQUEST_ID => $this->uniqueId(), Body::REQUEST_TIME => $this->currentTime(), - Body::EXTERNAL_ID => $this->model->getExternalId(), + Body::EXTERNAL_ID => $this->resource->externalId(), ]; } + + protected function authExtra(): array + { + return [Body::SCOPE => Scope::STATUS]; + } } diff --git a/src/SberQrCode/src/Resources/Details.php b/src/SberQrCode/src/Http/Responses/QrCodeResponse.php similarity index 50% rename from src/SberQrCode/src/Resources/Details.php rename to src/SberQrCode/src/Http/Responses/QrCodeResponse.php index e7218fcc..16f14e51 100644 --- a/src/SberQrCode/src/Resources/Details.php +++ b/src/SberQrCode/src/Http/Responses/QrCodeResponse.php @@ -15,24 +15,19 @@ declare(strict_types=1); -namespace Cashbox\Sber\QrCode\Resources; +namespace Cashbox\Sber\QrCode\Http\Responses; -use Cashbox\Core\Resources\Details as BaseDetails; +use Cashbox\Core\Http\Response; +use Spatie\LaravelData\Attributes\MapInputName; -class Details extends BaseDetails +class QrCodeResponse extends Response { - protected $url; + #[MapInputName('status.order_state')] + public ?string $status; - public function getUrl(): ?string - { - return $this->url; - } + #[MapInputName('status.order_form_url')] + public ?string $url; - public function toArray(): array - { - return [ - 'status' => $this->status, - 'url' => $this->url, - ]; - } + #[MapInputName('status.order_id')] + public string $externalId; } diff --git a/src/SberQrCode/src/Http/Responses/Response.php b/src/SberQrCode/src/Http/Responses/Response.php new file mode 100644 index 00000000..68f4895c --- /dev/null +++ b/src/SberQrCode/src/Http/Responses/Response.php @@ -0,0 +1,33 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Sber\QrCode\Http\Responses; + +use Cashbox\Core\Http\Response as BaseResponse; +use Spatie\LaravelData\Attributes\MapInputName; + +class Response extends BaseResponse +{ + #[MapInputName('status.order_state')] + public ?string $status; + + #[MapInputName('status.order_id')] + public string $externalId; + + #[MapInputName('status.order_operation_params.0.operation_id')] + public string $operationId; +} diff --git a/src/SberQrCode/src/Requests/BaseRequest.php b/src/SberQrCode/src/Requests/BaseRequest.php deleted file mode 100644 index 89c64acf..00000000 --- a/src/SberQrCode/src/Requests/BaseRequest.php +++ /dev/null @@ -1,72 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Sber\QrCode\Requests; - -use Cashbox\Core\Facades\Config\Main; -use Cashbox\Core\Facades\Helpers\Date; -use Cashbox\Core\Http\Request; -use Cashbox\Sber\Auth\Auth; -use Illuminate\Support\Carbon; - -abstract class BaseRequest extends Request -{ - protected $production_host = 'https://api.sberbank.ru'; - - protected $dev_host = 'https://dev.api.sberbank.ru'; - - protected $auth = Auth::class; - - public function getRawHeaders(): array - { - return [ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ]; - } - - public function getHttpOptions(): array - { - if (Main::isProduction()) { - $cert = $this->getCertificateData(); - - return compact('cert'); - } - - return []; - } - - protected function uniqueId(): string - { - return $this->model->getUniqueId(); - } - - protected function currentTime(): string - { - $date = Carbon::now(); - - return Date::toString($date); - } - - protected function getCertificateData(): array - { - return [ - $this->model->getCertificatePath(), - $this->model->getCertificatePassword(), - ]; - } -} diff --git a/src/SberQrCode/src/Requests/Cancel.php b/src/SberQrCode/src/Requests/Cancel.php deleted file mode 100644 index 5ec7acc4..00000000 --- a/src/SberQrCode/src/Requests/Cancel.php +++ /dev/null @@ -1,56 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Sber\QrCode\Requests; - -use Cashbox\Sber\QrCode\Constants\Body; -use Cashbox\Sber\QrCode\Constants\Scopes; - -class Cancel extends BaseRequest -{ - protected $path = '/ru/prod/order/v1/cancel'; - - protected $auth_extra = [ - Body::SCOPE => Scopes::CANCEL, - ]; - - protected $reload_relations = true; - - public function getRawBody(): array - { - return [ - Body::REQUEST_ID => $this->uniqueId(), - Body::REQUEST_TIME => $this->currentTime(), - - Body::TERMINAL_ID => $this->model->getTerminalId(), - - Body::EXTERNAL_ID => $this->model->getExternalId(), - Body::OPERATION_ID => $this->model->getOperationId(), - - Body::OPERATION_CURRENCY => $this->model->getCurrency(), - - Body::AUTH_CODE => $this->getAuthCode(), - - Body::CANCEL_SUM => $this->model->getSum(), - ]; - } - - protected function getAuthCode(): string - { - return (string) $this->model->getSum(); - } -} diff --git a/src/SberQrCode/src/Requests/Create.php b/src/SberQrCode/src/Requests/Create.php deleted file mode 100644 index 9f8ec6d2..00000000 --- a/src/SberQrCode/src/Requests/Create.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Sber\QrCode\Requests; - -use Cashbox\Sber\QrCode\Constants\Body; -use Cashbox\Sber\QrCode\Constants\Scopes; - -class Create extends BaseRequest -{ - protected $path = '/ru/prod/order/v1/creation'; - - protected $auth_extra = [ - Body::SCOPE => Scopes::CREATE, - ]; - - public function getRawBody(): array - { - return [ - Body::REQUEST_ID => $this->uniqueId(), - Body::REQUEST_TIME => $this->currentTime(), - - Body::MEMBER_ID => $this->model->getMemberId(), - Body::TERMINAL_ID => $this->model->getTerminalId(), - - Body::ORDER_ID => $this->model->getPaymentId(), - Body::ORDER_SUM => $this->model->getSum(), - Body::ORDER_CURRENCY => $this->model->getCurrency(), - Body::ORDER_CREATED_AT => $this->model->getCreatedAt(), - ]; - } -} diff --git a/src/SberQrCode/src/Resources/Model.php b/src/SberQrCode/src/Resources/Model.php deleted file mode 100644 index 16794f33..00000000 --- a/src/SberQrCode/src/Resources/Model.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -namespace Cashbox\Sber\QrCode\Resources; - -use Cashbox\Core\Resources\Model as BaseModel; - -abstract class Model extends BaseModel -{ - abstract public function getCertificatePath(): ?string; - - abstract public function getCertificatePassword(): ?string; - - abstract public function getMemberId(): string; - - abstract public function getTerminalId(): string; -} diff --git a/src/SberQrCode/src/Resources/SberQrCodeResource.php b/src/SberQrCode/src/Resources/SberQrCodeResource.php new file mode 100644 index 00000000..aaa48a6c --- /dev/null +++ b/src/SberQrCode/src/Resources/SberQrCodeResource.php @@ -0,0 +1,49 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Sber\QrCode\Resources; + +use Cashbox\Core\Resources\Resource; +use DateTimeInterface; + +abstract class SberQrCodeResource extends Resource +{ + public function certificatePath(): ?string + { + return $this->config->credentials->extra['certificate_path'] ?? null; + } + + public function certificatePassword(): ?string + { + return $this->config->credentials->extra['certificate_password'] ?? null; + } + + public function memberId(): string + { + return $this->config->credentials->extra['member_id']; + } + + public function terminalId(): string + { + return $this->config->credentials->clientId; + } + + public function createdAt(): DateTimeInterface + { + return $this->payment->created_at; + } +} diff --git a/src/SberQrCode/src/Responses/Cancel.php b/src/SberQrCode/src/Responses/Cancel.php deleted file mode 100644 index e88f40f8..00000000 --- a/src/SberQrCode/src/Responses/Cancel.php +++ /dev/null @@ -1,36 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Sber\QrCode\Responses; - -use Cashbox\Core\Http\Response; - -class Cancel extends Response -{ - protected $map = [ - self::KEY_EXTERNAL_ID => 'status.order_id', - - self::KEY_OPERATION_ID => 'status.order_operation_params.0.operation_id', - - self::KEY_STATUS => 'status.order_status', - ]; - - public function isEmpty(): bool - { - return empty($this->getExternalId()) || empty($this->getOperationId()); - } -} diff --git a/src/SberQrCode/src/Responses/QrCode.php b/src/SberQrCode/src/Responses/QrCode.php deleted file mode 100644 index f357e79b..00000000 --- a/src/SberQrCode/src/Responses/QrCode.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Sber\QrCode\Responses; - -use Cashbox\Core\Http\Response; - -class QrCode extends Response -{ - public const KEY_URL = 'url'; - - protected $map = [ - self::KEY_EXTERNAL_ID => 'status.order_id', - - self::KEY_STATUS => 'status.order_state', - - self::KEY_URL => 'status.order_form_url', - ]; - - public function getUrl(): ?string - { - return $this->value(self::KEY_URL); - } - - public function isEmpty(): bool - { - return empty($this->getExternalId()) || empty($this->getUrl()); - } -} diff --git a/src/SberQrCode/src/Responses/Status.php b/src/SberQrCode/src/Responses/Status.php deleted file mode 100644 index 8291891d..00000000 --- a/src/SberQrCode/src/Responses/Status.php +++ /dev/null @@ -1,36 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\Sber\QrCode\Responses; - -use Cashbox\Core\Http\Response; - -class Status extends Response -{ - protected $map = [ - self::KEY_EXTERNAL_ID => 'status.order_id', - - self::KEY_OPERATION_ID => 'status.order_operation_params.0.operation_id', - - self::KEY_STATUS => 'status.order_state', - ]; - - public function isEmpty(): bool - { - return empty($this->getExternalId()) || empty($this->getStatus()); - } -} diff --git a/src/SberQrCode/src/Services/Exception.php b/src/SberQrCode/src/Services/Exception.php new file mode 100644 index 00000000..8280923a --- /dev/null +++ b/src/SberQrCode/src/Services/Exception.php @@ -0,0 +1,42 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Sber\QrCode\Services; + +use Cashbox\Core\Exceptions\External\BankInternalErrorHttpException; +use Cashbox\Core\Exceptions\External\MethodNotFoundHttpException; +use Cashbox\Core\Exceptions\External\TooManyRequestsHttpException; +use Cashbox\Core\Exceptions\External\UnauthorizedHttpException; +use Cashbox\Core\Services\Exception as BaseException; + +class Exception extends BaseException +{ + protected array $codes = [ + 401 => UnauthorizedHttpException::class, + 405 => MethodNotFoundHttpException::class, + 429 => TooManyRequestsHttpException::class, + + 500 => BankInternalErrorHttpException::class, + 501 => BankInternalErrorHttpException::class, + 502 => BankInternalErrorHttpException::class, + 503 => BankInternalErrorHttpException::class, + ]; + + protected array $codeKeys = ['httpCode', 'status.error_code']; + + protected array $reasonKeys = ['moreInformation', 'httpMessage', 'Message', 'status.error_description']; +} diff --git a/src/SberQrCode/src/Helpers/Statuses.php b/src/SberQrCode/src/Services/Statuses.php similarity index 63% rename from src/SberQrCode/src/Helpers/Statuses.php rename to src/SberQrCode/src/Services/Statuses.php index c8c29c31..13f3e81e 100644 --- a/src/SberQrCode/src/Helpers/Statuses.php +++ b/src/SberQrCode/src/Services/Statuses.php @@ -13,23 +13,17 @@ * @see https://cashbox.city */ -namespace Cashbox\Sber\QrCode\Helpers; +declare(strict_types=1); + +namespace Cashbox\Sber\QrCode\Services; use Cashbox\Core\Services\Statuses as BaseStatus; class Statuses extends BaseStatus { - public const NEW = [ - 'CREATED', - ]; + public const FAILED = []; + public const NEW = ['CREATED']; + public const REFUNDED = ['REVERSED', 'REFUNDED', 'REVOKED']; public const REFUNDING = []; - public const REFUNDED = [ - 'REVERSED', - 'REFUNDED', - 'REVOKED', - ]; - public const FAILED = []; - public const SUCCESS = [ - 'PAID', - ]; + public const SUCCESS = ['PAID']; } diff --git a/src/TinkoffAuth/src/Sign.php b/src/TinkoffAuth/src/Auth.php similarity index 94% rename from src/TinkoffAuth/src/Sign.php rename to src/TinkoffAuth/src/Auth.php index 4005412f..865ca39a 100644 --- a/src/TinkoffAuth/src/Sign.php +++ b/src/TinkoffAuth/src/Auth.php @@ -18,11 +18,11 @@ namespace Cashbox\Tinkoff\Auth; use Cashbox\Core\Data\Signing\Token; -use Cashbox\Core\Services\Sign as BaseSign; +use Cashbox\Core\Services\Auth as BaseSign; use Cashbox\Tinkoff\Auth\Constants\Keys; use Cashbox\Tinkoff\Auth\Services\Hash; -class Sign extends BaseSign +class Auth extends BaseSign { public function body(): array { diff --git a/src/TinkoffCredit/src/Http/Responses/Response.php b/src/TinkoffCredit/src/Http/Responses/Response.php index 1d33c855..99c34a4e 100644 --- a/src/TinkoffCredit/src/Http/Responses/Response.php +++ b/src/TinkoffCredit/src/Http/Responses/Response.php @@ -17,7 +17,6 @@ namespace Cashbox\Tinkoff\Credit\Http\Responses; -use Cashbox\Core\Data\Models\InfoData; use Cashbox\Core\Http\Response as BaseResponse; use Spatie\LaravelData\Attributes\MapInputName; @@ -28,21 +27,6 @@ class Response extends BaseResponse #[MapInputName('link')] public ?string $url; - public function getOperationId(): ?string - { - return null; - } - - public function getInfo(): InfoData - { - return InfoData::from([ - 'externalId' => $this->getExternalId(), - 'operationId' => $this->getOperationId(), - 'status' => $this->getStatus(), - 'extra' => $this->getExtra(), - ]); - } - protected function getExtra(): array { return [ diff --git a/src/TinkoffCredit/src/Services/Exception.php b/src/TinkoffCredit/src/Services/Exception.php index 0bda48c2..eef27d51 100644 --- a/src/TinkoffCredit/src/Services/Exception.php +++ b/src/TinkoffCredit/src/Services/Exception.php @@ -15,72 +15,72 @@ namespace Cashbox\Tinkoff\Credit\Services; -use Cashbox\Core\Exceptions\External\BankInternalErrorException; -use Cashbox\Core\Exceptions\External\BuyerNotFoundClientException; -use Cashbox\Core\Exceptions\External\CardHasStolenException; -use Cashbox\Core\Exceptions\External\ContactTheSellerClientException; -use Cashbox\Core\Exceptions\External\IncorrectSumException; -use Cashbox\Core\Exceptions\External\InsufficientFundsCardException; -use Cashbox\Core\Exceptions\External\InvalidCardException; -use Cashbox\Core\Exceptions\External\PaymentCompletedException; -use Cashbox\Core\Exceptions\External\PaymentDeclinedException; -use Cashbox\Core\Exceptions\External\PaymentTypeNotAvailableException; -use Cashbox\Core\Exceptions\External\TooManyRequestsException; -use Cashbox\Core\Exceptions\External\TransactionNotFoundException; -use Cashbox\Core\Exceptions\External\TryAgainLaterClientException; +use Cashbox\Core\Exceptions\External\BankInternalErrorHttpException; +use Cashbox\Core\Exceptions\External\BuyerNotFoundHttpException; +use Cashbox\Core\Exceptions\External\CardHasStolenHttpException; +use Cashbox\Core\Exceptions\External\ContactTheSellerHttpException; +use Cashbox\Core\Exceptions\External\IncorrectSumHttpException; +use Cashbox\Core\Exceptions\External\InsufficientFundsCardHttpException; +use Cashbox\Core\Exceptions\External\InvalidCardHttpException; +use Cashbox\Core\Exceptions\External\PaymentCompletedHttpException; +use Cashbox\Core\Exceptions\External\PaymentDeclinedHttpException; +use Cashbox\Core\Exceptions\External\PaymentTypeNotAvailableHttpException; +use Cashbox\Core\Exceptions\External\TooManyRequestsHttpException; +use Cashbox\Core\Exceptions\External\TransactionNotFoundHttpException; +use Cashbox\Core\Exceptions\External\TryAgainLaterClientHttpException; use Cashbox\Core\Services\Exception as BaseException; class Exception extends BaseException { protected array $codes = [ - 7 => BuyerNotFoundClientException::class, - 53 => ContactTheSellerClientException::class, - 99 => PaymentDeclinedException::class, - 100 => TryAgainLaterClientException::class, - 102 => PaymentDeclinedException::class, - 103 => TryAgainLaterClientException::class, - 119 => TooManyRequestsException::class, - 403 => PaymentDeclinedException::class, - 404 => TransactionNotFoundException::class, - 604 => PaymentDeclinedException::class, - 620 => IncorrectSumException::class, - 623 => PaymentCompletedException::class, - 642 => InvalidCardException::class, - 1004 => CardHasStolenException::class, - 1005 => PaymentDeclinedException::class, - 1007 => CardHasStolenException::class, - 1008 => PaymentDeclinedException::class, - 1012 => PaymentDeclinedException::class, - 1013 => TryAgainLaterClientException::class, - 1014 => InvalidCardException::class, - 1015 => TryAgainLaterClientException::class, - 1019 => PaymentDeclinedException::class, - 1030 => TryAgainLaterClientException::class, - 1033 => InvalidCardException::class, - 1034 => TryAgainLaterClientException::class, - 1039 => PaymentDeclinedException::class, - 1041 => CardHasStolenException::class, - 1043 => CardHasStolenException::class, - 1051 => InsufficientFundsCardException::class, - 1053 => PaymentDeclinedException::class, - 1054 => InvalidCardException::class, - 1057 => InvalidCardException::class, - 1058 => InvalidCardException::class, - 1059 => CardHasStolenException::class, - 1061 => InvalidCardException::class, - 1062 => InvalidCardException::class, - 1063 => InvalidCardException::class, - 1064 => IncorrectSumException::class, - 1065 => PaymentDeclinedException::class, - 1076 => PaymentDeclinedException::class, - 1089 => TryAgainLaterClientException::class, - 1091 => TryAgainLaterClientException::class, - 1092 => PaymentDeclinedException::class, - 1093 => CardHasStolenException::class, - 1094 => BankInternalErrorException::class, - 1096 => TryAgainLaterClientException::class, - 3001 => PaymentTypeNotAvailableException::class, - 9999 => BankInternalErrorException::class, + 7 => BuyerNotFoundHttpException::class, + 53 => ContactTheSellerHttpException::class, + 99 => PaymentDeclinedHttpException::class, + 100 => TryAgainLaterClientHttpException::class, + 102 => PaymentDeclinedHttpException::class, + 103 => TryAgainLaterClientHttpException::class, + 119 => TooManyRequestsHttpException::class, + 403 => PaymentDeclinedHttpException::class, + 404 => TransactionNotFoundHttpException::class, + 604 => PaymentDeclinedHttpException::class, + 620 => IncorrectSumHttpException::class, + 623 => PaymentCompletedHttpException::class, + 642 => InvalidCardHttpException::class, + 1004 => CardHasStolenHttpException::class, + 1005 => PaymentDeclinedHttpException::class, + 1007 => CardHasStolenHttpException::class, + 1008 => PaymentDeclinedHttpException::class, + 1012 => PaymentDeclinedHttpException::class, + 1013 => TryAgainLaterClientHttpException::class, + 1014 => InvalidCardHttpException::class, + 1015 => TryAgainLaterClientHttpException::class, + 1019 => PaymentDeclinedHttpException::class, + 1030 => TryAgainLaterClientHttpException::class, + 1033 => InvalidCardHttpException::class, + 1034 => TryAgainLaterClientHttpException::class, + 1039 => PaymentDeclinedHttpException::class, + 1041 => CardHasStolenHttpException::class, + 1043 => CardHasStolenHttpException::class, + 1051 => InsufficientFundsCardHttpException::class, + 1053 => PaymentDeclinedHttpException::class, + 1054 => InvalidCardHttpException::class, + 1057 => InvalidCardHttpException::class, + 1058 => InvalidCardHttpException::class, + 1059 => CardHasStolenHttpException::class, + 1061 => InvalidCardHttpException::class, + 1062 => InvalidCardHttpException::class, + 1063 => InvalidCardHttpException::class, + 1064 => IncorrectSumHttpException::class, + 1065 => PaymentDeclinedHttpException::class, + 1076 => PaymentDeclinedHttpException::class, + 1089 => TryAgainLaterClientHttpException::class, + 1091 => TryAgainLaterClientHttpException::class, + 1092 => PaymentDeclinedHttpException::class, + 1093 => CardHasStolenHttpException::class, + 1094 => BankInternalErrorHttpException::class, + 1096 => TryAgainLaterClientHttpException::class, + 3001 => PaymentTypeNotAvailableHttpException::class, + 9999 => BankInternalErrorHttpException::class, ]; protected array $reasonKeys = ['Message', 'Data', 'errors']; diff --git a/src/TinkoffOnline/src/Http/Requests/BaseRequest.php b/src/TinkoffOnline/src/Http/Requests/BaseRequest.php index 8c227f2d..fb7af907 100644 --- a/src/TinkoffOnline/src/Http/Requests/BaseRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/BaseRequest.php @@ -18,14 +18,14 @@ namespace Cashbox\Tinkoff\Online\Http\Requests; use Cashbox\Core\Http\Request; -use Cashbox\Core\Services\Sign as BaseSign; -use Cashbox\Tinkoff\Auth\Sign; +use Cashbox\Core\Services\Auth as BaseSign; +use Cashbox\Tinkoff\Auth\Auth; abstract class BaseRequest extends Request { protected string $productionHost = 'https://securepay.tinkoff.ru'; - protected BaseSign|string|null $auth = Sign::class; + protected BaseSign|string|null $auth = Auth::class; protected function clientId(): string { diff --git a/src/TinkoffOnline/src/Http/Responses/Response.php b/src/TinkoffOnline/src/Http/Responses/Response.php index 079aa397..02565ed7 100644 --- a/src/TinkoffOnline/src/Http/Responses/Response.php +++ b/src/TinkoffOnline/src/Http/Responses/Response.php @@ -17,7 +17,6 @@ namespace Cashbox\Tinkoff\Online\Http\Responses; -use Cashbox\Core\Data\Models\InfoData; use Cashbox\Core\Http\Response as BaseResponse; use Spatie\LaravelData\Attributes\MapInputName; @@ -32,21 +31,6 @@ class Response extends BaseResponse #[MapInputName('PaymentId')] public string $externalId; - public function getOperationId(): ?string - { - return null; - } - - public function getInfo(): InfoData - { - return InfoData::from([ - 'externalId' => $this->getExternalId(), - 'operationId' => $this->getOperationId(), - 'status' => $this->getStatus(), - 'extra' => $this->getExtra(), - ]); - } - public function getExternalId(): ?string { return $this->externalId; diff --git a/src/TinkoffOnline/src/Services/Exception.php b/src/TinkoffOnline/src/Services/Exception.php index 86a9e49f..6ca8b713 100644 --- a/src/TinkoffOnline/src/Services/Exception.php +++ b/src/TinkoffOnline/src/Services/Exception.php @@ -17,72 +17,72 @@ namespace Cashbox\Tinkoff\Online\Services; -use Cashbox\Core\Exceptions\External\BankInternalErrorException; -use Cashbox\Core\Exceptions\External\BuyerNotFoundClientException; -use Cashbox\Core\Exceptions\External\CardHasStolenException; -use Cashbox\Core\Exceptions\External\ContactTheSellerClientException; -use Cashbox\Core\Exceptions\External\IncorrectSumException; -use Cashbox\Core\Exceptions\External\InsufficientFundsCardException; -use Cashbox\Core\Exceptions\External\InvalidCardException; -use Cashbox\Core\Exceptions\External\PaymentCompletedException; -use Cashbox\Core\Exceptions\External\PaymentDeclinedException; -use Cashbox\Core\Exceptions\External\PaymentTypeNotAvailableException; -use Cashbox\Core\Exceptions\External\TooManyRequestsException; -use Cashbox\Core\Exceptions\External\TransactionNotFoundException; -use Cashbox\Core\Exceptions\External\TryAgainLaterClientException; +use Cashbox\Core\Exceptions\External\BankInternalErrorHttpException; +use Cashbox\Core\Exceptions\External\BuyerNotFoundHttpException; +use Cashbox\Core\Exceptions\External\CardHasStolenHttpException; +use Cashbox\Core\Exceptions\External\ContactTheSellerHttpException; +use Cashbox\Core\Exceptions\External\IncorrectSumHttpException; +use Cashbox\Core\Exceptions\External\InsufficientFundsCardHttpException; +use Cashbox\Core\Exceptions\External\InvalidCardHttpException; +use Cashbox\Core\Exceptions\External\PaymentCompletedHttpException; +use Cashbox\Core\Exceptions\External\PaymentDeclinedHttpException; +use Cashbox\Core\Exceptions\External\PaymentTypeNotAvailableHttpException; +use Cashbox\Core\Exceptions\External\TooManyRequestsHttpException; +use Cashbox\Core\Exceptions\External\TransactionNotFoundHttpException; +use Cashbox\Core\Exceptions\External\TryAgainLaterClientHttpException; use Cashbox\Core\Services\Exception as BaseException; class Exception extends BaseException { protected array $codes = [ - 7 => BuyerNotFoundClientException::class, - 53 => ContactTheSellerClientException::class, - 99 => PaymentDeclinedException::class, - 100 => TryAgainLaterClientException::class, - 102 => PaymentDeclinedException::class, - 103 => TryAgainLaterClientException::class, - 119 => TooManyRequestsException::class, - 403 => PaymentDeclinedException::class, - 404 => TransactionNotFoundException::class, - 604 => PaymentDeclinedException::class, - 620 => IncorrectSumException::class, - 623 => PaymentCompletedException::class, - 642 => InvalidCardException::class, - 1004 => CardHasStolenException::class, - 1005 => PaymentDeclinedException::class, - 1007 => CardHasStolenException::class, - 1008 => PaymentDeclinedException::class, - 1012 => PaymentDeclinedException::class, - 1013 => TryAgainLaterClientException::class, - 1014 => InvalidCardException::class, - 1015 => TryAgainLaterClientException::class, - 1019 => PaymentDeclinedException::class, - 1030 => TryAgainLaterClientException::class, - 1033 => InvalidCardException::class, - 1034 => TryAgainLaterClientException::class, - 1039 => PaymentDeclinedException::class, - 1041 => CardHasStolenException::class, - 1043 => CardHasStolenException::class, - 1051 => InsufficientFundsCardException::class, - 1053 => PaymentDeclinedException::class, - 1054 => InvalidCardException::class, - 1057 => InvalidCardException::class, - 1058 => InvalidCardException::class, - 1059 => CardHasStolenException::class, - 1061 => InvalidCardException::class, - 1062 => InvalidCardException::class, - 1063 => InvalidCardException::class, - 1064 => IncorrectSumException::class, - 1065 => PaymentDeclinedException::class, - 1076 => PaymentDeclinedException::class, - 1089 => TryAgainLaterClientException::class, - 1091 => TryAgainLaterClientException::class, - 1092 => PaymentDeclinedException::class, - 1093 => CardHasStolenException::class, - 1094 => BankInternalErrorException::class, - 1096 => TryAgainLaterClientException::class, - 3001 => PaymentTypeNotAvailableException::class, - 9999 => BankInternalErrorException::class, + 7 => BuyerNotFoundHttpException::class, + 53 => ContactTheSellerHttpException::class, + 99 => PaymentDeclinedHttpException::class, + 100 => TryAgainLaterClientHttpException::class, + 102 => PaymentDeclinedHttpException::class, + 103 => TryAgainLaterClientHttpException::class, + 119 => TooManyRequestsHttpException::class, + 403 => PaymentDeclinedHttpException::class, + 404 => TransactionNotFoundHttpException::class, + 604 => PaymentDeclinedHttpException::class, + 620 => IncorrectSumHttpException::class, + 623 => PaymentCompletedHttpException::class, + 642 => InvalidCardHttpException::class, + 1004 => CardHasStolenHttpException::class, + 1005 => PaymentDeclinedHttpException::class, + 1007 => CardHasStolenHttpException::class, + 1008 => PaymentDeclinedHttpException::class, + 1012 => PaymentDeclinedHttpException::class, + 1013 => TryAgainLaterClientHttpException::class, + 1014 => InvalidCardHttpException::class, + 1015 => TryAgainLaterClientHttpException::class, + 1019 => PaymentDeclinedHttpException::class, + 1030 => TryAgainLaterClientHttpException::class, + 1033 => InvalidCardHttpException::class, + 1034 => TryAgainLaterClientHttpException::class, + 1039 => PaymentDeclinedHttpException::class, + 1041 => CardHasStolenHttpException::class, + 1043 => CardHasStolenHttpException::class, + 1051 => InsufficientFundsCardHttpException::class, + 1053 => PaymentDeclinedHttpException::class, + 1054 => InvalidCardHttpException::class, + 1057 => InvalidCardHttpException::class, + 1058 => InvalidCardHttpException::class, + 1059 => CardHasStolenHttpException::class, + 1061 => InvalidCardHttpException::class, + 1062 => InvalidCardHttpException::class, + 1063 => InvalidCardHttpException::class, + 1064 => IncorrectSumHttpException::class, + 1065 => PaymentDeclinedHttpException::class, + 1076 => PaymentDeclinedHttpException::class, + 1089 => TryAgainLaterClientHttpException::class, + 1091 => TryAgainLaterClientHttpException::class, + 1092 => PaymentDeclinedHttpException::class, + 1093 => CardHasStolenHttpException::class, + 1094 => BankInternalErrorHttpException::class, + 1096 => TryAgainLaterClientHttpException::class, + 3001 => PaymentTypeNotAvailableHttpException::class, + 9999 => BankInternalErrorHttpException::class, ]; protected array $failedKey = ['Success']; diff --git a/src/TinkoffQrCode/src/Http/Requests/BaseRequest.php b/src/TinkoffQrCode/src/Http/Requests/BaseRequest.php index 08b3163e..81afa955 100644 --- a/src/TinkoffQrCode/src/Http/Requests/BaseRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/BaseRequest.php @@ -18,14 +18,14 @@ namespace Cashbox\Tinkoff\QrCode\Http\Requests; use Cashbox\Core\Http\Request; -use Cashbox\Core\Services\Sign as BaseSign; -use Cashbox\Tinkoff\Auth\Sign; +use Cashbox\Core\Services\Auth as BaseSign; +use Cashbox\Tinkoff\Auth\Auth; abstract class BaseRequest extends Request { protected string $productionHost = 'https://securepay.tinkoff.ru'; - protected BaseSign|string|null $auth = Sign::class; + protected BaseSign|string|null $auth = Auth::class; protected function clientId(): string { diff --git a/src/TinkoffQrCode/src/Http/Responses/Response.php b/src/TinkoffQrCode/src/Http/Responses/Response.php index 9371627a..dac57244 100644 --- a/src/TinkoffQrCode/src/Http/Responses/Response.php +++ b/src/TinkoffQrCode/src/Http/Responses/Response.php @@ -17,7 +17,6 @@ namespace Cashbox\Tinkoff\QrCode\Http\Responses; -use Cashbox\Core\Data\Models\InfoData; use Cashbox\Core\Http\Response as BaseResponse; use Spatie\LaravelData\Attributes\MapInputName; @@ -32,21 +31,6 @@ class Response extends BaseResponse #[MapInputName('PaymentId')] public string $externalId; - public function getOperationId(): ?string - { - return null; - } - - public function getInfo(): InfoData - { - return InfoData::from([ - 'externalId' => $this->getExternalId(), - 'operationId' => $this->getOperationId(), - 'status' => $this->getStatus(), - 'extra' => $this->getExtra(), - ]); - } - public function getExternalId(): ?string { return $this->externalId; diff --git a/src/TinkoffQrCode/src/Services/Exception.php b/src/TinkoffQrCode/src/Services/Exception.php index 6e9d6a5b..cd8dff36 100644 --- a/src/TinkoffQrCode/src/Services/Exception.php +++ b/src/TinkoffQrCode/src/Services/Exception.php @@ -17,72 +17,72 @@ namespace Cashbox\Tinkoff\QrCode\Services; -use Cashbox\Core\Exceptions\External\BankInternalErrorException; -use Cashbox\Core\Exceptions\External\BuyerNotFoundClientException; -use Cashbox\Core\Exceptions\External\CardHasStolenException; -use Cashbox\Core\Exceptions\External\ContactTheSellerClientException; -use Cashbox\Core\Exceptions\External\IncorrectSumException; -use Cashbox\Core\Exceptions\External\InsufficientFundsCardException; -use Cashbox\Core\Exceptions\External\InvalidCardException; -use Cashbox\Core\Exceptions\External\PaymentCompletedException; -use Cashbox\Core\Exceptions\External\PaymentDeclinedException; -use Cashbox\Core\Exceptions\External\PaymentTypeNotAvailableException; -use Cashbox\Core\Exceptions\External\TooManyRequestsException; -use Cashbox\Core\Exceptions\External\TransactionNotFoundException; -use Cashbox\Core\Exceptions\External\TryAgainLaterClientException; +use Cashbox\Core\Exceptions\External\BankInternalErrorHttpException; +use Cashbox\Core\Exceptions\External\BuyerNotFoundHttpException; +use Cashbox\Core\Exceptions\External\CardHasStolenHttpException; +use Cashbox\Core\Exceptions\External\ContactTheSellerHttpException; +use Cashbox\Core\Exceptions\External\IncorrectSumHttpException; +use Cashbox\Core\Exceptions\External\InsufficientFundsCardHttpException; +use Cashbox\Core\Exceptions\External\InvalidCardHttpException; +use Cashbox\Core\Exceptions\External\PaymentCompletedHttpException; +use Cashbox\Core\Exceptions\External\PaymentDeclinedHttpException; +use Cashbox\Core\Exceptions\External\PaymentTypeNotAvailableHttpException; +use Cashbox\Core\Exceptions\External\TooManyRequestsHttpException; +use Cashbox\Core\Exceptions\External\TransactionNotFoundHttpException; +use Cashbox\Core\Exceptions\External\TryAgainLaterClientHttpException; use Cashbox\Core\Services\Exception as BaseException; class Exception extends BaseException { protected array $codes = [ - 7 => BuyerNotFoundClientException::class, - 53 => ContactTheSellerClientException::class, - 99 => PaymentDeclinedException::class, - 100 => TryAgainLaterClientException::class, - 102 => PaymentDeclinedException::class, - 103 => TryAgainLaterClientException::class, - 119 => TooManyRequestsException::class, - 403 => PaymentDeclinedException::class, - 404 => TransactionNotFoundException::class, - 604 => PaymentDeclinedException::class, - 620 => IncorrectSumException::class, - 623 => PaymentCompletedException::class, - 642 => InvalidCardException::class, - 1004 => CardHasStolenException::class, - 1005 => PaymentDeclinedException::class, - 1007 => CardHasStolenException::class, - 1008 => PaymentDeclinedException::class, - 1012 => PaymentDeclinedException::class, - 1013 => TryAgainLaterClientException::class, - 1014 => InvalidCardException::class, - 1015 => TryAgainLaterClientException::class, - 1019 => PaymentDeclinedException::class, - 1030 => TryAgainLaterClientException::class, - 1033 => InvalidCardException::class, - 1034 => TryAgainLaterClientException::class, - 1039 => PaymentDeclinedException::class, - 1041 => CardHasStolenException::class, - 1043 => CardHasStolenException::class, - 1051 => InsufficientFundsCardException::class, - 1053 => PaymentDeclinedException::class, - 1054 => InvalidCardException::class, - 1057 => InvalidCardException::class, - 1058 => InvalidCardException::class, - 1059 => CardHasStolenException::class, - 1061 => InvalidCardException::class, - 1062 => InvalidCardException::class, - 1063 => InvalidCardException::class, - 1064 => IncorrectSumException::class, - 1065 => PaymentDeclinedException::class, - 1076 => PaymentDeclinedException::class, - 1089 => TryAgainLaterClientException::class, - 1091 => TryAgainLaterClientException::class, - 1092 => PaymentDeclinedException::class, - 1093 => CardHasStolenException::class, - 1094 => BankInternalErrorException::class, - 1096 => TryAgainLaterClientException::class, - 3001 => PaymentTypeNotAvailableException::class, - 9999 => BankInternalErrorException::class, + 7 => BuyerNotFoundHttpException::class, + 53 => ContactTheSellerHttpException::class, + 99 => PaymentDeclinedHttpException::class, + 100 => TryAgainLaterClientHttpException::class, + 102 => PaymentDeclinedHttpException::class, + 103 => TryAgainLaterClientHttpException::class, + 119 => TooManyRequestsHttpException::class, + 403 => PaymentDeclinedHttpException::class, + 404 => TransactionNotFoundHttpException::class, + 604 => PaymentDeclinedHttpException::class, + 620 => IncorrectSumHttpException::class, + 623 => PaymentCompletedHttpException::class, + 642 => InvalidCardHttpException::class, + 1004 => CardHasStolenHttpException::class, + 1005 => PaymentDeclinedHttpException::class, + 1007 => CardHasStolenHttpException::class, + 1008 => PaymentDeclinedHttpException::class, + 1012 => PaymentDeclinedHttpException::class, + 1013 => TryAgainLaterClientHttpException::class, + 1014 => InvalidCardHttpException::class, + 1015 => TryAgainLaterClientHttpException::class, + 1019 => PaymentDeclinedHttpException::class, + 1030 => TryAgainLaterClientHttpException::class, + 1033 => InvalidCardHttpException::class, + 1034 => TryAgainLaterClientHttpException::class, + 1039 => PaymentDeclinedHttpException::class, + 1041 => CardHasStolenHttpException::class, + 1043 => CardHasStolenHttpException::class, + 1051 => InsufficientFundsCardHttpException::class, + 1053 => PaymentDeclinedHttpException::class, + 1054 => InvalidCardHttpException::class, + 1057 => InvalidCardHttpException::class, + 1058 => InvalidCardHttpException::class, + 1059 => CardHasStolenHttpException::class, + 1061 => InvalidCardHttpException::class, + 1062 => InvalidCardHttpException::class, + 1063 => InvalidCardHttpException::class, + 1064 => IncorrectSumHttpException::class, + 1065 => PaymentDeclinedHttpException::class, + 1076 => PaymentDeclinedHttpException::class, + 1089 => TryAgainLaterClientHttpException::class, + 1091 => TryAgainLaterClientHttpException::class, + 1092 => PaymentDeclinedHttpException::class, + 1093 => CardHasStolenHttpException::class, + 1094 => BankInternalErrorHttpException::class, + 1096 => TryAgainLaterClientHttpException::class, + 3001 => PaymentTypeNotAvailableHttpException::class, + 9999 => BankInternalErrorHttpException::class, ]; protected array $failedKey = ['Success']; diff --git a/tests/Helpers/auth.php b/tests/Helpers/auth.php index be910852..400d8100 100644 --- a/tests/Helpers/auth.php +++ b/tests/Helpers/auth.php @@ -15,16 +15,16 @@ declare(strict_types=1); -use Cashbox\Sber\Auth\Sign; +use Cashbox\Sber\Auth\Auth; use Tests\Fixtures\App\Models\PaymentModel; use Tests\Fixtures\Payments\SberAuth; use Tests\Fixtures\Requests\SberAuthRequest; -function sberSign(PaymentModel $payment): Sign +function sberAuth(PaymentModel $payment): Auth { $config = $payment->cashboxDriver()->config; - return new Sign( + return new Auth( request: new SberAuthRequest(new SberAuth($payment, $config)), config : $config, extra : [ diff --git a/tests/Unit/Drivers/SberAuth/SignTest.php b/tests/Unit/Drivers/SberAuth/SignTest.php index 5836e82c..9944554d 100644 --- a/tests/Unit/Drivers/SberAuth/SignTest.php +++ b/tests/Unit/Drivers/SberAuth/SignTest.php @@ -22,7 +22,7 @@ $payment = createPayment(TypeEnum::sberQrCode); - $sign = sberSign($payment); + $sign = sberAuth($payment); expect($sign->headers())->toBe([ 'X-IBM-Client-Id' => 'qwerty', diff --git a/tests/Unit/Drivers/TinkoffOnline/CreateTest.php b/tests/Unit/Drivers/TinkoffOnline/CreateTest.php index 061b7688..3a059dc8 100644 --- a/tests/Unit/Drivers/TinkoffOnline/CreateTest.php +++ b/tests/Unit/Drivers/TinkoffOnline/CreateTest.php @@ -20,7 +20,7 @@ use Cashbox\Core\Events\PaymentRefundedEvent; use Cashbox\Core\Events\PaymentSuccessEvent; use Cashbox\Core\Events\PaymentWaitRefundEvent; -use Cashbox\Core\Exceptions\External\BadRequestClientException; +use Cashbox\Core\Exceptions\External\BadRequestHttpException; use Illuminate\Support\Facades\Event; use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; @@ -80,4 +80,4 @@ fakeTinkoffOnlineInvalidHttp(); createPayment(TypeEnum::tinkoffOnline); -})->expectException(BadRequestClientException::class); +})->expectException(BadRequestHttpException::class); diff --git a/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php b/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php index 725b90ab..ee693a7c 100644 --- a/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php +++ b/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php @@ -20,7 +20,7 @@ use Cashbox\Core\Events\PaymentRefundedEvent; use Cashbox\Core\Events\PaymentSuccessEvent; use Cashbox\Core\Events\PaymentWaitRefundEvent; -use Cashbox\Core\Exceptions\External\BadRequestClientException; +use Cashbox\Core\Exceptions\External\BadRequestHttpException; use Illuminate\Support\Facades\Event; use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; @@ -80,4 +80,4 @@ fakeTinkoffQrCodeInvalidHttp(); createPayment(TypeEnum::tinkoffQrCode); -})->expectException(BadRequestClientException::class); +})->expectException(BadRequestHttpException::class); From 0b735c062c2698a3aa6bd224b091c69e28d93740 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 5 Aug 2023 01:55:27 +0300 Subject: [PATCH 140/164] Refactored Template Driver Auth --- composer.json | 2 +- split.json | 5 +- src/Core/src/Data/Signing/Token.php | 3 + .../.editorconfig | 0 .../.gitattributes | 0 .../.github/FUNDING.yml | 0 .../.github/dependabot.yml | 0 .../.github/workflows/close-pull-request.yml | 0 .../.gitignore | 0 .../LICENSE | 0 .../README.md | 0 .../composer.json | 0 .../phpunit.xml | 0 src/TemplateAuth/src/Auth.php | 56 ++++++++++++++ .../src/Constants/Keys.php | 6 +- src/TemplateAuth/src/Services/Hash.php | 71 ++++++++++++++++++ src/TemplateDriverAuth/src/Auth.php | 74 ------------------- .../src/Resources/AccessToken.php | 48 ------------ src/TemplateDriverAuth/src/Support/Hash.php | 73 ------------------ tests/Fixtures/App/Enums/TypeEnum.php | 2 + tests/Fixtures/Drivers/Driver.php | 36 +++++++++ .../{ => Http}/Requests/SberAuthRequest.php | 2 +- .../Http/Requests/TemplateAuthRequest.php | 40 ++++++++++ .../Resources/TemplateAuthResource.php | 34 +++++++++ tests/Helpers/auth.php | 2 +- tests/Helpers/models.php | 4 +- tests/Pest.php | 2 + tests/Unit/Drivers/TemplateAuth/AuthTest.php | 67 +++++++++++++++++ tests/Unit/Drivers/TemplateAuth/HashTest.php | 53 +++++++++++++ .../{HashTest.php => AuthTest.php} | 0 30 files changed, 375 insertions(+), 205 deletions(-) rename src/{TemplateDriverAuth => TemplateAuth}/.editorconfig (100%) rename src/{TemplateDriverAuth => TemplateAuth}/.gitattributes (100%) rename src/{TemplateDriverAuth => TemplateAuth}/.github/FUNDING.yml (100%) rename src/{TemplateDriverAuth => TemplateAuth}/.github/dependabot.yml (100%) rename src/{TemplateDriverAuth => TemplateAuth}/.github/workflows/close-pull-request.yml (100%) rename src/{TemplateDriverAuth => TemplateAuth}/.gitignore (100%) rename src/{TemplateDriverAuth => TemplateAuth}/LICENSE (100%) rename src/{TemplateDriverAuth => TemplateAuth}/README.md (100%) rename src/{TemplateDriverAuth => TemplateAuth}/composer.json (100%) rename src/{TemplateDriverAuth => TemplateAuth}/phpunit.xml (100%) create mode 100644 src/TemplateAuth/src/Auth.php rename src/{TemplateDriverAuth => TemplateAuth}/src/Constants/Keys.php (78%) create mode 100644 src/TemplateAuth/src/Services/Hash.php delete mode 100644 src/TemplateDriverAuth/src/Auth.php delete mode 100644 src/TemplateDriverAuth/src/Resources/AccessToken.php delete mode 100644 src/TemplateDriverAuth/src/Support/Hash.php create mode 100644 tests/Fixtures/Drivers/Driver.php rename tests/Fixtures/{ => Http}/Requests/SberAuthRequest.php (94%) create mode 100644 tests/Fixtures/Http/Requests/TemplateAuthRequest.php create mode 100644 tests/Fixtures/Resources/TemplateAuthResource.php create mode 100644 tests/Unit/Drivers/TemplateAuth/AuthTest.php create mode 100644 tests/Unit/Drivers/TemplateAuth/HashTest.php rename tests/Unit/Drivers/TinkoffAuth/{HashTest.php => AuthTest.php} (100%) diff --git a/composer.json b/composer.json index 176f5cad..49be0e60 100644 --- a/composer.json +++ b/composer.json @@ -92,7 +92,7 @@ "prefer-stable": true, "autoload": { "psr-4": { - "Cashbox\\BankName\\Auth\\": "src/TemplateDriverAuth/src/", + "Cashbox\\BankName\\Auth\\": "src/TemplateAuth/src/", "Cashbox\\BankName\\PaymentType\\": "src/TemplateDriver/src/", "Cashbox\\Cash\\": "src/Cash/src/", "Cashbox\\Core\\": "src/Core/src/", diff --git a/split.json b/split.json index 3adbe659..75f38b8f 100644 --- a/split.json +++ b/split.json @@ -30,7 +30,8 @@ { "name": "sber-qr", "directory": "src/SberQrCode", - "target": "git@github.com:cashbox-laravel/sber-qr.git" + "target": "git@github.com:cashbox-laravel/sber-qr.git", + "release": false }, { "name": "tinkoff-auth", @@ -60,7 +61,7 @@ }, { "name": "driver-auth", - "directory": "src/TemplateDriverAuth", + "directory": "src/TemplateAuth", "target": "git@github.com:cashbox-laravel/driver-auth.git", "release": false } diff --git a/src/Core/src/Data/Signing/Token.php b/src/Core/src/Data/Signing/Token.php index cf025d03..55008e17 100644 --- a/src/Core/src/Data/Signing/Token.php +++ b/src/Core/src/Data/Signing/Token.php @@ -18,8 +18,11 @@ namespace Cashbox\Core\Data\Signing; use DateTimeInterface; +use Spatie\LaravelData\Attributes\MapInputName; use Spatie\LaravelData\Data; +use Spatie\LaravelData\Mappers\SnakeCaseMapper; +#[MapInputName(SnakeCaseMapper::class)] class Token extends Data { public ?string $clientId; diff --git a/src/TemplateDriverAuth/.editorconfig b/src/TemplateAuth/.editorconfig similarity index 100% rename from src/TemplateDriverAuth/.editorconfig rename to src/TemplateAuth/.editorconfig diff --git a/src/TemplateDriverAuth/.gitattributes b/src/TemplateAuth/.gitattributes similarity index 100% rename from src/TemplateDriverAuth/.gitattributes rename to src/TemplateAuth/.gitattributes diff --git a/src/TemplateDriverAuth/.github/FUNDING.yml b/src/TemplateAuth/.github/FUNDING.yml similarity index 100% rename from src/TemplateDriverAuth/.github/FUNDING.yml rename to src/TemplateAuth/.github/FUNDING.yml diff --git a/src/TemplateDriverAuth/.github/dependabot.yml b/src/TemplateAuth/.github/dependabot.yml similarity index 100% rename from src/TemplateDriverAuth/.github/dependabot.yml rename to src/TemplateAuth/.github/dependabot.yml diff --git a/src/TemplateDriverAuth/.github/workflows/close-pull-request.yml b/src/TemplateAuth/.github/workflows/close-pull-request.yml similarity index 100% rename from src/TemplateDriverAuth/.github/workflows/close-pull-request.yml rename to src/TemplateAuth/.github/workflows/close-pull-request.yml diff --git a/src/TemplateDriverAuth/.gitignore b/src/TemplateAuth/.gitignore similarity index 100% rename from src/TemplateDriverAuth/.gitignore rename to src/TemplateAuth/.gitignore diff --git a/src/TemplateDriverAuth/LICENSE b/src/TemplateAuth/LICENSE similarity index 100% rename from src/TemplateDriverAuth/LICENSE rename to src/TemplateAuth/LICENSE diff --git a/src/TemplateDriverAuth/README.md b/src/TemplateAuth/README.md similarity index 100% rename from src/TemplateDriverAuth/README.md rename to src/TemplateAuth/README.md diff --git a/src/TemplateDriverAuth/composer.json b/src/TemplateAuth/composer.json similarity index 100% rename from src/TemplateDriverAuth/composer.json rename to src/TemplateAuth/composer.json diff --git a/src/TemplateDriverAuth/phpunit.xml b/src/TemplateAuth/phpunit.xml similarity index 100% rename from src/TemplateDriverAuth/phpunit.xml rename to src/TemplateAuth/phpunit.xml diff --git a/src/TemplateAuth/src/Auth.php b/src/TemplateAuth/src/Auth.php new file mode 100644 index 00000000..b3cfec5d --- /dev/null +++ b/src/TemplateAuth/src/Auth.php @@ -0,0 +1,56 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\BankName\Auth; + +use Cashbox\BankName\Auth\Constants\Keys; +use Cashbox\BankName\Auth\Services\Hash; +use Cashbox\Core\Data\Signing\Token; +use Cashbox\Core\Services\Auth as BaseSign; + +class Auth extends BaseSign +{ + public function body(): array + { + $token = $this->token(); + + return array_merge($this->request->body(), [ + Keys::TERMINAL => $token->clientId, + Keys::TOKEN => $token->clientSecret, + ]); + } + + protected function token(): Token + { + return Hash::get( + $this->clientId(), + $this->clientSecret(), + $this->request->body(), + $this->secure + ); + } + + protected function clientId(): string + { + return $this->config->credentials->clientId; + } + + protected function clientSecret(): string + { + return $this->config->credentials->clientSecret; + } +} diff --git a/src/TemplateDriverAuth/src/Constants/Keys.php b/src/TemplateAuth/src/Constants/Keys.php similarity index 78% rename from src/TemplateDriverAuth/src/Constants/Keys.php rename to src/TemplateAuth/src/Constants/Keys.php index 9035e835..3ce5b142 100644 --- a/src/TemplateDriverAuth/src/Constants/Keys.php +++ b/src/TemplateAuth/src/Constants/Keys.php @@ -19,7 +19,7 @@ class Keys { - public const TERMINAL = 'TerminalKey'; - public const TOKEN = 'Token'; - public const PASSWORD = 'Password'; + public const PASSWORD = 'password'; + public const TERMINAL = 'terminalId'; + public const TOKEN = 'token'; } diff --git a/src/TemplateAuth/src/Services/Hash.php b/src/TemplateAuth/src/Services/Hash.php new file mode 100644 index 00000000..1fb300bc --- /dev/null +++ b/src/TemplateAuth/src/Services/Hash.php @@ -0,0 +1,71 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\BankName\Auth\Services; + +use Carbon\Carbon; +use Cashbox\BankName\Auth\Constants\Keys; +use Cashbox\Core\Data\Signing\Token; +use DateTimeInterface; +use DragonCode\Support\Facades\Helpers\Arr; + +class Hash +{ + public static function get(string $clientId, string $clientSecret, array $data, bool $hash): Token + { + return $hash + ? static::hashed($clientId, $clientSecret, $data) + : static::basic($clientId, $clientSecret); + } + + protected static function basic(string $clientId, string $clientSecret): Token + { + return static::data($clientId, $clientSecret); + } + + protected static function hashed(string $clientId, string $clientSecret, array $data): Token + { + $hash = static::make($clientId, $clientSecret, $data); + + return static::data($clientId, $hash); + } + + protected static function make(string $clientId, string $clientSecret, array $data): string + { + $items = static::resolve($clientId, $clientSecret, $data); + + return hash('sha256', $items); + } + + protected static function resolve(string $clientId, string $clientSecret, array $data): string + { + return Arr::of($data) + ->set(Keys::TERMINAL, $clientId) + ->set(Keys::PASSWORD, $clientSecret) + ->ksort() + ->values() + ->implode('') + ->toString(); + } + + protected static function data(string $clientId, string $clientSecret, ?DateTimeInterface $expiresIn = null): Token + { + $expiresIn ??= Carbon::now()->addDay(); + + return Token::from(compact('clientId', 'clientSecret', 'expiresIn')); + } +} diff --git a/src/TemplateDriverAuth/src/Auth.php b/src/TemplateDriverAuth/src/Auth.php deleted file mode 100644 index 6028bc3f..00000000 --- a/src/TemplateDriverAuth/src/Auth.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\BankName\Auth; - -use Cashbox\BankName\Auth\Constants\Keys; -use Cashbox\BankName\Auth\Resources\AccessToken; -use Cashbox\BankName\Auth\Support\Hash; -use DragonCode\Contracts\Cashier\Auth\Auth as AuthContract; -use DragonCode\Contracts\Cashier\Http\Request; -use DragonCode\Contracts\Cashier\Resources\Model; -use DragonCode\Support\Concerns\Makeable; - -/** @method static Auth make(Model $model, Request $request, bool $hash = true) */ -class Auth implements AuthContract -{ - use Makeable; - - /** @var \DragonCode\Contracts\Cashier\Resources\Model */ - protected $model; - - /** @var \DragonCode\Contracts\Cashier\Http\Request */ - protected $request; - - /** @var bool */ - protected $hash; - - public function __construct(Model $model, Request $request, bool $hash = true, array $extra = []) - { - $this->model = $model; - $this->request = $request; - $this->hash = $hash; - } - - public function headers(): array - { - return $this->request->getRawHeaders(); - } - - public function body(): array - { - $token = $this->getAccessToken(); - - return array_merge($this->request->getRawBody(), [ - Keys::TERMINAL => $token->getClientId(), - Keys::TOKEN => $token->getAccessToken(), - ]); - } - - public function refresh(): void {} - - protected function getAccessToken(): AccessToken - { - return Hash::make()->get( - $this->model, - $this->request->getRawBody(), - $this->hash - ); - } -} diff --git a/src/TemplateDriverAuth/src/Resources/AccessToken.php b/src/TemplateDriverAuth/src/Resources/AccessToken.php deleted file mode 100644 index 5a8ebba4..00000000 --- a/src/TemplateDriverAuth/src/Resources/AccessToken.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -namespace Cashbox\BankName\Auth\Resources; - -use Cashbox\BankName\Auth\Constants\Keys; -use DragonCode\Contracts\Cashier\Resources\AccessToken as AccessTokenContract; -use DragonCode\SimpleDataTransferObject\DataTransferObject; -use Illuminate\Support\Carbon; - -class AccessToken extends DataTransferObject implements AccessTokenContract -{ - protected $client_id; - - protected $access_token; - - protected $map = [ - Keys::TERMINAL => 'client_id', - Keys::TOKEN => 'access_token', - ]; - - public function getClientId(): string - { - return $this->client_id; - } - - public function getAccessToken(): string - { - return $this->access_token; - } - - public function getExpiresIn(): Carbon - { - return Carbon::now()->addDay(); - } -} diff --git a/src/TemplateDriverAuth/src/Support/Hash.php b/src/TemplateDriverAuth/src/Support/Hash.php deleted file mode 100644 index 8c9038d8..00000000 --- a/src/TemplateDriverAuth/src/Support/Hash.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -namespace Cashbox\BankName\Auth\Support; - -use Cashbox\BankName\Auth\Constants\Keys; -use Cashbox\BankName\Auth\Resources\AccessToken; -use DragonCode\Contracts\Cashier\Resources\Model; -use DragonCode\Support\Concerns\Makeable; -use DragonCode\Support\Facades\Helpers\Ables\Arrayable; - -class Hash -{ - use Makeable; - - public function get(Model $model, array $data, bool $hash = true): AccessToken - { - return $this->makeToken($model->getClientId(), $model->getClientSecret(), $data, $hash); - } - - protected function makeToken(string $client_id, string $secret, array $data, bool $hash): AccessToken - { - return $hash - ? $this->hashed($client_id, $secret, $data) - : $this->basic($client_id, $secret); - } - - protected function basic(string $client_id, string $secret): AccessToken - { - return $this->items($client_id, $secret); - } - - protected function hashed(string $client_id, string $secret, array $data): AccessToken - { - $hash = $this->hash($client_id, $secret, $data); - - return $this->items($client_id, $hash); - } - - protected function hash(string $client_id, string $secret, array $data): string - { - $items = $this->prepare($client_id, $secret, $data); - - return hash('sha256', implode('', $items)); - } - - protected function prepare(string $client_id, string $secret, array $data): array - { - return Arrayable::of($data) - ->set(Keys::TERMINAL, $client_id) - ->set(Keys::PASSWORD, $secret) - ->ksort() - ->values() - ->get(); - } - - protected function items(string $client_id, string $access_token): AccessToken - { - return AccessToken::make(compact('client_id', 'access_token')); - } -} diff --git a/tests/Fixtures/App/Enums/TypeEnum.php b/tests/Fixtures/App/Enums/TypeEnum.php index 5bbbf4b4..94cce876 100644 --- a/tests/Fixtures/App/Enums/TypeEnum.php +++ b/tests/Fixtures/App/Enums/TypeEnum.php @@ -26,6 +26,7 @@ * @method static string tinkoffOnline() * @method static string tinkoffQrCode() * @method static string sberQrCode() + * @method static string templateAuth() */ enum TypeEnum: string { @@ -37,4 +38,5 @@ enum TypeEnum: string case tinkoffOnline = 'tinkoff_online'; case tinkoffQrCode = 'tinkoff_qr'; case sberQrCode = 'sber_qr'; + case templateAuth = 'template_auth'; } diff --git a/tests/Fixtures/Drivers/Driver.php b/tests/Fixtures/Drivers/Driver.php new file mode 100644 index 00000000..57ae2415 --- /dev/null +++ b/tests/Fixtures/Drivers/Driver.php @@ -0,0 +1,36 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Tests\Fixtures\Drivers; + +use Cashbox\Core\Http\Response; +use Cashbox\Core\Services\Driver as BaseDriver; + +class Driver extends BaseDriver +{ + protected string $statuses = 'foo'; + + protected string $exception = 'foo'; + + protected string $response = 'foo'; + + public function refund(): Response {} + + public function start(): Response {} + + public function verify(): Response {} +} diff --git a/tests/Fixtures/Requests/SberAuthRequest.php b/tests/Fixtures/Http/Requests/SberAuthRequest.php similarity index 94% rename from tests/Fixtures/Requests/SberAuthRequest.php rename to tests/Fixtures/Http/Requests/SberAuthRequest.php index 8fc2d2e2..e12bf326 100644 --- a/tests/Fixtures/Requests/SberAuthRequest.php +++ b/tests/Fixtures/Http/Requests/SberAuthRequest.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Tests\Fixtures\Requests; +namespace Tests\Fixtures\Http\Requests; use Cashbox\Core\Http\Request; diff --git a/tests/Fixtures/Http/Requests/TemplateAuthRequest.php b/tests/Fixtures/Http/Requests/TemplateAuthRequest.php new file mode 100644 index 00000000..349aa706 --- /dev/null +++ b/tests/Fixtures/Http/Requests/TemplateAuthRequest.php @@ -0,0 +1,40 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Tests\Fixtures\Http\Requests; + +use Cashbox\BankName\Auth\Auth as TemplateAuth; +use Cashbox\Core\Http\Request as BaseRequest; +use Cashbox\Core\Services\Auth; + +class TemplateAuthRequest extends BaseRequest +{ + protected string $productionHost = 'https://example.com'; + + protected string $productionUri = '/foo'; + + protected Auth|string|null $auth = TemplateAuth::class; + + public function body(): array + { + return [ + 'paymentId' => $this->resource->paymentId(), + 'sum' => $this->resource->sum(), + 'currency' => $this->resource->currency(), + ]; + } +} diff --git a/tests/Fixtures/Resources/TemplateAuthResource.php b/tests/Fixtures/Resources/TemplateAuthResource.php new file mode 100644 index 00000000..a642830e --- /dev/null +++ b/tests/Fixtures/Resources/TemplateAuthResource.php @@ -0,0 +1,34 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Tests\Fixtures\Resources; + +use Cashbox\Core\Enums\CurrencyEnum; +use Cashbox\Core\Resources\Resource as BaseResource; + +class TemplateAuthResource extends BaseResource +{ + public function currency(): int + { + return CurrencyEnum::USD->value; + } + + public function sum(): int + { + return $this->payment->price; + } +} diff --git a/tests/Helpers/auth.php b/tests/Helpers/auth.php index 400d8100..099c614d 100644 --- a/tests/Helpers/auth.php +++ b/tests/Helpers/auth.php @@ -17,8 +17,8 @@ use Cashbox\Sber\Auth\Auth; use Tests\Fixtures\App\Models\PaymentModel; +use Tests\Fixtures\Http\Requests\SberAuthRequest; use Tests\Fixtures\Payments\SberAuth; -use Tests\Fixtures\Requests\SberAuthRequest; function sberAuth(PaymentModel $payment): Auth { diff --git a/tests/Helpers/models.php b/tests/Helpers/models.php index 93d45f9d..78191c7a 100644 --- a/tests/Helpers/models.php +++ b/tests/Helpers/models.php @@ -20,9 +20,9 @@ use Tests\Fixtures\App\Enums\TypeEnum; use Tests\Fixtures\App\Models\PaymentModel; -function createPayment(TypeEnum $type): PaymentModel +function createPayment(TypeEnum $type, ?int $price = null): PaymentModel { - return PaymentModel::factory()->create(compact('type')); + return PaymentModel::factory()->create(compact('type', 'price')); } function subHour(Model ...$payments): void diff --git a/tests/Pest.php b/tests/Pest.php index 09c46308..02c6e555 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -38,6 +38,8 @@ uses(TestCase::class)->group('sber-auth')->in('Unit/Drivers/SberAuth'); +uses(TestCase::class)->group('template-auth')->in('Unit/Drivers/TemplateAuth'); + /* |-------------------------------------------------------------------------- | Functions diff --git a/tests/Unit/Drivers/TemplateAuth/AuthTest.php b/tests/Unit/Drivers/TemplateAuth/AuthTest.php new file mode 100644 index 00000000..660f06fd --- /dev/null +++ b/tests/Unit/Drivers/TemplateAuth/AuthTest.php @@ -0,0 +1,67 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Cashbox\BankName\Auth\Auth; +use Cashbox\BankName\Auth\Constants\Keys; +use Cashbox\Core\Data\Config\DriverData; +use Cashbox\Core\Data\Config\Drivers\CredentialsData; +use Cashbox\Core\Enums\CurrencyEnum; +use Tests\Fixtures\App\Enums\TypeEnum; +use Tests\Fixtures\Drivers\Driver; +use Tests\Fixtures\Http\Requests\TemplateAuthRequest; +use Tests\Fixtures\Resources\TemplateAuthResource; + +it('checks the authorization instance', function () { + fakeEvents(); + + $payment = createPayment(TypeEnum::templateAuth, 1234); + + $config = DriverData::from([ + 'driver' => Driver::class, + 'resource' => TemplateAuthResource::class, + 'credentials' => CredentialsData::from([ + 'clientId' => 'qwerty', + 'clientSecret' => 'qwerty123', + ]), + ]); + + $request = new TemplateAuthRequest( + new TemplateAuthResource($payment, $config) + ); + + expect($request->headers())->toBeEmpty(); + expect($request->options())->toBeEmpty(); + + expect($request->sign()->headers())->toBeEmpty(); + expect($request->sign()->options())->toBeEmpty(); + + expect($request->sign())->toBeInstanceOf(Auth::class); + + expect($request->body())->toBe([ + 'paymentId' => (string) $payment->id, + 'sum' => $payment->price, + 'currency' => CurrencyEnum::USD->value, + ]); + + expect($request->sign()->body())->toBe([ + 'paymentId' => (string) $payment->id, + 'sum' => $payment->price, + 'currency' => CurrencyEnum::USD->value, + Keys::TERMINAL => 'qwerty', + Keys::TOKEN => '57f7acb468d49f49dcaf10c0b193ef8303c84ce5fb35c40b53fea58ed877cb4f', + ]); +}); diff --git a/tests/Unit/Drivers/TemplateAuth/HashTest.php b/tests/Unit/Drivers/TemplateAuth/HashTest.php new file mode 100644 index 00000000..01dbb754 --- /dev/null +++ b/tests/Unit/Drivers/TemplateAuth/HashTest.php @@ -0,0 +1,53 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Carbon\Carbon; +use Cashbox\BankName\Auth\Services\Hash; + +it('basic data', function () { + $clientId = 'foo'; + $clientSecret = 'bar'; + + $hashed = Hash::get($clientId, $clientSecret, [ + 'field1' => 'qwe', + 'field2' => 'rty', + 'field3' => 'asd', + ], false); + + expect($hashed->clientId)->toBe($clientId); + expect($hashed->clientSecret)->toBe($clientSecret); + expect($hashed->expiresIn->toIso8601String())->toBe(Carbon::now()->addDay()->toIso8601String()); +}); + +it('hashed data', function (array $data) { + $clientId = 'foo'; + $clientSecret = 'bar'; + $hash = '7959ae1ec20a02490d8d2f01d3704a2543e70c43cbe0c672209741263ef8048f'; + + $hashed = Hash::get($clientId, $clientSecret, $data, true); + + expect($hashed->clientId)->toBe($clientId); + expect($hashed->clientSecret)->toBe($hash); + expect($hashed->expiresIn->toIso8601String())->toBe(Carbon::now()->addDay()->toIso8601String()); +})->with([ + [['field1' => 'qwe', 'field2' => 'rty', 'field3' => 'asd']], + [['field1' => 'qwe', 'field3' => 'asd', 'field2' => 'rty']], + [['field2' => 'rty', 'field1' => 'qwe', 'field3' => 'asd']], + [['field2' => 'rty', 'field3' => 'asd', 'field1' => 'qwe']], + [['field3' => 'asd', 'field1' => 'qwe', 'field2' => 'rty']], + [['field3' => 'asd', 'field2' => 'rty', 'field1' => 'qwe']], +]); diff --git a/tests/Unit/Drivers/TinkoffAuth/HashTest.php b/tests/Unit/Drivers/TinkoffAuth/AuthTest.php similarity index 100% rename from tests/Unit/Drivers/TinkoffAuth/HashTest.php rename to tests/Unit/Drivers/TinkoffAuth/AuthTest.php From 86dd7f85499b30ca1991e8e3306630af096ae58f Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 5 Aug 2023 01:58:25 +0300 Subject: [PATCH 141/164] Fixed tests --- tests/Helpers/models.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Helpers/models.php b/tests/Helpers/models.php index 78191c7a..c8176701 100644 --- a/tests/Helpers/models.php +++ b/tests/Helpers/models.php @@ -22,6 +22,8 @@ function createPayment(TypeEnum $type, ?int $price = null): PaymentModel { + $price ??= fake()->randomNumber(4); + return PaymentModel::factory()->create(compact('type', 'price')); } From abc1e99ea9923546b7efa0519ff7e2aec6eec2f4 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 5 Aug 2023 13:44:45 +0300 Subject: [PATCH 142/164] Updated test --- tests/Unit/Drivers/TemplateAuth/HashTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Unit/Drivers/TemplateAuth/HashTest.php b/tests/Unit/Drivers/TemplateAuth/HashTest.php index 01dbb754..a69e8324 100644 --- a/tests/Unit/Drivers/TemplateAuth/HashTest.php +++ b/tests/Unit/Drivers/TemplateAuth/HashTest.php @@ -30,7 +30,7 @@ expect($hashed->clientId)->toBe($clientId); expect($hashed->clientSecret)->toBe($clientSecret); - expect($hashed->expiresIn->toIso8601String())->toBe(Carbon::now()->addDay()->toIso8601String()); + expect($hashed->expiresIn->timestamp)->toBe(Carbon::now()->addDay()->timestamp); }); it('hashed data', function (array $data) { @@ -42,7 +42,7 @@ expect($hashed->clientId)->toBe($clientId); expect($hashed->clientSecret)->toBe($hash); - expect($hashed->expiresIn->toIso8601String())->toBe(Carbon::now()->addDay()->toIso8601String()); + expect($hashed->expiresIn->timestamp)->toBe(Carbon::now()->addDay()->timestamp); })->with([ [['field1' => 'qwe', 'field2' => 'rty', 'field3' => 'asd']], [['field1' => 'qwe', 'field3' => 'asd', 'field2' => 'rty']], From 19944f460d4652dda4c3bef377d1e79546789789 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 5 Aug 2023 23:30:39 +0300 Subject: [PATCH 143/164] Test was divided --- tests/Helpers/data.php | 16 +++++++++ tests/Unit/Core/Facades/ConfigTest.php | 32 ++++++++--------- tests/Unit/Drivers/TemplateAuth/AuthTest.php | 36 +++++++++++--------- 3 files changed, 51 insertions(+), 33 deletions(-) diff --git a/tests/Helpers/data.php b/tests/Helpers/data.php index bd5d1ed0..6161ab0a 100644 --- a/tests/Helpers/data.php +++ b/tests/Helpers/data.php @@ -15,8 +15,12 @@ declare(strict_types=1); +use Cashbox\Core\Data\Config\DriverData; +use Cashbox\Core\Data\Config\Drivers\CredentialsData; use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Support\DataProperty; +use Tests\Fixtures\Drivers\Driver; +use Tests\Fixtures\Resources\TemplateAuthResource; function dataCast(Cast|string $cast, mixed $value, ?DataProperty $property = null, array $context = []): mixed { @@ -26,3 +30,15 @@ function dataCast(Cast|string $cast, mixed $value, ?DataProperty $property = nul return $cast->cast($property, $value, $context); } + +function driverData(): DriverData +{ + return DriverData::from([ + 'driver' => Driver::class, + 'resource' => TemplateAuthResource::class, + 'credentials' => CredentialsData::from([ + 'clientId' => 'qwerty', + 'clientSecret' => 'qwerty123', + ]), + ]); +} diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 1648f059..5e628a74 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -167,34 +167,34 @@ function (array $main, array $driver, array $expected) { expect($item->getQueue()->refund)->toBe($expected['refund']); } )->with([ - 'filled' => [ - driverData('q1', 'q2', 'q3'), - driverData('q4', 'q5', 'q6'), - driverData('q4', 'q5', 'q6'), + 'filled' => [ + queueData('q1', 'q2', 'q3'), + queueData('q4', 'q5', 'q6'), + queueData('q4', 'q5', 'q6'), ], - 'partial' => [ - driverData('q1', 'q2', 'q3'), - driverData('q4', null, null), - driverData('q4', null, null), + 'partial' => [ + queueData('q1', 'q2', 'q3'), + queueData('q4', null, null), + queueData('q4', null, null), ], 'driver empty' => [ - driverData('q1', 'q2', 'q3'), + queueData('q1', 'q2', 'q3'), [], - driverData(null, null, null), + queueData(null, null, null), ], - 'main empty' => [ + 'main empty' => [ [], - driverData('q4', 'q5', 'q6'), - driverData('q4', 'q5', 'q6'), + queueData('q4', 'q5', 'q6'), + queueData('q4', 'q5', 'q6'), ], - 'full empty' => [ + 'full empty' => [ [], [], - driverData(null, null, null), + queueData(null, null, null), ], ]); -function driverData(?string $start, ?string $verify, ?string $refund): array +function queueData(?string $start, ?string $verify, ?string $refund): array { return compact('start', 'verify', 'refund'); } diff --git a/tests/Unit/Drivers/TemplateAuth/AuthTest.php b/tests/Unit/Drivers/TemplateAuth/AuthTest.php index 660f06fd..22eef5a6 100644 --- a/tests/Unit/Drivers/TemplateAuth/AuthTest.php +++ b/tests/Unit/Drivers/TemplateAuth/AuthTest.php @@ -17,27 +17,17 @@ use Cashbox\BankName\Auth\Auth; use Cashbox\BankName\Auth\Constants\Keys; -use Cashbox\Core\Data\Config\DriverData; -use Cashbox\Core\Data\Config\Drivers\CredentialsData; use Cashbox\Core\Enums\CurrencyEnum; use Tests\Fixtures\App\Enums\TypeEnum; -use Tests\Fixtures\Drivers\Driver; use Tests\Fixtures\Http\Requests\TemplateAuthRequest; use Tests\Fixtures\Resources\TemplateAuthResource; -it('checks the authorization instance', function () { +it('clean data', function () { fakeEvents(); $payment = createPayment(TypeEnum::templateAuth, 1234); - $config = DriverData::from([ - 'driver' => Driver::class, - 'resource' => TemplateAuthResource::class, - 'credentials' => CredentialsData::from([ - 'clientId' => 'qwerty', - 'clientSecret' => 'qwerty123', - ]), - ]); + $config = driverData(); $request = new TemplateAuthRequest( new TemplateAuthResource($payment, $config) @@ -46,16 +36,28 @@ expect($request->headers())->toBeEmpty(); expect($request->options())->toBeEmpty(); - expect($request->sign()->headers())->toBeEmpty(); - expect($request->sign()->options())->toBeEmpty(); - - expect($request->sign())->toBeInstanceOf(Auth::class); - expect($request->body())->toBe([ 'paymentId' => (string) $payment->id, 'sum' => $payment->price, 'currency' => CurrencyEnum::USD->value, ]); +}); + +it('signed data', function () { + fakeEvents(); + + $payment = createPayment(TypeEnum::templateAuth, 1234); + + $config = driverData(); + + $request = new TemplateAuthRequest( + new TemplateAuthResource($payment, $config) + ); + + expect($request->sign()->headers())->toBeEmpty(); + expect($request->sign()->options())->toBeEmpty(); + + expect($request->sign())->toBeInstanceOf(Auth::class); expect($request->sign()->body())->toBe([ 'paymentId' => (string) $payment->id, From ee204295cc5b9907f9bb47bffdd2c97a53838f7f Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 6 Aug 2023 00:19:39 +0300 Subject: [PATCH 144/164] [WIP] Template Driver --- src/SberOnline/composer.json | 2 +- src/SberOnline/src/Driver.php | 22 ++-- src/SberOnline/src/Exceptions/Manager.php | 2 +- src/SberOnline/src/Helpers/Statuses.php | 2 +- src/SberOnline/src/Requests/BaseRequest.php | 2 +- src/SberOnline/src/Requests/Cancel.php | 2 +- src/SberOnline/src/Requests/GetState.php | 2 +- src/SberOnline/src/Requests/Init.php | 2 +- src/SberOnline/src/Resources/Details.php | 2 +- src/SberOnline/src/Responses/Created.php | 2 +- src/SberOnline/src/Responses/Refund.php | 2 +- src/SberOnline/src/Responses/State.php | 2 +- src/TemplateDriver/src/Driver.php | 41 +++---- src/TemplateDriver/src/Exceptions/Manager.php | 86 -------------- src/TemplateDriver/src/Helpers/Statuses.php | 43 ------- .../src/Http/Requests/BaseRequest.php | 43 +++++++ .../Requests/CancelRequest.php} | 15 +-- .../src/Http/Requests/CreateRequest.php | 41 +++++++ .../Requests/GetStateRequest.php} | 10 +- .../src/Http/Responses/Response.php | 51 ++++++++ .../src/Requests/BaseRequest.php | 58 --------- src/TemplateDriver/src/Requests/Init.php | 40 ------- src/TemplateDriver/src/Resources/Details.php | 38 ------ .../TemplateDriverResource.php} | 15 ++- src/TemplateDriver/src/Responses/Refund.php | 29 ----- src/TemplateDriver/src/Services/Exception.php | 34 ++++++ src/TemplateDriver/src/Services/Statuses.php | 29 +++++ tests/Fixtures/App/Enums/TypeEnum.php | 16 +-- .../Fixtures/Payments/TemplateDriver.php | 20 ++-- tests/Helpers/Http/Tinkoff/template.php | 71 +++++++++++ tests/Helpers/data.php | 16 --- tests/Pest.php | 1 + tests/TestCase.php | 23 +++- tests/Unit/Drivers/TemplateAuth/AuthTest.php | 8 +- .../Drivers/TemplateDriver/CreateTest.php | 110 ++++++++++++++++++ .../Drivers/TemplateDriver/RefundTest.php | 92 +++++++++++++++ .../Drivers/TemplateDriver/VerifyTest.php | 67 +++++++++++ 37 files changed, 638 insertions(+), 403 deletions(-) delete mode 100644 src/TemplateDriver/src/Exceptions/Manager.php delete mode 100644 src/TemplateDriver/src/Helpers/Statuses.php create mode 100644 src/TemplateDriver/src/Http/Requests/BaseRequest.php rename src/TemplateDriver/src/{Requests/Cancel.php => Http/Requests/CancelRequest.php} (57%) create mode 100644 src/TemplateDriver/src/Http/Requests/CreateRequest.php rename src/TemplateDriver/src/{Requests/GetState.php => Http/Requests/GetStateRequest.php} (61%) create mode 100644 src/TemplateDriver/src/Http/Responses/Response.php delete mode 100644 src/TemplateDriver/src/Requests/BaseRequest.php delete mode 100644 src/TemplateDriver/src/Requests/Init.php delete mode 100644 src/TemplateDriver/src/Resources/Details.php rename src/TemplateDriver/src/{Responses/Created.php => Resources/TemplateDriverResource.php} (58%) delete mode 100644 src/TemplateDriver/src/Responses/Refund.php create mode 100644 src/TemplateDriver/src/Services/Exception.php create mode 100644 src/TemplateDriver/src/Services/Statuses.php rename src/TemplateDriver/src/Responses/State.php => tests/Fixtures/Payments/TemplateDriver.php (52%) create mode 100644 tests/Helpers/Http/Tinkoff/template.php create mode 100644 tests/Unit/Drivers/TemplateDriver/CreateTest.php create mode 100644 tests/Unit/Drivers/TemplateDriver/RefundTest.php create mode 100644 tests/Unit/Drivers/TemplateDriver/VerifyTest.php diff --git a/src/SberOnline/composer.json b/src/SberOnline/composer.json index f209d795..4ed532a9 100644 --- a/src/SberOnline/composer.json +++ b/src/SberOnline/composer.json @@ -48,7 +48,7 @@ "prefer-stable": true, "autoload": { "psr-4": { - "Cashbox\\BankName\\Technology\\": "src/" + "Cashbox\\Sber\\Online\\": "src/" } }, "config": { diff --git a/src/SberOnline/src/Driver.php b/src/SberOnline/src/Driver.php index c6db187d..44343b8c 100644 --- a/src/SberOnline/src/Driver.php +++ b/src/SberOnline/src/Driver.php @@ -13,17 +13,17 @@ * @see https://cashbox.city */ -namespace Cashbox\BankName\Technology; - -use Cashbox\BankName\Technology\Exceptions\Manager; -use Cashbox\BankName\Technology\Helpers\Statuses; -use Cashbox\BankName\Technology\Requests\Cancel; -use Cashbox\BankName\Technology\Requests\GetState; -use Cashbox\BankName\Technology\Requests\Init; -use Cashbox\BankName\Technology\Resources\Details; -use Cashbox\BankName\Technology\Responses\Created; -use Cashbox\BankName\Technology\Responses\Refund; -use Cashbox\BankName\Technology\Responses\State; +namespace Cashbox\Sber\Online; + +use Cashbox\Sber\Online\Exceptions\Manager; +use Cashbox\Sber\Online\Helpers\Statuses; +use Cashbox\Sber\Online\Requests\Cancel; +use Cashbox\Sber\Online\Requests\GetState; +use Cashbox\Sber\Online\Requests\Init; +use Cashbox\Sber\Online\Resources\Details; +use Cashbox\Sber\Online\Responses\Created; +use Cashbox\Sber\Online\Responses\Refund; +use Cashbox\Sber\Online\Responses\State; use Cashbox\Core\Services\Driver as BaseDriver; use DragonCode\Contracts\Cashier\Http\Response; diff --git a/src/SberOnline/src/Exceptions/Manager.php b/src/SberOnline/src/Exceptions/Manager.php index 87960223..5342a5f8 100644 --- a/src/SberOnline/src/Exceptions/Manager.php +++ b/src/SberOnline/src/Exceptions/Manager.php @@ -13,7 +13,7 @@ * @see https://cashbox.city */ -namespace Cashbox\BankName\Technology\Exceptions; +namespace Cashbox\Sber\Online\Exceptions; use Cashbox\Core\Exceptions\Http\BankInternalErrorException; use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; diff --git a/src/SberOnline/src/Helpers/Statuses.php b/src/SberOnline/src/Helpers/Statuses.php index 4d238082..f8aac751 100644 --- a/src/SberOnline/src/Helpers/Statuses.php +++ b/src/SberOnline/src/Helpers/Statuses.php @@ -13,7 +13,7 @@ * @see https://cashbox.city */ -namespace Cashbox\BankName\Technology\Helpers; +namespace Cashbox\Sber\Online\Helpers; use Cashbox\Core\Services\Statuses as BaseStatus; diff --git a/src/SberOnline/src/Requests/BaseRequest.php b/src/SberOnline/src/Requests/BaseRequest.php index 4be82187..23e35979 100644 --- a/src/SberOnline/src/Requests/BaseRequest.php +++ b/src/SberOnline/src/Requests/BaseRequest.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Cashbox\BankName\Technology\Requests; +namespace Cashbox\Sber\Online\Requests; use Cashbox\BankName\Auth\Auth; use Cashbox\Core\Facades\Config\Main; diff --git a/src/SberOnline/src/Requests/Cancel.php b/src/SberOnline/src/Requests/Cancel.php index e2b8fbc2..9ca6a28c 100644 --- a/src/SberOnline/src/Requests/Cancel.php +++ b/src/SberOnline/src/Requests/Cancel.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Cashbox\BankName\Technology\Requests; +namespace Cashbox\Sber\Online\Requests; class Cancel extends BaseRequest { diff --git a/src/SberOnline/src/Requests/GetState.php b/src/SberOnline/src/Requests/GetState.php index ba75ad81..a25a66fb 100644 --- a/src/SberOnline/src/Requests/GetState.php +++ b/src/SberOnline/src/Requests/GetState.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Cashbox\BankName\Technology\Requests; +namespace Cashbox\Sber\Online\Requests; class GetState extends BaseRequest { diff --git a/src/SberOnline/src/Requests/Init.php b/src/SberOnline/src/Requests/Init.php index ec6fb402..bcbefe65 100644 --- a/src/SberOnline/src/Requests/Init.php +++ b/src/SberOnline/src/Requests/Init.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Cashbox\BankName\Technology\Requests; +namespace Cashbox\Sber\Online\Requests; class Init extends BaseRequest { diff --git a/src/SberOnline/src/Resources/Details.php b/src/SberOnline/src/Resources/Details.php index 64e8830d..377cc644 100644 --- a/src/SberOnline/src/Resources/Details.php +++ b/src/SberOnline/src/Resources/Details.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Cashbox\BankName\Technology\Resources; +namespace Cashbox\Sber\Online\Resources; use Cashbox\Core\Resources\Details as BaseDetails; diff --git a/src/SberOnline/src/Responses/Created.php b/src/SberOnline/src/Responses/Created.php index 097dd78b..ba293641 100644 --- a/src/SberOnline/src/Responses/Created.php +++ b/src/SberOnline/src/Responses/Created.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Cashbox\BankName\Technology\Responses; +namespace Cashbox\Sber\Online\Responses; use Cashbox\Core\Http\Response; diff --git a/src/SberOnline/src/Responses/Refund.php b/src/SberOnline/src/Responses/Refund.php index f83a10e9..858c5a41 100644 --- a/src/SberOnline/src/Responses/Refund.php +++ b/src/SberOnline/src/Responses/Refund.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Cashbox\BankName\Technology\Responses; +namespace Cashbox\Sber\Online\Responses; use Cashbox\Core\Http\Response; diff --git a/src/SberOnline/src/Responses/State.php b/src/SberOnline/src/Responses/State.php index 49b7bf17..4b1553db 100644 --- a/src/SberOnline/src/Responses/State.php +++ b/src/SberOnline/src/Responses/State.php @@ -15,7 +15,7 @@ declare(strict_types=1); -namespace Cashbox\BankName\Technology\Responses; +namespace Cashbox\Sber\Online\Responses; use Cashbox\Core\Http\Response; diff --git a/src/TemplateDriver/src/Driver.php b/src/TemplateDriver/src/Driver.php index c6db187d..07093c18 100644 --- a/src/TemplateDriver/src/Driver.php +++ b/src/TemplateDriver/src/Driver.php @@ -15,44 +15,35 @@ namespace Cashbox\BankName\Technology; -use Cashbox\BankName\Technology\Exceptions\Manager; -use Cashbox\BankName\Technology\Helpers\Statuses; -use Cashbox\BankName\Technology\Requests\Cancel; -use Cashbox\BankName\Technology\Requests\GetState; -use Cashbox\BankName\Technology\Requests\Init; -use Cashbox\BankName\Technology\Resources\Details; -use Cashbox\BankName\Technology\Responses\Created; -use Cashbox\BankName\Technology\Responses\Refund; -use Cashbox\BankName\Technology\Responses\State; +use Cashbox\BankName\Technology\Http\Requests\CancelRequest; +use Cashbox\BankName\Technology\Http\Requests\CreateRequest; +use Cashbox\BankName\Technology\Http\Requests\GetStateRequest; +use Cashbox\BankName\Technology\Http\Responses\Response; +use Cashbox\BankName\Technology\Services\Exception; +use Cashbox\BankName\Technology\Services\Statuses; +use Cashbox\Core\Http\Response as BaseResponse; use Cashbox\Core\Services\Driver as BaseDriver; -use DragonCode\Contracts\Cashier\Http\Response; class Driver extends BaseDriver { - protected $exception = Manager::class; + protected string $statuses = Statuses::class; - protected $statuses = Statuses::class; + protected string $exception = Exception::class; - protected $details = Details::class; + protected string $response = Response::class; - public function start(): Response + public function start(): BaseResponse { - $request = Init::make($this->model); - - return $this->request($request, Created::class); + return $this->request(CreateRequest::class); } - public function check(): Response + public function verify(): BaseResponse { - $request = GetState::make($this->model); - - return $this->request($request, State::class); + return $this->request(GetStateRequest::class); } - public function refund(): Response + public function refund(): BaseResponse { - $request = Cancel::make($this->model); - - return $this->request($request, Refund::class); + return $this->request(CancelRequest::class); } } diff --git a/src/TemplateDriver/src/Exceptions/Manager.php b/src/TemplateDriver/src/Exceptions/Manager.php deleted file mode 100644 index 87960223..00000000 --- a/src/TemplateDriver/src/Exceptions/Manager.php +++ /dev/null @@ -1,86 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -namespace Cashbox\BankName\Technology\Exceptions; - -use Cashbox\Core\Exceptions\Http\BankInternalErrorException; -use Cashbox\Core\Exceptions\Http\BuyerNotFoundClientException; -use Cashbox\Core\Exceptions\Http\CardHasStolenException; -use Cashbox\Core\Exceptions\Http\ContactTheSellerClientException; -use Cashbox\Core\Exceptions\Http\InsufficientFundsCardException; -use Cashbox\Core\Exceptions\Http\InvalidCardException; -use Cashbox\Core\Exceptions\Http\PaymentCompletedException; -use Cashbox\Core\Exceptions\Http\PaymentDeclinedException; -use Cashbox\Core\Exceptions\Http\PaymentTypeNotAvailableException; -use Cashbox\Core\Exceptions\Http\SumException; -use Cashbox\Core\Exceptions\Http\TooManyRequestsException; -use Cashbox\Core\Exceptions\Http\TryAgainLaterClientException; -use Cashbox\Core\Exceptions\Manager as ExceptionManager; - -class Manager extends ExceptionManager -{ - protected $codes = [ - 7 => BuyerNotFoundClientException::class, - 53 => ContactTheSellerClientException::class, - 99 => PaymentDeclinedException::class, - 100 => TryAgainLaterClientException::class, - 102 => PaymentDeclinedException::class, - 103 => TryAgainLaterClientException::class, - 119 => TooManyRequestsException::class, - 604 => PaymentDeclinedException::class, - 620 => SumException::class, - 623 => PaymentCompletedException::class, - 642 => InvalidCardException::class, - 1004 => CardHasStolenException::class, - 1005 => PaymentDeclinedException::class, - 1007 => CardHasStolenException::class, - 1008 => PaymentDeclinedException::class, - 1012 => PaymentDeclinedException::class, - 1013 => TryAgainLaterClientException::class, - 1014 => InvalidCardException::class, - 1015 => TryAgainLaterClientException::class, - 1019 => PaymentDeclinedException::class, - 1030 => TryAgainLaterClientException::class, - 1033 => InvalidCardException::class, - 1034 => TryAgainLaterClientException::class, - 1039 => PaymentDeclinedException::class, - 1041 => CardHasStolenException::class, - 1043 => CardHasStolenException::class, - 1051 => InsufficientFundsCardException::class, - 1053 => PaymentDeclinedException::class, - 1054 => InvalidCardException::class, - 1057 => InvalidCardException::class, - 1058 => InvalidCardException::class, - 1059 => CardHasStolenException::class, - 1061 => InvalidCardException::class, - 1062 => InvalidCardException::class, - 1063 => InvalidCardException::class, - 1064 => SumException::class, - 1065 => PaymentDeclinedException::class, - 1076 => PaymentDeclinedException::class, - 1089 => TryAgainLaterClientException::class, - 1091 => TryAgainLaterClientException::class, - 1092 => PaymentDeclinedException::class, - 1093 => CardHasStolenException::class, - 1094 => BankInternalErrorException::class, - 1096 => TryAgainLaterClientException::class, - 3001 => PaymentTypeNotAvailableException::class, - 9999 => BankInternalErrorException::class, - ]; - - protected $code_keys = ['ErrorCode']; - - protected $reason_keys = ['Details', 'Message']; -} diff --git a/src/TemplateDriver/src/Helpers/Statuses.php b/src/TemplateDriver/src/Helpers/Statuses.php deleted file mode 100644 index 4d238082..00000000 --- a/src/TemplateDriver/src/Helpers/Statuses.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -namespace Cashbox\BankName\Technology\Helpers; - -use Cashbox\Core\Services\Statuses as BaseStatus; - -class Statuses extends BaseStatus -{ - public const NEW = [ - 'FORM_SHOWED', - 'NEW', - ]; - public const REFUNDING = [ - 'REFUNDING', - ]; - public const REFUNDED = [ - 'PARTIAL_REFUNDED', - 'REFUNDED', - 'REVERSED', - ]; - public const FAILED = [ - 'ATTEMPTS_EXPIRED', - 'CANCELED', - 'DEADLINE_EXPIRED', - 'REJECTED', - ]; - public const SUCCESS = [ - 'CONFIRMED', - ]; -} diff --git a/src/TemplateDriver/src/Http/Requests/BaseRequest.php b/src/TemplateDriver/src/Http/Requests/BaseRequest.php new file mode 100644 index 00000000..6520768a --- /dev/null +++ b/src/TemplateDriver/src/Http/Requests/BaseRequest.php @@ -0,0 +1,43 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\BankName\Technology\Http\Requests; + +use Cashbox\BankName\Auth\Auth; +use Cashbox\BankName\Technology\Resources\TemplateDriverResource; +use Cashbox\Core\Http\Request; +use Cashbox\Core\Services\Auth as BaseSign; + +/** + * @property-read TemplateDriverResource $resource + */ +abstract class BaseRequest extends Request +{ + protected string $productionHost = 'https://example.com'; + + protected BaseSign|string|null $auth = Auth::class; + + protected function clientId(): string + { + return $this->resource->config->credentials->clientId; + } + + protected function clientSecret(): string + { + return $this->resource->config->credentials->clientSecret; + } +} diff --git a/src/TemplateDriver/src/Requests/Cancel.php b/src/TemplateDriver/src/Http/Requests/CancelRequest.php similarity index 57% rename from src/TemplateDriver/src/Requests/Cancel.php rename to src/TemplateDriver/src/Http/Requests/CancelRequest.php index e2b8fbc2..8e9d0c86 100644 --- a/src/TemplateDriver/src/Requests/Cancel.php +++ b/src/TemplateDriver/src/Http/Requests/CancelRequest.php @@ -15,20 +15,17 @@ declare(strict_types=1); -namespace Cashbox\BankName\Technology\Requests; +namespace Cashbox\BankName\Technology\Http\Requests; -class Cancel extends BaseRequest +class CancelRequest extends BaseRequest { - protected $path = '/api/cancel'; + protected string $productionUri = '/v1/cancel'; - protected $reload_relations = true; - - public function getRawBody(): array + public function body(): array { return [ - 'PaymentId' => $this->model->getExternalId(), - - 'Amount' => $this->model->getSum(), + 'PaymentId' => $this->resource->payment->cashbox->external_id, + 'Amount' => $this->resource->sum(), ]; } } diff --git a/src/TemplateDriver/src/Http/Requests/CreateRequest.php b/src/TemplateDriver/src/Http/Requests/CreateRequest.php new file mode 100644 index 00000000..28fe5dea --- /dev/null +++ b/src/TemplateDriver/src/Http/Requests/CreateRequest.php @@ -0,0 +1,41 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\BankName\Technology\Http\Requests; + +class CreateRequest extends BaseRequest +{ + protected string $productionUri = '/v1/init'; + + protected bool $secure = false; + + public function body(): array + { + return [ + 'OrderId' => $this->resource->paymentId(), + 'Amount' => $this->resource->sum(), + 'Currency' => $this->resource->currency(), + ]; + } + + public function headers(): array + { + return [ + 'X-Some-ID' => $this->resource->someIdentifier(), + ]; + } +} diff --git a/src/TemplateDriver/src/Requests/GetState.php b/src/TemplateDriver/src/Http/Requests/GetStateRequest.php similarity index 61% rename from src/TemplateDriver/src/Requests/GetState.php rename to src/TemplateDriver/src/Http/Requests/GetStateRequest.php index ba75ad81..e5ab19df 100644 --- a/src/TemplateDriver/src/Requests/GetState.php +++ b/src/TemplateDriver/src/Http/Requests/GetStateRequest.php @@ -15,16 +15,16 @@ declare(strict_types=1); -namespace Cashbox\BankName\Technology\Requests; +namespace Cashbox\BankName\Technology\Http\Requests; -class GetState extends BaseRequest +class GetStateRequest extends BaseRequest { - protected $path = '/api/status'; + protected string $productionUri = '/v1/state'; - public function getRawBody(): array + public function body(): array { return [ - 'PaymentId' => $this->model->getExternalId(), + 'PaymentId' => $this->resource->payment->cashbox->external_id, ]; } } diff --git a/src/TemplateDriver/src/Http/Responses/Response.php b/src/TemplateDriver/src/Http/Responses/Response.php new file mode 100644 index 00000000..65cd207f --- /dev/null +++ b/src/TemplateDriver/src/Http/Responses/Response.php @@ -0,0 +1,51 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\BankName\Technology\Http\Responses; + +use Cashbox\Core\Http\Response as BaseResponse; +use Spatie\LaravelData\Attributes\MapInputName; + +class Response extends BaseResponse +{ + #[MapInputName('Status')] + public ?string $status; + + #[MapInputName('Data')] + public ?string $url; + + #[MapInputName('PaymentId')] + public string $externalId; + + public function getExternalId(): ?string + { + return $this->externalId; + } + + protected function getExtra(): array + { + return [ + 'status' => $this->status, + 'url' => $this->url, + ]; + } + + protected function getStatus(): ?string + { + return $this->status; + } +} diff --git a/src/TemplateDriver/src/Requests/BaseRequest.php b/src/TemplateDriver/src/Requests/BaseRequest.php deleted file mode 100644 index 4be82187..00000000 --- a/src/TemplateDriver/src/Requests/BaseRequest.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\BankName\Technology\Requests; - -use Cashbox\BankName\Auth\Auth; -use Cashbox\Core\Facades\Config\Main; -use Cashbox\Core\Http\Request; - -abstract class BaseRequest extends Request -{ - protected $production_host = 'https://api.example.com'; - - protected $dev_host = 'https://dev.api.example.com'; - - protected $auth = Auth::class; - - public function getRawHeaders(): array - { - return [ - 'Accept' => 'application/json', - 'Content-Type' => 'application/json', - ]; - } - - public function getHttpOptions(): array - { - if (Main::isProduction()) { - $cert = $this->getCertificateData(); - - return compact('cert'); - } - - return []; - } - - protected function getCertificateData(): array - { - return [ - $this->model->getCertificatePath(), - $this->model->getCertificatePassword(), - ]; - } -} diff --git a/src/TemplateDriver/src/Requests/Init.php b/src/TemplateDriver/src/Requests/Init.php deleted file mode 100644 index ec6fb402..00000000 --- a/src/TemplateDriver/src/Requests/Init.php +++ /dev/null @@ -1,40 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\BankName\Technology\Requests; - -class Init extends BaseRequest -{ - protected $path = '/api/create'; - - protected $secure = false; - - protected $auth_extra = [ - 'scope' => 'scope-if-needed', - ]; - - public function getRawBody(): array - { - return [ - 'OrderId' => $this->model->getPaymentId(), - - 'Amount' => $this->model->getSum(), - - 'Currency' => $this->model->getCurrency(), - ]; - } -} diff --git a/src/TemplateDriver/src/Resources/Details.php b/src/TemplateDriver/src/Resources/Details.php deleted file mode 100644 index 64e8830d..00000000 --- a/src/TemplateDriver/src/Resources/Details.php +++ /dev/null @@ -1,38 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\BankName\Technology\Resources; - -use Cashbox\Core\Resources\Details as BaseDetails; - -class Details extends BaseDetails -{ - protected $url; - - public function getUrl(): ?string - { - return $this->url; - } - - public function toArray(): array - { - return [ - 'status' => $this->status, - 'url' => $this->url, - ]; - } -} diff --git a/src/TemplateDriver/src/Responses/Created.php b/src/TemplateDriver/src/Resources/TemplateDriverResource.php similarity index 58% rename from src/TemplateDriver/src/Responses/Created.php rename to src/TemplateDriver/src/Resources/TemplateDriverResource.php index 097dd78b..02eec0a1 100644 --- a/src/TemplateDriver/src/Responses/Created.php +++ b/src/TemplateDriver/src/Resources/TemplateDriverResource.php @@ -15,15 +15,14 @@ declare(strict_types=1); -namespace Cashbox\BankName\Technology\Responses; +namespace Cashbox\BankName\Technology\Resources; -use Cashbox\Core\Http\Response; +use Cashbox\Core\Resources\Resource; -class Created extends Response +abstract class TemplateDriverResource extends Resource { - protected $map = [ - self::KEY_EXTERNAL_ID => 'PaymentId', - - self::KEY_STATUS => 'Status', - ]; + public function someIdentifier(): ?string + { + return $this->config->credentials->extra['some_id'] ?? null; + } } diff --git a/src/TemplateDriver/src/Responses/Refund.php b/src/TemplateDriver/src/Responses/Refund.php deleted file mode 100644 index f83a10e9..00000000 --- a/src/TemplateDriver/src/Responses/Refund.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Cashbox\BankName\Technology\Responses; - -use Cashbox\Core\Http\Response; - -class Refund extends Response -{ - protected $map = [ - self::KEY_EXTERNAL_ID => 'PaymentId', - - self::KEY_STATUS => 'Status', - ]; -} diff --git a/src/TemplateDriver/src/Services/Exception.php b/src/TemplateDriver/src/Services/Exception.php new file mode 100644 index 00000000..0e853ed6 --- /dev/null +++ b/src/TemplateDriver/src/Services/Exception.php @@ -0,0 +1,34 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\BankName\Technology\Services; + +use Cashbox\Core\Exceptions\External\UnauthorizedHttpException; +use Cashbox\Core\Services\Exception as BaseException; + +class Exception extends BaseException +{ + protected array $codes = [ + 403 => UnauthorizedHttpException::class, + ]; + + protected array $failedKey = ['Success']; + + protected array $codeKeys = ['ErrorCode']; + + protected array $reasonKeys = ['Details', 'Message']; +} diff --git a/src/TemplateDriver/src/Services/Statuses.php b/src/TemplateDriver/src/Services/Statuses.php new file mode 100644 index 00000000..2f4f8894 --- /dev/null +++ b/src/TemplateDriver/src/Services/Statuses.php @@ -0,0 +1,29 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\BankName\Technology\Services; + +use Cashbox\Core\Services\Statuses as BaseStatus; + +class Statuses extends BaseStatus +{ + public const FAILED = ['ATTEMPTS_EXPIRED', 'CANCELED', 'DEADLINE_EXPIRED', 'REJECTED']; + public const NEW = ['FORM_SHOWED', 'NEW']; + public const REFUNDED = ['PARTIAL_REFUNDED', 'REFUNDED', 'REVERSED']; + public const REFUNDING = ['REFUNDING']; + public const SUCCESS = ['CONFIRMED']; +} diff --git a/tests/Fixtures/App/Enums/TypeEnum.php b/tests/Fixtures/App/Enums/TypeEnum.php index 94cce876..949bd0d4 100644 --- a/tests/Fixtures/App/Enums/TypeEnum.php +++ b/tests/Fixtures/App/Enums/TypeEnum.php @@ -27,16 +27,18 @@ * @method static string tinkoffQrCode() * @method static string sberQrCode() * @method static string templateAuth() + * @method static string templateDriver() */ enum TypeEnum: string { use InvokableCases; - case cash = 'cash'; - case outside = 'outside'; - case tinkoffCredit = 'tinkoff_credit'; - case tinkoffOnline = 'tinkoff_online'; - case tinkoffQrCode = 'tinkoff_qr'; - case sberQrCode = 'sber_qr'; - case templateAuth = 'template_auth'; + case cash = 'cash'; + case outside = 'outside'; + case tinkoffCredit = 'tinkoff_credit'; + case tinkoffOnline = 'tinkoff_online'; + case tinkoffQrCode = 'tinkoff_qr'; + case sberQrCode = 'sber_qr'; + case templateAuth = 'template_auth'; + case templateDriver = 'template_driver'; } diff --git a/src/TemplateDriver/src/Responses/State.php b/tests/Fixtures/Payments/TemplateDriver.php similarity index 52% rename from src/TemplateDriver/src/Responses/State.php rename to tests/Fixtures/Payments/TemplateDriver.php index 49b7bf17..84d0967f 100644 --- a/src/TemplateDriver/src/Responses/State.php +++ b/tests/Fixtures/Payments/TemplateDriver.php @@ -15,20 +15,20 @@ declare(strict_types=1); -namespace Cashbox\BankName\Technology\Responses; +namespace Tests\Fixtures\Payments; -use Cashbox\Core\Http\Response; +use Cashbox\BankName\Technology\Resources\TemplateDriverResource; +use Cashbox\Core\Enums\CurrencyEnum; -class State extends Response +class TemplateDriver extends TemplateDriverResource { - protected $map = [ - self::KEY_EXTERNAL_ID => 'PaymentId', - - self::KEY_STATUS => 'Status', - ]; + public function currency(): int + { + return CurrencyEnum::USD->value; + } - public function isEmpty(): bool + public function sum(): int { - return empty($this->getExternalId()) || empty($this->getStatus()); + return $this->payment->price; } } diff --git a/tests/Helpers/Http/Tinkoff/template.php b/tests/Helpers/Http/Tinkoff/template.php new file mode 100644 index 00000000..71e21367 --- /dev/null +++ b/tests/Helpers/Http/Tinkoff/template.php @@ -0,0 +1,71 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Illuminate\Support\Facades\Http; + +function fakeTemplateHttp(string $info = 'CONFIRMED'): void +{ + Http::fake([ + 'https://example.com/v1/init' => Http::response([ + 'Success' => true, + 'ErrorCode' => 0, + 'Status' => 'NEW', + 'PaymentId' => fake()->randomNumber(), + 'Data' => fake()->imageUrl, + ]), + + 'https://example.com/v1/state' => Http::response([ + 'Success' => true, + 'ErrorCode' => 0, + 'Status' => $info, + 'PaymentId' => fake()->randomNumber(), + ]), + + 'https://example.com/v1/cancel' => Http::response([ + 'Success' => true, + 'ErrorCode' => 0, + 'Status' => 'REFUNDED', + 'PaymentId' => fake()->randomNumber(), + ]), + ]); +} + +function fakeTemplateInvalidHttp(): void +{ + Http::fake([ + 'https://example.com/v1/init' => Http::response([ + 'Success' => false, + 'ErrorCode' => 403, + 'Message' => 'Invalid parameters.', + 'Details' => 'Terminal not found.', + ]), + + 'https://example.com/v1/state' => Http::response([ + 'Success' => false, + 'ErrorCode' => 403, + 'Message' => 'Invalid parameters.', + 'Details' => 'Terminal not found.', + ]), + + 'https://example.com/v1/cancel' => Http::response([ + 'Success' => false, + 'ErrorCode' => 403, + 'Message' => 'Invalid parameters.', + 'Details' => 'Terminal not found.', + ]), + ]); +} diff --git a/tests/Helpers/data.php b/tests/Helpers/data.php index 6161ab0a..bd5d1ed0 100644 --- a/tests/Helpers/data.php +++ b/tests/Helpers/data.php @@ -15,12 +15,8 @@ declare(strict_types=1); -use Cashbox\Core\Data\Config\DriverData; -use Cashbox\Core\Data\Config\Drivers\CredentialsData; use Spatie\LaravelData\Casts\Cast; use Spatie\LaravelData\Support\DataProperty; -use Tests\Fixtures\Drivers\Driver; -use Tests\Fixtures\Resources\TemplateAuthResource; function dataCast(Cast|string $cast, mixed $value, ?DataProperty $property = null, array $context = []): mixed { @@ -30,15 +26,3 @@ function dataCast(Cast|string $cast, mixed $value, ?DataProperty $property = nul return $cast->cast($property, $value, $context); } - -function driverData(): DriverData -{ - return DriverData::from([ - 'driver' => Driver::class, - 'resource' => TemplateAuthResource::class, - 'credentials' => CredentialsData::from([ - 'clientId' => 'qwerty', - 'clientSecret' => 'qwerty123', - ]), - ]); -} diff --git a/tests/Pest.php b/tests/Pest.php index 02c6e555..336744e4 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -39,6 +39,7 @@ uses(TestCase::class)->group('sber-auth')->in('Unit/Drivers/SberAuth'); uses(TestCase::class)->group('template-auth')->in('Unit/Drivers/TemplateAuth'); +uses(TestCase::class)->group('template-driver')->in('Unit/Drivers/TemplateDriver'); /* |-------------------------------------------------------------------------- diff --git a/tests/TestCase.php b/tests/TestCase.php index 37ff0217..9a393b0e 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -15,6 +15,7 @@ namespace Tests; +use Cashbox\BankName\Technology\Driver as TemplateDriver; use Cashbox\Cash\Driver as CashDriver; use Cashbox\Core\Enums\AttributeEnum; use Cashbox\Core\Enums\StatusEnum; @@ -33,6 +34,7 @@ use Tests\Fixtures\App\Enums\TypeEnum; use Tests\Fixtures\App\Models\PaymentModel; use Tests\Fixtures\Payments\Cash; +use Tests\Fixtures\Payments\TemplateDriver as TemplateDriverResource; use Tests\Fixtures\Payments\TinkoffCredit; use Tests\Fixtures\Payments\TinkoffOnline; use Tests\Fixtures\Payments\TinkoffQrCode; @@ -92,6 +94,7 @@ protected function setUpDrivers(Application $app): void $this->setUpTinkoffOnlineDriver($app); $this->setUpTinkoffQrCodeDriver($app); $this->setUpSberQrCodeDriver($app); + $this->setUpTemplateDriver($app); } protected function setUpCashDriver(Application $app): void @@ -113,7 +116,7 @@ protected function setUpTinkoffCreditDriver(Application $app): void 'resource' => TinkoffCredit::class, 'credentials' => [ // shopId - 'client_id' => fake()->randomLetter, + 'client_id' => fake()->randomLetter, // password 'client_secret' => fake()->password, @@ -166,4 +169,22 @@ protected function setUpSberQrCodeDriver(Application $app): void ], ]); } + + protected function setUpTemplateDriver(Application $app): void + { + $app['config']->set('cashbox.payment.drivers.' . TypeEnum::templateDriver(), TypeEnum::templateDriver); + + $app['config']->set('cashbox.drivers.' . TypeEnum::templateDriver(), [ + 'driver' => TemplateDriver::class, + 'resource' => TemplateDriverResource::class, + 'credentials' => [ + 'client_id' => 'qwerty', + 'client_secret' => 'qwerty123', + + 'extra' => [ + 'some_id' => 12345, + ], + ], + ]); + } } diff --git a/tests/Unit/Drivers/TemplateAuth/AuthTest.php b/tests/Unit/Drivers/TemplateAuth/AuthTest.php index 22eef5a6..3b004f4e 100644 --- a/tests/Unit/Drivers/TemplateAuth/AuthTest.php +++ b/tests/Unit/Drivers/TemplateAuth/AuthTest.php @@ -27,10 +27,8 @@ $payment = createPayment(TypeEnum::templateAuth, 1234); - $config = driverData(); - $request = new TemplateAuthRequest( - new TemplateAuthResource($payment, $config) + new TemplateAuthResource($payment, $payment->cashboxDriver()->config) ); expect($request->headers())->toBeEmpty(); @@ -48,10 +46,8 @@ $payment = createPayment(TypeEnum::templateAuth, 1234); - $config = driverData(); - $request = new TemplateAuthRequest( - new TemplateAuthResource($payment, $config) + new TemplateAuthResource($payment, $payment->cashboxDriver()->config) ); expect($request->sign()->headers())->toBeEmpty(); diff --git a/tests/Unit/Drivers/TemplateDriver/CreateTest.php b/tests/Unit/Drivers/TemplateDriver/CreateTest.php new file mode 100644 index 00000000..34a70143 --- /dev/null +++ b/tests/Unit/Drivers/TemplateDriver/CreateTest.php @@ -0,0 +1,110 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Cashbox\Core\Enums\CurrencyEnum; +use Cashbox\Core\Events\PaymentCreatedEvent; +use Cashbox\Core\Events\PaymentFailedEvent; +use Cashbox\Core\Events\PaymentRefundedEvent; +use Cashbox\Core\Events\PaymentSuccessEvent; +use Cashbox\Core\Events\PaymentWaitRefundEvent; +use Cashbox\Core\Exceptions\External\BadRequestHttpException; +use Illuminate\Http\Client\Request; +use Illuminate\Support\Facades\Event; +use Illuminate\Support\Facades\Http; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; + +it('request data', function () { + fakeEvents(); + fakeTemplateHttp(); + + $payment = createPayment(TypeEnum::templateDriver, 1234); + + $data = [ + 'OrderId' => $payment->id, + 'Amount' => $payment->price, + 'Currency' => CurrencyEnum::USD->value, + ]; + + // Init + Http::assertSent(function (Request $request) use ($data) { + return $request->hasHeader('X-Some-ID', 12345) + && $request->data() === $data; + }); + + // Verify + Http::assertSent(function (Request $request) { + return $request->hasHeader('X-Some-ID', 12345); + }); +}); + +it('new payment', function () { + fakeEvents(); + fakeTemplateHttp('NEW'); + + $payment = createPayment(TypeEnum::templateDriver); + + expect($payment->type)->toBe(TypeEnum::templateDriver); + expect($payment->status)->toBe(StatusEnum::new); + + expect($payment)->toBeHasCashbox(); + + $payment->refresh(); + + expect($payment)->toBeStatus(StatusEnum::new); + + expect($payment->cashbox->info->extra['url'])->toBeUrl(); + + Event::assertDispatchedTimes(PaymentCreatedEvent::class); + + Event::assertNotDispatched(PaymentSuccessEvent::class); + Event::assertNotDispatched(PaymentFailedEvent::class); + Event::assertNotDispatched(PaymentRefundedEvent::class); + Event::assertNotDispatched(PaymentWaitRefundEvent::class); +}); + +it('confirmed payment', function () { + fakeEvents(); + fakeTemplateHttp(); + + $payment = createPayment(TypeEnum::templateDriver); + + expect($payment->type)->toBe(TypeEnum::templateDriver); + expect($payment->status)->toBe(StatusEnum::new); + + expect($payment)->toBeHasCashbox(); + + $payment->refresh(); + + expect($payment)->toBeStatus(StatusEnum::success); + + expect($payment->cashbox->info->extra['url'])->toBeUrl(); + + Event::assertDispatchedTimes(PaymentCreatedEvent::class); + + Event::assertDispatchedTimes(PaymentSuccessEvent::class, 1); + Event::assertNotDispatched(PaymentFailedEvent::class); + Event::assertNotDispatched(PaymentRefundedEvent::class); + Event::assertNotDispatched(PaymentWaitRefundEvent::class); +}); + +it('unauthorized request', function () { + fakeEvents(); + fakeTemplateInvalidHttp(); + + createPayment(TypeEnum::templateDriver); +})->expectException(BadRequestHttpException::class); diff --git a/tests/Unit/Drivers/TemplateDriver/RefundTest.php b/tests/Unit/Drivers/TemplateDriver/RefundTest.php new file mode 100644 index 00000000..50f2719e --- /dev/null +++ b/tests/Unit/Drivers/TemplateDriver/RefundTest.php @@ -0,0 +1,92 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Cashbox\Core\Console\Commands\Refund; +use Cashbox\Core\Events\PaymentCreatedEvent; +use Cashbox\Core\Events\PaymentRefundedEvent; +use Cashbox\Core\Events\PaymentSuccessEvent; +use Illuminate\Support\Facades\Event; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; + +it('refund for new', function () { + fakeEvents(); + fakeTinkoffOnlineHttp('NEW'); + + $payment = createPayment(TypeEnum::tinkoffOnline); + + expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->status)->toBe(StatusEnum::new); + + expect($payment)->toBeHasCashbox(); + + Event::assertDispatchedTimes(PaymentCreatedEvent::class); + Event::assertDispatchedTimes(PaymentSuccessEvent::class, 0); + + fakeEvents(); + + artisan(Refund::class); + + // time has not yet come to refund. + expect($payment)->toBeStatus(StatusEnum::new); + + Event::assertNothingDispatched(); + + subHour($payment); + + fakeEvents(); + + artisan(Refund::class); + + expect($payment)->toBeStatus(StatusEnum::refund); + + Event::assertDispatchedTimes(PaymentRefundedEvent::class); +}); + +it('refund for success', function () { + fakeEvents(); + fakeTinkoffOnlineHttp(); + + $payment = createPayment(TypeEnum::tinkoffOnline); + + expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->status)->toBe(StatusEnum::new); + + expect($payment)->toBeHasCashbox(); + + Event::assertDispatchedTimes(PaymentCreatedEvent::class); + Event::assertDispatchedTimes(PaymentSuccessEvent::class); + + fakeEvents(); + + artisan(Refund::class); + + // time has not yet come to refund. + expect($payment)->toBeStatus(StatusEnum::success); + + Event::assertNothingDispatched(); + + subHour($payment); + + fakeEvents(); + + artisan(Refund::class); + + expect($payment)->toBeStatus(StatusEnum::refund); + + Event::assertDispatchedTimes(PaymentRefundedEvent::class); +}); diff --git a/tests/Unit/Drivers/TemplateDriver/VerifyTest.php b/tests/Unit/Drivers/TemplateDriver/VerifyTest.php new file mode 100644 index 00000000..3402b272 --- /dev/null +++ b/tests/Unit/Drivers/TemplateDriver/VerifyTest.php @@ -0,0 +1,67 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Cashbox\Core\Console\Commands\Verify; +use Cashbox\Core\Events\PaymentCreatedEvent; +use Cashbox\Core\Events\PaymentSuccessEvent; +use Illuminate\Support\Facades\Event; +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Enums\TypeEnum; + +it('verify for new', function () { + fakeEvents(); + fakeTinkoffOnlineHttp('NEW'); + + $payment = createPayment(TypeEnum::tinkoffOnline); + + expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->status)->toBe(StatusEnum::new); + + expect($payment)->toBeHasCashbox(); + + Event::assertDispatchedTimes(PaymentCreatedEvent::class); + Event::assertDispatchedTimes(PaymentSuccessEvent::class, 0); + + fakeEvents(); + + artisan(Verify::class); + + expect($payment)->toBeStatus(StatusEnum::new); + + Event::assertNothingDispatched(); +}); + +it('refund for success', function () { + fakeEvents(); + fakeTinkoffOnlineHttp(); + + $payment = createPayment(TypeEnum::tinkoffOnline); + + expect($payment->type)->toBe(TypeEnum::tinkoffOnline); + expect($payment->status)->toBe(StatusEnum::new); + + expect($payment)->toBeHasCashbox(); + + Event::assertDispatchedTimes(PaymentCreatedEvent::class); + Event::assertDispatchedTimes(PaymentSuccessEvent::class); + + fakeEvents(); + + artisan(Verify::class); + + Event::assertNothingDispatched(); +}); From 2e9b2f57faba029c41ac0ab45072f9f2cc2ed75d Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 10 Aug 2023 18:26:07 +0300 Subject: [PATCH 145/164] Separation of hashing methods --- src/Core/src/Http/Request.php | 4 +- src/Core/src/Services/Auth.php | 1 - src/TemplateAuth/src/Auth.php | 7 +-- .../src/{Auth.php => BasicAuth.php} | 11 +--- src/TinkoffAuth/src/HashAuth.php | 51 +++++++++++++++++ src/TinkoffAuth/src/Tokens/Base.php | 34 +++++++++++ src/TinkoffAuth/src/Tokens/BasicToken.php | 28 ++++++++++ .../Hash.php => Tokens/HashToken.php} | 29 ++-------- tests/Unit/Drivers/TinkoffAuth/AuthTest.php | 30 +++++++--- tests/Unit/Drivers/TinkoffAuth/TokenTest.php | 56 +++++++++++++++++++ 10 files changed, 199 insertions(+), 52 deletions(-) rename src/TinkoffAuth/src/{Auth.php => BasicAuth.php} (81%) create mode 100644 src/TinkoffAuth/src/HashAuth.php create mode 100644 src/TinkoffAuth/src/Tokens/Base.php create mode 100644 src/TinkoffAuth/src/Tokens/BasicToken.php rename src/TinkoffAuth/src/{Services/Hash.php => Tokens/HashToken.php} (58%) create mode 100644 tests/Unit/Drivers/TinkoffAuth/TokenTest.php diff --git a/src/Core/src/Http/Request.php b/src/Core/src/Http/Request.php index cef8d491..39c6bf26 100644 --- a/src/Core/src/Http/Request.php +++ b/src/Core/src/Http/Request.php @@ -39,8 +39,6 @@ abstract class Request protected ?string $devUri = null; - protected bool $secure = true; - protected Auth|string|null $auth = null; abstract public function body(): array; @@ -79,7 +77,7 @@ public function sign(): ?Auth return $this->auth; } - return $this->auth = new $this->auth($this, $this->resource->config, $this->secure, $this->authExtra()); + return $this->auth = new $this->auth($this, $this->resource->config, $this->authExtra()); } protected function authExtra(): array diff --git a/src/Core/src/Services/Auth.php b/src/Core/src/Services/Auth.php index b566a01e..a885ea77 100644 --- a/src/Core/src/Services/Auth.php +++ b/src/Core/src/Services/Auth.php @@ -25,7 +25,6 @@ abstract class Auth public function __construct( protected readonly Request $request, protected readonly DriverData $config, - protected readonly bool $secure = true, protected readonly array $extra = [] ) {} diff --git a/src/TemplateAuth/src/Auth.php b/src/TemplateAuth/src/Auth.php index b3cfec5d..cf4e4a47 100644 --- a/src/TemplateAuth/src/Auth.php +++ b/src/TemplateAuth/src/Auth.php @@ -36,12 +36,7 @@ public function body(): array protected function token(): Token { - return Hash::get( - $this->clientId(), - $this->clientSecret(), - $this->request->body(), - $this->secure - ); + return Hash::get($this->clientId(), $this->clientSecret(), $this->request->body()); } protected function clientId(): string diff --git a/src/TinkoffAuth/src/Auth.php b/src/TinkoffAuth/src/BasicAuth.php similarity index 81% rename from src/TinkoffAuth/src/Auth.php rename to src/TinkoffAuth/src/BasicAuth.php index 865ca39a..921869bb 100644 --- a/src/TinkoffAuth/src/Auth.php +++ b/src/TinkoffAuth/src/BasicAuth.php @@ -20,9 +20,9 @@ use Cashbox\Core\Data\Signing\Token; use Cashbox\Core\Services\Auth as BaseSign; use Cashbox\Tinkoff\Auth\Constants\Keys; -use Cashbox\Tinkoff\Auth\Services\Hash; +use Cashbox\Tinkoff\Auth\Tokens\BasicToken; -class Auth extends BaseSign +class BasicAuth extends BaseSign { public function body(): array { @@ -36,12 +36,7 @@ public function body(): array protected function token(): Token { - return Hash::get( - $this->clientId(), - $this->clientSecret(), - $this->request->body(), - $this->secure - ); + return BasicToken::get($this->clientId(), $this->clientSecret(), $this->request->body()); } protected function clientId(): string diff --git a/src/TinkoffAuth/src/HashAuth.php b/src/TinkoffAuth/src/HashAuth.php new file mode 100644 index 00000000..45e6d62c --- /dev/null +++ b/src/TinkoffAuth/src/HashAuth.php @@ -0,0 +1,51 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Tinkoff\Auth; + +use Cashbox\Core\Data\Signing\Token; +use Cashbox\Core\Services\Auth as BaseSign; +use Cashbox\Tinkoff\Auth\Constants\Keys; +use Cashbox\Tinkoff\Auth\Tokens\HashToken; + +class HashAuth extends BaseSign +{ + public function body(): array + { + $token = $this->token(); + + return array_merge($this->request->body(), [ + Keys::TERMINAL => $token->clientId, + Keys::TOKEN => $token->clientSecret, + ]); + } + + protected function token(): Token + { + return HashToken::get($this->clientId(), $this->clientSecret(), $this->request->body()); + } + + protected function clientId(): string + { + return $this->config->credentials->clientId; + } + + protected function clientSecret(): string + { + return $this->config->credentials->clientSecret; + } +} diff --git a/src/TinkoffAuth/src/Tokens/Base.php b/src/TinkoffAuth/src/Tokens/Base.php new file mode 100644 index 00000000..10e025d5 --- /dev/null +++ b/src/TinkoffAuth/src/Tokens/Base.php @@ -0,0 +1,34 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Tinkoff\Auth\Tokens; + +use Carbon\Carbon; +use Cashbox\Core\Data\Signing\Token; +use DateTimeInterface; + +abstract class Base +{ + abstract public static function get(string $clientId, string $clientSecret, array $data): Token; + + protected static function token(string $clientId, string $clientSecret, ?DateTimeInterface $expiresIn = null): Token + { + $expiresIn ??= Carbon::now()->addDay(); + + return Token::from(compact('clientId', 'clientSecret', 'expiresIn')); + } +} diff --git a/src/TinkoffAuth/src/Tokens/BasicToken.php b/src/TinkoffAuth/src/Tokens/BasicToken.php new file mode 100644 index 00000000..c4f1823d --- /dev/null +++ b/src/TinkoffAuth/src/Tokens/BasicToken.php @@ -0,0 +1,28 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\Tinkoff\Auth\Tokens; + +use Cashbox\Core\Data\Signing\Token; + +class BasicToken extends Base +{ + public static function get(string $clientId, string $clientSecret, array $data): Token + { + return static::token($clientId, $clientSecret); + } +} diff --git a/src/TinkoffAuth/src/Services/Hash.php b/src/TinkoffAuth/src/Tokens/HashToken.php similarity index 58% rename from src/TinkoffAuth/src/Services/Hash.php rename to src/TinkoffAuth/src/Tokens/HashToken.php index 178bf81b..b4141482 100644 --- a/src/TinkoffAuth/src/Services/Hash.php +++ b/src/TinkoffAuth/src/Tokens/HashToken.php @@ -15,33 +15,19 @@ declare(strict_types=1); -namespace Cashbox\Tinkoff\Auth\Services; +namespace Cashbox\Tinkoff\Auth\Tokens; -use Carbon\Carbon; use Cashbox\Core\Data\Signing\Token; use Cashbox\Tinkoff\Auth\Constants\Keys; -use DateTimeInterface; use DragonCode\Support\Facades\Helpers\Arr; -class Hash +class HashToken extends Base { - public static function get(string $clientId, string $clientSecret, array $data, bool $hash): Token - { - return $hash - ? static::hashed($clientId, $clientSecret, $data) - : static::basic($clientId, $clientSecret); - } - - protected static function basic(string $clientId, string $clientSecret): Token - { - return static::data($clientId, $clientSecret); - } - - protected static function hashed(string $clientId, string $clientSecret, array $data): Token + public static function get(string $clientId, string $clientSecret, array $data): Token { $hash = static::make($clientId, $clientSecret, $data); - return static::data($clientId, $hash); + return static::token($clientId, $hash); } protected static function make(string $clientId, string $clientSecret, array $data): string @@ -61,11 +47,4 @@ protected static function resolve(string $clientId, string $clientSecret, array ->implode('') ->toString(); } - - protected static function data(string $clientId, string $clientSecret, ?DateTimeInterface $expiresIn = null): Token - { - $expiresIn ??= Carbon::now()->addDay(); - - return Token::from(compact('clientId', 'clientSecret', 'expiresIn')); - } } diff --git a/tests/Unit/Drivers/TinkoffAuth/AuthTest.php b/tests/Unit/Drivers/TinkoffAuth/AuthTest.php index 19750a88..fcfa9018 100644 --- a/tests/Unit/Drivers/TinkoffAuth/AuthTest.php +++ b/tests/Unit/Drivers/TinkoffAuth/AuthTest.php @@ -15,20 +15,32 @@ declare(strict_types=1); -use Cashbox\Tinkoff\Auth\Services\Hash; +use Cashbox\Tinkoff\Auth\BasicAuth; +use Cashbox\Tinkoff\Auth\Constants\Keys; +use Cashbox\Tinkoff\Auth\Tokens\HashToken; it('basic data', function () { + $request = 'some'; + $clientId = 'foo'; $clientSecret = 'bar'; - $hashed = Hash::get($clientId, $clientSecret, [ - 'field1' => 'qwe', - 'field2' => 'rty', - 'field3' => 'asd', - ], false); + $data = [ + 'some1' => 'foo1', + 'some2' => 'foo2', + ]; - expect($hashed->clientId)->toBe($clientId); - expect($hashed->clientSecret)->toBe($clientSecret); + $auth = new BasicAuth($request); + + expect($auth->headers())->toBeArray()->toBeEmpty(); + expect($auth->options())->toBeArray()->toBeEmpty(); + + expect($auth->body())->toBeArray()->toBe([ + 'some1' => 'foo1', + 'some2' => 'foo2', + Keys::TERMINAL => $clientId, + Keys::TOKEN => $clientSecret, + ]); }); it('hashed data', function (array $data) { @@ -36,7 +48,7 @@ $clientSecret = 'bar'; $hash = '7959ae1ec20a02490d8d2f01d3704a2543e70c43cbe0c672209741263ef8048f'; - $hashed = Hash::get($clientId, $clientSecret, $data, true); + $hashed = HashToken::get($clientId, $clientSecret, $data, true); expect($hashed->clientId)->toBe($clientId); expect($hashed->clientSecret)->toBe($hash); diff --git a/tests/Unit/Drivers/TinkoffAuth/TokenTest.php b/tests/Unit/Drivers/TinkoffAuth/TokenTest.php new file mode 100644 index 00000000..f192a175 --- /dev/null +++ b/tests/Unit/Drivers/TinkoffAuth/TokenTest.php @@ -0,0 +1,56 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Cashbox\Tinkoff\Auth\Tokens\BasicToken; +use Cashbox\Tinkoff\Auth\Tokens\HashToken; + +it('base signature', function (array $data) { + $clientId = 'foo'; + $clientSecret = 'bar'; + + $token = BasicToken::get($clientId, $clientSecret, $data); + + expect($token->clientId)->toBe($clientId); + expect($token->clientSecret)->toBe($clientSecret); + expect($token->expiresIn)->toBeInstanceOf(DateTimeInterface::class); +})->with([ + [['field1' => 'qwe', 'field2' => 'rty', 'field3' => 'asd']], + [['field1' => 'qwe', 'field3' => 'asd', 'field2' => 'rty']], + [['field2' => 'rty', 'field1' => 'qwe', 'field3' => 'asd']], + [['field2' => 'rty', 'field3' => 'asd', 'field1' => 'qwe']], + [['field3' => 'asd', 'field1' => 'qwe', 'field2' => 'rty']], + [['field3' => 'asd', 'field2' => 'rty', 'field1' => 'qwe']], +]); + +it('hashed signature', function (array $data) { + $clientId = 'foo'; + $clientSecret = 'bar'; + $hash = 'qweqweqwe'; + + $token = HashToken::get($clientId, $clientSecret, $data); + + expect($token->clientId)->toBe($clientId); + expect($token->clientSecret)->toBe($hash); + expect($token->expiresIn)->toBeInstanceOf(DateTimeInterface::class); +})->with([ + [['field1' => 'qwe', 'field2' => 'rty', 'field3' => 'asd']], + [['field1' => 'qwe', 'field3' => 'asd', 'field2' => 'rty']], + [['field2' => 'rty', 'field1' => 'qwe', 'field3' => 'asd']], + [['field2' => 'rty', 'field3' => 'asd', 'field1' => 'qwe']], + [['field3' => 'asd', 'field1' => 'qwe', 'field2' => 'rty']], + [['field3' => 'asd', 'field2' => 'rty', 'field1' => 'qwe']], +]); From 557f168024c3c84d175cb4c8ba331676e6de998d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 15:11:43 +0000 Subject: [PATCH 146/164] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] # Conflicts: # .github/workflows/phpunit.yml --- .github/workflows/code-style.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/split.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 4237f8f6..3836fb33 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -10,7 +10,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Detect job name id: detect diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9f94ae5..43bfd371 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup GIT uses: frankdejonge/use-github-token@1.0.2 diff --git a/.github/workflows/split.yml b/.github/workflows/split.yml index 4a2fc230..f550144f 100644 --- a/.github/workflows/split.yml +++ b/.github/workflows/split.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: '0' persist-credentials: 'false' From e65bf7789c70704fbd20b1aa050a9c20417ebf97 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 9 Sep 2023 17:24:54 +0300 Subject: [PATCH 147/164] Optimized test migration --- .../Models/Factories/PaymentModelFactory.php | 6 ++-- .../App/Observers/PaymentObserver.php | 29 ++++++++++++++++++ .../App/Providers/TestServiceProvider.php | 30 +++++++++++++++++++ tests/TestCase.php | 2 ++ ...023_07_14_022222_create_payments_model.php | 3 +- 5 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 tests/Fixtures/App/Observers/PaymentObserver.php create mode 100644 tests/Fixtures/App/Providers/TestServiceProvider.php diff --git a/tests/Fixtures/App/Models/Factories/PaymentModelFactory.php b/tests/Fixtures/App/Models/Factories/PaymentModelFactory.php index 93eafda4..23339653 100644 --- a/tests/Fixtures/App/Models/Factories/PaymentModelFactory.php +++ b/tests/Fixtures/App/Models/Factories/PaymentModelFactory.php @@ -18,7 +18,6 @@ namespace Tests\Fixtures\App\Models\Factories; use Illuminate\Database\Eloquent\Factories\Factory; -use Tests\Fixtures\App\Enums\StatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; use Tests\Fixtures\App\Models\PaymentModel; @@ -29,9 +28,8 @@ class PaymentModelFactory extends Factory public function definition(): array { return [ - 'type' => TypeEnum::outside, - 'status' => StatusEnum::new, - 'price' => $this->faker->randomNumber(4), + 'type' => TypeEnum::outside, + 'price' => $this->faker->randomNumber(4), ]; } } diff --git a/tests/Fixtures/App/Observers/PaymentObserver.php b/tests/Fixtures/App/Observers/PaymentObserver.php new file mode 100644 index 00000000..5a2ca43c --- /dev/null +++ b/tests/Fixtures/App/Observers/PaymentObserver.php @@ -0,0 +1,29 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Tests\Fixtures\App\Observers; + +use Tests\Fixtures\App\Enums\StatusEnum; +use Tests\Fixtures\App\Models\PaymentModel; + +class PaymentObserver +{ + public function creating(PaymentModel $payment): void + { + $payment->status = StatusEnum::new; + } +} diff --git a/tests/Fixtures/App/Providers/TestServiceProvider.php b/tests/Fixtures/App/Providers/TestServiceProvider.php new file mode 100644 index 00000000..3d625c8c --- /dev/null +++ b/tests/Fixtures/App/Providers/TestServiceProvider.php @@ -0,0 +1,30 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Tests\Fixtures\App\Providers; + +use Illuminate\Support\ServiceProvider; +use Tests\Fixtures\App\Models\PaymentModel; +use Tests\Fixtures\App\Observers\PaymentObserver; + +class TestServiceProvider extends ServiceProvider +{ + public function boot(): void + { + PaymentModel::observe(PaymentObserver::class); + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php index 9a393b0e..aa8ce426 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -33,6 +33,7 @@ use Tests\Fixtures\App\Enums\StatusEnum as TestStatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; use Tests\Fixtures\App\Models\PaymentModel; +use Tests\Fixtures\App\Providers\TestServiceProvider; use Tests\Fixtures\Payments\Cash; use Tests\Fixtures\Payments\TemplateDriver as TemplateDriverResource; use Tests\Fixtures\Payments\TinkoffCredit; @@ -51,6 +52,7 @@ protected function getPackageProviders($app): array BindingServiceProvider::class, ObserverServiceProvider::class, RateLimiterServiceProvider::class, + TestServiceProvider::class, ]; } diff --git a/tests/database/2023_07_14_022222_create_payments_model.php b/tests/database/2023_07_14_022222_create_payments_model.php index fba40d80..a99c62c7 100644 --- a/tests/database/2023_07_14_022222_create_payments_model.php +++ b/tests/database/2023_07_14_022222_create_payments_model.php @@ -18,7 +18,6 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -use Tests\Fixtures\App\Enums\StatusEnum; return new class extends Migration { public function up(): void @@ -29,7 +28,7 @@ public function up(): void $table->integer('price'); $table->string('type'); - $table->smallInteger('status')->default(StatusEnum::new->value); + $table->tinyInteger('status'); $table->timestamps(); }); From 502f3370254c14a8b973738c0e9b601218781522 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 9 Sep 2023 18:56:17 +0300 Subject: [PATCH 148/164] Removed unnecessary dock blocks. Laravel Idea can provide hints without them --- src/Core/src/Facades/Config.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/Core/src/Facades/Config.php b/src/Core/src/Facades/Config.php index 9c5c8e66..9347b87a 100644 --- a/src/Core/src/Facades/Config.php +++ b/src/Core/src/Facades/Config.php @@ -18,23 +18,8 @@ namespace Cashbox\Core\Facades; use Cashbox\Core\Data\Config\ConfigData; -use Cashbox\Core\Data\Config\DetailsData; -use Cashbox\Core\Data\Config\DriverData; -use Cashbox\Core\Data\Config\LogsData; -use Cashbox\Core\Data\Config\Payment\PaymentData; -use Cashbox\Core\Data\Config\Queue\QueueData; -use Cashbox\Core\Data\Config\RefundData; use Illuminate\Support\Facades\Facade; -/** - * @method static bool isProduction() - * @method static DetailsData details() - * @method static DriverData driver(int|string $name) - * @method static LogsData logs() - * @method static PaymentData payment() - * @method static QueueData queue() - * @method static RefundData refund() - */ class Config extends Facade { protected static function getFacadeAccessor(): string From 745fec03fa2f916b92422589620d31e525ee08b5 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 9 Sep 2023 18:58:27 +0300 Subject: [PATCH 149/164] Fixed error --- src/TinkoffCredit/src/Http/Requests/BaseRequest.php | 2 ++ src/TinkoffCredit/src/Http/Requests/CreateRequest.php | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TinkoffCredit/src/Http/Requests/BaseRequest.php b/src/TinkoffCredit/src/Http/Requests/BaseRequest.php index 7271bfc1..7f355325 100644 --- a/src/TinkoffCredit/src/Http/Requests/BaseRequest.php +++ b/src/TinkoffCredit/src/Http/Requests/BaseRequest.php @@ -27,6 +27,8 @@ abstract class BaseRequest extends Request { protected string $productionHost = 'https://forma.tinkoff.ru'; + protected bool $secure = false; + public function url(): ?string { return Str::replaceFormat(parent::url(), [ diff --git a/src/TinkoffCredit/src/Http/Requests/CreateRequest.php b/src/TinkoffCredit/src/Http/Requests/CreateRequest.php index b25680d8..d7aa6175 100644 --- a/src/TinkoffCredit/src/Http/Requests/CreateRequest.php +++ b/src/TinkoffCredit/src/Http/Requests/CreateRequest.php @@ -23,8 +23,6 @@ class CreateRequest extends BaseRequest protected ?string $devUri = '/api/partners/v2/orders/create-demo'; - protected bool $secure = false; - public function body(): array { return array_merge([ From ce685ed5c8ff0ceee7f1f1d4a765eb0932f7d200 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 9 Sep 2023 19:33:50 +0300 Subject: [PATCH 150/164] Internal errors fixed --- .../src/Concerns/Config/Payment/Drivers.php | 2 +- src/Core/src/Exceptions/BaseException.php | 9 +++++++-- .../src/Http/Requests/BaseRequest.php | 18 +++--------------- .../src/Http/Requests/BaseRequest.php | 4 ---- .../src/Http/Requests/CancelRequest.php | 5 +++++ .../src/Http/Requests/CreateRequest.php | 5 ++++- .../src/Http/Requests/GetStateRequest.php | 5 +++++ .../src/Http/Requests/BaseRequest.php | 4 ---- .../src/Http/Requests/CancelRequest.php | 5 +++++ .../src/Http/Requests/CreateRequest.php | 7 +++++-- .../src/Http/Requests/GetQrRequest.php | 5 +++++ .../src/Http/Requests/GetStateRequest.php | 5 +++++ 12 files changed, 45 insertions(+), 29 deletions(-) diff --git a/src/Core/src/Concerns/Config/Payment/Drivers.php b/src/Core/src/Concerns/Config/Payment/Drivers.php index c55f6b33..9602649d 100644 --- a/src/Core/src/Concerns/Config/Payment/Drivers.php +++ b/src/Core/src/Concerns/Config/Payment/Drivers.php @@ -46,6 +46,6 @@ protected static function driverByModel(Model $payment): DriverData return static::driver($name, $payment); } - throw new UnknownDriverConfigException($name, $payment->getKey()); + throw new UnknownDriverConfigException($type, $payment->getKey()); } } diff --git a/src/Core/src/Exceptions/BaseException.php b/src/Core/src/Exceptions/BaseException.php index 7205081f..1bdbf722 100644 --- a/src/Core/src/Exceptions/BaseException.php +++ b/src/Core/src/Exceptions/BaseException.php @@ -17,6 +17,7 @@ namespace Cashbox\Core\Exceptions; +use BackedEnum; use Exception; class BaseException extends Exception @@ -25,12 +26,12 @@ class BaseException extends Exception protected string $reason; - public function __construct(object|string|null $haystack = null, ?string $needle = null) + public function __construct(object|string|null $haystack = null, int|string|null $needle = null) { parent::__construct($this->reason($haystack, $needle), $this->statusCode); } - protected function reason(object|string|null $haystack, ?string $needle): string + protected function reason(object|string|null $haystack, int|string|null $needle): string { if ($haystack = $this->haystack($haystack)) { return sprintf($this->reason, $haystack, $needle); @@ -41,6 +42,10 @@ protected function reason(object|string|null $haystack, ?string $needle): string protected function haystack(object|string|null $haystack): ?string { + if ($haystack instanceof BackedEnum) { + return $haystack->value ?? $haystack->name; + } + return is_object($haystack) ? get_class($haystack) : $haystack; } } diff --git a/src/TinkoffCredit/src/Http/Requests/BaseRequest.php b/src/TinkoffCredit/src/Http/Requests/BaseRequest.php index 7f355325..f7650ca7 100644 --- a/src/TinkoffCredit/src/Http/Requests/BaseRequest.php +++ b/src/TinkoffCredit/src/Http/Requests/BaseRequest.php @@ -18,6 +18,8 @@ namespace Cashbox\Tinkoff\Credit\Http\Requests; use Cashbox\Core\Http\Request; +use Cashbox\Core\Services\Auth; +use Cashbox\Tinkoff\Auth\BasicAuth; use DragonCode\Support\Facades\Helpers\Str; /** @@ -27,7 +29,7 @@ abstract class BaseRequest extends Request { protected string $productionHost = 'https://forma.tinkoff.ru'; - protected bool $secure = false; + protected Auth|string|null $auth = BasicAuth::class; public function url(): ?string { @@ -36,20 +38,6 @@ public function url(): ?string ], '{%s}'); } - public function options(): array - { - if ($this->secure) { - return [ - 'auth' => [ - $this->clientId(), - $this->clientSecret(), - ], - ]; - } - - return []; - } - protected function clientId(): string { if (static::isProduction()) { diff --git a/src/TinkoffOnline/src/Http/Requests/BaseRequest.php b/src/TinkoffOnline/src/Http/Requests/BaseRequest.php index fb7af907..3c363fa5 100644 --- a/src/TinkoffOnline/src/Http/Requests/BaseRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/BaseRequest.php @@ -18,15 +18,11 @@ namespace Cashbox\Tinkoff\Online\Http\Requests; use Cashbox\Core\Http\Request; -use Cashbox\Core\Services\Auth as BaseSign; -use Cashbox\Tinkoff\Auth\Auth; abstract class BaseRequest extends Request { protected string $productionHost = 'https://securepay.tinkoff.ru'; - protected BaseSign|string|null $auth = Auth::class; - protected function clientId(): string { return $this->resource->config->credentials->clientId; diff --git a/src/TinkoffOnline/src/Http/Requests/CancelRequest.php b/src/TinkoffOnline/src/Http/Requests/CancelRequest.php index 2c5f04ad..8417441c 100644 --- a/src/TinkoffOnline/src/Http/Requests/CancelRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/CancelRequest.php @@ -17,10 +17,15 @@ namespace Cashbox\Tinkoff\Online\Http\Requests; +use Cashbox\Core\Services\Auth; +use Cashbox\Tinkoff\Auth\HashAuth; + class CancelRequest extends BaseRequest { protected string $productionUri = '/v2/Cancel'; + protected Auth|string|null $auth = HashAuth::class; + public function body(): array { return [ diff --git a/src/TinkoffOnline/src/Http/Requests/CreateRequest.php b/src/TinkoffOnline/src/Http/Requests/CreateRequest.php index 86b62298..0625b230 100644 --- a/src/TinkoffOnline/src/Http/Requests/CreateRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/CreateRequest.php @@ -17,11 +17,14 @@ namespace Cashbox\Tinkoff\Online\Http\Requests; +use Cashbox\Core\Services\Auth; +use Cashbox\Tinkoff\Auth\BasicAuth; + class CreateRequest extends BaseRequest { protected string $productionUri = '/v2/Init'; - protected bool $secure = false; + protected Auth|string|null $auth = BasicAuth::class; public function body(): array { diff --git a/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php b/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php index 48a622f9..035d257e 100644 --- a/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php @@ -17,10 +17,15 @@ namespace Cashbox\Tinkoff\Online\Http\Requests; +use Cashbox\Core\Services\Auth; +use Cashbox\Tinkoff\Auth\HashAuth; + class GetStateRequest extends BaseRequest { protected string $productionUri = '/v2/GetState'; + protected Auth|string|null $auth = HashAuth::class; + public function body(): array { return [ diff --git a/src/TinkoffQrCode/src/Http/Requests/BaseRequest.php b/src/TinkoffQrCode/src/Http/Requests/BaseRequest.php index 81afa955..a4d0d8df 100644 --- a/src/TinkoffQrCode/src/Http/Requests/BaseRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/BaseRequest.php @@ -18,15 +18,11 @@ namespace Cashbox\Tinkoff\QrCode\Http\Requests; use Cashbox\Core\Http\Request; -use Cashbox\Core\Services\Auth as BaseSign; -use Cashbox\Tinkoff\Auth\Auth; abstract class BaseRequest extends Request { protected string $productionHost = 'https://securepay.tinkoff.ru'; - protected BaseSign|string|null $auth = Auth::class; - protected function clientId(): string { return $this->resource->config->credentials->clientId; diff --git a/src/TinkoffQrCode/src/Http/Requests/CancelRequest.php b/src/TinkoffQrCode/src/Http/Requests/CancelRequest.php index ae226d52..c9067beb 100644 --- a/src/TinkoffQrCode/src/Http/Requests/CancelRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/CancelRequest.php @@ -17,10 +17,15 @@ namespace Cashbox\Tinkoff\QrCode\Http\Requests; +use Cashbox\Core\Services\Auth; +use Cashbox\Tinkoff\Auth\HashAuth; + class CancelRequest extends BaseRequest { protected string $productionUri = '/v2/Cancel'; + protected Auth|string|null $auth = HashAuth::class; + public function body(): array { return [ diff --git a/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php b/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php index 3703a5b6..103816b2 100644 --- a/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php @@ -17,11 +17,14 @@ namespace Cashbox\Tinkoff\QrCode\Http\Requests; +use Cashbox\Core\Services\Auth; +use Cashbox\Tinkoff\Auth\BasicAuth; + class CreateRequest extends BaseRequest { protected string $productionUri = '/v2/Init'; - - protected bool $secure = false; + + protected Auth|string|null $auth = BasicAuth::class; public function body(): array { diff --git a/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php b/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php index d5931f49..6614cf0f 100644 --- a/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php @@ -17,10 +17,15 @@ namespace Cashbox\Tinkoff\QrCode\Http\Requests; +use Cashbox\Core\Services\Auth; +use Cashbox\Tinkoff\Auth\HashAuth; + class GetQrRequest extends BaseRequest { protected string $productionUri = '/v2/GetQr'; + protected Auth|string|null $auth = HashAuth::class; + public function body(): array { return [ diff --git a/src/TinkoffQrCode/src/Http/Requests/GetStateRequest.php b/src/TinkoffQrCode/src/Http/Requests/GetStateRequest.php index b62d1082..f08fb671 100644 --- a/src/TinkoffQrCode/src/Http/Requests/GetStateRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/GetStateRequest.php @@ -17,10 +17,15 @@ namespace Cashbox\Tinkoff\QrCode\Http\Requests; +use Cashbox\Core\Services\Auth; +use Cashbox\Tinkoff\Auth\HashAuth; + class GetStateRequest extends BaseRequest { protected string $productionUri = '/v2/GetState'; + protected Auth|string|null $auth = HashAuth::class; + public function body(): array { return [ From e20434a02c1be77c75295089625a48cda28f5e29 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 9 Sep 2023 19:43:02 +0300 Subject: [PATCH 151/164] Reduced test configuration size --- tests/TestCase.php | 110 ++++++++++----------------------------------- 1 file changed, 24 insertions(+), 86 deletions(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index aa8ce426..8bdbda74 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -91,102 +91,40 @@ protected function setUpStatuses(Application $app): void protected function setUpDrivers(Application $app): void { - $this->setUpCashDriver($app); - $this->setUpTinkoffCreditDriver($app); - $this->setUpTinkoffOnlineDriver($app); - $this->setUpTinkoffQrCodeDriver($app); - $this->setUpSberQrCodeDriver($app); - $this->setUpTemplateDriver($app); - } - - protected function setUpCashDriver(Application $app): void - { - $app['config']->set('cashbox.payment.drivers.' . TypeEnum::cash(), TypeEnum::cash); - - $app['config']->set('cashbox.drivers.' . TypeEnum::cash(), [ - 'driver' => CashDriver::class, - 'resource' => Cash::class, - ]); - } - - protected function setUpTinkoffCreditDriver(Application $app): void - { - $app['config']->set('cashbox.payment.drivers.' . TypeEnum::tinkoffCredit(), TypeEnum::tinkoffCredit); - - $app['config']->set('cashbox.drivers.' . TypeEnum::tinkoffCredit(), [ - 'driver' => TinkoffCreditDriver::class, - 'resource' => TinkoffCredit::class, - 'credentials' => [ - // shopId - 'client_id' => fake()->randomLetter, - - // password - 'client_secret' => fake()->password, - - 'showcase_id' => fake()->randomLetter, - - 'promo_code' => 'default', - ], - ]); - } + $this->setUpDriver($app, TypeEnum::cash, CashDriver::class, Cash::class); - protected function setUpTinkoffOnlineDriver(Application $app): void - { - $app['config']->set('cashbox.payment.drivers.' . TypeEnum::tinkoffOnline(), TypeEnum::tinkoffOnline); - - $app['config']->set('cashbox.drivers.' . TypeEnum::tinkoffOnline(), [ - 'driver' => TinkoffOnlineDriver::class, - 'resource' => TinkoffOnline::class, - 'credentials' => [ - 'client_id' => fake()->randomLetter, - 'client_secret' => fake()->password, - ], + $this->setUpDriver($app, TypeEnum::tinkoffOnline, TinkoffOnlineDriver::class, TinkoffOnline::class); + $this->setUpDriver($app, TypeEnum::tinkoffQrCode, TinkoffQrCodeDriver::class, TinkoffQrCode::class); + $this->setUpDriver($app, TypeEnum::tinkoffCredit, TinkoffCreditDriver::class, TinkoffCredit::class, [ + 'showcase_id' => fake()->randomLetter, + 'promo_code' => 'default', ]); - } - protected function setUpTinkoffQrCodeDriver(Application $app): void - { - $app['config']->set('cashbox.payment.drivers.' . TypeEnum::tinkoffQrCode(), TypeEnum::tinkoffQrCode); - - $app['config']->set('cashbox.drivers.' . TypeEnum::tinkoffQrCode(), [ - 'driver' => TinkoffQrCodeDriver::class, - 'resource' => TinkoffQrCode::class, - 'credentials' => [ - 'client_id' => fake()->randomLetter, - 'client_secret' => fake()->password, - ], - ]); - } + $this->setUpDriver($app, TypeEnum::sberQrCode, TinkoffQrCodeDriver::class, TinkoffQrCode::class); - protected function setUpSberQrCodeDriver(Application $app): void - { - $app['config']->set('cashbox.payment.drivers.' . TypeEnum::sberQrCode(), TypeEnum::sberQrCode); - - $app['config']->set('cashbox.drivers.' . TypeEnum::sberQrCode(), [ - 'driver' => TinkoffQrCodeDriver::class, - 'resource' => TinkoffQrCode::class, - 'credentials' => [ - 'client_id' => 'qwerty', - 'client_secret' => 'qwerty123', + $this->setUpDriver($app, TypeEnum::templateDriver, TemplateDriver::class, TemplateDriverResource::class, [ + 'extra' => [ + 'some_id' => 12345, ], ]); } - protected function setUpTemplateDriver(Application $app): void - { - $app['config']->set('cashbox.payment.drivers.' . TypeEnum::templateDriver(), TypeEnum::templateDriver); - - $app['config']->set('cashbox.drivers.' . TypeEnum::templateDriver(), [ - 'driver' => TemplateDriver::class, - 'resource' => TemplateDriverResource::class, - 'credentials' => [ + protected function setUpDriver( + Application $app, + TypeEnum $type, + string $driver, + string $resource, + array $credentials = [] + ): void { + $app['config']->set('cashbox.payment.drivers.' . $type->value, $type); + + $app['config']->set('cashbox.drivers.' . $type->value, [ + 'driver' => $driver, + 'resource' => $resource, + 'credentials' => array_merge([ 'client_id' => 'qwerty', 'client_secret' => 'qwerty123', - - 'extra' => [ - 'some_id' => 12345, - ], - ], + ], $credentials), ]); } } From b4ebfa77ecefdaffe65f834984be83528921326b Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 9 Sep 2023 20:12:54 +0300 Subject: [PATCH 152/164] Simplified method name --- src/Core/src/Services/Driver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/src/Services/Driver.php b/src/Core/src/Services/Driver.php index 2ee663a4..54414a6c 100644 --- a/src/Core/src/Services/Driver.php +++ b/src/Core/src/Services/Driver.php @@ -54,7 +54,7 @@ protected function request(string $request, ?string $response = null, ?Response { $data = $this->call($request, 'make', $this->resource(), $prev); - $content = $this->http->send($data, $this->resolveException()); + $content = $this->http->send($data, $this->exception()); if ($prev !== null) { $content = array_merge($prev->toArray(), $content); @@ -70,7 +70,7 @@ protected function resource(): Resource return new $resource($this->payment, $this->config); } - protected function resolveException(): Exception + protected function exception(): Exception { return resolve($this->exception); } From c026752348a7adfdd44df9b85bcd82682342a778 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 9 Sep 2023 20:18:59 +0300 Subject: [PATCH 153/164] Adding a `thanks` block to plugins --- app/Commands/Composer.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app/Commands/Composer.php b/app/Commands/Composer.php index 1b29a406..1d5b2523 100644 --- a/app/Commands/Composer.php +++ b/app/Commands/Composer.php @@ -32,7 +32,8 @@ class Composer extends Command protected string $exclude = 'cashbox/'; protected array $thanks = [ - 'illuminate/' => 'laravel/framework', + "name" => "cashbox-laravel/foundation", + "url" => "https://github.com/cashbox-laravel/foundation", ]; protected function handle(string $source, string $target): void @@ -54,6 +55,8 @@ protected function handle(string $source, string $target): void $this->copyToMain($composer, 'keywords'); $this->copyToMain($composer, 'require'); + $this->setThanks($this->main); + $this->store($target, $composer); } @@ -64,8 +67,6 @@ protected function prepare(): void protected function finish(): void { - $this->sortMainThanks($this->main, 'extra.thanks'); - $this->store($this->basePath(), $this->main); } @@ -94,7 +95,7 @@ protected function copyToDriverIntersect(&$array, string $key): void protected function copyToMain($array, string $key): void { - $main = Arr::get($this->main, $key); + $main = Arr::get($this->main, $key); $driver = Arr::get($array, $key); $items = Arr::of($driver) @@ -109,13 +110,9 @@ protected function copyToMain($array, string $key): void IA::set($this->main, $key, $items); } - protected function sortMainThanks(array &$array, string $key): void + protected function setThanks(array &$array): void { - $thanks = Arr::get($array, $key, []); - - $items = collect($thanks)->sortBy('name')->values()->all(); - - IA::set($array, $key, $items); + IA::set($array, 'extra.thanks', $this->thanks); } protected function fromMain(string $key, mixed $default = null): mixed From a21b89897613692aef77833c00d9b253a3bd3914 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sat, 9 Sep 2023 21:04:15 +0300 Subject: [PATCH 154/164] =?UTF-8?q?Something=20has=20definitely=20changed?= =?UTF-8?q?=20=F0=9F=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 2 +- .../src/Concerns/Config/Payment/Drivers.php | 8 +-- ...onfigException.php => ConfigException.php} | 2 +- src/TemplateAuth/src/{Auth.php => Basic.php} | 6 +- src/TemplateAuth/src/Constants/Keys.php | 6 +- src/TemplateAuth/src/Hash.php | 50 +++++++++++++++++ src/TemplateAuth/src/Tokens/Base.php | 34 +++++++++++ src/TemplateAuth/src/Tokens/BasicToken.php | 28 ++++++++++ .../Hash.php => Tokens/HashToken.php} | 29 ++-------- .../src/Http/Requests/BaseRequest.php | 4 -- .../src/Http/Requests/CancelRequest.php | 5 ++ .../src/Http/Requests/CreateRequest.php | 5 +- .../src/Http/Requests/GetStateRequest.php | 5 ++ .../src/Resources/TemplateDriverResource.php | 2 +- .../src/{BasicAuth.php => Basic.php} | 2 +- .../src/{HashAuth.php => Hash.php} | 2 +- .../src/Http/Requests/BaseRequest.php | 4 +- .../src/Http/Requests/CancelRequest.php | 4 +- .../src/Http/Requests/CreateRequest.php | 4 +- .../src/Http/Requests/GetStateRequest.php | 4 +- .../src/Http/Requests/CancelRequest.php | 4 +- .../src/Http/Requests/CreateRequest.php | 4 +- .../src/Http/Requests/GetQrRequest.php | 4 +- .../src/Http/Requests/GetStateRequest.php | 4 +- ...quest.php => TemplateAuthBasicRequest.php} | 6 +- .../Http/{Tinkoff => Template}/template.php | 0 tests/Helpers/auth.php | 12 ++++ tests/TestCase.php | 4 +- tests/Unit/Drivers/TemplateAuth/AuthTest.php | 48 ++++------------ tests/Unit/Drivers/TemplateAuth/HashTest.php | 53 ------------------ tests/Unit/Drivers/TemplateAuth/TokenTest.php | 56 +++++++++++++++++++ tests/Unit/Drivers/TinkoffAuth/AuthTest.php | 4 +- 32 files changed, 245 insertions(+), 160 deletions(-) rename src/Core/src/Exceptions/Internal/{UnknownDriverConfigException.php => ConfigException.php} (90%) rename src/TemplateAuth/src/{Auth.php => Basic.php} (85%) create mode 100644 src/TemplateAuth/src/Hash.php create mode 100644 src/TemplateAuth/src/Tokens/Base.php create mode 100644 src/TemplateAuth/src/Tokens/BasicToken.php rename src/TemplateAuth/src/{Services/Hash.php => Tokens/HashToken.php} (58%) rename src/TinkoffAuth/src/{BasicAuth.php => Basic.php} (97%) rename src/TinkoffAuth/src/{HashAuth.php => Hash.php} (97%) rename tests/Fixtures/Http/Requests/{TemplateAuthRequest.php => TemplateAuthBasicRequest.php} (84%) rename tests/Helpers/Http/{Tinkoff => Template}/template.php (100%) delete mode 100644 tests/Unit/Drivers/TemplateAuth/HashTest.php create mode 100644 tests/Unit/Drivers/TemplateAuth/TokenTest.php diff --git a/composer.json b/composer.json index 49be0e60..aab38d2d 100644 --- a/composer.json +++ b/composer.json @@ -93,7 +93,7 @@ "autoload": { "psr-4": { "Cashbox\\BankName\\Auth\\": "src/TemplateAuth/src/", - "Cashbox\\BankName\\PaymentType\\": "src/TemplateDriver/src/", + "Cashbox\\BankName\\Technology\\": "src/TemplateDriver/src/", "Cashbox\\Cash\\": "src/Cash/src/", "Cashbox\\Core\\": "src/Core/src/", "Cashbox\\Sber\\Auth\\": "src/SberAuth/src/", diff --git a/src/Core/src/Concerns/Config/Payment/Drivers.php b/src/Core/src/Concerns/Config/Payment/Drivers.php index 9602649d..09ba6ad3 100644 --- a/src/Core/src/Concerns/Config/Payment/Drivers.php +++ b/src/Core/src/Concerns/Config/Payment/Drivers.php @@ -18,7 +18,7 @@ namespace Cashbox\Core\Concerns\Config\Payment; use Cashbox\Core\Data\Config\DriverData; -use Cashbox\Core\Exceptions\Internal\UnknownDriverConfigException; +use Cashbox\Core\Exceptions\Internal\ConfigException; use Cashbox\Core\Facades\Config; use Illuminate\Database\Eloquent\Model; @@ -30,13 +30,13 @@ protected static function driver(int|string $name, Model $payment): DriverData return $driver; } - throw new UnknownDriverConfigException($name, $payment->getKey()); + throw new ConfigException($name, $payment->getKey()); } /** * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment * - * @throws \Cashbox\Core\Exceptions\Internal\UnknownDriverConfigException + * @throws \Cashbox\Core\Exceptions\Internal\ConfigException */ protected static function driverByModel(Model $payment): DriverData { @@ -46,6 +46,6 @@ protected static function driverByModel(Model $payment): DriverData return static::driver($name, $payment); } - throw new UnknownDriverConfigException($type, $payment->getKey()); + throw new ConfigException($type, $payment->getKey()); } } diff --git a/src/Core/src/Exceptions/Internal/UnknownDriverConfigException.php b/src/Core/src/Exceptions/Internal/ConfigException.php similarity index 90% rename from src/Core/src/Exceptions/Internal/UnknownDriverConfigException.php rename to src/Core/src/Exceptions/Internal/ConfigException.php index 4a245186..88907fd0 100644 --- a/src/Core/src/Exceptions/Internal/UnknownDriverConfigException.php +++ b/src/Core/src/Exceptions/Internal/ConfigException.php @@ -19,7 +19,7 @@ use Cashbox\Core\Exceptions\BaseException; -class UnknownDriverConfigException extends BaseException +class ConfigException extends BaseException { protected string $reason = 'Driver configuration "%s" for payment ID %s not found.'; } diff --git a/src/TemplateAuth/src/Auth.php b/src/TemplateAuth/src/Basic.php similarity index 85% rename from src/TemplateAuth/src/Auth.php rename to src/TemplateAuth/src/Basic.php index cf4e4a47..9f2480cf 100644 --- a/src/TemplateAuth/src/Auth.php +++ b/src/TemplateAuth/src/Basic.php @@ -18,11 +18,11 @@ namespace Cashbox\BankName\Auth; use Cashbox\BankName\Auth\Constants\Keys; -use Cashbox\BankName\Auth\Services\Hash; +use Cashbox\BankName\Auth\Tokens\BasicToken; use Cashbox\Core\Data\Signing\Token; use Cashbox\Core\Services\Auth as BaseSign; -class Auth extends BaseSign +class Basic extends BaseSign { public function body(): array { @@ -36,7 +36,7 @@ public function body(): array protected function token(): Token { - return Hash::get($this->clientId(), $this->clientSecret(), $this->request->body()); + return BasicToken::get($this->clientId(), $this->clientSecret(), $this->request->body()); } protected function clientId(): string diff --git a/src/TemplateAuth/src/Constants/Keys.php b/src/TemplateAuth/src/Constants/Keys.php index 3ce5b142..0541bf22 100644 --- a/src/TemplateAuth/src/Constants/Keys.php +++ b/src/TemplateAuth/src/Constants/Keys.php @@ -19,7 +19,7 @@ class Keys { - public const PASSWORD = 'password'; - public const TERMINAL = 'terminalId'; - public const TOKEN = 'token'; + public const PASSWORD = 'Password'; + public const TERMINAL = 'TerminalKey'; + public const TOKEN = 'Token'; } diff --git a/src/TemplateAuth/src/Hash.php b/src/TemplateAuth/src/Hash.php new file mode 100644 index 00000000..d7282149 --- /dev/null +++ b/src/TemplateAuth/src/Hash.php @@ -0,0 +1,50 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\BankName\Auth; + +use Cashbox\BankName\Auth\Tokens\HashToken; +use Cashbox\Core\Data\Signing\Token; +use Cashbox\Core\Services\Auth as BaseSign; + +class Hash extends BaseSign +{ + public function headers(): array + { + $token = $this->token(); + + return array_merge($this->request->headers(), [ + 'Authorization' => 'Bearer ' . $token->clientSecret, + 'X-Store-ID' => $token->clientId, + ]); + } + + protected function token(): Token + { + return HashToken::get($this->clientId(), $this->clientSecret(), $this->request->body()); + } + + protected function clientId(): string + { + return $this->config->credentials->clientId; + } + + protected function clientSecret(): string + { + return $this->config->credentials->clientSecret; + } +} diff --git a/src/TemplateAuth/src/Tokens/Base.php b/src/TemplateAuth/src/Tokens/Base.php new file mode 100644 index 00000000..504c2bd3 --- /dev/null +++ b/src/TemplateAuth/src/Tokens/Base.php @@ -0,0 +1,34 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\BankName\Auth\Tokens; + +use Carbon\Carbon; +use Cashbox\Core\Data\Signing\Token; +use DateTimeInterface; + +abstract class Base +{ + abstract public static function get(string $clientId, string $clientSecret, array $data): Token; + + protected static function token(string $clientId, string $clientSecret, ?DateTimeInterface $expiresIn = null): Token + { + $expiresIn ??= Carbon::now()->addDay(); + + return Token::from(compact('clientId', 'clientSecret', 'expiresIn')); + } +} diff --git a/src/TemplateAuth/src/Tokens/BasicToken.php b/src/TemplateAuth/src/Tokens/BasicToken.php new file mode 100644 index 00000000..251e0e16 --- /dev/null +++ b/src/TemplateAuth/src/Tokens/BasicToken.php @@ -0,0 +1,28 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +namespace Cashbox\BankName\Auth\Tokens; + +use Cashbox\Core\Data\Signing\Token; + +class BasicToken extends Base +{ + public static function get(string $clientId, string $clientSecret, array $data): Token + { + return static::token($clientId, $clientSecret); + } +} diff --git a/src/TemplateAuth/src/Services/Hash.php b/src/TemplateAuth/src/Tokens/HashToken.php similarity index 58% rename from src/TemplateAuth/src/Services/Hash.php rename to src/TemplateAuth/src/Tokens/HashToken.php index 1fb300bc..909916ee 100644 --- a/src/TemplateAuth/src/Services/Hash.php +++ b/src/TemplateAuth/src/Tokens/HashToken.php @@ -15,33 +15,19 @@ declare(strict_types=1); -namespace Cashbox\BankName\Auth\Services; +namespace Cashbox\BankName\Auth\Tokens; -use Carbon\Carbon; use Cashbox\BankName\Auth\Constants\Keys; use Cashbox\Core\Data\Signing\Token; -use DateTimeInterface; use DragonCode\Support\Facades\Helpers\Arr; -class Hash +class HashToken extends Base { - public static function get(string $clientId, string $clientSecret, array $data, bool $hash): Token - { - return $hash - ? static::hashed($clientId, $clientSecret, $data) - : static::basic($clientId, $clientSecret); - } - - protected static function basic(string $clientId, string $clientSecret): Token - { - return static::data($clientId, $clientSecret); - } - - protected static function hashed(string $clientId, string $clientSecret, array $data): Token + public static function get(string $clientId, string $clientSecret, array $data): Token { $hash = static::make($clientId, $clientSecret, $data); - return static::data($clientId, $hash); + return static::token($clientId, $hash); } protected static function make(string $clientId, string $clientSecret, array $data): string @@ -61,11 +47,4 @@ protected static function resolve(string $clientId, string $clientSecret, array ->implode('') ->toString(); } - - protected static function data(string $clientId, string $clientSecret, ?DateTimeInterface $expiresIn = null): Token - { - $expiresIn ??= Carbon::now()->addDay(); - - return Token::from(compact('clientId', 'clientSecret', 'expiresIn')); - } } diff --git a/src/TemplateDriver/src/Http/Requests/BaseRequest.php b/src/TemplateDriver/src/Http/Requests/BaseRequest.php index 6520768a..96f73961 100644 --- a/src/TemplateDriver/src/Http/Requests/BaseRequest.php +++ b/src/TemplateDriver/src/Http/Requests/BaseRequest.php @@ -17,10 +17,8 @@ namespace Cashbox\BankName\Technology\Http\Requests; -use Cashbox\BankName\Auth\Auth; use Cashbox\BankName\Technology\Resources\TemplateDriverResource; use Cashbox\Core\Http\Request; -use Cashbox\Core\Services\Auth as BaseSign; /** * @property-read TemplateDriverResource $resource @@ -29,8 +27,6 @@ abstract class BaseRequest extends Request { protected string $productionHost = 'https://example.com'; - protected BaseSign|string|null $auth = Auth::class; - protected function clientId(): string { return $this->resource->config->credentials->clientId; diff --git a/src/TemplateDriver/src/Http/Requests/CancelRequest.php b/src/TemplateDriver/src/Http/Requests/CancelRequest.php index 8e9d0c86..16b104fe 100644 --- a/src/TemplateDriver/src/Http/Requests/CancelRequest.php +++ b/src/TemplateDriver/src/Http/Requests/CancelRequest.php @@ -17,10 +17,15 @@ namespace Cashbox\BankName\Technology\Http\Requests; +use Cashbox\BankName\Auth\Hash; +use Cashbox\Core\Services\Auth; + class CancelRequest extends BaseRequest { protected string $productionUri = '/v1/cancel'; + protected Auth|string|null $auth = Hash::class; + public function body(): array { return [ diff --git a/src/TemplateDriver/src/Http/Requests/CreateRequest.php b/src/TemplateDriver/src/Http/Requests/CreateRequest.php index 28fe5dea..c8f0405a 100644 --- a/src/TemplateDriver/src/Http/Requests/CreateRequest.php +++ b/src/TemplateDriver/src/Http/Requests/CreateRequest.php @@ -17,11 +17,14 @@ namespace Cashbox\BankName\Technology\Http\Requests; +use Cashbox\BankName\Auth\Basic; +use Cashbox\Core\Services\Auth; + class CreateRequest extends BaseRequest { protected string $productionUri = '/v1/init'; - protected bool $secure = false; + protected Auth|string|null $auth = Basic::class; public function body(): array { diff --git a/src/TemplateDriver/src/Http/Requests/GetStateRequest.php b/src/TemplateDriver/src/Http/Requests/GetStateRequest.php index e5ab19df..1f2dbbf5 100644 --- a/src/TemplateDriver/src/Http/Requests/GetStateRequest.php +++ b/src/TemplateDriver/src/Http/Requests/GetStateRequest.php @@ -17,10 +17,15 @@ namespace Cashbox\BankName\Technology\Http\Requests; +use Cashbox\BankName\Auth\Hash; +use Cashbox\Core\Services\Auth; + class GetStateRequest extends BaseRequest { protected string $productionUri = '/v1/state'; + protected Auth|string|null $auth = Hash::class; + public function body(): array { return [ diff --git a/src/TemplateDriver/src/Resources/TemplateDriverResource.php b/src/TemplateDriver/src/Resources/TemplateDriverResource.php index 02eec0a1..03aa8e9d 100644 --- a/src/TemplateDriver/src/Resources/TemplateDriverResource.php +++ b/src/TemplateDriver/src/Resources/TemplateDriverResource.php @@ -23,6 +23,6 @@ abstract class TemplateDriverResource extends Resource { public function someIdentifier(): ?string { - return $this->config->credentials->extra['some_id'] ?? null; + return (string) $this->config->credentials->extra['some_id'] ?? null; } } diff --git a/src/TinkoffAuth/src/BasicAuth.php b/src/TinkoffAuth/src/Basic.php similarity index 97% rename from src/TinkoffAuth/src/BasicAuth.php rename to src/TinkoffAuth/src/Basic.php index 921869bb..b363a308 100644 --- a/src/TinkoffAuth/src/BasicAuth.php +++ b/src/TinkoffAuth/src/Basic.php @@ -22,7 +22,7 @@ use Cashbox\Tinkoff\Auth\Constants\Keys; use Cashbox\Tinkoff\Auth\Tokens\BasicToken; -class BasicAuth extends BaseSign +class Basic extends BaseSign { public function body(): array { diff --git a/src/TinkoffAuth/src/HashAuth.php b/src/TinkoffAuth/src/Hash.php similarity index 97% rename from src/TinkoffAuth/src/HashAuth.php rename to src/TinkoffAuth/src/Hash.php index 45e6d62c..7a7d43ca 100644 --- a/src/TinkoffAuth/src/HashAuth.php +++ b/src/TinkoffAuth/src/Hash.php @@ -22,7 +22,7 @@ use Cashbox\Tinkoff\Auth\Constants\Keys; use Cashbox\Tinkoff\Auth\Tokens\HashToken; -class HashAuth extends BaseSign +class Hash extends BaseSign { public function body(): array { diff --git a/src/TinkoffCredit/src/Http/Requests/BaseRequest.php b/src/TinkoffCredit/src/Http/Requests/BaseRequest.php index f7650ca7..b6ce74c7 100644 --- a/src/TinkoffCredit/src/Http/Requests/BaseRequest.php +++ b/src/TinkoffCredit/src/Http/Requests/BaseRequest.php @@ -19,7 +19,7 @@ use Cashbox\Core\Http\Request; use Cashbox\Core\Services\Auth; -use Cashbox\Tinkoff\Auth\BasicAuth; +use Cashbox\Tinkoff\Auth\Basic; use DragonCode\Support\Facades\Helpers\Str; /** @@ -29,7 +29,7 @@ abstract class BaseRequest extends Request { protected string $productionHost = 'https://forma.tinkoff.ru'; - protected Auth|string|null $auth = BasicAuth::class; + protected Auth|string|null $auth = Basic::class; public function url(): ?string { diff --git a/src/TinkoffOnline/src/Http/Requests/CancelRequest.php b/src/TinkoffOnline/src/Http/Requests/CancelRequest.php index 8417441c..9f55cb59 100644 --- a/src/TinkoffOnline/src/Http/Requests/CancelRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/CancelRequest.php @@ -18,13 +18,13 @@ namespace Cashbox\Tinkoff\Online\Http\Requests; use Cashbox\Core\Services\Auth; -use Cashbox\Tinkoff\Auth\HashAuth; +use Cashbox\Tinkoff\Auth\Hash; class CancelRequest extends BaseRequest { protected string $productionUri = '/v2/Cancel'; - protected Auth|string|null $auth = HashAuth::class; + protected Auth|string|null $auth = Hash::class; public function body(): array { diff --git a/src/TinkoffOnline/src/Http/Requests/CreateRequest.php b/src/TinkoffOnline/src/Http/Requests/CreateRequest.php index 0625b230..772fb344 100644 --- a/src/TinkoffOnline/src/Http/Requests/CreateRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/CreateRequest.php @@ -18,13 +18,13 @@ namespace Cashbox\Tinkoff\Online\Http\Requests; use Cashbox\Core\Services\Auth; -use Cashbox\Tinkoff\Auth\BasicAuth; +use Cashbox\Tinkoff\Auth\Basic; class CreateRequest extends BaseRequest { protected string $productionUri = '/v2/Init'; - protected Auth|string|null $auth = BasicAuth::class; + protected Auth|string|null $auth = Basic::class; public function body(): array { diff --git a/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php b/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php index 035d257e..e1b9bf21 100644 --- a/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php +++ b/src/TinkoffOnline/src/Http/Requests/GetStateRequest.php @@ -18,13 +18,13 @@ namespace Cashbox\Tinkoff\Online\Http\Requests; use Cashbox\Core\Services\Auth; -use Cashbox\Tinkoff\Auth\HashAuth; +use Cashbox\Tinkoff\Auth\Hash; class GetStateRequest extends BaseRequest { protected string $productionUri = '/v2/GetState'; - protected Auth|string|null $auth = HashAuth::class; + protected Auth|string|null $auth = Hash::class; public function body(): array { diff --git a/src/TinkoffQrCode/src/Http/Requests/CancelRequest.php b/src/TinkoffQrCode/src/Http/Requests/CancelRequest.php index c9067beb..6801c185 100644 --- a/src/TinkoffQrCode/src/Http/Requests/CancelRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/CancelRequest.php @@ -18,13 +18,13 @@ namespace Cashbox\Tinkoff\QrCode\Http\Requests; use Cashbox\Core\Services\Auth; -use Cashbox\Tinkoff\Auth\HashAuth; +use Cashbox\Tinkoff\Auth\Hash; class CancelRequest extends BaseRequest { protected string $productionUri = '/v2/Cancel'; - protected Auth|string|null $auth = HashAuth::class; + protected Auth|string|null $auth = Hash::class; public function body(): array { diff --git a/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php b/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php index 103816b2..291ca3dd 100644 --- a/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php @@ -18,13 +18,13 @@ namespace Cashbox\Tinkoff\QrCode\Http\Requests; use Cashbox\Core\Services\Auth; -use Cashbox\Tinkoff\Auth\BasicAuth; +use Cashbox\Tinkoff\Auth\Basic; class CreateRequest extends BaseRequest { protected string $productionUri = '/v2/Init'; - protected Auth|string|null $auth = BasicAuth::class; + protected Auth|string|null $auth = Basic::class; public function body(): array { diff --git a/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php b/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php index 6614cf0f..2aa072fc 100644 --- a/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/GetQrRequest.php @@ -18,13 +18,13 @@ namespace Cashbox\Tinkoff\QrCode\Http\Requests; use Cashbox\Core\Services\Auth; -use Cashbox\Tinkoff\Auth\HashAuth; +use Cashbox\Tinkoff\Auth\Hash; class GetQrRequest extends BaseRequest { protected string $productionUri = '/v2/GetQr'; - protected Auth|string|null $auth = HashAuth::class; + protected Auth|string|null $auth = Hash::class; public function body(): array { diff --git a/src/TinkoffQrCode/src/Http/Requests/GetStateRequest.php b/src/TinkoffQrCode/src/Http/Requests/GetStateRequest.php index f08fb671..cf34707c 100644 --- a/src/TinkoffQrCode/src/Http/Requests/GetStateRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/GetStateRequest.php @@ -18,13 +18,13 @@ namespace Cashbox\Tinkoff\QrCode\Http\Requests; use Cashbox\Core\Services\Auth; -use Cashbox\Tinkoff\Auth\HashAuth; +use Cashbox\Tinkoff\Auth\Hash; class GetStateRequest extends BaseRequest { protected string $productionUri = '/v2/GetState'; - protected Auth|string|null $auth = HashAuth::class; + protected Auth|string|null $auth = Hash::class; public function body(): array { diff --git a/tests/Fixtures/Http/Requests/TemplateAuthRequest.php b/tests/Fixtures/Http/Requests/TemplateAuthBasicRequest.php similarity index 84% rename from tests/Fixtures/Http/Requests/TemplateAuthRequest.php rename to tests/Fixtures/Http/Requests/TemplateAuthBasicRequest.php index 349aa706..1b345e72 100644 --- a/tests/Fixtures/Http/Requests/TemplateAuthRequest.php +++ b/tests/Fixtures/Http/Requests/TemplateAuthBasicRequest.php @@ -17,17 +17,17 @@ namespace Tests\Fixtures\Http\Requests; -use Cashbox\BankName\Auth\Auth as TemplateAuth; +use Cashbox\BankName\Auth\Basic; use Cashbox\Core\Http\Request as BaseRequest; use Cashbox\Core\Services\Auth; -class TemplateAuthRequest extends BaseRequest +class TemplateAuthBasicRequest extends BaseRequest { protected string $productionHost = 'https://example.com'; protected string $productionUri = '/foo'; - protected Auth|string|null $auth = TemplateAuth::class; + protected Auth|string|null $auth = Basic::class; public function body(): array { diff --git a/tests/Helpers/Http/Tinkoff/template.php b/tests/Helpers/Http/Template/template.php similarity index 100% rename from tests/Helpers/Http/Tinkoff/template.php rename to tests/Helpers/Http/Template/template.php diff --git a/tests/Helpers/auth.php b/tests/Helpers/auth.php index 099c614d..fc00fd56 100644 --- a/tests/Helpers/auth.php +++ b/tests/Helpers/auth.php @@ -15,10 +15,12 @@ declare(strict_types=1); +use Cashbox\Core\Http\Request; use Cashbox\Sber\Auth\Auth; use Tests\Fixtures\App\Models\PaymentModel; use Tests\Fixtures\Http\Requests\SberAuthRequest; use Tests\Fixtures\Payments\SberAuth; +use Tests\Fixtures\Payments\TemplateDriver; function sberAuth(PaymentModel $payment): Auth { @@ -33,3 +35,13 @@ function sberAuth(PaymentModel $payment): Auth ] ); } + +function templateAuth(PaymentModel $payment, Auth|string $auth, Request|string $request): Auth +{ + $config = $payment->cashboxDriver()->config; + + return new $auth( + request: new $request(new TemplateDriver($payment, $config)), + config : $config + ); +} diff --git a/tests/TestCase.php b/tests/TestCase.php index 8bdbda74..56f9a42b 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -103,9 +103,7 @@ protected function setUpDrivers(Application $app): void $this->setUpDriver($app, TypeEnum::sberQrCode, TinkoffQrCodeDriver::class, TinkoffQrCode::class); $this->setUpDriver($app, TypeEnum::templateDriver, TemplateDriver::class, TemplateDriverResource::class, [ - 'extra' => [ - 'some_id' => 12345, - ], + 'extra' => ['some_id' => 12345], ]); } diff --git a/tests/Unit/Drivers/TemplateAuth/AuthTest.php b/tests/Unit/Drivers/TemplateAuth/AuthTest.php index 3b004f4e..36afb11e 100644 --- a/tests/Unit/Drivers/TemplateAuth/AuthTest.php +++ b/tests/Unit/Drivers/TemplateAuth/AuthTest.php @@ -15,51 +15,23 @@ declare(strict_types=1); -use Cashbox\BankName\Auth\Auth; +use Cashbox\BankName\Auth\Basic; use Cashbox\BankName\Auth\Constants\Keys; -use Cashbox\Core\Enums\CurrencyEnum; use Tests\Fixtures\App\Enums\TypeEnum; -use Tests\Fixtures\Http\Requests\TemplateAuthRequest; -use Tests\Fixtures\Resources\TemplateAuthResource; +use Tests\Fixtures\Http\Requests\TemplateAuthBasicRequest; -it('clean data', function () { +it('basic authorization', function () { fakeEvents(); + fakeTemplateHttp(); - $payment = createPayment(TypeEnum::templateAuth, 1234); + $payment = createPayment(TypeEnum::templateDriver, 1234); - $request = new TemplateAuthRequest( - new TemplateAuthResource($payment, $payment->cashboxDriver()->config) - ); + $auth = templateAuth($payment, Basic::class, TemplateAuthBasicRequest::class); - expect($request->headers())->toBeEmpty(); - expect($request->options())->toBeEmpty(); + expect($auth->headers())->toBeArray()->toBeEmpty(); + expect($auth->options())->toBeArray()->toBeEmpty(); - expect($request->body())->toBe([ - 'paymentId' => (string) $payment->id, - 'sum' => $payment->price, - 'currency' => CurrencyEnum::USD->value, - ]); -}); - -it('signed data', function () { - fakeEvents(); - - $payment = createPayment(TypeEnum::templateAuth, 1234); - - $request = new TemplateAuthRequest( - new TemplateAuthResource($payment, $payment->cashboxDriver()->config) - ); - - expect($request->sign()->headers())->toBeEmpty(); - expect($request->sign()->options())->toBeEmpty(); - - expect($request->sign())->toBeInstanceOf(Auth::class); - - expect($request->sign()->body())->toBe([ - 'paymentId' => (string) $payment->id, - 'sum' => $payment->price, - 'currency' => CurrencyEnum::USD->value, - Keys::TERMINAL => 'qwerty', - Keys::TOKEN => '57f7acb468d49f49dcaf10c0b193ef8303c84ce5fb35c40b53fea58ed877cb4f', + expect($auth->body())->toBeArray()->toBe([ + Keys::TOKEN => 123, ]); }); diff --git a/tests/Unit/Drivers/TemplateAuth/HashTest.php b/tests/Unit/Drivers/TemplateAuth/HashTest.php deleted file mode 100644 index a69e8324..00000000 --- a/tests/Unit/Drivers/TemplateAuth/HashTest.php +++ /dev/null @@ -1,53 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -use Carbon\Carbon; -use Cashbox\BankName\Auth\Services\Hash; - -it('basic data', function () { - $clientId = 'foo'; - $clientSecret = 'bar'; - - $hashed = Hash::get($clientId, $clientSecret, [ - 'field1' => 'qwe', - 'field2' => 'rty', - 'field3' => 'asd', - ], false); - - expect($hashed->clientId)->toBe($clientId); - expect($hashed->clientSecret)->toBe($clientSecret); - expect($hashed->expiresIn->timestamp)->toBe(Carbon::now()->addDay()->timestamp); -}); - -it('hashed data', function (array $data) { - $clientId = 'foo'; - $clientSecret = 'bar'; - $hash = '7959ae1ec20a02490d8d2f01d3704a2543e70c43cbe0c672209741263ef8048f'; - - $hashed = Hash::get($clientId, $clientSecret, $data, true); - - expect($hashed->clientId)->toBe($clientId); - expect($hashed->clientSecret)->toBe($hash); - expect($hashed->expiresIn->timestamp)->toBe(Carbon::now()->addDay()->timestamp); -})->with([ - [['field1' => 'qwe', 'field2' => 'rty', 'field3' => 'asd']], - [['field1' => 'qwe', 'field3' => 'asd', 'field2' => 'rty']], - [['field2' => 'rty', 'field1' => 'qwe', 'field3' => 'asd']], - [['field2' => 'rty', 'field3' => 'asd', 'field1' => 'qwe']], - [['field3' => 'asd', 'field1' => 'qwe', 'field2' => 'rty']], - [['field3' => 'asd', 'field2' => 'rty', 'field1' => 'qwe']], -]); diff --git a/tests/Unit/Drivers/TemplateAuth/TokenTest.php b/tests/Unit/Drivers/TemplateAuth/TokenTest.php new file mode 100644 index 00000000..e982fb0d --- /dev/null +++ b/tests/Unit/Drivers/TemplateAuth/TokenTest.php @@ -0,0 +1,56 @@ + + * @copyright 2023 Andrey Helldar + * @license MIT + * + * @see https://cashbox.city + */ + +declare(strict_types=1); + +use Cashbox\BankName\Auth\Tokens\BasicToken; +use Cashbox\BankName\Auth\Tokens\HashToken; + +it('base signature', function (array $data) { + $clientId = 'foo'; + $clientSecret = 'bar'; + + $token = BasicToken::get($clientId, $clientSecret, $data); + + expect($token->clientId)->toBe($clientId); + expect($token->clientSecret)->toBe($clientSecret); + expect($token->expiresIn)->toBeInstanceOf(DateTimeInterface::class); +})->with([ + [['field1' => 'qwe', 'field2' => 'rty', 'field3' => 'asd']], + [['field1' => 'qwe', 'field3' => 'asd', 'field2' => 'rty']], + [['field2' => 'rty', 'field1' => 'qwe', 'field3' => 'asd']], + [['field2' => 'rty', 'field3' => 'asd', 'field1' => 'qwe']], + [['field3' => 'asd', 'field1' => 'qwe', 'field2' => 'rty']], + [['field3' => 'asd', 'field2' => 'rty', 'field1' => 'qwe']], +]); + +it('hashed signature', function (array $data) { + $clientId = 'foo'; + $clientSecret = 'bar'; + $hash = '7959ae1ec20a02490d8d2f01d3704a2543e70c43cbe0c672209741263ef8048f'; + + $token = HashToken::get($clientId, $clientSecret, $data); + + expect($token->clientId)->toBe($clientId); + expect($token->clientSecret)->toBe($hash); + expect($token->expiresIn)->toBeInstanceOf(DateTimeInterface::class); +})->with([ + [['field1' => 'qwe', 'field2' => 'rty', 'field3' => 'asd']], + [['field1' => 'qwe', 'field3' => 'asd', 'field2' => 'rty']], + [['field2' => 'rty', 'field1' => 'qwe', 'field3' => 'asd']], + [['field2' => 'rty', 'field3' => 'asd', 'field1' => 'qwe']], + [['field3' => 'asd', 'field1' => 'qwe', 'field2' => 'rty']], + [['field3' => 'asd', 'field2' => 'rty', 'field1' => 'qwe']], +]); diff --git a/tests/Unit/Drivers/TinkoffAuth/AuthTest.php b/tests/Unit/Drivers/TinkoffAuth/AuthTest.php index fcfa9018..5c5f3ee3 100644 --- a/tests/Unit/Drivers/TinkoffAuth/AuthTest.php +++ b/tests/Unit/Drivers/TinkoffAuth/AuthTest.php @@ -15,7 +15,7 @@ declare(strict_types=1); -use Cashbox\Tinkoff\Auth\BasicAuth; +use Cashbox\Tinkoff\Auth\Basic; use Cashbox\Tinkoff\Auth\Constants\Keys; use Cashbox\Tinkoff\Auth\Tokens\HashToken; @@ -30,7 +30,7 @@ 'some2' => 'foo2', ]; - $auth = new BasicAuth($request); + $auth = new Basic($request); expect($auth->headers())->toBeArray()->toBeEmpty(); expect($auth->options())->toBeArray()->toBeEmpty(); From a533dcf8ee23062dc1602cc2f2e2b0a21470c3e3 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Sun, 10 Sep 2023 01:49:27 +0300 Subject: [PATCH 155/164] Fixed tests --- tests/TestCase.php | 19 +++++++++---------- tests/Unit/Core/Facades/ConfigTest.php | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/TestCase.php b/tests/TestCase.php index 56f9a42b..d1d6515d 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -91,7 +91,7 @@ protected function setUpStatuses(Application $app): void protected function setUpDrivers(Application $app): void { - $this->setUpDriver($app, TypeEnum::cash, CashDriver::class, Cash::class); + $this->setUpDriver($app, TypeEnum::cash, CashDriver::class, Cash::class, null); $this->setUpDriver($app, TypeEnum::tinkoffOnline, TinkoffOnlineDriver::class, TinkoffOnline::class); $this->setUpDriver($app, TypeEnum::tinkoffQrCode, TinkoffQrCodeDriver::class, TinkoffQrCode::class); @@ -112,17 +112,16 @@ protected function setUpDriver( TypeEnum $type, string $driver, string $resource, - array $credentials = [] + ?array $credentials = [] ): void { - $app['config']->set('cashbox.payment.drivers.' . $type->value, $type); - - $app['config']->set('cashbox.drivers.' . $type->value, [ - 'driver' => $driver, - 'resource' => $resource, - 'credentials' => array_merge([ + if (! is_null($credentials)) { + $credentials = array_merge([ 'client_id' => 'qwerty', 'client_secret' => 'qwerty123', - ], $credentials), - ]); + ], $credentials); + } + + $app['config']->set('cashbox.payment.drivers.' . $type->value, $type); + $app['config']->set('cashbox.drivers.' . $type->value, compact('driver', 'resource', 'credentials')); } } diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 5e628a74..5eaaa126 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -60,12 +60,12 @@ expect($data->status->failed)->toBe(StatusEnum::failed); expect($data->drivers)->toBeArray(); - expect($data->drivers)->toBe([ + expect($data->drivers)->toMatchArray([ TypeEnum::cash() => TypeEnum::cash, + TypeEnum::sberQrCode() => TypeEnum::sberQrCode, TypeEnum::tinkoffCredit() => TypeEnum::tinkoffCredit, TypeEnum::tinkoffOnline() => TypeEnum::tinkoffOnline, TypeEnum::tinkoffQrCode() => TypeEnum::tinkoffQrCode, - TypeEnum::sberQrCode() => TypeEnum::sberQrCode, ]); }); From f8ccbe2dc21905a527708840190f657fddb015e6 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Tue, 5 Dec 2023 18:21:15 +0300 Subject: [PATCH 156/164] Upgrade documentation skeleton --- .gitattributes | 1 + .github/FUNDING.yml | 3 - .github/workflows/documentation.yml | 138 ++++++++++++++++++ .github/workflows/tests.yml | 57 ++++++++ docs/.env.example | 3 - docs/.github/FUNDING.yml | 3 - docs/.github/dependabot.yml | 7 - docs/.github/workflows/close-pull-request.yml | 13 -- docs/.github/workflows/docs.yml | 42 ------ docs/.gitignore | 18 --- docs/LICENSE | 21 --- docs/README.md | 55 ------- docs/c.list | 6 + docs/cashbox.tree | 13 ++ docs/cfg/buildprofiles.xml | 50 +++++++ docs/docs/.vuepress/.gitignore | 4 - docs/docs/.vuepress/config.js | 82 ----------- docs/docs/.vuepress/public/CNAME | 1 - .../public/fonts/Nunito-SemiBold.woff2 | Bin 56088 -> 0 bytes docs/docs/.vuepress/public/images/logo.svg | 51 ------- .../.vuepress/public/images/social-logo.png | Bin 27469 -> 0 bytes docs/docs/.vuepress/styles/_fonts.scss | 67 --------- docs/docs/.vuepress/styles/index.scss | 75 ---------- docs/docs/index.md | 25 ---- docs/docs/license.md | 21 --- docs/package.json | 32 ---- docs/topics/introduction.topic | 56 +++++++ docs/topics/license.topic | 42 ++++++ docs/topics/snippets-library.topic | 22 +++ docs/v.list | 10 ++ docs/versions.json | 7 + docs/writerside.cfg | 9 ++ split.json | 6 - 33 files changed, 411 insertions(+), 529 deletions(-) delete mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/documentation.yml delete mode 100644 docs/.env.example delete mode 100644 docs/.github/FUNDING.yml delete mode 100644 docs/.github/dependabot.yml delete mode 100644 docs/.github/workflows/close-pull-request.yml delete mode 100644 docs/.github/workflows/docs.yml delete mode 100644 docs/.gitignore delete mode 100644 docs/LICENSE delete mode 100644 docs/README.md create mode 100644 docs/c.list create mode 100644 docs/cashbox.tree create mode 100644 docs/cfg/buildprofiles.xml delete mode 100644 docs/docs/.vuepress/.gitignore delete mode 100644 docs/docs/.vuepress/config.js delete mode 100644 docs/docs/.vuepress/public/CNAME delete mode 100644 docs/docs/.vuepress/public/fonts/Nunito-SemiBold.woff2 delete mode 100644 docs/docs/.vuepress/public/images/logo.svg delete mode 100644 docs/docs/.vuepress/public/images/social-logo.png delete mode 100644 docs/docs/.vuepress/styles/_fonts.scss delete mode 100644 docs/docs/.vuepress/styles/index.scss delete mode 100644 docs/docs/index.md delete mode 100644 docs/docs/license.md delete mode 100644 docs/package.json create mode 100644 docs/topics/introduction.topic create mode 100644 docs/topics/license.topic create mode 100644 docs/topics/snippets-library.topic create mode 100644 docs/v.list create mode 100644 docs/versions.json create mode 100644 docs/writerside.cfg diff --git a/.gitattributes b/.gitattributes index 52c63e07..c8456883 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,6 +5,7 @@ .requests/ export-ignore .run/ export-ignore +docs/ export-ignore tests/ export-ignore .gitattributes export-ignore diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index a74abc9a..00000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -github: TheDragonCode -open_collective: dragon-code -custom: [ "https://boosty.to/dragon-code", "https://yoomoney.ru/to/410012608840929" ] diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 00000000..b06a3ab3 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,138 @@ +name: Documentation + +on: + push: + branches: + - main + - 4.x + workflow_dispatch: + +permissions: + id-token: write + pages: write + +env: + ARTIFACT: webHelpCASHBOX2-all.zip + CONFIG_JSON_PRODUCT: CASHBOX + CONFIG_JSON_VERSION: 4.x + INSTANCE: docs/cashbox + DOMAIN_NAME: cashbox.city + BUILDER_VERSION: 232.10275 + +jobs: + build: + name: Build Application + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, simplexml + coverage: xdebug + + - name: Configure git + run: git config --global --add safe.directory /github/workspace + + - name: Install dependencies + run: composer update --no-progress --no-interaction + + - name: Build documentation + uses: JetBrains/writerside-github-action@v4 + with: + instance: ${{ env.INSTANCE }} + artifact: ${{ env.ARTIFACT }} + docker-version: ${{ env.BUILDER_VERSION }} + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: docs + path: | + artifacts/${{ env.ARTIFACT }} + artifacts/report.json + retention-days: 7 + + test: + needs: build + name: Testing + runs-on: ubuntu-latest + + steps: + - name: Download docs artifact + uses: actions/download-artifact@v3 + with: + name: docs + path: artifacts + + - name: Test documentation + uses: JetBrains/writerside-checker-action@v1 + with: + instance: ${{ env.INSTANCE }} + + robots: + needs: build + name: Generate robots.txt + runs-on: ubuntu-latest + + steps: + - name: Create robots.txt + run: | + touch robots.txt + echo "User-Agent: *" >> robots.txt + echo "Disallow: " >> robots.txt + echo "Host: https://${{ env.DOMAIN_NAME }}" >> robots.txt + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: robots + path: robots.txt + retention-days: 7 + + deploy-pages: + environment: + name: deploy + url: ${{ steps.deployment.outputs.page_url }} + + needs: + - test + - robots + + name: Deploy to Pages + runs-on: ubuntu-latest + + steps: + - name: Download docs artifact + uses: actions/download-artifact@v3 + with: + name: docs + + - name: Download robots artifact + uses: actions/download-artifact@v3 + with: + name: robots + + - name: Unzip artifact + uses: montudor/action-zip@v1 + with: + args: unzip -qq ${{ env.ARTIFACT }} -d dir + + - name: Move robots + run: | + sudo mv robots.txt dir/robots.txt + + - name: Setup Pages + uses: actions/configure-pages@v3 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: dir + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7fc53665..7106f128 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,6 +2,13 @@ name: Tests on: [ push, pull_request ] +permissions: read-all + +env: + INSTANCE: docs/cashbox + ARTIFACT: webHelpCASHBOX2-all.zip + BUILDER_VERSION: 232.10275 + jobs: linux: runs-on: ubuntu-latest @@ -91,3 +98,53 @@ jobs: DB_CONNECTION: mysql DB_USERNAME: root DB_PORT: ${{ job.services.mysql.ports[3306] }} + + documentation_build: + name: Build Documentation + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, simplexml + coverage: xdebug + + - name: Configure git + run: git config --global --add safe.directory /github/workspace + + - name: Build documentation + uses: JetBrains/writerside-github-action@v4 + with: + instance: ${{ env.INSTANCE }} + artifact: ${{ env.ARTIFACT }} + docker-version: ${{ env.BUILDER_VERSION }} + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: docs + path: | + artifacts/${{ env.ARTIFACT }} + artifacts/report.json + retention-days: 7 + + documentation_test: + needs: build + name: Test Documentation + runs-on: ubuntu-latest + + steps: + - name: Download docs artifact + uses: actions/download-artifact@v3 + with: + name: docs + path: artifacts + + - name: Test documentation + uses: JetBrains/writerside-checker-action@v1 + with: + instance: ${{ env.INSTANCE }} diff --git a/docs/.env.example b/docs/.env.example deleted file mode 100644 index a98ecdbc..00000000 --- a/docs/.env.example +++ /dev/null @@ -1,3 +0,0 @@ -VITE_APP_ALGOLIA_APP_ID= -VITE_APP_ALGOLIA_API_KEY= -VITE_APP_ALGOLIA_INDEX_NAME= diff --git a/docs/.github/FUNDING.yml b/docs/.github/FUNDING.yml deleted file mode 100644 index a74abc9a..00000000 --- a/docs/.github/FUNDING.yml +++ /dev/null @@ -1,3 +0,0 @@ -github: TheDragonCode -open_collective: dragon-code -custom: [ "https://boosty.to/dragon-code", "https://yoomoney.ru/to/410012608840929" ] diff --git a/docs/.github/dependabot.yml b/docs/.github/dependabot.yml deleted file mode 100644 index d20ffd05..00000000 --- a/docs/.github/dependabot.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 -updates: - - - package-ecosystem: github-actions - directory: / - schedule: - interval: daily diff --git a/docs/.github/workflows/close-pull-request.yml b/docs/.github/workflows/close-pull-request.yml deleted file mode 100644 index de0bb421..00000000 --- a/docs/.github/workflows/close-pull-request.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Close Pull Request - -on: - pull_request_target: - types: [ opened ] - -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: "Thank you for your pull request. However, you have submitted this PR on the Cashbox for Laravel organization which is a read-only sub split of `cashbox/foundation`. Please submit your PR on the https://github.com/cashbox-laravel/foundation repository.

Thanks!" diff --git a/docs/.github/workflows/docs.yml b/docs/.github/workflows/docs.yml deleted file mode 100644 index 3f94b99e..00000000 --- a/docs/.github/workflows/docs.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Documentation - -on: - push: - branches: - - main - workflow_dispatch: - -permissions: write-all - -jobs: - generate: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - token: ${{ secrets.COMPOSER_TOKEN }} - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 20 - - - name: Install dependencies - run: npm i - - - name: Build VuePress site - run: npm run build - env: - VITE_APP_ALGOLIA_APP_ID: ${{ secrets.VITE_APP_ALGOLIA_APP_ID }} - VITE_APP_ALGOLIA_API_KEY: ${{ secrets.VITE_APP_ALGOLIA_API_KEY }} - VITE_APP_ALGOLIA_INDEX_NAME: ${{ secrets.VITE_APP_ALGOLIA_INDEX_NAME }} - - - name: Deploy to GitHub Pages - uses: crazy-max/ghaction-github-pages@v3.1.0 - with: - target_branch: gh-pages - build_dir: docs/.vuepress/dist - env: - GITHUB_TOKEN: ${{ secrets.COMPOSER_TOKEN }} diff --git a/docs/.gitignore b/docs/.gitignore deleted file mode 100644 index 501000fe..00000000 --- a/docs/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -.idea/ -_site/ - -build/ -node_modules/ -tmp/ -vendor/ - -.DS_Store -.env -.temp - -*.bak -*.cache -*.clover -*.orig - -package-lock.json diff --git a/docs/LICENSE b/docs/LICENSE deleted file mode 100644 index 740b9cdd..00000000 --- a/docs/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Andrey Helldar - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index 7404cf31..00000000 --- a/docs/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# Cashbox Documentation - -![cashbox documentation](https://preview.dragon-code.pro/cashbox/documentation.svg?brand=laravel) - -[![Stable Version][badge_stable]][link_packagist] -[![Unstable Version][badge_unstable]][link_packagist] -[![Total Downloads][badge_downloads]][link_packagist] -[![License][badge_license]][link_license] - -> Attention -> -> The project is in a state of global upgrade and some links may not be correct. - -## About Cashbox - -`Cashbox` provides an expressive and user-friendly interface for managing billing and payment verification services. -We believe that development should be an enjoyable, creative experience to be truly rewarding. -`Cashbox` tries to ease development by simplifying the tasks of adding payment systems to a web application. - -The project contains some ready-made solutions of payment systems, but you can offer your own. - -## Documentation - -You will find full documentation on the dedicated [documentation](https://cashbox.city) site. - -## Contributing - -Thank you for considering contributing to the `Cashbox`! -The contribution guide can be found in the [Cashbox documentation](https://cashbox.city). - -## Code of Conduct - -In order to ensure that the `Cashbox` community is welcoming to all, please review and abide by -the [Code of Conduct](https://cashbox.city). - -## Security Vulnerabilities - -Please review [our security policy](https://cashbox.city) on how to report security vulnerabilities. - -## License - -The Cashbox for Laravel is open-source software that works in conjunction with -the [Laravel framework](https://laravel.com/), distributed under the MIT license. - -[badge_downloads]: https://img.shields.io/packagist/dt/cashbox/cash.svg?style=flat-square - -[badge_license]: https://img.shields.io/packagist/l/cashbox/foundation.svg?style=flat-square - -[badge_stable]: https://img.shields.io/github/v/release/cashbox/foundation?label=stable&style=flat-square - -[badge_unstable]: https://img.shields.io/badge/unstable-dev--main-orange?style=flat-square - -[link_license]: LICENSE - -[link_packagist]: https://packagist.org/packages/cashbox/foundation diff --git a/docs/c.list b/docs/c.list new file mode 100644 index 00000000..ca56a40c --- /dev/null +++ b/docs/c.list @@ -0,0 +1,6 @@ + + + + + diff --git a/docs/cashbox.tree b/docs/cashbox.tree new file mode 100644 index 00000000..714e3cff --- /dev/null +++ b/docs/cashbox.tree @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/docs/cfg/buildprofiles.xml b/docs/cfg/buildprofiles.xml new file mode 100644 index 00000000..3f327cc9 --- /dev/null +++ b/docs/cfg/buildprofiles.xml @@ -0,0 +1,50 @@ + + + + + true + + en_US + + frozen + https://cashbox.city + true + + https://github.com/cashbox-laravel/docs/edit/main/docs/ + + + + + + https://raw.githubusercontent.com/cashbox-laravel/docs/main/versions.json + + + + + false + + +
+ + GitHub + + + Issues + + + Discussions + +
+
diff --git a/docs/docs/.vuepress/.gitignore b/docs/docs/.vuepress/.gitignore deleted file mode 100644 index 1d57eb52..00000000 --- a/docs/docs/.vuepress/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.cache/ -.temp/ - -dist/ diff --git a/docs/docs/.vuepress/config.js b/docs/docs/.vuepress/config.js deleted file mode 100644 index b7885c9c..00000000 --- a/docs/docs/.vuepress/config.js +++ /dev/null @@ -1,82 +0,0 @@ - -/** - * This file is part of the "cashbox/foundation" project. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * @author Andrey Helldar - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -import dotenv from 'dotenv' - -import { defaultTheme, viteBundler } from 'vuepress' -import { docsearchPlugin } from '@vuepress/plugin-docsearch' -import { containerPlugin } from '@vuepress/plugin-container' -import { githubLinkifyPlugin } from 'vuepress-plugin-github-linkify' - -dotenv.config() - -const hostname = 'cashbox.com' - -module.exports = { - lang: 'en-US', - title: 'Cashbox for Laravel', - description: 'Cashier provides an expressive, fluent interface to manage billing services', - - head: [ - ['link', { rel: 'icon', href: `https://${ hostname }/images/logo.svg` }], - ['meta', { name: 'twitter:image', content: `https://${ hostname }/images/social-logo.png` }] - ], - - bundler: viteBundler(), - - theme: defaultTheme({ - hostname, - base: '/', - - logo: `https://${ hostname }/images/logo.svg`, - - repo: 'https://github.com/cashbox-laravel/foundation', - repoLabel: 'GitHub', - docsRepo: 'https://github.com/cashbox-laravel/foundation', - docsBranch: 'main', - docsDir: 'docs', - - contributors: false, - editLink: true, - - navbar: [ - '/index.md' - ], - - sidebarDepth: 1, - - sidebar: [ - { - text: 'License', - link: '/license.md' - } - ] - }), - - plugins: [ - docsearchPlugin({ - appId: process.env.VITE_APP_ALGOLIA_APP_ID, - apiKey: process.env.VITE_APP_ALGOLIA_API_KEY, - indexName: process.env.VITE_APP_ALGOLIA_INDEX_NAME - }), - - containerPlugin({ - type: 'tip' - }), - - githubLinkifyPlugin({ - repo: 'Laravel-Lang/common' - }) - ] -} diff --git a/docs/docs/.vuepress/public/CNAME b/docs/docs/.vuepress/public/CNAME deleted file mode 100644 index 16865d60..00000000 --- a/docs/docs/.vuepress/public/CNAME +++ /dev/null @@ -1 +0,0 @@ -cashbox.city diff --git a/docs/docs/.vuepress/public/fonts/Nunito-SemiBold.woff2 b/docs/docs/.vuepress/public/fonts/Nunito-SemiBold.woff2 deleted file mode 100644 index 0f41dd933127d332e2837a8a2e03a846b32c8b6e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 56088 zcma&Nb95&#^EdjfZ5vzLwr$(CZQHint!>-3-L0){`|k6@d++`4e$FJB;3PS7P9~E{ z;w~@71ONj3!xkn0`CkH@jtKy4*8F$bf6D*A;1?59k;TOhw8IJdqlMc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Ul^p+hNjIh}f#VTxewNl!wlEcB3yCu5(Zh2}V^ReT!t za#d*!md2q_qN%zhi*!ifJ`|gNVG2oTCP{nUF`Nn&v8l%ZzVjfZ@|~emDIqCp6p?(; zeI}b5Y4th~0#IWBg^{6aUHRFfw^`?1W=SL%6oS|LzW6#VE=JAqYFduusX~XD)5Ay| zYe#~eAJ@zv0)`bsNrV+M`DA8%pRb7t+A`r}A@}d?>R6VY>IN}ib3|@z*PBy${Dt)J zZ_$I;@XUVr;x~ArX%Jo2P)&8)djj1oc_33C-Hc-qKXLg;c>`rRdA5ICgm0W6CD#rQ zq70++$ARpcd?0ESKuH&C-B?}}KL$RzVbObaP3oMdPt0opkJ-^OXP-Gw$%*`D>|y}z gjqR*0o4SgseVt6LcWWp<{=)47QM)p^0+4|J0gU^|Q2+n{ diff --git a/docs/docs/.vuepress/public/images/logo.svg b/docs/docs/.vuepress/public/images/logo.svg deleted file mode 100644 index e32fb63e..00000000 --- a/docs/docs/.vuepress/public/images/logo.svg +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - diff --git a/docs/docs/.vuepress/public/images/social-logo.png b/docs/docs/.vuepress/public/images/social-logo.png deleted file mode 100644 index bb80b63fa0f3956fea64284a933b2249819dcfa8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27469 zcmeFZX*`tg+Xp;DQVH#fM9G#=WXo1m%33M1Do`4lLfhn1$^i}*I0zXoOWF}bNY&(0DzuT$Xgi z)X^nR`;~rHR-13fvQnOcMys#!)p#M%4hu4419&M6xnT)G<%a$Rdnm-R7y5j*X~Qw- zQ*iqxYv}XTp=~(m6M04u35Wji=oE|<`rL5`wh{U~%mUvEeV*U&e+&Gd4F12;g8^du zg`dS&eQrm2jxJaM#XGzisM+zWmQwSh7Z^#G-QtF52x2={;{o>zfvPsE%|LUv0?qyW zy(K%%phUgAOI?4XE8{AH1E_HCb{uS*^vYuWOLnhWDjGj5Xl@`uYV;@Yc`U!CMzS)rl*aA6zq5Ya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*Cc)ps_fmSZAvqBM%bGD%48l_VUeZsKx&I51GAk!x%YQ3rv=@(hAl z&BGc-Od|5EU{8Vn3sn{BW(&rD^M5nL5leu;{qKC;lJpe>C-y8={8prOU8;)If0V&K z^u34YT;ncg9E-lq3lTuH&7J>|OEwc9hdq>qHi&yV0m(D?yQf5vkuou+qF=W|I-r~y zMqOPAOVT*zg(ap>zhP7Loqr|-*3Itnp2HjpurGJr90P0F>PSF841qC+vnZEi^fkP~ zi7um5c7J=Y{sDVa9>?PJ%l;K$zQq`Gp?E^6H6U~Savu#^h4g-6xAd)(ehh=Kp?VB3 z?uCD9Kwpu-2Rb$5WNUEAN}^J%E8k#vTX}F}{zrWV;x_>}ZG*nP-B@S#-BA(f1K!}B z?YLx^CufzG3a8Wg@%MxvKMepBQ!oM>)0a34iwV9Vl-?~x?~;fM&gQ{R0Cbx372gq3 zV_gg@zSQ0D{3gh2x(Af{43s^q$3;0cMTzy7R0G6=Jp-K`LvBHa`#}ZIQU&c_M#xbw z0;K_av>F9JpFr6TWrK;i;ll0Tl0fL4d;7bKg;@*Z-);d3-U2A`wLzX05||s4sk*`o1pxz}@S~IjGjXvTH`xr3 zS>Gl=W`VDv&Q1cGOiyV<%8uWE5z0{RouMqwzPagN9t;_FT4H$`2$7NA-DYRVUU%iD zlD0~1BKTPfaDavvfH_>p>!#kn6mLb?CiOBZp(k!2c9f#w&W)OCrDo=^Hq_9 z?6tStaPN=ecVqP*2u>v{Y7X=qz!*SJe8EcAf&PBpZRC5|NS4R?5N2A diff --git a/docs/docs/.vuepress/styles/_fonts.scss b/docs/docs/.vuepress/styles/_fonts.scss deleted file mode 100644 index fdda966d..00000000 --- a/docs/docs/.vuepress/styles/_fonts.scss +++ /dev/null @@ -1,67 +0,0 @@ - -/*!* - * This file is part of the "cashbox/foundation" project. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * @author Andrey Helldar - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - - -/*!* - * This file is part of the "cashbox/foundation" project. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * @author Andrey Helldar - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - - -/*!* - * This file is part of the "cashbox/foundation" project. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * @author Andrey Helldar - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - - -/*!* - * This file is part of the "cashbox/foundation" project. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * @author Andrey Helldar - * - * @copyright 2023 Andrey Helldar - * - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -@charset "UTF-8"; - -@font-face { - font-family: 'Nunito'; - src: local('Nunito'), url(/fonts/Nunito-SemiBold.woff2) format('woff2'); - font-weight: 600; - font-style: normal; - font-display: swap; -} diff --git a/docs/docs/.vuepress/styles/index.scss b/docs/docs/.vuepress/styles/index.scss deleted file mode 100644 index a141d1d9..00000000 --- a/docs/docs/.vuepress/styles/index.scss +++ /dev/null @@ -1,75 +0,0 @@ - -/*!* - * This file is part of the "cashbox/foundation" project. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * @author Andrey Helldar - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - - -/*!* - * This file is part of the "cashbox/foundation" project. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * @author Andrey Helldar - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - - -/*!* - * This file is part of the "cashbox/foundation" project. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * @author Andrey Helldar - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - - -/*!* - * This file is part of the "cashbox/foundation" project. - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - * - * @author Andrey Helldar - * - * @copyright 2023 Andrey Helldar - * - * @license MIT - * - * @see https://github.com/cashbox-laravel/foundation - */ - -@charset "UTF-8"; - -@import "fonts"; - -:root { - --content-width: 75%; - - @media only screen and (min-width: 1921px) { - --content-width: 1600px; - } -} - -.code-group { - &__nav-tab { - font-family: Nunito, system-ui, sans-serif; - } -} diff --git a/docs/docs/index.md b/docs/docs/index.md deleted file mode 100644 index 7769c076..00000000 --- a/docs/docs/index.md +++ /dev/null @@ -1,25 +0,0 @@ -# Cashbox Documentation - -![cashbox documentation](https://preview.dragon-code.pro/cashbox/documentation.svg?brand=laravel) - -[![Stable Version][badge_stable]][link_packagist] -[![Unstable Version][badge_unstable]][link_packagist] -[![Total Downloads][badge_downloads]][link_packagist] -[![License][badge_license]][link_license] - -> The project is undergoing a global upgrade. -> -> We will soon release version 4.0 for all our products 💪 - - -[badge_downloads]: https://img.shields.io/packagist/dt/cashbox/core.svg?style=flat-square - -[badge_license]: https://img.shields.io/packagist/l/cashbox/foundation.svg?style=flat-square - -[badge_stable]: https://img.shields.io/github/v/release/cashbox/foundation?label=stable&style=flat-square - -[badge_unstable]: https://img.shields.io/badge/unstable-dev--main-orange?style=flat-square - -[link_license]: license.md - -[link_packagist]: https://packagist.org/packages/cashbox/core diff --git a/docs/docs/license.md b/docs/docs/license.md deleted file mode 100644 index d62c7028..00000000 --- a/docs/docs/license.md +++ /dev/null @@ -1,21 +0,0 @@ -# MIT License - -Copyright (c) 2023 Andrey Helldar - -> Permission is hereby granted, free of charge, to any person obtaining a copy -> of this software and associated documentation files (the "Software"), to deal -> in the Software without restriction, including without limitation the rights -> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -> copies of the Software, and to permit persons to whom the Software is -> furnished to do so, subject to the following conditions: -> -> The above copyright notice and this permission notice shall be included in -> all copies or substantial portions of the Software. -> -> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -> THE SOFTWARE. diff --git a/docs/package.json b/docs/package.json deleted file mode 100644 index 475c0bd9..00000000 --- a/docs/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "docs", - "version": "1.0.0", - "description": "Easily connect the necessary language packs to the application", - "author": "Andrey Helldar", - "license": "MIT", - "homepage": "https://cashbox.com", - "bugs": { - "url": "https://github.com/cashbox-laravel/foundation/issues" - }, - "scripts": { - "dev": "vuepress dev docs --debug", - "build": "vuepress build docs" - }, - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/cashbox-laravel/foundation.git" - }, - "keywords": [ - "docs" - ], - "devDependencies": { - "@vuepress/plugin-container": "2.0.0-beta.64", - "@vuepress/plugin-docsearch": "2.0.0-beta.64", - "dotenv": "^15.0.0", - "vuepress": "2.0.0-beta.64", - "vuepress-plugin-github-linkify": "^1.2.3" - }, - "engines": { - "node": ">=20.4" - } -} diff --git a/docs/topics/introduction.topic b/docs/topics/introduction.topic new file mode 100644 index 00000000..d41258f1 --- /dev/null +++ b/docs/topics/introduction.topic @@ -0,0 +1,56 @@ + + + + + + + +

+ %instance% +

+

+ Downloads + Stable + Unstable + License +

+ +

+ The project is undergoing a global upgrade. +

+

+ We will soon release version 4.0 for all our products 💪 +

+
+

+ %instance% + provides an expressive and user-friendly interface for managing billing and payment verification services. + We believe that development should be an enjoyable, creative experience to be truly rewarding. + %instance% + tries to ease development by simplifying the tasks of adding payment systems to a web application. +

+

+ This project contains some ready-made solutions of payment systems, but you can offer your own. +

+ +
diff --git a/docs/topics/license.topic b/docs/topics/license.topic new file mode 100644 index 00000000..7b453283 --- /dev/null +++ b/docs/topics/license.topic @@ -0,0 +1,42 @@ + + + + + + +

+ Copyright (c) %year% %author-name% +

+

+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + documentation files (the “Software”), to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +

+

+ The above copyright notice and this permission notice shall be included in all copies or substantial portions + of the Software. +

+

+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED + TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +

+
diff --git a/docs/topics/snippets-library.topic b/docs/topics/snippets-library.topic new file mode 100644 index 00000000..03647fac --- /dev/null +++ b/docs/topics/snippets-library.topic @@ -0,0 +1,22 @@ + + + + + +
  • Cash
  • +
  • ◻️ Sber Auth
  • +
  • ◻️ Sber QR
  • +
  • Tinkoff QR
  • +
  • Tinkoff Online
  • +
  • Tinkoff Credit
  • +
  • Tinkoff Auth
  • +
  • ◻️ Template Driver
  • +
  • Template Driver Auth
  • +
    +
    +
    diff --git a/docs/v.list b/docs/v.list new file mode 100644 index 00000000..1e029094 --- /dev/null +++ b/docs/v.list @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/docs/versions.json b/docs/versions.json new file mode 100644 index 00000000..07e7a6f7 --- /dev/null +++ b/docs/versions.json @@ -0,0 +1,7 @@ +[ + { + "version": "4.x", + "url": "/", + "isCurrent": true + } +] diff --git a/docs/writerside.cfg b/docs/writerside.cfg new file mode 100644 index 00000000..d6cfcffa --- /dev/null +++ b/docs/writerside.cfg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/split.json b/split.json index 75f38b8f..213c899b 100644 --- a/split.json +++ b/split.json @@ -1,11 +1,5 @@ { "sub-splits": [ - { - "name": "docs", - "directory": "docs", - "target": "git@github.com:cashbox-laravel/docs.git", - "release": false - }, { "name": "core", "directory": "src/Core", From 289e2ae5d6610efc8d1ddaad518bb0125b52ec66 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Tue, 5 Dec 2023 18:31:02 +0300 Subject: [PATCH 157/164] Update version.json link --- docs/cfg/buildprofiles.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cfg/buildprofiles.xml b/docs/cfg/buildprofiles.xml index 3f327cc9..c0115566 100644 --- a/docs/cfg/buildprofiles.xml +++ b/docs/cfg/buildprofiles.xml @@ -28,7 +28,7 @@ - https://raw.githubusercontent.com/cashbox-laravel/docs/main/versions.json + https://raw.githubusercontent.com/cashbox-laravel/foundation/4.x/docs/versions.json From bab53650fb466a287d062f08bcaab385f94dae0c Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Tue, 5 Dec 2023 20:12:32 +0300 Subject: [PATCH 158/164] Update cashbox.tree --- docs/cashbox.tree | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/cashbox.tree b/docs/cashbox.tree index 714e3cff..b25e0b66 100644 --- a/docs/cashbox.tree +++ b/docs/cashbox.tree @@ -7,7 +7,6 @@ name="Cashbox for Laravel" start-page="introduction.topic" > - From ec1573400fbfc3165462b8b5485c70614ab72ebb Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Tue, 19 Dec 2023 23:58:13 +0300 Subject: [PATCH 159/164] Bump dependencies --- composer.json | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/composer.json b/composer.json index aab38d2d..b5997cc1 100644 --- a/composer.json +++ b/composer.json @@ -33,14 +33,6 @@ "type": "yoomoney", "url": "https://yoomoney.ru/to/410012608840929" }, - { - "type": "github", - "url": "https://github.com/sponsors/TheDragonCode" - }, - { - "type": "open_collective", - "url": "https://opencollective.com/dragon-code" - }, { "type": "donationalerts", "url": "https://www.donationalerts.com/r/dragon_code" @@ -50,33 +42,28 @@ "php": "^8.1", "ext-json": "*", "archtechx/enums": "^0.3.2", - "doctrine/dbal": "^3.6", - "dragon-code/contracts": "^2.20", - "dragon-code/laravel-cache": "^3.9", + "doctrine/dbal": "^3.7.2", + "dragon-code/contracts": "^2.22", + "dragon-code/laravel-cache": "^3.10.1", "dragon-code/laravel-support": "^3.6", "dragon-code/simple-dto": "^2.7.1", - "dragon-code/support": "^6.11.2", - "guzzlehttp/guzzle": "^7.7", - "illuminate/bus": "^10.15", - "illuminate/console": "^10.15", - "illuminate/contracts": "^10.15", - "illuminate/database": "^10.15", - "illuminate/queue": "^10.15", - "illuminate/support": "^10.15", - "nesbot/carbon": "^2.68.1", + "dragon-code/support": "^6.12.0", + "guzzlehttp/guzzle": "^7.8.1", + "laravel/framework": "^10.38", + "nesbot/carbon": "^2.72.1", "psr/http-message": "^2.0", "psr/log": "^3.0", - "spatie/laravel-data": "^3.7", - "symfony/console": "^6.3" + "spatie/laravel-data": "^3.10.1", + "symfony/console": "^6.4.1" }, "require-dev": { - "cerbero/json-parser": "^1.0", - "mockery/mockery": "^1.6", - "orchestra/testbench": "^8.5.10", - "pestphp/pest": "^2.8.3", + "cerbero/json-parser": "^1.1", + "mockery/mockery": "^1.6.7", + "orchestra/testbench": "^8.18.0", + "pestphp/pest": "^2.28.1", "pestphp/pest-plugin-faker": "^2.0", - "pestphp/pest-plugin-laravel": "^2.1", - "symfony/var-dumper": "^6.3.1" + "pestphp/pest-plugin-laravel": "^2.2", + "symfony/var-dumper": "^6.4.0" }, "replace": { "cashbox/cash": "self.version", From 15c74a09024d3276ea1b4c732bd736ec52f1b519 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Wed, 20 Dec 2023 00:33:13 +0300 Subject: [PATCH 160/164] Update docs --- docs/cfg/buildprofiles.xml | 17 ++++++++--------- docs/images/logo.png | Bin 0 -> 42907 bytes docs/images/social-logo.png | Bin 0 -> 56482 bytes docs/library.tree | 10 ++++++++++ docs/snippets/.gitkeep | 0 docs/topics/introduction.topic | 3 +++ docs/topics/library.md | 3 +++ docs/v.list | 3 +++ docs/versions.json | 7 ------- docs/writerside.cfg | 1 + 10 files changed, 28 insertions(+), 16 deletions(-) create mode 100644 docs/images/logo.png create mode 100644 docs/images/social-logo.png create mode 100644 docs/library.tree create mode 100644 docs/snippets/.gitkeep create mode 100644 docs/topics/library.md delete mode 100644 docs/versions.json diff --git a/docs/cfg/buildprofiles.xml b/docs/cfg/buildprofiles.xml index c0115566..e1187523 100644 --- a/docs/cfg/buildprofiles.xml +++ b/docs/cfg/buildprofiles.xml @@ -15,21 +15,20 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> true - + logo.png en_US - + + https://raw.githubusercontent.com/cashbox-laravel/foundation/main/docs/images/social-logo.png + frozen https://cashbox.city true - https://github.com/cashbox-laravel/docs/edit/main/docs/ + https://github.com/cashbox-laravel/foundation/edit/main/docs/ - - - - - https://raw.githubusercontent.com/cashbox-laravel/foundation/4.x/docs/versions.json - + + logo.png,logo.png,logo.png,logo.png + diff --git a/docs/images/logo.png b/docs/images/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..702108c26a0d2334bc92ea4785be44a59be0d261 GIT binary patch literal 42907 zcmbSy1yo(lvgX0v-6aq_xI2Vk!QDByyByqI1A!#C1_A^pxLY8>-QC?CX6L{Ez3;wR zZ{Ey2)&jOvmvmQGcYR$uN?B1F4Vf4j1OlPS%DhztfuMm)Xb>Xs4+@pcRS>vCa+1+; z1%Xg-{`^9L(lQ7^Ah-c*b!|6oh4%ucj`nZBW{xK2Zy@$g05u3CBnoi?o7$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ud$VqFiWrV&5Ds%SEMfiF5o62nCw?3d>q&FHg zYfl`dgS;m%8e$W@1-<`%@?Y9Qp9ROKP1HPXkjTcru0QiJly3~N;>^+H;j9l{bX+x1 z3<<8$KYFKS?}tpXhbEHU1$eR@X@K)OGU6&(YXTj(?Spf@a4ic_Z$OQ#hX9ZD0YiSq z%Yo*Rl}%lZ`jk;tD`1hg#hD?QvHhBLTqhX)NGrXftb>ZN`|8n5X=6{3^HP(!hL zCJYzk`W2_$fWjTx?vKbbSgHJP{~G=Y@K;Y^r}?K^Vu-WeZR5n@MjX$ zZsadf#>3DDmY)M6q9K1dVq9U}zEln35{Ss_la}|9c7sNJT5C2aI&k*2`S0d>8gjz; zN;YkFX~;Su+SJF$bK3|65fqSO6fp`sNm8X=okAoshWqM5tk9? zMS7(0TaNjTz(OxHC0OvX{D}y%McOaW5E!I?t{(<~FEDrC%EJ$x;y9@)<(iLNlxiBX zD3aVBaopgS!pVZZ4)|ii29W0&bsxz&TaYnt|L4b`oOM^|zAhDv7Gz8F z%318&5rUW^${j(P1#JmHb*uEB`i?=x@$j~)?9MK;yDunc-+e&=q`l&rq+i{4xCXgo z%Na|W>lNpGV0~FkcmKcWMh!2!C%Z;RZL^;;;yhXo)_92y-UkwWW$r2ysg&WTC~I@! z5h9kAD4+_oIP!3orfeEnh?$jsN8k;TkR|x@Dw7lh!wJtuNiL`N)S|-=@c$c($do6j zR3oe|U=r2@3OsM#Yd4~RBM_x2qX|#)5!5y*Gk_LJI__wzG6N8hGeG`<$H6 U)i>*JMlb+@r>mdKI;Vst01zh}NdN!< literal 0 HcmV?d00001 diff --git a/docs/library.tree b/docs/library.tree new file mode 100644 index 00000000..f5892189 --- /dev/null +++ b/docs/library.tree @@ -0,0 +1,10 @@ + + + + + + + diff --git a/docs/snippets/.gitkeep b/docs/snippets/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/docs/topics/introduction.topic b/docs/topics/introduction.topic index d41258f1..6053974a 100644 --- a/docs/topics/introduction.topic +++ b/docs/topics/introduction.topic @@ -34,6 +34,7 @@ Unstable License

    +

    The project is undergoing a global upgrade. @@ -42,6 +43,7 @@ We will soon release version 4.0 for all our products 💪

    +

    %instance% provides an expressive and user-friendly interface for managing billing and payment verification services. @@ -52,5 +54,6 @@

    This project contains some ready-made solutions of payment systems, but you can offer your own.

    + diff --git a/docs/topics/library.md b/docs/topics/library.md new file mode 100644 index 00000000..e6f3e367 --- /dev/null +++ b/docs/topics/library.md @@ -0,0 +1,3 @@ +# About Library + +It's a library helper for documentation instance. diff --git a/docs/v.list b/docs/v.list index 1e029094..ed83cb0d 100644 --- a/docs/v.list +++ b/docs/v.list @@ -3,6 +3,9 @@ + + + diff --git a/docs/versions.json b/docs/versions.json deleted file mode 100644 index 07e7a6f7..00000000 --- a/docs/versions.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "version": "4.x", - "url": "/", - "isCurrent": true - } -] diff --git a/docs/writerside.cfg b/docs/writerside.cfg index d6cfcffa..9afa2d15 100644 --- a/docs/writerside.cfg +++ b/docs/writerside.cfg @@ -6,4 +6,5 @@ + From 06fc3e353403bd687e45cc115cb3e267abd0461f Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Wed, 20 Dec 2023 00:47:15 +0300 Subject: [PATCH 161/164] Update workflows --- .github/workflows/code-style.yml | 50 ------------------- .github/workflows/composer_normalize.yml | 62 ++++++++++++++++++++++++ .github/workflows/databases.yml | 6 +-- 3 files changed, 65 insertions(+), 53 deletions(-) create mode 100644 .github/workflows/composer_normalize.yml diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index 3836fb33..f33c357f 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -24,53 +24,3 @@ jobs: with: github_token: ${{ secrets.COMPOSER_TOKEN }} fix: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - - normalize: - needs: style - - runs-on: ubuntu-latest - - strategy: - fail-fast: true - matrix: - file: - - src/Core - - src/Cash - - src/SberAuth - - src/SberOnline - - src/SberQrCode - - src/TinkoffAuth - - src/TinkoffCredit - - src/TinkoffOnline - - src/TinkoffQrCode - - src/TemplateDriver - - src/TemplateDriverAuth - - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - - steps: - - name: Git setup - if: success() - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - - name: Install dependency - run: composer global require ergebnis/composer-normalize - - - name: Normalize composer.json - id: normalizer - run: | - IS_DIRTY=1 - - composer normalize ${{ matrix.file }}/composer.json - - { git add . && git commit -a -m "Normalized \`composer.json\` files"; } || IS_DIRTY_0 - - echo "is_dirty=${IS_DIRTY}" >> $GITHUB_OUTPUT - - - name: Push changes - uses: ad-m/github-push-action@master - if: steps.normalizer.outputs.is_dirty == 1 - with: - github_token: ${{ secrets.COMPOSER_TOKEN }} diff --git a/.github/workflows/composer_normalize.yml b/.github/workflows/composer_normalize.yml new file mode 100644 index 00000000..b2cad2b6 --- /dev/null +++ b/.github/workflows/composer_normalize.yml @@ -0,0 +1,62 @@ +name: Normalize composer.json + +on: [ push, pull_request ] + +permissions: write-all + +jobs: + normalize: + needs: style + + runs-on: ubuntu-latest + + strategy: + fail-fast: true + matrix: + package: + - Core + - Cash + - SberAuth + - SberOnline + - SberQrCode + - TinkoffAuth + - TinkoffCredit + - TinkoffOnline + - TinkoffQrCode + - TemplateDriver + - TemplateDriverAuth + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json + coverage: none + + - name: Git setup + if: success() + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + + - name: Install dependency + run: composer global require ergebnis/composer-normalize + + - name: Normalize composer.json + id: normalizer + run: composer normalize src/${{ matrix.package }}/composer.json + + { git add . && git commit -a -m "Normalized \`composer.json\` files"; } + + - name: Create a Pull Request + uses: peter-evans/create-pull-request@v5 + with: + branch: normalize/package + branch-suffix: random + delete-branch: true + add-paths: src/${{ matrix.package }}/composer.json + title: "[${{ matrix.package }}]: Normalized \`composer.json\`" + commit-message: Normalized \`composer.json\` diff --git a/.github/workflows/databases.yml b/.github/workflows/databases.yml index f26b3e64..97228de6 100644 --- a/.github/workflows/databases.yml +++ b/.github/workflows/databases.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: true matrix: - db: [ "5.7", "8" ] + db: [ "8" ] name: MySQL ${{ matrix.db }} @@ -41,7 +41,7 @@ jobs: command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --colors=always + run: vendor/bin/pest --colors=always env: DB_CONNECTION: mysql DB_USERNAME: root @@ -95,7 +95,7 @@ jobs: strategy: fail-fast: true matrix: - db: [ "14", "15" ] + db: [ "14", "15", "16" ] name: PostgreSQL ${{ matrix.db }} From 8f4722c1ffb7e3fc5354ad2ca2d2e313dcc11987 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Wed, 20 Dec 2023 23:37:02 +0300 Subject: [PATCH 162/164] Added `composer test` command --- .github/workflows/tests.yml | 2 +- composer.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7106f128..ab084a8f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -93,7 +93,7 @@ jobs: command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Execute tests - run: vendor/bin/pest --colors=always + run: composer test env: DB_CONNECTION: mysql DB_USERNAME: root diff --git a/composer.json b/composer.json index b5997cc1..41cccb70 100644 --- a/composer.json +++ b/composer.json @@ -124,6 +124,9 @@ "scripts": { "post-autoload-dump": [ "@php vendor/bin/testbench package:discover --ansi" + ], + "test": [ + "php vendor/bin/pest --parallel --colors=always" ] } } From 0a364c13449c6182ad0c157ddfa74f436c323873 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Wed, 20 Dec 2023 23:37:40 +0300 Subject: [PATCH 163/164] Updated link to author's homepage --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 41cccb70..bbf0b261 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ { "name": "Andrey Helldar", "email": "helldar@dragon-code.pro", - "homepage": "https://github.com/andrey-helldar" + "homepage": "https://dragon-code.pro" } ], "support": { From 27e5a07937893d3fe3208449f122f4c35b8cd1fa Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Thu, 21 Dec 2023 00:08:44 +0300 Subject: [PATCH 164/164] Small refactoring --- app/Commands/Composer.php | 6 +- src/Cash/src/Http/Responses/Response.php | 2 +- src/Core/src/Billable.php | 6 +- src/Core/src/Concerns/Events/Notifiable.php | 10 +- .../Concerns/Migrations/PrivateMigration.php | 4 +- .../Concerns/Migrations/PublicMigration.php | 4 +- src/Core/src/Console/Commands/Command.php | 2 +- .../src/Data/Config/Payment/StatusData.php | 33 ++-- src/Core/src/Data/Models/InfoData.php | 32 +--- src/Core/src/Enums/AttributeEnum.php | 12 +- src/Core/src/Enums/HttpMethodEnum.php | 4 +- src/Core/src/Enums/RateLimiterEnum.php | 8 +- src/Core/src/Enums/StatusEnum.php | 20 +-- src/Core/src/Events/BaseEvent.php | 3 + src/Core/src/Http/Request.php | 2 +- src/Core/src/Http/Response.php | 19 +-- src/Core/src/Jobs/BaseJob.php | 2 + src/Core/src/Jobs/VerifyJob.php | 2 +- .../src/Observers/PaymentDetailsObserver.php | 6 +- .../src/Providers/BindingServiceProvider.php | 4 +- src/Core/src/Providers/ServiceProvider.php | 4 +- src/Core/src/Services/Driver.php | 3 +- src/Core/src/Services/Exception.php | 4 +- src/Core/src/Services/Http.php | 2 +- src/Core/src/Services/Statuses.php | 10 +- src/SberOnline/src/Driver.php | 2 +- .../src/Http/Requests/BaseRequest.php | 2 +- .../src/Http/Requests/GetStateRequest.php | 2 +- .../src/Http/Requests/CreateRequest.php | 2 +- tests/Fixtures/App/Enums/StatusEnum.php | 10 +- tests/Fixtures/App/Enums/TypeEnum.php | 32 ++-- .../Models/Factories/PaymentModelFactory.php | 2 +- tests/Fixtures/App/Models/PaymentModel.php | 4 + .../App/Observers/PaymentObserver.php | 29 ---- .../App/Providers/TestServiceProvider.php | 30 ---- tests/TestCase.php | 24 ++- tests/Unit/Core/Console/RefundTest.php | 90 +++++------ tests/Unit/Core/Console/VerifyTest.php | 142 +++++++++--------- .../Unit/Core/Data/Casts/FromEnumCastTest.php | 8 +- tests/Unit/Core/Facades/ConfigTest.php | 28 ++-- tests/Unit/Drivers/Cash/CreateTest.php | 6 +- tests/Unit/Drivers/Cash/RefundTest.php | 18 +-- tests/Unit/Drivers/Cash/VerifyTest.php | 10 +- tests/Unit/Drivers/Outside/CreateTest.php | 6 +- tests/Unit/Drivers/Outside/FailedTest.php | 10 +- tests/Unit/Drivers/Outside/RefundTest.php | 24 +-- tests/Unit/Drivers/Outside/VerifyTest.php | 10 +- tests/Unit/Drivers/SberAuth/SignTest.php | 2 +- tests/Unit/Drivers/TemplateAuth/AuthTest.php | 2 +- .../Drivers/TemplateDriver/CreateTest.php | 22 +-- .../Drivers/TemplateDriver/RefundTest.php | 20 +-- .../Drivers/TemplateDriver/VerifyTest.php | 14 +- .../Unit/Drivers/TinkoffCredit/CreateTest.php | 16 +- .../Unit/Drivers/TinkoffCredit/RefundTest.php | 20 +-- .../Unit/Drivers/TinkoffCredit/VerifyTest.php | 14 +- .../Unit/Drivers/TinkoffOnline/CreateTest.php | 18 +-- .../Unit/Drivers/TinkoffOnline/RefundTest.php | 20 +-- .../Unit/Drivers/TinkoffOnline/VerifyTest.php | 14 +- .../Unit/Drivers/TinkoffQrCode/CreateTest.php | 18 +-- .../Unit/Drivers/TinkoffQrCode/RefundTest.php | 20 +-- .../Unit/Drivers/TinkoffQrCode/VerifyTest.php | 14 +- ...023_07_14_022222_create_payments_model.php | 4 +- 62 files changed, 411 insertions(+), 502 deletions(-) delete mode 100644 tests/Fixtures/App/Observers/PaymentObserver.php delete mode 100644 tests/Fixtures/App/Providers/TestServiceProvider.php diff --git a/app/Commands/Composer.php b/app/Commands/Composer.php index 1d5b2523..4a2bcdec 100644 --- a/app/Commands/Composer.php +++ b/app/Commands/Composer.php @@ -32,8 +32,8 @@ class Composer extends Command protected string $exclude = 'cashbox/'; protected array $thanks = [ - "name" => "cashbox-laravel/foundation", - "url" => "https://github.com/cashbox-laravel/foundation", + 'name' => 'cashbox-laravel/foundation', + 'url' => 'https://github.com/cashbox-laravel/foundation', ]; protected function handle(string $source, string $target): void @@ -95,7 +95,7 @@ protected function copyToDriverIntersect(&$array, string $key): void protected function copyToMain($array, string $key): void { - $main = Arr::get($this->main, $key); + $main = Arr::get($this->main, $key); $driver = Arr::get($array, $key); $items = Arr::of($driver) diff --git a/src/Cash/src/Http/Responses/Response.php b/src/Cash/src/Http/Responses/Response.php index b3022d34..a93eaf78 100644 --- a/src/Cash/src/Http/Responses/Response.php +++ b/src/Cash/src/Http/Responses/Response.php @@ -28,7 +28,7 @@ class Response extends BaseData { use Identifiers; - public ?string $status; + public string $status; public function getOperationId(): ?string { diff --git a/src/Core/src/Billable.php b/src/Core/src/Billable.php index b0ad756f..002c9a91 100644 --- a/src/Core/src/Billable.php +++ b/src/Core/src/Billable.php @@ -42,11 +42,7 @@ public function cashbox(): Relation public function cashboxDriver(): Driver { - if ($this->cashboxDriver) { - return $this->cashboxDriver; - } - - return $this->cashboxDriver = DriverManager::find($this); + return $this->cashboxDriver ??= DriverManager::find($this); } public function cashboxJob(bool $force = false): Services\Job diff --git a/src/Core/src/Concerns/Events/Notifiable.php b/src/Core/src/Concerns/Events/Notifiable.php index ddaf4869..03ae6845 100644 --- a/src/Core/src/Concerns/Events/Notifiable.php +++ b/src/Core/src/Concerns/Events/Notifiable.php @@ -33,11 +33,11 @@ trait Notifiable protected static function event(Model $payment, StatusEnum $status): void { match ($status) { - StatusEnum::new => event(new PaymentCreatedEvent($payment)), - StatusEnum::refund => event(new PaymentRefundedEvent($payment)), - StatusEnum::waitRefund => event(new PaymentWaitRefundEvent($payment)), - StatusEnum::success => event(new PaymentSuccessEvent($payment)), - StatusEnum::failed => event(new PaymentFailedEvent($payment)), + StatusEnum::New => PaymentCreatedEvent::dispatch($payment), + StatusEnum::Refund => PaymentRefundedEvent::dispatch($payment), + StatusEnum::WaitRefund => PaymentWaitRefundEvent::dispatch($payment), + StatusEnum::Success => PaymentSuccessEvent::dispatch($payment), + StatusEnum::Failed => PaymentFailedEvent::dispatch($payment), }; } diff --git a/src/Core/src/Concerns/Migrations/PrivateMigration.php b/src/Core/src/Concerns/Migrations/PrivateMigration.php index 0bc67b4b..aeef5c9f 100644 --- a/src/Core/src/Concerns/Migrations/PrivateMigration.php +++ b/src/Core/src/Concerns/Migrations/PrivateMigration.php @@ -32,7 +32,9 @@ abstract class PrivateMigration extends Migration protected function connection(): Builder { - return Schema::connection(static::detailsConfig()->connection); + return Schema::connection( + static::detailsConfig()->connection + ); } protected function table(): string diff --git a/src/Core/src/Concerns/Migrations/PublicMigration.php b/src/Core/src/Concerns/Migrations/PublicMigration.php index 53e72cfb..f60cb405 100644 --- a/src/Core/src/Concerns/Migrations/PublicMigration.php +++ b/src/Core/src/Concerns/Migrations/PublicMigration.php @@ -32,7 +32,9 @@ abstract class PublicMigration extends Migration protected function connection(): Builder { - return Schema::connection($this->modelConnection()); + return Schema::connection( + $this->modelConnection() + ); } protected function modelConnection(): ?string diff --git a/src/Core/src/Console/Commands/Command.php b/src/Core/src/Console/Commands/Command.php index 9764f78a..afa742bf 100644 --- a/src/Core/src/Console/Commands/Command.php +++ b/src/Core/src/Console/Commands/Command.php @@ -96,7 +96,7 @@ protected function getTypes(): array protected function action(): string { - return Str::of(static::class)->classBasename()->append('ing')->toString(); + return Str::of(static::class)->classBasename()->singular()->append('ing')->toString(); } protected function hasForce(): bool diff --git a/src/Core/src/Data/Config/Payment/StatusData.php b/src/Core/src/Data/Config/Payment/StatusData.php index bb34ea3e..f285418a 100644 --- a/src/Core/src/Data/Config/Payment/StatusData.php +++ b/src/Core/src/Data/Config/Payment/StatusData.php @@ -17,6 +17,7 @@ namespace Cashbox\Core\Data\Config\Payment; +use BackedEnum; use Cashbox\Core\Enums\StatusEnum; use Spatie\LaravelData\Attributes\MapName; use Spatie\LaravelData\Data; @@ -25,35 +26,35 @@ #[MapName(SnakeCaseMapper::class)] class StatusData extends Data { - public mixed $new; + public BackedEnum|int|string $new; - public mixed $success; + public BackedEnum|int|string $success; - public mixed $refund; + public BackedEnum|int|string $refund; - public mixed $waitRefund; + public BackedEnum|int|string $waitRefund; - public mixed $failed; + public BackedEnum|int|string $failed; - public function fromEnum(StatusEnum $status): mixed + public function fromEnum(StatusEnum $status): BackedEnum|int|string { return match ($status) { - StatusEnum::new => $this->new, - StatusEnum::success => $this->success, - StatusEnum::refund => $this->refund, - StatusEnum::waitRefund => $this->waitRefund, - StatusEnum::failed => $this->failed, + StatusEnum::New => $this->new, + StatusEnum::Success => $this->success, + StatusEnum::Refund => $this->refund, + StatusEnum::WaitRefund => $this->waitRefund, + StatusEnum::Failed => $this->failed, }; } public function toEnum(mixed $status): ?StatusEnum { return match ($status) { - $this->new => StatusEnum::new, - $this->success => StatusEnum::success, - $this->refund => StatusEnum::refund, - $this->waitRefund => StatusEnum::waitRefund, - $this->failed => StatusEnum::failed, + $this->new => StatusEnum::New, + $this->success => StatusEnum::Success, + $this->refund => StatusEnum::Refund, + $this->waitRefund => StatusEnum::WaitRefund, + $this->failed => StatusEnum::Failed, default => null }; } diff --git a/src/Core/src/Data/Models/InfoData.php b/src/Core/src/Data/Models/InfoData.php index 9e392a9f..3ac62124 100644 --- a/src/Core/src/Data/Models/InfoData.php +++ b/src/Core/src/Data/Models/InfoData.php @@ -18,53 +18,33 @@ namespace Cashbox\Core\Data\Models; use Cashbox\Core\Concerns\Config\Application; -use Cashbox\Core\Support\Arr; use Spatie\LaravelData\Attributes\MapName; use Spatie\LaravelData\Data; use Spatie\LaravelData\Mappers\SnakeCaseMapper; -use Spatie\LaravelData\Support\Wrapping\WrapExecutionType; -use Stringable; +use Spatie\LaravelData\Optional; #[MapName(SnakeCaseMapper::class)] -class InfoData extends Data implements Stringable +class InfoData extends Data { use Application; - public ?string $externalId; + public Optional|string|null $externalId; - public ?string $operationId; + public Optional|string|null $operationId; - public ?string $status; + public Optional|string|null $status; - public array $extra = []; + public array|Optional $extra = []; public function toJson($options = 0): string { return parent::toJson($this->flags()); } - public function transform( - bool $transformValues = true, - WrapExecutionType $wrapExecutionType = WrapExecutionType::Disabled, - bool $mapPropertyNames = true, - ): array { - return $this->filter(parent::transform($transformValues, $wrapExecutionType, $mapPropertyNames)); - } - - public function __toString(): string - { - return $this->toJson(); - } - protected function flags(): int { return static::isProduction() ? JSON_UNESCAPED_SLASHES ^ JSON_UNESCAPED_UNICODE ^ JSON_NUMERIC_CHECK : JSON_UNESCAPED_SLASHES ^ JSON_UNESCAPED_UNICODE ^ JSON_NUMERIC_CHECK ^ JSON_PRETTY_PRINT; } - - protected function filter(array $items): array - { - return Arr::filter($items); - } } diff --git a/src/Core/src/Enums/AttributeEnum.php b/src/Core/src/Enums/AttributeEnum.php index dec0e3a1..07db6118 100644 --- a/src/Core/src/Enums/AttributeEnum.php +++ b/src/Core/src/Enums/AttributeEnum.php @@ -20,15 +20,15 @@ use ArchTech\Enums\InvokableCases; /** - * @method static string createdAt() - * @method static string status() - * @method static string type() + * @method static string CreatedAt() + * @method static string Status() + * @method static string Type() */ enum AttributeEnum: string { use InvokableCases; - case createdAt = 'created_at'; - case status = 'status'; - case type = 'type'; + case CreatedAt = 'created_at'; + case Status = 'status'; + case Type = 'type'; } diff --git a/src/Core/src/Enums/HttpMethodEnum.php b/src/Core/src/Enums/HttpMethodEnum.php index 7b68f616..2414214e 100644 --- a/src/Core/src/Enums/HttpMethodEnum.php +++ b/src/Core/src/Enums/HttpMethodEnum.php @@ -19,6 +19,6 @@ enum HttpMethodEnum: string { - case post = 'POST'; - case get = 'GET'; + case Post = 'POST'; + case Get = 'GET'; } diff --git a/src/Core/src/Enums/RateLimiterEnum.php b/src/Core/src/Enums/RateLimiterEnum.php index a641767a..0d7ecc3b 100644 --- a/src/Core/src/Enums/RateLimiterEnum.php +++ b/src/Core/src/Enums/RateLimiterEnum.php @@ -20,13 +20,13 @@ use ArchTech\Enums\InvokableCases; /** - * @method static string disabled() - * @method static string enabled() + * @method static string Disabled() + * @method static string Enabled() */ enum RateLimiterEnum: string { use InvokableCases; - case disabled = 'cashbox_disabled'; - case enabled = 'cashbox_enabled'; + case Disabled = 'cashbox_disabled'; + case Enabled = 'cashbox_enabled'; } diff --git a/src/Core/src/Enums/StatusEnum.php b/src/Core/src/Enums/StatusEnum.php index 9eaf7a5e..09c5ccf0 100644 --- a/src/Core/src/Enums/StatusEnum.php +++ b/src/Core/src/Enums/StatusEnum.php @@ -22,11 +22,11 @@ use Cashbox\Core\Concerns\Enums\From; /** - * @method string failed() - * @method string new() - * @method string refund() - * @method string success() - * @method string waitRefund() + * @method string Failed() + * @method string New() + * @method string Refund() + * @method string Success() + * @method string WaitRefund() */ enum StatusEnum: string { @@ -34,9 +34,9 @@ enum StatusEnum: string use InvokableCases; use Values; - case failed = 'failed'; - case new = 'new'; - case refund = 'refund'; - case success = 'success'; - case waitRefund = 'wait_refund'; + case Failed = 'failed'; + case New = 'new'; + case Refund = 'refund'; + case Success = 'success'; + case WaitRefund = 'wait_refund'; } diff --git a/src/Core/src/Events/BaseEvent.php b/src/Core/src/Events/BaseEvent.php index 24deb670..0ad179af 100644 --- a/src/Core/src/Events/BaseEvent.php +++ b/src/Core/src/Events/BaseEvent.php @@ -18,9 +18,12 @@ namespace Cashbox\Core\Events; use Illuminate\Database\Eloquent\Model; +use Illuminate\Foundation\Events\Dispatchable; abstract class BaseEvent { + use Dispatchable; + public function __construct( public Model $payment ) {} diff --git a/src/Core/src/Http/Request.php b/src/Core/src/Http/Request.php index 39c6bf26..776b3f91 100644 --- a/src/Core/src/Http/Request.php +++ b/src/Core/src/Http/Request.php @@ -29,7 +29,7 @@ abstract class Request use Application; use Makeable; - protected HttpMethodEnum $method = HttpMethodEnum::post; + protected HttpMethodEnum $method = HttpMethodEnum::Post; protected string $productionHost; diff --git a/src/Core/src/Http/Response.php b/src/Core/src/Http/Response.php index 468ccf23..73521b0c 100644 --- a/src/Core/src/Http/Response.php +++ b/src/Core/src/Http/Response.php @@ -18,9 +18,7 @@ namespace Cashbox\Core\Http; use Cashbox\Core\Data\Models\InfoData; -use DragonCode\Support\Facades\Helpers\Arr; use Spatie\LaravelData\Data; -use Spatie\LaravelData\Support\Wrapping\WrapExecutionType; abstract class Response extends Data { @@ -46,26 +44,11 @@ public function getExternalId(): ?string public function isEmpty(): bool { - return empty($this->filter($this->toArray())); - } - - public function transform( - bool $transformValues = true, - WrapExecutionType $wrapExecutionType = WrapExecutionType::Disabled, - bool $mapPropertyNames = true, - ): array { - return $this->filter( - parent::transform($transformValues, $wrapExecutionType, $mapPropertyNames) - ); + return empty($this->toArray()); } protected function getExtra(): array { return []; } - - protected function filter(array $items): array - { - return Arr::filter($items, fn (mixed $value) => $value !== null); - } } diff --git a/src/Core/src/Jobs/BaseJob.php b/src/Core/src/Jobs/BaseJob.php index 9765567d..628f4df7 100644 --- a/src/Core/src/Jobs/BaseJob.php +++ b/src/Core/src/Jobs/BaseJob.php @@ -29,6 +29,7 @@ use Illuminate\Contracts\Queue\ShouldBeUnique; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Database\Eloquent\Model; +use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\Middleware\RateLimitedWithRedis; use Illuminate\Queue\SerializesModels; @@ -40,6 +41,7 @@ */ abstract class BaseJob implements ShouldBeUnique, ShouldQueue { + use Dispatchable; use InteractsWithQueue; use Queue; use Queueable; diff --git a/src/Core/src/Jobs/VerifyJob.php b/src/Core/src/Jobs/VerifyJob.php index 5273dd1d..8f8c5f84 100644 --- a/src/Core/src/Jobs/VerifyJob.php +++ b/src/Core/src/Jobs/VerifyJob.php @@ -34,7 +34,7 @@ protected function request(): Response protected function start(): void { if ($this->authorizeToStart()) { - dispatch_sync(new StartJob($this->payment, true)); + StartJob::dispatchSync($this->payment, true); } } } diff --git a/src/Core/src/Observers/PaymentDetailsObserver.php b/src/Core/src/Observers/PaymentDetailsObserver.php index 2a1f5f16..301e305e 100644 --- a/src/Core/src/Observers/PaymentDetailsObserver.php +++ b/src/Core/src/Observers/PaymentDetailsObserver.php @@ -47,14 +47,12 @@ public function saved(Details $model): void $this->updateStatus($model->parent, $model->status); } - /** - * @param \Illuminate\Database\Eloquent\Model|\Cashbox\Core\Billable $payment - */ protected function updateStatus(Model $payment, StatusEnum $status): void { $value = static::paymentConfig()->status->fromEnum($status); $field = static::attributeConfig()->status; - $payment->update([$field => $value]); + $payment->setAttribute($field, $value); + $payment->save(); } } diff --git a/src/Core/src/Providers/BindingServiceProvider.php b/src/Core/src/Providers/BindingServiceProvider.php index 42d1a6e5..10a42669 100644 --- a/src/Core/src/Providers/BindingServiceProvider.php +++ b/src/Core/src/Providers/BindingServiceProvider.php @@ -34,8 +34,8 @@ public function boot(): void protected function bindConfig(): void { $this->app->singleton(ConfigData::class, function () { - if ($config = config('cashbox')) { - return ConfigData::from($config); + if (! file_exists(config_path('cashbox.php'))) { + return ConfigData::from(config('cashbox')); } throw new ConfigCannotBeEmptyException(); diff --git a/src/Core/src/Providers/ServiceProvider.php b/src/Core/src/Providers/ServiceProvider.php index 045ed67a..fb99bc78 100644 --- a/src/Core/src/Providers/ServiceProvider.php +++ b/src/Core/src/Providers/ServiceProvider.php @@ -42,11 +42,11 @@ protected function bootPublishes(): void $this->publishes([ __DIR__ . '/../../config/cashbox.php' => $this->app->configPath('cashbox.php'), - ], 'config'); + ], ['config', 'cashbox']); $this->publishes([ __DIR__ . '/../../database/migrations/public' => $this->app->databasePath('migrations'), - ], 'migrations'); + ], ['migrations', 'cashbox']); } protected function bootMigrations(): void diff --git a/src/Core/src/Services/Driver.php b/src/Core/src/Services/Driver.php index 54414a6c..01a80510 100644 --- a/src/Core/src/Services/Driver.php +++ b/src/Core/src/Services/Driver.php @@ -42,7 +42,8 @@ abstract public function verify(): Response; public function __construct( protected Model $payment, public readonly DriverData $config, - protected readonly Http $http = new Http() + protected readonly Http $http = new Http( + ) ) {} public function statuses(): Statuses diff --git a/src/Core/src/Services/Exception.php b/src/Core/src/Services/Exception.php index 37046409..849434ee 100644 --- a/src/Core/src/Services/Exception.php +++ b/src/Core/src/Services/Exception.php @@ -31,8 +31,6 @@ abstract class Exception * ['Success' => false] * ['Success' => 0] * ['Status' => 'error'] - * - * @var array */ protected array $failedKey = []; @@ -64,7 +62,7 @@ protected function hasFailed(array $data): bool $key = is_numeric($k) ? $v : $k; $value = is_numeric($k) ? false : $v; - if (Arr::get($data, $key) == $value) { + if ($value == Arr::get($data, $key)) { return true; } } diff --git a/src/Core/src/Services/Http.php b/src/Core/src/Services/Http.php index e7ef0796..6c93acff 100644 --- a/src/Core/src/Services/Http.php +++ b/src/Core/src/Services/Http.php @@ -42,7 +42,7 @@ public function send(Request $request, Exception $exception): array url : $request->url(), headers: $request->sign()?->headers() ?? $request->headers(), options: $request->sign()?->options() ?? $request->options(), - data : $request->sign()?->body() ?? $request->body() + data : $request->sign()?->body() ?? $request->body() ); static::log($request, $response); diff --git a/src/Core/src/Services/Statuses.php b/src/Core/src/Services/Statuses.php index f0abf6fa..dbd2b0c6 100644 --- a/src/Core/src/Services/Statuses.php +++ b/src/Core/src/Services/Statuses.php @@ -94,11 +94,11 @@ public function inProgress(?StatusEnum $status = null): bool public function detect(string $status): ?StatusEnum { return match (true) { - $this->contains($status, static::NEW) => StatusEnum::new, - $this->contains($status, static::SUCCESS) => StatusEnum::success, - $this->contains($status, static::REFUNDING) => StatusEnum::waitRefund, - $this->contains($status, static::REFUNDED) => StatusEnum::refund, - $this->contains($status, static::FAILED) => StatusEnum::failed, + $this->contains($status, static::NEW) => StatusEnum::New, + $this->contains($status, static::SUCCESS) => StatusEnum::Success, + $this->contains($status, static::REFUNDING) => StatusEnum::WaitRefund, + $this->contains($status, static::REFUNDED) => StatusEnum::Refund, + $this->contains($status, static::FAILED) => StatusEnum::Failed, default => null }; } diff --git a/src/SberOnline/src/Driver.php b/src/SberOnline/src/Driver.php index 44343b8c..506470d6 100644 --- a/src/SberOnline/src/Driver.php +++ b/src/SberOnline/src/Driver.php @@ -15,6 +15,7 @@ namespace Cashbox\Sber\Online; +use Cashbox\Core\Services\Driver as BaseDriver; use Cashbox\Sber\Online\Exceptions\Manager; use Cashbox\Sber\Online\Helpers\Statuses; use Cashbox\Sber\Online\Requests\Cancel; @@ -24,7 +25,6 @@ use Cashbox\Sber\Online\Responses\Created; use Cashbox\Sber\Online\Responses\Refund; use Cashbox\Sber\Online\Responses\State; -use Cashbox\Core\Services\Driver as BaseDriver; use DragonCode\Contracts\Cashier\Http\Response; class Driver extends BaseDriver diff --git a/src/TemplateDriver/src/Http/Requests/BaseRequest.php b/src/TemplateDriver/src/Http/Requests/BaseRequest.php index 96f73961..19020d02 100644 --- a/src/TemplateDriver/src/Http/Requests/BaseRequest.php +++ b/src/TemplateDriver/src/Http/Requests/BaseRequest.php @@ -21,7 +21,7 @@ use Cashbox\Core\Http\Request; /** - * @property-read TemplateDriverResource $resource + * @property TemplateDriverResource $resource */ abstract class BaseRequest extends Request { diff --git a/src/TinkoffCredit/src/Http/Requests/GetStateRequest.php b/src/TinkoffCredit/src/Http/Requests/GetStateRequest.php index dd2b9a69..56fff692 100644 --- a/src/TinkoffCredit/src/Http/Requests/GetStateRequest.php +++ b/src/TinkoffCredit/src/Http/Requests/GetStateRequest.php @@ -21,7 +21,7 @@ class GetStateRequest extends BaseRequest { - public HttpMethodEnum $method = HttpMethodEnum::get; + public HttpMethodEnum $method = HttpMethodEnum::Get; protected string $productionUri = '/api/partners/v2/orders/{orderNumber}/info'; diff --git a/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php b/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php index 291ca3dd..352b8e08 100644 --- a/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php +++ b/src/TinkoffQrCode/src/Http/Requests/CreateRequest.php @@ -23,7 +23,7 @@ class CreateRequest extends BaseRequest { protected string $productionUri = '/v2/Init'; - + protected Auth|string|null $auth = Basic::class; public function body(): array diff --git a/tests/Fixtures/App/Enums/StatusEnum.php b/tests/Fixtures/App/Enums/StatusEnum.php index 40bee422..97a26512 100644 --- a/tests/Fixtures/App/Enums/StatusEnum.php +++ b/tests/Fixtures/App/Enums/StatusEnum.php @@ -19,9 +19,9 @@ enum StatusEnum: int { - case new = 0; - case success = 1; - case waitRefund = 2; - case refund = 3; - case failed = 4; + case New = 0; + case Success = 1; + case WaitRefund = 2; + case Refund = 3; + case Failed = 4; } diff --git a/tests/Fixtures/App/Enums/TypeEnum.php b/tests/Fixtures/App/Enums/TypeEnum.php index 949bd0d4..9476bc2c 100644 --- a/tests/Fixtures/App/Enums/TypeEnum.php +++ b/tests/Fixtures/App/Enums/TypeEnum.php @@ -20,25 +20,25 @@ use ArchTech\Enums\InvokableCases; /** - * @method static string cash() - * @method static string outside() - * @method static string tinkoffCredit() - * @method static string tinkoffOnline() - * @method static string tinkoffQrCode() - * @method static string sberQrCode() - * @method static string templateAuth() - * @method static string templateDriver() + * @method static string Cash() + * @method static string Outside() + * @method static string TinkoffCredit() + * @method static string TinkoffOnline() + * @method static string TinkoffQrCode() + * @method static string SberQrCode() + * @method static string TemplateAuth() + * @method static string TemplateDriver() */ enum TypeEnum: string { use InvokableCases; - case cash = 'cash'; - case outside = 'outside'; - case tinkoffCredit = 'tinkoff_credit'; - case tinkoffOnline = 'tinkoff_online'; - case tinkoffQrCode = 'tinkoff_qr'; - case sberQrCode = 'sber_qr'; - case templateAuth = 'template_auth'; - case templateDriver = 'template_driver'; + case Cash = 'cash'; + case Outside = 'outside'; + case TinkoffCredit = 'tinkoff_credit'; + case TinkoffOnline = 'tinkoff_online'; + case TinkoffQrCode = 'tinkoff_qr'; + case SberQrCode = 'sber_qr'; + case TemplateAuth = 'template_auth'; + case TemplateDriver = 'template_driver'; } diff --git a/tests/Fixtures/App/Models/Factories/PaymentModelFactory.php b/tests/Fixtures/App/Models/Factories/PaymentModelFactory.php index 23339653..76120cc1 100644 --- a/tests/Fixtures/App/Models/Factories/PaymentModelFactory.php +++ b/tests/Fixtures/App/Models/Factories/PaymentModelFactory.php @@ -28,7 +28,7 @@ class PaymentModelFactory extends Factory public function definition(): array { return [ - 'type' => TypeEnum::outside, + 'type' => TypeEnum::Outside, 'price' => $this->faker->randomNumber(4), ]; } diff --git a/tests/Fixtures/App/Models/PaymentModel.php b/tests/Fixtures/App/Models/PaymentModel.php index 1be4cf72..a2041cee 100644 --- a/tests/Fixtures/App/Models/PaymentModel.php +++ b/tests/Fixtures/App/Models/PaymentModel.php @@ -44,6 +44,10 @@ class PaymentModel extends Model 'price' => 'int', ]; + protected $attributes = [ + 'status' => StatusEnum::New, + ]; + protected static function newFactory(): PaymentModelFactory { return PaymentModelFactory::new(); diff --git a/tests/Fixtures/App/Observers/PaymentObserver.php b/tests/Fixtures/App/Observers/PaymentObserver.php deleted file mode 100644 index 5a2ca43c..00000000 --- a/tests/Fixtures/App/Observers/PaymentObserver.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Tests\Fixtures\App\Observers; - -use Tests\Fixtures\App\Enums\StatusEnum; -use Tests\Fixtures\App\Models\PaymentModel; - -class PaymentObserver -{ - public function creating(PaymentModel $payment): void - { - $payment->status = StatusEnum::new; - } -} diff --git a/tests/Fixtures/App/Providers/TestServiceProvider.php b/tests/Fixtures/App/Providers/TestServiceProvider.php deleted file mode 100644 index 3d625c8c..00000000 --- a/tests/Fixtures/App/Providers/TestServiceProvider.php +++ /dev/null @@ -1,30 +0,0 @@ - - * @copyright 2023 Andrey Helldar - * @license MIT - * - * @see https://cashbox.city - */ - -declare(strict_types=1); - -namespace Tests\Fixtures\App\Providers; - -use Illuminate\Support\ServiceProvider; -use Tests\Fixtures\App\Models\PaymentModel; -use Tests\Fixtures\App\Observers\PaymentObserver; - -class TestServiceProvider extends ServiceProvider -{ - public function boot(): void - { - PaymentModel::observe(PaymentObserver::class); - } -} diff --git a/tests/TestCase.php b/tests/TestCase.php index d1d6515d..d30bc4aa 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -33,7 +33,6 @@ use Tests\Fixtures\App\Enums\StatusEnum as TestStatusEnum; use Tests\Fixtures\App\Enums\TypeEnum; use Tests\Fixtures\App\Models\PaymentModel; -use Tests\Fixtures\App\Providers\TestServiceProvider; use Tests\Fixtures\Payments\Cash; use Tests\Fixtures\Payments\TemplateDriver as TemplateDriverResource; use Tests\Fixtures\Payments\TinkoffCredit; @@ -52,7 +51,6 @@ protected function getPackageProviders($app): array BindingServiceProvider::class, ObserverServiceProvider::class, RateLimiterServiceProvider::class, - TestServiceProvider::class, ]; } @@ -82,27 +80,27 @@ protected function setUpAttributes(Application $app): void protected function setUpStatuses(Application $app): void { - $app['config']->set('cashbox.payment.status.' . StatusEnum::new(), TestStatusEnum::new); - $app['config']->set('cashbox.payment.status.' . StatusEnum::success(), TestStatusEnum::success); - $app['config']->set('cashbox.payment.status.' . StatusEnum::waitRefund(), TestStatusEnum::waitRefund); - $app['config']->set('cashbox.payment.status.' . StatusEnum::refund(), TestStatusEnum::refund); - $app['config']->set('cashbox.payment.status.' . StatusEnum::failed(), TestStatusEnum::failed); + $app['config']->set('cashbox.payment.status.' . StatusEnum::new(), TestStatusEnum::New); + $app['config']->set('cashbox.payment.status.' . StatusEnum::success(), TestStatusEnum::Success); + $app['config']->set('cashbox.payment.status.' . StatusEnum::waitRefund(), TestStatusEnum::WaitRefund); + $app['config']->set('cashbox.payment.status.' . StatusEnum::refund(), TestStatusEnum::Refund); + $app['config']->set('cashbox.payment.status.' . StatusEnum::failed(), TestStatusEnum::Failed); } protected function setUpDrivers(Application $app): void { - $this->setUpDriver($app, TypeEnum::cash, CashDriver::class, Cash::class, null); + $this->setUpDriver($app, TypeEnum::Cash, CashDriver::class, Cash::class, null); - $this->setUpDriver($app, TypeEnum::tinkoffOnline, TinkoffOnlineDriver::class, TinkoffOnline::class); - $this->setUpDriver($app, TypeEnum::tinkoffQrCode, TinkoffQrCodeDriver::class, TinkoffQrCode::class); - $this->setUpDriver($app, TypeEnum::tinkoffCredit, TinkoffCreditDriver::class, TinkoffCredit::class, [ + $this->setUpDriver($app, TypeEnum::TinkoffOnline, TinkoffOnlineDriver::class, TinkoffOnline::class); + $this->setUpDriver($app, TypeEnum::TinkoffQrCode, TinkoffQrCodeDriver::class, TinkoffQrCode::class); + $this->setUpDriver($app, TypeEnum::TinkoffCredit, TinkoffCreditDriver::class, TinkoffCredit::class, [ 'showcase_id' => fake()->randomLetter, 'promo_code' => 'default', ]); - $this->setUpDriver($app, TypeEnum::sberQrCode, TinkoffQrCodeDriver::class, TinkoffQrCode::class); + $this->setUpDriver($app, TypeEnum::SberQrCode, TinkoffQrCodeDriver::class, TinkoffQrCode::class); - $this->setUpDriver($app, TypeEnum::templateDriver, TemplateDriver::class, TemplateDriverResource::class, [ + $this->setUpDriver($app, TypeEnum::TemplateDriver, TemplateDriver::class, TemplateDriverResource::class, [ 'extra' => ['some_id' => 12345], ]); } diff --git a/tests/Unit/Core/Console/RefundTest.php b/tests/Unit/Core/Console/RefundTest.php index b9a00b28..a66a3aa6 100644 --- a/tests/Unit/Core/Console/RefundTest.php +++ b/tests/Unit/Core/Console/RefundTest.php @@ -28,13 +28,13 @@ fakeEvents(); fakeTinkoffCreditHttp(); - $payment1 = createPayment(TypeEnum::outside); - $payment2 = createPayment(TypeEnum::cash); - $payment3 = createPayment(TypeEnum::tinkoffCredit); + $payment1 = createPayment(TypeEnum::Outside); + $payment2 = createPayment(TypeEnum::Cash); + $payment3 = createPayment(TypeEnum::TinkoffCredit); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 2); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 2); @@ -43,9 +43,9 @@ artisan(Refund::class); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); Event::assertNothingDispatched(); }); @@ -54,13 +54,13 @@ fakeEvents(); fakeTinkoffCreditHttp(); - $payment1 = createPayment(TypeEnum::outside); - $payment2 = createPayment(TypeEnum::cash); - $payment3 = createPayment(TypeEnum::tinkoffCredit); + $payment1 = createPayment(TypeEnum::Outside); + $payment2 = createPayment(TypeEnum::Cash); + $payment3 = createPayment(TypeEnum::TinkoffCredit); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 2); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 2); @@ -71,9 +71,9 @@ artisan(Refund::class); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::refund); - expect($payment3)->toBeStatus(StatusEnum::refund); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Refund); + expect($payment3)->toBeStatus(StatusEnum::Refund); Event::assertDispatchedTimes(PaymentRefundedEvent::class, 2); }); @@ -82,13 +82,13 @@ fakeEvents(); fakeTinkoffCreditHttp(); - $payment1 = createPayment(TypeEnum::outside); - $payment2 = createPayment(TypeEnum::cash); - $payment3 = createPayment(TypeEnum::tinkoffCredit); + $payment1 = createPayment(TypeEnum::Outside); + $payment2 = createPayment(TypeEnum::Cash); + $payment3 = createPayment(TypeEnum::TinkoffCredit); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 2); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 2); @@ -97,9 +97,9 @@ artisan(Refund::class, ['--force' => true]); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::refund); - expect($payment3)->toBeStatus(StatusEnum::refund); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Refund); + expect($payment3)->toBeStatus(StatusEnum::Refund); Event::assertDispatchedTimes(PaymentRefundedEvent::class, 2); }); @@ -108,13 +108,13 @@ fakeEvents(); fakeTinkoffCreditHttp(); - $payment1 = createPayment(TypeEnum::outside); - $payment2 = createPayment(TypeEnum::cash); - $payment3 = createPayment(TypeEnum::tinkoffCredit); + $payment1 = createPayment(TypeEnum::Outside); + $payment2 = createPayment(TypeEnum::Cash); + $payment3 = createPayment(TypeEnum::TinkoffCredit); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 2); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 2); @@ -125,9 +125,9 @@ 'payment' => $payment2->id, ]); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::refund); - expect($payment3)->toBeStatus(StatusEnum::success); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Refund); + expect($payment3)->toBeStatus(StatusEnum::Success); Event::assertDispatchedTimes(PaymentRefundedEvent::class, 1); }); @@ -136,13 +136,13 @@ fakeEvents(); fakeTinkoffCreditHttp(); - $payment1 = createPayment(TypeEnum::outside); - $payment2 = createPayment(TypeEnum::cash); - $payment3 = createPayment(TypeEnum::tinkoffCredit); + $payment1 = createPayment(TypeEnum::Outside); + $payment2 = createPayment(TypeEnum::Cash); + $payment3 = createPayment(TypeEnum::TinkoffCredit); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 2); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 2); @@ -154,9 +154,9 @@ '--force' => true, ]); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::refund); - expect($payment3)->toBeStatus(StatusEnum::success); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Refund); + expect($payment3)->toBeStatus(StatusEnum::Success); Event::assertDispatchedTimes(PaymentRefundedEvent::class, 1); Event::assertDispatchedTimes(PaymentWaitRefundEvent::class, 0); diff --git a/tests/Unit/Core/Console/VerifyTest.php b/tests/Unit/Core/Console/VerifyTest.php index f595c79c..81562ba1 100644 --- a/tests/Unit/Core/Console/VerifyTest.php +++ b/tests/Unit/Core/Console/VerifyTest.php @@ -26,35 +26,35 @@ fakeEvents(); fakeTinkoffCreditHttp(); - $payment1 = createPayment(TypeEnum::outside); - $payment2 = createPayment(TypeEnum::cash); - $payment3 = createPayment(TypeEnum::cash); - $payment4 = createPayment(TypeEnum::tinkoffCredit); - $payment5 = createPayment(TypeEnum::tinkoffCredit); - - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); - expect($payment4)->toBeStatus(StatusEnum::success); - expect($payment5)->toBeStatus(StatusEnum::success); + $payment1 = createPayment(TypeEnum::Outside); + $payment2 = createPayment(TypeEnum::Cash); + $payment3 = createPayment(TypeEnum::Cash); + $payment4 = createPayment(TypeEnum::TinkoffCredit); + $payment5 = createPayment(TypeEnum::TinkoffCredit); + + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); + expect($payment4)->toBeStatus(StatusEnum::Success); + expect($payment5)->toBeStatus(StatusEnum::Success); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 4); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 4); - setStatus(StatusEnum::new, $payment2, $payment4); + setStatus(StatusEnum::New, $payment2, $payment4); fakeEvents(); - expect($payment2)->toBeStatus(StatusEnum::new); - expect($payment4)->toBeStatus(StatusEnum::new); + expect($payment2)->toBeStatus(StatusEnum::New); + expect($payment4)->toBeStatus(StatusEnum::New); artisan(Verify::class); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); - expect($payment4)->toBeStatus(StatusEnum::success); - expect($payment5)->toBeStatus(StatusEnum::success); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); + expect($payment4)->toBeStatus(StatusEnum::Success); + expect($payment5)->toBeStatus(StatusEnum::Success); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 0); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 2); @@ -64,17 +64,17 @@ fakeEvents(); fakeTinkoffCreditHttp('new'); - $payment1 = createPayment(TypeEnum::outside); - $payment2 = createPayment(TypeEnum::cash); - $payment3 = createPayment(TypeEnum::cash); - $payment4 = createPayment(TypeEnum::tinkoffCredit); - $payment5 = createPayment(TypeEnum::tinkoffCredit); + $payment1 = createPayment(TypeEnum::Outside); + $payment2 = createPayment(TypeEnum::Cash); + $payment3 = createPayment(TypeEnum::Cash); + $payment4 = createPayment(TypeEnum::TinkoffCredit); + $payment5 = createPayment(TypeEnum::TinkoffCredit); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); - expect($payment4)->toBeStatus(StatusEnum::new); - expect($payment5)->toBeStatus(StatusEnum::new); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); + expect($payment4)->toBeStatus(StatusEnum::New); + expect($payment5)->toBeStatus(StatusEnum::New); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 4); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 2); @@ -83,11 +83,11 @@ artisan(Verify::class); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); - expect($payment4)->toBeStatus(StatusEnum::new); - expect($payment5)->toBeStatus(StatusEnum::new); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); + expect($payment4)->toBeStatus(StatusEnum::New); + expect($payment5)->toBeStatus(StatusEnum::New); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 0); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 0); @@ -96,11 +96,11 @@ artisan(Verify::class); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); - expect($payment4)->toBeStatus(StatusEnum::new); - expect($payment5)->toBeStatus(StatusEnum::new); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); + expect($payment4)->toBeStatus(StatusEnum::New); + expect($payment5)->toBeStatus(StatusEnum::New); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 0); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 0); @@ -110,22 +110,22 @@ fakeEvents(); fakeTinkoffCreditHttp('new'); - $payment1 = createPayment(TypeEnum::outside); - $payment2 = createPayment(TypeEnum::cash); - $payment3 = createPayment(TypeEnum::cash); - $payment4 = createPayment(TypeEnum::tinkoffCredit); - $payment5 = createPayment(TypeEnum::tinkoffCredit); + $payment1 = createPayment(TypeEnum::Outside); + $payment2 = createPayment(TypeEnum::Cash); + $payment3 = createPayment(TypeEnum::Cash); + $payment4 = createPayment(TypeEnum::TinkoffCredit); + $payment5 = createPayment(TypeEnum::TinkoffCredit); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); - expect($payment4)->toBeStatus(StatusEnum::new); - expect($payment5)->toBeStatus(StatusEnum::new); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); + expect($payment4)->toBeStatus(StatusEnum::New); + expect($payment5)->toBeStatus(StatusEnum::New); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 4); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 2); - setStatus(StatusEnum::new, $payment2, $payment3); + setStatus(StatusEnum::New, $payment2, $payment3); fakeEvents(); @@ -133,11 +133,11 @@ 'payment' => $payment2->id, ]); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::new); - expect($payment4)->toBeStatus(StatusEnum::new); - expect($payment5)->toBeStatus(StatusEnum::new); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::New); + expect($payment4)->toBeStatus(StatusEnum::New); + expect($payment5)->toBeStatus(StatusEnum::New); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 0); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 1); @@ -147,22 +147,22 @@ fakeEvents(); fakeTinkoffCreditHttp('new'); - $payment1 = createPayment(TypeEnum::outside); - $payment2 = createPayment(TypeEnum::cash); - $payment3 = createPayment(TypeEnum::cash); - $payment4 = createPayment(TypeEnum::tinkoffCredit); - $payment5 = createPayment(TypeEnum::tinkoffCredit); + $payment1 = createPayment(TypeEnum::Outside); + $payment2 = createPayment(TypeEnum::Cash); + $payment3 = createPayment(TypeEnum::Cash); + $payment4 = createPayment(TypeEnum::TinkoffCredit); + $payment5 = createPayment(TypeEnum::TinkoffCredit); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::success); - expect($payment4)->toBeStatus(StatusEnum::new); - expect($payment5)->toBeStatus(StatusEnum::new); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::Success); + expect($payment4)->toBeStatus(StatusEnum::New); + expect($payment5)->toBeStatus(StatusEnum::New); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 4); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 2); - setStatus(StatusEnum::new, $payment2, $payment3); + setStatus(StatusEnum::New, $payment2, $payment3); fakeEvents(); @@ -171,11 +171,11 @@ '--force' => true, ]); - expect($payment1)->toBeStatus(StatusEnum::new); - expect($payment2)->toBeStatus(StatusEnum::success); - expect($payment3)->toBeStatus(StatusEnum::new); - expect($payment4)->toBeStatus(StatusEnum::new); - expect($payment5)->toBeStatus(StatusEnum::new); + expect($payment1)->toBeStatus(StatusEnum::New); + expect($payment2)->toBeStatus(StatusEnum::Success); + expect($payment3)->toBeStatus(StatusEnum::New); + expect($payment4)->toBeStatus(StatusEnum::New); + expect($payment5)->toBeStatus(StatusEnum::New); Event::assertDispatchedTimes(PaymentCreatedEvent::class, 0); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 1); diff --git a/tests/Unit/Core/Data/Casts/FromEnumCastTest.php b/tests/Unit/Core/Data/Casts/FromEnumCastTest.php index 18ec866f..31e00995 100644 --- a/tests/Unit/Core/Data/Casts/FromEnumCastTest.php +++ b/tests/Unit/Core/Data/Casts/FromEnumCastTest.php @@ -20,12 +20,12 @@ it('must be a enum', function () { expect( - dataCast(FromEnumCast::class, TypeEnum::cash) - )->toBe(TypeEnum::cash->value)->toBeString(); + dataCast(FromEnumCast::class, TypeEnum::Cash) + )->toBe(TypeEnum::Cash->value)->toBeString(); expect( - dataCast(FromEnumCast::class, TypeEnum::outside) - )->toBe(TypeEnum::outside->value)->toBeString(); + dataCast(FromEnumCast::class, TypeEnum::Outside) + )->toBe(TypeEnum::Outside->value)->toBeString(); }); it('must be a empty', function () { diff --git a/tests/Unit/Core/Facades/ConfigTest.php b/tests/Unit/Core/Facades/ConfigTest.php index 5eaaa126..0b20e95c 100644 --- a/tests/Unit/Core/Facades/ConfigTest.php +++ b/tests/Unit/Core/Facades/ConfigTest.php @@ -53,19 +53,19 @@ expect($data->attribute->status)->toBe('status'); expect($data->attribute->createdAt)->toBe('created_at'); - expect($data->status->new)->toBe(StatusEnum::new); - expect($data->status->success)->toBe(StatusEnum::success); - expect($data->status->waitRefund)->toBe(StatusEnum::waitRefund); - expect($data->status->refund)->toBe(StatusEnum::refund); - expect($data->status->failed)->toBe(StatusEnum::failed); + expect($data->status->new)->toBe(StatusEnum::New); + expect($data->status->success)->toBe(StatusEnum::Success); + expect($data->status->waitRefund)->toBe(StatusEnum::WaitRefund); + expect($data->status->refund)->toBe(StatusEnum::Refund); + expect($data->status->failed)->toBe(StatusEnum::Failed); expect($data->drivers)->toBeArray(); expect($data->drivers)->toMatchArray([ - TypeEnum::cash() => TypeEnum::cash, - TypeEnum::sberQrCode() => TypeEnum::sberQrCode, - TypeEnum::tinkoffCredit() => TypeEnum::tinkoffCredit, - TypeEnum::tinkoffOnline() => TypeEnum::tinkoffOnline, - TypeEnum::tinkoffQrCode() => TypeEnum::tinkoffQrCode, + TypeEnum::cash() => TypeEnum::Cash, + TypeEnum::sberQrCode() => TypeEnum::SberQrCode, + TypeEnum::tinkoffCredit() => TypeEnum::TinkoffCredit, + TypeEnum::tinkoffOnline() => TypeEnum::TinkoffOnline, + TypeEnum::tinkoffQrCode() => TypeEnum::TinkoffQrCode, ]); }); @@ -167,12 +167,12 @@ function (array $main, array $driver, array $expected) { expect($item->getQueue()->refund)->toBe($expected['refund']); } )->with([ - 'filled' => [ + 'filled' => [ queueData('q1', 'q2', 'q3'), queueData('q4', 'q5', 'q6'), queueData('q4', 'q5', 'q6'), ], - 'partial' => [ + 'partial' => [ queueData('q1', 'q2', 'q3'), queueData('q4', null, null), queueData('q4', null, null), @@ -182,12 +182,12 @@ function (array $main, array $driver, array $expected) { [], queueData(null, null, null), ], - 'main empty' => [ + 'main empty' => [ [], queueData('q4', 'q5', 'q6'), queueData('q4', 'q5', 'q6'), ], - 'full empty' => [ + 'full empty' => [ [], [], queueData(null, null, null), diff --git a/tests/Unit/Drivers/Cash/CreateTest.php b/tests/Unit/Drivers/Cash/CreateTest.php index d97e637a..24baf661 100644 --- a/tests/Unit/Drivers/Cash/CreateTest.php +++ b/tests/Unit/Drivers/Cash/CreateTest.php @@ -28,10 +28,10 @@ it('checks the create', function () { fakeEvents(); - $payment = createPayment(TypeEnum::cash); + $payment = createPayment(TypeEnum::Cash); - expect($payment->type)->toBe(TypeEnum::cash); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::Cash); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); diff --git a/tests/Unit/Drivers/Cash/RefundTest.php b/tests/Unit/Drivers/Cash/RefundTest.php index 113a0a8c..ca74e974 100644 --- a/tests/Unit/Drivers/Cash/RefundTest.php +++ b/tests/Unit/Drivers/Cash/RefundTest.php @@ -28,22 +28,22 @@ it('checks the manual refund', function () { fakeEvents(); - $payment = createPayment(TypeEnum::cash); + $payment = createPayment(TypeEnum::Cash); - expect($payment->type)->toBe(TypeEnum::cash); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::Cash); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); $payment->refresh(); - expect($payment->status)->toBe(StatusEnum::success); + expect($payment->status)->toBe(StatusEnum::Success); // refund $payment->refresh(); $payment->cashboxJob()->refund(); $payment->refresh(); - expect($payment->status)->toBe(StatusEnum::refund); + expect($payment->status)->toBe(StatusEnum::Refund); Event::assertDispatchedTimes(PaymentCreatedEvent::class); Event::assertDispatchedTimes(PaymentSuccessEvent::class); @@ -61,15 +61,15 @@ config(['cashbox.auto_refund.enabled' => true]); - $payment = createPayment(TypeEnum::cash); + $payment = createPayment(TypeEnum::Cash); - expect($payment->type)->toBe(TypeEnum::cash); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::Cash); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); $payment->refresh(); - expect($payment->status)->toBe(StatusEnum::refund); + expect($payment->status)->toBe(StatusEnum::Refund); Event::assertDispatchedTimes(PaymentCreatedEvent::class); Event::assertDispatchedTimes(PaymentSuccessEvent::class); diff --git a/tests/Unit/Drivers/Cash/VerifyTest.php b/tests/Unit/Drivers/Cash/VerifyTest.php index 105d4e03..0206c64a 100644 --- a/tests/Unit/Drivers/Cash/VerifyTest.php +++ b/tests/Unit/Drivers/Cash/VerifyTest.php @@ -28,22 +28,22 @@ it('checks the verify', function () { fakeEvents(); - $payment = createPayment(TypeEnum::cash); + $payment = createPayment(TypeEnum::Cash); - expect($payment->type)->toBe(TypeEnum::cash); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::Cash); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); // verify $payment->refresh()->updateQuietly([ - 'status' => StatusEnum::new, + 'status' => StatusEnum::New, ]); $payment->cashboxJob()->verify(); $payment->refresh(); - expect($payment->status)->toBe(StatusEnum::success); + expect($payment->status)->toBe(StatusEnum::Success); Event::assertDispatchedTimes(PaymentCreatedEvent::class); Event::assertDispatchedTimes(PaymentSuccessEvent::class, 2); diff --git a/tests/Unit/Drivers/Outside/CreateTest.php b/tests/Unit/Drivers/Outside/CreateTest.php index cabdfaf0..3c1b3de0 100644 --- a/tests/Unit/Drivers/Outside/CreateTest.php +++ b/tests/Unit/Drivers/Outside/CreateTest.php @@ -27,10 +27,10 @@ it('checks the create', function () { fakeEvents(); - $payment = createPayment(TypeEnum::outside); + $payment = createPayment(TypeEnum::Outside); - expect($payment->type)->toBe(TypeEnum::outside); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::Outside); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeDoesntHaveCashbox(); diff --git a/tests/Unit/Drivers/Outside/FailedTest.php b/tests/Unit/Drivers/Outside/FailedTest.php index b6a5cc66..94b92796 100644 --- a/tests/Unit/Drivers/Outside/FailedTest.php +++ b/tests/Unit/Drivers/Outside/FailedTest.php @@ -27,14 +27,14 @@ it('checks the failed', function () { fakeEvents(); - $payment = createPayment(TypeEnum::outside); + $payment = createPayment(TypeEnum::Outside); - expect($payment->type)->toBe(TypeEnum::outside); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::Outside); + expect($payment->status)->toBe(StatusEnum::New); - $payment->update(['status' => StatusEnum::failed]); + $payment->update(['status' => StatusEnum::Failed]); - expect($payment->status)->toBe(StatusEnum::failed); + expect($payment->status)->toBe(StatusEnum::Failed); expect($payment)->toBeDoesntHaveCashbox(); diff --git a/tests/Unit/Drivers/Outside/RefundTest.php b/tests/Unit/Drivers/Outside/RefundTest.php index bcbbb377..d910de5f 100644 --- a/tests/Unit/Drivers/Outside/RefundTest.php +++ b/tests/Unit/Drivers/Outside/RefundTest.php @@ -27,18 +27,18 @@ it('checks the wait to refund', function () { fakeEvents(); - $payment = createPayment(TypeEnum::outside); + $payment = createPayment(TypeEnum::Outside); - expect($payment->type)->toBe(TypeEnum::outside); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::Outside); + expect($payment->status)->toBe(StatusEnum::New); - $payment->update(['status' => StatusEnum::waitRefund]); + $payment->update(['status' => StatusEnum::WaitRefund]); - expect($payment->status)->toBe(StatusEnum::waitRefund); + expect($payment->status)->toBe(StatusEnum::WaitRefund); - $payment->update(['status' => StatusEnum::refund]); + $payment->update(['status' => StatusEnum::Refund]); - expect($payment->status)->toBe(StatusEnum::refund); + expect($payment->status)->toBe(StatusEnum::Refund); expect($payment)->toBeDoesntHaveCashbox(); @@ -52,14 +52,14 @@ it('checks the refund', function () { fakeEvents(); - $payment = createPayment(TypeEnum::outside); + $payment = createPayment(TypeEnum::Outside); - expect($payment->type)->toBe(TypeEnum::outside); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::Outside); + expect($payment->status)->toBe(StatusEnum::New); - $payment->update(['status' => StatusEnum::refund]); + $payment->update(['status' => StatusEnum::Refund]); - expect($payment->status)->toBe(StatusEnum::refund); + expect($payment->status)->toBe(StatusEnum::Refund); expect($payment)->toBeDoesntHaveCashbox(); diff --git a/tests/Unit/Drivers/Outside/VerifyTest.php b/tests/Unit/Drivers/Outside/VerifyTest.php index 0750e71f..3408e698 100644 --- a/tests/Unit/Drivers/Outside/VerifyTest.php +++ b/tests/Unit/Drivers/Outside/VerifyTest.php @@ -27,14 +27,14 @@ it('checks the verify', function () { fakeEvents(); - $payment = createPayment(TypeEnum::outside); + $payment = createPayment(TypeEnum::Outside); - expect($payment->type)->toBe(TypeEnum::outside); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::Outside); + expect($payment->status)->toBe(StatusEnum::New); - $payment->update(['status' => StatusEnum::failed]); + $payment->update(['status' => StatusEnum::Failed]); - expect($payment->status)->toBe(StatusEnum::failed); + expect($payment->status)->toBe(StatusEnum::Failed); expect($payment)->toBeDoesntHaveCashbox(); diff --git a/tests/Unit/Drivers/SberAuth/SignTest.php b/tests/Unit/Drivers/SberAuth/SignTest.php index 9944554d..0e2f9670 100644 --- a/tests/Unit/Drivers/SberAuth/SignTest.php +++ b/tests/Unit/Drivers/SberAuth/SignTest.php @@ -20,7 +20,7 @@ it('should check authorization', function () { fakeSberAuth(); - $payment = createPayment(TypeEnum::sberQrCode); + $payment = createPayment(TypeEnum::SberQrCode); $sign = sberAuth($payment); diff --git a/tests/Unit/Drivers/TemplateAuth/AuthTest.php b/tests/Unit/Drivers/TemplateAuth/AuthTest.php index 36afb11e..6fecc550 100644 --- a/tests/Unit/Drivers/TemplateAuth/AuthTest.php +++ b/tests/Unit/Drivers/TemplateAuth/AuthTest.php @@ -24,7 +24,7 @@ fakeEvents(); fakeTemplateHttp(); - $payment = createPayment(TypeEnum::templateDriver, 1234); + $payment = createPayment(TypeEnum::TemplateDriver, 1234); $auth = templateAuth($payment, Basic::class, TemplateAuthBasicRequest::class); diff --git a/tests/Unit/Drivers/TemplateDriver/CreateTest.php b/tests/Unit/Drivers/TemplateDriver/CreateTest.php index 34a70143..ccbdc644 100644 --- a/tests/Unit/Drivers/TemplateDriver/CreateTest.php +++ b/tests/Unit/Drivers/TemplateDriver/CreateTest.php @@ -32,7 +32,7 @@ fakeEvents(); fakeTemplateHttp(); - $payment = createPayment(TypeEnum::templateDriver, 1234); + $payment = createPayment(TypeEnum::TemplateDriver, 1234); $data = [ 'OrderId' => $payment->id, @@ -43,7 +43,7 @@ // Init Http::assertSent(function (Request $request) use ($data) { return $request->hasHeader('X-Some-ID', 12345) - && $request->data() === $data; + && $data === $request->data(); }); // Verify @@ -56,16 +56,16 @@ fakeEvents(); fakeTemplateHttp('NEW'); - $payment = createPayment(TypeEnum::templateDriver); + $payment = createPayment(TypeEnum::TemplateDriver); - expect($payment->type)->toBe(TypeEnum::templateDriver); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TemplateDriver); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); $payment->refresh(); - expect($payment)->toBeStatus(StatusEnum::new); + expect($payment)->toBeStatus(StatusEnum::New); expect($payment->cashbox->info->extra['url'])->toBeUrl(); @@ -81,16 +81,16 @@ fakeEvents(); fakeTemplateHttp(); - $payment = createPayment(TypeEnum::templateDriver); + $payment = createPayment(TypeEnum::TemplateDriver); - expect($payment->type)->toBe(TypeEnum::templateDriver); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TemplateDriver); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); $payment->refresh(); - expect($payment)->toBeStatus(StatusEnum::success); + expect($payment)->toBeStatus(StatusEnum::Success); expect($payment->cashbox->info->extra['url'])->toBeUrl(); @@ -106,5 +106,5 @@ fakeEvents(); fakeTemplateInvalidHttp(); - createPayment(TypeEnum::templateDriver); + createPayment(TypeEnum::TemplateDriver); })->expectException(BadRequestHttpException::class); diff --git a/tests/Unit/Drivers/TemplateDriver/RefundTest.php b/tests/Unit/Drivers/TemplateDriver/RefundTest.php index 50f2719e..d7175ea9 100644 --- a/tests/Unit/Drivers/TemplateDriver/RefundTest.php +++ b/tests/Unit/Drivers/TemplateDriver/RefundTest.php @@ -27,10 +27,10 @@ fakeEvents(); fakeTinkoffOnlineHttp('NEW'); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::TinkoffOnline); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffOnline); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); @@ -42,7 +42,7 @@ artisan(Refund::class); // time has not yet come to refund. - expect($payment)->toBeStatus(StatusEnum::new); + expect($payment)->toBeStatus(StatusEnum::New); Event::assertNothingDispatched(); @@ -52,7 +52,7 @@ artisan(Refund::class); - expect($payment)->toBeStatus(StatusEnum::refund); + expect($payment)->toBeStatus(StatusEnum::Refund); Event::assertDispatchedTimes(PaymentRefundedEvent::class); }); @@ -61,10 +61,10 @@ fakeEvents(); fakeTinkoffOnlineHttp(); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::TinkoffOnline); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffOnline); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); @@ -76,7 +76,7 @@ artisan(Refund::class); // time has not yet come to refund. - expect($payment)->toBeStatus(StatusEnum::success); + expect($payment)->toBeStatus(StatusEnum::Success); Event::assertNothingDispatched(); @@ -86,7 +86,7 @@ artisan(Refund::class); - expect($payment)->toBeStatus(StatusEnum::refund); + expect($payment)->toBeStatus(StatusEnum::Refund); Event::assertDispatchedTimes(PaymentRefundedEvent::class); }); diff --git a/tests/Unit/Drivers/TemplateDriver/VerifyTest.php b/tests/Unit/Drivers/TemplateDriver/VerifyTest.php index 3402b272..ff17cb09 100644 --- a/tests/Unit/Drivers/TemplateDriver/VerifyTest.php +++ b/tests/Unit/Drivers/TemplateDriver/VerifyTest.php @@ -26,10 +26,10 @@ fakeEvents(); fakeTinkoffOnlineHttp('NEW'); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::TinkoffOnline); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffOnline); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); @@ -40,7 +40,7 @@ artisan(Verify::class); - expect($payment)->toBeStatus(StatusEnum::new); + expect($payment)->toBeStatus(StatusEnum::New); Event::assertNothingDispatched(); }); @@ -49,10 +49,10 @@ fakeEvents(); fakeTinkoffOnlineHttp(); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::TinkoffOnline); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffOnline); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); diff --git a/tests/Unit/Drivers/TinkoffCredit/CreateTest.php b/tests/Unit/Drivers/TinkoffCredit/CreateTest.php index 4aa46eec..3a77a878 100644 --- a/tests/Unit/Drivers/TinkoffCredit/CreateTest.php +++ b/tests/Unit/Drivers/TinkoffCredit/CreateTest.php @@ -29,16 +29,16 @@ fakeEvents(); fakeTinkoffCreditHttp('new'); - $payment = createPayment(TypeEnum::tinkoffCredit); + $payment = createPayment(TypeEnum::TinkoffCredit); - expect($payment->type)->toBe(TypeEnum::tinkoffCredit); - expect($payment->status)->toBe(AppStatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffCredit); + expect($payment->status)->toBe(AppStatusEnum::New); expect($payment)->toBeHasCashbox(); $payment->refresh(); - expect(StatusEnum::new)->toBe( + expect(StatusEnum::New)->toBe( $payment->cashboxDriver()->statuses()->detect($payment->cashbox->info->status) ); @@ -56,16 +56,16 @@ fakeEvents(); fakeTinkoffCreditHttp(); - $payment = createPayment(TypeEnum::tinkoffCredit); + $payment = createPayment(TypeEnum::TinkoffCredit); - expect($payment->type)->toBe(TypeEnum::tinkoffCredit); - expect($payment->status)->toBe(AppStatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffCredit); + expect($payment->status)->toBe(AppStatusEnum::New); expect($payment)->toBeHasCashbox(); $payment->refresh(); - expect(StatusEnum::success)->toBe( + expect(StatusEnum::Success)->toBe( $payment->cashboxDriver()->statuses()->detect($payment->cashbox->info->status) ); diff --git a/tests/Unit/Drivers/TinkoffCredit/RefundTest.php b/tests/Unit/Drivers/TinkoffCredit/RefundTest.php index b913ed01..1563059c 100644 --- a/tests/Unit/Drivers/TinkoffCredit/RefundTest.php +++ b/tests/Unit/Drivers/TinkoffCredit/RefundTest.php @@ -27,10 +27,10 @@ fakeEvents(); fakeTinkoffCreditHttp('new'); - $payment = createPayment(TypeEnum::tinkoffCredit); + $payment = createPayment(TypeEnum::TinkoffCredit); - expect($payment->type)->toBe(TypeEnum::tinkoffCredit); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffCredit); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); @@ -42,7 +42,7 @@ artisan(Refund::class); // time has not yet come to refund. - expect($payment)->toBeStatus(StatusEnum::new); + expect($payment)->toBeStatus(StatusEnum::New); Event::assertNothingDispatched(); @@ -52,7 +52,7 @@ artisan(Refund::class); - expect($payment)->toBeStatus(StatusEnum::refund); + expect($payment)->toBeStatus(StatusEnum::Refund); Event::assertDispatchedTimes(PaymentRefundedEvent::class); }); @@ -61,10 +61,10 @@ fakeEvents(); fakeTinkoffCreditHttp(); - $payment = createPayment(TypeEnum::tinkoffCredit); + $payment = createPayment(TypeEnum::TinkoffCredit); - expect($payment->type)->toBe(TypeEnum::tinkoffCredit); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffCredit); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); @@ -76,7 +76,7 @@ artisan(Refund::class); // time has not yet come to refund. - expect($payment)->toBeStatus(StatusEnum::success); + expect($payment)->toBeStatus(StatusEnum::Success); Event::assertNothingDispatched(); @@ -86,7 +86,7 @@ artisan(Refund::class); - expect($payment)->toBeStatus(StatusEnum::refund); + expect($payment)->toBeStatus(StatusEnum::Refund); Event::assertDispatchedTimes(PaymentRefundedEvent::class); }); diff --git a/tests/Unit/Drivers/TinkoffCredit/VerifyTest.php b/tests/Unit/Drivers/TinkoffCredit/VerifyTest.php index 666c8d2a..b12a00cc 100644 --- a/tests/Unit/Drivers/TinkoffCredit/VerifyTest.php +++ b/tests/Unit/Drivers/TinkoffCredit/VerifyTest.php @@ -26,10 +26,10 @@ fakeEvents(); fakeTinkoffCreditHttp('new'); - $payment = createPayment(TypeEnum::tinkoffCredit); + $payment = createPayment(TypeEnum::TinkoffCredit); - expect($payment->type)->toBe(TypeEnum::tinkoffCredit); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffCredit); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); @@ -40,7 +40,7 @@ artisan(Verify::class); - expect($payment)->toBeStatus(StatusEnum::new); + expect($payment)->toBeStatus(StatusEnum::New); Event::assertNothingDispatched(); }); @@ -49,10 +49,10 @@ fakeEvents(); fakeTinkoffCreditHttp(); - $payment = createPayment(TypeEnum::tinkoffCredit); + $payment = createPayment(TypeEnum::TinkoffCredit); - expect($payment->type)->toBe(TypeEnum::tinkoffCredit); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffCredit); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); diff --git a/tests/Unit/Drivers/TinkoffOnline/CreateTest.php b/tests/Unit/Drivers/TinkoffOnline/CreateTest.php index 3a059dc8..178c7bb6 100644 --- a/tests/Unit/Drivers/TinkoffOnline/CreateTest.php +++ b/tests/Unit/Drivers/TinkoffOnline/CreateTest.php @@ -29,16 +29,16 @@ fakeEvents(); fakeTinkoffOnlineHttp('NEW'); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::TinkoffOnline); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffOnline); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); $payment->refresh(); - expect($payment)->toBeStatus(StatusEnum::new); + expect($payment)->toBeStatus(StatusEnum::New); expect($payment->cashbox->info->extra['url'])->toBeUrl(); @@ -54,16 +54,16 @@ fakeEvents(); fakeTinkoffOnlineHttp(); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::TinkoffOnline); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffOnline); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); $payment->refresh(); - expect($payment)->toBeStatus(StatusEnum::success); + expect($payment)->toBeStatus(StatusEnum::Success); expect($payment->cashbox->info->extra['url'])->toBeUrl(); @@ -79,5 +79,5 @@ fakeEvents(); fakeTinkoffOnlineInvalidHttp(); - createPayment(TypeEnum::tinkoffOnline); + createPayment(TypeEnum::TinkoffOnline); })->expectException(BadRequestHttpException::class); diff --git a/tests/Unit/Drivers/TinkoffOnline/RefundTest.php b/tests/Unit/Drivers/TinkoffOnline/RefundTest.php index 50f2719e..d7175ea9 100644 --- a/tests/Unit/Drivers/TinkoffOnline/RefundTest.php +++ b/tests/Unit/Drivers/TinkoffOnline/RefundTest.php @@ -27,10 +27,10 @@ fakeEvents(); fakeTinkoffOnlineHttp('NEW'); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::TinkoffOnline); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffOnline); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); @@ -42,7 +42,7 @@ artisan(Refund::class); // time has not yet come to refund. - expect($payment)->toBeStatus(StatusEnum::new); + expect($payment)->toBeStatus(StatusEnum::New); Event::assertNothingDispatched(); @@ -52,7 +52,7 @@ artisan(Refund::class); - expect($payment)->toBeStatus(StatusEnum::refund); + expect($payment)->toBeStatus(StatusEnum::Refund); Event::assertDispatchedTimes(PaymentRefundedEvent::class); }); @@ -61,10 +61,10 @@ fakeEvents(); fakeTinkoffOnlineHttp(); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::TinkoffOnline); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffOnline); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); @@ -76,7 +76,7 @@ artisan(Refund::class); // time has not yet come to refund. - expect($payment)->toBeStatus(StatusEnum::success); + expect($payment)->toBeStatus(StatusEnum::Success); Event::assertNothingDispatched(); @@ -86,7 +86,7 @@ artisan(Refund::class); - expect($payment)->toBeStatus(StatusEnum::refund); + expect($payment)->toBeStatus(StatusEnum::Refund); Event::assertDispatchedTimes(PaymentRefundedEvent::class); }); diff --git a/tests/Unit/Drivers/TinkoffOnline/VerifyTest.php b/tests/Unit/Drivers/TinkoffOnline/VerifyTest.php index 3402b272..ff17cb09 100644 --- a/tests/Unit/Drivers/TinkoffOnline/VerifyTest.php +++ b/tests/Unit/Drivers/TinkoffOnline/VerifyTest.php @@ -26,10 +26,10 @@ fakeEvents(); fakeTinkoffOnlineHttp('NEW'); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::TinkoffOnline); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffOnline); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); @@ -40,7 +40,7 @@ artisan(Verify::class); - expect($payment)->toBeStatus(StatusEnum::new); + expect($payment)->toBeStatus(StatusEnum::New); Event::assertNothingDispatched(); }); @@ -49,10 +49,10 @@ fakeEvents(); fakeTinkoffOnlineHttp(); - $payment = createPayment(TypeEnum::tinkoffOnline); + $payment = createPayment(TypeEnum::TinkoffOnline); - expect($payment->type)->toBe(TypeEnum::tinkoffOnline); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffOnline); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); diff --git a/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php b/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php index ee693a7c..a1a546f6 100644 --- a/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php +++ b/tests/Unit/Drivers/TinkoffQrCode/CreateTest.php @@ -29,16 +29,16 @@ fakeEvents(); fakeTinkoffQrCodeHttp('NEW'); - $payment = createPayment(TypeEnum::tinkoffQrCode); + $payment = createPayment(TypeEnum::TinkoffQrCode); - expect($payment->type)->toBe(TypeEnum::tinkoffQrCode); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffQrCode); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); $payment->refresh(); - expect($payment)->toBeStatus(StatusEnum::new); + expect($payment)->toBeStatus(StatusEnum::New); expect($payment->cashbox->info->extra['url'])->toBeUrl(); @@ -54,16 +54,16 @@ fakeEvents(); fakeTinkoffQrCodeHttp(); - $payment = createPayment(TypeEnum::tinkoffQrCode); + $payment = createPayment(TypeEnum::TinkoffQrCode); - expect($payment->type)->toBe(TypeEnum::tinkoffQrCode); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffQrCode); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); $payment->refresh(); - expect($payment)->toBeStatus(StatusEnum::success); + expect($payment)->toBeStatus(StatusEnum::Success); expect($payment->cashbox->info->extra['url'])->toBeUrl(); @@ -79,5 +79,5 @@ fakeEvents(); fakeTinkoffQrCodeInvalidHttp(); - createPayment(TypeEnum::tinkoffQrCode); + createPayment(TypeEnum::TinkoffQrCode); })->expectException(BadRequestHttpException::class); diff --git a/tests/Unit/Drivers/TinkoffQrCode/RefundTest.php b/tests/Unit/Drivers/TinkoffQrCode/RefundTest.php index 950f3274..09872caf 100644 --- a/tests/Unit/Drivers/TinkoffQrCode/RefundTest.php +++ b/tests/Unit/Drivers/TinkoffQrCode/RefundTest.php @@ -27,10 +27,10 @@ fakeEvents(); fakeTinkoffQrCodeHttp('NEW'); - $payment = createPayment(TypeEnum::tinkoffQrCode); + $payment = createPayment(TypeEnum::TinkoffQrCode); - expect($payment->type)->toBe(TypeEnum::tinkoffQrCode); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffQrCode); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); @@ -42,7 +42,7 @@ artisan(Refund::class); // time has not yet come to refund. - expect($payment)->toBeStatus(StatusEnum::new); + expect($payment)->toBeStatus(StatusEnum::New); Event::assertNothingDispatched(); @@ -52,7 +52,7 @@ artisan(Refund::class); - expect($payment)->toBeStatus(StatusEnum::refund); + expect($payment)->toBeStatus(StatusEnum::Refund); Event::assertDispatchedTimes(PaymentRefundedEvent::class); }); @@ -61,10 +61,10 @@ fakeEvents(); fakeTinkoffQrCodeHttp(); - $payment = createPayment(TypeEnum::tinkoffQrCode); + $payment = createPayment(TypeEnum::TinkoffQrCode); - expect($payment->type)->toBe(TypeEnum::tinkoffQrCode); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffQrCode); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); @@ -76,7 +76,7 @@ artisan(Refund::class); // time has not yet come to refund. - expect($payment)->toBeStatus(StatusEnum::success); + expect($payment)->toBeStatus(StatusEnum::Success); Event::assertNothingDispatched(); @@ -86,7 +86,7 @@ artisan(Refund::class); - expect($payment)->toBeStatus(StatusEnum::refund); + expect($payment)->toBeStatus(StatusEnum::Refund); Event::assertDispatchedTimes(PaymentRefundedEvent::class); }); diff --git a/tests/Unit/Drivers/TinkoffQrCode/VerifyTest.php b/tests/Unit/Drivers/TinkoffQrCode/VerifyTest.php index 04346242..284462c7 100644 --- a/tests/Unit/Drivers/TinkoffQrCode/VerifyTest.php +++ b/tests/Unit/Drivers/TinkoffQrCode/VerifyTest.php @@ -26,10 +26,10 @@ fakeEvents(); fakeTinkoffQrCodeHttp('NEW'); - $payment = createPayment(TypeEnum::tinkoffQrCode); + $payment = createPayment(TypeEnum::TinkoffQrCode); - expect($payment->type)->toBe(TypeEnum::tinkoffQrCode); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffQrCode); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); @@ -40,7 +40,7 @@ artisan(Verify::class); - expect($payment)->toBeStatus(StatusEnum::new); + expect($payment)->toBeStatus(StatusEnum::New); Event::assertNothingDispatched(); }); @@ -49,10 +49,10 @@ fakeEvents(); fakeTinkoffQrCodeHttp(); - $payment = createPayment(TypeEnum::tinkoffQrCode); + $payment = createPayment(TypeEnum::TinkoffQrCode); - expect($payment->type)->toBe(TypeEnum::tinkoffQrCode); - expect($payment->status)->toBe(StatusEnum::new); + expect($payment->type)->toBe(TypeEnum::TinkoffQrCode); + expect($payment->status)->toBe(StatusEnum::New); expect($payment)->toBeHasCashbox(); diff --git a/tests/database/2023_07_14_022222_create_payments_model.php b/tests/database/2023_07_14_022222_create_payments_model.php index a99c62c7..d29b295f 100644 --- a/tests/database/2023_07_14_022222_create_payments_model.php +++ b/tests/database/2023_07_14_022222_create_payments_model.php @@ -25,10 +25,10 @@ public function up(): void Schema::create('payments', function (Blueprint $table) { $table->id(); - $table->integer('price'); + $table->unsignedInteger('price'); $table->string('type'); - $table->tinyInteger('status'); + $table->unsignedTinyInteger('status'); $table->timestamps(); });