This repository was archived by the owner on Dec 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 153
graphQl-961: ShippingAddressInput.postcode: String, is not required by Schema #969
Merged
magento-engcom-team
merged 13 commits into
magento:2.3-develop
from
kisroman:graphql-961
Nov 6, 2019
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
39c9c80
graphQl-961: ShippingAddressInput.postcode: String, is not required b…
kisroman 18a3260
graphQl-961: ShippingAddressInput.postcode: String, is not required b…
kisroman c6cfe10
Merge branch '2.3-develop' into graphql-961
kisroman 18784c2
graphQl-961: ShippingAddressInput.postcode: String, is not required b…
kisroman 694dda4
Merge branch '2.3-develop' into graphql-961
kisroman f8b47b3
graphQl-961: ShippingAddressInput.postcode: String, is not required b…
kisroman 2555933
Merge branch '2.3-develop' of github.com:magento/graphql-ce into grap…
lenaorobei e9a701f
magento/graphql-ce#961: ShippingAddressInput.postcode: String, is not…
lenaorobei 9ced73c
magento/graphql-ce#961: ShippingAddressInput.postcode: String, is not…
lenaorobei 2e4cd74
magento/graphql-ce#961: ShippingAddressInput.postcode: String, is not…
lenaorobei b72a5c6
magento/graphql-ce#961: ShippingAddressInput.postcode: String, is not…
lenaorobei 1f03323
Merge branch '2.3-develop' of github.com:magento/graphql-ce into grap…
lenaorobei 222ec5f
magento/graphql-ce#961: ShippingAddressInput.postcode: String, is not…
lenaorobei 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -9,7 +9,9 @@ | |
|
||
use Magento\Customer\Helper\Address as AddressHelper; | ||
use Magento\CustomerGraphQl\Model\Customer\Address\GetCustomerAddress; | ||
use Magento\Directory\Api\CountryInformationAcquirerInterface; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Framework\Exception\NoSuchEntityException; | ||
use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException; | ||
use Magento\Framework\GraphQl\Exception\GraphQlInputException; | ||
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException; | ||
|
@@ -36,36 +38,57 @@ class QuoteAddressFactory | |
*/ | ||
private $addressHelper; | ||
|
||
/** | ||
* @var CountryInformationAcquirerInterface | ||
*/ | ||
private $countryInformationAcquirer; | ||
|
||
/** | ||
* @param BaseQuoteAddressFactory $quoteAddressFactory | ||
* @param GetCustomerAddress $getCustomerAddress | ||
* @param AddressHelper $addressHelper | ||
* @param CountryInformationAcquirerInterface $countryInformationAcquirer | ||
*/ | ||
public function __construct( | ||
BaseQuoteAddressFactory $quoteAddressFactory, | ||
GetCustomerAddress $getCustomerAddress, | ||
AddressHelper $addressHelper | ||
AddressHelper $addressHelper, | ||
CountryInformationAcquirerInterface $countryInformationAcquirer | ||
) { | ||
$this->quoteAddressFactory = $quoteAddressFactory; | ||
$this->getCustomerAddress = $getCustomerAddress; | ||
$this->addressHelper = $addressHelper; | ||
$this->countryInformationAcquirer = $countryInformationAcquirer; | ||
} | ||
|
||
/** | ||
* Create QuoteAddress based on input data | ||
* | ||
* @param array $addressInput | ||
* | ||
* @return QuoteAddress | ||
* @throws GraphQlInputException | ||
*/ | ||
public function createBasedOnInputData(array $addressInput): QuoteAddress | ||
{ | ||
$addressInput['country_id'] = ''; | ||
if ($addressInput['country_code']) { | ||
if (isset($addressInput['country_code']) && $addressInput['country_code']) { | ||
$addressInput['country_code'] = strtoupper($addressInput['country_code']); | ||
$addressInput['country_id'] = $addressInput['country_code']; | ||
} | ||
|
||
if ($addressInput['country_id'] && isset($addressInput['region'])) { | ||
try { | ||
$countryInformation = $this->countryInformationAcquirer->getCountryInfo($addressInput['country_id']); | ||
} catch (NoSuchEntityException $e) { | ||
throw new GraphQlInputException(__('The country isn\'t available.')); | ||
} | ||
$availableRegions = $countryInformation->getAvailableRegions(); | ||
if (null !== $availableRegions) { | ||
$addressInput['region_code'] = $addressInput['region']; | ||
} | ||
} | ||
|
||
$maxAllowedLineCount = $this->addressHelper->getStreetLines(); | ||
if (is_array($addressInput['street']) && count($addressInput['street']) > $maxAllowedLineCount) { | ||
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. I think that |
||
throw new GraphQlInputException( | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
We do not care about BC in GraphQL modules. Only the schema is out API.
https://github.com/magento/graphql-ce/wiki/Approach-to-Implementation#backward-compatibility-policy
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.
Ok.