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
98dbe562
Commit
98dbe562
authored
Nov 13, 2017
by
Alessio Zampatti
Committed by
GitHub
Nov 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed shopper locale for Paybymail method (#206)
parent
058eb3c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
16 deletions
+18
-16
Gateway/Command/PayByMailCommand.php
Gateway/Command/PayByMailCommand.php
+11
-14
Helper/Data.php
Helper/Data.php
+5
-0
Helper/PaymentMethods.php
Helper/PaymentMethods.php
+2
-2
No files found.
Gateway/Command/PayByMailCommand.php
View file @
98dbe562
...
...
@@ -26,6 +26,7 @@ namespace Adyen\Payment\Gateway\Command;
use
Magento\Payment\Gateway\Command
;
use
Magento\Payment\Gateway\CommandInterface
;
class
PayByMailCommand
implements
CommandInterface
{
...
...
@@ -34,11 +35,6 @@ class PayByMailCommand implements CommandInterface
*/
protected
$_adyenHelper
;
/**
* @var ResolverInterface
*/
protected
$_resolver
;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
...
...
@@ -53,11 +49,9 @@ class PayByMailCommand implements CommandInterface
*/
public
function
__construct
(
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Magento\Framework\Locale\ResolverInterface
$resolver
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
)
{
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_resolver
=
$resolver
;
$this
->
_adyenLogger
=
$adyenLogger
;
}
/**
...
...
@@ -134,6 +128,7 @@ class PayByMailCommand implements CommandInterface
$realOrderId
=
$order
->
getRealOrderId
();
$orderCurrencyCode
=
$order
->
getOrderCurrencyCode
();
$storeId
=
$order
->
getStore
()
->
getId
();
// check if paybymail has it's own skin
$skinCode
=
trim
(
$this
->
_adyenHelper
->
getAdyenPayByMailConfigData
(
'skin_code'
));
...
...
@@ -141,18 +136,20 @@ class PayByMailCommand implements CommandInterface
// use HPP skin and HMAC
$skinCode
=
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'skin_code'
);
$hmacKey
=
$this
->
_adyenHelper
->
getHmac
();
$shopperLocale
=
trim
(
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'shopper_locale'
,
$storeId
));
$countryCode
=
trim
(
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'country_code'
,
$storeId
));
}
else
{
// use pay_by_mail skin and hmac
$hmacKey
=
$this
->
_adyenHelper
->
getHmacPayByMail
();
}
$amount
=
$this
->
_adyenHelper
->
formatAmount
(
$order
->
getGrandTotal
(),
$orderCurrencyCode
);
$merchantAccount
=
trim
(
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'merchant_account'
));
$merchantAccount
=
trim
(
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'merchant_account'
,
$storeId
));
$shopperEmail
=
$order
->
getCustomerEmail
();
$customerId
=
$order
->
getCustomerId
();
$shopperLocale
=
trim
(
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'shopper_locale'
));
$shopperLocale
=
(
!
empty
(
$shopperLocale
))
?
$shopperLocale
:
$this
->
_resolver
->
getLocale
();
$
countryCode
=
trim
(
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'country_code'
)
);
// get locale from store
$
shopperLocale
=
(
!
empty
(
$shopperLocale
))
?
$shopperLocale
:
$this
->
_adyenHelper
->
getStoreLocale
(
$storeId
);
$countryCode
=
(
!
empty
(
$countryCode
))
?
$countryCode
:
false
;
// if directory lookup is enabled use the billingadress as countrycode
...
...
@@ -164,7 +161,7 @@ class PayByMailCommand implements CommandInterface
}
}
$deliveryDays
=
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'delivery_days'
);
$deliveryDays
=
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'delivery_days'
,
$storeId
);
$deliveryDays
=
(
!
empty
(
$deliveryDays
))
?
$deliveryDays
:
5
;
$formFields
=
[];
...
...
@@ -184,9 +181,9 @@ class PayByMailCommand implements CommandInterface
$formFields
[
'shopperEmail'
]
=
$shopperEmail
;
// recurring
$recurringType
=
trim
(
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'recurring_type'
));
$recurringType
=
trim
(
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'recurring_type'
,
$storeId
));
$sessionValidity
=
$this
->
_adyenHelper
->
getAdyenPayByMailConfigData
(
'session_validity'
);
$sessionValidity
=
$this
->
_adyenHelper
->
getAdyenPayByMailConfigData
(
'session_validity'
,
$storeId
);
if
(
$sessionValidity
==
""
)
{
$sessionValidity
=
3
;
...
...
Helper/Data.php
View file @
98dbe562
...
...
@@ -816,4 +816,9 @@ class Data extends AbstractHelper
return
$this
->
_assetRepo
->
createAsset
(
$fileId
,
$params
);
}
public
function
getStoreLocale
(
$storeId
)
{
$path
=
\Magento\Directory\Helper\Data
::
XML_PATH_DEFAULT_LOCALE
;
return
$this
->
scopeConfig
->
getValue
(
$path
,
\Magento\Store\Model\ScopeInterface
::
SCOPE_STORE
,
$storeId
);
}
}
\ No newline at end of file
Helper/PaymentMethods.php
View file @
98dbe562
...
...
@@ -336,9 +336,9 @@ class PaymentMethods extends AbstractHelper
return
$locale
;
}
// should have the v
u
lue if not fall back to default
// should have the v
a
lue if not fall back to default
$localeCode
=
$this
->
_config
->
getValue
(
Data
::
XML_PATH_DEFAULT_LOCALE
,
\Magento\Directory\Helper\
Data
::
XML_PATH_DEFAULT_LOCALE
,
\Magento\Store\Model\ScopeInterface
::
SCOPE_STORES
,
$store
->
getCode
()
);
...
...
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