Skip to content

Commit c882a97

Browse files
committed
ACP2E-1053: Generate coupon codes ignores Code Length
- Fixed the static test failure.
1 parent b17c043 commit c882a97

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote/Generate.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ public function execute()
9898
&& !$rule->getUseAutoGeneration()) {
9999
$result['error'] =
100100
__('The rule coupon settings changed. Please save the rule before using auto-generation.');
101-
} elseif (
102-
(int)$this->getRequest()->getParams()['length'] !==
101+
} elseif ((int)$this->getRequest()->getParams()['length'] !==
103102
$this->validateCouponLengthWithQuantity->validateCouponCodeLengthWithQuantity(
104103
$this->getRequest()->getParams()
105104
)

app/code/Magento/SalesRule/Model/Quote/ValidateCouponLengthWithQuantity.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,29 @@
1717
class ValidateCouponLengthWithQuantity implements ValidateCouponLengthWithQuantityInterface
1818
{
1919
/**
20-
* Sales rule coupon
20+
* Initialize Sales rule coupon property
2121
*
2222
* @var Coupon
2323
*/
2424
protected Coupon $salesRuleCoupon;
2525

2626
/**
27-
* @param Coupon $salesRuleCoupon
27+
* Generate constructor.
28+
*
29+
* @param Coupon $salesRuleCoupon
2830
*/
2931
public function __construct(
3032
Coupon $salesRuleCoupon
3133
) {
3234
$this->salesRuleCoupon = $salesRuleCoupon;
3335
}
3436

37+
/**
38+
* Validate coupon code length with quantity
39+
*
40+
* @param array $couponCodeDataArray
41+
* @return int
42+
*/
3543
public function validateCouponCodeLengthWithQuantity(array $couponCodeDataArray): int
3644
{
3745
$maxProbability = Massgenerator::MAX_PROBABILITY_OF_GUESSING;

0 commit comments

Comments
 (0)