Skip to content

Commit

Permalink
Small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
hossam-adyen committed Feb 21, 2024
1 parent 73287fd commit 0f48b6d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions Gateway/Http/Client/TransactionCancel.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function placeRequest(TransferInterface $transferObject): array
$responseData = json_decode(json_encode($response->jsonSerialize()), true);
$this->adyenHelper->logResponse($responseData);
} catch (AdyenException $e) {
$responseData['error'] = $e->getMessage();
$this->adyenHelper->logAdyenException($e);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Helper/PaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ protected function getPaymentMethodsResponse(array $requestParams, Store $store)
$client = $this->adyenHelper->initializeAdyenClient($store->getId());

// initialize service
$service = new PaymentsApi($client);
$service =$this->adyenHelper->initializePaymentsApi($client);

try {
$this->adyenHelper->logRequest($requestParams, Client::API_CHECKOUT_VERSION, '/paymentMethods');
Expand Down
8 changes: 4 additions & 4 deletions Plugin/PaymentVaultDeleteToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2023 Adyen N.V. (https://www.adyen.com/)
* Copyright (c) 2024 Adyen N.V. (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
Expand All @@ -18,7 +18,6 @@
use Adyen\Payment\Helper\Requests;
use Adyen\Payment\Helper\Vault;
use Adyen\Payment\Logger\AdyenLogger;
use Adyen\Service\RecurringApi;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Vault\Api\Data\PaymentTokenInterface;
Expand Down Expand Up @@ -62,14 +61,15 @@ public function beforeDelete(PaymentTokenRepositoryInterface $subject, PaymentTo

try {
$client = $this->dataHelper->initializeAdyenClient($storeId);
$recurringService = $this->dataHelper->createAdyenRecurringService($client);
$recurringService = $this->dataHelper->initializeRecurringApi($client);

$this->dataHelper->logRequest(
$request,
Client::API_RECURRING_VERSION,
sprintf("/pal/servlet/Recurring/%s/disable", Client::API_RECURRING_VERSION)
);
$response = $recurringService->disable($request);

$response = $recurringService->disable(new DisableRequest($request));
$this->dataHelper->logResponse($response);
} catch (AdyenException $e) {
$this->adyenLogger->error(sprintf(
Expand Down

0 comments on commit 0f48b6d

Please sign in to comment.