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
b8c2a0bc
Commit
b8c2a0bc
authored
Apr 08, 2016
by
rikterbeek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #30 added option to do moto transaction in backend
parent
1c0d3249
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
4 deletions
+61
-4
Block/Form/Cc.php
Block/Form/Cc.php
+23
-0
Model/Api/PaymentRequest.php
Model/Api/PaymentRequest.php
+25
-4
etc/adminhtml/system/adyen_cc.xml
etc/adminhtml/system/adyen_cc.xml
+12
-0
etc/config.xml
etc/config.xml
+1
-0
No files found.
Block/Form/Cc.php
View file @
b8c2a0bc
...
...
@@ -42,6 +42,16 @@ class Cc extends \Magento\Payment\Block\Form
*/
protected
$_adyenHelper
;
/**
* @var \Magento\Framework\App\State
*/
protected
$_appState
;
/**
* @var \Magento\Checkout\Model\Session
*/
protected
$_checkoutSession
;
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Payment\Model\Config $paymentConfig
...
...
@@ -51,11 +61,14 @@ class Cc extends \Magento\Payment\Block\Form
\Magento\Framework\View\Element\Template\Context
$context
,
\Magento\Payment\Model\Config
$paymentConfig
,
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Magento\Checkout\Model\Session
$checkoutSession
,
array
$data
=
[]
)
{
parent
::
__construct
(
$context
,
$data
);
$this
->
_paymentConfig
=
$paymentConfig
;
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_appState
=
$context
->
getAppState
();
$this
->
_checkoutSession
=
$checkoutSession
;
}
...
...
@@ -142,6 +155,16 @@ class Cc extends \Magento\Payment\Block\Form
*/
public
function
hasVerification
()
{
// if backend order and moto payments is turned on don't show cvc
if
(
$this
->
_appState
->
getAreaCode
()
===
\Magento\Backend\App\Area\FrontNameResolver
::
AREA_CODE
)
{
$this
->
getCheckoutSession
();
$store
=
$this
->
_checkoutSession
->
getQuote
()
->
getStore
();
$enableMoto
=
$this
->
_adyenHelper
->
getAdyenCcConfigDataFlag
(
'enable_moto'
,
$store
->
getId
());
if
(
$enableMoto
)
{
return
false
;
}
}
return
true
;
}
...
...
Model/Api/PaymentRequest.php
View file @
b8c2a0bc
...
...
@@ -62,6 +62,11 @@ class PaymentRequest extends DataObject
*/
protected
$_recurringType
;
/**
* @var \Magento\Framework\App\State
*/
protected
$_appState
;
const
GUEST_ID
=
'customer_'
;
/**
...
...
@@ -74,6 +79,7 @@ class PaymentRequest extends DataObject
* @param array $data
*/
public
function
__construct
(
\Magento\Framework\Model\Context
$context
,
\Magento\Framework\App\Config\ScopeConfigInterface
$scopeConfig
,
\Psr\Log\LoggerInterface
$logger
,
\Magento\Framework\Encryption\EncryptorInterface
$encryptor
,
...
...
@@ -88,6 +94,7 @@ class PaymentRequest extends DataObject
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_adyenLogger
=
$adyenLogger
;
$this
->
_recurringType
=
$recurringType
;
$this
->
_appState
=
$context
->
getAppState
();
// initialize client
$webserviceUsername
=
$this
->
_adyenHelper
->
getWsUsername
();
...
...
@@ -113,13 +120,18 @@ class PaymentRequest extends DataObject
public
function
fullApiRequest
(
$payment
,
$paymentMethodCode
)
{
$storeId
=
null
;
if
(
$this
->
_appState
->
getAreaCode
()
===
\Magento\Backend\App\Area\FrontNameResolver
::
AREA_CODE
)
{
$storeId
=
$payment
->
getOrder
()
->
getStoreId
();
}
$order
=
$payment
->
getOrder
();
$amount
=
$order
->
getGrandTotal
();
$customerEmail
=
$order
->
getCustomerEmail
();
$shopperIp
=
$order
->
getRemoteIp
();
$orderCurrencyCode
=
$order
->
getOrderCurrencyCode
();
$merchantAccount
=
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
"merchant_account"
);
$recurringType
=
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'recurring_type'
);
$merchantAccount
=
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
"merchant_account"
,
$storeId
);
$recurringType
=
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'recurring_type'
,
$storeId
);
$realOrderId
=
$order
->
getRealOrderId
();
$customerId
=
$order
->
getCustomerId
();
...
...
@@ -217,8 +229,18 @@ class PaymentRequest extends DataObject
$request
=
array_merge
(
$request
,
$requestDelivery
);
}
$enableMoto
=
$this
->
_adyenHelper
->
getAdyenCcConfigDataFlag
(
'enable_moto'
,
$storeId
);
$recurringDetailReference
=
null
;
// define the shopper interaction
if
(
$paymentMethodCode
==
\Adyen\Payment\Model\Method\Oneclick
::
METHOD_CODE
)
{
if
(
$this
->
_appState
->
getAreaCode
()
===
\Magento\Backend\App\Area\FrontNameResolver
::
AREA_CODE
&&
$paymentMethodCode
==
\Adyen\Payment\Model\Method\Cc
::
METHOD_CODE
&&
$enableMoto
)
{
// if MOTO for backend is enabled use MOTO as shopper interaction type
$shopperInteraction
=
"Moto"
;
}
else
if
(
$paymentMethodCode
==
\Adyen\Payment\Model\Method\Oneclick
::
METHOD_CODE
)
{
$recurringDetailReference
=
$payment
->
getAdditionalInformation
(
"recurring_detail_reference"
);
if
(
$payment
->
getAdditionalInformation
(
'customer_interaction'
))
{
$shopperInteraction
=
"Ecommerce"
;
...
...
@@ -233,7 +255,6 @@ class PaymentRequest extends DataObject
}
}
}
else
{
$recurringDetailReference
=
null
;
$shopperInteraction
=
"Ecommerce"
;
}
...
...
etc/adminhtml/system/adyen_cc.xml
View file @
b8c2a0bc
...
...
@@ -62,6 +62,18 @@
<depends><field
id=
"cse_enabled"
>
1
</field></depends>
<config_path>
payment/adyen_cc/cse_publickey_live
</config_path>
</field>
<group
id=
"adyen_cc_advanced_settings"
translate=
"label"
showInDefault=
"1"
showInWebsite=
"1"
sortOrder=
"150"
>
<label>
Advanced Settings
</label>
<frontend_model>
Magento\Config\Block\System\Config\Form\Fieldset
</frontend_model>
<field
id=
"enable_moto"
translate=
"label"
type=
"select"
sortOrder=
"10"
showInDefault=
"1"
showInWebsite=
"1"
showInStore=
"1"
>
<label>
Enable MOTO
</label>
<tooltip>
<![CDATA[Important you have to activate MOTO for your account contact magento@adyen.com.]]>
</tooltip>
<source_model>
Magento\Config\Model\Config\Source\Yesno
</source_model>
<config_path>
payment/adyen_cc/enable_moto
</config_path>
</field>
</group>
<group
id=
"adyen_cc_country_specific"
translate=
"label"
showInDefault=
"1"
showInWebsite=
"1"
sortOrder=
"200"
>
<label>
Country Specific Settings
</label>
<frontend_model>
Magento\Config\Block\System\Config\Form\Fieldset
</frontend_model>
...
...
etc/config.xml
View file @
b8c2a0bc
...
...
@@ -45,6 +45,7 @@
<cctypes>
AE,VI,MC,DI
</cctypes>
<useccv>
1
</useccv>
<cse_enabled>
1
</cse_enabled>
<enable_moto>
0
</enable_moto>
<payment_action>
authorize
</payment_action>
<group>
adyen
</group>
</adyen_cc>
...
...
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