Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] Initial checkout implementation #11670

Closed
wants to merge 3 commits into from

Conversation

lchrusciel
Copy link
Member

@lchrusciel lchrusciel commented Jul 21, 2020

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Related tickets Based on #11666
License MIT

@lchrusciel lchrusciel added Feature New feature proposals. API APIs related issues and PRs. labels Jul 21, 2020
@lchrusciel lchrusciel requested a review from a team as a code owner July 21, 2020 14:20
/**
* @When I proceed with :shippingMethod shipping method
*/
public function iHaveProceededSelectingShippingMethod(ShippingMethodInterface $shippingMethod): void
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function iHaveProceededSelectingShippingMethod(ShippingMethodInterface $shippingMethod): void
public function iProceededWithShippingMethod(ShippingMethodInterface $shippingMethod): void

}

public function __invoke(AddressOrder $addressOrder): OrderInterface
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$addressOrder->orderTokenValue is used in three places, it should be assigned to new variable

$paymentMethod = $this->paymentMethodRepository->findOneBy(['code' => $choosePaymentMethod->paymentMethod]);

Assert::notNull($paymentMethod, 'Payment method has not been found');
Assert::true(isset($cart->getPayments()[$choosePaymentMethod->paymentIdentifier]), 'Can not find payment with given identifier.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$choosePaymentMethod->paymentIdentifier should be assigned to new variable


Assert::notNull($shippingMethod, 'Shipping method has not been found');
Assert::true(
isset($cart->getShipments()[$chooseShippingMethod->shipmentIdentifier]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$chooseShippingMethod->shipmentIdentifier the same like above comment

public function __invoke(CompleteOrder $completeOrder): OrderInterface
{
/** @var OrderInterface $cart */
$cart = $this->orderRepository->findOneBy(['tokenValue' => $completeOrder->orderTokenValue]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$completeOrder->orderTokenValue and here

Comment on lines +40 to +45
OrderRepositoryInterface $orderRepository,
OrderInterface $order,
PaymentMethodRepositoryInterface $paymentMethodRepository,
PaymentMethodInterface $paymentMethod,
PaymentInterface $payment,
FactoryInterface $stateMachineFactory,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong order, first three arguments should be in order like let function

Comment on lines +82 to +87
OrderRepositoryInterface $orderRepository,
OrderInterface $order,
PaymentMethodRepositoryInterface $paymentMethodRepository,
PaymentInterface $payment,
FactoryInterface $stateMachineFactory,
StateMachineInterface $stateMachine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like comment above, here and in every places in this file

Comment on lines +42 to +49
OrderRepositoryInterface $orderRepository,
OrderInterface $order,
ShippingMethodRepositoryInterface $shippingMethodRepository,
ShippingMethodInterface $shippingMethod,
ShipmentInterface $shipment,
ShippingMethodEligibilityCheckerInterface $eligibilityChecker,
FactoryInterface $stateMachineFactory,
StateMachineInterface $stateMachine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar like comment above

Comment on lines +66 to +69
FactoryInterface $stateMachineFactory,
OrderInterface $order,
OrderRepositoryInterface $orderRepository,
StateMachineInterface $stateMachine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

use Symfony\Component\BrowserKit\AbstractBrowser;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\VarDumper\VarDumper;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use Symfony\Component\VarDumper\VarDumper;
use Symfony\Component\VarDumper\VarDumper;

not needed

@GSadee
Copy link
Member

GSadee commented Jul 23, 2020

Closing in favour of #11675

@GSadee GSadee closed this Jul 23, 2020
GSadee added a commit that referenced this pull request Jul 23, 2020
…iel, Tomanhez)

This PR was merged into the 1.8-dev branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | master
| Bug fix?        | no
| New feature?    | yes
| BC breaks?      | no
| Deprecations?   | no
| License         | MIT

This pr is based on #11670

<!--
 - Bug fixes must be submitted against the 1.7 branch (the lowest possible)
 - Features and deprecations must be submitted against the master branch
 - Make sure that the correct base branch is set

 To be sure you are not breaking any Backward Compatibilities, check the documentation:
 https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->


Commits
-------

6456377 [API] Initial checkout implementation
e0857fc Add fixes for tests
@lchrusciel lchrusciel deleted the checkout branch August 11, 2020 10:14
lchrusciel pushed a commit to Sylius/SyliusApiBundle that referenced this pull request Sep 4, 2020
…iel, Tomanhez)

This PR was merged into the 1.8-dev branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | master
| Bug fix?        | no
| New feature?    | yes
| BC breaks?      | no
| Deprecations?   | no
| License         | MIT

This pr is based on Sylius/Sylius#11670

<!--
 - Bug fixes must be submitted against the 1.7 branch (the lowest possible)
 - Features and deprecations must be submitted against the master branch
 - Make sure that the correct base branch is set

 To be sure you are not breaking any Backward Compatibilities, check the documentation:
 https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->


Commits
-------

64563778e6d65948afab089aa1613a4614d88130 [API] Initial checkout implementation
e0857fc5a3291ffd4e4d5337c471fe717d903bfa Add fixes for tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API APIs related issues and PRs. Feature New feature proposals.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants