This repository has been archived by the owner on Dec 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Base shipping methods support #342
Merged
magento-engcom-team
merged 17 commits into
2.3-develop
from
base-shipping-methods-checkout
Mar 6, 2019
Merged
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2cfeec7
Cart address id added to the address resolver
rogyar 15c9377
Modified input schema and resolver
rogyar c88e975
Updated logic to match a new schema
rogyar b1a0bb6
Merge remote-tracking branch 'origin/2.3-develop' into base-shipping-…
naydav b4c032b
Merge branch '2.3-develop' into base-shipping-methods-checkout
rogyar d10e506
New schema for setting shipping methods
rogyar 65ff06b
Merge branch '2.3-develop' into base-shipping-methods-checkout
rogyar a8c5504
Improved tests coverage
rogyar f3c9247
Merge remote-tracking branch 'origin/2.3-develop' into base-shipping-…
naydav 0ef7711
GraphQL-418: [Shipping methods] Set Shipping Methods on Cart
naydav e02dc94
GraphQL-418: [Shipping methods] Set Shipping Methods on Cart
naydav f2f05df
GraphQL-418: [Shipping methods] Set Shipping Methods on Cart
naydav b424d79
GraphQL-418: [Shipping methods] Set Shipping Methods on Cart
naydav 8b2106a
Merge remote-tracking branch 'origin/2.3-develop' into base-shipping-…
naydav a13639c
GraphQL-418: [Shipping methods] Set Shipping Methods on Cart
naydav bfacd22
GraphQL-418: [Shipping methods] Set Shipping Methods on Cart
naydav 031dc63
GraphQL-418: [Shipping methods] Set Shipping Methods on Cart
naydav File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pls, verify that is proper changes There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 mutation {
setShippingMethodOnCart (
input: {
cart_id: "vpLKDPvz0F2P2J3ksx97ZcSHUA95a8PX"
shipping_addresses: [ <!-- Here is the mentioned change
{
... Thanks. |
||
$shippingAddresses = $this->arrayManager->get('input/shipping_addresses', $args); | ||
$maskedCartId = $this->arrayManager->get('input/cart_id', $args); | ||
|
||
if (!$maskedCartId) { | ||
throw new GraphQlInputException(__('Required parameter "cart_id" is missing')); | ||
} | ||
if (!$shippingMethods) { | ||
if (!$shippingAddresses) { | ||
throw new GraphQlInputException(__('Required parameter "shipping_methods" is missing')); | ||
} | ||
|
||
$shippingMethod = reset($shippingMethods); // This point can be extended for multishipping | ||
$shippingAddress = reset($shippingAddresses); // This point can be extended for multishipping | ||
|
||
if (!$shippingMethod['cart_address_id']) { | ||
if (!$shippingAddress['cart_address_id']) { | ||
throw new GraphQlInputException(__('Required parameter "cart_address_id" is missing')); | ||
} | ||
if (!$shippingMethod['shipping_carrier_code']) { | ||
throw new GraphQlInputException(__('Required parameter "shipping_carrier_code" is missing')); | ||
if (!isset($shippingAddress['shipping_method'])) { | ||
throw new GraphQlInputException(__('Required parameter "shipping_method" is missing')); | ||
} | ||
if (!$shippingMethod['shipping_method_code']) { | ||
throw new GraphQlInputException(__('Required parameter "shipping_method_code" is missing')); | ||
if (!$shippingAddress['shipping_method']['carrier_code']) { | ||
throw new GraphQlInputException(__('Required parameter "carrier_code" is missing')); | ||
} | ||
if (!$shippingAddress['shipping_method']['method_code']) { | ||
throw new GraphQlInputException(__('Required parameter "method_code" is missing')); | ||
} | ||
|
||
$userId = $context->getUserId(); | ||
$cart = $this->getCartForUser->execute((string) $maskedCartId, $userId); | ||
|
||
$this->setShippingMethodOnCart->execute( | ||
$cart, | ||
$shippingMethod['cart_address_id'], | ||
$shippingMethod['shipping_carrier_code'], | ||
$shippingMethod['shipping_method_code'] | ||
$shippingAddress['cart_address_id'], | ||
$shippingAddress['shipping_method']['carrier_code'], | ||
$shippingAddress['shipping_method']['method_code'] | ||
); | ||
|
||
return [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 ofMagento_QuoteGraphQl