From 8281765d4e78c8026290980e8ad2ae1b9c921e41 Mon Sep 17 00:00:00 2001 From: wellfix Date: Mon, 27 Feb 2023 09:49:58 +0100 Subject: [PATCH 1/6] fix: changed name of field in PayPageConfigurationDto.php from $paymentMethodActionInfo to $paymentMethodActionInfoList, so it matches swagger docs --- src/Dto/Netaxept/PayPageConfigurationDto.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dto/Netaxept/PayPageConfigurationDto.php b/src/Dto/Netaxept/PayPageConfigurationDto.php index 0c6f02e..9f3c2f7 100644 --- a/src/Dto/Netaxept/PayPageConfigurationDto.php +++ b/src/Dto/Netaxept/PayPageConfigurationDto.php @@ -9,7 +9,7 @@ class PayPageConfigurationDto /** * @var PaymentMethodActionInfoDto[] */ - public ?array $paymentMethodActionInfo; + public ?array $paymentMethodActionInfoList; public string $language; public string $pageType; public string $templateName; From 8ff08156fa1ae6a5038334fa004a2f028806701e Mon Sep 17 00:00:00 2001 From: "pawel.karczmarczyk" Date: Tue, 21 Mar 2023 17:24:57 +0000 Subject: [PATCH 2/6] fix: Updated README.md for production --- README.md | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 0a63247..d456cfe 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,20 @@ -# NetsCore - Payment Core for simple integration EasyNets and Netaxept API for plugins +# NetsPaymentCore - Payment Core for simple integration Netaxept API for plugins ============================================ -| Core | NetsCore - Payment Core | -|-------------------|-------------------------| -| Author | `Nets eCom` | -| Version | `0.0.3` | -| License | `MIT License` | -| Supporting System | `Netaxept` | +| Core | NetsCore - Payment Core +|-------------------|------------------------- +| Author | `Nets eCom LAKA` +| Version | `1.2` +| License | `MIT License` +| Supporting System | `Nets eCom LAKA plugins` -## INSTALLATION -### Download / Installation +### What is it +SDK for payment plug-ins. These can be updated separately from the payment plugins themselves. - TODO: Finish this +### Updating SDK - -## Guide - -### Init core - -TODO: Finish this - -### Logs - -Logs are very simple to use. You must only use ``LogsService::logger("Message");`` and that's all. +* If the latest SDK package has been released and you don't have it in your plugin then all you need to do is + * composer update nets-ecom-integrations/paymentcore + * if manualy added via composer just use + * composer reinstall nets-ecom-integrations/paymentcore \ No newline at end of file From 9b0e48f24c16c967fa288593dee580f63b7d306d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Karczmarczyk?= Date: Thu, 23 Mar 2023 18:16:20 +0100 Subject: [PATCH 3/6] fix: Rebranding from NetsPayment to NexiNetsPayment --- composer.json | 8 +- src/Auth/NetaxeptAPIAuthService.php | 10 +- src/Auth/NetaxeptSandboxAPIAuthService.php | 10 +- src/Clients/BaseAPIClient.php | 6 +- src/Clients/NetaxeptAPIClient.php | 14 +- src/Clients/NetaxeptSandboxAPIClient.php | 14 +- src/Configuration/NetaxeptConfiguration.php | 8 +- .../NetaxeptSandboxConfiguration.php | 8 +- src/Dto/Netaxept/BasketItemDto.php | 2 +- src/Dto/Netaxept/CardDetails.php | 2 +- src/Dto/Netaxept/Customer/AddressDto.php | 2 +- .../Netaxept/Customer/CompanyCustomerDto.php | 4 +- src/Dto/Netaxept/Customer/CustomerDto.php | 4 +- .../Customer/IndividualCustomerDto.php | 4 +- .../CustomerDtoTransformerInterface.php | 2 +- src/Dto/Netaxept/PayPageConfigurationDto.php | 4 +- src/Dto/Netaxept/PaymentDetail.php | 2 +- .../Netaxept/PaymentMethodActionInfoDto.php | 2 +- ...ialPaymentMethodTokenizationDetailsDto.php | 4 +- .../MerchantInitiatedPaymentWithTokenDto.php | 4 +- .../PaymentWithTokenDto.php | 4 +- .../SepaDirectDepositTypeADto.php | 4 +- .../SepaDirectDepositTypeCDto.php | 4 +- .../PaymentMethodDetails/SofortDto.php | 4 +- src/Dto/Netaxept/PaymentSummary.php | 2 +- src/Dto/Netaxept/PaymentTransaction.php | 2 +- .../Netaxept/PaymentTransactionCollection.php | 2 +- src/Dto/Netaxept/RedirectUrlDto.php | 2 +- src/Dto/Netaxept/Request/PaymentObject.php | 14 +- src/Dto/Netaxept/Request/PaymentRequest.php | 4 +- .../Netaxept/Request/RefundPaymentRequest.php | 6 +- .../Response/AuthorizePaymentResponseDto.php | 2 +- .../Response/CancelPaymentResponseDto.php | 2 +- .../Response/CapturePaymentResponseDto.php | 2 +- .../Response/CreatePaymentResponseDto.php | 2 +- .../Response/PaymentDetailResponseDto.php | 12 +- .../Response/RefundPaymentResponseDto.php | 2 +- src/Enums/ApiUrlsEnum.php | 2 +- src/Enums/ClientTypeEnum.php | 2 +- src/Enums/CountryCodeEnum.php | 2 +- src/Enums/CurrencyCodeEnum.php | 2 +- src/Enums/CustomerTypeEnum.php | 2 +- src/Enums/ExceptionEnum.php | 2 +- src/Enums/LanguageEnum.php | 2 +- .../MerchantInitiatedTransactionTypeEnum.php | 2 +- src/Enums/PageTypeEnum.php | 2 +- src/Enums/PaymentMethodActionEnum.php | 2 +- src/Enums/PaymentMethodCardOriginEnum.php | 2 +- .../PaymentMethodCardProductTypeEnum.php | 2 +- src/Enums/PaymentMethodCardTypeEnum.php | 2 +- src/Enums/PaymentMethodDetailsTypeEnum.php | 2 +- src/Enums/PaymentMethodEnum.php | 2 +- src/Enums/PaymentMethodTypeEnum.php | 2 +- src/Enums/PaymentProcessingTypeEnum.php | 2 +- src/Enums/PaymentTypeEnum.php | 2 +- src/Exceptions/ApiResponseException.php | 2 +- src/Exceptions/CapturePaymentException.php | 2 +- src/Exceptions/CartValueException.php | 2 +- src/Exceptions/PaymentObjectException.php | 2 +- src/Factory/APIClientFactory.php | 4 +- src/Factory/AuthFactory.php | 8 +- src/Factory/ClientFactory.php | 8 +- src/Factory/ConfigurationFactory.php | 6 +- src/Formatters/UserCurrencyInputFormatter.php | 2 +- src/Interfaces/APIAuthServiceInterface.php | 2 +- src/Interfaces/APIClientInterface.php | 2 +- .../AuthorizePaymentRequestInterface.php | 2 +- src/Interfaces/CapturePaymentInterface.php | 2 +- src/Interfaces/ClientServiceInterface.php | 2 +- src/Interfaces/ConfigurationInterface.php | 2 +- src/Interfaces/CustomerInterface.php | 2 +- .../PaymentMethodDetailsInterface.php | 2 +- src/Interfaces/PaymentObjectInterface.php | 2 +- src/Interfaces/PaymentRequestInterface.php | 2 +- .../RequestDtoTransformerInterface.php | 2 +- src/NetsCore.php | 122 ------------------ src/Services/ApiService.php | 2 +- src/Services/AuthService.php | 6 +- src/Services/LogsService.php | 2 +- src/Services/NetaxeptSandboxService.php | 32 ++--- src/Services/NetaxeptService.php | 30 ++--- src/Tests/TestHelper.php | 2 +- src/Tests/Unit/NetsCoreTest.php | 16 +-- src/Validator/CapturePaymentValidator.php | 8 +- src/Validator/CartValueValidator.php | 8 +- src/Validator/IsDirectoryValidator.php | 2 +- src/Validator/PaymentObjectValidator.php | 20 +-- src/Validator/UserCurrencyInputValidator.php | 2 +- 88 files changed, 204 insertions(+), 326 deletions(-) delete mode 100644 src/NetsCore.php diff --git a/composer.json b/composer.json index 3d0cc7d..f9ebd18 100644 --- a/composer.json +++ b/composer.json @@ -1,17 +1,17 @@ { - "name": "nets-ecom-integrations/paymentcore", + "name": "nexi-nets-ecom-integrations/paymentcore", "description": "Core for Netaxept payments plugin", "type": "library", "license": "MIT", - "version": "1.1.1", + "version": "1.2", "autoload": { "psr-4": { - "NetsCore\\": "src/" + "NexiNetsCore\\": "src/" } }, "authors": [ { - "name": "Nets-eCom" + "name": "Nexi/Nets-eCom" } ], "require": { diff --git a/src/Auth/NetaxeptAPIAuthService.php b/src/Auth/NetaxeptAPIAuthService.php index fd11aae..e1fd705 100644 --- a/src/Auth/NetaxeptAPIAuthService.php +++ b/src/Auth/NetaxeptAPIAuthService.php @@ -1,11 +1,11 @@ configuration = $configuration ?: new NetaxeptConfiguration(); - $this->authService = (new AuthFactory())->getAuthenticationService($this->configuration, $this->configuration->getClientType()); - } - - /** - * @param PaymentObjectInterface $paymentObject - * - * @return CreatePaymentResponseDto - */ - public function createPayment(PaymentObjectInterface $paymentObject): CreatePaymentResponseDto - { - return $this->getClient()->createPayment($paymentObject); - } - - /** - * @param string $paymentId - * - * @return PaymentDetailResponseDto - */ - public function getPaymentDetails(string $paymentId): PaymentDetailResponseDto - { - return $this->getClient()->getPaymentDetails($paymentId); - } - - /** - * @param PaymentRequestInterface $paymentObject - * - * @return mixed - */ - public function cancelPayment(PaymentRequestInterface $paymentObject) - { - return $this->getClient()->cancelPayment($paymentObject); - } - - /** - * @param PaymentRequestInterface $authorizationObject - * - * @return AuthorizePaymentResponseDto - * @throws ApiResponseException - */ - public function authorizePayment(PaymentRequestInterface $authorizationObject): AuthorizePaymentResponseDto - { - try { - return $this->getClient()->authorizePayment($authorizationObject); - } catch (ApiResponseException $e) { - throw new ApiResponseException(); - } - } - - /** - * @param PaymentRequestInterface $capturePayment - * - * @return CapturePaymentResponseDto - * @throws ApiResponseException - */ - public function capturePayment(PaymentRequestInterface $capturePayment): CapturePaymentResponseDto - { - try { - return $this->getClient()->capturePayment($capturePayment); - } catch (ApiResponseException $e) { - throw new ApiResponseException(); - } - } - - /** - * @param PaymentRequestInterface $refundObject - * - * @return RefundPaymentResponseDto - */ - public function refundPayment(PaymentRequestInterface $refundObject): RefundPaymentResponseDto - { - return $this->getClient()->refundPayment($refundObject); - } - - public function salePayment() - { - //TODO: Create sale payment plugin api - } - - /** - * @return ClientServiceInterface - */ - protected function getClient(): ClientServiceInterface - { - $authService = new AuthService($this->configuration, $this->authService); - $apiClient = (new APIClientFactory())->getClient($authService->getAuthData(), $this->configuration->getClientType()); - return (new ClientFactory())->getService($apiClient, $this->configuration->getClientType()); - } -} diff --git a/src/Services/ApiService.php b/src/Services/ApiService.php index 8eae463..52f926b 100644 --- a/src/Services/ApiService.php +++ b/src/Services/ApiService.php @@ -1,6 +1,6 @@ Date: Thu, 23 Mar 2023 17:20:37 +0000 Subject: [PATCH 4/6] Updated README.md --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d456cfe..9476182 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ -# NetsPaymentCore - Payment Core for simple integration Netaxept API for plugins +# NexiNetsPaymentCore - Payment Core for simple integration with Netaxept API for plugins ============================================ | Core | NetsCore - Payment Core |-------------------|------------------------- -| Author | `Nets eCom LAKA` +| Author | `Nexi/Nets eCom LAKA` | Version | `1.2` | License | `MIT License` | Supporting System | `Nets eCom LAKA plugins` -### What is it -SDK for payment plug-ins. These can be updated separately from the payment plugins themselves. +### What it is +NexiNetsPaymentCore is an SDK for payment plug-ins. It can be updated separately from the payment plugins themselves. -### Updating SDK +### Updating the SDK -* If the latest SDK package has been released and you don't have it in your plugin then all you need to do is - * composer update nets-ecom-integrations/paymentcore - * if manualy added via composer just use - * composer reinstall nets-ecom-integrations/paymentcore \ No newline at end of file +* If the latest SDK package has been released and you don't have it in your plugin, then all you need to do is the following: + * composer update nexi-nets-ecom-integrations/paymentcore + * if the SDK was manually installed via composer use the below command: + * composer reinstall nexi-nets-ecom-integrations/paymentcore \ No newline at end of file From 9a8b9a3aa0aad6531b437f27c2731a360ed01e47 Mon Sep 17 00:00:00 2001 From: "pawel.karczmarczyk" Date: Thu, 23 Mar 2023 17:27:10 +0000 Subject: [PATCH 5/6] Updated README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9476182..8d46e45 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ # NexiNetsPaymentCore - Payment Core for simple integration with Netaxept API for plugins ============================================ -| Core | NetsCore - Payment Core +| Core | NexiNetsCore - Payment Core |-------------------|------------------------- | Author | `Nexi/Nets eCom LAKA` | Version | `1.2` -| License | `MIT License` -| Supporting System | `Nets eCom LAKA plugins` +| License | `MIT License` ### What it is From 4ae75a4b1999d6c66879bd9f96cba77d92a58425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Karczmarczyk?= Date: Thu, 23 Mar 2023 18:42:15 +0100 Subject: [PATCH 6/6] fix: add missing file --- src/NexiNetsCore.php | 122 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 src/NexiNetsCore.php diff --git a/src/NexiNetsCore.php b/src/NexiNetsCore.php new file mode 100644 index 0000000..a84e954 --- /dev/null +++ b/src/NexiNetsCore.php @@ -0,0 +1,122 @@ +configuration = $configuration ?: new NetaxeptConfiguration(); + $this->authService = (new AuthFactory())->getAuthenticationService($this->configuration, $this->configuration->getClientType()); + } + + /** + * @param PaymentObjectInterface $paymentObject + * + * @return CreatePaymentResponseDto + */ + public function createPayment(PaymentObjectInterface $paymentObject): CreatePaymentResponseDto + { + return $this->getClient()->createPayment($paymentObject); + } + + /** + * @param string $paymentId + * + * @return PaymentDetailResponseDto + */ + public function getPaymentDetails(string $paymentId): PaymentDetailResponseDto + { + return $this->getClient()->getPaymentDetails($paymentId); + } + + /** + * @param PaymentRequestInterface $paymentObject + * + * @return mixed + */ + public function cancelPayment(PaymentRequestInterface $paymentObject) + { + return $this->getClient()->cancelPayment($paymentObject); + } + + /** + * @param PaymentRequestInterface $authorizationObject + * + * @return AuthorizePaymentResponseDto + * @throws ApiResponseException + */ + public function authorizePayment(PaymentRequestInterface $authorizationObject): AuthorizePaymentResponseDto + { + try { + return $this->getClient()->authorizePayment($authorizationObject); + } catch (ApiResponseException $e) { + throw new ApiResponseException(); + } + } + + /** + * @param PaymentRequestInterface $capturePayment + * + * @return CapturePaymentResponseDto + * @throws ApiResponseException + */ + public function capturePayment(PaymentRequestInterface $capturePayment): CapturePaymentResponseDto + { + try { + return $this->getClient()->capturePayment($capturePayment); + } catch (ApiResponseException $e) { + throw new ApiResponseException(); + } + } + + /** + * @param PaymentRequestInterface $refundObject + * + * @return RefundPaymentResponseDto + */ + public function refundPayment(PaymentRequestInterface $refundObject): RefundPaymentResponseDto + { + return $this->getClient()->refundPayment($refundObject); + } + + public function salePayment() + { + //TODO: Create sale payment plugin api + } + + /** + * @return ClientServiceInterface + */ + protected function getClient(): ClientServiceInterface + { + $authService = new AuthService($this->configuration, $this->authService); + $apiClient = (new APIClientFactory())->getClient($authService->getAuthData(), $this->configuration->getClientType()); + return (new ClientFactory())->getService($apiClient, $this->configuration->getClientType()); + } +}