Skip to content

Commit eb55d76

Browse files
author
Serhii Balko
committed
Merge remote-tracking branch 'origin/MC-40657' into 2.4-develop-pr51
2 parents ab4c545 + 9cc436f commit eb55d76

File tree

2 files changed

+2
-64
lines changed

2 files changed

+2
-64
lines changed

app/code/Magento/CheckoutAgreements/Model/Checkout/Plugin/Validation.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -86,30 +86,6 @@ public function beforeSavePaymentInformationAndPlaceOrder(
8686
}
8787
}
8888

89-
/**
90-
* Check validation before saving the payment information
91-
*
92-
* @param \Magento\Checkout\Api\PaymentInformationManagementInterface $subject
93-
* @param int $cartId
94-
* @param \Magento\Quote\Api\Data\PaymentInterface $paymentMethod
95-
* @param \Magento\Quote\Api\Data\AddressInterface|null $billingAddress
96-
* @return void
97-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
98-
* @throws \Magento\Framework\Exception\NoSuchEntityException
99-
* @throws \Magento\Framework\Exception\CouldNotSaveException
100-
*/
101-
public function beforeSavePaymentInformation(
102-
\Magento\Checkout\Api\PaymentInformationManagementInterface $subject,
103-
$cartId,
104-
\Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
105-
\Magento\Quote\Api\Data\AddressInterface $billingAddress = null
106-
) {
107-
$quote = $this->quoteRepository->getActive($cartId);
108-
if ($this->isAgreementEnabled() && !$quote->getIsMultiShipping()) {
109-
$this->validateAgreements($paymentMethod);
110-
}
111-
}
112-
11389
/**
11490
* Validate agreements base on the payment method
11591
*

app/code/Magento/CheckoutAgreements/Test/Unit/Model/Checkout/Plugin/ValidationTest.php

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,9 @@ public function testBeforeSavePaymentInformationAndPlaceOrder()
126126
->willReturn(true);
127127
$searchCriteriaMock = $this->createMock(SearchCriteria::class);
128128
$this->quoteMock
129-
->expects($this->once())
130129
->method('getIsMultiShipping')
131130
->willReturn(false);
132131
$this->quoteRepositoryMock
133-
->expects($this->once())
134132
->method('getActive')
135133
->with($cartId)
136134
->willReturn($this->quoteMock);
@@ -146,7 +144,7 @@ public function testBeforeSavePaymentInformationAndPlaceOrder()
146144
$this->paymentMock->expects(static::atLeastOnce())
147145
->method('getExtensionAttributes')
148146
->willReturn($this->extensionAttributesMock);
149-
$this->model->beforeSavePaymentInformation(
147+
$this->model->beforeSavePaymentInformationAndPlaceOrder(
150148
$this->subjectMock,
151149
$cartId,
152150
$this->paymentMock,
@@ -166,11 +164,9 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali
166164
->willReturn(true);
167165
$searchCriteriaMock = $this->createMock(SearchCriteria::class);
168166
$this->quoteMock
169-
->expects($this->once())
170167
->method('getIsMultiShipping')
171168
->willReturn(false);
172169
$this->quoteRepositoryMock
173-
->expects($this->once())
174170
->method('getActive')
175171
->with($cartId)
176172
->willReturn($this->quoteMock);
@@ -186,7 +182,7 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali
186182
$this->paymentMock->expects(static::atLeastOnce())
187183
->method('getExtensionAttributes')
188184
->willReturn($this->extensionAttributesMock);
189-
$this->model->beforeSavePaymentInformation(
185+
$this->model->beforeSavePaymentInformationAndPlaceOrder(
190186
$this->subjectMock,
191187
$cartId,
192188
$this->paymentMock,
@@ -198,40 +194,6 @@ public function testBeforeSavePaymentInformationAndPlaceOrderIfAgreementsNotVali
198194
);
199195
}
200196

201-
public function testBeforeSavePaymentInformation()
202-
{
203-
$cartId = 100;
204-
$agreements = [1, 2, 3];
205-
$this->scopeConfigMock
206-
->expects($this->once())
207-
->method('isSetFlag')
208-
->with(AgreementsProvider::PATH_ENABLED, ScopeInterface::SCOPE_STORE)
209-
->willReturn(true);
210-
$this->quoteMock
211-
->expects($this->once())
212-
->method('getIsMultiShipping')
213-
->willReturn(false);
214-
$this->quoteRepositoryMock
215-
->expects($this->once())
216-
->method('getActive')
217-
->with($cartId)
218-
->willReturn($this->quoteMock);
219-
$searchCriteriaMock = $this->createMock(SearchCriteria::class);
220-
$this->agreementsFilterMock->expects($this->once())
221-
->method('buildSearchCriteria')
222-
->willReturn($searchCriteriaMock);
223-
$this->checkoutAgreementsListMock->expects($this->once())
224-
->method('getList')
225-
->with($searchCriteriaMock)
226-
->willReturn([1]);
227-
$this->extensionAttributesMock->expects($this->once())->method('getAgreementIds')->willReturn($agreements);
228-
$this->agreementsValidatorMock->expects($this->once())->method('isValid')->with($agreements)->willReturn(true);
229-
$this->paymentMock->expects(static::atLeastOnce())
230-
->method('getExtensionAttributes')
231-
->willReturn($this->extensionAttributesMock);
232-
$this->model->beforeSavePaymentInformation($this->subjectMock, $cartId, $this->paymentMock, $this->addressMock);
233-
}
234-
235197
/**
236198
* Build payment extension mock.
237199
*

0 commit comments

Comments
 (0)