diff --git a/app/code/Magento/AuthorizenetGraphQl/etc/schema.graphqls b/app/code/Magento/AuthorizenetGraphQl/etc/schema.graphqls
index 1d724bbde3c5d..b6e817cc91d61 100644
--- a/app/code/Magento/AuthorizenetGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/AuthorizenetGraphQl/etc/schema.graphqls
@@ -1,7 +1,7 @@
# Copyright © Magento, Inc. All rights reserved.
# See COPYING.txt for license details.
-input PaymentMethodAdditionalDataInput {
+input PaymentMethodInput {
authorizenet_acceptjs: AuthorizenetInput @doc(description: "Defines the required attributes for Authorize.Net payments")
}
diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/SortFields.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/SortFields.php
index cb5553bb03701..44ea0222ba59d 100644
--- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/SortFields.php
+++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Category/SortFields.php
@@ -7,6 +7,8 @@
namespace Magento\CatalogGraphQl\Model\Resolver\Category;
+use Magento\Catalog\Model\Category\Attribute\Source\Sortby;
+use Magento\Catalog\Model\Config;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
@@ -17,32 +19,24 @@
class SortFields implements ResolverInterface
{
/**
- * @var \Magento\Catalog\Model\Config
+ * @var Config
*/
private $catalogConfig;
-
- /**
- * @var \Magento\Store\Model\StoreManagerInterface
- */
- private $storeManager;
-
+
/**
- * @var \Magento\Catalog\Model\Category\Attribute\Source\Sortby
+ * @var Sortby
*/
private $sortbyAttributeSource;
/**
- * @param \Magento\Catalog\Model\Config $catalogConfig
- * @param \Magento\Store\Model\StoreManagerInterface $storeManager
- * @oaram \Magento\Catalog\Model\Category\Attribute\Source\Sortby $sortbyAttributeSource
+ * @param Config $catalogConfig
+ * @param Sortby $sortbyAttributeSource
*/
public function __construct(
- \Magento\Catalog\Model\Config $catalogConfig,
- \Magento\Store\Model\StoreManagerInterface $storeManager,
- \Magento\Catalog\Model\Category\Attribute\Source\Sortby $sortbyAttributeSource
+ Config $catalogConfig,
+ Sortby $sortbyAttributeSource
) {
$this->catalogConfig = $catalogConfig;
- $this->storeManager = $storeManager;
$this->sortbyAttributeSource = $sortbyAttributeSource;
}
@@ -52,6 +46,8 @@ public function __construct(
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
{
$sortFieldsOptions = $this->sortbyAttributeSource->getAllOptions();
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+
array_walk(
$sortFieldsOptions,
function (&$option) {
@@ -59,10 +55,10 @@ function (&$option) {
}
);
$data = [
- 'default' => $this->catalogConfig->getProductListDefaultSortBy($this->storeManager->getStore()->getId()),
+ 'default' => $this->catalogConfig->getProductListDefaultSortBy($storeId),
'options' => $sortFieldsOptions,
];
-
+
return $data;
}
}
diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/Price.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/Price.php
index 55d930101fb60..c542fc26495f7 100644
--- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/Price.php
+++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/Price.php
@@ -7,43 +7,35 @@
namespace Magento\CatalogGraphQl\Model\Resolver\Product;
-use Magento\Framework\Exception\LocalizedException;
-use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
-use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Catalog\Model\Product;
use Magento\Catalog\Pricing\Price\FinalPrice;
use Magento\Catalog\Pricing\Price\RegularPrice;
+use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Config\Element\Field;
+use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
use Magento\Framework\GraphQl\Query\ResolverInterface;
+use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Framework\Pricing\Adjustment\AdjustmentInterface;
use Magento\Framework\Pricing\Amount\AmountInterface;
use Magento\Framework\Pricing\PriceInfo\Factory as PriceInfoFactory;
-use Magento\Store\Model\StoreManagerInterface;
+use Magento\Store\Api\Data\StoreInterface;
/**
* Format a product's price information to conform to GraphQL schema representation
*/
class Price implements ResolverInterface
{
- /**
- * @var StoreManagerInterface
- */
- private $storeManager;
-
/**
* @var PriceInfoFactory
*/
private $priceInfoFactory;
/**
- * @param StoreManagerInterface $storeManager
* @param PriceInfoFactory $priceInfoFactory
*/
public function __construct(
- StoreManagerInterface $storeManager,
PriceInfoFactory $priceInfoFactory
) {
- $this->storeManager = $storeManager;
$this->priceInfoFactory = $priceInfoFactory;
}
@@ -80,11 +72,20 @@ public function resolve(
$minimalPriceAmount = $finalPrice->getMinimalPrice();
$maximalPriceAmount = $finalPrice->getMaximalPrice();
$regularPriceAmount = $priceInfo->getPrice(RegularPrice::PRICE_CODE)->getAmount();
+ $store = $context->getExtensionAttributes()->getStore();
$prices = [
- 'minimalPrice' => $this->createAdjustmentsArray($priceInfo->getAdjustments(), $minimalPriceAmount),
- 'regularPrice' => $this->createAdjustmentsArray($priceInfo->getAdjustments(), $regularPriceAmount),
- 'maximalPrice' => $this->createAdjustmentsArray($priceInfo->getAdjustments(), $maximalPriceAmount)
+ 'minimalPrice' => $this->createAdjustmentsArray(
+ $priceInfo->getAdjustments(),
+ $minimalPriceAmount,
+ $store
+ ),
+ 'regularPrice' => $this->createAdjustmentsArray(
+ $priceInfo->getAdjustments(),
+ $regularPriceAmount,
+ $store
+ ),
+ 'maximalPrice' => $this->createAdjustmentsArray($priceInfo->getAdjustments(), $maximalPriceAmount, $store)
];
return $prices;
@@ -95,13 +96,11 @@ public function resolve(
*
* @param AdjustmentInterface[] $adjustments
* @param AmountInterface $amount
+ * @param StoreInterface $store
* @return array
*/
- private function createAdjustmentsArray(array $adjustments, AmountInterface $amount) : array
+ private function createAdjustmentsArray(array $adjustments, AmountInterface $amount, StoreInterface $store) : array
{
- /** @var \Magento\Store\Model\Store $store */
- $store = $this->storeManager->getStore();
-
$priceArray = [
'amount' => [
'value' => $amount->getValue(),
diff --git a/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductImage/Label.php b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductImage/Label.php
index f971e35742628..978bbfb01ff1b 100644
--- a/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductImage/Label.php
+++ b/app/code/Magento/CatalogGraphQl/Model/Resolver/Product/ProductImage/Label.php
@@ -13,7 +13,6 @@
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
-use Magento\Store\Model\StoreManagerInterface;
/**
* Returns product's image label
@@ -25,21 +24,13 @@ class Label implements ResolverInterface
*/
private $productResource;
- /**
- * @var StoreManagerInterface
- */
- private $storeManager;
-
/**
* @param ProductResourceModel $productResource
- * @param StoreManagerInterface $storeManager
*/
public function __construct(
- ProductResourceModel $productResource,
- StoreManagerInterface $storeManager
+ ProductResourceModel $productResource
) {
$this->productResource = $productResource;
- $this->storeManager = $storeManager;
}
/**
@@ -65,15 +56,16 @@ public function resolve(
$imageType = $value['image_type'];
$imagePath = $product->getData($imageType);
$productId = (int)$product->getEntityId();
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
// null if image is not set
if (null === $imagePath) {
- return $this->getAttributeValue($productId, 'name');
+ return $this->getAttributeValue($productId, 'name', $storeId);
}
- $imageLabel = $this->getAttributeValue($productId, $imageType . '_label');
+ $imageLabel = $this->getAttributeValue($productId, $imageType . '_label', $storeId);
if (null === $imageLabel) {
- $imageLabel = $this->getAttributeValue($productId, 'name');
+ $imageLabel = $this->getAttributeValue($productId, 'name', $storeId);
}
return $imageLabel;
@@ -84,12 +76,11 @@ public function resolve(
*
* @param int $productId
* @param string $attributeCode
+ * @param int $storeId
* @return null|string Null if attribute value is not exists
*/
- private function getAttributeValue(int $productId, string $attributeCode): ?string
+ private function getAttributeValue(int $productId, string $attributeCode, int $storeId): ?string
{
- $storeId = $this->storeManager->getStore()->getId();
-
$value = $this->productResource->getAttributeRawValue($productId, $attributeCode, $storeId);
return is_array($value) && empty($value) ? null : $value;
}
diff --git a/app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php b/app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php
index 40825e70a994e..9ca215368ab5f 100644
--- a/app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php
+++ b/app/code/Magento/CmsGraphQl/Model/Resolver/DataProvider/Page.php
@@ -11,7 +11,6 @@
use Magento\Cms\Api\GetPageByIdentifierInterface;
use Magento\Cms\Api\PageRepositoryInterface;
use Magento\Framework\Exception\NoSuchEntityException;
-use Magento\Store\Model\StoreManagerInterface;
use Magento\Widget\Model\Template\FilterEmulate;
/**
@@ -29,11 +28,6 @@ class Page
*/
private $pageRepository;
- /**
- * @var StoreManagerInterface
- */
- private $storeManager;
-
/**
* @var FilterEmulate
*/
@@ -43,19 +37,16 @@ class Page
* @param PageRepositoryInterface $pageRepository
* @param FilterEmulate $widgetFilter
* @param GetPageByIdentifierInterface $getPageByIdentifier
- * @param StoreManagerInterface $storeManager
*/
public function __construct(
PageRepositoryInterface $pageRepository,
FilterEmulate $widgetFilter,
- GetPageByIdentifierInterface $getPageByIdentifier,
- StoreManagerInterface $storeManager
+ GetPageByIdentifierInterface $getPageByIdentifier
) {
$this->pageRepository = $pageRepository;
$this->widgetFilter = $widgetFilter;
$this->pageByIdentifier = $getPageByIdentifier;
- $this->storeManager = $storeManager;
}
/**
@@ -76,12 +67,12 @@ public function getDataByPageId(int $pageId): array
* Returns page data by page identifier
*
* @param string $pageIdentifier
+ * @param int $storeId
* @return array
* @throws NoSuchEntityException
*/
- public function getDataByPageIdentifier(string $pageIdentifier): array
+ public function getDataByPageIdentifier(string $pageIdentifier, int $storeId): array
{
- $storeId = (int)$this->storeManager->getStore()->getId();
$page = $this->pageByIdentifier->execute($pageIdentifier, $storeId);
return $this->convertPageData($page);
diff --git a/app/code/Magento/CmsGraphQl/Model/Resolver/Page.php b/app/code/Magento/CmsGraphQl/Model/Resolver/Page.php
index 64891cfeaa87a..7d03de7c4d0c3 100644
--- a/app/code/Magento/CmsGraphQl/Model/Resolver/Page.php
+++ b/app/code/Magento/CmsGraphQl/Model/Resolver/Page.php
@@ -55,7 +55,10 @@ public function resolve(
if (isset($args['id'])) {
$pageData = $this->pageDataProvider->getDataByPageId((int)$args['id']);
} elseif (isset($args['identifier'])) {
- $pageData = $this->pageDataProvider->getDataByPageIdentifier((string)$args['identifier']);
+ $pageData = $this->pageDataProvider->getDataByPageIdentifier(
+ (string)$args['identifier'],
+ (int)$context->getExtensionAttributes()->getStore()->getId()
+ );
}
} catch (NoSuchEntityException $e) {
throw new GraphQlNoSuchEntityException(__($e->getMessage()), $e);
diff --git a/app/code/Magento/CmsGraphQl/composer.json b/app/code/Magento/CmsGraphQl/composer.json
index e0e8481d59b7b..18a6f1aa95e37 100644
--- a/app/code/Magento/CmsGraphQl/composer.json
+++ b/app/code/Magento/CmsGraphQl/composer.json
@@ -6,7 +6,6 @@
"php": "~7.1.3||~7.2.0",
"magento/framework": "*",
"magento/module-cms": "*",
- "magento/module-store": "*",
"magento/module-widget": "*"
},
"suggest": {
diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/CreateCustomerAccount.php b/app/code/Magento/CustomerGraphQl/Model/Customer/CreateCustomerAccount.php
index b7b66df042467..eada473b61e1f 100644
--- a/app/code/Magento/CustomerGraphQl/Model/Customer/CreateCustomerAccount.php
+++ b/app/code/Magento/CustomerGraphQl/Model/Customer/CreateCustomerAccount.php
@@ -13,7 +13,7 @@
use Magento\Framework\Api\DataObjectHelper;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
-use Magento\Store\Model\StoreManagerInterface;
+use Magento\Store\Api\Data\StoreInterface;
/**
* Create new customer account
@@ -35,11 +35,6 @@ class CreateCustomerAccount
*/
private $accountManagement;
- /**
- * @var StoreManagerInterface
- */
- private $storeManager;
-
/**
* @var ChangeSubscriptionStatus
*/
@@ -48,21 +43,18 @@ class CreateCustomerAccount
/**
* @param DataObjectHelper $dataObjectHelper
* @param CustomerInterfaceFactory $customerFactory
- * @param StoreManagerInterface $storeManager
* @param AccountManagementInterface $accountManagement
* @param ChangeSubscriptionStatus $changeSubscriptionStatus
*/
public function __construct(
DataObjectHelper $dataObjectHelper,
CustomerInterfaceFactory $customerFactory,
- StoreManagerInterface $storeManager,
AccountManagementInterface $accountManagement,
ChangeSubscriptionStatus $changeSubscriptionStatus
) {
$this->dataObjectHelper = $dataObjectHelper;
$this->customerFactory = $customerFactory;
$this->accountManagement = $accountManagement;
- $this->storeManager = $storeManager;
$this->changeSubscriptionStatus = $changeSubscriptionStatus;
}
@@ -70,13 +62,14 @@ public function __construct(
* Creates new customer account
*
* @param array $data
+ * @param StoreInterface $store
* @return CustomerInterface
* @throws GraphQlInputException
*/
- public function execute(array $data): CustomerInterface
+ public function execute(array $data, StoreInterface $store): CustomerInterface
{
try {
- $customer = $this->createAccount($data);
+ $customer = $this->createAccount($data, $store);
} catch (LocalizedException $e) {
throw new GraphQlInputException(__($e->getMessage()));
}
@@ -91,10 +84,11 @@ public function execute(array $data): CustomerInterface
* Create account
*
* @param array $data
+ * @param StoreInterface $store
* @return CustomerInterface
* @throws LocalizedException
*/
- private function createAccount(array $data): CustomerInterface
+ private function createAccount(array $data, StoreInterface $store): CustomerInterface
{
$customerDataObject = $this->customerFactory->create();
$this->dataObjectHelper->populateWithArray(
@@ -102,7 +96,6 @@ private function createAccount(array $data): CustomerInterface
$data,
CustomerInterface::class
);
- $store = $this->storeManager->getStore();
$customerDataObject->setWebsiteId($store->getWebsiteId());
$customerDataObject->setStoreId($store->getId());
diff --git a/app/code/Magento/CustomerGraphQl/Model/Customer/UpdateCustomerAccount.php b/app/code/Magento/CustomerGraphQl/Model/Customer/UpdateCustomerAccount.php
index 8601d586b3c95..51d47eaf0d048 100644
--- a/app/code/Magento/CustomerGraphQl/Model/Customer/UpdateCustomerAccount.php
+++ b/app/code/Magento/CustomerGraphQl/Model/Customer/UpdateCustomerAccount.php
@@ -10,12 +10,14 @@
use Magento\Framework\GraphQl\Exception\GraphQlAlreadyExistsException;
use Magento\Framework\GraphQl\Exception\GraphQlAuthenticationException;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
-use Magento\Store\Model\StoreManagerInterface;
use Magento\Customer\Api\Data\CustomerInterface;
use Magento\Framework\Api\DataObjectHelper;
+use Magento\Store\Api\Data\StoreInterface;
/**
* Update customer account data
+ *
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - https://jira.corp.magento.com/browse/MC-18152
*/
class UpdateCustomerAccount
{
@@ -24,11 +26,6 @@ class UpdateCustomerAccount
*/
private $saveCustomer;
- /**
- * @var StoreManagerInterface
- */
- private $storeManager;
-
/**
* @var CheckCustomerPassword
*/
@@ -51,7 +48,6 @@ class UpdateCustomerAccount
/**
* @param SaveCustomer $saveCustomer
- * @param StoreManagerInterface $storeManager
* @param CheckCustomerPassword $checkCustomerPassword
* @param DataObjectHelper $dataObjectHelper
* @param ChangeSubscriptionStatus $changeSubscriptionStatus
@@ -59,14 +55,12 @@ class UpdateCustomerAccount
*/
public function __construct(
SaveCustomer $saveCustomer,
- StoreManagerInterface $storeManager,
CheckCustomerPassword $checkCustomerPassword,
DataObjectHelper $dataObjectHelper,
ChangeSubscriptionStatus $changeSubscriptionStatus,
array $restrictedKeys = []
) {
$this->saveCustomer = $saveCustomer;
- $this->storeManager = $storeManager;
$this->checkCustomerPassword = $checkCustomerPassword;
$this->dataObjectHelper = $dataObjectHelper;
$this->restrictedKeys = $restrictedKeys;
@@ -78,12 +72,14 @@ public function __construct(
*
* @param CustomerInterface $customer
* @param array $data
+ * @param StoreInterface $store
* @return void
* @throws GraphQlAlreadyExistsException
* @throws GraphQlAuthenticationException
* @throws GraphQlInputException
+ * @throws \Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException
*/
- public function execute(CustomerInterface $customer, array $data): void
+ public function execute(CustomerInterface $customer, array $data, StoreInterface $store): void
{
if (isset($data['email']) && $customer->getEmail() !== $data['email']) {
if (!isset($data['password']) || empty($data['password'])) {
@@ -97,7 +93,7 @@ public function execute(CustomerInterface $customer, array $data): void
$filteredData = array_diff_key($data, array_flip($this->restrictedKeys));
$this->dataObjectHelper->populateWithArray($customer, $filteredData, CustomerInterface::class);
- $customer->setStoreId($this->storeManager->getStore()->getId());
+ $customer->setStoreId($store->getId());
$this->saveCustomer->execute($customer);
diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomer.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomer.php
index e12c636f0edf6..1f730f2a5c7e6 100644
--- a/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomer.php
+++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/CreateCustomer.php
@@ -55,7 +55,10 @@ public function resolve(
throw new GraphQlInputException(__('"input" value should be specified'));
}
- $customer = $this->createCustomerAccount->execute($args['input']);
+ $customer = $this->createCustomerAccount->execute(
+ $args['input'],
+ $context->getExtensionAttributes()->getStore()
+ );
$data = $this->extractCustomerData->execute($customer);
return ['customer' => $data];
diff --git a/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomer.php b/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomer.php
index 47c51c3778842..b2ef03fc40e5a 100644
--- a/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomer.php
+++ b/app/code/Magento/CustomerGraphQl/Model/Resolver/UpdateCustomer.php
@@ -72,7 +72,11 @@ public function resolve(
}
$customer = $this->getCustomer->execute($context);
- $this->updateCustomerAccount->execute($customer, $args['input']);
+ $this->updateCustomerAccount->execute(
+ $customer,
+ $args['input'],
+ $context->getExtensionAttributes()->getStore()
+ );
$data = $this->extractCustomerData->execute($customer);
return ['customer' => $data];
diff --git a/app/code/Magento/PaypalGraphQl/Model/Plugin/Resolver/SetPaymentMethodOnCart.php b/app/code/Magento/PaypalGraphQl/Model/Plugin/Resolver/SetPaymentMethodOnCart.php
index 62ed8e0f68bcf..988ae7c8f4aa6 100644
--- a/app/code/Magento/PaypalGraphQl/Model/Plugin/Resolver/SetPaymentMethodOnCart.php
+++ b/app/code/Magento/PaypalGraphQl/Model/Plugin/Resolver/SetPaymentMethodOnCart.php
@@ -25,7 +25,7 @@ class SetPaymentMethodOnCart
{
private const PATH_CODE = 'input/payment_method/code';
- private const PATH_ADDITIONAL_DATA = 'input/payment_method/additional_data';
+ private const PATH_PAYMENT_METHOD_DATA = 'input/payment_method';
private $allowedPaymentMethodCodes = [];
@@ -98,7 +98,7 @@ public function afterResolve(
return $resolvedValue;
}
- $paypalAdditionalData = $this->arrayManager->get(self::PATH_ADDITIONAL_DATA, $args) ?? [];
+ $paypalAdditionalData = $this->arrayManager->get(self::PATH_PAYMENT_METHOD_DATA, $args) ?? [];
$payerId = $paypalAdditionalData[$paymentCode]['payer_id'] ?? null;
$token = $paypalAdditionalData[$paymentCode]['token'] ?? null;
$cart = $resolvedValue['cart']['model'];
diff --git a/app/code/Magento/PaypalGraphQl/Model/Resolver/PayflowProResponse.php b/app/code/Magento/PaypalGraphQl/Model/Resolver/PayflowProResponse.php
index 42a5504de9a16..ce44511c60f3e 100644
--- a/app/code/Magento/PaypalGraphQl/Model/Resolver/PayflowProResponse.php
+++ b/app/code/Magento/PaypalGraphQl/Model/Resolver/PayflowProResponse.php
@@ -117,7 +117,8 @@ public function resolve(
}
$maskedCartId = $args['input']['cart_id'];
- $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
$paypalPayload = $args['input']['paypal_payload'] ?? '';
diff --git a/app/code/Magento/PaypalGraphQl/Model/Resolver/PayflowProToken.php b/app/code/Magento/PaypalGraphQl/Model/Resolver/PayflowProToken.php
index 64aec1b035c0d..409145ca9a963 100644
--- a/app/code/Magento/PaypalGraphQl/Model/Resolver/PayflowProToken.php
+++ b/app/code/Magento/PaypalGraphQl/Model/Resolver/PayflowProToken.php
@@ -65,7 +65,8 @@ public function resolve(
$urls = $args['input']['urls'] ?? null ;
$customerId = $context->getUserId();
- $cart = $this->getCartForUser->execute($cartId, $customerId);
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($cartId, $customerId, $storeId);
if (!empty($args['input']['urls'])) {
$this->validateUrls($args['input']['urls']);
diff --git a/app/code/Magento/PaypalGraphQl/Model/Resolver/PaypalExpressToken.php b/app/code/Magento/PaypalGraphQl/Model/Resolver/PaypalExpressToken.php
index 0c6449fc9d230..89db082e715c4 100644
--- a/app/code/Magento/PaypalGraphQl/Model/Resolver/PaypalExpressToken.php
+++ b/app/code/Magento/PaypalGraphQl/Model/Resolver/PaypalExpressToken.php
@@ -85,7 +85,8 @@ public function resolve(
$usedExpressButton = isset($args['input']['express_button']) ? $args['input']['express_button'] : false;
$customerId = $context->getUserId();
- $cart = $this->getCartForUser->execute($cartId, $customerId);
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($cartId, $customerId, $storeId);
$config = $this->configProvider->getConfig($paymentCode);
$checkout = $this->checkoutProvider->getCheckout($config, $cart);
diff --git a/app/code/Magento/PaypalGraphQl/etc/schema.graphqls b/app/code/Magento/PaypalGraphQl/etc/schema.graphqls
index 97b65fb6587f6..33cbb73668732 100644
--- a/app/code/Magento/PaypalGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/PaypalGraphQl/etc/schema.graphqls
@@ -31,7 +31,7 @@ type PayflowLinkToken {
paypal_url: String @doc(description:"PayPal URL used for requesting Payflow form")
}
-input PaymentMethodAdditionalDataInput {
+input PaymentMethodInput {
paypal_express: PaypalExpressInput @doc(description:"Required input for PayPal Express Checkout payments")
payflow_express: PayflowExpressInput @doc(description:"Required input for PayPal Payflow Express Checkout payments")
payflow_link: PayflowLinkAdditionalDataInput @doc(description:"Required input for PayPal Payflow Link payments")
diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php b/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php
index 9c57550295413..af70809a1053d 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php
@@ -13,7 +13,6 @@
use Magento\Quote\Api\CartRepositoryInterface;
use Magento\Quote\Model\MaskedQuoteIdToQuoteIdInterface;
use Magento\Quote\Model\Quote;
-use Magento\Store\Model\StoreManagerInterface;
/**
* Get cart
@@ -30,24 +29,16 @@ class GetCartForUser
*/
private $cartRepository;
- /**
- * @var StoreManagerInterface
- */
- private $storeManager;
-
/**
* @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId
* @param CartRepositoryInterface $cartRepository
- * @param StoreManagerInterface $storeManager
*/
public function __construct(
MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId,
- CartRepositoryInterface $cartRepository,
- StoreManagerInterface $storeManager
+ CartRepositoryInterface $cartRepository
) {
$this->maskedQuoteIdToQuoteId = $maskedQuoteIdToQuoteId;
$this->cartRepository = $cartRepository;
- $this->storeManager = $storeManager;
}
/**
@@ -55,12 +46,13 @@ public function __construct(
*
* @param string $cartHash
* @param int|null $customerId
+ * @param int $storeId
* @return Quote
* @throws GraphQlAuthorizationException
* @throws GraphQlNoSuchEntityException
* @throws NoSuchEntityException
*/
- public function execute(string $cartHash, ?int $customerId): Quote
+ public function execute(string $cartHash, ?int $customerId, int $storeId): Quote
{
try {
$cartId = $this->maskedQuoteIdToQuoteId->execute($cartHash);
@@ -85,7 +77,7 @@ public function execute(string $cartHash, ?int $customerId): Quote
);
}
- if ((int)$cart->getStoreId() !== (int)$this->storeManager->getStore()->getId()) {
+ if ((int)$cart->getStoreId() !== $storeId) {
throw new GraphQlNoSuchEntityException(
__(
'Wrong store code specified for cart "%masked_cart_id"',
diff --git a/app/code/Magento/QuoteGraphQl/Model/Cart/SetPaymentMethodOnCart.php b/app/code/Magento/QuoteGraphQl/Model/Cart/SetPaymentMethodOnCart.php
index ceaebf19e0e03..4deb794761efb 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Cart/SetPaymentMethodOnCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Cart/SetPaymentMethodOnCart.php
@@ -68,18 +68,15 @@ public function execute(Quote $cart, array $paymentData): void
$paymentMethodCode = $paymentData['code'];
$poNumber = $paymentData['purchase_order_number'] ?? null;
- $additionalData = isset($paymentData['additional_data'])
- ? $this->additionalDataProviderPool->getData($paymentMethodCode, $paymentData['additional_data'])
- : [];
+ $additionalData = $this->additionalDataProviderPool->getData($paymentMethodCode, $paymentData);
$payment = $this->paymentFactory->create(
[
- 'data' =>
- [
- PaymentInterface::KEY_METHOD => $paymentMethodCode,
- PaymentInterface::KEY_PO_NUMBER => $poNumber,
- PaymentInterface::KEY_ADDITIONAL_DATA => $additionalData,
- ],
+ 'data' => [
+ PaymentInterface::KEY_METHOD => $paymentMethodCode,
+ PaymentInterface::KEY_PO_NUMBER => $poNumber,
+ PaymentInterface::KEY_ADDITIONAL_DATA => $additionalData,
+ ],
]
);
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php
index 9876938c08bc6..2948994cf0ba3 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php
@@ -59,7 +59,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
}
$cartItems = $args['input']['cart_items'];
- $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
$this->addProductsToCart->execute($cart, $cartItems);
return [
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/ApplyCouponToCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/ApplyCouponToCart.php
index 84d2183eeac73..ddd7d25943baa 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/ApplyCouponToCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/ApplyCouponToCart.php
@@ -61,7 +61,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
$couponCode = $args['input']['coupon_code'];
$currentUserId = $context->getUserId();
- $cart = $this->getCartForUser->execute($maskedCartId, $currentUserId);
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $currentUserId, $storeId);
$cartId = $cart->getId();
/* Check current cart does not have coupon code applied */
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/Cart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/Cart.php
index 16fd639685b82..34812c3eac410 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/Cart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/Cart.php
@@ -43,7 +43,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
$maskedCartId = $args['cart_id'];
$currentUserId = $context->getUserId();
- $cart = $this->getCartForUser->execute($maskedCartId, $currentUserId);
+ $storeId = $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $currentUserId, $storeId);
return [
'model' => $cart,
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartPrices.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartPrices.php
old mode 100644
new mode 100755
index 48711ec38c4f8..6a57a7662af09
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/CartPrices.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/CartPrices.php
@@ -73,7 +73,7 @@ private function getAppliedTaxes(Total $total, string $currency): array
$appliedTaxesData = [];
$appliedTaxes = $total->getAppliedTaxes();
- if (count($appliedTaxes) === 0) {
+ if (empty($appliedTaxes)) {
return $appliedTaxesData;
}
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/PlaceOrder.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/PlaceOrder.php
index 51cea7e3b3652..1a0740a75c8f8 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/PlaceOrder.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/PlaceOrder.php
@@ -72,7 +72,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
}
$maskedCartId = $args['input']['cart_id'];
- $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
$this->checkCartCheckoutAllowance->execute($cart);
if ((int)$context->getUserId() === 0) {
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/RemoveCouponFromCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/RemoveCouponFromCart.php
index 291dd9c507ebd..f5b768d0dcb0b 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/RemoveCouponFromCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/RemoveCouponFromCart.php
@@ -56,7 +56,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
$maskedCartId = $args['input']['cart_id'];
$currentUserId = $context->getUserId();
- $cart = $this->getCartForUser->execute($maskedCartId, $currentUserId);
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $currentUserId, $storeId);
$cartId = $cart->getId();
try {
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/RemoveItemFromCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/RemoveItemFromCart.php
index 0dc7274bd474e..bf9ccef8ae44a 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/RemoveItemFromCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/RemoveItemFromCart.php
@@ -59,7 +59,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
}
$itemId = $args['input']['cart_item_id'];
- $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
try {
$this->cartItemRepository->deleteById((int)$cart->getId(), $itemId);
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetBillingAddressOnCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetBillingAddressOnCart.php
index a56fabae2732b..c315aa9b14146 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetBillingAddressOnCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetBillingAddressOnCart.php
@@ -65,7 +65,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
}
$billingAddress = $args['input']['billing_address'];
- $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
+ $storeId = $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
$this->checkCartCheckoutAllowance->execute($cart);
$this->setBillingAddressOnCart->execute($context, $cart, $billingAddress);
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetGuestEmailOnCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetGuestEmailOnCart.php
index a029f447e369f..b951151e27c68 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetGuestEmailOnCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetGuestEmailOnCart.php
@@ -86,7 +86,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
throw new GraphQlInputException(__('The request is not allowed for logged in customers'));
}
- $cart = $this->getCartForUser->execute($maskedCartId, $currentUserId);
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $currentUserId, $storeId);
$this->checkCartCheckoutAllowance->execute($cart);
$cart->setCustomerEmail($email);
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetPaymentAndPlaceOrder.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetPaymentAndPlaceOrder.php
index 10ce62e49c53d..0efbde5d6b218 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetPaymentAndPlaceOrder.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetPaymentAndPlaceOrder.php
@@ -77,7 +77,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
}
$paymentData = $args['input']['payment_method'];
- $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
if ((int)$context->getUserId() === 0) {
if (!$cart->getCustomerEmail()) {
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetPaymentMethodOnCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetPaymentMethodOnCart.php
index e8b663ed612e5..fb6c1e678f1f0 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetPaymentMethodOnCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetPaymentMethodOnCart.php
@@ -65,7 +65,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
}
$paymentData = $args['input']['payment_method'];
- $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
$this->checkCartCheckoutAllowance->execute($cart);
$this->setPaymentMethodOnCart->execute($cart, $paymentData);
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetShippingAddressesOnCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetShippingAddressesOnCart.php
index b61addabf417a..d86244b2d8fc3 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetShippingAddressesOnCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetShippingAddressesOnCart.php
@@ -65,7 +65,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
}
$shippingAddresses = $args['input']['shipping_addresses'];
- $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
$this->checkCartCheckoutAllowance->execute($cart);
$this->setShippingAddressesOnCart->execute($context, $cart, $shippingAddresses);
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetShippingMethodsOnCart.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetShippingMethodsOnCart.php
index 6c8bb4b24f46c..e1cd9c18d9873 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/SetShippingMethodsOnCart.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/SetShippingMethodsOnCart.php
@@ -65,7 +65,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
}
$shippingMethods = $args['input']['shipping_methods'];
- $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
$this->checkCartCheckoutAllowance->execute($cart);
$this->setShippingMethodsOnCart->execute($context, $cart, $shippingMethods);
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/AvailableShippingMethods.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/AvailableShippingMethods.php
index 958934ed18032..e5dd1d73b80b5 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/AvailableShippingMethods.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/AvailableShippingMethods.php
@@ -16,7 +16,7 @@
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Quote\Api\Data\ShippingMethodInterface;
use Magento\Quote\Model\Cart\ShippingMethodConverter;
-use Magento\Store\Model\StoreManagerInterface;
+use Magento\Store\Api\Data\StoreInterface;
/**
* @inheritdoc
@@ -33,24 +33,16 @@ 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,
- StoreManagerInterface $storeManager
+ ShippingMethodConverter $shippingMethodConverter
) {
$this->dataObjectConverter = $dataObjectConverter;
$this->shippingMethodConverter = $shippingMethodConverter;
- $this->storeManager = $storeManager;
}
/**
@@ -81,7 +73,11 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
[],
ShippingMethodInterface::class
);
- $methods[] = $this->processMoneyTypeData($methodData, $cart->getQuoteCurrencyCode());
+ $methods[] = $this->processMoneyTypeData(
+ $methodData,
+ $cart->getQuoteCurrencyCode(),
+ $context->getExtensionAttributes()->getStore()
+ );
}
}
return $methods;
@@ -92,10 +88,11 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
*
* @param array $data
* @param string $quoteCurrencyCode
+ * @param StoreInterface $store
* @return array
* @throws NoSuchEntityException
*/
- private function processMoneyTypeData(array $data, string $quoteCurrencyCode): array
+ private function processMoneyTypeData(array $data, string $quoteCurrencyCode, StoreInterface $store): array
{
if (isset($data['amount'])) {
$data['amount'] = ['value' => $data['amount'], 'currency' => $quoteCurrencyCode];
@@ -103,7 +100,7 @@ private function processMoneyTypeData(array $data, string $quoteCurrencyCode): a
if (isset($data['base_amount'])) {
/** @var Currency $currency */
- $currency = $this->storeManager->getStore()->getBaseCurrency();
+ $currency = $store->getBaseCurrency();
$data['base_amount'] = ['value' => $data['base_amount'], 'currency' => $currency->getCode()];
}
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php
index b359971880036..f2dacf6d007f3 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/ShippingAddress/SelectedShippingMethod.php
@@ -14,27 +14,12 @@
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
*/
@@ -62,7 +47,7 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
}
/** @var Currency $currency */
- $currency = $this->storeManager->getStore()->getBaseCurrency();
+ $currency = $context->getExtensionAttributes()->getStore()->getBaseCurrency();
$data = [
'carrier_code' => $carrierCode,
diff --git a/app/code/Magento/QuoteGraphQl/Model/Resolver/UpdateCartItems.php b/app/code/Magento/QuoteGraphQl/Model/Resolver/UpdateCartItems.php
index db6a43513cc30..8066c28e9e48a 100644
--- a/app/code/Magento/QuoteGraphQl/Model/Resolver/UpdateCartItems.php
+++ b/app/code/Magento/QuoteGraphQl/Model/Resolver/UpdateCartItems.php
@@ -71,7 +71,8 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
}
$cartItems = $args['input']['cart_items'];
- $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId());
+ $storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
+ $cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
try {
$this->processCartItems($cart, $cartItems);
diff --git a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls
index 897227bbcf30b..63f965daf1243 100644
--- a/app/code/Magento/QuoteGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/QuoteGraphQl/etc/schema.graphqls
@@ -138,7 +138,6 @@ input SetPaymentMethodOnCartInput {
input PaymentMethodInput {
code: String! @doc(description:"Payment method code")
purchase_order_number: String @doc(description:"Purchase order number")
- additional_data: PaymentMethodAdditionalDataInput @doc(description: "Additional payment data")
}
input SetGuestEmailOnCartInput {
diff --git a/app/code/Magento/StoreGraphQl/Model/Context/AddStoreInfoToContext.php b/app/code/Magento/StoreGraphQl/Model/Context/AddStoreInfoToContext.php
new file mode 100644
index 0000000000000..f894b1251ecb8
--- /dev/null
+++ b/app/code/Magento/StoreGraphQl/Model/Context/AddStoreInfoToContext.php
@@ -0,0 +1,43 @@
+storeManager = $storeManager;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function execute(ContextParametersInterface $contextParameters): ContextParametersInterface
+ {
+ $currentStore = $this->storeManager->getStore();
+ $contextParameters->addExtensionAttribute('store', $currentStore);
+
+ return $contextParameters;
+ }
+}
diff --git a/app/code/Magento/StoreGraphQl/Model/Resolver/Store/StoreConfigDataProvider.php b/app/code/Magento/StoreGraphQl/Model/Resolver/Store/StoreConfigDataProvider.php
index 8c2d6c36591d5..59f9831789a35 100644
--- a/app/code/Magento/StoreGraphQl/Model/Resolver/Store/StoreConfigDataProvider.php
+++ b/app/code/Magento/StoreGraphQl/Model/Resolver/Store/StoreConfigDataProvider.php
@@ -10,7 +10,7 @@
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Api\StoreConfigManagerInterface;
use Magento\Store\Model\ScopeInterface;
-use Magento\Store\Model\StoreManagerInterface;
+use Magento\Store\Api\Data\StoreInterface;
/**
* StoreConfig field data provider, used for GraphQL request processing.
@@ -22,11 +22,6 @@ class StoreConfigDataProvider
*/
private $storeConfigManager;
- /**
- * @var StoreManagerInterface
- */
- private $storeManager;
-
/**
* @var ScopeConfigInterface
*/
@@ -39,18 +34,15 @@ class StoreConfigDataProvider
/**
* @param StoreConfigManagerInterface $storeConfigManager
- * @param StoreManagerInterface $storeManager
* @param ScopeConfigInterface $scopeConfig
* @param array $extendedConfigData
*/
public function __construct(
StoreConfigManagerInterface $storeConfigManager,
- StoreManagerInterface $storeManager,
ScopeConfigInterface $scopeConfig,
array $extendedConfigData = []
) {
$this->storeConfigManager = $storeConfigManager;
- $this->storeManager = $storeManager;
$this->scopeConfig = $scopeConfig;
$this->extendedConfigData = $extendedConfigData;
}
@@ -58,13 +50,14 @@ public function __construct(
/**
* Get store config data
*
+ * @param StoreInterface $store
* @return array
*/
- public function getStoreConfigData(): array
+ public function getStoreConfigData(StoreInterface $store): array
{
$storeConfigData = array_merge(
- $this->getBaseConfigData(),
- $this->getExtendedConfigData()
+ $this->getBaseConfigData($store),
+ $this->getExtendedConfigData((int)$store->getId())
);
return $storeConfigData;
}
@@ -72,11 +65,11 @@ public function getStoreConfigData(): array
/**
* Get base config data
*
+ * @param StoreInterface $store
* @return array
*/
- private function getBaseConfigData() : array
+ private function getBaseConfigData(StoreInterface $store) : array
{
- $store = $this->storeManager->getStore();
$storeConfig = current($this->storeConfigManager->getStoreConfigs([$store->getCode()]));
$storeConfigData = [
@@ -103,17 +96,17 @@ private function getBaseConfigData() : array
/**
* Get extended config data
*
+ * @param int $storeId
* @return array
*/
- private function getExtendedConfigData()
+ private function getExtendedConfigData(int $storeId)
{
- $store = $this->storeManager->getStore();
$extendedConfigData = [];
foreach ($this->extendedConfigData as $key => $path) {
$extendedConfigData[$key] = $this->scopeConfig->getValue(
$path,
ScopeInterface::SCOPE_STORE,
- $store->getId()
+ $storeId
);
}
return $extendedConfigData;
diff --git a/app/code/Magento/StoreGraphQl/Model/Resolver/StoreConfigResolver.php b/app/code/Magento/StoreGraphQl/Model/Resolver/StoreConfigResolver.php
index 9c426172de85d..d93790298c1b4 100644
--- a/app/code/Magento/StoreGraphQl/Model/Resolver/StoreConfigResolver.php
+++ b/app/code/Magento/StoreGraphQl/Model/Resolver/StoreConfigResolver.php
@@ -41,6 +41,6 @@ public function resolve(
array $value = null,
array $args = null
) {
- return $this->storeConfigDataProvider->getStoreConfigData();
+ return $this->storeConfigDataProvider->getStoreConfigData($context->getExtensionAttributes()->getStore());
}
}
diff --git a/app/code/Magento/StoreGraphQl/etc/extension_attributes.xml b/app/code/Magento/StoreGraphQl/etc/extension_attributes.xml
new file mode 100644
index 0000000000000..d1f2638df10b3
--- /dev/null
+++ b/app/code/Magento/StoreGraphQl/etc/extension_attributes.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
diff --git a/app/code/Magento/StoreGraphQl/etc/graphql/di.xml b/app/code/Magento/StoreGraphQl/etc/graphql/di.xml
index c2191164287f1..3a0143821d8b9 100644
--- a/app/code/Magento/StoreGraphQl/etc/graphql/di.xml
+++ b/app/code/Magento/StoreGraphQl/etc/graphql/di.xml
@@ -16,4 +16,11 @@
+
+
+
+ - Magento\StoreGraphQl\Model\Context\AddStoreInfoToContext
+
+
+
diff --git a/app/code/Magento/UrlRewriteGraphQl/Model/Resolver/EntityUrl.php b/app/code/Magento/UrlRewriteGraphQl/Model/Resolver/EntityUrl.php
index 6e6c915959a16..0acece9271f7c 100644
--- a/app/code/Magento/UrlRewriteGraphQl/Model/Resolver/EntityUrl.php
+++ b/app/code/Magento/UrlRewriteGraphQl/Model/Resolver/EntityUrl.php
@@ -12,8 +12,8 @@
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
-use Magento\Store\Model\StoreManagerInterface;
use Magento\UrlRewrite\Model\UrlFinderInterface;
+use Magento\UrlRewrite\Service\V1\Data\UrlRewrite;
use Magento\UrlRewriteGraphQl\Model\Resolver\UrlRewrite\CustomUrlLocatorInterface;
/**
@@ -26,11 +26,6 @@ class EntityUrl implements ResolverInterface
*/
private $urlFinder;
- /**
- * @var StoreManagerInterface
- */
- private $storeManager;
-
/**
* @var CustomUrlLocatorInterface
*/
@@ -38,16 +33,13 @@ class EntityUrl implements ResolverInterface
/**
* @param UrlFinderInterface $urlFinder
- * @param StoreManagerInterface $storeManager
* @param CustomUrlLocatorInterface $customUrlLocator
*/
public function __construct(
UrlFinderInterface $urlFinder,
- StoreManagerInterface $storeManager,
CustomUrlLocatorInterface $customUrlLocator
) {
$this->urlFinder = $urlFinder;
- $this->storeManager = $storeManager;
$this->customUrlLocator = $customUrlLocator;
}
@@ -72,7 +64,7 @@ public function resolve(
}
$customUrl = $this->customUrlLocator->locateUrl($url);
$url = $customUrl ?: $url;
- $urlRewrite = $this->findCanonicalUrl($url);
+ $urlRewrite = $this->findCanonicalUrl($url, (int)$context->getExtensionAttributes()->getStore()->getId());
if ($urlRewrite) {
if (!$urlRewrite->getEntityId()) {
throw new GraphQlNoSuchEntityException(
@@ -93,21 +85,22 @@ public function resolve(
* Find the canonical url passing through all redirects if any
*
* @param string $requestPath
- * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite|null
+ * @param int $storeId
+ * @return UrlRewrite|null
*/
- private function findCanonicalUrl(string $requestPath) : ?\Magento\UrlRewrite\Service\V1\Data\UrlRewrite
+ private function findCanonicalUrl(string $requestPath, int $storeId) : ?UrlRewrite
{
- $urlRewrite = $this->findUrlFromRequestPath($requestPath);
+ $urlRewrite = $this->findUrlFromRequestPath($requestPath, $storeId);
if ($urlRewrite && $urlRewrite->getRedirectType() > 0) {
while ($urlRewrite && $urlRewrite->getRedirectType() > 0) {
- $urlRewrite = $this->findUrlFromRequestPath($urlRewrite->getTargetPath());
+ $urlRewrite = $this->findUrlFromRequestPath($urlRewrite->getTargetPath(), $storeId);
}
}
if (!$urlRewrite) {
- $urlRewrite = $this->findUrlFromTargetPath($requestPath);
+ $urlRewrite = $this->findUrlFromTargetPath($requestPath, $storeId);
}
if ($urlRewrite && !$urlRewrite->getEntityId() && !$urlRewrite->getIsAutogenerated()) {
- $urlRewrite = $this->findUrlFromTargetPath($urlRewrite->getTargetPath());
+ $urlRewrite = $this->findUrlFromTargetPath($urlRewrite->getTargetPath(), $storeId);
}
return $urlRewrite;
@@ -117,14 +110,15 @@ private function findCanonicalUrl(string $requestPath) : ?\Magento\UrlRewrite\Se
* Find a url from a request url on the current store
*
* @param string $requestPath
- * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite|null
+ * @param int $storeId
+ * @return UrlRewrite|null
*/
- private function findUrlFromRequestPath(string $requestPath) : ?\Magento\UrlRewrite\Service\V1\Data\UrlRewrite
+ private function findUrlFromRequestPath(string $requestPath, int $storeId) : ?UrlRewrite
{
return $this->urlFinder->findOneByData(
[
'request_path' => $requestPath,
- 'store_id' => $this->storeManager->getStore()->getId()
+ 'store_id' => $storeId
]
);
}
@@ -133,14 +127,15 @@ private function findUrlFromRequestPath(string $requestPath) : ?\Magento\UrlRewr
* Find a url from a target url on the current store
*
* @param string $targetPath
- * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite|null
+ * @param int $storeId
+ * @return UrlRewrite|null
*/
- private function findUrlFromTargetPath(string $targetPath) : ?\Magento\UrlRewrite\Service\V1\Data\UrlRewrite
+ private function findUrlFromTargetPath(string $targetPath, int $storeId) : ?UrlRewrite
{
return $this->urlFinder->findOneByData(
[
'target_path' => $targetPath,
- 'store_id' => $this->storeManager->getStore()->getId()
+ 'store_id' => $storeId
]
);
}
diff --git a/app/code/Magento/UrlRewriteGraphQl/composer.json b/app/code/Magento/UrlRewriteGraphQl/composer.json
index 1c99276269aa7..e063903a5170f 100644
--- a/app/code/Magento/UrlRewriteGraphQl/composer.json
+++ b/app/code/Magento/UrlRewriteGraphQl/composer.json
@@ -5,8 +5,7 @@
"require": {
"php": "~7.1.3||~7.2.0",
"magento/framework": "*",
- "magento/module-url-rewrite": "*",
- "magento/module-store": "*"
+ "magento/module-url-rewrite": "*"
},
"suggest": {
"magento/module-graph-ql": "*"
diff --git a/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/Gateway/Http/MockClient.php b/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/Gateway/Http/MockClient.php
new file mode 100644
index 0000000000000..3c82d4eba740f
--- /dev/null
+++ b/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/Gateway/Http/MockClient.php
@@ -0,0 +1,135 @@
+random = $random;
+ $this->arrayManager = $arrayManager;
+ }
+
+ /**
+ * Places request to gateway. Returns result as ENV array
+ *
+ * @param TransferInterface $transferObject
+ * @return array
+ */
+ public function placeRequest(TransferInterface $transferObject): array
+ {
+ $request = $transferObject->getBody();
+ $nonce = $this->arrayManager->get('transactionRequest/payment/opaqueData/dataValue', $request);
+ $descriptor = $this->arrayManager->get('transactionRequest/payment/opaqueData/dataDescriptor', $request);
+
+ $approve = true;
+ if ($nonce !== 'fake-nonce' || $descriptor !== 'COMMON.ACCEPT.INAPP.PAYMENT') {
+ $approve = false;
+ }
+
+ return $this->createResponse($approve);
+ }
+
+ /**
+ * Create mock response body
+ *
+ * @param bool $approve
+ * @return array
+ * @throws \Magento\Framework\Exception\LocalizedException
+ */
+ private function createResponse(bool $approve): array
+ {
+ return [
+ 'transactionResponse' => [
+ 'responseCode' => $approve ? '1' : '2',
+ 'authCode' => strtoupper($this->random->getRandomString(6)),
+ 'avsResultCode' => 'Y',
+ 'cvvResultCode' => 'P',
+ 'cavvResultCode' => '2',
+ 'transId' => random_int(10000000000, 99999999999),
+ 'refTransId' => '',
+ 'transHash' => '',
+ 'testRequest' => '0',
+ 'accountNumber' => 'XXXX1111',
+ 'accountType' => 'Visa',
+ 'messages' => $approve ? $this->getApprovalMessage() : $this->getDeclineMessage(),
+ 'userFields' => [
+ [
+ 'name' => 'transactionType',
+ 'value' => 'authOnlyTransaction',
+ ],
+ ],
+ 'transHashSha2' => 'fake-hash',
+ 'SupplementalDataQualificationIndicator' => '0',
+ ],
+ 'messages' => [
+ 'resultCode' => 'Ok',
+ 'message' => [
+ [
+ 'code' => 'I00001',
+ 'text' => 'Successful.',
+ ],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Provide approval message for response
+ *
+ * @return array
+ */
+ private function getApprovalMessage(): array
+ {
+ return [
+ [
+ 'code' => '1',
+ 'description' => 'This transaction has been approved.',
+ ],
+ ];
+ }
+
+ /**
+ * Provide decline message for response
+ *
+ * @return array
+ */
+ private function getDeclineMessage(): array
+ {
+ return [
+ [
+ 'code' => '2',
+ 'description' => 'This transaction has been declined.',
+ ],
+ ];
+ }
+}
diff --git a/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/Gateway/Validator/TransactionHashValidator.php b/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/Gateway/Validator/TransactionHashValidator.php
new file mode 100644
index 0000000000000..b0e281e9faa5c
--- /dev/null
+++ b/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/Gateway/Validator/TransactionHashValidator.php
@@ -0,0 +1,29 @@
+createResult(true);
+ }
+}
diff --git a/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/etc/di.xml b/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/etc/di.xml
new file mode 100644
index 0000000000000..9f19743cfc205
--- /dev/null
+++ b/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/etc/di.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/etc/module.xml b/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/etc/module.xml
new file mode 100644
index 0000000000000..378b61946ef3a
--- /dev/null
+++ b/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/etc/module.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/registration.php b/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/registration.php
new file mode 100644
index 0000000000000..42ac558174062
--- /dev/null
+++ b/dev/tests/api-functional/_files/Magento/TestModuleAuthorizenetAcceptjs/registration.php
@@ -0,0 +1,12 @@
+getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleAuthorizenetAcceptjs') === null) {
+ ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleAuthorizenetAcceptjs', __DIR__);
+}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/Customer/SetPaymentMethodTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/Customer/SetPaymentMethodTest.php
new file mode 100644
index 0000000000000..385598e49462b
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/Customer/SetPaymentMethodTest.php
@@ -0,0 +1,211 @@
+getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
+ $this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
+ $this->orderCollectionFactory = $objectManager->get(CollectionFactory::class);
+ $this->orderRepository = $objectManager->get(OrderRepositoryInterface::class);
+ $this->registry = Bootstrap::getObjectManager()->get(Registry::class);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_shipping_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_new_billing_address.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_flatrate_shipping_method.php
+ * @magentoApiDataFixture Magento/GraphQl/AuthorizenetAcceptjs/_files/enable_authorizenetacceptjs.php
+ * @param string $nonce
+ * @param string $descriptor
+ * @param bool $expectSuccess
+ * @dataProvider dataProviderTestPlaceOrder
+ */
+ public function testPlaceOrder(string $nonce, string $descriptor, bool $expectSuccess)
+ {
+ $reservedOrderId = 'test_quote';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($reservedOrderId);
+
+ $setPaymentMutation = $this->getSetPaymentMutation($maskedQuoteId, $descriptor, $nonce);
+ $setPaymentResponse = $this->graphQlMutation($setPaymentMutation, [], '', $this->getHeaderMap());
+
+ $this->assertSetPaymentMethodResponse($setPaymentResponse, 'authorizenet_acceptjs');
+
+ $placeOrderQuery = $this->getPlaceOrderMutation($maskedQuoteId);
+
+ if (!$expectSuccess) {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('Transaction has been declined. Please try again later.');
+ }
+
+ $placeOrderResponse = $this->graphQlMutation($placeOrderQuery, [], '', $this->getHeaderMap());
+
+ $this->assertPlaceOrderResponse($placeOrderResponse, $reservedOrderId);
+ }
+
+ public function dataProviderTestPlaceOrder(): array
+ {
+ return [
+ [static::VALID_NONCE, static::VALID_DESCRIPTOR, true],
+ ['nonce', static::VALID_DESCRIPTOR, false],
+ [static::VALID_NONCE, 'descriptor', false],
+ ];
+ }
+
+ private function assertPlaceOrderResponse(array $response, string $reservedOrderId): void
+ {
+ self::assertArrayHasKey('placeOrder', $response);
+ self::assertArrayHasKey('order', $response['placeOrder']);
+ self::assertArrayHasKey('order_id', $response['placeOrder']['order']);
+ self::assertEquals($reservedOrderId, $response['placeOrder']['order']['order_id']);
+ }
+
+ private function assertSetPaymentMethodResponse(array $response, string $methodCode): void
+ {
+ self::assertArrayHasKey('setPaymentMethodOnCart', $response);
+ self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']);
+ self::assertArrayHasKey('selected_payment_method', $response['setPaymentMethodOnCart']['cart']);
+ self::assertArrayHasKey('code', $response['setPaymentMethodOnCart']['cart']['selected_payment_method']);
+ self::assertEquals($methodCode, $response['setPaymentMethodOnCart']['cart']['selected_payment_method']['code']);
+ }
+
+ /**
+ * Create setPaymentMethodOnCart mutation
+ *
+ * @param string $maskedQuoteId
+ * @param string $descriptor
+ * @param string $nonce
+ * @return string
+ */
+ private function getSetPaymentMutation(string $maskedQuoteId, string $descriptor, string $nonce): string
+ {
+ return <<customerTokenService->createCustomerAccessToken($username, $password);
+ $headerMap = ['Authorization' => 'Bearer ' . $customerToken];
+ return $headerMap;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function tearDown()
+ {
+ $this->registry->unregister('isSecureArea');
+ $this->registry->register('isSecureArea', true);
+
+ $orderCollection = $this->orderCollectionFactory->create();
+ foreach ($orderCollection as $order) {
+ $this->orderRepository->delete($order);
+ }
+ $this->registry->unregister('isSecureArea');
+ $this->registry->register('isSecureArea', false);
+
+ parent::tearDown();
+ }
+}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/Guest/SetPaymentMethodTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/Guest/SetPaymentMethodTest.php
new file mode 100644
index 0000000000000..de5ba83d1e14b
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/Guest/SetPaymentMethodTest.php
@@ -0,0 +1,196 @@
+getMaskedQuoteIdByReservedOrderId = $objectManager->get(GetMaskedQuoteIdByReservedOrderId::class);
+ $this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
+ $this->orderCollectionFactory = $objectManager->get(CollectionFactory::class);
+ $this->orderRepository = $objectManager->get(OrderRepositoryInterface::class);
+ $this->registry = Bootstrap::getObjectManager()->get(Registry::class);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/enable_offline_shipping_methods.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/set_guest_email.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_new_billing_address.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_flatrate_shipping_method.php
+ * @magentoApiDataFixture Magento/GraphQl/AuthorizenetAcceptjs/_files/enable_authorizenetacceptjs.php
+ * @param string $nonce
+ * @param string $descriptor
+ * @param bool $expectSuccess
+ * @dataProvider dataProviderTestPlaceOrder
+ */
+ public function testPlaceOrder(string $nonce, string $descriptor, bool $expectSuccess)
+ {
+ $reservedOrderId = 'test_quote';
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute($reservedOrderId);
+
+ $setPaymentMutation = $this->getSetPaymentMutation($maskedQuoteId, $descriptor, $nonce);
+ $setPaymentResponse = $this->graphQlMutation($setPaymentMutation);
+
+ $this->assertSetPaymentMethodResponse($setPaymentResponse, 'authorizenet_acceptjs');
+
+ $placeOrderQuery = $this->getPlaceOrderMutation($maskedQuoteId);
+
+ if (!$expectSuccess) {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('Transaction has been declined. Please try again later.');
+ }
+
+ $placeOrderResponse = $this->graphQlMutation($placeOrderQuery);
+
+ $this->assertPlaceOrderResponse($placeOrderResponse, $reservedOrderId);
+ }
+
+ public function dataProviderTestPlaceOrder(): array
+ {
+ return [
+ [static::VALID_NONCE, static::VALID_DESCRIPTOR, true],
+ ['nonce', static::VALID_DESCRIPTOR, false],
+ [static::VALID_NONCE, 'descriptor', false],
+ ];
+ }
+
+ private function assertPlaceOrderResponse(array $response, string $reservedOrderId): void
+ {
+ self::assertArrayHasKey('placeOrder', $response);
+ self::assertArrayHasKey('order', $response['placeOrder']);
+ self::assertArrayHasKey('order_id', $response['placeOrder']['order']);
+ self::assertEquals($reservedOrderId, $response['placeOrder']['order']['order_id']);
+ }
+
+ private function assertSetPaymentMethodResponse(array $response, string $methodCode): void
+ {
+ self::assertArrayHasKey('setPaymentMethodOnCart', $response);
+ self::assertArrayHasKey('cart', $response['setPaymentMethodOnCart']);
+ self::assertArrayHasKey('selected_payment_method', $response['setPaymentMethodOnCart']['cart']);
+ self::assertArrayHasKey('code', $response['setPaymentMethodOnCart']['cart']['selected_payment_method']);
+ self::assertEquals($methodCode, $response['setPaymentMethodOnCart']['cart']['selected_payment_method']['code']);
+ }
+
+ /**
+ * Create setPaymentMethodOnCart mutation
+ *
+ * @param string $maskedQuoteId
+ * @param string $descriptor
+ * @param string $nonce
+ * @return string
+ */
+ private function getSetPaymentMutation(string $maskedQuoteId, string $descriptor, string $nonce): string
+ {
+ return <<registry->unregister('isSecureArea');
+ $this->registry->register('isSecureArea', true);
+
+ $orderCollection = $this->orderCollectionFactory->create();
+ foreach ($orderCollection as $order) {
+ $this->orderRepository->delete($order);
+ }
+ $this->registry->unregister('isSecureArea');
+ $this->registry->register('isSecureArea', false);
+
+ parent::tearDown();
+ }
+}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CartTotalsTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CartTotalsTest.php
old mode 100644
new mode 100755
index bb8acfce629ff..f449f6db3c39b
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CartTotalsTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/CartTotalsTest.php
@@ -64,6 +64,33 @@ public function testGetCartTotalsWithTaxApplied()
self::assertEquals('USD', $appliedTaxesResponse[0]['amount']['currency']);
}
+ /**
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ * @magentoApiDataFixture Magento/GraphQl/Tax/_files/tax_rule_for_region_1.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/apply_tax_for_simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php
+ */
+ public function testGetCartTotalsWithEmptyCart()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId);
+ $response = $this->graphQlQuery($query, [], '', $this->getHeaderMap());
+
+ self::assertArrayHasKey('prices', $response['cart']);
+ $pricesResponse = $response['cart']['prices'];
+ self::assertEquals(0, $pricesResponse['grand_total']['value']);
+ self::assertEquals(0, $pricesResponse['subtotal_including_tax']['value']);
+ self::assertEquals(0, $pricesResponse['subtotal_excluding_tax']['value']);
+ self::assertEquals(0, $pricesResponse['subtotal_with_discount_excluding_tax']['value']);
+
+ $appliedTaxesResponse = $pricesResponse['applied_taxes'];
+
+ self::assertCount(0, $appliedTaxesResponse);
+ }
+
/**
* @magentoApiDataFixture Magento/Customer/_files/customer.php
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CartTotalsTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CartTotalsTest.php
old mode 100644
new mode 100755
index 7eb09cf301bf4..3334a98e8feb9
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CartTotalsTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/CartTotalsTest.php
@@ -59,6 +59,32 @@ public function testGetCartTotalsWithTaxApplied()
self::assertEquals('USD', $appliedTaxesResponse[0]['amount']['currency']);
}
+ /**
+ * @magentoApiDataFixture Magento/GraphQl/Tax/_files/tax_rule_for_region_1.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/apply_tax_for_simple_product.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_shipping_address.php
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/set_new_billing_address.php
+ */
+ public function testGetCartTotalsWithEmptyCart()
+ {
+ $maskedQuoteId = $this->getMaskedQuoteIdByReservedOrderId->execute('test_quote');
+ $query = $this->getQuery($maskedQuoteId);
+ $response = $this->graphQlQuery($query);
+
+ self::assertArrayHasKey('prices', $response['cart']);
+ $pricesResponse = $response['cart']['prices'];
+ self::assertEquals(0, $pricesResponse['grand_total']['value']);
+ self::assertEquals(0, $pricesResponse['subtotal_including_tax']['value']);
+ self::assertEquals(0, $pricesResponse['subtotal_excluding_tax']['value']);
+ self::assertEquals(0, $pricesResponse['subtotal_with_discount_excluding_tax']['value']);
+
+ $appliedTaxesResponse = $pricesResponse['applied_taxes'];
+
+ self::assertCount(0, $appliedTaxesResponse);
+ }
+
/**
* @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
* @magentoApiDataFixture Magento/GraphQl/Quote/_files/guest/create_empty_cart.php
diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php
index 90ec6686c5a3c..794e589002e73 100644
--- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php
+++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/PlaceOrderWithAuthorizeNetTest.php
@@ -94,11 +94,10 @@ public function testDispatchToPlaceOrderWithRegisteredCustomer(): void
cart_id: "$cartId"
payment_method: {
code: "$paymentMethod"
- additional_data:
- {authorizenet_acceptjs:
+ authorizenet_acceptjs:
{opaque_data_descriptor: "mydescriptor",
opaque_data_value: "myvalue",
- cc_last_4: 1111}}
+ cc_last_4: 1111}
}
}) {
cart {
diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php
index e304216bc4a77..b82469c61d288 100644
--- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php
+++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Customer/SetAuthorizeNetPaymentMethodOnCartTest.php
@@ -69,11 +69,10 @@ public function testDispatchToSetPaymentMethodWithAuthorizenet(): void
cart_id: "$maskedQuoteId"
payment_method: {
code: "$methodCode"
- additional_data:
- {authorizenet_acceptjs:
+ authorizenet_acceptjs:
{opaque_data_descriptor: "COMMON.ACCEPT.INAPP.PAYMENT",
opaque_data_value: "abx",
- cc_last_4: 1111}}
+ cc_last_4: 1111}
}
}) {
cart {
diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php
index 383abf81a111a..070543a0880e8 100644
--- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php
+++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/PlaceOrderWithAuthorizeNetTest.php
@@ -94,11 +94,10 @@ public function testDispatchToPlaceAnOrderWithAuthorizenet(): void
cart_id: "$cartId"
payment_method: {
code: "$paymentMethod"
- additional_data:
- {authorizenet_acceptjs:
+ authorizenet_acceptjs:
{opaque_data_descriptor: "mydescriptor",
opaque_data_value: "myvalue",
- cc_last_4: 1111}}
+ cc_last_4: 1111}
}
}) {
cart {
diff --git a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php
index fef20df4ee931..ff526a491b5d7 100644
--- a/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php
+++ b/dev/tests/integration/testsuite/Magento/AuthorizenetGraphQl/Model/Resolver/Guest/SetAuthorizeNetPaymentMethodOnCartTest.php
@@ -64,11 +64,10 @@ public function testDispatchToSetPaymentMethodWithAuthorizenet(): void
cart_id: "$maskedQuoteId"
payment_method: {
code: "$methodCode"
- additional_data:
- {authorizenet_acceptjs:
+ authorizenet_acceptjs:
{opaque_data_descriptor: "COMMON.ACCEPT.INAPP.PAYMENT",
opaque_data_value: "abx",
- cc_last_4: 1111}}
+ cc_last_4: 1111}
}
}) {
cart {
diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/_files/enable_authorizenetacceptjs.php b/dev/tests/integration/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/_files/enable_authorizenetacceptjs.php
new file mode 100644
index 0000000000000..3043a5eaf2ae1
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/_files/enable_authorizenetacceptjs.php
@@ -0,0 +1,32 @@
+get(EncryptorInterface::class);
+
+/** @var Writer $configWriter */
+$configWriter = $objectManager->get(WriterInterface::class);
+$configWriter->save('payment/' . Config::METHOD . '/active', '1');
+$configWriter->save('payment/' . Config::METHOD . '/environment', 'sandbox');
+$configWriter->save('payment/' . Config::METHOD . '/login', $encryptor->encrypt('def_login'));
+$configWriter->save('payment/' . Config::METHOD . '/trans_key', $encryptor->encrypt('def_trans_key'));
+$configWriter->save('payment/' . Config::METHOD . '/public_client_key', $encryptor->encrypt('def_public_client_key'));
+$configWriter->save(
+ 'payment/' . Config::METHOD . '/trans_signature_key',
+ $encryptor->encrypt('def_trans_signature_key')
+);
+
+$scopeConfig = $objectManager->get(ScopeConfigInterface::class);
+$scopeConfig->clean();
diff --git a/dev/tests/integration/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/_files/enable_authorizenetacceptjs_rollback.php b/dev/tests/integration/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/_files/enable_authorizenetacceptjs_rollback.php
new file mode 100644
index 0000000000000..b73883f80f333
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/GraphQl/AuthorizenetAcceptjs/_files/enable_authorizenetacceptjs_rollback.php
@@ -0,0 +1,26 @@
+get(WriterInterface::class);
+$configWriter->delete('payment/' . Config::METHOD . '/active');
+$configWriter->delete('payment/' . Config::METHOD . '/environment');
+$configWriter->delete('payment/' . Config::METHOD . '/login');
+$configWriter->delete('payment/' . Config::METHOD . '/trans_key');
+$configWriter->delete('payment/' . Config::METHOD . '/public_client_key');
+$configWriter->delete('payment/' . Config::METHOD . '/trans_signature_key');
+
+$scopeConfig = $objectManager->get(ScopeConfigInterface::class);
+$scopeConfig->clean();
diff --git a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PaypalExpressSetPaymentMethodTest.php b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PaypalExpressSetPaymentMethodTest.php
index f367c0242fdb0..b194bdbde307c 100644
--- a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PaypalExpressSetPaymentMethodTest.php
+++ b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PaypalExpressSetPaymentMethodTest.php
@@ -98,7 +98,6 @@ public function testResolve(string $paymentMethod): void
setPaymentMethodOnCart(input: {
payment_method: {
code: "{$paymentMethod}",
- additional_data: {
paypal_express: {
payer_id: "$payerId",
token: "$token"
@@ -107,7 +106,6 @@ public function testResolve(string $paymentMethod): void
payer_id: "$payerId",
token: "$token"
}
- }
},
cart_id: "{$maskedCartId}"})
{
diff --git a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PlaceOrderWithPayflowLinkTest.php b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PlaceOrderWithPayflowLinkTest.php
index b5d2aeb0803a5..96d80dfc28053 100644
--- a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PlaceOrderWithPayflowLinkTest.php
+++ b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PlaceOrderWithPayflowLinkTest.php
@@ -124,13 +124,11 @@ public function testResolvePlaceOrderWithPayflowLinkForCustomer(): void
cart_id: "$cartId"
payment_method: {
code: "$paymentMethod"
- additional_data: {
payflow_link:
{
cancel_url:"{$baseUrl}paypal/payflow/cancelPayment"
return_url:"{$baseUrl}paypal/payflow/returnUrl"
}
- }
}
}) {
cart {
diff --git a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PlaceOrderWithPayflowProTest.php b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PlaceOrderWithPayflowProTest.php
index 444588195e0ae..b8efe7c0319b5 100644
--- a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PlaceOrderWithPayflowProTest.php
+++ b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Customer/PlaceOrderWithPayflowProTest.php
@@ -80,7 +80,6 @@ public function testResolveCustomer(): void
setPaymentMethodOnCart(input: {
payment_method: {
code: "{$paymentMethod}",
- additional_data: {
payflowpro: {
cc_details: {
cc_exp_month: 12,
@@ -88,7 +87,6 @@ public function testResolveCustomer(): void
cc_last_4: 1111,
cc_type: "IV",
}
- }
}
},
cart_id: "{$cartId}"})
diff --git a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PaypalExpressSetPaymentMethodTest.php b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PaypalExpressSetPaymentMethodTest.php
index 0b8b18d88e00e..e5e1955bbf81b 100644
--- a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PaypalExpressSetPaymentMethodTest.php
+++ b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PaypalExpressSetPaymentMethodTest.php
@@ -96,7 +96,6 @@ public function testResolveGuest(string $paymentMethod): void
setPaymentMethodOnCart(input: {
payment_method: {
code: "{$paymentMethod}",
- additional_data: {
paypal_express: {
payer_id: "$payerId",
token: "$token"
@@ -105,7 +104,6 @@ public function testResolveGuest(string $paymentMethod): void
payer_id: "$payerId",
token: "$token"
}
- }
},
cart_id: "{$cartId}"})
{
diff --git a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PaypalPayflowProSetPaymentMethodTest.php b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PaypalPayflowProSetPaymentMethodTest.php
index 8121facaf0f55..1ef054fbdaac9 100644
--- a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PaypalPayflowProSetPaymentMethodTest.php
+++ b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PaypalPayflowProSetPaymentMethodTest.php
@@ -80,7 +80,6 @@ public function testResolveGuest(): void
setPaymentMethodOnCart(input: {
payment_method: {
code: "{$paymentMethod}",
- additional_data: {
payflowpro: {
cc_details: {
cc_exp_month: 12,
@@ -88,7 +87,6 @@ public function testResolveGuest(): void
cc_last_4: 1111,
cc_type: "IV",
}
- }
}
},
cart_id: "{$cartId}"})
diff --git a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PlaceOrderWithPayflowLinkTest.php b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PlaceOrderWithPayflowLinkTest.php
index 789d4b34c8ced..7ad0659839bc7 100644
--- a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PlaceOrderWithPayflowLinkTest.php
+++ b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/PlaceOrderWithPayflowLinkTest.php
@@ -117,14 +117,12 @@ public function testResolvePlaceOrderWithPayflowLink(): void
cart_id: "$cartId"
payment_method: {
code: "$paymentMethod"
- additional_data: {
payflow_link:
{
cancel_url:"http://mage.test/paypal/payflow/cancel"
return_url:"http://mage.test/paypal/payflow/return"
error_url:"http://mage.test/paypal/payflow/error"
}
- }
}
}) {
cart {
@@ -221,14 +219,12 @@ public function testResolveWithPayflowLinkDeclined(): void
cart_id: "$cartId"
payment_method: {
code: "$paymentMethod"
- additional_data: {
payflow_link:
{
cancel_url:"http://mage.test/paypal/payflow/cancelPayment"
return_url:"http://mage.test/paypal/payflow/returnUrl"
error_url:"http://mage.test/paypal/payflow/returnUrl"
}
- }
}
}) {
cart {
diff --git a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/SetPaymentMethodAsPayflowLinkTest.php b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/SetPaymentMethodAsPayflowLinkTest.php
index 91e5b06e56e01..a4b61ed11d784 100644
--- a/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/SetPaymentMethodAsPayflowLinkTest.php
+++ b/dev/tests/integration/testsuite/Magento/PaypalGraphQl/Model/Resolver/Guest/SetPaymentMethodAsPayflowLinkTest.php
@@ -71,13 +71,11 @@ public function testSetPayflowLinkAsPaymentMethod(): void
cart_id: "$maskedCartId"
payment_method: {
code: "$paymentMethod"
- additional_data: {
payflow_link: {
return_url:"http://magento.com/paypal/payflow/link/success"
cancel_url:"http://magento.com/paypal/payflow/link/cancel"
error_url:"http://magento.com/paypal/payflow/link/error"
}
- }
}
}) {
cart {
@@ -147,13 +145,11 @@ public function testInvalidUrl(): void
cart_id: "$cartId"
payment_method: {
code: "$paymentMethod"
- additional_data: {
payflow_link: {
return_url:"http://magento.com/paypal/payflow/link/sucess"
cancel_url:"http://magento.com/paypal/payflow/link/cancel"
error_url:"/not/a/validUrl"
}
- }
}
}) {
cart {