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

Msi 2030 add ability to mark orders placed with store pickup #2082

Conversation

swnsma
Copy link
Contributor

@swnsma swnsma commented Mar 14, 2019

Description (*)

Add possibility to mark orders, created with 'In Store Pickup' Shipping method.
Add extension attribute to order entity with information about related pickup point.

Fixed Issues

  1. Add an ability to Mark Orders placed with Store Pickup #2030: Add an ability to Mark Orders placed with Store Pickup

Points to discuss

Probably, it will be nice to add this extension attribute to collection join:

    <extension_attributes for="Magento\Sales\Api\Data\OrderInterface">
        <attribute code="pickup_point_id" type="string">
            <join reference_table="inventory_pickup_point_order" join_on_field="entity_id" reference_field="order_id">
                <field column="pickup_point_id">pickup_point_id</field>
            </join>
        </attribute>

But for this we need to add join processor for Order Repository 'getList' method in Magento 2 Core Repository (https://github.com/magento-engcom/msi/blob/475dc7c32e54621087b9669ca76ab1eacecde12f/app/code/Magento/Sales/Model/OrderRepository.php#L197)
E.g.

        /** @var \Magento\Framework\Api\ExtensionAttribute\JoinProcessor $extensionJoinProcessor */
        $extensionJoinProcessor = ObjectManager::getInstance()->get('\Magento\Framework\Api\ExtensionAttribute\JoinProcessor');
        $extensionJoinProcessor->process($searchResult, OrderInterface::class);

UPD: issue already reported magento/magento2#8035

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-cicd2
Copy link

magento-cicd2 commented Mar 14, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@ishakhsuvarov ishakhsuvarov left a comment

Choose a reason for hiding this comment

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

  • Pickup Point term has to be discussed and aligned with business domain
  • Please add integration tests as well
  • Please update with the latest changes from store-pickup branch

use Magento\Framework\App\ResourceConnection;

/**
* Class GetPickupPointByOrderId.
Copy link
Contributor

Choose a reason for hiding this comment

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

Repeating class name in the comment is redundant. Clear responsibility description is sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

*/
class GetPickupPointByOrderId
{
const ORDER_ID = 'order_id';
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these constants be private?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

*
* @return string|null
*/
public function execute(int $orderId):?string
Copy link
Contributor

Choose a reason for hiding this comment

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

Why should pickup point id be a string? Maybe it's a point code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="inventory_pickup_point_order" resource="default" engine="innodb">
Copy link
Contributor

Choose a reason for hiding this comment

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

We have to discuss Pickup Point naming. It's best to align it with business domain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to 'Pickup Location'.

<module name="Magento_InventoryInStorePickup" setup_version="1.0.0">
<sequence>
<module name="Magento_Sales" />
<module name="Magento_Inventory" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be Magento_Inventory or InventoryApi?

Also sales should be added to composer dependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now, dependency on Magento_Sales only.
Added to composer.json.

al.kravchuk added 4 commits March 14, 2019 23:17
…ability-to-mark-orders-placed-with-store-pickup
Fix tests and apply code review corrections.
…ability-to-mark-orders-placed-with-store-pickup
Add integration test for order placement.

MSI-2030-Add an ability to Mark Orders placed with Store Pickup.
al.kravchuk added 2 commits March 22, 2019 13:46
Pickup Point -> Pickup Location
Pickup Point Id -> Pickup Location Code
Add join directive for extension attribute.
@swnsma swnsma requested a review from ishakhsuvarov March 22, 2019 12:08
@ishakhsuvarov ishakhsuvarov self-assigned this Mar 22, 2019
/** @var AddressInterface $address */
$address = $addressFactory->create(
[
'data' => [
Copy link
Contributor

Choose a reason for hiding this comment

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

I love how you save a US address to the Quote in fixture designed for EU Website :)

@ishakhsuvarov ishakhsuvarov merged commit d3ead30 into store-pickup Mar 23, 2019
@ghost
Copy link

ghost commented Mar 23, 2019

Hi @swnsma, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ishakhsuvarov ishakhsuvarov added this to the Store Pickup Support milestone May 30, 2019
@ishakhsuvarov ishakhsuvarov deleted the MSI-2030-add-ability-to-mark-orders-placed-with-store-pickup branch June 19, 2019 16:19
@ishakhsuvarov ishakhsuvarov removed this from the Store Pickup Support milestone Sep 10, 2019
ishakhsuvarov added a commit that referenced this pull request Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants