Skip to content

Commit 8771e75

Browse files
[UPMERGE] 1.7 -> 2.0 (#411)
This PR has been generated automatically. For more details see [upmerge_pr.yaml](/Sylius/PayPalPlugin/blob/1.7/.github/workflows/upmerge_pr.yaml). **Remember!** The upmerge should always be merged with using `Merge pull request` button. In case of conflicts, please resolve them manually with usign the following commands: ``` git fetch upstream gh pr checkout <this-pr-number> git merge upstream/2.0 -m "Resolve conflicts between 1.7 and 2.0" ``` If you use other name for the upstream remote, please replace `upstream` with the name of your remote pointing to the `Sylius/PayPalPlugin` repository. Once the conflicts are resolved, please run `git merge --continue` and push the changes to this PR.
2 parents 36262c3 + 1631e83 commit 8771e75

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

.github/workflows/build.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches-ignore:
66
- 'dependabot/**'
7+
- 'upmerge/**'
78
pull_request: ~
89
release:
910
types: [ created ]
@@ -202,8 +203,8 @@ jobs:
202203
run: vendor/bin/console cache:warmup -vvv
203204

204205
-
205-
name: Load fixtures in test application
206-
run: vendor/bin/console sylius:fixtures:load -n
206+
name: Validate container
207+
run: vendor/bin/console lint:container -vvv
207208

208209
- name: Run security check
209210
run: symfony security:check
@@ -213,8 +214,8 @@ jobs:
213214
run: composer validate --ansi --strict
214215

215216
-
216-
name: Validate container
217-
run: vendor/bin/console lint:container
217+
name: Load fixtures in test application
218+
run: vendor/bin/console sylius:fixtures:load -n
218219

219220
-
220221
name: Run Non-unit PHPUnit tests

src/Controller/ProcessPayPalOrderAction.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,13 @@ public function __invoke(Request $request): Response
9999
$address->setPostcode($purchaseUnit['shipping']['address']['postal_code']);
100100
$address->setCountryCode($purchaseUnit['shipping']['address']['country_code']);
101101

102+
$order->setShippingAddress(clone $address);
103+
$order->setBillingAddress(clone $address);
104+
102105
$this->stateMachineFactory->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_ADDRESS);
103106

104107
if ($this->stateMachineFactory->can($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_SHIPPING)) {
105108
$this->stateMachineFactory->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_SHIPPING);
106-
} elseif ($this->stateMachineFactory->can($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SKIP_SHIPPING)) {
107-
$this->stateMachineFactory->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SKIP_SHIPPING);
108109
}
109110
} else {
110111
$address->setFirstName($customer->getFirstName());
@@ -117,16 +118,14 @@ public function __invoke(Request $request): Response
117118
$address->setPostcode($defaultAddress ? $defaultAddress->getPostcode() : '');
118119
$address->setCountryCode($data['payer']['address']['country_code']);
119120

121+
$order->setShippingAddress(clone $address);
122+
$order->setBillingAddress(clone $address);
123+
120124
$this->stateMachineFactory->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_ADDRESS);
121125
}
122126

123-
$order->setShippingAddress(clone $address);
124-
$order->setBillingAddress(clone $address);
125-
126127
if ($this->stateMachineFactory->can($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT)) {
127128
$this->stateMachineFactory->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT);
128-
} elseif ($this->stateMachineFactory->can($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SKIP_PAYMENT)) {
129-
$this->stateMachineFactory->apply($order, OrderCheckoutTransitions::GRAPH, OrderCheckoutTransitions::TRANSITION_SKIP_PAYMENT);
130129
}
131130

132131
$this->orderManager->flush();

src/Form/Type/PayPalConfigurationType.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Form\FormBuilderInterface;
2020
use Symfony\Component\Form\FormEvent;
2121
use Symfony\Component\Form\FormEvents;
22+
use Symfony\Component\Validator\Constraints\NotBlank;
2223

2324
final class PayPalConfigurationType extends AbstractType
2425
{
@@ -48,9 +49,18 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
4849
$form
4950
->add('sylius_merchant_id', HiddenType::class, ['data' => self::SANDBOX_SYLIUS_MERCHANT_ID, 'attr' => ['readonly' => true]])
5051
->add('partner_attribution_id', HiddenType::class, ['data' => self::SANDBOX_ATTRIBUTION_ID, 'attr' => ['readonly' => true]])
51-
->add('client_id', TextType::class, ['label' => 'sylius_paypal.client_id'])
52-
->add('client_secret', TextType::class, ['label' => 'sylius_paypal.client_secret'])
53-
->add('merchant_id', TextType::class, ['label' => 'sylius_paypal.merchant_id'])
52+
->add('client_id', TextType::class, [
53+
'label' => 'sylius_paypal.client_id',
54+
'constraints' => [new NotBlank(['groups' => 'sylius'])],
55+
])
56+
->add('client_secret', TextType::class, [
57+
'label' => 'sylius_paypal.client_secret',
58+
'constraints' => [new NotBlank(['groups' => 'sylius'])],
59+
])
60+
->add('merchant_id', TextType::class, [
61+
'label' => 'sylius_paypal.merchant_id',
62+
'constraints' => [new NotBlank(['groups' => 'sylius'])],
63+
])
5464
;
5565
} else {
5666
$form

0 commit comments

Comments
 (0)