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
4a176d04
Commit
4a176d04
authored
Mar 20, 2020
by
cyattilakiss
Committed by
GitHub
Mar 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use quote retrieved by quote id (#667)
parent
d6032d10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
11 deletions
+34
-11
Helper/PaymentMethods.php
Helper/PaymentMethods.php
+34
-11
No files found.
Helper/PaymentMethods.php
View file @
4a176d04
...
...
@@ -85,6 +85,11 @@ class PaymentMethods extends AbstractHelper
*/
protected
$themeProvider
;
/**
* @var \Magento\Quote\Model\Quote
*/
protected
$quote
;
/**
* PaymentMethods constructor.
*
...
...
@@ -133,41 +138,51 @@ class PaymentMethods extends AbstractHelper
{
// get quote from quoteId
$quote
=
$this
->
quoteRepository
->
getActive
(
$quoteId
);
$store
=
$quote
->
getStore
();
$paymentMethods
=
$this
->
fetchAlternativeMethods
(
$store
,
$country
);
// If quote cannot be found early return the empty paymentMethods array
if
(
empty
(
$quote
))
{
return
[];
}
$this
->
setQuote
(
$quote
);
$paymentMethods
=
$this
->
fetchAlternativeMethods
(
$country
);
return
$paymentMethods
;
}
/**
* @param $store
* @param $country
* @return array
*/
protected
function
fetchAlternativeMethods
(
$
store
,
$
country
)
protected
function
fetchAlternativeMethods
(
$country
)
{
$merchantAccount
=
$this
->
adyenHelper
->
getAdyenAbstractConfigData
(
'merchant_account'
);
$quote
=
$this
->
getQuote
();
$store
=
$quote
->
getStore
();
$merchantAccount
=
$this
->
adyenHelper
->
getAdyenAbstractConfigData
(
'merchant_account'
,
$store
->
getId
());
if
(
!
$merchantAccount
)
{
return
[];
}
$currencyCode
=
$this
->
getCurrentCurrencyCode
(
$store
);
$adyFields
=
[
"channel"
=>
"Web"
,
"merchantAccount"
=>
$merchantAccount
,
"countryCode"
=>
$this
->
getCurrentCountryCode
(
$store
,
$country
),
"amount"
=>
[
"currency"
=>
$
this
->
getCurrentCurrencyCode
(
$store
)
,
"currency"
=>
$
currencyCode
,
"value"
=>
(
int
)
$this
->
adyenHelper
->
formatAmount
(
$this
->
getCurrentPaymentAmount
(),
$
this
->
getCurrentCurrencyCode
(
$store
)
$
currencyCode
),
],
"shopperReference"
=>
$this
->
getCurrentShopperReference
(),
"shopperLocale"
=>
$this
->
adyenHelper
->
getCurrentLocaleCode
(
$store
->
getId
())
];
$billingAddress
=
$
this
->
getQuote
()
->
getBillingAddress
();
$billingAddress
=
$
quote
->
getBillingAddress
();
if
(
!
empty
(
$billingAddress
))
{
if
(
$customerTelephone
=
trim
(
$billingAddress
->
getTelephone
()))
{
...
...
@@ -319,7 +334,7 @@ class PaymentMethods extends AbstractHelper
{
// initialize the adyen client
$client
=
$this
->
adyenHelper
->
initializeAdyenClient
(
$
this
->
getQuote
()
->
getStore
Id
());
$client
=
$this
->
adyenHelper
->
initializeAdyenClient
(
$
store
->
get
Id
());
// initialize service
$service
=
$this
->
adyenHelper
->
createAdyenCheckoutService
(
$client
);
...
...
@@ -342,7 +357,15 @@ class PaymentMethods extends AbstractHelper
*/
protected
function
getQuote
()
{
return
$this
->
session
->
getQuote
();
return
$this
->
quote
;
}
/**
* @param \Magento\Quote\Model\Quote $quote
*/
protected
function
setQuote
(
\Magento\Quote\Model\Quote
$quote
)
{
$this
->
quote
=
$quote
;
}
/**
...
...
@@ -389,4 +412,4 @@ class PaymentMethods extends AbstractHelper
return
$responseData
;
}
}
\ No newline at end of file
}
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