Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Base shipping methods support #342

Merged
merged 17 commits into from
Mar 6, 2019

Conversation

rogyar
Copy link
Contributor

@rogyar rogyar commented Feb 5, 2019

Description (*)

This PR introduced refactored logic for setting shipping methods. The new GraphQl schema is introduced here.

#418

Supported shipping methods

  • Flat Rate
  • Table Rates
  • Free shipping
  • UPS
  • USPS
  • FedEx

Fixed Issues (if relevant)

  1. [Shipping methods] Support of "Flat Rate" shipping method #279: [Shipping methods] Support of "Flat Rate" shipping method
  2. [Shipping methods] Support of "Table Rates" shipping method #280: [Shipping methods] Support of "Table Rates" shipping method
  3. [Shipping methods] Support of "Flat Rate" shipping method #279: [Shipping methods] Support of "Free Shipping" method
  4. [Shipping methods] Support of UPS shipping method #281: [Shipping methods] Support of UPS shipping method
  5. [Shipping methods] Support of USPS shipping method #282: [Shipping methods] Support of USPS shipping method
  6. [Shipping methods] Support of FedEx shipping method #283: [Shipping methods] Support of FedEx shipping method

Manual testing scenarios (*)

Use the following query with your own data to set a shipping method:

mutation {
  setShippingMethodsOnCart(input: {cart_id: "beBwcjBq0Cuo6T90SpZcnzSBTvSaia8a", shipping_addresses: [{cart_address_id: 10, shipping_method: {method_code: "flatrate", carrier_code: "flatrate"}}]}) {
    cart {
      shipping_addresses {
        postcode
        selected_shipping_method {
          carrier_code,
          method_code
          label
        }
      }
    }
  }
}

naydav and others added 2 commits February 14, 2019 21:18
…methods-checkout

# Conflicts:
#	app/code/Magento/QuoteGraphQl/Model/Cart/Address/AddressDataProvider.php
#	app/code/Magento/QuoteGraphQl/Model/Resolver/BillingAddress.php
#	app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddresses.php
#	app/code/Magento/QuoteGraphQl/etc/schema.graphqls
#	dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingMethodOnCartTest.php
@@ -12,6 +12,7 @@
<module name="Magento_ConfigurableProduct"/>
<module name="Magento_GraphQl"/>
<module name="Magento_CatalogGraphQl"/>
<module name="Magento_QuoteGraphQl"/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's necessary since CartItemDetailsInput field that is used in this module declared within a scope of Magento_QuoteGraphQl

@rogyar rogyar force-pushed the base-shipping-methods-checkout branch from 75e95e9 to d10e506 Compare February 21, 2019 13:12
@@ -57,36 +57,39 @@ public function __construct(
*/
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
{
$shippingMethods = $this->arrayManager->get('input/shipping_methods', $args);
Copy link
Contributor

Choose a reason for hiding this comment

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

Pls, verify that is proper changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this change is required. Please, take a look at the schema change https://github.com/magento/graphql-ce/pull/342/files#diff-795a33fde881f18aba5165a5a8c7513fR63
We have changed the input in order to reflect the new schema from here https://github.com/magento/graphql-ce/wiki/Checkout-workflow

mutation {
  setShippingMethodOnCart (
    input: {
      cart_id: "vpLKDPvz0F2P2J3ksx97ZcSHUA95a8PX"
      shipping_addresses: [ <!-- Here is the mentioned change
        {
             ...

Thanks.

…methods-checkout

# Conflicts:
#	app/code/Magento/QuoteGraphQl/Model/Cart/ExtractDataFromAddress.php
#	app/code/Magento/QuoteGraphQl/Model/Resolver/SetShippingMethodsOnCart.php
@ghost
Copy link

ghost commented Mar 6, 2019

Hi @rogyar, 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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants