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
b1f76ea0
Commit
b1f76ea0
authored
Feb 26, 2016
by
rikterbeek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented Adyen POS
parent
45074486
Changes
35
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
1442 additions
and
108 deletions
+1442
-108
Block/Info/Pos.php
Block/Info/Pos.php
+33
-0
Block/Redirect/Pos.php
Block/Redirect/Pos.php
+107
-0
Block/Redirect/Redirect.php
Block/Redirect/Redirect.php
+1
-1
Block/Redirect/Validate3d.php
Block/Redirect/Validate3d.php
+1
-3
Controller/Process/Json.php
Controller/Process/Json.php
+7
-7
Controller/Process/RedirectPos.php
Controller/Process/RedirectPos.php
+111
-0
Controller/Process/Result.php
Controller/Process/Result.php
+11
-6
Controller/Process/ResultPos.php
Controller/Process/ResultPos.php
+264
-0
Helper/Data.php
Helper/Data.php
+24
-2
Model/AdyenCcConfigProvider.php
Model/AdyenCcConfigProvider.php
+0
-17
Model/AdyenGenericConfigProvider.php
Model/AdyenGenericConfigProvider.php
+126
-0
Model/AdyenHppConfigProvider.php
Model/AdyenHppConfigProvider.php
+0
-14
Model/AdyenOneclickConfigProvider.php
Model/AdyenOneclickConfigProvider.php
+0
-41
Model/Cron.php
Model/Cron.php
+1
-3
Model/Method/Hpp.php
Model/Method/Hpp.php
+13
-1
Model/Method/Pos.php
Model/Method/Pos.php
+421
-0
etc/adminhtml/system.xml
etc/adminhtml/system.xml
+1
-0
etc/adminhtml/system/adyen_pos.xml
etc/adminhtml/system/adyen_pos.xml
+77
-0
etc/config.xml
etc/config.xml
+13
-2
etc/frontend/di.xml
etc/frontend/di.xml
+1
-0
i18n/en_US.csv
i18n/en_US.csv
+3
-1
view/frontend/layout/adyen_process_redirect.xml
view/frontend/layout/adyen_process_redirect.xml
+1
-1
view/frontend/layout/adyen_process_redirectpos.xml
view/frontend/layout/adyen_process_redirectpos.xml
+29
-0
view/frontend/layout/adyen_process_validate3d.xml
view/frontend/layout/adyen_process_validate3d.xml
+1
-1
view/frontend/layout/checkout_index_index.xml
view/frontend/layout/checkout_index_index.xml
+1
-1
view/frontend/templates/info/adyen_hpp.phtml
view/frontend/templates/info/adyen_hpp.phtml
+1
-1
view/frontend/templates/info/adyen_pos.phtml
view/frontend/templates/info/adyen_pos.phtml
+34
-0
view/frontend/templates/redirect/cc/3dform.phtml
view/frontend/templates/redirect/cc/3dform.phtml
+0
-0
view/frontend/templates/redirect/hpp/form.phtml
view/frontend/templates/redirect/hpp/form.phtml
+0
-0
view/frontend/templates/redirect/pos/form.phtml
view/frontend/templates/redirect/pos/form.phtml
+37
-0
view/frontend/web/js/action/place-order.js
view/frontend/web/js/action/place-order.js
+1
-5
view/frontend/web/js/action/set-payment-method.js
view/frontend/web/js/action/set-payment-method.js
+1
-1
view/frontend/web/js/view/payment/adyen-methods.js
view/frontend/web/js/view/payment/adyen-methods.js
+4
-0
view/frontend/web/js/view/payment/method-renderer/adyen-pos-method.js
...d/web/js/view/payment/method-renderer/adyen-pos-method.js
+56
-0
view/frontend/web/template/payment/pos-form.html
view/frontend/web/template/payment/pos-form.html
+61
-0
No files found.
Block/Info/Pos.php
0 → 100755
View file @
b1f76ea0
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
namespace
Adyen\Payment\Block\Info
;
class
Pos
extends
AbstractInfo
{
/**
* @var string
*/
protected
$_template
=
'Adyen_Payment::info/adyen_pos.phtml'
;
}
Block/Redirect/Pos.php
0 → 100644
View file @
b1f76ea0
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
namespace
Adyen\Payment\Block\Redirect
;
use
Symfony\Component\Config\Definition\Exception\Exception
;
class
Pos
extends
\Magento\Payment\Block\Form
{
protected
$_orderFactory
;
/**
* @var \Magento\Checkout\Model\Session
*/
protected
$_checkoutSession
;
/**
* @var \Magento\Checkout\Model\Order
*/
protected
$_order
;
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param array $data
* @param \Magento\Sales\Model\OrderFactory $orderFactory
* @param \Magento\Checkout\Model\Session $checkoutSession
*/
public
function
__construct
(
\Magento\Framework\View\Element\Template\Context
$context
,
array
$data
=
[],
\Magento\Sales\Model\OrderFactory
$orderFactory
,
\Magento\Checkout\Model\Session
$checkoutSession
)
{
$this
->
_orderFactory
=
$orderFactory
;
$this
->
_checkoutSession
=
$checkoutSession
;
parent
::
__construct
(
$context
,
$data
);
$this
->
_getOrder
();
}
public
function
_prepareLayout
()
{
return
parent
::
_prepareLayout
();
}
public
function
getLaunchLink
()
{
$result
=
""
;
try
{
$order
=
$this
->
_order
;
if
(
$order
->
getPayment
())
{
$result
=
$this
->
_order
->
getPayment
()
->
getMethodInstance
()
->
getLaunchLink
();
}
}
catch
(
Exception
$e
)
{
// do nothing for now
throw
(
$e
);
}
return
$result
;
}
/**
* Get order object
*
* @return \Magento\Sales\Model\Order
*/
protected
function
_getOrder
()
{
if
(
!
$this
->
_order
)
{
$incrementId
=
$this
->
_getCheckout
()
->
getLastRealOrderId
();
$this
->
_order
=
$this
->
_orderFactory
->
create
()
->
loadByIncrementId
(
$incrementId
);
}
return
$this
->
_order
;
}
/**
* Get frontend checkout session object
*
* @return \Magento\Checkout\Model\Session
*/
protected
function
_getCheckout
()
{
return
$this
->
_checkoutSession
;
}
}
\ No newline at end of file
Block/Redirect.php
→
Block/Redirect
/Redirect
.php
View file @
b1f76ea0
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
* Author: Adyen <magento@adyen.com>
* Author: Adyen <magento@adyen.com>
*/
*/
namespace
Adyen\Payment\Block
;
namespace
Adyen\Payment\Block
\Redirect
;
use
Symfony\Component\Config\Definition\Exception\Exception
;
use
Symfony\Component\Config\Definition\Exception\Exception
;
...
...
Block/Validate3d.php
→
Block/
Redirect/
Validate3d.php
View file @
b1f76ea0
...
@@ -21,9 +21,7 @@
...
@@ -21,9 +21,7 @@
* Author: Adyen <magento@adyen.com>
* Author: Adyen <magento@adyen.com>
*/
*/
namespace
Adyen\Payment\Block
;
namespace
Adyen\Payment\Block\Redirect
;
use
Symfony\Component\Config\Definition\Exception\Exception
;
class
Validate3d
extends
\Magento\Payment\Block\Form
class
Validate3d
extends
\Magento\Payment\Block\Form
{
{
...
...
Controller/Process/Json.php
View file @
b1f76ea0
...
@@ -86,7 +86,7 @@ class Json extends \Magento\Framework\App\Action\Action
...
@@ -86,7 +86,7 @@ class Json extends \Magento\Framework\App\Action\Action
foreach
(
$notificationItems
[
'notificationItems'
]
as
$notificationItem
)
foreach
(
$notificationItems
[
'notificationItems'
]
as
$notificationItem
)
{
{
$status
=
$this
->
_processNotification
(
$notificationItem
[
'NotificationRequestItem'
],
$notificationMode
);
$status
=
$this
->
_processNotification
(
$notificationItem
[
'NotificationRequestItem'
],
$notificationMode
);
if
(
$status
==
"401"
)
{
if
(
$status
!=
true
)
{
$this
->
_return401
();
$this
->
_return401
();
return
;
return
;
}
}
...
@@ -138,9 +138,7 @@ class Json extends \Magento\Framework\App\Action\Action
...
@@ -138,9 +138,7 @@ class Json extends \Magento\Framework\App\Action\Action
{
{
// check if notificaiton already exists
// check if notificaiton already exists
if
(
!
$this
->
_isDuplicate
(
$response
))
{
if
(
!
$this
->
_isDuplicate
(
$response
))
{
try
{
try
{
$notification
=
$this
->
_objectManager
->
create
(
'Adyen\Payment\Model\Notification'
);
$notification
=
$this
->
_objectManager
->
create
(
'Adyen\Payment\Model\Notification'
);
if
(
isset
(
$response
[
'pspReference'
]))
{
if
(
isset
(
$response
[
'pspReference'
]))
{
...
@@ -182,15 +180,17 @@ class Json extends \Magento\Framework\App\Action\Action
...
@@ -182,15 +180,17 @@ class Json extends \Magento\Framework\App\Action\Action
$notification
->
save
();
$notification
->
save
();
return
true
;
}
catch
(
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
throw
new
\Magento\Framework\Exception\LocalizedException
(
__
(
$e
->
getMessage
()));
throw
new
\Magento\Framework\Exception\LocalizedException
(
__
(
$e
->
getMessage
()));
}
}
}
}
else
{
}
else
{
return
"401"
;
// duplicated so do nothing but return accepted to Adyen
}
return
true
;
return
true
;
}
}
}
return
false
;
}
/**
/**
...
...
Controller/Process/RedirectPos.php
0 → 100644
View file @
b1f76ea0
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
namespace
Adyen\Payment\Controller\Process
;
class
RedirectPos
extends
\Magento\Framework\App\Action\Action
{
/**
* @var \Magento\Quote\Model\Quote
*/
protected
$_quote
=
false
;
/**
* @var \Magento\Checkout\Model\Session
*/
protected
$_checkoutSession
;
/**
* @var \Magento\Sales\Model\Order
*/
protected
$_order
;
/**
* @var \Magento\Sales\Model\OrderFactory
*/
protected
$_orderFactory
;
/**
* @param \Magento\Framework\App\Action\Context $context
*/
public
function
__construct
(
\Magento\Framework\App\Action\Context
$context
)
{
parent
::
__construct
(
$context
);
}
/**
* Return checkout session object
*
* @return \Magento\Checkout\Model\Session
*/
protected
function
_getCheckoutSession
()
{
return
$this
->
_checkoutSession
;
}
public
function
execute
()
{
$this
->
_view
->
loadLayout
();
$this
->
_view
->
getLayout
()
->
initMessages
();
$this
->
_view
->
renderLayout
();
}
/**
* Get order object
*
* @return \Magento\Sales\Model\Order
*/
protected
function
_getOrder
()
{
if
(
!
$this
->
_order
)
{
$incrementId
=
$this
->
_getCheckout
()
->
getLastRealOrderId
();
$this
->
_orderFactory
=
$this
->
_objectManager
->
get
(
'Magento\Sales\Model\OrderFactory'
);
$this
->
_order
=
$this
->
_orderFactory
->
create
()
->
loadByIncrementId
(
$incrementId
);
}
return
$this
->
_order
;
}
/**
* @return \Magento\Checkout\Model\Session
*/
protected
function
_getCheckout
()
{
return
$this
->
_objectManager
->
get
(
'Magento\Checkout\Model\Session'
);
}
protected
function
_getQuote
()
{
return
$this
->
_objectManager
->
get
(
'Magento\Quote\Model\Quote'
);
}
protected
function
_getQuoteManagement
()
{
return
$this
->
_objectManager
->
get
(
'\Magento\Quote\Model\QuoteManagement'
);
}
}
\ No newline at end of file
Controller/Process/Result.php
View file @
b1f76ea0
...
@@ -87,6 +87,7 @@ class Result extends \Magento\Framework\App\Action\Action
...
@@ -87,6 +87,7 @@ class Result extends \Magento\Framework\App\Action\Action
$response
=
$this
->
getRequest
()
->
getParams
();
$response
=
$this
->
getRequest
()
->
getParams
();
$this
->
_adyenLogger
->
addAdyenResult
(
print_r
(
$response
,
true
));
$this
->
_adyenLogger
->
addAdyenResult
(
print_r
(
$response
,
true
));
if
(
$response
)
{
$result
=
$this
->
validateResponse
(
$response
);
$result
=
$this
->
validateResponse
(
$response
);
if
(
$result
)
{
if
(
$result
)
{
...
@@ -97,6 +98,10 @@ class Result extends \Magento\Framework\App\Action\Action
...
@@ -97,6 +98,10 @@ class Result extends \Magento\Framework\App\Action\Action
$this
->
_cancel
(
$response
);
$this
->
_cancel
(
$response
);
$this
->
_redirect
(
'checkout/cart'
);
$this
->
_redirect
(
'checkout/cart'
);
}
}
}
else
{
// redirect to checkout page
$this
->
_redirect
(
'checkout/cart'
);
}
}
}
protected
function
_cancel
(
$response
)
protected
function
_cancel
(
$response
)
...
...
Controller/Process/ResultPos.php
0 → 100644
View file @
b1f76ea0
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
namespace
Adyen\Payment\Controller\Process
;
class
ResultPos
extends
\Magento\Framework\App\Action\Action
{
/**
* @var \Adyen\Payment\Helper\Data
*/
protected
$_adyenHelper
;
/**
* @var \Magento\Sales\Model\OrderFactory
*/
protected
$_orderFactory
;
/**
* @var \Magento\Sales\Model\Order
*/
protected
$_order
;
/**
* @var \Magento\Sales\Model\Order\Status\HistoryFactory
*/
protected
$_orderHistoryFactory
;
/**
* @var \Magento\Checkout\Model\Session
*/
protected
$_session
;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
protected
$_adyenLogger
;
/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Sales\Model\OrderFactory $orderFactory
* @param \Magento\Sales\Model\Order\Status\HistoryFactory $orderHistoryFactory
* @param \Magento\Checkout\Model\Session $session
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
*/
public
function
__construct
(
\Magento\Framework\App\Action\Context
$context
,
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Magento\Sales\Model\OrderFactory
$orderFactory
,
\Magento\Sales\Model\Order\Status\HistoryFactory
$orderHistoryFactory
,
\Magento\Checkout\Model\Session
$session
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
)
{
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_orderFactory
=
$orderFactory
;
$this
->
_orderHistoryFactory
=
$orderHistoryFactory
;
$this
->
_session
=
$session
;
$this
->
_adyenLogger
=
$adyenLogger
;
parent
::
__construct
(
$context
);
}
public
function
execute
()
{
$response
=
$this
->
getRequest
()
->
getParams
();
$this
->
_adyenLogger
->
addAdyenResult
(
print_r
(
$response
,
true
));
$result
=
$this
->
_validateResponse
(
$response
);
if
(
$result
)
{
$session
=
$this
->
_session
;
$session
->
getQuote
()
->
setIsActive
(
false
)
->
save
();
$this
->
_redirect
(
'checkout/onepage/success'
);
}
else
{
$this
->
_cancel
(
$response
);
$this
->
_redirect
(
'checkout/cart'
);
}
}
private
function
_validateResponse
(
$response
)
{
$result
=
false
;
if
(
$response
!=
null
&&
$response
[
'result'
]
!=
""
&&
$this
->
_validateChecksum
(
$response
))
{
$incrementId
=
$response
[
'merchantReference'
];
$responseResult
=
$response
[
'result'
];
if
(
$incrementId
)
{
$order
=
$this
->
_getOrder
(
$incrementId
);
if
(
$order
->
getId
())
{
$comment
=
__
(
'%1 <br /> Result: %2 <br /> paymentMethod: %3'
,
'Adyen App Result URL Notification:'
,
$responseResult
,
'POS'
);
if
(
$responseResult
==
'APPROVED'
)
{
$this
->
_adyenLogger
->
addAdyenResult
(
'Result is approved'
);
$history
=
$this
->
_orderHistoryFactory
->
create
()
//->setStatus($status)
->
setComment
(
$comment
)
->
setEntityName
(
'order'
)
->
setOrder
(
$order
)
;
$history
->
save
();
// needed becuase then we need to save $order objects
$order
->
setAdyenResulturlEventCode
(
"POS_APPROVED"
);
// save order
$order
->
save
();
return
true
;
}
else
{
$this
->
_adyenLogger
->
addAdyenResult
(
'Result is:'
.
$responseResult
);
$history
=
$this
->
_orderHistoryFactory
->
create
()
//->setStatus($status)
->
setComment
(
$comment
)
->
setEntityName
(
'order'
)
->
setOrder
(
$order
)
;
$history
->
save
();
// cancel the order
if
(
$order
->
canCancel
())
{
$order
->
cancel
()
->
save
();
$this
->
_adyenLogger
->
addAdyenResult
(
'Order is cancelled'
);
}
else
{
$this
->
_adyenLogger
->
addAdyenResult
(
'Order can not be cancelled'
);
}
}
}
else
{
$this
->
_adyenLogger
->
addAdyenResult
(
'Order does not exists with increment_id: '
.
$incrementId
);
}
}
else
{
$this
->
_adyenLogger
->
addAdyenResult
(
'Empty merchantReference'
);
}
}
else
{
$this
->
_adyenLogger
->
addAdyenResult
(
'actionName or checksum failed or response is empty'
);
}
return
$result
;
}
protected
function
_validateChecksum
(
$response
)
{
$checksum
=
$response
[
'cs'
];
$result
=
$response
[
'result'
];
$amount
=
$response
[
'originalCustomAmount'
];
$currency
=
$response
[
'originalCustomCurrency'
];
$sessionId
=
$response
[
'sessionId'
];
// for android sessionis is with low i
if
(
$sessionId
==
""
)
{
$sessionId
=
$response
[
'sessionid'
];
}
// calculate amount checksum
$amount_checksum
=
0
;
$amountLength
=
strlen
(
$amount
);
for
(
$i
=
0
;
$i
<
$amountLength
;
$i
++
)
{
// ASCII value use ord
$checksumCalc
=
ord
(
$amount
[
$i
])
-
48
;
$amount_checksum
+=
$checksumCalc
;
}
$currency_checksum
=
0
;
$currencyLength
=
strlen
(
$currency
);
for
(
$i
=
0
;
$i
<
$currencyLength
;
$i
++
)
{
$checksumCalc
=
ord
(
$currency
[
$i
])
-
64
;
$currency_checksum
+=
$checksumCalc
;
}
$result_checksum
=
0
;
$resultLength
=
strlen
(
$result
);
for
(
$i
=
0
;
$i
<
$resultLength
;
$i
++
)
{
$checksumCalc
=
ord
(
$result
[
$i
])
-
64
;
$result_checksum
+=
$checksumCalc
;
}
$sessionId_checksum
=
0
;
$sessionIdLength
=
strlen
(
$sessionId
);
for
(
$i
=
0
;
$i
<
$sessionIdLength
;
$i
++
)
{
$checksumCalc
=
$this
->
_getAscii2Int
(
$sessionId
[
$i
]);
$sessionId_checksum
+=
$checksumCalc
;
}
$total_result_checksum
=
((
$amount_checksum
+
$currency_checksum
+
$result_checksum
)
*
$sessionId_checksum
)
%
100
;
// check if request is valid
if
(
$total_result_checksum
==
$checksum
)
{
$this
->
_adyenLogger
->
addAdyenResult
(
'Checksum is valid'
);
return
true
;
}
$this
->
_adyenLogger
->
addAdyenResult
(
'Checksum is invalid!'
);
return
false
;
}
protected
function
_getAscii2Int
(
$ascii
)
{
if
(
is_numeric
(
$ascii
)){
$int
=
ord
(
$ascii
)
-
48
;
}
else
{
$int
=
ord
(
$ascii
)
-
64
;
}
return
$int
;
}
protected
function
_getOrder
(
$incrementId
)
{
if
(
!
$this
->
_order
)
{
$this
->
_order
=
$this
->
_orderFactory
->
create
()
->
loadByIncrementId
(
$incrementId
);
}
return
$this
->
_order
;
}
protected
function
_cancel
(
$response
)
{
$session
=
$this
->
_session
;
// restore the quote
$session
->
restoreQuote
();
$order
=
$this
->
_order
;
if
(
$order
)
{
$this
->
_adyenHelper
->
cancelOrder
(
$order
);
if
(
isset
(
$response
[
'authResult'
])
&&
$response
[
'authResult'
]
==
\Adyen\Payment\Model\Notification
::
CANCELLED
)
{
$this
->
messageManager
->
addError
(
__
(
'You have cancelled the order. Please try again'
));
}
else
{
$this
->
messageManager
->
addError
(
__
(
'Your payment failed, Please try again later'
));
}
}
}
}
\ No newline at end of file
Helper/Data.php
View file @
b1f76ea0
...
@@ -263,7 +263,7 @@ class Data extends AbstractHelper
...
@@ -263,7 +263,7 @@ class Data extends AbstractHelper
}
}
/**
/**
* @desc Gives back adyen_
hpp
configuration values
* @desc Gives back adyen_
oneclick
configuration values
* @param $field
* @param $field
* @param null $storeId
* @param null $storeId
* @return mixed
* @return mixed
...
@@ -274,7 +274,7 @@ class Data extends AbstractHelper
...
@@ -274,7 +274,7 @@ class Data extends AbstractHelper
}
}
/**
/**
* @desc Gives back adyen_
hpp
configuration values as flag
* @desc Gives back adyen_
oneclick
configuration values as flag
* @param $field
* @param $field
* @param null $storeId
* @param null $storeId
* @return mixed
* @return mixed
...
@@ -284,6 +284,28 @@ class Data extends AbstractHelper
...
@@ -284,6 +284,28 @@ class Data extends AbstractHelper
return
$this
->
getConfigData
(
$field
,
'adyen_oneclick'
,
$storeId
,
true
);
return
$this
->
getConfigData
(
$field
,
'adyen_oneclick'
,
$storeId
,
true
);
}
}
/**
* @desc Gives back adyen_pos configuration values
* @param $field
* @param null $storeId
* @return mixed
*/
public
function
getAdyenPosConfigData
(
$field
,
$storeId
=
null
)
{
return
$this
->
getConfigData
(
$field
,
'adyen_pos'
,
$storeId
);
}
/**
* @desc Gives back adyen_pos configuration values as flag
* @param $field
* @param null $storeId
* @return mixed
*/
public
function
getAdyenPosConfigDataFlag
(
$field
,
$storeId
=
null
)
{
return
$this
->
getConfigData
(
$field
,
'adyen_pos'
,
$storeId
,
true
);
}
/**
/**
* @desc Retrieve decrypted hmac key
* @desc Retrieve decrypted hmac key
* @return string
* @return string
...
...
Model/AdyenCcConfigProvider.php
View file @
b1f76ea0
...
@@ -109,26 +109,9 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider
...
@@ -109,26 +109,9 @@ class AdyenCcConfigProvider extends CcGenericConfigProvider
$config
[
'payment'
][
'adyenCc'
][
'creditCardPaymentMethodIcon'
]
=
$this
->
_getCreditCardPaymentMethodIcon
();
$config
[
'payment'
][
'adyenCc'
][
'creditCardPaymentMethodIcon'
]
=
$this
->
_getCreditCardPaymentMethodIcon
();
}
}
foreach
(
$this
->
methodCodes
as
$code
)
{
if
(
$this
->
methods
[
$code
]
->
isAvailable
())
{
$config
[
'payment'
][
'adyenCc'
][
'redirectUrl'
][
$code
]
=
$this
->
getMethodRedirectUrl
(
$code
);
}
}
return
$config
;
return
$config
;
}
}
/**
* Return redirect URL for method
*
* @param string $code
* @return mixed
*/
protected
function
getMethodRedirectUrl
(
$code
)
{
return
$this
->
methods
[
$code
]
->
getCheckoutRedirectUrl
();
}
protected
function
_getCreditCardPaymentMethodIcon
()
protected
function
_getCreditCardPaymentMethodIcon
()
{
{
$asset
=
$this
->
_genericConfig
->
createAsset
(
'Adyen_Payment::images/logos/img_trans.gif'
);
$asset
=
$this
->
_genericConfig
->
createAsset
(
'Adyen_Payment::images/logos/img_trans.gif'
);
...
...
Model/AdyenGenericConfigProvider.php
0 → 100644
View file @
b1f76ea0
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
namespace
Adyen\Payment\Model
;
use
Magento\Checkout\Model\ConfigProviderInterface
;
use
Magento\Payment\Helper\Data
as
PaymentHelper
;
class
AdyenGenericConfigProvider
implements
ConfigProviderInterface
{
/**
* @var RequestInterface
*/
protected
$request
;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected
$_adyenHelper
;
/**
* @var \Magento\Payment\Model\Method\AbstractMethod[]
*/
protected
$methods
=
[];
/**
* @var string[]
*/
protected
$methodCodes
=
[
'adyen_cc'
,
'adyen_hpp'
,
'adyen_oneclick'
,
'adyen_pos'
];
/**
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Checkout\Model\Session $session
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param PaymentHelper $paymentHelper
* @param \Magento\Framework\Locale\ResolverInterface $localeResolver
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param AdyenGenericConfig $genericConfig
*/
public
function
__construct
(
\Magento\Framework\Model\Context
$context
,
\Magento\Checkout\Model\Session
$session
,
\Magento\Store\Model\StoreManagerInterface
$storeManager
,
PaymentHelper
$paymentHelper
,
\Magento\Framework\Locale\ResolverInterface
$localeResolver
,
\Magento\Framework\App\Config\ScopeConfigInterface
$config
,
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
,
\Adyen\Payment\Model\AdyenGenericConfig
$genericConfig
)
{
$this
->
_appState
=
$context
->
getAppState
();
$this
->
_session
=
$session
;
$this
->
_storeManager
=
$storeManager
;
$this
->
_paymentHelper
=
$paymentHelper
;
$this
->
_localeResolver
=
$localeResolver
;
$this
->
_config
=
$config
;
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_adyenLogger
=
$adyenLogger
;
$this
->
_genericConfig
=
$genericConfig
;
foreach
(
$this
->
methodCodes
as
$code
)
{
$this
->
methods
[
$code
]
=
$this
->
_paymentHelper
->
getMethodInstance
(
$code
);
}
}
/**
* Define foreach payment methods the RedirectUrl
*
* @return array
*/
public
function
getConfig
()
{
$config
=
[
'payment'
=>
[]
];
foreach
(
$this
->
methodCodes
as
$code
)
{
if
(
$this
->
methods
[
$code
]
->
isAvailable
())
{
$config
[
'payment'
][
$code
]
=
[
'redirectUrl'
=>
$this
->
getMethodRedirectUrl
(
$code
)
];
}
}
return
$config
;
}
/**
* Return redirect URL for method
*
* @param string $code
* @return mixed
*/
protected
function
getMethodRedirectUrl
(
$code
)
{
return
$this
->
methods
[
$code
]
->
getCheckoutRedirectUrl
();
}
}
\ No newline at end of file
Model/AdyenHppConfigProvider.php
View file @
b1f76ea0
...
@@ -135,10 +135,7 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
...
@@ -135,10 +135,7 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
];
];
foreach
(
$this
->
methodCodes
as
$code
)
{
foreach
(
$this
->
methodCodes
as
$code
)
{
if
(
$this
->
methods
[
$code
]
->
isAvailable
())
{
if
(
$this
->
methods
[
$code
]
->
isAvailable
())
{
$config
[
'payment'
][
'adyenHpp'
][
'redirectUrl'
][
$code
]
=
$this
->
getMethodRedirectUrl
(
$code
);
// get payment methods
// get payment methods
$config
[
'payment'
]
[
'adyenHpp'
][
'paymentMethods'
]
=
$this
->
getAdyenHppPaymentMethods
();
$config
[
'payment'
]
[
'adyenHpp'
][
'paymentMethods'
]
=
$this
->
getAdyenHppPaymentMethods
();
}
}
}
}
...
@@ -149,17 +146,6 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
...
@@ -149,17 +146,6 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
return
$config
;
return
$config
;
}
}
/**
* Return redirect URL for method
*
* @param string $code
* @return mixed
*/
protected
function
getMethodRedirectUrl
(
$code
)
{
return
$this
->
methods
[
$code
]
->
getCheckoutRedirectUrl
();
}
public
function
getAdyenHppPaymentMethods
()
public
function
getAdyenHppPaymentMethods
()
{
{
...
...
Model/AdyenOneclickConfigProvider.php
View file @
b1f76ea0
...
@@ -144,7 +144,6 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
...
@@ -144,7 +144,6 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
foreach
(
$this
->
methodCodes
as
$code
)
{
foreach
(
$this
->
methodCodes
as
$code
)
{
if
(
$this
->
methods
[
$code
]
->
isAvailable
())
{
if
(
$this
->
methods
[
$code
]
->
isAvailable
())
{
$config
[
'payment'
][
'adyenOneclick'
][
'redirectUrl'
][
$code
]
=
$this
->
getMethodRedirectUrl
(
$code
);
$config
[
'payment'
]
[
'adyenOneclick'
][
'billingAgreements'
]
=
$this
->
getAdyenOneclickPaymentMethods
();
$config
[
'payment'
]
[
'adyenOneclick'
][
'billingAgreements'
]
=
$this
->
getAdyenOneclickPaymentMethods
();
$recurringContractType
=
$this
->
_getRecurringContractType
();
$recurringContractType
=
$this
->
_getRecurringContractType
();
...
@@ -154,24 +153,12 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
...
@@ -154,24 +153,12 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
}
else
{
}
else
{
$config
[
'payment'
]
[
'adyenOneclick'
][
'hasCustomerInteraction'
]
=
false
;
$config
[
'payment'
]
[
'adyenOneclick'
][
'hasCustomerInteraction'
]
=
false
;
}
}
$config
[
'payment'
][
'adyenOneclick'
][
'redirectUrl'
][
$code
]
=
$this
->
getMethodRedirectUrl
(
$code
);
}
}
}
}
return
$config
;
return
$config
;
}
}
/**
* Return redirect URL for method
*
* @param string $code
* @return mixed
*/
protected
function
getMethodRedirectUrl
(
$code
)
{
return
$this
->
methods
[
$code
]
->
getCheckoutRedirectUrl
();
}
public
function
getAdyenOneclickPaymentMethods
()
public
function
getAdyenOneclickPaymentMethods
()
{
{
...
@@ -233,34 +220,6 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
...
@@ -233,34 +220,6 @@ class AdyenOneclickConfigProvider extends CcGenericConfigProvider
return
$billingAgreements
;
return
$billingAgreements
;
}
}
/**
* @param Adyen_Payment_Model_Billing_Agreement $billingAgreement
* @param Mage_Core_Model_Store $store
*
* @return bool
*/
protected
function
_createPaymentMethodFromBA
(
$billingAgreement
,
$store
)
{
$methodInstance
=
$billingAgreement
->
getPaymentMethodInstance
();
if
(
!
$methodInstance
||
!
$methodInstance
->
getConfigData
(
'active'
,
$store
))
{
return
false
;
}
$methodNewCode
=
'adyen_oneclick_'
.
$billingAgreement
->
getReferenceId
();
$methodData
=
array
(
'model'
=>
'adyen/adyen_oneclick'
)
+
$billingAgreement
->
getOneClickData
()
+
Mage
::
getStoreConfig
(
'payment/adyen_oneclick'
,
$store
);
foreach
(
$methodData
as
$key
=>
$value
)
{
$store
->
setConfig
(
'payment/'
.
$methodNewCode
.
'/'
.
$key
,
$value
);
}
return
true
;
}
protected
function
_getRecurringContractType
()
protected
function
_getRecurringContractType
()
{
{
return
$this
->
_adyenHelper
->
getAdyenOneclickConfigData
(
'recurring_payment_type'
);
return
$this
->
_adyenHelper
->
getAdyenOneclickConfigData
(
'recurring_payment_type'
);
...
...
Model/Cron.php
View file @
b1f76ea0
...
@@ -168,7 +168,6 @@ class Cron
...
@@ -168,7 +168,6 @@ class Cron
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
"START OF THE CRONJOB"
);
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
"START OF THE CRONJOB"
);
//fixme somehow the created_at is saved in my timzone
$dateStart
=
new
\DateTime
();
$dateStart
=
new
\DateTime
();
// execute notifications from 2 minute or earlier because order could not yet been created by magento
// execute notifications from 2 minute or earlier because order could not yet been created by magento
...
@@ -666,7 +665,6 @@ class Cron
...
@@ -666,7 +665,6 @@ class Cron
}
}
}
}
if
(
$contractDetail
!=
null
)
{
if
(
$contractDetail
!=
null
)
{
// update status of all the current saved agreements in magento
// update status of all the current saved agreements in magento
...
@@ -829,7 +827,7 @@ class Cron
...
@@ -829,7 +827,7 @@ class Cron
// only do this if status in configuration is set
// only do this if status in configuration is set
if
(
!
empty
(
$status
))
{
if
(
!
empty
(
$status
))
{
$this
->
_order
->
addStatusHistoryComment
(
__
(
'Payment is
pre
authorised waiting for capture'
),
$status
);
$this
->
_order
->
addStatusHistoryComment
(
__
(
'Payment is authorised waiting for capture'
),
$status
);
$this
->
_debugData
[
'_setPrePaymentAuthorized'
]
=
'Order status is changed to Pre-authorised status, status is '
.
$status
;
$this
->
_debugData
[
'_setPrePaymentAuthorized'
]
=
'Order status is changed to Pre-authorised status, status is '
.
$status
;
}
else
{
}
else
{
$this
->
_debugData
[
'_setPrePaymentAuthorized'
]
=
'No pre-authorised status is used so ignore'
;
$this
->
_debugData
[
'_setPrePaymentAuthorized'
]
=
'No pre-authorised status is used so ignore'
;
...
...
Model/Method/Hpp.php
View file @
b1f76ea0
...
@@ -120,6 +120,7 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
...
@@ -120,6 +120,7 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
*/
public
function
__construct
(
public
function
__construct
(
\Magento\Framework\App\RequestInterface
$request
,
\Adyen\Payment\Model\Api\PaymentRequest
$paymentRequest
,
\Adyen\Payment\Model\Api\PaymentRequest
$paymentRequest
,
\Magento\Framework\UrlInterface
$urlBuilder
,
\Magento\Framework\UrlInterface
$urlBuilder
,
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Adyen\Payment\Helper\Data
$adyenHelper
,
...
@@ -155,6 +156,7 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
...
@@ -155,6 +156,7 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
$this
->
storeManager
=
$storeManager
;
$this
->
storeManager
=
$storeManager
;
$this
->
resolver
=
$resolver
;
$this
->
resolver
=
$resolver
;
$this
->
_adyenLogger
=
$adyenLogger
;
$this
->
_adyenLogger
=
$adyenLogger
;
$this
->
_request
=
$request
;
}
}
protected
$_paymentMethodType
=
'hpp'
;
protected
$_paymentMethodType
=
'hpp'
;
...
@@ -211,7 +213,17 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
...
@@ -211,7 +213,17 @@ class Hpp extends \Magento\Payment\Model\Method\AbstractMethod implements Gatewa
*/
*/
public
function
getCheckoutRedirectUrl
()
public
function
getCheckoutRedirectUrl
()
{
{
return
$this
->
_urlBuilder
->
getUrl
(
'adyen/process/redirect'
);
return
$this
->
_urlBuilder
->
getUrl
(
'adyen/process/redirect'
,[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]);
}
/**
* Retrieve request object
*
* @return \Magento\Framework\App\RequestInterface
*/
protected
function
_getRequest
()
{
return
$this
->
_request
;
}
}
...
...
Model/Method/Pos.php
0 → 100755
View file @
b1f76ea0
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
namespace
Adyen\Payment\Model\Method
;
use
Magento\Framework\DataObject
;
use
Magento\Payment\Model\Method\ConfigInterface
;
use
Magento\Payment\Model\Method\Online\GatewayInterface
;
/**
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
* @SuppressWarnings(PHPMD.TooManyFields)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class
Pos
extends
\Magento\Payment\Model\Method\AbstractMethod
implements
GatewayInterface
{
const
METHOD_CODE
=
'adyen_pos'
;
/**
* @var string
*/
protected
$_code
=
self
::
METHOD_CODE
;
/**
* @var GUEST_ID , used when order is placed by guests
*/
const
GUEST_ID
=
'customer_'
;
protected
$_infoBlockType
=
'Adyen\Payment\Block\Info\Pos'
;
/**
* Payment Method feature
*
* @var bool
*/
protected
$_isGateway
=
true
;
protected
$_canAuthorize
=
true
;
protected
$_isInitializeNeeded
=
true
;
protected
$_canRefund
=
true
;
protected
$_canRefundInvoicePartial
=
true
;
/**
* Payment Method feature
*
* @var bool
*/
protected
$_canUseInternal
=
false
;
/**
* @var \Adyen\Payment\Model\Api\PaymentRequest
*/
protected
$_paymentRequest
;
/**
* @var \Adyen\Payment\Helper\Data
*/
protected
$_adyenHelper
;
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected
$storeManager
;
/**
* @var \Magento\Framework\UrlInterface
*/
protected
$_urlBuilder
;
/**
* @var ResolverInterface
*/
protected
$resolver
;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
protected
$_adyenLogger
;
/**
* Currency factory
*
* @var CurrencyFactory
*/
protected
$_currencyFactory
;
/**
* @param \Adyen\Payment\Model\Api\PaymentRequest $paymentRequest
* @param \Magento\Framework\UrlInterface $urlBuilder
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\Locale\ResolverInterface $resolver
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory
* @param \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory
* @param \Magento\Payment\Helper\Data $paymentData
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Payment\Model\Method\Logger $logger
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
* @param array $data
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public
function
__construct
(
\Magento\Directory\Model\CurrencyFactory
$currencyFactory
,
\Magento\Framework\App\RequestInterface
$request
,
\Adyen\Payment\Model\Api\PaymentRequest
$paymentRequest
,
\Magento\Framework\UrlInterface
$urlBuilder
,
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Magento\Store\Model\StoreManagerInterface
$storeManager
,
\Magento\Framework\Locale\ResolverInterface
$resolver
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
,
\Magento\Framework\Model\Context
$context
,
\Magento\Framework\Registry
$registry
,
\Magento\Framework\Api\ExtensionAttributesFactory
$extensionFactory
,
\Magento\Framework\Api\AttributeValueFactory
$customAttributeFactory
,
\Magento\Payment\Helper\Data
$paymentData
,
\Magento\Framework\App\Config\ScopeConfigInterface
$scopeConfig
,
\Magento\Payment\Model\Method\Logger
$logger
,
\Magento\Framework\Model\ResourceModel\AbstractResource
$resource
=
null
,
\Magento\Framework\Data\Collection\AbstractDb
$resourceCollection
=
null
,
array
$data
=
[]
)
{
parent
::
__construct
(
$context
,
$registry
,
$extensionFactory
,
$customAttributeFactory
,
$paymentData
,
$scopeConfig
,
$logger
,
$resource
,
$resourceCollection
,
$data
);
$this
->
_paymentRequest
=
$paymentRequest
;
$this
->
_urlBuilder
=
$urlBuilder
;
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
storeManager
=
$storeManager
;
$this
->
resolver
=
$resolver
;
$this
->
_adyenLogger
=
$adyenLogger
;
$this
->
_request
=
$request
;
$this
->
_currencyFactory
=
$currencyFactory
;
}
protected
$_paymentMethodType
=
'hpp'
;
public
function
getPaymentMethodType
()
{
return
$this
->
_paymentMethodType
;
}
public
function
initialize
(
$paymentAction
,
$stateObject
)
{
/*
* do not send order confirmation mail after order creation wait for
* Adyen AUTHORIISATION notification
*/
$payment
=
$this
->
getInfoInstance
();
$order
=
$payment
->
getOrder
();
$order
->
setCanSendNewEmailFlag
(
false
);
$state
=
\Magento\Sales\Model\Order
::
STATE_NEW
;
$stateObject
->
setState
(
$state
);
$stateObject
->
setStatus
(
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'order_status'
));
}
/**
* Assign data to info model instance
*
* @param \Magento\Framework\DataObject|mixed $data
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public
function
assignData
(
\Magento\Framework\DataObject
$data
)
{
parent
::
assignData
(
$data
);
$infoInstance
=
$this
->
getInfoInstance
();
return
$this
;
}
/**
* Checkout redirect URL getter for onepage checkout (hardcode)
*
* @see \Magento\Checkout\Controller\Onepage::savePaymentAction()
* @see \Magento\Quote\Model\Quote\Payment::getCheckoutRedirectUrl()
* @return string
*/
public
function
getCheckoutRedirectUrl
()
{
return
$this
->
_urlBuilder
->
getUrl
(
'adyen/process/redirectPos'
,[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]);
}
/**
* Retrieve request object
*
* @return \Magento\Framework\App\RequestInterface
*/
protected
function
_getRequest
()
{
return
$this
->
_request
;
}
/**
* Post request to gateway and return response
*
* @param Object $request
* @param ConfigInterface $config
*
* @return Object
*
* @throws \Exception
*/
public
function
postRequest
(
DataObject
$request
,
ConfigInterface
$config
)
{
// Implement postRequest() method.
}
public
function
getLaunchLink
()
{
$paymentInfo
=
$this
->
getInfoInstance
();
$order
=
$paymentInfo
->
getOrder
();
$realOrderId
=
$order
->
getRealOrderId
();
$orderCurrencyCode
=
$order
->
getOrderCurrencyCode
();
$amount
=
$this
->
_adyenHelper
->
formatAmount
(
$order
->
getGrandTotal
(),
$orderCurrencyCode
);
$shopperEmail
=
$order
->
getCustomerEmail
();
$customerId
=
$order
->
getCustomerId
();
$callbackUrl
=
$this
->
_urlBuilder
->
getUrl
(
'adyen/process/resultpos'
,[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]);
$addReceiptOrderLines
=
$this
->
_adyenHelper
->
getAdyenPosConfigData
(
"add_receipt_order_lines"
);
$recurringContract
=
$this
->
_adyenHelper
->
getAdyenPosConfigData
(
'recurring_type'
);
$currencyCode
=
$orderCurrencyCode
;
$paymentAmount
=
$amount
;
$merchantReference
=
$realOrderId
;
$shopperReference
=
(
!
empty
(
$customerId
))
?
$customerId
:
self
::
GUEST_ID
.
$realOrderId
;
$shopperEmail
=
$shopperEmail
;
$recurringParams
=
""
;
if
(
$order
->
getPayment
()
->
getAdditionalInformation
(
"store_cc"
)
!=
""
)
{
$recurringParams
=
"&recurringContract="
.
urlencode
(
$recurringContract
)
.
"&shopperReference="
.
urlencode
(
$shopperReference
)
.
"&shopperEmail="
.
urlencode
(
$shopperEmail
);
}
$receiptOrderLines
=
""
;
if
(
$addReceiptOrderLines
)
{
$orderLines
=
base64_encode
(
$this
->
getReceiptOrderLines
(
$order
));
$receiptOrderLines
=
"&receiptOrderLines="
.
urlencode
(
$orderLines
);
}
// extra parameters so that you alway's return these paramters from the application
$extra_paramaters
=
urlencode
(
"/?originalCustomCurrency="
.
$currencyCode
.
"&originalCustomAmount="
.
$paymentAmount
.
"&originalCustomMerchantReference="
.
$merchantReference
.
"&originalCustomSessionId="
.
session_id
());
$launchlink
=
"adyen://payment?sessionId="
.
session_id
()
.
"&amount="
.
$paymentAmount
.
"¤cy="
.
$currencyCode
.
"&merchantReference="
.
$merchantReference
.
$recurringParams
.
$receiptOrderLines
.
"&callback="
.
$callbackUrl
.
$extra_paramaters
;
$this
->
_adyenLogger
->
debug
(
print_r
(
$launchlink
,
true
));
return
$launchlink
;
}
private
function
getReceiptOrderLines
(
$order
)
{
$myReceiptOrderLines
=
""
;
// temp
$currency
=
$order
->
getOrderCurrencyCode
();
$formattedAmountValue
=
$this
->
_currencyFactory
->
create
()
->
format
(
$order
->
getGrandTotal
(),
array
(
'display'
=>
\Magento\Framework\Currency
::
NO_SYMBOL
),
false
);
$taxAmount
=
$order
->
getTaxAmount
();
$formattedTaxAmount
=
$this
->
_currencyFactory
->
create
()
->
format
(
$taxAmount
,
array
(
'display'
=>
\Magento\Framework\Currency
::
NO_SYMBOL
),
false
);
$paymentAmount
=
"1000"
;
$myReceiptOrderLines
.=
"---||C
\n
"
.
"====== YOUR ORDER DETAILS ======||CB
\n
"
.
"---||C
\n
"
.
" No. Description |Piece Subtotal|
\n
"
;
foreach
(
$order
->
getItemsCollection
()
as
$item
)
{
//skip dummies
if
(
$item
->
isDummy
())
continue
;
$singlePriceFormat
=
$this
->
_currencyFactory
->
create
()
->
format
(
$item
->
getPriceInclTax
(),
array
(
'display'
=>
\Magento\Framework\Currency
::
NO_SYMBOL
),
false
);
$itemAmount
=
$item
->
getPriceInclTax
()
*
(
int
)
$item
->
getQtyOrdered
();
$itemAmountFormat
=
$this
->
_currencyFactory
->
create
()
->
format
(
$itemAmount
,
array
(
'display'
=>
\Magento\Framework\Currency
::
NO_SYMBOL
),
false
);
$myReceiptOrderLines
.=
" "
.
(
int
)
$item
->
getQtyOrdered
()
.
" "
.
trim
(
substr
(
$item
->
getName
(),
0
,
25
))
.
"| "
.
$currency
.
" "
.
$singlePriceFormat
.
" "
.
$currency
.
" "
.
$itemAmountFormat
.
"|
\n
"
;
}
//discount cost
if
(
$order
->
getDiscountAmount
()
>
0
||
$order
->
getDiscountAmount
()
<
0
)
{
$discountAmountFormat
=
$this
->
_currencyFactory
->
create
()
->
format
(
$order
->
getDiscountAmount
(),
array
(
'display'
=>
\Magento\Framework\Currency
::
NO_SYMBOL
),
false
);
$myReceiptOrderLines
.=
" "
.
1
.
" "
.
$this
->
__
(
'Total Discount'
)
.
"| "
.
$currency
.
" "
.
$discountAmountFormat
.
"|
\n
"
;
}
//shipping cost
if
(
$order
->
getShippingAmount
()
>
0
||
$order
->
getShippingTaxAmount
()
>
0
)
{
$shippingAmountFormat
=
$this
->
_currencyFactory
->
create
()
->
format
(
$order
->
getShippingAmount
(),
array
(
'display'
=>
\Magento\Framework\Currency
::
NO_SYMBOL
),
false
);
$myReceiptOrderLines
.=
" "
.
1
.
" "
.
$order
->
getShippingDescription
()
.
"| "
.
$currency
.
" "
.
$shippingAmountFormat
.
"|
\n
"
;
}
if
(
$order
->
getPaymentFeeAmount
()
>
0
)
{
$paymentFeeAmount
=
$this
->
_currencyFactory
->
create
()
->
format
(
$order
->
getPaymentFeeAmount
(),
array
(
'display'
=>
\Magento\Framework\Currency
::
NO_SYMBOL
),
false
);
$myReceiptOrderLines
.=
" "
.
1
.
" "
.
$this
->
__
(
'Payment Fee'
)
.
"| "
.
$currency
.
" "
.
$paymentFeeAmount
.
"|
\n
"
;
}
$myReceiptOrderLines
.=
"|--------|
\n
"
.
"|Order Total: "
.
$currency
.
" "
.
$formattedAmountValue
.
"|B
\n
"
.
"|Tax: "
.
$currency
.
" "
.
$formattedTaxAmount
.
"|B
\n
"
.
"||C
\n
"
;
//Cool new header for card details section! Default location is After Header so simply add to Order Details as separator
$myReceiptOrderLines
.=
"---||C
\n
"
.
"====== YOUR PAYMENT DETAILS ======||CB
\n
"
.
"---||C
\n
"
;
return
$myReceiptOrderLines
;
}
/**
* Capture on Adyen
*
* @param \Magento\Payment\Model\InfoInterface $payment
* @param float $amount
*/
public
function
capture
(
\Magento\Payment\Model\InfoInterface
$payment
,
$amount
)
{
parent
::
capture
(
$payment
,
$amount
);
$this
->
_paymentRequest
->
capture
(
$payment
,
$amount
);
return
$this
;
}
/**
* Refund specified amount for payment
*
* @param \Magento\Framework\DataObject|InfoInterface $payment
* @param float $amount
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
* @api
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public
function
refund
(
\Magento\Payment\Model\InfoInterface
$payment
,
$amount
)
{
parent
::
refund
(
$payment
,
$amount
);
// get pspReference
$pspReference
=
$payment
->
getAdyenPspReference
();
$order
=
$payment
->
getOrder
();
// if amount is a full refund send a refund/cancelled request so if it is not captured yet it will cancel the order
$grandTotal
=
$order
->
getGrandTotal
();
if
(
$grandTotal
==
$amount
)
{
$this
->
_paymentRequest
->
cancelOrRefund
(
$payment
);
}
else
{
$this
->
_paymentRequest
->
refund
(
$payment
,
$amount
);
}
return
$this
;
}
}
\ No newline at end of file
etc/adminhtml/system.xml
View file @
b1f76ea0
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
<include
path=
"Adyen_Payment::system/adyen_cc.xml"
/>
<include
path=
"Adyen_Payment::system/adyen_cc.xml"
/>
<include
path=
"Adyen_Payment::system/adyen_oneclick.xml"
/>
<include
path=
"Adyen_Payment::system/adyen_oneclick.xml"
/>
<include
path=
"Adyen_Payment::system/adyen_hpp.xml"
/>
<include
path=
"Adyen_Payment::system/adyen_hpp.xml"
/>
<include
path=
"Adyen_Payment::system/adyen_pos.xml"
/>
</group>
</group>
<group
id=
"test"
translate=
"label"
type=
"text"
sortOrder=
"30"
showInDefault=
"1"
showInWebsite=
"1"
showInStore=
"1"
>
<group
id=
"test"
translate=
"label"
type=
"text"
sortOrder=
"30"
showInDefault=
"1"
showInWebsite=
"1"
showInStore=
"1"
>
<label>
Test
</label>
<label>
Test
</label>
...
...
etc/adminhtml/system/adyen_pos.xml
0 → 100755
View file @
b1f76ea0
<?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>
*/
-->
<include
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:module:Magento_Config:etc/system_include.xsd"
>
<group
id=
"adyen_pos"
translate=
"label"
type=
"text"
sortOrder=
"300"
showInDefault=
"1"
showInWebsite=
"1"
showInStore=
"1"
>
<label>
<![CDATA[Point of Sale (POS) integration]]>
</label>
<frontend_model>
Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment
</frontend_model>
<fieldset_css>
adyen-method-adyen-cc
</fieldset_css>
<comment>
Process Point of Sales transactions
</comment>
<field
id=
"active"
translate=
"label"
type=
"select"
sortOrder=
"10"
showInDefault=
"1"
showInWebsite=
"1"
showInStore=
"1"
>
<label>
Enabled
</label>
<source_model>
Magento\Config\Model\Config\Source\Yesno
</source_model>
<config_path>
payment/adyen_pos/active
</config_path>
</field>
<field
id=
"title"
translate=
"label"
type=
"text"
sortOrder=
"20"
showInDefault=
"1"
showInWebsite=
"1"
showInStore=
"1"
>
<label>
Title
</label>
<config_path>
payment/adyen_pos/title
</config_path>
</field>
<field
id=
"sort_order"
translate=
"label"
type=
"text"
sortOrder=
"30"
showInDefault=
"1"
showInWebsite=
"1"
showInStore=
"0"
>
<label>
Sort Order
</label>
<frontend_class>
validate-number
</frontend_class>
<config_path>
payment/adyen_pos/sort_order
</config_path>
</field>
<field
id=
"recurring_type"
translate=
"label"
type=
"select"
sortOrder=
"40"
showInDefault=
"1"
showInWebsite=
"1"
showInStore=
"1"
>
<label>
Agreement Type
</label>
<tooltip>
You can set different value for POS because you have to have the permission of the customer
</tooltip>
<source_model>
Adyen\Payment\Model\Config\Source\RecurringType
</source_model>
<config_path>
payment/adyen_pos/recurring_type
</config_path>
</field>
<group
id=
"adyen_pos_advanced_settings"
translate=
"label"
showInDefault=
"1"
showInWebsite=
"1"
sortOrder=
"200"
>
<label>
Advanced Settings
</label>
<frontend_model>
Magento\Config\Block\System\Config\Form\Fieldset
</frontend_model>
<field
id=
"add_receipt_order_lines"
translate=
"label"
type=
"select"
sortOrder=
"10"
showInDefault=
"1"
showInWebsite=
"1"
showInStore=
"1"
>
<label>
Add orderlines to receipt
</label>
<tooltip>
If you have the Adyen App configured to print to an external printer the orderlines can be printed on to the receipt if you turn this option on.
</tooltip>
<source_model>
Magento\Config\Model\Config\Source\Yesno
</source_model>
<config_path>
payment/adyen_pos/add_receipt_order_lines
</config_path>
</field>
</group>
<group
id=
"adyen_pos_country_specific"
translate=
"label"
showInDefault=
"1"
showInWebsite=
"1"
sortOrder=
"210"
>
<label>
Country Specific Settings
</label>
<frontend_model>
Magento\Config\Block\System\Config\Form\Fieldset
</frontend_model>
<field
id=
"allowspecific"
translate=
"label"
type=
"allowspecific"
sortOrder=
"40"
showInDefault=
"1"
showInWebsite=
"1"
showInStore=
"0"
>
<label>
Payment from Applicable Countries
</label>
<source_model>
Magento\Payment\Model\Config\Source\Allspecificcountries
</source_model>
<config_path>
payment/adyen_pos/allowspecific
</config_path>
</field>
<field
id=
"specificcountry"
translate=
"label"
type=
"multiselect"
sortOrder=
"50"
showInDefault=
"1"
showInWebsite=
"1"
showInStore=
"0"
>
<label>
Payment from Specific Countries
</label>
<source_model>
Magento\Directory\Model\Config\Source\Country
</source_model>
<can_be_empty>
1
</can_be_empty>
<config_path>
payment/adyen_pos/specificcountry
</config_path>
</field>
</group>
</group>
</include>
\ No newline at end of file
etc/config.xml
View file @
b1f76ea0
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
<model>
Adyen\Payment\Model\Method\Cc
</model>
<model>
Adyen\Payment\Model\Method\Cc
</model>
<title>
Adyen CreditCard
</title>
<title>
Adyen CreditCard
</title>
<allowspecific>
0
</allowspecific>
<allowspecific>
0
</allowspecific>
<sort_order>
1
</sort_order>
<sort_order>
2
</sort_order>
<cctypes>
AE,VI,MC,DI
</cctypes>
<cctypes>
AE,VI,MC,DI
</cctypes>
<useccv>
1
</useccv>
<useccv>
1
</useccv>
<cse_enabled>
1
</cse_enabled>
<cse_enabled>
1
</cse_enabled>
...
@@ -67,11 +67,22 @@
...
@@ -67,11 +67,22 @@
<payment_routine>
single
</payment_routine>
<payment_routine>
single
</payment_routine>
<delivery_days>
5
</delivery_days>
<delivery_days>
5
</delivery_days>
<allowspecific>
0
</allowspecific>
<allowspecific>
0
</allowspecific>
<sort_order>
10
</sort_order>
<sort_order>
3
</sort_order>
<place_order_url>
adyen/process/redirect
</place_order_url>
<place_order_url>
adyen/process/redirect
</place_order_url>
<order_place_redirect_url>
adyen/process/redirect
</order_place_redirect_url>
<order_place_redirect_url>
adyen/process/redirect
</order_place_redirect_url>
<group>
adyen
</group>
<group>
adyen
</group>
</adyen_hpp>
</adyen_hpp>
<adyen_pos>
<active>
0
</active>
<model>
Adyen\Payment\Model\Method\Pos
</model>
<order_status>
pending
</order_status>
<title>
Adyen POS
</title>
<allowspecific>
0
</allowspecific>
<sort_order>
4
</sort_order>
<place_order_url>
adyen/process/redirect
</place_order_url>
<order_place_redirect_url>
adyen/process/redirect
</order_place_redirect_url>
<group>
adyen
</group>
</adyen_pos>
</payment>
</payment>
</default>
</default>
</config>
</config>
etc/frontend/di.xml
View file @
b1f76ea0
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
<type
name=
"Magento\Checkout\Model\CompositeConfigProvider"
>
<type
name=
"Magento\Checkout\Model\CompositeConfigProvider"
>
<arguments>
<arguments>
<argument
name=
"configProviders"
xsi:type=
"array"
>
<argument
name=
"configProviders"
xsi:type=
"array"
>
<item
name=
"adyen_generic_config_provider"
xsi:type=
"object"
>
Adyen\Payment\Model\AdyenGenericConfigProvider
</item>
<item
name=
"adyen_cc_config_provider"
xsi:type=
"object"
>
Adyen\Payment\Model\AdyenCcConfigProvider
</item>
<item
name=
"adyen_cc_config_provider"
xsi:type=
"object"
>
Adyen\Payment\Model\AdyenCcConfigProvider
</item>
<item
name=
"adyen_oneclick_config_provider"
xsi:type=
"object"
>
Adyen\Payment\Model\AdyenOneclickConfigProvider
</item>
<item
name=
"adyen_oneclick_config_provider"
xsi:type=
"object"
>
Adyen\Payment\Model\AdyenOneclickConfigProvider
</item>
<item
name=
"adyen_hpp_config_provider"
xsi:type=
"object"
>
Adyen\Payment\Model\AdyenHppConfigProvider
</item>
<item
name=
"adyen_hpp_config_provider"
xsi:type=
"object"
>
Adyen\Payment\Model\AdyenHppConfigProvider
</item>
...
...
i18n/en_US.csv
View file @
b1f76ea0
...
@@ -49,3 +49,5 @@
...
@@ -49,3 +49,5 @@
"The expiry month is not set. Please check your expiry month!","The expiry month is not set. Please check your expiry month!"
"The expiry month is not set. Please check your expiry month!","The expiry month is not set. Please check your expiry month!"
"The payment is REFUSED","The payment is REFUSED"
"The payment is REFUSED","The payment is REFUSED"
"Failed to disable this contract","Failed to disable this contract"
"Failed to disable this contract","Failed to disable this contract"
"You will be redirected to the Adyen App", "You will be redirected to the Adyen App"
"Continue to Adyen App", "Continue to Adyen App"
\ No newline at end of file
view/frontend/layout/adyen_process_redirect.xml
View file @
b1f76ea0
...
@@ -24,6 +24,6 @@
...
@@ -24,6 +24,6 @@
-->
-->
<layout
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:View/Layout/etc/layout_generic.xsd"
>
<layout
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:View/Layout/etc/layout_generic.xsd"
>
<container
name=
"root"
>
<container
name=
"root"
>
<block
class=
"Adyen\Payment\Block\Redirect
"
name=
"adyen-form"
template=
"
form.phtml"
cacheable=
"false"
/>
<block
class=
"Adyen\Payment\Block\Redirect
\Redirect"
name=
"adyen-hpp-redirect-form"
template=
"redirect/hpp/
form.phtml"
cacheable=
"false"
/>
</container>
</container>
</layout>
</layout>
\ No newline at end of file
view/frontend/layout/adyen_process_redirectpos.xml
0 → 100644
View file @
b1f76ea0
<?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>
*/
-->
<layout
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:View/Layout/etc/layout_generic.xsd"
>
<container
name=
"root"
>
<block
class=
"Adyen\Payment\Block\Redirect\Pos"
name=
"adyen-pos-redirect-form"
template=
"redirect/pos/form.phtml"
cacheable=
"false"
/>
</container>
</layout>
\ No newline at end of file
view/frontend/layout/adyen_process_validate3d.xml
View file @
b1f76ea0
...
@@ -24,6 +24,6 @@
...
@@ -24,6 +24,6 @@
-->
-->
<layout
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:View/Layout/etc/layout_generic.xsd"
>
<layout
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:View/Layout/etc/layout_generic.xsd"
>
<container
name=
"root"
>
<container
name=
"root"
>
<block
class=
"Adyen\Payment\Block\
Validate3d"
name=
"adyen-form-validate3d"
template=
"
3dform.phtml"
cacheable=
"false"
/>
<block
class=
"Adyen\Payment\Block\
Redirect\Validate3d"
name=
"adyen-cc-form-validate3d"
template=
"redirect/cc/
3dform.phtml"
cacheable=
"false"
/>
</container>
</container>
</layout>
</layout>
\ No newline at end of file
view/frontend/layout/checkout_index_index.xml
View file @
b1f76ea0
...
@@ -44,7 +44,7 @@
...
@@ -44,7 +44,7 @@
<!-- merge payment method renders here -->
<!-- merge payment method renders here -->
<item
name=
"children"
xsi:type=
"array"
>
<item
name=
"children"
xsi:type=
"array"
>
<item
name=
"adyen_payment"
xsi:type=
"array"
>
<item
name=
"adyen_payment"
xsi:type=
"array"
>
<item
name=
"component"
xsi:type=
"string"
>
Adyen_Payment/js/view/payment/
cc-method
</item>
<item
name=
"component"
xsi:type=
"string"
>
Adyen_Payment/js/view/payment/
adyen-methods
</item>
<item
name=
"methods"
xsi:type=
"array"
>
<item
name=
"methods"
xsi:type=
"array"
>
<item
name=
"adyen_oneclick"
xsi:type=
"array"
>
<item
name=
"adyen_oneclick"
xsi:type=
"array"
>
<item
name=
"isBillingAddressRequired"
xsi:type=
"boolean"
>
true
</item>
<item
name=
"isBillingAddressRequired"
xsi:type=
"boolean"
>
true
</item>
...
...
view/frontend/templates/info/adyen_hpp.phtml
View file @
b1f76ea0
...
@@ -33,7 +33,7 @@ $_info = $this->getInfo();
...
@@ -33,7 +33,7 @@ $_info = $this->getInfo();
<dl
class=
"payment-method adyen_hpp"
>
<dl
class=
"payment-method adyen_hpp"
>
<?php
if
(
$paymentSelectionOnAdyen
)
:
?>
<?php
if
(
$paymentSelectionOnAdyen
)
:
?>
<?php
echo
$this
->
htmlEscape
(
$this
->
getMethod
()
->
getTitle
())
?>
<br/>
<?php
echo
$this
->
escapeHtml
(
$this
->
getMethod
()
->
getTitle
())
?>
<br/>
<dt
class=
"title"
>
<?php
echo
$block
->
escapeHtml
(
$block
->
getMethod
()
->
getTitle
())
?>
</dt>
<dt
class=
"title"
>
<?php
echo
$block
->
escapeHtml
(
$block
->
getMethod
()
->
getTitle
())
?>
</dt>
<?php
else
:
?>
<?php
else
:
?>
...
...
view/frontend/templates/info/adyen_pos.phtml
0 → 100644
View file @
b1f76ea0
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
// @codingStandardsIgnoreFile
?>
<?php
$_info
=
$this
->
getInfo
();
?>
<dl
class=
"payment-method adyen_pos"
>
<?php
echo
$this
->
escapeHtml
(
$this
->
getMethod
()
->
getTitle
())
?>
<br/>
<dt
class=
"title"
>
<?php
echo
$block
->
escapeHtml
(
$block
->
getMethod
()
->
getTitle
())
?>
</dt>
</dl>
view/frontend/templates/3dform.phtml
→
view/frontend/templates/
redirect/cc/
3dform.phtml
View file @
b1f76ea0
File moved
view/frontend/templates/form.phtml
→
view/frontend/templates/
redirect/hpp/
form.phtml
View file @
b1f76ea0
File moved
view/frontend/templates/redirect/pos/form.phtml
0 → 100755
View file @
b1f76ea0
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
?>
<html>
<head>
</head>
<body>
<a
id=
"adyen-pos-launchlink"
href=
"
<?php
echo
$block
->
getLaunchLink
();
?>
"
>
Continue
</a>
<script>
document
.
getElementById
(
'
adyen-pos-launchlink
'
).
click
();
</script>
</body>
</html>
view/frontend/web/js/action/place-order.js
View file @
b1f76ea0
...
@@ -66,11 +66,7 @@ define(
...
@@ -66,11 +66,7 @@ define(
).
done
(
).
done
(
function
()
{
function
()
{
if
(
redirectOnSuccess
)
{
if
(
redirectOnSuccess
)
{
if
(
quote
.
paymentMethod
().
method
==
'
adyen_oneclick
'
)
{
window
.
location
.
replace
(
url
.
build
(
window
.
checkoutConfig
.
payment
[
quote
.
paymentMethod
().
method
].
redirectUrl
));
window
.
location
.
replace
(
url
.
build
(
window
.
checkoutConfig
.
payment
.
adyenOneclick
.
redirectUrl
[
quote
.
paymentMethod
().
method
]));
}
else
{
window
.
location
.
replace
(
url
.
build
(
window
.
checkoutConfig
.
payment
.
adyenCc
.
redirectUrl
[
quote
.
paymentMethod
().
method
]));
}
}
}
}
}
).
fail
(
).
fail
(
...
...
view/frontend/web/js/action/set-payment-method.js
View file @
b1f76ea0
...
@@ -81,7 +81,7 @@ define(
...
@@ -81,7 +81,7 @@ define(
serviceUrl
,
JSON
.
stringify
(
payload
)
serviceUrl
,
JSON
.
stringify
(
payload
)
).
done
(
).
done
(
function
()
{
function
()
{
$
.
mage
.
redirect
(
window
.
checkoutConfig
.
payment
.
adyenHpp
.
redirectUrl
[
quote
.
paymentMethod
().
method
]
);
$
.
mage
.
redirect
(
window
.
checkoutConfig
.
payment
[
quote
.
paymentMethod
().
method
].
redirectUrl
);
}
}
).
fail
(
).
fail
(
function
(
response
)
{
function
(
response
)
{
...
...
view/frontend/web/js/view/payment/
cc-method
.js
→
view/frontend/web/js/view/payment/
adyen-methods
.js
View file @
b1f76ea0
...
@@ -43,6 +43,10 @@ define(
...
@@ -43,6 +43,10 @@ define(
{
{
type
:
'
adyen_hpp
'
,
type
:
'
adyen_hpp
'
,
component
:
'
Adyen_Payment/js/view/payment/method-renderer/adyen-hpp-method
'
component
:
'
Adyen_Payment/js/view/payment/method-renderer/adyen-hpp-method
'
},
{
type
:
'
adyen_pos
'
,
component
:
'
Adyen_Payment/js/view/payment/method-renderer/adyen-pos-method
'
}
}
);
);
/** Add view logic here if needed */
/** Add view logic here if needed */
...
...
view/frontend/web/js/view/payment/method-renderer/adyen-pos-method.js
0 → 100755
View file @
b1f76ea0
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
/*browser:true*/
/*global define*/
define
(
[
'
ko
'
,
'
Magento_Checkout/js/view/payment/default
'
,
'
Adyen_Payment/js/action/set-payment-method
'
],
function
(
ko
,
Component
,
setPaymentMethodAction
)
{
'
use strict
'
;
var
brandCode
=
ko
.
observable
(
null
);
var
paymentMethod
=
ko
.
observable
(
null
);
return
Component
.
extend
({
self
:
this
,
defaults
:
{
template
:
'
Adyen_Payment/payment/pos-form
'
,
brandCode
:
''
},
initObservable
:
function
()
{
this
.
_super
()
.
observe
([
]);
return
this
;
},
/** Redirect to adyen */
continueToAdyen
:
function
()
{
//update payment method information if additional data was changed
this
.
selectPaymentMethod
();
setPaymentMethodAction
();
return
false
;
}
});
}
);
view/frontend/web/template/payment/pos-form.html
0 → 100755
View file @
b1f76ea0
<!--
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* 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>
*/
-->
<div
class=
"payment-method"
data-bind=
"css: {'_active': (getCode() == isChecked())}"
>
<div
class=
"payment-method-title field choice"
>
<input
type=
"radio"
name=
"payment[method]"
class=
"radio"
data-bind=
"attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()"
/>
<label
data-bind=
"attr: {'for': getCode()}"
class=
"label"
><span
data-bind=
"text: getTitle()"
></span></label>
</div>
<div
class=
"payment-method-content"
>
<div
class=
"payment-method-billing-address"
>
<!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<fieldset
class=
"fieldset"
data-bind=
'attr: {id: "payment_form_" + getCode()}'
>
<div
class=
"payment-method-note"
>
<!-- ko text: $t('You will be redirected to the Adyen App.') --><!-- /ko -->
</div>
</fieldset>
<div
class=
"checkout-agreements-block"
>
<!-- ko foreach: $parent.getRegion('before-place-order') -->
<!-- ko template: getTemplate() --><!-- /ko -->
<!--/ko-->
</div>
<div
class=
"actions-toolbar"
>
<div
class=
"primary"
>
<button
class=
"action primary checkout"
type=
"submit"
data-bind=
"click: continueToAdyen, enable: (getCode() == isChecked())"
disabled
>
<span
data-bind=
"text: $t('Continue to Adyen App')"
></span>
</button>
</div>
</div>
</div>
</div>
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