Skip to content

Commit

Permalink
Merge pull request #359 from Adyen/develop
Browse files Browse the repository at this point in the history
Release 3.10.1
  • Loading branch information
candemiralp authored Mar 9, 2023
2 parents bff64bf + b4594ce commit f7d633d
Show file tree
Hide file tree
Showing 16 changed files with 584 additions and 500 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The plugin integrates card component (Secured Fields) using Adyen Checkout for a
- Twint
- Vipps
- WeChat Pay
- Open Banking / Pay by Bank

## API Library
This module is using the Adyen APIs Library for PHP for all (API) connections to Adyen.
Expand Down
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.10.0",
"version": "3.10.1",
"type": "shopware-platform-plugin",
"license": "MIT",
"require": {
Expand Down
662 changes: 331 additions & 331 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Controller/StoreApi/Donate/DonateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function donate(
Request $request,
SalesChannelContext $salesChannelContext
): JsonResponse {
$payload = $request->get('payload');
$payload = $request->request->get('payload');

$orderId = $payload['orderId'];
$currency = $payload['amount']['currency'];
Expand Down
24 changes: 17 additions & 7 deletions src/Controller/StoreApi/Payment/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@
use Adyen\Shopware\Service\PaymentResponseService;
use Adyen\Shopware\Service\PaymentStatusService;
use Adyen\Shopware\Service\Repository\OrderRepository;
use Petstore30\Order;
use Psr\Log\LoggerInterface;
use Shopware\Core\Checkout\Cart\Price\Struct\CalculatedPrice;
use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionDefinition;
use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStateHandler;
use Shopware\Core\Checkout\Order\Aggregate\OrderTransaction\OrderTransactionStates;
use Shopware\Core\Checkout\Order\OrderEntity;
use Shopware\Core\Checkout\Order\SalesChannel\OrderService;
Expand Down Expand Up @@ -108,6 +110,10 @@ class PaymentController
* @var ConfigurationService
*/
private $configurationService;
/**
* @var OrderTransactionStateHandler
*/
private $orderTransactionStateHandler;

/**
* StoreApiController constructor.
Expand Down Expand Up @@ -137,7 +143,8 @@ public function __construct(
StateMachineRegistry $stateMachineRegistry,
LoggerInterface $logger,
EntityRepositoryInterface $orderTransactionRepository,
ConfigurationService $configurationService
ConfigurationService $configurationService,
OrderTransactionStateHandler $orderTransactionStateHandler
) {
$this->paymentMethodsService = $paymentMethodsService;
$this->paymentDetailsService = $paymentDetailsService;
Expand All @@ -151,6 +158,7 @@ public function __construct(
$this->logger = $logger;
$this->orderTransactionRepository = $orderTransactionRepository;
$this->configurationService = $configurationService;
$this->orderTransactionStateHandler = $orderTransactionStateHandler;
}

/**
Expand Down Expand Up @@ -265,7 +273,7 @@ function (Context $context) use ($orderTransactionId, $customFields) {
*/
public function getPaymentStatus(Request $request, SalesChannelContext $context): JsonResponse
{
$orderId = $request->get('orderId');
$orderId = $request->request->get('orderId');
if (empty($orderId)) {
return new JsonResponse('Order ID not provided', 400);
}
Expand Down Expand Up @@ -315,7 +323,11 @@ public function getPaymentStatus(Request $request, SalesChannelContext $context)
*/
public function updatePaymentMethod(Request $request, SalesChannelContext $context): SetPaymentOrderRouteResponse
{
$this->setPaymentMethod($request->get('paymentMethodId'), $request->get('orderId'), $context);
$this->setPaymentMethod(
$request->request->get('paymentMethodId'),
$request->request->get('orderId'),
$context
);
return new SetPaymentOrderRouteResponse();
}

Expand All @@ -337,10 +349,8 @@ function () use ($order, $initialState, $orderId, $paymentMethodId, $context): v
foreach ($order->getTransactions() as $transaction) {
if ($transaction->getStateMachineState()->getTechnicalName()
!== OrderTransactionStates::STATE_CANCELLED) {
$this->orderService->orderTransactionStateTransition(
$this->orderTransactionStateHandler->cancel(
$transaction->getId(),
'cancel',
new ParameterBag(),
$context
);
}
Expand Down Expand Up @@ -385,7 +395,7 @@ public function cancelOrderTransaction(
SalesChannelContext $salesChannelContext
): JsonResponse {
$context = $salesChannelContext->getContext();
$orderId = $request->get('orderId');
$orderId = $request->request->get('orderId');
$order = $this->orderRepository->getOrder($orderId, $context, ['transactions']);

$transaction = $order->getTransactions()->filterByState(OrderTransactionStates::STATE_IN_PROGRESS)->first();
Expand Down
Loading

0 comments on commit f7d633d

Please sign in to comment.