Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches-ignore:
- 'dependabot/**'
- 'upmerge/**'
pull_request: ~
release:
types: [ created ]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 6 additions & 7 deletions src/Controller/ProcessPayPalOrderAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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();
Expand Down
16 changes: 13 additions & 3 deletions src/Form/Type/PayPalConfigurationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
Expand Down