Skip to content

Commit aa3ea45

Browse files
committed
Merge branch '2.3-develop' into Chaika-PR-2019-08-29
2 parents 7afc1a0 + 31a6cd7 commit aa3ea45

File tree

25 files changed

+486
-46
lines changed

25 files changed

+486
-46
lines changed

app/code/Magento/ConfigurableProductGraphQl/etc/module.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<module name="Magento_ConfigurableProduct"/>
1313
<module name="Magento_GraphQl"/>
1414
<module name="Magento_CatalogGraphQl"/>
15+
<module name="Magento_QuoteGraphQl"/>
1516
</sequence>
1617
</module>
1718
</config>

app/code/Magento/DownloadableGraphQl/Resolver/Customer/DownloadableProducts.php renamed to app/code/Magento/CustomerDownloadableGraphQl/Model/Resolver/CustomerDownloadableProducts.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
declare(strict_types=1);
77

8-
namespace Magento\DownloadableGraphQl\Resolver\Customer;
8+
namespace Magento\CustomerDownloadableGraphQl\Model\Resolver;
99

1010
use Magento\DownloadableGraphQl\Model\ResourceModel\GetPurchasedDownloadableProducts;
1111
use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException;
@@ -20,7 +20,7 @@
2020
*
2121
* Returns available downloadable products for customer
2222
*/
23-
class DownloadableProducts implements ResolverInterface
23+
class CustomerDownloadableProducts implements ResolverInterface
2424
{
2525
/**
2626
* @var GetPurchasedDownloadableProducts
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# DownloadableGraphQl
2+
3+
**CustomerDownloadableGraphQl** provides type and resolver information for the GraphQl module
4+
to generate downloadable product information.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Downloadable Graph Ql Functional Tests
2+
3+
The Functional Test Module for **Magento Customer Downloadable Graph Ql** module.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "magento/module-customer-downloadable-graph-ql",
3+
"description": "N/A",
4+
"type": "magento2-module",
5+
"require": {
6+
"php": "~7.1.3||~7.2.0||~7.3.0",
7+
"magento/module-downloadable-graph-ql": "*",
8+
"magento/module-graph-ql": "*",
9+
"magento/framework": "*"
10+
},
11+
"suggest": {
12+
"magento/module-catalog-graph-ql": "*"
13+
},
14+
"license": [
15+
"OSL-3.0",
16+
"AFL-3.0"
17+
],
18+
"autoload": {
19+
"files": [
20+
"registration.php"
21+
],
22+
"psr-4": {
23+
"Magento\\CustomerDownloadableGraphQl\\": ""
24+
}
25+
}
26+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9+
<module name="Magento_CustomerDownloadableGraphQl" >
10+
<sequence>
11+
<module name="Magento_GraphQl"/>
12+
<module name="Magento_DownloadableGraphQl"/>
13+
</sequence>
14+
</module>
15+
</config>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright © Magento, Inc. All rights reserved.
2+
# See COPYING.txt for license details.
3+
4+
type Query {
5+
customerDownloadableProducts: CustomerDownloadableProducts @resolver(class: "Magento\\CustomerDownloadableGraphQl\\Model\\Resolver\\CustomerDownloadableProducts") @doc(description: "The query returns the contents of a customer's downloadable products") @cache(cacheable: false)
6+
}
7+
8+
type CustomerDownloadableProducts {
9+
items: [CustomerDownloadableProduct] @doc(description: "List of purchased downloadable items")
10+
}
11+
12+
type CustomerDownloadableProduct {
13+
order_increment_id: String
14+
date: String
15+
status: String
16+
download_url: String
17+
remaining_downloads: String
18+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
use Magento\Framework\Component\ComponentRegistrar;
8+
9+
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CustomerDownloadableGraphQl', __DIR__);

app/code/Magento/DownloadableGraphQl/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"php": "~7.1.3||~7.2.0||~7.3.0",
77
"magento/module-catalog": "*",
88
"magento/module-downloadable": "*",
9-
"magento/module-graph-ql": "*",
109
"magento/module-quote": "*",
1110
"magento/module-quote-graph-ql": "*",
1211
"magento/framework": "*"

app/code/Magento/DownloadableGraphQl/etc/schema.graphqls

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
# Copyright © Magento, Inc. All rights reserved.
22
# See COPYING.txt for license details.
33

4-
type Query {
5-
customerDownloadableProducts: CustomerDownloadableProducts @resolver(class: "Magento\\DownloadableGraphQl\\Resolver\\Customer\\DownloadableProducts") @doc(description: "The query returns the contents of a customer's downloadable products") @cache(cacheable: false)
6-
}
7-
84
type Mutation {
95
addDownloadableProductsToCart(input: AddDownloadableProductsToCartInput): AddDownloadableProductsToCartOutput @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AddSimpleProductsToCart")
106
}
@@ -34,18 +30,6 @@ type DownloadableCartItem implements CartItemInterface @doc(description: "Downlo
3430
samples: [DownloadableProductSamples] @resolver(class: "Magento\\DownloadableGraphQl\\Resolver\\DownloadableCartItem\\Samples") @doc(description: "DownloadableProductSamples defines characteristics of a downloadable product")
3531
}
3632

37-
type CustomerDownloadableProducts {
38-
items: [CustomerDownloadableProduct] @doc(description: "List of purchased downloadable items")
39-
}
40-
41-
type CustomerDownloadableProduct {
42-
order_increment_id: String
43-
date: String
44-
status: String
45-
download_url: String
46-
remaining_downloads: String
47-
}
48-
4933
type DownloadableProduct implements ProductInterface, CustomizableProductInterface @doc(description: "DownloadableProduct defines a product that the customer downloads") {
5034
downloadable_product_samples: [DownloadableProductSamples] @resolver(class: "Magento\\DownloadableGraphQl\\Resolver\\Product\\Samples") @doc(description: "An array containing information about samples of this downloadable product.")
5135
downloadable_product_links: [DownloadableProductLinks] @resolver(class: "Magento\\DownloadableGraphQl\\Resolver\\Product\\Links") @doc(description: "An array containing information about the links for this downloadable product")

app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function execute(Quote $cart, array $cartItemData): void
5555
$sku = $this->extractSku($cartItemData);
5656

5757
try {
58-
$product = $this->productRepository->get($sku);
58+
$product = $this->productRepository->get($sku, false, null, true);
5959
} catch (NoSuchEntityException $e) {
6060
throw new GraphQlNoSuchEntityException(__('Could not find a product with SKU "%sku"', ['sku' => $sku]));
6161
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\QuoteGraphQl\Model\Resolver;
9+
10+
use Magento\Framework\Exception\LocalizedException;
11+
use Magento\Framework\GraphQl\Config\Element\Field;
12+
use Magento\Framework\GraphQl\Query\ResolverInterface;
13+
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
14+
use Magento\Quote\Model\Quote;
15+
16+
/**
17+
* @inheritdoc
18+
*/
19+
class CartTotalQuantity implements ResolverInterface
20+
{
21+
/**
22+
* @inheritdoc
23+
*/
24+
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
25+
{
26+
if (!isset($value['model'])) {
27+
throw new LocalizedException(__('"model" value should be specified'));
28+
}
29+
/** @var Quote $cart */
30+
$cart = $value['model'];
31+
32+
return (float)$cart->getItemsSummaryQty();
33+
}
34+
}

app/code/Magento/QuoteGraphQl/etc/schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ type Cart {
197197
available_payment_methods: [AvailablePaymentMethod] @resolver(class: "Magento\\QuoteGraphQl\\Model\\Resolver\\AvailablePaymentMethods") @doc(description: "Available payment methods")
198198
selected_payment_method: SelectedPaymentMethod @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\SelectedPaymentMethod")
199199
prices: CartPrices @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartPrices")
200+
total_quantity: Float! @resolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartTotalQuantity")
200201
}
201202

202203
interface CartAddressInterface @typeResolver(class: "\\Magento\\QuoteGraphQl\\Model\\Resolver\\CartAddressTypeResolver") {

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
"magento/module-currency-symbol": "*",
148148
"magento/module-customer": "*",
149149
"magento/module-customer-analytics": "*",
150+
"magento/module-customer-downloadable-graph-ql": "*",
150151
"magento/module-customer-import-export": "*",
151152
"magento/module-deploy": "*",
152153
"magento/module-developer": "*",

composer.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\TestModuleUps\Model;
9+
10+
use Magento\Framework\Async\ProxyDeferredFactory;
11+
use Magento\Framework\HTTP\AsyncClientInterface;
12+
use Magento\Framework\HTTP\ClientFactory;
13+
use Magento\Framework\Xml\Security;
14+
use Magento\Ups\Helper\Config;
15+
16+
/**
17+
* Mock UPS shipping implementation
18+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
19+
*/
20+
class Carrier extends \Magento\Ups\Model\Carrier
21+
{
22+
/**
23+
* @var MockResponseBodyLoader
24+
*/
25+
private $mockResponseLoader;
26+
27+
/**
28+
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
29+
* @param \Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory
30+
* @param \Psr\Log\LoggerInterface $logger
31+
* @param Security $xmlSecurity
32+
* @param \Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory
33+
* @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory
34+
* @param \Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory
35+
* @param \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory
36+
* @param \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory
37+
* @param \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory
38+
* @param \Magento\Directory\Model\RegionFactory $regionFactory
39+
* @param \Magento\Directory\Model\CountryFactory $countryFactory
40+
* @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
41+
* @param \Magento\Directory\Helper\Data $directoryData
42+
* @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
43+
* @param \Magento\Framework\Locale\FormatInterface $localeFormat
44+
* @param Config $configHelper
45+
* @param ClientFactory $httpClientFactory
46+
* @param array $data
47+
* @param AsyncClientInterface $asyncHttpClient
48+
* @param ProxyDeferredFactory $proxyDeferredFactory
49+
* @param MockResponseBodyLoader $mockResponseLoader
50+
*
51+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
52+
*/
53+
public function __construct(
54+
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
55+
\Magento\Quote\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory,
56+
\Psr\Log\LoggerInterface $logger,
57+
Security $xmlSecurity,
58+
\Magento\Shipping\Model\Simplexml\ElementFactory $xmlElFactory,
59+
\Magento\Shipping\Model\Rate\ResultFactory $rateFactory,
60+
\Magento\Quote\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory,
61+
\Magento\Shipping\Model\Tracking\ResultFactory $trackFactory,
62+
\Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory,
63+
\Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory,
64+
\Magento\Directory\Model\RegionFactory $regionFactory,
65+
\Magento\Directory\Model\CountryFactory $countryFactory,
66+
\Magento\Directory\Model\CurrencyFactory $currencyFactory,
67+
\Magento\Directory\Helper\Data $directoryData,
68+
\Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry,
69+
\Magento\Framework\Locale\FormatInterface $localeFormat,
70+
Config $configHelper,
71+
ClientFactory $httpClientFactory,
72+
AsyncClientInterface $asyncHttpClient,
73+
ProxyDeferredFactory $proxyDeferredFactory,
74+
MockResponseBodyLoader $mockResponseLoader,
75+
array $data = []
76+
) {
77+
parent::__construct(
78+
$scopeConfig,
79+
$rateErrorFactory,
80+
$logger,
81+
$xmlSecurity,
82+
$xmlElFactory,
83+
$rateFactory,
84+
$rateMethodFactory,
85+
$trackFactory,
86+
$trackErrorFactory,
87+
$trackStatusFactory,
88+
$regionFactory,
89+
$countryFactory,
90+
$currencyFactory,
91+
$directoryData,
92+
$stockRegistry,
93+
$localeFormat,
94+
$configHelper,
95+
$httpClientFactory,
96+
$data,
97+
$asyncHttpClient,
98+
$proxyDeferredFactory
99+
);
100+
$this->mockResponseLoader = $mockResponseLoader;
101+
}
102+
103+
/**
104+
* @inheritdoc
105+
*/
106+
protected function _getCgiQuotes()
107+
{
108+
$responseBody = $this->mockResponseLoader->loadForRequest($this->_rawRequest->getDestCountry());
109+
return $this->_parseCgiResponse($responseBody);
110+
}
111+
}

0 commit comments

Comments
 (0)