diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
index d4780c5c0867a..45a4323e7f4bc 100644
--- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
@@ -41,7 +41,7 @@ type ConfigurableProductOptionsValues @doc(description: "ConfigurableProductOpti
input AddConfigurableProductsToCartInput {
cart_id: String!
- cartItems: [ConfigurableProductCartItemInput!]!
+ cart_items: [ConfigurableProductCartItemInput!]!
}
type AddConfigurableProductsToCartOutput {
diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/GenerateCustomerToken.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/GenerateCustomerToken.php
index 1bd77fe1cde8f..2a7cb8a734a50 100644
--- a/app/code/Magento/CustomerGraphQl/Model/Resolver/GenerateCustomerToken.php
+++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/GenerateCustomerToken.php
@@ -44,11 +44,11 @@ public function resolve(
array $value = null,
array $args = null
) {
- if (!isset($args['email'])) {
+ if (!isset($args['email']) || empty($args['email'])) {
throw new GraphQlInputException(__('Specify the "email" value.'));
}
- if (!isset($args['password'])) {
+ if (!isset($args['password']) || empty($args['password'])) {
throw new GraphQlInputException(__('Specify the "password" value.'));
}
diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php
index ad730288e5cc2..b491b10730c10 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Cart/AddSimpleProductToCart.php
@@ -13,21 +13,13 @@
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
-use Magento\Framework\Stdlib\ArrayManager;
use Magento\Quote\Model\Quote;
/**
* Add simple product to cart
- *
- * TODO: should be replaced for different types resolver
*/
class AddSimpleProductToCart
{
- /**
- * @var ArrayManager
- */
- private $arrayManager;
-
/**
* @var DataObjectFactory
*/
@@ -39,16 +31,13 @@ class AddSimpleProductToCart
private $productRepository;
/**
- * @param ArrayManager $arrayManager
* @param DataObjectFactory $dataObjectFactory
* @param ProductRepositoryInterface $productRepository
*/
public function __construct(
- ArrayManager $arrayManager,
DataObjectFactory $dataObjectFactory,
ProductRepositoryInterface $productRepository
) {
- $this->arrayManager = $arrayManager;
$this->dataObjectFactory = $dataObjectFactory;
$this->productRepository = $productRepository;
}
@@ -67,11 +56,6 @@ public function execute(Quote $cart, array $cartItemData): void
{
$sku = $this->extractSku($cartItemData);
$quantity = $this->extractQuantity($cartItemData);
- if ($quantity <= 0) {
- throw new GraphQlInputException(
- __('Please enter a number greater than 0 in this field.')
- );
- }
$customizableOptions = $this->extractCustomizableOptions($cartItemData);
try {
@@ -105,11 +89,10 @@ public function execute(Quote $cart, array $cartItemData): void
*/
private function extractSku(array $cartItemData): string
{
- $sku = $this->arrayManager->get('data/sku', $cartItemData);
- if (!isset($sku)) {
- throw new GraphQlInputException(__('Missing key "sku" in cart item data'));
+ if (!isset($cartItemData['data']['sku']) || empty($cartItemData['data']['sku'])) {
+ throw new GraphQlInputException(__('Missed "sku" in cart item data'));
}
- return (string)$sku;
+ return (string)$cartItemData['data']['sku'];
}
/**
@@ -121,11 +104,17 @@ private function extractSku(array $cartItemData): string
*/
private function extractQuantity(array $cartItemData): float
{
- $quantity = $this->arrayManager->get('data/quantity', $cartItemData);
- if (!isset($quantity)) {
- throw new GraphQlInputException(__('Missing key "quantity" in cart item data'));
+ if (!isset($cartItemData['data']['quantity'])) {
+ throw new GraphQlInputException(__('Missed "qty" in cart item data'));
+ }
+ $quantity = (float)$cartItemData['data']['quantity'];
+
+ if ($quantity <= 0) {
+ throw new GraphQlInputException(
+ __('Please enter a number greater than 0 in this field.')
+ );
}
- return (float)$quantity;
+ return $quantity;
}
/**
@@ -136,11 +125,17 @@ private function extractQuantity(array $cartItemData): float
*/
private function extractCustomizableOptions(array $cartItemData): array
{
- $customizableOptions = $this->arrayManager->get('customizable_options', $cartItemData, []);
+ if (!isset($cartItemData['customizable_options']) || empty($cartItemData['customizable_options'])) {
+ return [];
+ }
$customizableOptionsData = [];
- foreach ($customizableOptions as $customizableOption) {
- $customizableOptionsData[$customizableOption['id']] = $customizableOption['value'];
+ foreach ($cartItemData['customizable_options'] as $customizableOption) {
+ if (isset($customizableOption['value_string'])) {
+ $customizableOptionsData[$customizableOption['id']] = $this->convertCustomOptionValue(
+ $customizableOption['value_string']
+ );
+ }
}
return $customizableOptionsData;
}
@@ -161,4 +156,20 @@ private function createBuyRequest(float $quantity, array $customOptions): DataOb
],
]);
}
+
+ /**
+ * Convert custom options vakue
+ *
+ * @param string $value
+ * @return string|array
+ */
+ private function convertCustomOptionValue(string $value)
+ {
+ $value = trim($value);
+ if (substr($value, 0, 1) === "[" &&
+ substr($value, strlen($value) - 1, 1) === "]") {
+ return explode(',', substr($value, 1, -1));
+ }
+ return $value;
+ }
}
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php
index 82ffd0970d672..cfae0e1267802 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php
@@ -52,12 +52,12 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
}
$maskedCartId = $args['input']['cart_id'];
- if (!isset($args['input']['cartItems']) || empty($args['input']['cartItems'])
- || !is_array($args['input']['cartItems'])
+ if (!isset($args['input']['cart_items']) || empty($args['input']['cart_items'])
+ || !is_array($args['input']['cart_items'])
) {
- throw new GraphQlInputException(__('Required parameter "cartItems" is missing'));
+ throw new GraphQlInputException(__('Required parameter "cart_items" is missing'));
}
- $cartItems = $args['input']['cartItems'];
+ $cartItems = $args['input']['cart_items'];
$cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
$this->addProductsToCart->execute($cart, $cartItems);
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/AvailableShippingMethods.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/AvailableShippingMethods.php
index a9e0ba59d15d9..958934ed18032 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/AvailableShippingMethods.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/AvailableShippingMethods.php
@@ -7,13 +7,16 @@
namespace Magento\QuoteGraphQl\Model\Resolver\ShippingAddress;
+use Magento\Directory\Model\Currency;
use Magento\Framework\Api\ExtensibleDataObjectConverter;
use Magento\Framework\Exception\LocalizedException;
+use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Quote\Api\Data\ShippingMethodInterface;
use Magento\Quote\Model\Cart\ShippingMethodConverter;
+use Magento\Store\Model\StoreManagerInterface;
/**
* @inheritdoc
@@ -30,16 +33,24 @@ class AvailableShippingMethods implements ResolverInterface
*/
private $shippingMethodConverter;
+ /**
+ * @var StoreManagerInterface
+ */
+ private $storeManager;
+
/**
* @param ExtensibleDataObjectConverter $dataObjectConverter
* @param ShippingMethodConverter $shippingMethodConverter
+ * @param StoreManagerInterface $storeManager
*/
public function __construct(
ExtensibleDataObjectConverter $dataObjectConverter,
- ShippingMethodConverter $shippingMethodConverter
+ ShippingMethodConverter $shippingMethodConverter,
+ StoreManagerInterface $storeManager
) {
$this->dataObjectConverter = $dataObjectConverter;
$this->shippingMethodConverter = $shippingMethodConverter;
+ $this->storeManager = $storeManager;
}
/**
@@ -65,13 +76,44 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
$shippingRates = $address->getGroupedAllShippingRates();
foreach ($shippingRates as $carrierRates) {
foreach ($carrierRates as $rate) {
- $methods[] = $this->dataObjectConverter->toFlatArray(
+ $methodData = $this->dataObjectConverter->toFlatArray(
$this->shippingMethodConverter->modelToDataObject($rate, $cart->getQuoteCurrencyCode()),
[],
ShippingMethodInterface::class
);
+ $methods[] = $this->processMoneyTypeData($methodData, $cart->getQuoteCurrencyCode());
}
}
return $methods;
}
+
+ /**
+ * Process money type data
+ *
+ * @param array $data
+ * @param string $quoteCurrencyCode
+ * @return array
+ * @throws NoSuchEntityException
+ */
+ private function processMoneyTypeData(array $data, string $quoteCurrencyCode): array
+ {
+ if (isset($data['amount'])) {
+ $data['amount'] = ['value' => $data['amount'], 'currency' => $quoteCurrencyCode];
+ }
+
+ if (isset($data['base_amount'])) {
+ /** @var Currency $currency */
+ $currency = $this->storeManager->getStore()->getBaseCurrency();
+ $data['base_amount'] = ['value' => $data['base_amount'], 'currency' => $currency->getCode()];
+ }
+
+ if (isset($data['price_excl_tax'])) {
+ $data['price_excl_tax'] = ['value' => $data['price_excl_tax'], 'currency' => $quoteCurrencyCode];
+ }
+
+ if (isset($data['price_incl_tax'])) {
+ $data['price_incl_tax'] = ['value' => $data['price_incl_tax'], 'currency' => $quoteCurrencyCode];
+ }
+ return $data;
+ }
}
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php
index cd8f20c3f164f..05bc196acfc22 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php
@@ -7,18 +7,34 @@
namespace Magento\QuoteGraphQl\Model\Resolver\ShippingAddress;
+use Magento\Directory\Model\Currency;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Quote\Model\Quote\Address;
use Magento\Quote\Model\Quote\Address\Rate;
+use Magento\Store\Model\StoreManagerInterface;
/**
* @inheritdoc
*/
class SelectedShippingMethod implements ResolverInterface
{
+ /**
+ * @var StoreManagerInterface
+ */
+ private $storeManager;
+
+ /**
+ * @param StoreManagerInterface $storeManager
+ */
+ public function __construct(
+ StoreManagerInterface $storeManager
+ ) {
+ $this->storeManager = $storeManager;
+ }
+
/**
* @inheritdoc
*/
@@ -30,32 +46,44 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
/** @var Address $address */
$address = $value['model'];
$rates = $address->getAllShippingRates();
+ $carrierTitle = null;
+ $methodTitle = null;
if (count($rates) > 0) {
list($carrierCode, $methodCode) = explode('_', $address->getShippingMethod(), 2);
+
/** @var Rate $rate */
- $rate = current($rates);
+ foreach ($rates as $rate) {
+ if ($rate->getCode() == $address->getShippingMethod()) {
+ $carrierTitle = $rate->getCarrierTitle();
+ $methodTitle = $rate->getMethodTitle();
+ break;
+ }
+ }
+
+ /** @var Currency $currency */
+ $currency = $this->storeManager->getStore()->getBaseCurrency();
$data = [
'carrier_code' => $carrierCode,
'method_code' => $methodCode,
- 'carrier_title' => $rate->getCarrierTitle(),
- 'method_title' => $rate->getMethodTitle(),
+ 'carrier_title' => $carrierTitle,
+ 'method_title' => $methodTitle,
'amount' => [
'value' => $address->getShippingAmount(),
'currency' => $address->getQuote()->getQuoteCurrencyCode(),
],
'base_amount' => [
'value' => $address->getBaseShippingAmount(),
- 'currency' => $address->getQuote()->getBaseCurrencyCode(),
+ 'currency' => $currency->getCode(),
],
];
} else {
$data = [
'carrier_code' => null,
'method_code' => null,
- 'carrier_title' => null,
- 'method_title' => null,
+ 'carrier_title' => $carrierTitle,
+ 'method_title' => $methodTitle,
'amount' => null,
'base_amount' => null,
];
diff --git a/app/code/Magento/QuoteGraphQl/composer.json b/app/code/Magento/QuoteGraphQl/composer.json
index a3c07f7df2cee..6f4d3969d1018 100644
--- a/app/code/Magento/QuoteGraphQl/composer.json
+++ b/app/code/Magento/QuoteGraphQl/composer.json
@@ -11,7 +11,8 @@
"magento/module-store": "*",
"magento/module-customer": "*",
"magento/module-customer-graph-ql": "*",
- "magento/module-sales": "*"
+ "magento/module-sales": "*",
+ "magento/module-directory": "*"
},
"suggest": {
"magento/module-graph-ql": "*",
diff --git a/app/code/Magento/QuoteGraphQl/etc/di.xml b/app/code/Magento/QuoteGraphQl/etc/di.xml
index 0697761a2a2a6..32b8b12987ffa 100644
--- a/app/code/Magento/QuoteGraphQl/etc/di.xml
+++ b/app/code/Magento/QuoteGraphQl/etc/di.xml
@@ -26,7 +26,7 @@
- Magento\QuoteGraphQl\Model\CartItem\DataProvider\CustomizableOptionValue\Text
- Magento\QuoteGraphQl\Model\CartItem\DataProvider\CustomizableOptionValue\Dropdown
- Magento\QuoteGraphQl\Model\CartItem\DataProvider\CustomizableOptionValue\Dropdown
- - Magento\QuoteGraphQl\Model\CartItem\DataProvider\CustomizableOptionValue\Dropdown
+ - Magento\QuoteGraphQl\Model\CartItem\DataProvider\CustomizableOptionValue\Multiple
- Magento\QuoteGraphQl\Model\CartItem\DataProvider\CustomizableOptionValue\Multiple
diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls
index e2d29e93db574..9e9c83b358206 100644
--- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls
@@ -27,7 +27,7 @@ input createEmptyCartInput {
input AddSimpleProductsToCartInput {
cart_id: String!
- cartItems: [SimpleProductCartItemInput!]!
+ cart_items: [SimpleProductCartItemInput!]!
}
input SimpleProductCartItemInput {
@@ -37,7 +37,7 @@ input SimpleProductCartItemInput {
input AddVirtualProductsToCartInput {
cart_id: String!
- cartItems: [VirtualProductCartItemInput!]!
+ cart_items: [VirtualProductCartItemInput!]!
}
input VirtualProductCartItemInput {
@@ -52,7 +52,7 @@ input CartItemInput {
input CustomizableOptionInput {
id: Int!
- value: String!
+ value_string: String!
}
input ApplyCouponToCartInput {
@@ -130,13 +130,9 @@ input SetPaymentMethodOnCartInput {
input PaymentMethodInput {
code: String! @doc(description:"Payment method code")
- additional_data: PaymentMethodAdditionalDataInput @doc(description:"Additional payment data")
purchase_order_number: String @doc(description:"Purchase order number")
}
-input PaymentMethodAdditionalDataInput {
-}
-
input SetGuestEmailOnCartInput {
cart_id: String!
email: String!
@@ -243,10 +239,10 @@ type AvailableShippingMethod {
method_code: String @doc(description: "Could be null if method is not available")
method_title: String @doc(description: "Could be null if method is not available")
error_message: String
- amount: Float!
- base_amount: Float @doc(description: "Could be null if method is not available")
- price_excl_tax: Float!
- price_incl_tax: Float!
+ amount: Money!
+ base_amount: Money @doc(description: "Could be null if method is not available")
+ price_excl_tax: Money!
+ price_incl_tax: Money!
available: Boolean!
}
@@ -258,13 +254,9 @@ type AvailablePaymentMethod {
type SelectedPaymentMethod {
code: String! @doc(description: "The payment method code")
title: String! @doc(description: "The payment method title.")
- additional_data: SelectedPaymentMethodAdditionalData @doc(description: "Additional payment data")
purchase_order_number: String @doc(description: "The purchase order number.")
}
-type SelectedPaymentMethodAdditionalData {
-}
-
type AppliedCoupon {
code: String!
}
@@ -314,8 +306,7 @@ interface CartItemInterface @typeResolver(class: "Magento\\QuoteGraphQl\\Model\\
type SelectedCustomizableOption {
id: Int!
label: String!
- type: String!
- is_required: Int!
+ is_required: Boolean!
values: [SelectedCustomizableOptionValue!]!
sort_order: Int!
}
@@ -323,9 +314,8 @@ type SelectedCustomizableOption {
type SelectedCustomizableOptionValue {
id: Int!
label: String!
- value: String!
+ value: String
price: CartItemSelectedOptionValuePrice!
- sort_order: Int!
}
type CartItemSelectedOptionValuePrice {
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php
index 6f27693eeb4a7..6ed0f6ef7a132 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php
@@ -112,7 +112,7 @@ private function getQuery(string $maskedQuoteId, string $sku, float $quantity) :
addSimpleProductsToCart(
input: {
cart_id: "{$maskedQuoteId}",
- cartItems: [
+ cart_items: [
{
data: {
quantity: $quantity
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php
index 6810f9d44ce91..a6f02e4239f25 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/ConfigurableProduct/AddConfigurableProductToCartTest.php
@@ -93,7 +93,7 @@ private function getQuery(string $maskedQuoteId, string $variantSku, int $quanti
addConfigurableProductsToCart(
input: {
cart_id: "{$maskedQuoteId}"
- cartItems: [
+ cart_items: [
{
variant_sku: "{$variantSku}"
data: {
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php
index 88eaeaa8f9dd5..e13c1974e3067 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/GenerateCustomerTokenTest.php
@@ -68,4 +68,54 @@ public function testGenerateCustomerTokenWithInvalidCredentials()
'was incorrect or your account is disabled temporarily. Please wait and try again later.');
$this->graphQlMutation($mutation);
}
+
+ /**
+ * Verify customer with empty email
+ */
+ public function testGenerateCustomerTokenWithEmptyEmail()
+ {
+ $email = '';
+ $password = 'bad-password';
+
+ $mutation
+ = <<expectException(\Exception::class);
+ $this->expectExceptionMessage('GraphQL response contains errors: Specify the "email" value.');
+ $this->graphQlMutation($mutation);
+ }
+
+ /**
+ * Verify customer with empty password
+ */
+ public function testGenerateCustomerTokenWithEmptyPassword()
+ {
+ $email = 'customer@example.com';
+ $password = '';
+
+ $mutation
+ = <<expectException(\Exception::class);
+ $this->expectExceptionMessage('GraphQL response contains errors: Specify the "password" value.');
+ $this->graphQlMutation($mutation);
+ }
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/PageCache/Quote/Guest/CartCacheTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/PageCache/Quote/Guest/CartCacheTest.php
index e09ee8bc969af..808fd95d331e1 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/PageCache/Quote/Guest/CartCacheTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/PageCache/Quote/Guest/CartCacheTest.php
@@ -79,7 +79,7 @@ private function addSimpleProductToCart(string $maskedCartId, int $qty, string $
addSimpleProductsToCart(
input: {
cart_id: "{$maskedCartId}"
- cartItems: [
+ cart_items: [
{
data: {
qty: $qty
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductWithCustomOptionsToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductWithCustomOptionsToCartTest.php
index 63546298304b0..53be8f84ffc83 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductWithCustomOptionsToCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddSimpleProductWithCustomOptionsToCartTest.php
@@ -50,41 +50,11 @@ public function testAddSimpleProductWithOptions()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
$customOptionsValues = $this->getCustomOptionsValuesForQuery($sku);
-
/* Generate customizable options fragment for GraphQl request */
- $queryCustomizableOptions = preg_replace('/"([^"]+)"\s*:\s*/', '$1:', json_encode($customOptionsValues));
+ $queryCustomizableOptionValues = preg_replace('/"([^"]+)"\s*:\s*/', '$1:', json_encode($customOptionsValues));
- $query = <<getQuery($maskedQuoteId, $sku, $quantity, $customizableOptions);
$response = $this->graphQlMutation($query);
@@ -95,7 +65,7 @@ public function testAddSimpleProductWithOptions()
$assignedOptionsCount = count($customOptionsValues);
for ($counter = 0; $counter < $assignedOptionsCount; $counter++) {
self::assertEquals(
- $customOptionsValues[$counter]['value'],
+ $customOptionsValues[$counter]['value_string'],
$customizableOptionsOutput[$counter]['values'][0]['value']
);
}
@@ -107,23 +77,42 @@ public function testAddSimpleProductWithOptions()
* @magentoApiDataFixture Magento/Catalog/_files/product_simple_with_options.php
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
*/
- public function testAddSimpleProductWithNoRequiredOptionsSet()
+ public function testAddSimpleProductWithMissedRequiredOptionsSet()
{
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
$sku = 'simple';
$quantity = 1;
- $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
+ $customizableOptions = '';
- $query = <<getQuery($maskedQuoteId, $sku, $quantity, $customizableOptions);
+
+ self::expectExceptionMessage(
+ 'The product\'s required option(s) weren\'t entered. Make sure the options are entered and try again.'
+ );
+ $this->graphQlMutation($query);
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @param string $sku
+ * @param float $quantity
+ * @param string $customizableOptions
+ * @return string
+ */
+ private function getQuery(string $maskedQuoteId, string $sku, float $quantity, string $customizableOptions): string
+ {
+ return <<graphQlMutation($query);
}
/**
@@ -168,13 +151,13 @@ private function getCustomOptionsValuesForQuery(string $sku): array
if ($optionType == 'field' || $optionType == 'area') {
$customOptionsValues[] = [
'id' => (int) $customOption->getOptionId(),
- 'value' => 'test'
+ 'value_string' => 'test'
];
} elseif ($optionType == 'drop_down') {
$optionSelectValues = $customOption->getValues();
$customOptionsValues[] = [
'id' => (int) $customOption->getOptionId(),
- 'value' => reset($optionSelectValues)->getOptionTypeId()
+ 'value_string' => reset($optionSelectValues)->getOptionTypeId()
];
}
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddVirtualProductWithCustomOptionsToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddVirtualProductWithCustomOptionsToCartTest.php
index 94ac11ad8e0b1..7b3c5de4ba61d 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddVirtualProductWithCustomOptionsToCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/AddVirtualProductWithCustomOptionsToCartTest.php
@@ -50,41 +50,11 @@ public function testAddVirtualProductWithOptions()
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
$customOptionsValues = $this->getCustomOptionsValuesForQuery($sku);
-
/* Generate customizable options fragment for GraphQl request */
- $queryCustomizableOptions = preg_replace('/"([^"]+)"\s*:\s*/', '$1:', json_encode($customOptionsValues));
+ $queryCustomizableOptionValues = preg_replace('/"([^"]+)"\s*:\s*/', '$1:', json_encode($customOptionsValues));
- $query = <<getQuery($maskedQuoteId, $sku, $quantity, $customizableOptions);
$response = $this->graphQlMutation($query);
@@ -95,7 +65,7 @@ public function testAddVirtualProductWithOptions()
$assignedOptionsCount = count($customOptionsValues);
for ($counter = 0; $counter < $assignedOptionsCount; $counter++) {
self::assertEquals(
- $customOptionsValues[$counter]['value'],
+ $customOptionsValues[$counter]['value_string'],
$customizableOptionsOutput[$counter]['values'][0]['value']
);
}
@@ -107,23 +77,42 @@ public function testAddVirtualProductWithOptions()
* @magentoApiDataFixture Magento/Catalog/_files/product_virtual_with_options.php
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
*/
- public function testAddVirtualProductWithNoRequiredOptionsSet()
+ public function testAddSimpleProductWithMissedRequiredOptionsSet()
{
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
$sku = 'virtual';
$quantity = 1;
- $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_order_1');
+ $customizableOptions = '';
- $query = <<getQuery($maskedQuoteId, $sku, $quantity, $customizableOptions);
+
+ self::expectExceptionMessage(
+ 'The product\'s required option(s) weren\'t entered. Make sure the options are entered and try again.'
+ );
+ $this->graphQlMutation($query);
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @param string $sku
+ * @param float $quantity
+ * @param string $customizableOptions
+ * @return string
+ */
+ private function getQuery(string $maskedQuoteId, string $sku, float $quantity, string $customizableOptions): string
+ {
+ return <<graphQlMutation($query);
}
/**
@@ -168,13 +151,13 @@ private function getCustomOptionsValuesForQuery(string $sku): array
if ($optionType == 'field' || $optionType == 'area') {
$customOptionsValues[] = [
'id' => (int) $customOption->getOptionId(),
- 'value' => 'test'
+ 'value_string' => 'test'
];
} elseif ($optionType == 'drop_down') {
$optionSelectValues = $customOption->getValues();
$customOptionsValues[] = [
'id' => (int) $customOption->getOptionId(),
- 'value' => reset($optionSelectValues)->getOptionTypeId()
+ 'value_string' => reset($optionSelectValues)->getOptionTypeId()
];
}
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php
index be22d860df122..aca13e53875dd 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddSimpleProductToCartTest.php
@@ -139,7 +139,7 @@ private function getQuery(string $maskedQuoteId, string $sku, float $quantity):
mutation {
addSimpleProductsToCart(input: {
cart_id: "{$maskedQuoteId}",
- cartItems: [
+ cart_items: [
{
data: {
quantity: {$quantity}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php
index 1269b9d8e7b3d..86573dcde2e35 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/AddVirtualProductToCartTest.php
@@ -139,7 +139,7 @@ private function getQuery(string $maskedQuoteId, string $sku, float $quantity):
mutation {
addVirtualProductsToCart(input: {
cart_id: "{$maskedQuoteId}",
- cartItems: [
+ cart_items: [
{
data: {
quantity: {$quantity}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CheckoutEndToEndTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CheckoutEndToEndTest.php
index 92974f2491f75..5a4cc88d69623 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CheckoutEndToEndTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CheckoutEndToEndTest.php
@@ -212,7 +212,7 @@ private function addProductToCart(string $cartId, float $qty, string $sku): void
addSimpleProductsToCart(
input: {
cart_id: "{$cartId}"
- cartItems: [
+ cart_items: [
{
data: {
quantity: {$qty}
@@ -309,7 +309,9 @@ private function setShippingAddress(string $cartId): array
available_shipping_methods {
carrier_code
method_code
- amount
+ amount {
+ value
+ }
}
}
}
@@ -334,7 +336,8 @@ private function setShippingAddress(string $cartId): array
self::assertNotEmpty($availableShippingMethod['method_code']);
self::assertArrayHasKey('amount', $availableShippingMethod);
- self::assertNotEmpty($availableShippingMethod['amount']);
+ self::assertArrayHasKey('value', $availableShippingMethod['amount']);
+ self::assertNotEmpty($availableShippingMethod['amount']['value']);
return $availableShippingMethod;
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetAvailableShippingMethodsTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetAvailableShippingMethodsTest.php
index 2b647f61c4c63..b01921ae67ed7 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetAvailableShippingMethodsTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetAvailableShippingMethodsTest.php
@@ -58,15 +58,27 @@ public function testGetAvailableShippingMethods()
self::assertCount(1, $response['cart']['shipping_addresses'][0]['available_shipping_methods']);
$expectedAddressData = [
- 'amount' => 10,
- 'base_amount' => 10,
+ 'amount' => [
+ 'value' => 10,
+ 'currency' => 'USD',
+ ],
+ 'base_amount' => [
+ 'value' => 10,
+ 'currency' => 'USD',
+ ],
'carrier_code' => 'flatrate',
'carrier_title' => 'Flat Rate',
'error_message' => '',
'method_code' => 'flatrate',
'method_title' => 'Fixed',
- 'price_incl_tax' => 10,
- 'price_excl_tax' => 10,
+ 'price_incl_tax' => [
+ 'value' => 10,
+ 'currency' => 'USD',
+ ],
+ 'price_excl_tax' => [
+ 'value' => 10,
+ 'currency' => 'USD',
+ ],
];
self::assertEquals(
$expectedAddressData,
@@ -158,15 +170,27 @@ private function getQuery(string $maskedQuoteId): string
cart (cart_id: "{$maskedQuoteId}") {
shipping_addresses {
available_shipping_methods {
- amount
- base_amount
+ amount {
+ value
+ currency
+ }
+ base_amount {
+ value
+ currency
+ }
carrier_code
carrier_title
error_message
method_code
method_title
- price_excl_tax
- price_incl_tax
+ price_excl_tax {
+ value
+ currency
+ }
+ price_incl_tax {
+ value
+ currency
+ }
}
}
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSelectedPaymentMethodTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSelectedPaymentMethodTest.php
new file mode 100644
index 0000000000000..d876d74de661b
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSelectedPaymentMethodTest.php
@@ -0,0 +1,143 @@
+getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+
+ $query = $this->getQuery($maskedQuoteId);
+ $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+
+ $this->assertArrayHasKey('cart', $response);
+ $this->assertArrayHasKey('selected_payment_method', $response['cart']);
+ $this->assertArrayHasKey('code', $response['cart']['selected_payment_method']);
+ $this->assertEquals('checkmo', $response['cart']['selected_payment_method']['code']);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @expectedException \Exception
+ */
+ public function testGetSelectedPaymentMethodFromNonExistentCart()
+ {
+ $maskedQuoteId = 'non_existent_masked_id';
+ $query = $this->getQuery($maskedQuoteId);
+
+ $this->expectExceptionMessage(
+ 'Could not find a cart with ID "non_existent_masked_id"'
+ );
+
+ $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * _security
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_payment_methods.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_checkmo_payment_method.php
+ */
+ public function testGetSelectedPaymentMethodFromGuestCart()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $this->expectExceptionMessage(
+ "The current user cannot perform operations on cart \"$maskedQuoteId\""
+ );
+
+ $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * _security
+ * @magentoApiDataFixture Magento/Customer/_files/three_customers.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
+ */
+ public function testGetSelectedPaymentMethodFromAnotherCustomerCart()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $this->expectExceptionMessage(
+ "The current user cannot perform operations on cart \"{$maskedQuoteId}\""
+ );
+
+ $this->graphQlQuery($query, [], '', $this->getHeaderMap('customer3@search.example.com'));
+ }
+
+ protected function setUp()
+ {
+ $objectManager = Bootstrap::getObjectManager();
+ $this->getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
+ $this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @return string
+ */
+ private function getQuery(string $maskedQuoteId): string
+ {
+ return <<customerTokenService->createCustomerAccessToken($username, $password);
+ $headerMap = ['Authorization' => 'Bearer ' . $customerToken];
+ return $headerMap;
+ }
+}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedBillingAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedBillingAddressTest.php
index 1ff5ddbde54ec..b6dde46871cbb 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedBillingAddressTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedBillingAddressTest.php
@@ -44,7 +44,7 @@ protected function setUp()
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php
*/
- public function testGeSpecifiedBillingAddress()
+ public function testGetSpecifiedBillingAddress()
{
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId);
@@ -83,7 +83,7 @@ public function testGeSpecifiedBillingAddress()
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
*/
- public function testGeSpecifiedBillingAddressIfBillingAddressIsNotSet()
+ public function testGetSpecifiedBillingAddressIfBillingAddressIsNotSet()
{
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId);
@@ -121,7 +121,7 @@ public function testGeSpecifiedBillingAddressIfBillingAddressIsNotSet()
* @expectedException \Exception
* @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id"
*/
- public function testGeSpecifiedBillingAddressOfNonExistentCart()
+ public function testGetSpecifiedBillingAddressOfNonExistentCart()
{
$maskedQuoteId = 'non_existent_masked_id';
$query = $this->getQuery($maskedQuoteId);
@@ -137,7 +137,7 @@ public function testGeSpecifiedBillingAddressOfNonExistentCart()
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php
*/
- public function testGeSpecifiedBillingAddressFromAnotherGuestCart()
+ public function testGetSpecifiedBillingAddressFromAnotherGuestCart()
{
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
@@ -155,7 +155,7 @@ public function testGeSpecifiedBillingAddressFromAnotherGuestCart()
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php
*/
- public function testGeSpecifiedBillingAddressFromAnotherCustomerCart()
+ public function testGetSpecifiedBillingAddressFromAnotherCustomerCart()
{
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedShippingAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedShippingAddressTest.php
new file mode 100644
index 0000000000000..de3c384e65783
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/GetSpecifiedShippingAddressTest.php
@@ -0,0 +1,219 @@
+getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
+ $this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
+ */
+ public function testGetSpecifiedShippingAddress()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ self::assertArrayHasKey('cart', $response);
+ self::assertArrayHasKey('shipping_addresses', $response['cart']);
+
+ $expectedShippingAddressData = [
+ 'firstname' => 'John',
+ 'lastname' => 'Smith',
+ 'company' => 'CompanyName',
+ 'street' => [
+ 'Green str, 67'
+ ],
+ 'city' => 'CityM',
+ 'region' => [
+ 'code' => 'AL',
+ 'label' => 'Alabama',
+ ],
+ 'postcode' => '75477',
+ 'country' => [
+ 'code' => 'US',
+ 'label' => 'US',
+ ],
+ 'telephone' => '3468676',
+ '__typename' => 'ShippingCartAddress',
+ 'customer_notes' => null,
+ ];
+ self::assertEquals($expectedShippingAddressData, current($response['cart']['shipping_addresses']));
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
+ */
+ public function testGetSpecifiedShippingAddressIfShippingAddressIsNotSet()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ self::assertArrayHasKey('cart', $response);
+ self::assertArrayHasKey('shipping_addresses', $response['cart']);
+
+ $expectedShippingAddressData = [
+ 'firstname' => null,
+ 'lastname' => null,
+ 'company' => null,
+ 'street' => [
+ ''
+ ],
+ 'city' => null,
+ 'region' => [
+ 'code' => null,
+ 'label' => null,
+ ],
+ 'postcode' => null,
+ 'country' => [
+ 'code' => null,
+ 'label' => null,
+ ],
+ 'telephone' => null,
+ '__typename' => 'ShippingCartAddress',
+ 'customer_notes' => null,
+ ];
+ self::assertEquals($expectedShippingAddressData, current($response['cart']['shipping_addresses']));
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @expectedException \Exception
+ * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id"
+ */
+ public function testGetSpecifiedShippingAddressOfNonExistentCart()
+ {
+ $maskedQuoteId = 'non_existent_masked_id';
+ $query = $this->getQuery($maskedQuoteId);
+
+ $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * _security
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
+ */
+ public function testGetSpecifiedShippingAddressFromGuestCart()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+
+ $this->expectExceptionMessage(
+ "The current user cannot perform operations on cart \"$maskedQuoteId\""
+ );
+ $this->graphQlQuery($this->getQuery($maskedQuoteId), [], '', $this->getHeaderMap());
+ }
+
+ /**
+ * _security
+ * @magentoApiDataFixture Magento/Customer/_files/three_customers.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
+ */
+ public function testGetSpecifiedShippingAddressFromAnotherCustomerCart()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+
+ $this->expectExceptionMessage(
+ "The current user cannot perform operations on cart \"$maskedQuoteId\""
+ );
+ $this->graphQlQuery(
+ $this->getQuery($maskedQuoteId),
+ [],
+ '',
+ $this->getHeaderMap('customer2@search.example.com')
+ );
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @return string
+ */
+ private function getQuery(string $maskedQuoteId): string
+ {
+ return <<customerTokenService->createCustomerAccessToken($username, $password);
+ $headerMap = ['Authorization' => 'Bearer ' . $customerToken];
+ return $headerMap;
+ }
+}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php
index 8b20320fc2f02..9a943cf4b204e 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddSimpleProductToCartTest.php
@@ -112,7 +112,7 @@ private function getQuery(string $maskedQuoteId, string $sku, float $quantity):
addSimpleProductsToCart(
input: {
cart_id: "{$maskedQuoteId}"
- cartItems: [
+ cart_items: [
{
data: {
quantity: $quantity
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php
index cb429e7b9cb9e..cadbec857c2d6 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/AddVirtualProductToCartTest.php
@@ -113,7 +113,7 @@ private function getQuery(string $maskedQuoteId, string $sku, float $quantity):
addVirtualProductsToCart(
input: {
cart_id: "{$maskedQuoteId}"
- cartItems: [
+ cart_items: [
{
data: {
quantity: {$quantity}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CheckoutEndToEndTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CheckoutEndToEndTest.php
index bddee2151f5cd..ed5aa9303d875 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CheckoutEndToEndTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CheckoutEndToEndTest.php
@@ -172,7 +172,7 @@ private function addProductToCart(string $cartId, float $quantity, string $sku):
addSimpleProductsToCart(
input: {
cart_id: "{$cartId}"
- cartItems: [
+ cart_items: [
{
data: {
quantity: {$quantity}
@@ -269,7 +269,9 @@ private function setShippingAddress(string $cartId): array
available_shipping_methods {
carrier_code
method_code
- amount
+ amount {
+ value
+ }
}
}
}
@@ -294,7 +296,8 @@ private function setShippingAddress(string $cartId): array
self::assertNotEmpty($availableShippingMethod['method_code']);
self::assertArrayHasKey('amount', $availableShippingMethod);
- self::assertNotEmpty($availableShippingMethod['amount']);
+ self::assertArrayHasKey('value', $availableShippingMethod['amount']);
+ self::assertNotEmpty($availableShippingMethod['amount']['value']);
return $availableShippingMethod;
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetAvailableShippingMethodsTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetAvailableShippingMethodsTest.php
index a8113657eff6e..8703a690c62e3 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetAvailableShippingMethodsTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetAvailableShippingMethodsTest.php
@@ -50,15 +50,27 @@ public function testGetAvailableShippingMethods()
self::assertCount(1, $response['cart']['shipping_addresses'][0]['available_shipping_methods']);
$expectedAddressData = [
- 'amount' => 10,
- 'base_amount' => 10,
+ 'amount' => [
+ 'value' => 10,
+ 'currency' => 'USD',
+ ],
+ 'base_amount' => [
+ 'value' => 10,
+ 'currency' => 'USD',
+ ],
'carrier_code' => 'flatrate',
'carrier_title' => 'Flat Rate',
'error_message' => '',
'method_code' => 'flatrate',
'method_title' => 'Fixed',
- 'price_incl_tax' => 10,
- 'price_excl_tax' => 10,
+ 'price_incl_tax' => [
+ 'value' => 10,
+ 'currency' => 'USD',
+ ],
+ 'price_excl_tax' => [
+ 'value' => 10,
+ 'currency' => 'USD',
+ ],
];
self::assertEquals(
$expectedAddressData,
@@ -126,15 +138,27 @@ private function getQuery(string $maskedQuoteId): string
cart (cart_id: "{$maskedQuoteId}") {
shipping_addresses {
available_shipping_methods {
- amount
- base_amount
+ amount {
+ value
+ currency
+ }
+ base_amount {
+ value
+ currency
+ }
carrier_code
carrier_title
error_message
method_code
method_title
- price_excl_tax
- price_incl_tax
+ price_excl_tax {
+ value
+ currency
+ }
+ price_incl_tax {
+ value
+ currency
+ }
}
}
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSelectedPaymentMethodTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSelectedPaymentMethodTest.php
new file mode 100644
index 0000000000000..ef04da88ea67a
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSelectedPaymentMethodTest.php
@@ -0,0 +1,105 @@
+getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_payment_methods.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_checkmo_payment_method.php
+ *
+ */
+ public function testGetSelectedPaymentMethod()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+
+ $query = $this->getQuery($maskedQuoteId);
+ $response = $this->graphQlQuery($query);
+
+ $this->assertArrayHasKey('cart', $response);
+ $this->assertArrayHasKey('selected_payment_method', $response['cart']);
+ $this->assertArrayHasKey('code', $response['cart']['selected_payment_method']);
+ $this->assertEquals('checkmo', $response['cart']['selected_payment_method']['code']);
+ }
+
+ /**
+ * @expectedException \Exception
+ */
+ public function testGetSelectedPaymentMethodFromNonExistentCart()
+ {
+ $maskedQuoteId = 'non_existent_masked_id';
+ $query = $this->getQuery($maskedQuoteId);
+
+ $this->expectExceptionMessage(
+ 'Could not find a cart with ID "non_existent_masked_id"'
+ );
+
+ $this->graphQlQuery($query);
+ }
+
+ /**
+ * _security
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_payment_methods.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_checkmo_payment_method.php
+ */
+ public function testGetSelectedPaymentMethodFromCustomerCart()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $this->expectExceptionMessage(
+ "The current user cannot perform operations on cart \"{$maskedQuoteId}\""
+ );
+
+ $this->graphQlQuery($query);
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @return string
+ */
+ private function getQuery(string $maskedQuoteId): string
+ {
+ return <<getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId);
@@ -73,7 +73,7 @@ public function testGeSpecifiedBillingAddress()
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
*/
- public function testGeSpecifiedBillingAddressIfBillingAddressIsNotSet()
+ public function testGetSpecifiedBillingAddressIfBillingAddressIsNotSet()
{
$maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
$query = $this->getQuery($maskedQuoteId);
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSpecifiedShippingAddressTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSpecifiedShippingAddressTest.php
new file mode 100644
index 0000000000000..f71915bab650f
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/GetSpecifiedShippingAddressTest.php
@@ -0,0 +1,171 @@
+getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
+ */
+ public function testGetSpecifiedShippingAddress()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $response = $this->graphQlQuery($query);
+ self::assertArrayHasKey('cart', $response);
+ self::assertArrayHasKey('shipping_addresses', $response['cart']);
+
+ $expectedShippingAddressData = [
+ 'firstname' => 'John',
+ 'lastname' => 'Smith',
+ 'company' => 'CompanyName',
+ 'street' => [
+ 'Green str, 67'
+ ],
+ 'city' => 'CityM',
+ 'region' => [
+ 'code' => 'AL',
+ 'label' => 'Alabama',
+ ],
+ 'postcode' => '75477',
+ 'country' => [
+ 'code' => 'US',
+ 'label' => 'US',
+ ],
+ 'telephone' => '3468676',
+ '__typename' => 'ShippingCartAddress',
+ ];
+ self::assertEquals($expectedShippingAddressData, current($response['cart']['shipping_addresses']));
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
+ */
+ public function testGetSpecifiedShippingAddressIfShippingAddressIsNotSet()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $response = $this->graphQlQuery($query);
+ self::assertArrayHasKey('cart', $response);
+ self::assertArrayHasKey('shipping_addresses', $response['cart']);
+
+ $expectedShippingAddressData = [
+ 'firstname' => null,
+ 'lastname' => null,
+ 'company' => null,
+ 'street' => [
+ ''
+ ],
+ 'city' => null,
+ 'region' => [
+ 'code' => null,
+ 'label' => null,
+ ],
+ 'postcode' => null,
+ 'country' => [
+ 'code' => null,
+ 'label' => null,
+ ],
+ 'telephone' => null,
+ '__typename' => 'ShippingCartAddress',
+ ];
+ self::assertEquals($expectedShippingAddressData, current($response['cart']['shipping_addresses']));
+ }
+
+ /**
+ * @expectedException \Exception
+ * @expectedExceptionMessage Could not find a cart with ID "non_existent_masked_id"
+ */
+ public function testGetShippingAddressOfNonExistentCart()
+ {
+ $maskedQuoteId = 'non_existent_masked_id';
+ $query = $this->getQuery($maskedQuoteId);
+ $this->graphQlQuery($query);
+ }
+
+ /**
+ * _security
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
+ */
+ public function testGetShippingAddressFromCustomerCart()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId);
+
+ $this->expectExceptionMessage(
+ "The current user cannot perform operations on cart \"$maskedQuoteId\""
+ );
+ $this->graphQlQuery($query);
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @return string
+ */
+ private function getQuery(string $maskedQuoteId): string
+ {
+ return <<
false
- {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null}
+ {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_items: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null}
=
@@ -41567,7 +41567,7 @@ vars.put("product_sku", product.get("sku"));
false
- {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n variant_sku: \"${product_option}\"\n data: {\n quantity: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n quantity\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null}
+ {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_items: [\n {\n variant_sku: \"${product_option}\"\n data: {\n quantity: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n quantity\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null}
=
@@ -41739,7 +41739,7 @@ vars.put("product_sku", product.get("sku"));
false
- {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null}
+ {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_items: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null}
=
@@ -42045,7 +42045,7 @@ vars.put("product_sku", product.get("sku"));
false
- {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n variant_sku: \"${product_option}\"\n data: {\n quantity: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n quantity\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null}
+ {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_items: [\n {\n variant_sku: \"${product_option}\"\n data: {\n quantity: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n quantity\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null}
=
@@ -42303,7 +42303,7 @@ vars.put("product_sku", product.get("sku"));
false
- {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null}
+ {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_items: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null}
=
@@ -42609,7 +42609,7 @@ vars.put("product_sku", product.get("sku"));
false
- {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n variant_sku: \"${product_option}\"\n data: {\n quantity: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n quantity\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null}
+ {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_items: [\n {\n variant_sku: \"${product_option}\"\n data: {\n quantity: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n quantity\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null}
=
@@ -42867,7 +42867,7 @@ vars.put("product_sku", product.get("sku"));
false
- {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null}
+ {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_items: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null}
=
@@ -43094,7 +43094,7 @@ vars.put("product_sku", product.get("sku"));
false
- {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null}
+ {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_items: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null}
=
@@ -43959,7 +43959,7 @@ vars.put("product_sku", product.get("sku"));
false
- {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n variant_sku: \"${product_option}\"\n data: {\n quantity: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n quantity\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null}
+ {"query":"mutation {\n addConfigurableProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_items: [\n {\n variant_sku: \"${product_option}\"\n data: {\n quantity: 2\n sku: \"${product_option}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n id\n quantity\n product {\n name\n sku\n }\n ... on ConfigurableCartItem {\n configurable_options {\n option_label\n }\n }\n }\n }\n }\n}","variables":null,"operationName":null}
=
@@ -44019,7 +44019,7 @@ vars.put("product_sku", product.get("sku"));
false
- {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cartItems: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null}
+ {"query":"mutation { \n addSimpleProductsToCart(\n input: {\n cart_id: \"${quote_id}\"\n cart_items: [\n {\n data: {\n quantity: 2\n sku: \"${product_sku}\"\n }\n }\n ]\n }\n ) {\n cart {\n items {\n quantity\n product {\n sku\n }\n }\n }\n }\n}","variables":null,"operationName":null}
=