Skip to content

Commit 965689d

Browse files
committed
MAGETWO-91678: Minimum Order amount required in Admin orders
1 parent 8278e9b commit 965689d

12 files changed

+37
-12
lines changed

app/code/Magento/Quote/Model/ValidationRules/AllowedCountryValidationRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use Magento\Framework\Validation\ValidationResultFactory;
1212
use Magento\Quote\Model\Quote;
1313

14+
/**
15+
* @inheritdoc
16+
*/
1417
class AllowedCountryValidationRule implements QuoteValidationRuleInterface
1518
{
1619
/**
@@ -57,7 +60,7 @@ public function validate(Quote $quote): array
5760
$this->allowedCountryReader->getAllowedCountries()
5861
);
5962
if (!$validationResult) {
60-
$validationErrors = [$this->generalMessage];
63+
$validationErrors = [__($this->generalMessage)];
6164
}
6265
}
6366

app/code/Magento/Quote/Model/ValidationRules/BillingAddressValidationRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Framework\Validation\ValidationResultFactory;
1111
use Magento\Quote\Model\Quote;
1212

13+
/**
14+
* @inheritdoc
15+
*/
1316
class BillingAddressValidationRule implements QuoteValidationRuleInterface
1417
{
1518
/**
@@ -42,7 +45,7 @@ public function validate(Quote $quote): array
4245
$validationErrors = [];
4346
$validationResult = $quote->getBillingAddress()->validate();
4447
if ($validationResult !== true) {
45-
$validationErrors = [$this->generalMessage];
48+
$validationErrors = [__($this->generalMessage)];
4649
}
4750
if (is_array($validationResult)) {
4851
$validationErrors = array_merge($validationErrors, $validationResult);

app/code/Magento/Quote/Model/ValidationRules/MinimumAmountValidationRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
use Magento\Quote\Model\Quote;
1212
use Magento\Quote\Model\Quote\Validator\MinimumOrderAmount\ValidationMessage;
1313

14+
/**
15+
* @inheritdoc
16+
*/
1417
class MinimumAmountValidationRule implements QuoteValidationRuleInterface
1518
{
1619
/**
@@ -55,7 +58,7 @@ public function validate(Quote $quote): array
5558
if (!$this->generalMessage) {
5659
$this->generalMessage = $this->amountValidationMessage->getMessage();
5760
}
58-
$validationErrors = [$this->generalMessage];
61+
$validationErrors = [__($this->generalMessage)];
5962
}
6063

6164
return [$this->validationResultFactory->create(['errors' => $validationErrors])];

app/code/Magento/Quote/Model/ValidationRules/PaymentMethodValidationRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Framework\Validation\ValidationResultFactory;
1111
use Magento\Quote\Model\Quote;
1212

13+
/**
14+
* @inheritdoc
15+
*/
1316
class PaymentMethodValidationRule implements QuoteValidationRuleInterface
1417
{
1518
/**
@@ -42,7 +45,7 @@ public function validate(Quote $quote): array
4245
$validationErrors = [];
4346
$validationResult = $quote->getPayment()->getMethod();
4447
if (!$validationResult) {
45-
$validationErrors = [$this->generalMessage];
48+
$validationErrors = [__($this->generalMessage)];
4649
}
4750

4851
return [$this->validationResultFactory->create(['errors' => $validationErrors])];

app/code/Magento/Quote/Model/ValidationRules/QuoteValidationComposite.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
use Magento\Quote\Model\Quote;
1111

12+
/**
13+
* @inheritdoc
14+
*/
1215
class QuoteValidationComposite implements QuoteValidationRuleInterface
1316
{
1417
/**

app/code/Magento/Quote/Model/ValidationRules/QuoteValidationRuleInterface.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
use Magento\Framework\Validation\ValidationResult;
1010
use Magento\Quote\Model\Quote;
1111

12+
/**
13+
* Provides validation of Quote model.
14+
*/
1215
interface QuoteValidationRuleInterface
1316
{
1417
/**
15-
* Validate quote model.
18+
* Validate Quote model.
1619
*
1720
* @param Quote $quote
1821
* @return ValidationResult[]

app/code/Magento/Quote/Model/ValidationRules/ShippingAddressValidationRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Framework\Validation\ValidationResultFactory;
1111
use Magento\Quote\Model\Quote;
1212

13+
/**
14+
* @inheritdoc
15+
*/
1316
class ShippingAddressValidationRule implements QuoteValidationRuleInterface
1417
{
1518
/**
@@ -45,7 +48,7 @@ public function validate(Quote $quote): array
4548
if (!$quote->isVirtual()) {
4649
$validationResult = $quote->getShippingAddress()->validate();
4750
if ($validationResult !== true) {
48-
$validationErrors = [$this->generalMessage];
51+
$validationErrors = [__($this->generalMessage)];
4952
}
5053
if (is_array($validationResult)) {
5154
$validationErrors = array_merge($validationErrors, $validationResult);

app/code/Magento/Quote/Model/ValidationRules/ShippingMethodValidationRule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Framework\Validation\ValidationResultFactory;
1111
use Magento\Quote\Model\Quote;
1212

13+
/**
14+
* @inheritdoc
15+
*/
1316
class ShippingMethodValidationRule implements QuoteValidationRuleInterface
1417
{
1518
/**
@@ -46,7 +49,7 @@ public function validate(Quote $quote): array
4649
$shippingRate = $quote->getShippingAddress()->getShippingRateByCode($shippingMethod);
4750
$validationResult = $shippingMethod && $shippingRate;
4851
if (!$validationResult) {
49-
$validationErrors = [$this->generalMessage];
52+
$validationErrors = [__($this->generalMessage)];
5053
}
5154
}
5255

app/code/Magento/Quote/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<preference for="Magento\Quote\Api\GuestCartTotalManagementInterface" type="Magento\Quote\Model\GuestCart\GuestCartTotalManagement" />
4242
<preference for="Magento\Quote\Api\Data\EstimateAddressInterface" type="Magento\Quote\Model\EstimateAddress" />
4343
<preference for="Magento\Quote\Api\Data\ProductOptionInterface" type="Magento\Quote\Model\Quote\ProductOption" />
44-
<preference for="Magento\Quote\Model\ValidationRules\QuoteValidationRuleInterface" type="Magento\Quote\Model\ValidationRules\QuoteValidationComposite"/>
44+
<preference for="Magento\Quote\Model\ValidationRules\QuoteValidationRuleInterface" type="Magento\Quote\Model\ValidationRules\QuoteValidationComposite\Proxy"/>
4545
<type name="Magento\Webapi\Controller\Rest\ParamsOverrider">
4646
<arguments>
4747
<argument name="paramOverriders" xsi:type="array">

app/code/Magento/Sales/Test/Mftf/Data/SalesConfigData.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
-->
88
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
10-
<entity name="EnabledMinimumOrderAmount" type="sales_minimum_order">
10+
<entity name="EnabledMinimumOrderAmount500" type="sales_minimum_order">
1111
<requiredEntity type="active">EnableMinimumOrderCheck</requiredEntity>
12-
<requiredEntity type="amount">MinimumOrderAmount</requiredEntity>
12+
<requiredEntity type="amount">MinimumOrderAmount500</requiredEntity>
1313
</entity>
1414
<entity name="EnableMinimumOrderCheck" type="active">
1515
<data key="value">1</data>
1616
</entity>
17-
<entity name="MinimumOrderAmount" type="amount">
17+
<entity name="MinimumOrderAmount500" type="amount">
1818
<data key="value">500</data>
1919
</entity>
2020

0 commit comments

Comments
 (0)