diff --git a/CHANGELOG-3.2.x.md b/CHANGELOG-3.2.x.md index 19cef3c70c..bf8fa0ae33 100644 --- a/CHANGELOG-3.2.x.md +++ b/CHANGELOG-3.2.x.md @@ -1,4 +1,13 @@ -## 3.2.12 +# 3.2.13 +* [Currency/Money] implement Pimcore Grid Column by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2686 +* [StorageList] make sure to remove StorageList from Session on Logout by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2684 +* [InventoryBundle] add stock label renderer and hide onHand field by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2690 +* [InventoryBundle] add translations for stock label #2 by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2691 +* [Product] fix regression of price rules for products with default unit by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2698 +* [OrderBundle] fix precison/factor for Payment Total by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2700 +* [Payum] req payum/payum-bundle:^2.6 by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2710 + +# 3.2.12 * [MoneyBundle] money and moneyCurrency type should respect money_decimal_precision by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2671 * [VariantBundle] Add possibility to exclude Variants from AttributeCollector via AttributePreconditionEvent by @almshadi in https://github.com/coreshop/CoreShop/pull/2674 * [Product] don't allow Price and DiscountPrice Rule for unit prices by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2678 diff --git a/CHANGELOG-4.0.x.md b/CHANGELOG-4.0.x.md index 2ca62f7e08..9e2557cb68 100644 --- a/CHANGELOG-4.0.x.md +++ b/CHANGELOG-4.0.x.md @@ -1,8 +1,16 @@ +## 4.0.10 + +* [PimcoreBundle] respect user language for grid filter labels (#2694) by @benwalch in https://github.com/coreshop/CoreShop/pull/2695 +* [Product] fix regression of price rules for products with default unit by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2698 +* [NotificationBundle] Mail Processor: Fix adding recipient twice by @benwalch in https://github.com/coreshop/CoreShop/pull/2701 + ## 4.0.9 + * [OrderBundle] use context language for OrderState Operator by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2677 * [VariantBundle] Variant Creator by @breakone in https://github.com/coreshop/CoreShop/pull/2679 ## 4.0.8 + * [PaymentBundle] fix null title for payment provider by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2640 * [ProductBundle] fix missing cascade merge by @benwalch in https://github.com/coreshop/CoreShop/pull/2647 * [PaymentBundle/ShippingBundle] fix logo select form type by @dpfaffenbauer in https://github.com/coreshop/CoreShop/pull/2654 diff --git a/composer.json b/composer.json index 25bd417fea..09dba9f27e 100644 --- a/composer.json +++ b/composer.json @@ -98,7 +98,7 @@ "laminas/laminas-stdlib": "^3.6", "laminas/laminas-zendframework-bridge": "^1.5", "payum/payum": "^1.7", - "payum/payum-bundle": "^2.5", + "payum/payum-bundle": "^2.6", "php-http/guzzle7-adapter": "^1.0", "php-http/message-factory": "^1.1", "pimcore/admin-ui-classic-bundle": "^1.2", diff --git a/features/domain/order/order_payment.feature b/features/domain/order/order_payment.feature index c7cc09caea..b7da684682 100644 --- a/features/domain/order/order_payment.feature +++ b/features/domain/order/order_payment.feature @@ -22,28 +22,34 @@ Feature: Create a new order and add a payment Given I create a payment for my order with payment provider "Bankwire" and amount 1800 And I apply payment transition "fail" to latest order payment Then the order payment state should be "awaiting_payment" + And the order state should be "new" Scenario: Create cancelled payment Given I create a payment for my order with payment provider "Bankwire" and amount 1800 And I apply payment transition "cancel" to latest order payment Then the order payment state should be "awaiting_payment" + And the order state should be "new" Scenario: Create fully paid payment Given I create a payment for my order with payment provider "Bankwire" and amount 2400 And I apply payment transition "complete" to latest order payment Then the order payment state should be "paid" + And the order state should be "confirmed" Scenario: Create partially paid payment Given I create a payment for my order with payment provider "Bankwire" and amount 1800 And I apply payment transition "complete" to latest order payment Then the order payment state should be "partially_paid" + And the order state should be "confirmed" Scenario: Create fully authorized payment Given I create a payment for my order with payment provider "Bankwire" and amount 2400 And I apply payment transition "authorize" to latest order payment Then the order payment state should be "authorized" + And the order state should be "confirmed" Scenario: Create partially authorized payment Given I create a payment for my order with payment provider "Bankwire" and amount 1800 And I apply payment transition "authorize" to latest order payment Then the order payment state should be "partially_authorized" + And the order state should be "confirmed" diff --git a/features/domain/order/order_workflow.feature b/features/domain/order/order_workflow.feature index 9ec656dfb7..3839bf387d 100644 --- a/features/domain/order/order_workflow.feature +++ b/features/domain/order/order_workflow.feature @@ -20,17 +20,15 @@ Feature: Create a new order and add a invoice Scenario: Create order with payment and shipment which still is new Given I create an order from my cart And I create a payment for my order with payment provider "Bankwire" and amount 2400 - And I apply payment transition "complete" to latest order payment And I create a shipment for my order And I apply order shipment transition "request_shipment" to my order And I apply shipment transition "ship" to latest order shipment Then the order shipping state should be "shipped" - And the order payment state should be "paid" + And the order payment state should be "awaiting_payment" And the order state should be "new" Scenario: Create order with payment and shipment which still is completed Given I create an order from my cart - And I apply transition "confirm" to my order And I create a payment for my order with payment provider "Bankwire" and amount 2400 And I apply payment transition "complete" to latest order payment And I create a shipment for my order diff --git a/src/CoreShop/Bundle/CoreBundle/Application/Version.php b/src/CoreShop/Bundle/CoreBundle/Application/Version.php index 39b068d710..10a09966da 100644 --- a/src/CoreShop/Bundle/CoreBundle/Application/Version.php +++ b/src/CoreShop/Bundle/CoreBundle/Application/Version.php @@ -24,7 +24,7 @@ final class Version public const MINOR_VERSION = '0'; - public const RELEASE_VERSION = '9'; + public const RELEASE_VERSION = '10'; public const EXTRA_VERSION = ''; diff --git a/src/CoreShop/Bundle/OrderBundle/Resources/config/pimcore/workflow/coreshop_order_payment.yml b/src/CoreShop/Bundle/OrderBundle/Resources/config/pimcore/workflow/coreshop_order_payment.yml index bafe381861..570c7b94b6 100644 --- a/src/CoreShop/Bundle/OrderBundle/Resources/config/pimcore/workflow/coreshop_order_payment.yml +++ b/src/CoreShop/Bundle/OrderBundle/Resources/config/pimcore/workflow/coreshop_order_payment.yml @@ -57,6 +57,6 @@ core_shop_workflow: callbacks: after: resolve_state: - on: ['pay'] + on: ['partially_authorize', 'authorize', 'partially_pay', 'pay'] do: ['@CoreShop\Bundle\OrderBundle\StateResolver\OrderStateResolver', 'resolve'] args: ['object'] diff --git a/src/CoreShop/Bundle/OrderBundle/StateResolver/OrderStateResolver.php b/src/CoreShop/Bundle/OrderBundle/StateResolver/OrderStateResolver.php index 4f76a1c5e0..eae46f2ae9 100644 --- a/src/CoreShop/Bundle/OrderBundle/StateResolver/OrderStateResolver.php +++ b/src/CoreShop/Bundle/OrderBundle/StateResolver/OrderStateResolver.php @@ -37,11 +37,26 @@ public function __construct( public function resolve(OrderInterface $order): void { $stateMachine = $this->stateMachineManager->get($order, 'coreshop_order'); + + if ($this->canOrderBeConfirmed($order) && $stateMachine->can($order, OrderTransitions::TRANSITION_CONFIRM)) { + $stateMachine->apply($order, OrderTransitions::TRANSITION_CONFIRM); + } + if ($this->canOrderBeComplete($order) && $stateMachine->can($order, OrderTransitions::TRANSITION_COMPLETE)) { $stateMachine->apply($order, OrderTransitions::TRANSITION_COMPLETE); } } + private function canOrderBeConfirmed(OrderInterface $order): bool + { + return in_array($order->getPaymentState(), [ + OrderPaymentStates::STATE_PAID, + OrderPaymentStates::STATE_PARTIALLY_PAID, + OrderPaymentStates::STATE_AUTHORIZED, + OrderPaymentStates::STATE_PARTIALLY_AUTHORIZED, + ], true); + } + private function canOrderBeComplete(OrderInterface $order): bool { $coreStates = OrderPaymentStates::STATE_PAID === $order->getPaymentState() && diff --git a/src/CoreShop/Bundle/PayumBundle/Exception/ReplyToSymfonyResponseConverter.php b/src/CoreShop/Bundle/PayumBundle/Exception/ReplyToSymfonyResponseConverter.php index 906d316149..20ca8809f9 100644 --- a/src/CoreShop/Bundle/PayumBundle/Exception/ReplyToSymfonyResponseConverter.php +++ b/src/CoreShop/Bundle/PayumBundle/Exception/ReplyToSymfonyResponseConverter.php @@ -18,34 +18,12 @@ namespace CoreShop\Bundle\PayumBundle\Exception; +use Payum\Bundle\PayumBundle\ReplyToSymfonyResponseConverter as BaseReplyToSymfonyResponseConverter; use Payum\Core\Reply\ReplyInterface; -use Symfony\Component\HttpFoundation\Response; -/** - * @psalm-suppress TypeDoesNotContainType - */ -if (false) { - //This is just for the IDE - class BaseCoreShopReplayToSymfonyResponseConverter - { - public function convert(ReplyInterface $reply): Response - { - throw new \RuntimeException('Not implemented'); - } - } -} - -if (class_exists('Payum\Bundle\PayumBundle\ReplyToSymfonyResponseConverter')) { - \class_alias(\Payum\Bundle\PayumBundle\ReplyToSymfonyResponseConverter::class, 'CoreShop\Bundle\PayumBundle\Exception\BaseCoreShopReplayToSymfonyResponseConverter'); -} elseif (class_exists('Payum\Core\Bridge\Symfony\ReplyToSymfonyResponseConverter')) { - \class_alias(\Payum\Core\Bridge\Symfony\ReplyToSymfonyResponseConverter::class, 'CoreShop\Bundle\PayumBundle\Exception\BaseCoreShopReplayToSymfonyResponseConverter'); -} else { - throw new \RuntimeException('Cannot find Payum ReplyToSymfonyResponseConverter class'); -} - -class ReplyToSymfonyResponseConverter extends BaseCoreShopReplayToSymfonyResponseConverter +class ReplyToSymfonyResponseConverter extends BaseReplyToSymfonyResponseConverter { - public function convert(ReplyInterface $reply): Response + public function convert(ReplyInterface $reply) { if ($reply instanceof ReplyException && null !== $reply->getPrevious()) { throw $reply->getPrevious(); diff --git a/src/CoreShop/Bundle/PayumBundle/Extension/UpdateOrderStateExtension.php b/src/CoreShop/Bundle/PayumBundle/Extension/UpdateOrderStateExtension.php deleted file mode 100644 index 813be9e076..0000000000 --- a/src/CoreShop/Bundle/PayumBundle/Extension/UpdateOrderStateExtension.php +++ /dev/null @@ -1,110 +0,0 @@ -getException()) { - return; - } - - $previousStack = $context->getPrevious(); - /** - * @var int - * - * @psalm-type int - */ - $previousStackSize = count($previousStack); - - if ($previousStackSize > 1) { - return; - } - - if ($previousStackSize === 1) { - $previousActionClassName = $previousStack[0]->getAction()::class; - if (false === stripos($previousActionClassName, 'NotifyNullAction')) { - return; - } - } - - /** @var Generic|bool $request */ - $request = $context->getRequest(); - if (false === $request instanceof Generic) { - return; - } - - if (false === $request instanceof Notify) { - return; - } - - /** @var PaymentInterface|bool $payment */ - $payment = $request->getFirstModel(); - if (false === $payment instanceof PaymentInterface) { - return; - } - - $context->getGateway()->execute($status = new GetStatus($payment)); - $value = $status->getValue(); - - if ($value === $payment->getState()) { - return; - } - - if ($value === PaymentInterface::STATE_COMPLETED || - $value === PaymentInterface::STATE_AUTHORIZED || - $value === PaymentInterface::STATE_PROCESSING - ) { - $order = $payment->getOrder(); - $this->confirmOrderState($order); - } - } - - private function confirmOrderState(OrderInterface $order): void - { - $stateMachine = $this->stateMachineManager->get($order, 'coreshop_order'); - if ($stateMachine->can($order, OrderTransitions::TRANSITION_CONFIRM)) { - $stateMachine->apply($order, OrderTransitions::TRANSITION_CONFIRM); - } - } -} diff --git a/src/CoreShop/Bundle/PayumBundle/Resources/config/services/extension.yml b/src/CoreShop/Bundle/PayumBundle/Resources/config/services/extension.yml index 07dbde747a..11a8882531 100644 --- a/src/CoreShop/Bundle/PayumBundle/Resources/config/services/extension.yml +++ b/src/CoreShop/Bundle/PayumBundle/Resources/config/services/extension.yml @@ -8,8 +8,3 @@ services: tags: - { name: payum.extension, all: true, prepend: true } - CoreShop\Bundle\PayumBundle\Extension\UpdateOrderStateExtension: - arguments: - - '@CoreShop\Bundle\WorkflowBundle\Manager\StateMachineManagerInterface' - tags: - - { name: payum.extension, all: true, prepend: true }