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
48811d7c
Commit
48811d7c
authored
Nov 21, 2018
by
cyattilakiss
Committed by
GitHub
Nov 21, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #343 from Adyen/PW-635
PW-635 Secure Fields integration for backend orders
parents
002899f9
b1532469
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
275 additions
and
177 deletions
+275
-177
Block/Form/Cc.php
Block/Form/Cc.php
+73
-40
Block/Form/Oneclick.php
Block/Form/Oneclick.php
+2
-4
Gateway/Request/CcAuthorizationDataBuilder.php
Gateway/Request/CcAuthorizationDataBuilder.php
+0
-2
Helper/Data.php
Helper/Data.php
+6
-4
Observer/AdyenCcDataAssignObserver.php
Observer/AdyenCcDataAssignObserver.php
+0
-2
view/adminhtml/layout/sales_order_create_index.xml
view/adminhtml/layout/sales_order_create_index.xml
+29
-0
view/adminhtml/templates/form/cc.phtml
view/adminhtml/templates/form/cc.phtml
+97
-125
view/adminhtml/web/css/order_create_styles.css
view/adminhtml/web/css/order_create_styles.css
+68
-0
No files found.
Block/Form/Cc.php
View file @
48811d7c
...
...
@@ -30,37 +30,31 @@ class Cc extends \Magento\Payment\Block\Form\Cc
*/
protected
$_template
=
'Adyen_Payment::form/cc.phtml'
;
/**
* Payment config model
*
* @var \Magento\Payment\Model\Config
*/
protected
$_paymentConfig
;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected
$
_
adyenHelper
;
protected
$adyenHelper
;
/**
* @var \Magento\Framework\App\State
*/
protected
$
_
appState
;
protected
$appState
;
/**
* @var \Magento\Checkout\Model\Session
*/
protected
$
_
checkoutSession
;
protected
$checkoutSession
;
/**
* Cc constructor.
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Payment\Model\Config $paymentConfig
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param array $data
*/
/**
* Cc constructor.
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Payment\Model\Config $paymentConfig
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param array $data
*/
public
function
__construct
(
\Magento\Framework\View\Element\Template\Context
$context
,
\Magento\Payment\Model\Config
$paymentConfig
,
...
...
@@ -70,27 +64,35 @@ class Cc extends \Magento\Payment\Block\Form\Cc
)
{
parent
::
__construct
(
$context
,
$paymentConfig
);
$this
->
_
adyenHelper
=
$adyenHelper
;
$this
->
_
appState
=
$context
->
getAppState
();
$this
->
_
checkoutSession
=
$checkoutSession
;
$this
->
adyenHelper
=
$adyenHelper
;
$this
->
appState
=
$context
->
getAppState
();
$this
->
checkoutSession
=
$checkoutSession
;
}
/**
* @return string
*/
public
function
getCheckoutCardComponentJs
()
{
return
$this
->
adyenHelper
->
getCheckoutCardComponentJs
(
$this
->
checkoutSession
->
getQuote
()
->
getStore
()
->
getId
());
}
/**
* @return mixed
* @throws \Magento\Framework\Exception\LocalizedException
*/
public
function
getLibrarySource
()
{
// get storeId for admin
if
(
!
$this
->
_appState
->
getAreaCode
()
===
\Magento\Backend\App\Area\FrontNameResolver
::
AREA_CODE
)
{
$storeId
=
$this
->
_storeManager
->
getStore
()
->
getId
();
}
else
{
$storeId
=
null
;
}
/**
* @return string
* @throws \Adyen\AdyenException
*/
public
function
getCheckoutOriginKeys
()
{
return
$this
->
adyenHelper
->
getOriginKeyForBaseUrl
();
}
return
$this
->
_adyenHelper
->
getLibrarySource
(
$storeId
);
}
/**
* @return string
*/
public
function
getCheckoutContextUrl
()
{
return
$this
->
adyenHelper
->
getCheckoutContextUrl
(
$this
->
checkoutSession
->
getQuote
()
->
getStore
()
->
getId
());
}
/**
* Retrieve has verification configuration
...
...
@@ -100,14 +102,45 @@ class Cc extends \Magento\Payment\Block\Form\Cc
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
)
{
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
());
$store
=
$this
->
checkoutSession
->
getQuote
()
->
getStore
();
$enableMoto
=
$this
->
adyenHelper
->
getAdyenCcConfigDataFlag
(
'enable_moto'
,
$store
->
getId
());
if
(
$enableMoto
)
{
return
false
;
}
}
return
true
;
}
}
\ No newline at end of file
/**
* @return string
*/
public
function
getLocale
()
{
return
$this
->
adyenHelper
->
getStoreLocale
(
$this
->
checkoutSession
->
getQuote
()
->
getStore
()
->
getId
());
}
/**
* Retrieve availables credit card type codes by alt code
*
* @return array
*/
public
function
getCcAvailableTypesByAlt
()
{
$types
=
[];
$ccTypes
=
$this
->
adyenHelper
->
getAdyenCcTypes
();
$availableTypes
=
$this
->
adyenHelper
->
getAdyenCcConfigData
(
'cctypes'
);
if
(
$availableTypes
)
{
$availableTypes
=
explode
(
','
,
$availableTypes
);
foreach
(
array_keys
(
$ccTypes
)
as
$code
)
{
if
(
in_array
(
$code
,
$availableTypes
))
{
$types
[
$ccTypes
[
$code
][
'code_alt'
]]
=
$code
;
}
}
}
return
$types
;
}
}
Block/Form/Oneclick.php
View file @
48811d7c
...
...
@@ -68,10 +68,8 @@ class Oneclick extends \Adyen\Payment\Block\Form\Cc
// For backend only allow recurring payments
$recurringType
=
\Adyen\Payment\Model\RecurringType
::
RECURRING
;
$cards
=
$this
->
_
adyenHelper
->
getOneClickPaymentMethods
(
$customerId
,
$storeId
,
$grandTotal
,
$recurringType
);
$cards
=
$this
->
adyenHelper
->
getOneClickPaymentMethods
(
$customerId
,
$storeId
,
$grandTotal
,
$recurringType
);
return
$cards
;
}
}
\ No newline at end of file
}
Gateway/Request/CcAuthorizationDataBuilder.php
View file @
48811d7c
...
...
@@ -95,8 +95,6 @@ class CcAuthorizationDataBuilder implements BuilderInterface
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
SECURITY_CODE
);
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
HOLDER_NAME
);
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
ENCRYPTED_DATA
);
/**
* if MOTO for backend is enabled use MOTO as shopper interaction type
*/
...
...
Helper/Data.php
View file @
48811d7c
...
...
@@ -1229,7 +1229,8 @@ class Data extends AbstractHelper
if
(
!
$originKey
=
$this
->
cache
->
load
(
"Adyen_origin_key_for_"
.
$domain
))
{
$originKey
=
""
;
if
(
$originKey
=
$this
->
getOriginKeyForUrl
(
$domain
))
{
$storeId
=
$this
->
storeManager
->
getStore
()
->
getId
();
if
(
$originKey
=
$this
->
getOriginKeyForUrl
(
$domain
,
$storeId
))
{
$this
->
cache
->
save
(
$originKey
,
"Adyen_origin_key_for_"
.
$domain
,
array
(),
60
*
60
*
24
);
}
}
...
...
@@ -1241,10 +1242,11 @@ class Data extends AbstractHelper
* Get origin key for a specific url using the adyen api library client
*
* @param $url
* @return mixed
* @param int|null $storeId
* @return string
* @throws \Adyen\AdyenException
*/
private
function
getOriginKeyForUrl
(
$url
)
private
function
getOriginKeyForUrl
(
$url
,
$storeId
=
null
)
{
$params
=
array
(
"originDomains"
=>
array
(
...
...
@@ -1252,7 +1254,7 @@ class Data extends AbstractHelper
)
);
$client
=
$this
->
initializeAdyenClient
();
$client
=
$this
->
initializeAdyenClient
(
$storeId
);
$service
=
$this
->
createAdyenCheckoutUtilityService
(
$client
);
$respone
=
$service
->
originKeys
(
$params
);
...
...
Observer/AdyenCcDataAssignObserver.php
View file @
48811d7c
...
...
@@ -40,8 +40,6 @@ class AdyenCcDataAssignObserver extends AbstractDataAssignObserver
const
EXPIRY_YEAR
=
'expiryYear'
;
const
HOLDER_NAME
=
'holderName'
;
const
ENCRYPTED_DATA
=
'encrypted_data'
;
/**
* @var array
*/
...
...
view/adminhtml/layout/sales_order_create_index.xml
0 → 100644
View file @
48811d7c
<?xml version="1.0"?>
<!--
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
-->
<page
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:View/Layout/etc/page_configuration.xsd"
>
<head>
<css
src=
"Adyen_Payment::css/order_create_styles.css"
/>
</head>
</page>
view/adminhtml/templates/form/cc.phtml
View file @
48811d7c
This diff is collapsed.
Click to expand it.
view/adminhtml/web/css/order_create_styles.css
0 → 100644
View file @
48811d7c
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
#payment_form_adyen_cc
{
padding-left
:
30px
;
}
.adyen-checkout-card__form
.adyen-checkout__input
iframe
{
max-height
:
40px
;
}
#payment_form_adyen_cc
.admin__field
{
margin-bottom
:
10px
;
}
#payment_form_adyen_cc
.helper-text
{
font-size
:
11px
;
color
:
rgb
(
144
,
162
,
189
);
font-weight
:
100
;
}
#payment_form_adyen_cc
#adyen_cc_cc_owner
{
width
:
225px
;
border
:
none
;
padding
:
0
;
color
:
rgb
(
0
,
27
,
43
);
font-size
:
16px
;
font-weight
:
400
;
margin-top
:
10px
;
}
#payment_form_adyen_cc
#adyen_cc_cc_owner
.input-text
:focus
{
border
:
none
;
box-shadow
:
none
;
}
#payment_form_adyen_cc
#adyen_cc_cc_owner
::placeholder
,
#payment_form_adyen_cc
#adyen_cc_cc_owner
:placeholder-shown
{
color
:
rgb
(
144
,
162
,
189
);
font-weight
:
200
;
}
#payment_form_adyen_cc
.cc-type-VI
{
margin
:
10px
;
display
:
inline-block
;
font-weight
:
bold
;
}
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