Skip to content

Commit

Permalink
Merge pull request #269 from Adyen/revert-prepared-payment
Browse files Browse the repository at this point in the history
Release 3.4.2
  • Loading branch information
peterojo authored Jul 4, 2022
2 parents 889295e + 359d1e6 commit 9819eb2
Show file tree
Hide file tree
Showing 79 changed files with 735 additions and 1,263 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
],
"description": "Official Shopware 6 Plugin to connect to Payment Service Provider Adyen",
"version": "3.5.0",
"version": "3.4.2",
"type": "shopware-platform-plugin",
"license": "MIT",
"require": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 2 additions & 36 deletions src/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@
use Adyen\Shopware\Service\CaptureService;
use Adyen\Shopware\Service\ConfigurationService;
use Adyen\Shopware\Service\NotificationService;
use Adyen\Shopware\Service\PaymentResponseService;
use Adyen\Shopware\Service\RefundService;
use Adyen\Shopware\Service\Repository\AdyenPaymentCaptureRepository;
use Adyen\Shopware\Service\Repository\AdyenRefundRepository;
use Adyen\Shopware\Service\Repository\OrderRepository;
use Adyen\Shopware\Service\Repository\OrderTransactionRepository;
use Adyen\Util\Currency;
use Psr\Log\LoggerInterface;
use Shopware\Core\Checkout\Order\OrderEntity;
Expand All @@ -47,7 +45,6 @@
use Shopware\Core\Framework\Routing\Annotation\RouteScope;
use Shopware\Core\Framework\Validation\DataBag\RequestDataBag;
use Shopware\Core\System\Currency\CurrencyFormatter;
use Shopware\Core\System\SalesChannel\SalesChannelContext;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
Expand Down Expand Up @@ -77,7 +74,7 @@ class AdminController
/**
* @var NotificationService
*/
private $notificationService;
private NotificationService $notificationService;

/** @var CurrencyFormatter */
private $currencyFormatter;
Expand All @@ -91,20 +88,12 @@ class AdminController
/** @var AdyenPaymentCaptureRepository */
private $adyenPaymentCaptureRepository;

/** @var OrderTransactionRepository */
private $orderTransactionRepository;

/** @var ConfigurationService */
private $configurationService;

/**
* AdminController constructor.
*
* @param LoggerInterface $logger
* @param OrderRepository $orderRepository
* @param RefundService $refundService
* @param OrderTransactionRepository $orderTransactionRepository
* @param ConfigurationService $configurationService
* @param AdyenRefundRepository $adyenRefundRepository
* @param AdyenPaymentCaptureRepository $adyenPaymentCaptureRepository
* @param NotificationService $notificationService
Expand All @@ -116,8 +105,6 @@ public function __construct(
LoggerInterface $logger,
OrderRepository $orderRepository,
RefundService $refundService,
OrderTransactionRepository $orderTransactionRepository,
ConfigurationService $configurationService,
AdyenRefundRepository $adyenRefundRepository,
AdyenPaymentCaptureRepository $adyenPaymentCaptureRepository,
NotificationService $notificationService,
Expand All @@ -134,8 +121,6 @@ public function __construct(
$this->captureService = $captureService;
$this->currencyFormatter = $currencyFormatter;
$this->currencyUtil = $currencyUtil;
$this->orderTransactionRepository = $orderTransactionRepository;
$this->configurationService = $configurationService;
}

/**
Expand Down Expand Up @@ -211,7 +196,7 @@ public function sendCaptureRequest(Request $request)

try {
$results = $this->captureService
->capture($context, $order->getOrderNumber(), $amountInMinorUnit);
->doOpenInvoiceCapture($order->getOrderNumber(), $amountInMinorUnit, $context);
} catch (CaptureException $e) {
$this->logger->error($e->getMessage());

Expand Down Expand Up @@ -378,25 +363,6 @@ public function getOrderNotifications(string $orderId): JsonResponse
return new JsonResponse($response);
}

/**
* @Route(
* "/api/adyen/orders/{orderId}/payment-details",
* methods={"GET"}
* )
*/
public function getPaymentDetails(string $orderId): JsonResponse
{
$orderTransaction = $this->orderTransactionRepository->getFirstAdyenOrderTransaction($orderId);
$customFields = $orderTransaction->getCustomFields();
$response = [
'paymentReference' => $customFields['paymentReference'] ?? null,
'pspReference' => $customFields['originalPspReference'] ?? null,
'environment' => $this->configurationService->getEnvironment()
];

return new JsonResponse($response);
}

/**
* Build a response containing the data to be displayed
*
Expand Down
Loading

0 comments on commit 9819eb2

Please sign in to comment.