diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ee0422b3..39f915a3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,6 +4,7 @@ on: push: branches-ignore: - 'dependabot/**' + - 'upmerge/**' pull_request: ~ release: types: [ created ] @@ -202,8 +203,8 @@ jobs: run: vendor/bin/console cache:warmup -vvv - - name: Load fixtures in test application - run: vendor/bin/console sylius:fixtures:load -n + name: Validate container + run: vendor/bin/console lint:container -vvv - name: Run security check run: symfony security:check @@ -213,8 +214,8 @@ jobs: run: composer validate --ansi --strict - - name: Validate container - run: vendor/bin/console lint:container + name: Load fixtures in test application + run: vendor/bin/console sylius:fixtures:load -n - name: Run Non-unit PHPUnit tests diff --git a/src/Controller/ProcessPayPalOrderAction.php b/src/Controller/ProcessPayPalOrderAction.php index aa215991..3b41d1b2 100644 --- a/src/Controller/ProcessPayPalOrderAction.php +++ b/src/Controller/ProcessPayPalOrderAction.php @@ -99,12 +99,13 @@ public function __invoke(Request $request): Response $address->setPostcode($purchaseUnit['shipping']['address']['postal_code']); $address->setCountryCode($purchaseUnit['shipping']['address']['country_code']); + $order->setShippingAddress(clone $address); + $order->setBillingAddress(clone $address); + $this->stateMachineFactory->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_ADDRESS); if ($this->stateMachineFactory->can($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_SHIPPING)) { $this->stateMachineFactory->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_SHIPPING); - } elseif ($this->stateMachineFactory->can($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SKIP_SHIPPING)) { - $this->stateMachineFactory->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SKIP_SHIPPING); } } else { $address->setFirstName($customer->getFirstName()); @@ -117,16 +118,14 @@ public function __invoke(Request $request): Response $address->setPostcode($defaultAddress ? $defaultAddress->getPostcode() : ''); $address->setCountryCode($data['payer']['address']['country_code']); + $order->setShippingAddress(clone $address); + $order->setBillingAddress(clone $address); + $this->stateMachineFactory->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_ADDRESS); } - $order->setShippingAddress(clone $address); - $order->setBillingAddress(clone $address); - if ($this->stateMachineFactory->can($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT)) { $this->stateMachineFactory->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT); - } elseif ($this->stateMachineFactory->can($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SKIP_PAYMENT)) { - $this->stateMachineFactory->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SKIP_PAYMENT); } $this->orderManager->flush(); diff --git a/src/Form/Type/PayPalConfigurationType.php b/src/Form/Type/PayPalConfigurationType.php index c6375e41..353ee60e 100644 --- a/src/Form/Type/PayPalConfigurationType.php +++ b/src/Form/Type/PayPalConfigurationType.php @@ -19,6 +19,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; +use Symfony\Component\Validator\Constraints\NotBlank; final class PayPalConfigurationType extends AbstractType { @@ -48,9 +49,18 @@ public function buildForm(FormBuilderInterface $builder, array $options): void $form ->add('sylius_merchant_id', HiddenType::class, ['data' => self::SANDBOX_SYLIUS_MERCHANT_ID, 'attr' => ['readonly' => true]]) ->add('partner_attribution_id', HiddenType::class, ['data' => self::SANDBOX_ATTRIBUTION_ID, 'attr' => ['readonly' => true]]) - ->add('client_id', TextType::class, ['label' => 'sylius_paypal.client_id']) - ->add('client_secret', TextType::class, ['label' => 'sylius_paypal.client_secret']) - ->add('merchant_id', TextType::class, ['label' => 'sylius_paypal.merchant_id']) + ->add('client_id', TextType::class, [ + 'label' => 'sylius_paypal.client_id', + 'constraints' => [new NotBlank(['groups' => 'sylius'])], + ]) + ->add('client_secret', TextType::class, [ + 'label' => 'sylius_paypal.client_secret', + 'constraints' => [new NotBlank(['groups' => 'sylius'])], + ]) + ->add('merchant_id', TextType::class, [ + 'label' => 'sylius_paypal.merchant_id', + 'constraints' => [new NotBlank(['groups' => 'sylius'])], + ]) ; } else { $form