Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Adyen Magento2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared Libs
Adyen Magento2
Commits
040c9e38
Commit
040c9e38
authored
Apr 24, 2020
by
acampos1916
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PW-2212]: Adjusting installments validator and config provider
parent
9cc27dcd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
38 deletions
+4
-38
Gateway/Validator/InstallmentValidator.php
Gateway/Validator/InstallmentValidator.php
+2
-23
Model/Ui/AdyenCcConfigProvider.php
Model/Ui/AdyenCcConfigProvider.php
+2
-10
etc/di.xml
etc/di.xml
+0
-5
No files found.
Gateway/Validator/InstallmentValidator.php
View file @
040c9e38
...
...
@@ -39,11 +39,6 @@ class InstallmentValidator extends AbstractValidator
*/
private
$adyenHelper
;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private
$serializer
;
/**
* @var \Magento\Quote\Model\QuoteRepository
*/
...
...
@@ -54,20 +49,17 @@ class InstallmentValidator extends AbstractValidator
* @param \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
* @param \Magento\Quote\Model\QuoteRepository $quoteRepository
*/
public
function
__construct
(
\Magento\Payment\Gateway\Validator\ResultInterfaceFactory
$resultFactory
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
,
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Magento\Framework\Serialize\SerializerInterface
$serializer
,
\Magento\Quote\Model\QuoteRepository
$quoteRepository
)
{
$this
->
adyenLogger
=
$adyenLogger
;
$this
->
adyenHelper
=
$adyenHelper
;
$this
->
serializer
=
$serializer
;
$this
->
quoteRepository
=
$quoteRepository
;
parent
::
__construct
(
$resultFactory
);
}
...
...
@@ -88,27 +80,14 @@ class InstallmentValidator extends AbstractValidator
$installmentsEnabled
=
$this
->
adyenHelper
->
getAdyenCcConfigData
(
'enable_installments'
);
if
(
$quote
&&
$installmentsEnabled
)
{
$grandTotal
=
$quote
->
getGrandTotal
();
$installments
Available
=
$this
->
adyenHelper
->
getAdyenCcConfigData
(
'installments'
);
$installments
=
$this
->
adyenHelper
->
getAdyenCcConfigData
(
'installments'
);
$installmentSelected
=
$payment
->
getAdditionalInformation
(
'number_of_installments'
);
$ccType
=
$payment
->
getAdditionalInformation
(
'cc_type'
);
if
(
$installmentsAvailable
)
{
$installments
=
$this
->
serializer
->
unserialize
(
$installmentsAvailable
);
}
if
(
$installmentSelected
&&
$installmentsAvailable
)
{
$isValid
=
false
;
$fails
[]
=
__
(
'Installments not valid.'
);
if
(
$installments
)
{
foreach
(
$installments
as
$ccTypeInstallment
=>
$installment
)
{
if
(
$ccTypeInstallment
==
$ccType
)
{
foreach
(
$installment
as
$amount
=>
$installmentsData
)
{
if
(
$installmentSelected
==
$installmentsData
)
{
if
(
$grandTotal
>=
$amount
)
{
$isValid
=
true
;
}
}
}
}
}
//TODO how implement custom validation of generated installments code against selected value?
}
}
}
...
...
Model/Ui/AdyenCcConfigProvider.php
View file @
040c9e38
...
...
@@ -69,11 +69,6 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
*/
private
$storeManager
;
/**
* @var \Magento\Framework\Serialize\SerializerInterface
*/
private
$serializer
;
/**
* AdyenCcConfigProvider constructor.
*
...
...
@@ -84,7 +79,6 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
* @param \Magento\Framework\View\Asset\Source $assetSource
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Payment\Model\CcConfig $ccConfig
* @param \Magento\Framework\Serialize\SerializerInterface $serializer
*/
public
function
__construct
(
\Magento\Payment\Helper\Data
$paymentHelper
,
...
...
@@ -93,8 +87,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
\Magento\Framework\UrlInterface
$urlBuilder
,
\Magento\Framework\View\Asset\Source
$assetSource
,
\Magento\Store\Model\StoreManagerInterface
$storeManager
,
\Magento\Payment\Model\CcConfig
$ccConfig
,
\Magento\Framework\Serialize\SerializerInterface
$serializer
\Magento\Payment\Model\CcConfig
$ccConfig
)
{
$this
->
_paymentHelper
=
$paymentHelper
;
$this
->
_adyenHelper
=
$adyenHelper
;
...
...
@@ -103,7 +96,6 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$this
->
_assetSource
=
$assetSource
;
$this
->
ccConfig
=
$ccConfig
;
$this
->
storeManager
=
$storeManager
;
$this
->
serializer
=
$serializer
;
}
/**
...
...
@@ -163,7 +155,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
$installments
=
$this
->
_adyenHelper
->
getAdyenCcConfigData
(
'installments'
);
if
(
$installmentsEnabled
&&
$installments
)
{
$config
[
'payment'
][
'adyenCc'
][
'installments'
]
=
$
this
->
serializer
->
unserialize
(
$installments
)
;
$config
[
'payment'
][
'adyenCc'
][
'installments'
]
=
$
installments
;
$config
[
'payment'
][
'adyenCc'
][
'hasInstallments'
]
=
true
;
}
else
{
$config
[
'payment'
][
'adyenCc'
][
'installments'
]
=
[];
...
...
etc/di.xml
View file @
040c9e38
...
...
@@ -989,11 +989,6 @@
<argument
name=
"serializer"
xsi:type=
"object"
>
Magento\Framework\Serialize\Serializer\Serialize
</argument>
</arguments>
</type>
<type
name=
"Adyen\Payment\Gateway\Validator\InstallmentValidator"
>
<arguments>
<argument
name=
"serializer"
xsi:type=
"object"
>
Magento\Framework\Serialize\Serializer\Serialize
</argument>
</arguments>
</type>
<type
name=
"Adyen\Payment\Model\Ui\AdyenPosCloudConfigProvider"
>
<arguments>
<argument
name=
"serializer"
xsi:type=
"object"
>
Magento\Framework\Serialize\Serializer\Serialize
</argument>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment