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
165cb2b2
Commit
165cb2b2
authored
Dec 11, 2018
by
Rik ter Beek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
autofix code style + two fixed errors setting the right exception class file
parent
305271ec
Changes
126
Hide whitespace changes
Inline
Side-by-side
Showing
126 changed files
with
570 additions
and
552 deletions
+570
-552
AdminMessage/CronMessage.php
AdminMessage/CronMessage.php
+5
-4
AdminMessage/VersionMessage.php
AdminMessage/VersionMessage.php
+2
-6
Api/AdyenPaymentMethodManagementInterface.php
Api/AdyenPaymentMethodManagementInterface.php
+0
-1
Api/AdyenRequestMerchantSessionInterface.php
Api/AdyenRequestMerchantSessionInterface.php
+1
-3
Api/Data/InvoiceInterface.php
Api/Data/InvoiceInterface.php
+1
-2
Api/Data/NotificationInterface.php
Api/Data/NotificationInterface.php
+1
-1
Api/Data/OrderPaymentInterface.php
Api/Data/OrderPaymentInterface.php
+1
-2
Api/GuestAdyenPaymentMethodManagementInterface.php
Api/GuestAdyenPaymentMethodManagementInterface.php
+0
-1
Block/Adminhtml/System/Config/Field/Installments.php
Block/Adminhtml/System/Config/Field/Installments.php
+1
-2
Block/Adminhtml/System/Config/Field/Version.php
Block/Adminhtml/System/Config/Field/Version.php
+1
-1
Block/Checkout/Success.php
Block/Checkout/Success.php
+1
-1
Block/Form/ApplePay.php
Block/Form/ApplePay.php
+2
-4
Block/Form/Boleto.php
Block/Form/Boleto.php
+1
-2
Block/Form/Cc.php
Block/Form/Cc.php
+2
-3
Block/Form/Oneclick.php
Block/Form/Oneclick.php
+1
-3
Block/Form/PayByMail.php
Block/Form/PayByMail.php
+1
-3
Block/Form/PosCloud.php
Block/Form/PosCloud.php
+0
-1
Block/Form/Sepa.php
Block/Form/Sepa.php
+1
-1
Block/Info/AbstractInfo.php
Block/Info/AbstractInfo.php
+2
-3
Block/Info/ApplePay.php
Block/Info/ApplePay.php
+1
-1
Block/Info/Boleto.php
Block/Info/Boleto.php
+0
-1
Block/Info/PayByMail.php
Block/Info/PayByMail.php
+0
-1
Block/Info/Pos.php
Block/Info/Pos.php
+0
-1
Block/Info/PosCloud.php
Block/Info/PosCloud.php
+0
-1
Block/Info/Sepa.php
Block/Info/Sepa.php
+0
-1
Block/Redirect/Pos.php
Block/Redirect/Pos.php
+9
-10
Block/Redirect/Redirect.php
Block/Redirect/Redirect.php
+36
-33
Block/Redirect/Validate3d.php
Block/Redirect/Validate3d.php
+4
-3
Controller/Process/Json.php
Controller/Process/Json.php
+4
-9
Controller/Process/Redirect.php
Controller/Process/Redirect.php
+1
-1
Controller/Process/RedirectPos.php
Controller/Process/RedirectPos.php
+1
-1
Controller/Process/Result.php
Controller/Process/Result.php
+14
-14
Controller/Process/ResultPos.php
Controller/Process/ResultPos.php
+9
-10
Controller/Process/Validate3d.php
Controller/Process/Validate3d.php
+3
-5
Gateway/Command/HppCommand.php
Gateway/Command/HppCommand.php
+3
-3
Gateway/Command/PayByMailCommand.php
Gateway/Command/PayByMailCommand.php
+0
-1
Gateway/Command/PosCommand.php
Gateway/Command/PosCommand.php
+1
-1
Gateway/Http/Client/TransactionAuthorization.php
Gateway/Http/Client/TransactionAuthorization.php
+2
-2
Gateway/Http/Client/TransactionCancel.php
Gateway/Http/Client/TransactionCancel.php
+3
-3
Gateway/Http/Client/TransactionCapture.php
Gateway/Http/Client/TransactionCapture.php
+3
-3
Gateway/Http/Client/TransactionPosCloudSync.php
Gateway/Http/Client/TransactionPosCloudSync.php
+10
-11
Gateway/Http/Client/TransactionRefund.php
Gateway/Http/Client/TransactionRefund.php
+3
-4
Gateway/Http/TransferFactory.php
Gateway/Http/TransferFactory.php
+1
-1
Gateway/Request/AddressDataBuilder.php
Gateway/Request/AddressDataBuilder.php
+1
-3
Gateway/Request/ApplePayAuthorizationDataBuilder.php
Gateway/Request/ApplePayAuthorizationDataBuilder.php
+2
-4
Gateway/Request/Authorize3DSecureDataBuilder.php
Gateway/Request/Authorize3DSecureDataBuilder.php
+1
-1
Gateway/Request/BoletoAuthorizationDataBuilder.php
Gateway/Request/BoletoAuthorizationDataBuilder.php
+5
-3
Gateway/Request/BrowserInfoDataBuilder.php
Gateway/Request/BrowserInfoDataBuilder.php
+1
-1
Gateway/Request/CancelDataBuilder.php
Gateway/Request/CancelDataBuilder.php
+2
-2
Gateway/Request/CaptureDataBuilder.php
Gateway/Request/CaptureDataBuilder.php
+1
-1
Gateway/Request/CcAuthorizationDataBuilder.php
Gateway/Request/CcAuthorizationDataBuilder.php
+2
-3
Gateway/Request/CustomerDataBuilder.php
Gateway/Request/CustomerDataBuilder.php
+1
-1
Gateway/Request/MerchantAccountDataBuilder.php
Gateway/Request/MerchantAccountDataBuilder.php
+1
-1
Gateway/Request/OneclickAuthorizationDataBuilder.php
Gateway/Request/OneclickAuthorizationDataBuilder.php
+1
-1
Gateway/Request/PaymentDataBuilder.php
Gateway/Request/PaymentDataBuilder.php
+2
-2
Gateway/Request/RecurringDataBuilder.php
Gateway/Request/RecurringDataBuilder.php
+2
-2
Gateway/Request/RefundDataBuilder.php
Gateway/Request/RefundDataBuilder.php
+2
-5
Gateway/Request/SepaAuthorizationDataBuilder.php
Gateway/Request/SepaAuthorizationDataBuilder.php
+1
-1
Gateway/Response/PaymentAuthorisationDetailsHandler.php
Gateway/Response/PaymentAuthorisationDetailsHandler.php
+1
-2
Gateway/Response/PaymentCancelDetailsHandler.php
Gateway/Response/PaymentCancelDetailsHandler.php
+1
-1
Gateway/Response/PaymentCaptureDetailsHandler.php
Gateway/Response/PaymentCaptureDetailsHandler.php
+1
-1
Gateway/Response/PaymentCommentHistoryHandler.php
Gateway/Response/PaymentCommentHistoryHandler.php
+6
-4
Gateway/Response/PaymentCommentHistoryRefundHandler.php
Gateway/Response/PaymentCommentHistoryRefundHandler.php
+6
-4
Gateway/Response/PaymentPosCloudHandler.php
Gateway/Response/PaymentPosCloudHandler.php
+4
-5
Gateway/Response/PaymentRefundDetailsHandler.php
Gateway/Response/PaymentRefundDetailsHandler.php
+1
-1
Gateway/Validator/CancelResponseValidator.php
Gateway/Validator/CancelResponseValidator.php
+1
-1
Gateway/Validator/CaptureResponseValidator.php
Gateway/Validator/CaptureResponseValidator.php
+1
-1
Gateway/Validator/GeneralResponseValidator.php
Gateway/Validator/GeneralResponseValidator.php
+3
-3
Gateway/Validator/InstallmentValidator.php
Gateway/Validator/InstallmentValidator.php
+0
-1
Gateway/Validator/PosCloudResponseValidator.php
Gateway/Validator/PosCloudResponseValidator.php
+7
-9
Gateway/Validator/RefundResponseValidator.php
Gateway/Validator/RefundResponseValidator.php
+1
-1
Gateway/Validator/SepaValidator.php
Gateway/Validator/SepaValidator.php
+2
-3
Helper/Data.php
Helper/Data.php
+121
-100
Helper/PaymentMethods.php
Helper/PaymentMethods.php
+3
-3
Logger/AdyenLogger.php
Logger/AdyenLogger.php
+6
-6
Logger/Handler/AdyenBase.php
Logger/Handler/AdyenBase.php
+1
-1
Logger/Handler/AdyenCronjob.php
Logger/Handler/AdyenCronjob.php
+0
-1
Logger/Handler/AdyenDebug.php
Logger/Handler/AdyenDebug.php
+0
-1
Logger/Handler/AdyenError.php
Logger/Handler/AdyenError.php
+0
-1
Logger/Handler/AdyenInfo.php
Logger/Handler/AdyenInfo.php
+0
-1
Logger/Handler/AdyenNotification.php
Logger/Handler/AdyenNotification.php
+0
-1
Logger/Handler/AdyenResult.php
Logger/Handler/AdyenResult.php
+1
-2
Model/AdyenInitiateTerminalApi.php
Model/AdyenInitiateTerminalApi.php
+28
-21
Model/AdyenPaymentMethodManagement.php
Model/AdyenPaymentMethodManagement.php
+1
-2
Model/AdyenRequestMerchantSession.php
Model/AdyenRequestMerchantSession.php
+5
-6
Model/Api/PaymentRequest.php
Model/Api/PaymentRequest.php
+11
-11
Model/Billing/Agreement.php
Model/Billing/Agreement.php
+17
-13
Model/Config/Backend/Installments.php
Model/Config/Backend/Installments.php
+0
-1
Model/Config/Source/ApplePayShippingType.php
Model/Config/Source/ApplePayShippingType.php
+3
-3
Model/Config/Source/CaptureMode.php
Model/Config/Source/CaptureMode.php
+1
-1
Model/Config/Source/DemoMode.php
Model/Config/Source/DemoMode.php
+1
-1
Model/Config/Source/RecurringType.php
Model/Config/Source/RecurringType.php
+1
-2
Model/Config/Source/SepaFlow.php
Model/Config/Source/SepaFlow.php
+1
-2
Model/Config/Source/SplitPaymentRefundStrategy.php
Model/Config/Source/SplitPaymentRefundStrategy.php
+0
-1
Model/Cron.php
Model/Cron.php
+92
-64
Model/Gender.php
Model/Gender.php
+1
-1
Model/GuestAdyenPaymentMethodManagement.php
Model/GuestAdyenPaymentMethodManagement.php
+1
-1
Model/Invoice.php
Model/Invoice.php
+2
-4
Model/Method/Adapter.php
Model/Method/Adapter.php
+1
-2
Model/Notification.php
Model/Notification.php
+2
-3
Model/Order/Payment.php
Model/Order/Payment.php
+2
-3
Model/RecurringType.php
Model/RecurringType.php
+4
-3
Model/ResourceModel/Billing/Agreement.php
Model/ResourceModel/Billing/Agreement.php
+1
-1
Model/ResourceModel/Invoice.php
Model/ResourceModel/Invoice.php
+1
-1
Model/ResourceModel/Invoice/Collection.php
Model/ResourceModel/Invoice/Collection.php
+1
-2
Model/ResourceModel/Notification.php
Model/ResourceModel/Notification.php
+2
-2
Model/ResourceModel/Notification/Collection.php
Model/ResourceModel/Notification/Collection.php
+1
-1
Model/ResourceModel/Order/Payment.php
Model/ResourceModel/Order/Payment.php
+1
-1
Model/Ui/AdyenApplePayConfigProvider.php
Model/Ui/AdyenApplePayConfigProvider.php
+4
-2
Model/Ui/AdyenBoletoConfigProvider.php
Model/Ui/AdyenBoletoConfigProvider.php
+4
-2
Model/Ui/AdyenCcConfigProvider.php
Model/Ui/AdyenCcConfigProvider.php
+5
-4
Model/Ui/AdyenGenericConfigProvider.php
Model/Ui/AdyenGenericConfigProvider.php
+3
-2
Model/Ui/AdyenHppConfigProvider.php
Model/Ui/AdyenHppConfigProvider.php
+6
-6
Model/Ui/AdyenOneclickConfigProvider.php
Model/Ui/AdyenOneclickConfigProvider.php
+5
-4
Model/Ui/AdyenPayByMailConfigProvider.php
Model/Ui/AdyenPayByMailConfigProvider.php
+4
-2
Model/Ui/AdyenPosCloudConfigProvider.php
Model/Ui/AdyenPosCloudConfigProvider.php
+3
-1
Model/Ui/AdyenPosConfigProvider.php
Model/Ui/AdyenPosConfigProvider.php
+4
-2
Model/Ui/AdyenSepaConfigProvider.php
Model/Ui/AdyenSepaConfigProvider.php
+4
-2
Observer/Adminhtml/BeforeShipmentObserver.php
Observer/Adminhtml/BeforeShipmentObserver.php
+6
-8
Observer/AdyenHppDataAssignObserver.php
Observer/AdyenHppDataAssignObserver.php
+1
-1
Observer/AdyenOneclickDataAssignObserver.php
Observer/AdyenOneclickDataAssignObserver.php
+0
-2
Setup/InstallSchema.php
Setup/InstallSchema.php
+1
-1
Setup/UpgradeSchema.php
Setup/UpgradeSchema.php
+10
-5
registration.php
registration.php
+1
-1
view/frontend/templates/checkout/success.phtml
view/frontend/templates/checkout/success.phtml
+1
-1
view/frontend/templates/redirect/hpp/form.phtml
view/frontend/templates/redirect/hpp/form.phtml
+3
-3
No files found.
AdminMessage/CronMessage.php
View file @
165cb2b2
...
...
@@ -80,7 +80,6 @@ class CronMessage implements \Magento\Framework\Notification\MessageInterface
}
else
{
return
false
;
}
}
/**
...
...
@@ -93,8 +92,11 @@ class CronMessage implements \Magento\Framework\Notification\MessageInterface
$message
=
__
(
'You have '
.
$this
->
_cronCheck
.
' unprocessed notification(s). Please check your Cron'
);
$urlMagento
=
"http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html"
;
$urlAdyen
=
"https://docs.adyen.com/developers/plug-ins-and-partners/magento/magento-2/configuring-the-adyen-plug-in"
;
$message
.=
__
(
' and visit <a href="%1">Magento DevDocs</a> and <a href="%2">Adyen Docs</a> on how to configure Cron.'
,
$urlMagento
,
$urlAdyen
);
$message
.=
__
(
' and visit <a href="%1">Magento DevDocs</a> and <a href="%2">Adyen Docs</a> on how to configure Cron.'
,
$urlMagento
,
$urlAdyen
);
$message
.=
__
(
'<i> Last cron check was: %1</i> '
,
$this
->
_dateChecked
->
format
(
'd/m/Y H:i:s'
));
return
__
(
$message
);
}
...
...
@@ -125,4 +127,3 @@ class CronMessage implements \Magento\Framework\Notification\MessageInterface
return
$this
->
_authSession
->
getData
(
$key
,
$remove
);
}
}
AdminMessage/VersionMessage.php
View file @
165cb2b2
...
...
@@ -64,18 +64,17 @@ class VersionMessage implements \Magento\Framework\Notification\MessageInterface
{
// Only execute the query the first time you access the Admin page
if
(
$this
->
_authSession
->
isFirstPageAfterLogin
())
{
try
{
$githubContent
=
$this
->
getDecodedContentFromGithub
();
$this
->
setSessionData
(
"AdyenGithubVersion"
,
$githubContent
);
$title
=
"Adyen extension version "
.
$githubContent
[
'tag_name'
]
.
" available!"
;
$versionData
[]
=
array
(
$versionData
[]
=
[
'severity'
=>
self
::
SEVERITY_NOTICE
,
'date_added'
=>
$githubContent
[
'published_at'
],
'title'
=>
$title
,
'description'
=>
$githubContent
[
'body'
],
'url'
=>
$githubContent
[
'html_url'
],
)
;
]
;
/*
* The parse function checks if the $versionData message exists in the inbox,
...
...
@@ -95,7 +94,6 @@ class VersionMessage implements \Magento\Framework\Notification\MessageInterface
}
}
return
false
;
}
/**
...
...
@@ -150,6 +148,4 @@ class VersionMessage implements \Magento\Framework\Notification\MessageInterface
{
return
$this
->
_authSession
->
getData
(
$key
,
$remove
);
}
}
Api/AdyenPaymentMethodManagementInterface.php
View file @
165cb2b2
...
...
@@ -40,5 +40,4 @@ interface AdyenPaymentMethodManagementInterface
* @return \Magento\Checkout\Api\Data\PaymentDetailsInterface
*/
public
function
getPaymentMethods
(
$cartId
,
\Magento\Quote\Api\Data\AddressInterface
$shippingAddress
=
null
);
}
Api/AdyenRequestMerchantSessionInterface.php
View file @
165cb2b2
...
...
@@ -24,7 +24,6 @@
namespace
Adyen\Payment\Api
;
interface
AdyenRequestMerchantSessionInterface
{
...
...
@@ -32,5 +31,4 @@ interface AdyenRequestMerchantSessionInterface
* @return mixed
*/
public
function
getMerchantSession
();
}
\ No newline at end of file
}
Api/Data/InvoiceInterface.php
View file @
165cb2b2
...
...
@@ -121,5 +121,4 @@ interface InvoiceInterface
* @return $this
*/
public
function
setInvoiceId
(
$invoiceId
);
}
\ No newline at end of file
}
Api/Data/NotificationInterface.php
View file @
165cb2b2
...
...
@@ -301,4 +301,4 @@ interface NotificationInterface
* @return $this
*/
public
function
setUpdatedAt
(
$timestamp
);
}
\ No newline at end of file
}
Api/Data/OrderPaymentInterface.php
View file @
165cb2b2
...
...
@@ -201,5 +201,4 @@ interface OrderPaymentInterface
* @return $this
*/
public
function
setUpdatedAt
(
$timestamp
);
}
\ No newline at end of file
}
Api/GuestAdyenPaymentMethodManagementInterface.php
View file @
165cb2b2
...
...
@@ -40,5 +40,4 @@ interface GuestAdyenPaymentMethodManagementInterface
* @return \Magento\Checkout\Api\Data\PaymentDetailsInterface
*/
public
function
getPaymentMethods
(
$cartId
,
\Magento\Quote\Api\Data\AddressInterface
$shippingAddress
=
null
);
}
Block/Adminhtml/System/Config/Field/Installments.php
View file @
165cb2b2
...
...
@@ -56,7 +56,7 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA
/**
* Returns renderer for country element
*
*
* @return \Magento\Braintree\Block\Adminhtml\Form\Field\Cctypes
*/
protected
function
getCcTypesRenderer
()
...
...
@@ -114,7 +114,6 @@ class Installments extends \Magento\Config\Block\System\Config\Form\Field\FieldA
$options
=
[];
if
(
$installlments
)
{
$options
[
'option_'
.
$this
->
getNumberOfInstallmentsRenderer
()
->
calcOptionHash
(
$installlments
)]
=
'selected="selected"'
;
...
...
Block/Adminhtml/System/Config/Field/Version.php
View file @
165cb2b2
...
...
@@ -58,4 +58,4 @@ class Version extends \Magento\Config\Block\System\Config\Form\Field
{
return
$this
->
_adyenHelper
->
getModuleVersion
();
}
}
\ No newline at end of file
}
Block/Checkout/Success.php
View file @
165cb2b2
...
...
@@ -115,4 +115,4 @@ class Success extends \Magento\Framework\View\Element\Template
}
return
$this
->
_order
;
}
}
\ No newline at end of file
}
Block/Form/ApplePay.php
View file @
165cb2b2
...
...
@@ -42,8 +42,7 @@ class ApplePay extends \Magento\Payment\Block\Form
\Magento\Framework\View\Element\Template\Context
$context
,
\Adyen\Payment\Helper\Data
$adyenHelper
,
array
$data
=
[]
)
{
)
{
parent
::
__construct
(
$context
,
$data
);
$this
->
_adyenHelper
=
$adyenHelper
;
}
...
...
@@ -60,5 +59,4 @@ class ApplePay extends \Magento\Payment\Block\Form
}
return
$types
;
}
}
\ No newline at end of file
}
Block/Form/Boleto.php
View file @
165cb2b2
...
...
@@ -64,5 +64,4 @@ class Boleto extends \Magento\Payment\Block\Form
}
return
$types
;
}
}
\ No newline at end of file
}
Block/Form/Cc.php
View file @
165cb2b2
...
...
@@ -67,8 +67,7 @@ class Cc extends \Magento\Payment\Block\Form\Cc
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Magento\Checkout\Model\Session
$checkoutSession
,
array
$data
=
[]
)
{
)
{
parent
::
__construct
(
$context
,
$paymentConfig
);
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_appState
=
$context
->
getAppState
();
...
...
@@ -110,4 +109,4 @@ class Cc extends \Magento\Payment\Block\Form\Cc
}
return
true
;
}
}
\ No newline at end of file
}
Block/Form/Oneclick.php
View file @
165cb2b2
...
...
@@ -72,6 +72,4 @@ class Oneclick extends \Adyen\Payment\Block\Form\Cc
return
$cards
;
}
}
\ No newline at end of file
}
Block/Form/PayByMail.php
View file @
165cb2b2
...
...
@@ -30,6 +30,4 @@ class PayByMail extends \Magento\Payment\Block\Form
* @var string
*/
protected
$_template
=
'Adyen_Payment::form/pay_by_mail.phtml'
;
}
\ No newline at end of file
}
Block/Form/PosCloud.php
View file @
165cb2b2
...
...
@@ -30,5 +30,4 @@ class PosCloud extends \Magento\Payment\Block\Form
* @var string
*/
protected
$_template
=
'Adyen_Payment::form/pos_cloud.phtml'
;
}
Block/Form/Sepa.php
View file @
165cb2b2
...
...
@@ -59,4 +59,4 @@ class Sepa extends \Magento\Payment\Block\Form
{
return
$this
->
_adyenHelper
->
getSepaCountries
();
}
}
\ No newline at end of file
}
Block/Info/AbstractInfo.php
View file @
165cb2b2
...
...
@@ -51,8 +51,7 @@ class AbstractInfo extends \Magento\Payment\Block\Info
\Adyen\Payment\Model\ResourceModel\Order\Payment\CollectionFactory
$adyenOrderPaymentCollectionFactory
,
Template\Context
$context
,
array
$data
=
[]
)
{
)
{
parent
::
__construct
(
$context
,
$data
);
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_adyenOrderPaymentCollectionFactory
=
$adyenOrderPaymentCollectionFactory
;
...
...
@@ -76,4 +75,4 @@ class AbstractInfo extends \Magento\Payment\Block\Info
$storeId
=
$this
->
getInfo
()
->
getOrder
()
->
getStoreId
();
return
$this
->
_adyenHelper
->
getAdyenAbstractConfigDataFlag
(
'demo_mode'
,
$storeId
);
}
}
\ No newline at end of file
}
Block/Info/ApplePay.php
View file @
165cb2b2
...
...
@@ -26,4 +26,4 @@ namespace Adyen\Payment\Block\Info;
class
ApplePay
extends
Cc
{
}
\ No newline at end of file
}
Block/Info/Boleto.php
View file @
165cb2b2
...
...
@@ -29,5 +29,4 @@ class Boleto extends AbstractInfo
* @var string
*/
protected
$_template
=
'Adyen_Payment::info/adyen_boleto.phtml'
;
}
Block/Info/PayByMail.php
View file @
165cb2b2
...
...
@@ -29,5 +29,4 @@ class PayByMail extends AbstractInfo
* @var string
*/
protected
$_template
=
'Adyen_Payment::info/adyen_pay_by_mail.phtml'
;
}
Block/Info/Pos.php
View file @
165cb2b2
...
...
@@ -29,5 +29,4 @@ class Pos extends AbstractInfo
* @var string
*/
protected
$_template
=
'Adyen_Payment::info/adyen_pos.phtml'
;
}
Block/Info/PosCloud.php
View file @
165cb2b2
...
...
@@ -30,5 +30,4 @@ class PosCloud extends AbstractInfo
* @var string
*/
protected
$_template
=
'Adyen_Payment::info/adyen_pos_cloud.phtml'
;
}
Block/Info/Sepa.php
View file @
165cb2b2
...
...
@@ -29,5 +29,4 @@ class Sepa extends AbstractInfo
* @var string
*/
protected
$_template
=
'Adyen_Payment::info/adyen_sepa.phtml'
;
}
Block/Redirect/Pos.php
View file @
165cb2b2
...
...
@@ -105,18 +105,19 @@ class Pos extends \Magento\Payment\Block\Form
{
$launchlink
=
""
;
try
{
if
(
$this
->
_order
->
getPayment
())
{
if
(
$this
->
_order
->
getPayment
())
{
$realOrderId
=
$this
->
_order
->
getRealOrderId
();
$orderCurrencyCode
=
$this
->
_order
->
getOrderCurrencyCode
();
$amount
=
$this
->
_adyenHelper
->
formatAmount
(
$this
->
_order
->
getGrandTotal
(),
$orderCurrencyCode
$this
->
_order
->
getGrandTotal
(),
$orderCurrencyCode
);
$shopperEmail
=
$this
->
_order
->
getCustomerEmail
();
$customerId
=
$this
->
_order
->
getCustomerId
();
$callbackUrl
=
$this
->
_urlBuilder
->
getUrl
(
'adyen/process/resultpos'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]);
$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
;
...
...
@@ -153,7 +154,7 @@ class Pos extends \Magento\Payment\Block\Form
$this
->
_adyenLogger
->
addAdyenDebug
(
print_r
(
$launchlink
,
true
));
}
}
catch
(
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
// do nothing for now
throw
(
$e
);
}
...
...
@@ -232,7 +233,6 @@ class Pos extends \Magento\Payment\Block\Form
);
$myReceiptOrderLines
.=
" "
.
1
.
" "
.
$order
->
getShippingDescription
()
.
"| "
.
$currency
.
" "
.
$shippingAmountFormat
.
"|
\n
"
;
}
if
(
$order
->
getPaymentFeeAmount
()
>
0
)
{
...
...
@@ -243,7 +243,6 @@ class Pos extends \Magento\Payment\Block\Form
);
$myReceiptOrderLines
.=
" "
.
1
.
" "
.
$this
->
__
(
'Payment Fee'
)
.
"| "
.
$currency
.
" "
.
$paymentFeeAmount
.
"|
\n
"
;
}
$myReceiptOrderLines
.=
"|--------|
\n
"
.
...
...
@@ -282,4 +281,4 @@ class Pos extends \Magento\Payment\Block\Form
{
return
$this
->
_request
;
}
}
\ No newline at end of file
}
Block/Redirect/Redirect.php
View file @
165cb2b2
...
...
@@ -84,8 +84,7 @@ class Redirect extends \Magento\Payment\Block\Form
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
,
\Magento\Tax\Model\Config
$taxConfig
,
\Magento\Tax\Model\Calculation
$taxCalculation
)
{
)
{
$this
->
_orderFactory
=
$orderFactory
;
$this
->
_checkoutSession
=
$checkoutSession
;
parent
::
__construct
(
$context
,
$data
);
...
...
@@ -126,20 +125,19 @@ class Redirect extends \Magento\Payment\Block\Form
if
(
$paymentRoutine
==
'single'
&&
$this
->
getPaymentMethodSelectionOnAdyen
())
{
$url
=
'https://test.adyen.com/hpp/pay.shtml'
;
}
else
{
if
(
$this
->
getPaymentMethodSelectionOnAdyen
())
{
$url
=
'https://test.adyen.com/hpp/select.shtml'
;
}
else
{
if
(
$this
->
_adyenHelper
->
isPaymentMethodOpenInvoiceMethod
(
$this
->
_order
->
getPayment
()
->
getAdditionalInformation
(
'brand_code'
)
)
||
$this
->
_adyenHelper
->
isPaymentMethodMolpayMethod
(
$this
->
_order
->
getPayment
()
->
getAdditionalInformation
(
'brand_code'
)
)
)
{
$url
=
"https://test.adyen.com/hpp/skipDetails.shtml"
;
}
else
{
$url
=
"https://test.adyen.com/hpp/details.shtml"
;
}
if
(
$this
->
_adyenHelper
->
isPaymentMethodOpenInvoiceMethod
(
$this
->
_order
->
getPayment
()
->
getAdditionalInformation
(
'brand_code'
)
)
||
$this
->
_adyenHelper
->
isPaymentMethodMolpayMethod
(
$this
->
_order
->
getPayment
()
->
getAdditionalInformation
(
'brand_code'
)
)
)
{
$url
=
"https://test.adyen.com/hpp/skipDetails.shtml"
;
}
else
{
$url
=
"https://test.adyen.com/hpp/details.shtml"
;
}
}
}
break
;
...
...
@@ -150,16 +148,16 @@ class Redirect extends \Magento\Payment\Block\Form
if
(
$this
->
getPaymentMethodSelectionOnAdyen
())
{
$url
=
'https://live.adyen.com/hpp/select.shtml'
;
}
else
{
if
(
$this
->
_adyenHelper
->
isPaymentMethodOpenInvoiceMethod
(
$this
->
_order
->
getPayment
()
->
getAdditionalInformation
(
'brand_code'
)
)
||
$this
->
_adyenHelper
->
isPaymentMethodMolpayMethod
(
$this
->
_order
->
getPayment
()
->
getAdditionalInformation
(
'brand_code'
)
)
)
{
$url
=
"https://live.adyen.com/hpp/skipDetails.shtml"
;
}
else
{
$url
=
"https://live.adyen.com/hpp/details.shtml"
;
}
if
(
$this
->
_adyenHelper
->
isPaymentMethodOpenInvoiceMethod
(
$this
->
_order
->
getPayment
()
->
getAdditionalInformation
(
'brand_code'
)
)
||
$this
->
_adyenHelper
->
isPaymentMethodMolpayMethod
(
$this
->
_order
->
getPayment
()
->
getAdditionalInformation
(
'brand_code'
)
)
)
{
$url
=
"https://live.adyen.com/hpp/skipDetails.shtml"
;
}
else
{
$url
=
"https://live.adyen.com/hpp/details.shtml"
;
}
}
}
break
;
...
...
@@ -189,12 +187,12 @@ class Redirect extends \Magento\Payment\Block\Form
$formFields
=
[];
try
{
if
(
$this
->
_order
->
getPayment
())
{
$realOrderId
=
$this
->
_order
->
getRealOrderId
();
$orderCurrencyCode
=
$this
->
_order
->
getOrderCurrencyCode
();
$skinCode
=
trim
(
$this
->
_adyenHelper
->
getAdyenHppConfigData
(
'skin_code'
));
$amount
=
$this
->
_adyenHelper
->
formatAmount
(
$this
->
_order
->
getGrandTotal
(),
$orderCurrencyCode
$this
->
_order
->
getGrandTotal
(),
$orderCurrencyCode
);
$merchantAccount
=
trim
(
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'merchant_account'
));
$shopperEmail
=
$this
->
_order
->
getCustomerEmail
();
...
...
@@ -238,8 +236,8 @@ class Redirect extends \Magento\Payment\Block\Form
$formFields
[
'shopperEmail'
]
=
$shopperEmail
;
// recurring
$recurringType
=
trim
(
$this
->
_adyenHelper
->
getAdyenAbstractConfigData
(
'recurring_type'
)
);
'recurring_type'
)
)
;
$brandCode
=
$this
->
_order
->
getPayment
()
->
getAdditionalInformation
(
\Adyen\Payment\Observer\AdyenHppDataAssignObserver
::
BRAND_CODE
);
...
...
@@ -316,7 +314,6 @@ class Redirect extends \Magento\Payment\Block\Form
$this
->
_adyenLogger
->
addAdyenDebug
(
print_r
(
$formFields
,
true
));
}
}
catch
(
Exception
$e
)
{
// do nothing for now
}
...
...
@@ -389,7 +386,6 @@ class Redirect extends \Magento\Payment\Block\Form
$shippingAddress
=
$this
->
_order
->
getShippingAddress
();
if
(
$shippingAddress
)
{
$street
=
$this
->
_adyenHelper
->
getStreet
(
$shippingAddress
);
if
(
isset
(
$street
[
'name'
])
&&
$street
[
'name'
]
!=
""
)
{
...
...
@@ -439,7 +435,6 @@ class Redirect extends \Magento\Payment\Block\Form
$currency
=
$this
->
_order
->
getOrderCurrencyCode
();
foreach
(
$this
->
_order
->
getAllVisibleItems
()
as
$item
)
{
++
$count
;
$numberOfItems
=
(
int
)
$item
->
getQtyOrdered
();
...
...
@@ -467,13 +462,21 @@ class Redirect extends \Magento\Payment\Block\Form
$itemVatPercentage
=
"0"
;
$numberOfItems
=
1
;
$formFields
=
$this
->
_adyenHelper
->
getOpenInvoiceLineData
(
$formFields
,
$count
,
$currency
,
$description
,
$itemAmount
,
$itemVatAmount
,
$itemVatPercentage
,
$numberOfItems
,
$this
->
_order
->
getPayment
());
$formFields
=
$this
->
_adyenHelper
->
getOpenInvoiceLineData
(
$formFields
,
$count
,
$currency
,
$description
,
$itemAmount
,
$itemVatAmount
,
$itemVatPercentage
,
$numberOfItems
,
$this
->
_order
->
getPayment
()
);
}
// Shipping cost
if
(
$this
->
_order
->
getShippingAmount
()
>
0
||
$this
->
_order
->
getShippingTaxAmount
()
>
0
)
{
++
$count
;
$formFields
=
$this
->
_adyenHelper
->
createOpenInvoiceLineShipping
(
$formFields
,
...
...
Block/Redirect/Validate3d.php
View file @
165cb2b2
...
...
@@ -120,8 +120,10 @@ class Validate3d extends \Magento\Payment\Block\Form
*/
public
function
getTermUrl
()
{
return
$this
->
getUrl
(
'adyen/process/validate3d'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]);
return
$this
->
getUrl
(
'adyen/process/validate3d'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]
);
}
/**
...
...
@@ -133,5 +135,4 @@ class Validate3d extends \Magento\Payment\Block\Form
{
return
$this
->
_request
;
}
}
Controller/Process/Json.php
View file @
165cb2b2
...
...
@@ -62,8 +62,7 @@ class Json extends \Magento\Framework\App\Action\Action
\Magento\Framework\App\Action\Context
$context
,
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
)
{
)
{
parent
::
__construct
(
$context
);
$this
->
_objectManager
=
$context
->
getObjectManager
();
$this
->
_resultFactory
=
$context
->
getResultFactory
();
...
...
@@ -80,7 +79,6 @@ class Json extends \Magento\Framework\App\Action\Action
// if version is in the notification string show the module version
$response
=
$this
->
getRequest
()
->
getParams
();
if
(
isset
(
$response
[
'version'
]))
{
$this
->
getResponse
()
->
clearHeader
(
'Content-Type'
)
->
setHeader
(
'Content-Type'
,
'text/html'
)
...
...
@@ -101,10 +99,9 @@ class Json extends \Magento\Framework\App\Action\Action
if
(
$notificationMode
!==
""
&&
$this
->
_validateNotificationMode
(
$notificationMode
))
{
foreach
(
$notificationItems
[
'notificationItems'
]
as
$notificationItem
)
{
$status
=
$this
->
_processNotification
(
$notificationItem
[
'NotificationRequestItem'
],
$notificationMode
$notificationItem
[
'NotificationRequestItem'
],
$notificationMode
);
if
(
$status
!=
true
)
{
...
...
@@ -113,7 +110,6 @@ class Json extends \Magento\Framework\App\Action\Action
}
$acceptedMessage
=
"[accepted]"
;
}
$cronCheckTest
=
$notificationItems
[
'notificationItems'
][
0
][
'NotificationRequestItem'
][
'pspReference'
];
...
...
@@ -173,7 +169,6 @@ class Json extends \Magento\Framework\App\Action\Action
{
// validate the notification
if
(
$this
->
authorised
(
$response
))
{
// check if notification already exists
if
(
!
$this
->
_isDuplicate
(
$response
))
{
try
{
...
...
@@ -369,4 +364,4 @@ class Json extends \Magento\Framework\App\Action\Action
->
setBody
(
$message
);
return
;
}
}
\ No newline at end of file
}
Controller/Process/Redirect.php
View file @
165cb2b2
...
...
@@ -113,4 +113,4 @@ class Redirect extends \Magento\Framework\App\Action\Action
{
return
$this
->
_objectManager
->
get
(
'\Magento\Quote\Model\QuoteManagement'
);
}
}
\ No newline at end of file
}
Controller/Process/RedirectPos.php
View file @
165cb2b2
...
...
@@ -111,4 +111,4 @@ class RedirectPos extends \Magento\Framework\App\Action\Action
{
return
$this
->
_objectManager
->
get
(
'\Magento\Quote\Model\QuoteManagement'
);
}
}
\ No newline at end of file
}
Controller/Process/Result.php
View file @
165cb2b2
...
...
@@ -163,7 +163,6 @@ class Result extends \Magento\Framework\App\Action\Action
if
(
$incrementId
)
{
$order
=
$this
->
_getOrder
(
$incrementId
);
if
(
$order
->
getId
())
{
$this
->
_eventManager
->
dispatch
(
'adyen_payment_process_resulturl_before'
,
[
'order'
=>
$order
,
'adyen_response'
=>
$response
...
...
@@ -179,7 +178,6 @@ class Result extends \Magento\Framework\App\Action\Action
'order'
=>
$order
,
'adyen_response'
=>
$response
]);
}
else
{
throw
new
\Magento\Framework\Exception\LocalizedException
(
__
(
'Order does not exists with increment_id: %1'
,
$incrementId
)
...
...
@@ -209,8 +207,12 @@ class Result extends \Magento\Framework\App\Action\Action
$pspReference
=
isset
(
$response
[
'pspReference'
])
?
trim
(
$response
[
'pspReference'
])
:
''
;
$type
=
'Adyen Result URL response:'
;
$comment
=
__
(
'%1 <br /> authResult: %2 <br /> pspReference: %3 <br /> paymentMethod: %4'
,
$type
,
$authResult
,
$pspReference
,
$paymentMethod
$comment
=
__
(
'%1 <br /> authResult: %2 <br /> pspReference: %3 <br /> paymentMethod: %4'
,
$type
,
$authResult
,
$pspReference
,
$paymentMethod
);
...
...
@@ -225,13 +227,11 @@ class Result extends \Magento\Framework\App\Action\Action
case
Notification
::
PENDING
:
// do nothing wait for the notification
$result
=
true
;
if
(
strpos
(
$paymentMethod
,
"bankTransfer"
)
!==
false
)
{
if
(
strpos
(
$paymentMethod
,
"bankTransfer"
)
!==
false
)
{
$comment
.=
"<br /><br />Waiting for the customer to transfer the money."
;
}
elseif
(
$paymentMethod
==
"sepadirectdebit"
){
}
elseif
(
$paymentMethod
==
"sepadirectdebit"
)
{
$comment
.=
"<br /><br />This request will be send to the bank at the end of the day."
;
}
else
{
}
else
{
$comment
.=
"<br /><br />The payment result is not confirmed (yet).
<br />Once the payment is authorised, the order status will be updated accordingly.
<br />If the order is stuck on this status, the payment can be seen as unsuccessful.
...
...
@@ -263,8 +263,7 @@ class Result extends \Magento\Framework\App\Action\Action
//->setStatus($status)
->
setComment
(
$comment
)
->
setEntityName
(
'order'
)
->
setOrder
(
$order
)
;
->
setOrder
(
$order
);
$history
->
save
();
...
...
@@ -277,7 +276,8 @@ class Result extends \Magento\Framework\App\Action\Action
* @param $response
* @return bool
*/
protected
function
_authenticate
(
$response
)
{
protected
function
_authenticate
(
$response
)
{
$merchantSigNotification
=
$response
[
'merchantSig'
];
...
...
@@ -314,7 +314,7 @@ class Result extends \Magento\Framework\App\Action\Action
*/
protected
function
escapeString
(
$val
)
{
return
str_replace
(
':'
,
'\\:'
,
str_replace
(
'\\'
,
'\\\\'
,
$val
));
return
str_replace
(
':'
,
'\\:'
,
str_replace
(
'\\'
,
'\\\\'
,
$val
));
}
/**
...
...
@@ -330,4 +330,4 @@ class Result extends \Magento\Framework\App\Action\Action
}
return
$this
->
_order
;
}
}
\ No newline at end of file
}
Controller/Process/ResultPos.php
View file @
165cb2b2
...
...
@@ -111,27 +111,27 @@ class ResultPos extends \Magento\Framework\App\Action\Action
$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'
);
$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
)
;
->
setOrder
(
$order
);
$history
->
save
();
// needed becuase then we need to save $order objects
...
...
@@ -148,8 +148,7 @@ class ResultPos extends \Magento\Framework\App\Action\Action
//->setStatus($status)
->
setComment
(
$comment
)
->
setEntityName
(
'order'
)
->
setOrder
(
$order
)
;
->
setOrder
(
$order
);
$history
->
save
();
// cancel the order
...
...
@@ -282,4 +281,4 @@ class ResultPos extends \Magento\Framework\App\Action\Action
}
}
}
}
\ No newline at end of file
}
Controller/Process/Validate3d.php
View file @
165cb2b2
...
...
@@ -94,19 +94,16 @@ class Validate3d extends \Magento\Framework\App\Action\Action
// check if 3D secure is active. If not just go to success page
if
(
$active
&&
$success
!=
true
)
{
$this
->
_adyenLogger
->
addAdyenResult
(
"3D secure is active"
);
// check if it is already processed
if
(
$this
->
getRequest
()
->
isPost
())
{
$this
->
_adyenLogger
->
addAdyenResult
(
"Process 3D secure payment"
);
$requestMD
=
$this
->
getRequest
()
->
getPost
(
'MD'
);
$requestPaRes
=
$this
->
getRequest
()
->
getPost
(
'PaRes'
);
$md
=
$order
->
getPayment
()
->
getAdditionalInformation
(
'md'
);
if
(
$requestMD
==
$md
)
{
$order
->
getPayment
()
->
setAdditionalInformation
(
'paResponse'
,
$requestPaRes
);
try
{
...
...
@@ -159,7 +156,8 @@ class Validate3d extends \Magento\Framework\App\Action\Action
__
(
'Customer was redirected to bank for 3D-secure validation. Once the shopper authenticated, the order status will be updated accordingly.
<br />Make sure that your notifications are being processed!
<br />If the order is stuck on this status, the shopper abandoned the session. The payment can be seen as unsuccessful.
<br />The order can be automatically cancelled based on the OFFER_CLOSED notification. Please contact Adyen Support to enable this.'
))
->
save
();
<br />The order can be automatically cancelled based on the OFFER_CLOSED notification. Please contact Adyen Support to enable this.'
)
)
->
save
();
$this
->
_view
->
loadLayout
();
$this
->
_view
->
getLayout
()
->
initMessages
();
$this
->
_view
->
renderLayout
();
...
...
@@ -180,7 +178,7 @@ class Validate3d extends \Magento\Framework\App\Action\Action
{
try
{
$response
=
$this
->
_paymentRequest
->
authorise3d
(
$payment
);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
throw
$e
;
}
$responseCode
=
$response
[
'resultCode'
];
...
...
Gateway/Command/HppCommand.php
View file @
165cb2b2
...
...
@@ -61,8 +61,8 @@ class HppCommand implements CommandInterface
// update customer based on additionalFields
if
(
$payment
->
getAdditionalInformation
(
"gender"
))
{
$order
->
setCustomerGender
(
\Adyen\Payment\Model\Gender
::
getMagentoGenderFromAdyenGender
(
$payment
->
getAdditionalInformation
(
"gender"
)
)
);
$payment
->
getAdditionalInformation
(
"gender"
)
)
)
;
}
if
(
$payment
->
getAdditionalInformation
(
"dob"
))
{
...
...
@@ -80,4 +80,4 @@ class HppCommand implements CommandInterface
return
$this
;
}
}
\ No newline at end of file
}
Gateway/Command/PayByMailCommand.php
View file @
165cb2b2
...
...
@@ -26,7 +26,6 @@ namespace Adyen\Payment\Gateway\Command;
use
Magento\Payment\Gateway\Command
;
use
Magento\Payment\Gateway\CommandInterface
;
class
PayByMailCommand
implements
CommandInterface
{
...
...
Gateway/Command/PosCommand.php
View file @
165cb2b2
...
...
@@ -63,4 +63,4 @@ class PosCommand implements CommandInterface
return
$this
;
}
}
\ No newline at end of file
}
Gateway/Http/Client/TransactionAuthorization.php
View file @
165cb2b2
...
...
@@ -60,7 +60,7 @@ class TransactionAuthorization implements ClientInterface
$this
->
_recurringType
=
$recurringType
;
$this
->
_appState
=
$context
->
getAppState
();
$this
->
_client
=
$this
->
_adyenHelper
->
initializeAdyenClient
();
$this
->
_client
=
$this
->
_adyenHelper
->
initializeAdyenClient
();
}
/**
...
...
@@ -77,7 +77,7 @@ class TransactionAuthorization implements ClientInterface
try
{
$response
=
$service
->
authorise
(
$request
);
}
catch
(
\Adyen\AdyenException
$e
)
{
}
catch
(
\Adyen\AdyenException
$e
)
{
$response
[
'error'
]
=
$e
->
getMessage
();
}
return
$response
;
...
...
Gateway/Http/Client/TransactionCancel.php
View file @
165cb2b2
...
...
@@ -55,7 +55,7 @@ class TransactionCancel implements ClientInterface
$this
->
_recurringType
=
$recurringType
;
$this
->
_appState
=
$context
->
getAppState
();
$this
->
_client
=
$this
->
_adyenHelper
->
initializeAdyenClient
();
$this
->
_client
=
$this
->
_adyenHelper
->
initializeAdyenClient
();
}
/**
...
...
@@ -71,10 +71,10 @@ class TransactionCancel implements ClientInterface
try
{
$response
=
$service
->
cancel
(
$request
);
}
catch
(
\Adyen\AdyenException
$e
)
{
}
catch
(
\Adyen\AdyenException
$e
)
{
$response
=
null
;
}
return
$response
;
}
}
\ No newline at end of file
}
Gateway/Http/Client/TransactionCapture.php
View file @
165cb2b2
...
...
@@ -55,7 +55,7 @@ class TransactionCapture implements ClientInterface
$this
->
_recurringType
=
$recurringType
;
$this
->
_appState
=
$context
->
getAppState
();
$this
->
_client
=
$this
->
_adyenHelper
->
initializeAdyenClient
();
$this
->
_client
=
$this
->
_adyenHelper
->
initializeAdyenClient
();
}
/**
...
...
@@ -71,11 +71,11 @@ class TransactionCapture implements ClientInterface
try
{
$response
=
$service
->
capture
(
$request
);
}
catch
(
\Adyen\AdyenException
$e
)
{
}
catch
(
\Adyen\AdyenException
$e
)
{
$this
->
_adyenLogger
->
error
(
$e
);
// add this for now not in the lib yet
$response
=
null
;
}
return
$response
;
}
}
\ No newline at end of file
}
Gateway/Http/Client/TransactionPosCloudSync.php
View file @
165cb2b2
...
...
@@ -35,19 +35,19 @@ class TransactionPosCloudSync implements ClientInterface
*/
protected
$storeId
;
/**
* @var \Adyen\Client
*/
/**
* @var \Adyen\Client
*/
protected
$client
;
/**
* @var \Adyen\Payment\Helper\Data
*/
/**
* @var \Adyen\Payment\Helper\Data
*/
protected
$adyenHelper
;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
protected
$adyenLogger
;
public
function
__construct
(
...
...
@@ -60,7 +60,7 @@ class TransactionPosCloudSync implements ClientInterface
$this
->
adyenLogger
=
$adyenLogger
;
$this
->
storeId
=
$storeManager
->
getStore
()
->
getId
();
$apiKey
=
$this
->
adyenHelper
->
getPosApiKey
(
$this
->
storeId
);
$apiKey
=
$this
->
adyenHelper
->
getPosApiKey
(
$this
->
storeId
);
// initialize client
$client
=
$this
->
adyenHelper
->
initializeAdyenClient
(
$this
->
storeId
,
$apiKey
);
...
...
@@ -72,7 +72,6 @@ class TransactionPosCloudSync implements ClientInterface
}
$this
->
client
=
$client
;
}
/**
...
...
Gateway/Http/Client/TransactionRefund.php
View file @
165cb2b2
...
...
@@ -55,7 +55,7 @@ class TransactionRefund implements ClientInterface
$this
->
_recurringType
=
$recurringType
;
$this
->
_appState
=
$context
->
getAppState
();
$this
->
_client
=
$this
->
_adyenHelper
->
initializeAdyenClient
();
$this
->
_client
=
$this
->
_adyenHelper
->
initializeAdyenClient
();
}
/**
...
...
@@ -68,16 +68,15 @@ class TransactionRefund implements ClientInterface
$responses
=
[];
foreach
(
$requests
as
$request
)
{
// call lib
$service
=
new
\Adyen\Service\Modification
(
$this
->
_client
);
try
{
$responses
[]
=
$service
->
refund
(
$request
);
}
catch
(
\Adyen\AdyenException
$e
)
{
}
catch
(
\Adyen\AdyenException
$e
)
{
$responses
[]
=
null
;
}
}
return
$responses
;
}
}
\ No newline at end of file
}
Gateway/Http/TransferFactory.php
View file @
165cb2b2
...
...
@@ -56,4 +56,4 @@ class TransferFactory implements TransferFactoryInterface
->
setBody
(
$request
)
->
build
();
}
}
\ No newline at end of file
}
Gateway/Request/AddressDataBuilder.php
View file @
165cb2b2
...
...
@@ -47,7 +47,7 @@ class AddressDataBuilder implements BuilderInterface
/**
* Add delivery\billing details into request
*
*
* @param array $buildSubject
* @return array
*/
...
...
@@ -61,7 +61,6 @@ class AddressDataBuilder implements BuilderInterface
$billingAddress
=
$order
->
getBillingAddress
();
if
(
$billingAddress
)
{
$requestBilling
=
[
"street"
=>
"N/A"
,
"postalCode"
=>
''
,
"city"
=>
"N/A"
,
...
...
@@ -95,7 +94,6 @@ class AddressDataBuilder implements BuilderInterface
$shippingAddress
=
$order
->
getShippingAddress
();
if
(
$shippingAddress
)
{
// filter housenumber from streetLine1
$requestDelivery
=
[
"street"
=>
$shippingAddress
->
getStreetLine1
(),
"postalCode"
=>
$shippingAddress
->
getPostcode
(),
...
...
Gateway/Request/ApplePayAuthorizationDataBuilder.php
View file @
165cb2b2
...
...
@@ -48,8 +48,7 @@ class ApplePayAuthorizationDataBuilder implements BuilderInterface
public
function
__construct
(
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
)
{
)
{
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_adyenLogger
=
$adyenLogger
;
}
...
...
@@ -77,5 +76,4 @@ class ApplePayAuthorizationDataBuilder implements BuilderInterface
return
$request
;
}
}
\ No newline at end of file
}
Gateway/Request/Authorize3DSecureDataBuilder.php
View file @
165cb2b2
...
...
@@ -61,4 +61,4 @@ class Authorize3DSecureDataBuilder implements BuilderInterface
"paResponse"
=>
$paResponse
,
];
}
}
\ No newline at end of file
}
Gateway/Request/BoletoAuthorizationDataBuilder.php
View file @
165cb2b2
...
...
@@ -81,16 +81,18 @@ class BoletoAuthorizationDataBuilder implements BuilderInterface
$deliveryDays
=
(
!
empty
(
$deliveryDays
))
?
$deliveryDays
:
5
;
$deliveryDate
=
date
(
"Y-m-d\TH:i:s "
,
mktime
(
date
(
"H"
),
mktime
(
date
(
"H"
),
date
(
"i"
),
date
(
"s"
),
date
(
"m"
),
date
(
"j"
)
+
$deliveryDays
,
date
(
"Y"
))
date
(
"Y"
)
)
);
$request
[
'deliveryDate'
]
=
$deliveryDate
;
return
$request
;
}
}
\ No newline at end of file
}
Gateway/Request/BrowserInfoDataBuilder.php
View file @
165cb2b2
...
...
@@ -43,4 +43,4 @@ class BrowserInfoDataBuilder implements BuilderInterface
]
];
}
}
\ No newline at end of file
}
Gateway/Request/CancelDataBuilder.php
View file @
165cb2b2
...
...
@@ -48,7 +48,7 @@ class CancelDataBuilder implements BuilderInterface
/**
* Create cancel_or_refund request
*
*
* @param array $buildSubject
* @return array
*/
...
...
@@ -65,4 +65,4 @@ class CancelDataBuilder implements BuilderInterface
"originalReference"
=>
$pspReference
];
}
}
\ No newline at end of file
}
Gateway/Request/CaptureDataBuilder.php
View file @
165cb2b2
...
...
@@ -137,4 +137,4 @@ class CaptureDataBuilder implements BuilderInterface
return
$formFields
;
}
}
\ No newline at end of file
}
Gateway/Request/CcAuthorizationDataBuilder.php
View file @
165cb2b2
...
...
@@ -47,8 +47,7 @@ class CcAuthorizationDataBuilder implements BuilderInterface
public
function
__construct
(
\Adyen\Payment\Helper\Data
$adyenHelper
,
\Magento\Framework\Model\Context
$context
)
{
)
{
$this
->
adyenHelper
=
$adyenHelper
;
$this
->
appState
=
$context
->
getAppState
();
}
...
...
@@ -92,4 +91,4 @@ class CcAuthorizationDataBuilder implements BuilderInterface
return
$request
;
}
}
\ No newline at end of file
}
Gateway/Request/CustomerDataBuilder.php
View file @
165cb2b2
...
...
@@ -32,7 +32,7 @@ class CustomerDataBuilder implements BuilderInterface
/**
* Add shopper data into request
*
*
* @param array $buildSubject
* @return array
*/
...
...
Gateway/Request/MerchantAccountDataBuilder.php
View file @
165cb2b2
...
...
@@ -60,4 +60,4 @@ class MerchantAccountDataBuilder implements BuilderInterface
return
[
"merchantAccount"
=>
$merchantAccount
];
}
}
\ No newline at end of file
}
Gateway/Request/OneclickAuthorizationDataBuilder.php
View file @
165cb2b2
...
...
@@ -81,4 +81,4 @@ class OneclickAuthorizationDataBuilder implements BuilderInterface
return
$request
;
}
}
\ No newline at end of file
}
Gateway/Request/PaymentDataBuilder.php
View file @
165cb2b2
...
...
@@ -37,7 +37,7 @@ class PaymentDataBuilder implements BuilderInterface
/**
* PaymentDataBuilder constructor.
*
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public
function
__construct
(
\Adyen\Payment\Helper\Data
$adyenHelper
)
...
...
@@ -70,4 +70,4 @@ class PaymentDataBuilder implements BuilderInterface
"fraudOffset"
=>
"0"
];
}
}
\ No newline at end of file
}
Gateway/Request/RecurringDataBuilder.php
View file @
165cb2b2
...
...
@@ -84,7 +84,7 @@ class RecurringDataBuilder implements BuilderInterface
}
else
{
$recurringContractType
=
\Adyen\Payment\Model\RecurringType
::
RECURRING
;
}
}
else
if
(
$paymentMethodCode
==
\Adyen\Payment\Model\Ui\AdyenCcConfigProvider
::
CODE
)
{
}
elseif
(
$paymentMethodCode
==
\Adyen\Payment\Model\Ui\AdyenCcConfigProvider
::
CODE
)
{
if
(
$payment
->
getAdditionalInformation
(
"store_cc"
)
==
""
&&
(
$recurringType
==
"ONECLICK,RECURRING"
||
$recurringType
==
"RECURRING"
))
{
$recurringContractType
=
\Adyen\Payment\Model\RecurringType
::
RECURRING
;
...
...
@@ -104,4 +104,4 @@ class RecurringDataBuilder implements BuilderInterface
return
$result
;
}
}
\ No newline at end of file
}
Gateway/Request/RefundDataBuilder.php
View file @
165cb2b2
...
...
@@ -88,7 +88,6 @@ class RefundDataBuilder implements BuilderInterface
// partial refund if multiple payments check refund strategy
if
(
$orderPaymentCollection
->
getSize
()
>
1
)
{
$refundStrategy
=
$this
->
adyenHelper
->
getAdyenAbstractConfigData
(
'split_payments_refund_strategy'
,
$order
->
getStoreId
()
...
...
@@ -173,7 +172,6 @@ class RefundDataBuilder implements BuilderInterface
//There is only one payment, so we add the fields to the first(and only) result
$result
[
0
][
"additionalData"
]
=
$openInvoiceFields
;
}
}
return
$result
;
...
...
@@ -207,7 +205,6 @@ class RefundDataBuilder implements BuilderInterface
$numberOfItems
,
$payment
);
}
// Shipping cost
...
...
@@ -233,10 +230,10 @@ class RefundDataBuilder implements BuilderInterface
$invoice
=
$invoices
->
getFirstItem
();
if
(
$invoice
)
{
if
(
$invoice
)
{
$formFields
[
'acquirerReference'
]
=
$invoice
->
getAcquirerReference
();
}
return
$formFields
;
}
}
\ No newline at end of file
}
Gateway/Request/SepaAuthorizationDataBuilder.php
View file @
165cb2b2
...
...
@@ -52,4 +52,4 @@ class SepaAuthorizationDataBuilder implements BuilderInterface
return
$request
;
}
}
\ No newline at end of file
}
Gateway/Response/PaymentAuthorisationDetailsHandler.php
View file @
165cb2b2
...
...
@@ -54,6 +54,5 @@ class PaymentAuthorisationDetailsHandler implements HandlerInterface
// do not close transaction so you can do a cancel() and void
$payment
->
setIsTransactionClosed
(
false
);
$payment
->
setShouldCloseParentTransaction
(
false
);
}
}
\ No newline at end of file
}
Gateway/Response/PaymentCancelDetailsHandler.php
View file @
165cb2b2
...
...
@@ -45,4 +45,4 @@ class PaymentCancelDetailsHandler implements HandlerInterface
$payment
->
setIsTransactionClosed
(
true
);
$payment
->
setShouldCloseParentTransaction
(
true
);
}
}
\ No newline at end of file
}
Gateway/Response/PaymentCaptureDetailsHandler.php
View file @
165cb2b2
...
...
@@ -48,4 +48,4 @@ class PaymentCaptureDetailsHandler implements HandlerInterface
$payment
->
setIsTransactionClosed
(
true
);
$payment
->
setShouldCloseParentTransaction
(
false
);
}
}
\ No newline at end of file
}
Gateway/Response/PaymentCommentHistoryHandler.php
View file @
165cb2b2
...
...
@@ -43,7 +43,6 @@ class PaymentCommentHistoryHandler implements HandlerInterface
if
(
isset
(
$response
[
'resultCode'
]))
{
$responseCode
=
$response
[
'resultCode'
];
}
else
{
// try to get response from response key (used for modifications
if
(
isset
(
$response
[
'response'
]))
{
$responseCode
=
$response
[
'response'
];
...
...
@@ -59,8 +58,12 @@ class PaymentCommentHistoryHandler implements HandlerInterface
}
$type
=
'Adyen Result response:'
;
$comment
=
__
(
'%1 <br /> authResult: %2 <br /> pspReference: %3 '
,
$type
,
$responseCode
,
$pspReference
);
$comment
=
__
(
'%1 <br /> authResult: %2 <br /> pspReference: %3 '
,
$type
,
$responseCode
,
$pspReference
);
if
(
$responseCode
)
{
$payment
->
getOrder
()
->
setAdyenResulturlEventCode
(
$responseCode
);
...
...
@@ -71,4 +74,3 @@ class PaymentCommentHistoryHandler implements HandlerInterface
return
$this
;
}
}
Gateway/Response/PaymentCommentHistoryRefundHandler.php
View file @
165cb2b2
...
...
@@ -44,7 +44,6 @@ class PaymentCommentHistoryRefundHandler implements HandlerInterface
if
(
isset
(
$singleResponse
[
'resultCode'
]))
{
$responseCode
=
$singleResponse
[
'resultCode'
];
}
else
{
// try to get response from response key (used for modifications
if
(
isset
(
$singleResponse
[
'response'
]))
{
$responseCode
=
$singleResponse
[
'response'
];
...
...
@@ -60,8 +59,12 @@ class PaymentCommentHistoryRefundHandler implements HandlerInterface
}
$type
=
'Adyen Result response:'
;
$comment
=
__
(
'%1 <br /> authResult: %2 <br /> pspReference: %3 '
,
$type
,
$responseCode
,
$pspReference
);
$comment
=
__
(
'%1 <br /> authResult: %2 <br /> pspReference: %3 '
,
$type
,
$responseCode
,
$pspReference
);
if
(
$responseCode
)
{
$payment
->
getOrder
()
->
setAdyenResulturlEventCode
(
$responseCode
);
...
...
@@ -73,4 +76,3 @@ class PaymentCommentHistoryRefundHandler implements HandlerInterface
return
$this
;
}
}
Gateway/Response/PaymentPosCloudHandler.php
View file @
165cb2b2
...
...
@@ -24,7 +24,6 @@
namespace
Adyen\Payment\Gateway\Response
;
use
Magento\Payment\Gateway\Response\HandlerInterface
;
use
Magento\Setup\Exception
;
...
...
@@ -35,9 +34,9 @@ class PaymentPosCloudHandler implements HandlerInterface
*/
private
$adyenHelper
;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
private
$adyenLogger
;
/**
...
...
@@ -64,7 +63,7 @@ class PaymentPosCloudHandler implements HandlerInterface
*/
public
function
handle
(
array
$handlingSubject
,
array
$paymentResponse
)
{
$paymentDataObject
=
\Magento\Payment\Gateway\Helper\SubjectReader
::
readPayment
(
$handlingSubject
);
$paymentDataObject
=
\Magento\Payment\Gateway\Helper\SubjectReader
::
readPayment
(
$handlingSubject
);
/** @var OrderPaymentInterface $payment */
$payment
=
$paymentDataObject
->
getPayment
();
...
...
Gateway/Response/PaymentRefundDetailsHandler.php
View file @
165cb2b2
...
...
@@ -51,4 +51,4 @@ class PaymentRefundDetailsHandler implements HandlerInterface
$closeParent
=
!
(
bool
)
$payment
->
getCreditmemo
()
->
getInvoice
()
->
canRefund
();
$payment
->
setShouldCloseParentTransaction
(
$closeParent
);
}
}
\ No newline at end of file
}
Gateway/Validator/CancelResponseValidator.php
View file @
165cb2b2
...
...
@@ -66,4 +66,4 @@ class CancelResponseValidator extends AbstractValidator
return
$this
->
createResult
(
$isValid
,
$errorMessages
);
}
}
\ No newline at end of file
}
Gateway/Validator/CaptureResponseValidator.php
View file @
165cb2b2
...
...
@@ -66,4 +66,4 @@ class CaptureResponseValidator extends AbstractValidator
return
$this
->
createResult
(
$isValid
,
$errorMessages
);
}
}
\ No newline at end of file
}
Gateway/Validator/GeneralResponseValidator.php
View file @
165cb2b2
...
...
@@ -70,7 +70,6 @@ class GeneralResponseValidator extends AbstractValidator
$payment
->
setAdditionalInformation
(
'pspReference'
,
$response
[
'pspReference'
]);
// set additionalData
if
(
isset
(
$response
[
'additionalData'
])
&&
is_array
(
$response
[
'additionalData'
]))
{
$additionalData
=
$response
[
'additionalData'
];
if
(
isset
(
$additionalData
[
'boletobancario.dueDate'
]))
{
$payment
->
setAdditionalInformation
(
...
...
@@ -109,7 +108,8 @@ class GeneralResponseValidator extends AbstractValidator
}
else
{
$isValid
=
false
;
$errorMsg
=
__
(
'3D secure is not valid.'
);
$this
->
adyenLogger
->
error
(
$errorMsg
);;
$this
->
adyenLogger
->
error
(
$errorMsg
);
;
$errorMessages
[]
=
$errorMsg
;
}
break
;
...
...
@@ -130,4 +130,4 @@ class GeneralResponseValidator extends AbstractValidator
return
$this
->
createResult
(
$isValid
,
$errorMessages
);
}
}
\ No newline at end of file
}
Gateway/Validator/InstallmentValidator.php
View file @
165cb2b2
...
...
@@ -25,7 +25,6 @@
namespace
Adyen\Payment\Gateway\Validator
;
use
Magento\Payment\Gateway\Validator\AbstractValidator
;
class
InstallmentValidator
extends
AbstractValidator
...
...
Gateway/Validator/PosCloudResponseValidator.php
View file @
165cb2b2
...
...
@@ -24,10 +24,8 @@
namespace
Adyen\Payment\Gateway\Validator
;
use
Magento\Payment\Gateway\Validator\AbstractValidator
;
class
PosCloudResponseValidator
extends
AbstractValidator
{
/**
...
...
@@ -40,13 +38,13 @@ class PosCloudResponseValidator extends AbstractValidator
*/
private
$adyenHelper
;
/**
* PosCloudResponseValidator constructor.
*
* @param \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
/**
* PosCloudResponseValidator constructor.
*
* @param \Magento\Payment\Gateway\Validator\ResultInterfaceFactory $resultFactory
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public
function
__construct
(
\Magento\Payment\Gateway\Validator\ResultInterfaceFactory
$resultFactory
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
,
...
...
Gateway/Validator/RefundResponseValidator.php
View file @
165cb2b2
...
...
@@ -68,4 +68,4 @@ class RefundResponseValidator extends AbstractValidator
return
$this
->
createResult
(
$isValid
,
$errorMessages
);
}
}
\ No newline at end of file
}
Gateway/Validator/SepaValidator.php
View file @
165cb2b2
...
...
@@ -74,12 +74,11 @@ class SepaValidator extends AbstractValidator
if
(
isset
(
$countries
[
substr
(
$iban
,
0
,
2
)])
&&
strlen
(
$iban
)
==
$countries
[
substr
(
$iban
,
0
,
2
)])
{
$movedChar
=
substr
(
$iban
,
4
)
.
substr
(
$iban
,
0
,
4
);
$movedCharArray
=
str_split
(
$movedChar
);
$newString
=
""
;
foreach
(
$movedCharArray
AS
$key
=>
$value
)
{
foreach
(
$movedCharArray
as
$key
=>
$value
)
{
if
(
!
is_numeric
(
$movedCharArray
[
$key
]))
{
$movedCharArray
[
$key
]
=
$chars
[
$movedCharArray
[
$key
]];
}
...
...
@@ -110,4 +109,4 @@ class SepaValidator extends AbstractValidator
return
false
;
}
}
}
\ No newline at end of file
}
Helper/Data.php
View file @
165cb2b2
...
...
@@ -30,7 +30,7 @@ use Magento\Framework\App\Helper\AbstractHelper;
*/
class
Data
extends
AbstractHelper
{
const
MODULE_NAME
=
'adyen-magento2'
;
const
MODULE_NAME
=
'adyen-magento2'
;
const
TEST
=
'test'
;
const
LIVE
=
'live'
;
...
...
@@ -84,14 +84,14 @@ class Data extends AbstractHelper
*/
protected
$_taxCalculation
;
/**
* @var \Magento\Framework\App\ProductMetadataInterface
*/
/**
* @var \Magento\Framework\App\ProductMetadataInterface
*/
protected
$productMetadata
;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
protected
$adyenLogger
;
/**
...
...
@@ -105,8 +105,8 @@ class Data extends AbstractHelper
* @param \Adyen\Payment\Model\ResourceModel\Billing\Agreement\CollectionFactory $billingAgreementCollectionFactory
* @param \Magento\Framework\View\Asset\Repository $assetRepo
* @param \Magento\Framework\View\Asset\Source $assetSource
* @param \Magento\Framework\App\ProductMetadataInterface $productMetadata
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
* @param \Magento\Framework\App\ProductMetadataInterface $productMetadata
* @param \Adyen\Payment\Logger\AdyenLogger $adyenLogger
*/
public
function
__construct
(
\Magento\Framework\App\Helper\Context
$context
,
...
...
@@ -120,9 +120,8 @@ class Data extends AbstractHelper
\Adyen\Payment\Model\ResourceModel\Notification\CollectionFactory
$notificationFactory
,
\Magento\Tax\Model\Config
$taxConfig
,
\Magento\Tax\Model\Calculation
$taxCalculation
,
\Magento\Framework\App\ProductMetadataInterface
$productMetadata
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
\Magento\Framework\App\ProductMetadataInterface
$productMetadata
,
\Adyen\Payment\Logger\AdyenLogger
$adyenLogger
)
{
parent
::
__construct
(
$context
);
$this
->
_encryptor
=
$encryptor
;
...
...
@@ -319,7 +318,7 @@ class Data extends AbstractHelper
* @param type $street
* @return type $street
*/
static
publ
ic
function
formatStreet
(
$street
)
public
stat
ic
function
formatStreet
(
$street
)
{
if
(
count
(
$street
)
!=
1
)
{
return
$street
;
...
...
@@ -617,11 +616,15 @@ class Data extends AbstractHelper
public
function
getWsPassword
(
$storeId
=
null
)
{
if
(
$this
->
isDemoMode
(
$storeId
))
{
$wsPassword
=
$this
->
_encryptor
->
decrypt
(
trim
(
$this
->
getAdyenAbstractConfigData
(
'ws_password_test'
,
$storeId
)));
$wsPassword
=
$this
->
_encryptor
->
decrypt
(
trim
(
$this
->
getAdyenAbstractConfigData
(
'ws_password_test'
,
$storeId
)));
}
else
{
$wsPassword
=
$this
->
_encryptor
->
decrypt
(
trim
(
$this
->
getAdyenAbstractConfigData
(
'ws_password_live'
,
$storeId
)));
$wsPassword
=
$this
->
_encryptor
->
decrypt
(
trim
(
$this
->
getAdyenAbstractConfigData
(
'ws_password_live'
,
$storeId
)));
}
return
$wsPassword
;
}
...
...
@@ -766,21 +769,21 @@ class Data extends AbstractHelper
return
$sepaCountries
;
}
/**
* Get adyen magento module's name sent to Adyen
*
* @return string
*/
public
function
getModuleName
()
{
return
(
string
)
self
::
MODULE_NAME
;
}
/**
* Get adyen magento module's version
*
* @return string
*/
/**
* Get adyen magento module's name sent to Adyen
*
* @return string
*/
public
function
getModuleName
()
{
return
(
string
)
self
::
MODULE_NAME
;
}
/**
* Get adyen magento module's version
*
* @return string
*/
public
function
getModuleVersion
()
{
return
(
string
)
$this
->
_moduleList
->
getOne
(
"Adyen_Payment"
)[
'setup_version'
];
...
...
@@ -830,7 +833,6 @@ class Data extends AbstractHelper
$baCollection
->
addActiveFilter
();
foreach
(
$baCollection
as
$billingAgreement
)
{
$agreementData
=
$billingAgreement
->
getAgreementData
();
// no agreementData and contractType then ignore
...
...
@@ -843,7 +845,6 @@ class Data extends AbstractHelper
if
(
in_array
(
$recurringType
,
$allowedContractTypes
))
{
// check if AgreementLabel is set and if contract has an recurringType
if
(
$billingAgreement
->
getAgreementLabel
())
{
// for Ideal use sepadirectdebit because it is
if
(
$agreementData
[
'variant'
]
==
'ideal'
)
{
$agreementData
[
'variant'
]
=
'sepadirectdebit'
;
...
...
@@ -928,18 +929,18 @@ class Data extends AbstractHelper
return
false
;
}
/**
* @param $paymentMethod
* @return bool
*/
public
function
isPaymentMethodMolpayMethod
(
$paymentMethod
)
{
if
(
strpos
(
$paymentMethod
,
'molpay_'
)
!==
false
)
{
return
true
;
}
/**
* @param $paymentMethod
* @return bool
*/
public
function
isPaymentMethodMolpayMethod
(
$paymentMethod
)
{
if
(
strpos
(
$paymentMethod
,
'molpay_'
)
!==
false
)
{
return
true
;
}
return
false
;
}
return
false
;
}
public
function
getRatePayId
()
{
...
...
@@ -1019,7 +1020,8 @@ class Data extends AbstractHelper
{
$notifications
=
$this
->
_notificationFactory
->
create
();
$notifications
->
unprocessedNotificationsFilter
();
return
$notifications
->
getSize
();;
return
$notifications
->
getSize
();
;
}
/**
...
...
@@ -1080,15 +1082,27 @@ class Data extends AbstractHelper
$description
=
str_replace
(
"
\n
"
,
''
,
trim
(
$name
));
$itemAmount
=
$this
->
formatAmount
(
$price
,
$currency
);
$itemVatAmount
=
$this
->
getItemVatAmount
(
$taxAmount
,
$priceInclTax
,
$price
,
$currency
);
$itemVatAmount
=
$this
->
getItemVatAmount
(
$taxAmount
,
$priceInclTax
,
$price
,
$currency
);
// Calculate vat percentage
$itemVatPercentage
=
$this
->
getMinorUnitTaxPercent
(
$taxPercent
);
return
$this
->
getOpenInvoiceLineData
(
$formFields
,
$count
,
$currency
,
$description
,
return
$this
->
getOpenInvoiceLineData
(
$formFields
,
$count
,
$currency
,
$description
,
$itemAmount
,
$itemVatAmount
,
$itemVatPercentage
,
$numberOfItems
,
$payment
);
$itemVatAmount
,
$itemVatPercentage
,
$numberOfItems
,
$payment
);
}
/**
...
...
@@ -1130,9 +1144,17 @@ class Data extends AbstractHelper
$itemVatPercentage
=
$this
->
getMinorUnitTaxPercent
(
$rate
);
$numberOfItems
=
1
;
return
$this
->
getOpenInvoiceLineData
(
$formFields
,
$count
,
$currency
,
$description
,
return
$this
->
getOpenInvoiceLineData
(
$formFields
,
$count
,
$currency
,
$description
,
$itemAmount
,
$itemVatAmount
,
$itemVatPercentage
,
$numberOfItems
,
$payment
);
$itemVatAmount
,
$itemVatPercentage
,
$numberOfItems
,
$payment
);
}
/**
...
...
@@ -1188,7 +1210,8 @@ class Data extends AbstractHelper
$formFields
[
'openinvoicedata.'
.
$linename
.
'.numberOfItems'
]
=
$numberOfItems
;
if
(
$this
->
isVatCategoryHigh
(
$payment
->
getAdditionalInformation
(
\Adyen\Payment\Observer\AdyenHppDataAssignObserver
::
BRAND_CODE
))
\Adyen\Payment\Observer\AdyenHppDataAssignObserver
::
BRAND_CODE
))
)
{
$formFields
[
'openinvoicedata.'
.
$linename
.
'.vatCategory'
]
=
"High"
;
}
else
{
...
...
@@ -1275,52 +1298,50 @@ class Data extends AbstractHelper
return
$formattedHtml
;
}
/**
* Initializes and returns Adyen Client and sets the required parameters of it
*
* @param int|null $storeId
* @param string|null $apiKey
* @return \Adyen\Client
* @throws \Adyen\AdyenException
*/
public
function
initializeAdyenClient
(
$storeId
=
null
,
$apiKey
=
null
)
{
// initialize client
$client
=
new
\Adyen\Client
();
if
(
$apiKey
)
{
$client
->
setXApiKey
(
$apiKey
);
}
else
{
$client
->
setUsername
(
$this
->
getWsUsername
(
$storeId
));
$client
->
setPassword
(
$this
->
getWsPassword
(
$storeId
));
}
$client
->
setApplicationName
(
"Magento 2 plugin"
);
$client
->
setAdyenPaymentSource
(
$this
->
getModuleName
(),
$this
->
getModuleVersion
());
$client
->
setExternalPlatform
(
$this
->
productMetadata
->
getName
(),
$this
->
productMetadata
->
getVersion
());
if
(
$this
->
isDemoMode
(
$storeId
))
{
$client
->
setEnvironment
(
\Adyen\Environment
::
TEST
);
}
else
{
$client
->
setEnvironment
(
\Adyen\Environment
::
LIVE
);
}
$client
->
setLogger
(
$this
->
adyenLogger
);
return
$client
;
}
/**
* @param \Adyen\Clien $client
* @return \Adyen\Service\PosPayment
* @throws \Adyen\AdyenException
*/
public
function
createAdyenPosPaymentService
(
$client
)
{
return
new
\Adyen\Service\PosPayment
(
$client
);
}
}
/**
* Initializes and returns Adyen Client and sets the required parameters of it
*
* @param int|null $storeId
* @param string|null $apiKey
* @return \Adyen\Client
* @throws \Adyen\AdyenException
*/
public
function
initializeAdyenClient
(
$storeId
=
null
,
$apiKey
=
null
)
{
// initialize client
$client
=
new
\Adyen\Client
();
if
(
$apiKey
)
{
$client
->
setXApiKey
(
$apiKey
);
}
else
{
$client
->
setUsername
(
$this
->
getWsUsername
(
$storeId
));
$client
->
setPassword
(
$this
->
getWsPassword
(
$storeId
));
}
$client
->
setApplicationName
(
"Magento 2 plugin"
);
$client
->
setAdyenPaymentSource
(
$this
->
getModuleName
(),
$this
->
getModuleVersion
());
$client
->
setExternalPlatform
(
$this
->
productMetadata
->
getName
(),
$this
->
productMetadata
->
getVersion
());
if
(
$this
->
isDemoMode
(
$storeId
))
{
$client
->
setEnvironment
(
\Adyen\Environment
::
TEST
);
}
else
{
$client
->
setEnvironment
(
\Adyen\Environment
::
LIVE
);
}
$client
->
setLogger
(
$this
->
adyenLogger
);
return
$client
;
}
/**
* @param \Adyen\Clien $client
* @return \Adyen\Service\PosPayment
* @throws \Adyen\AdyenException
*/
public
function
createAdyenPosPaymentService
(
$client
)
{
return
new
\Adyen\Service\PosPayment
(
$client
);
}
}
Helper/PaymentMethods.php
View file @
165cb2b2
...
...
@@ -426,14 +426,14 @@ class PaymentMethods extends AbstractHelper
/**
* @var array
*/
protected
$_cacheParams
=
array
(
protected
$_cacheParams
=
[
'currencyCode'
,
'merchantReference'
,
'skinCode'
,
'merchantAccount'
,
'countryCode'
,
'shopperLocale'
,
)
;
]
;
/**
* @param $requestParams
...
...
@@ -460,4 +460,4 @@ class PaymentMethods extends AbstractHelper
{
return
$this
->
_session
->
getQuote
();
}
}
\ No newline at end of file
}
Logger/AdyenLogger.php
View file @
165cb2b2
...
...
@@ -66,22 +66,22 @@ class AdyenLogger extends Logger
* @param array $context The log context
* @return Boolean Whether the record has been processed
*/
public
function
addAdyenNotification
(
$message
,
array
$context
=
array
()
)
public
function
addAdyenNotification
(
$message
,
array
$context
=
[]
)
{
return
$this
->
addRecord
(
static
::
ADYEN_NOTIFICATION
,
$message
,
$context
);
}
public
function
addAdyenDebug
(
$message
,
array
$context
=
array
()
)
public
function
addAdyenDebug
(
$message
,
array
$context
=
[]
)
{
return
$this
->
addRecord
(
static
::
ADYEN_DEBUG
,
$message
,
$context
);
}
public
function
addAdyenResult
(
$message
,
array
$context
=
array
()
)
public
function
addAdyenResult
(
$message
,
array
$context
=
[]
)
{
return
$this
->
addRecord
(
static
::
ADYEN_RESULT
,
$message
,
$context
);
}
public
function
addAdyenNotificationCronjob
(
$message
,
array
$context
=
array
()
)
public
function
addAdyenNotificationCronjob
(
$message
,
array
$context
=
[]
)
{
return
$this
->
addRecord
(
static
::
ADYEN_NOTIFICATION_CRONJOB
,
$message
,
$context
);
}
...
...
@@ -109,8 +109,8 @@ class AdyenLogger extends Logger
* @param array $context The log context
* @return Boolean Whether the record has been processed
*/
public
function
addNotificationLog
(
$message
,
array
$context
=
array
()
)
public
function
addNotificationLog
(
$message
,
array
$context
=
[]
)
{
return
$this
->
addRecord
(
static
::
INFO
,
$message
,
$context
);
}
}
\ No newline at end of file
}
Logger/Handler/AdyenBase.php
View file @
165cb2b2
...
...
@@ -36,4 +36,4 @@ class AdyenBase extends Base
{
return
$record
[
'level'
]
==
$this
->
level
;
}
}
\ No newline at end of file
}
Logger/Handler/AdyenCronjob.php
View file @
165cb2b2
...
...
@@ -39,5 +39,4 @@ class AdyenCronjob extends AdyenBase
protected
$loggerType
=
AdyenLogger
::
ADYEN_NOTIFICATION_CRONJOB
;
protected
$level
=
AdyenLogger
::
ADYEN_NOTIFICATION_CRONJOB
;
}
Logger/Handler/AdyenDebug.php
View file @
165cb2b2
...
...
@@ -39,5 +39,4 @@ class AdyenDebug extends AdyenBase
protected
$loggerType
=
AdyenLogger
::
ADYEN_DEBUG
;
protected
$level
=
AdyenLogger
::
ADYEN_DEBUG
;
}
Logger/Handler/AdyenError.php
View file @
165cb2b2
...
...
@@ -42,5 +42,4 @@ class AdyenError extends AdyenBase
* @var
*/
protected
$level
=
AdyenLogger
::
ERROR
;
}
Logger/Handler/AdyenInfo.php
View file @
165cb2b2
...
...
@@ -39,5 +39,4 @@ class AdyenInfo extends AdyenBase
protected
$loggerType
=
AdyenLogger
::
INFO
;
protected
$level
=
AdyenLogger
::
INFO
;
}
Logger/Handler/AdyenNotification.php
View file @
165cb2b2
...
...
@@ -39,5 +39,4 @@ class AdyenNotification extends AdyenBase
protected
$loggerType
=
AdyenLogger
::
ADYEN_NOTIFICATION
;
protected
$level
=
AdyenLogger
::
ADYEN_NOTIFICATION
;
}
Logger/Handler/AdyenResult.php
View file @
165cb2b2
...
...
@@ -39,5 +39,4 @@ class AdyenResult extends AdyenBase
protected
$loggerType
=
AdyenLogger
::
ADYEN_RESULT
;
protected
$level
=
AdyenLogger
::
ADYEN_RESULT
;
}
\ No newline at end of file
}
Model/AdyenInitiateTerminalApi.php
View file @
165cb2b2
...
...
@@ -30,20 +30,20 @@ use Adyen\Util\Util;
class
AdyenInitiateTerminalApi
implements
AdyenInitiateTerminalApiInterface
{
/**
* @var \Adyen\Payment\Helper\Data
*/
/**
* @var \Adyen\Payment\Helper\Data
*/
private
$adyenHelper
;
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
/**
* @var \Adyen\Payment\Logger\AdyenLogger
*/
private
$adyenLogger
;
/**
* @var \Adyen\Client
*/
protected
$client
;
/**
* @var \Adyen\Client
*/
protected
$client
;
/**
* @var int
...
...
@@ -68,15 +68,14 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
\Magento\Checkout\Model\Session
$checkoutSession
,
\Magento\Store\Model\StoreManagerInterface
$storeManager
,
array
$data
=
[]
)
{
)
{
$this
->
adyenHelper
=
$adyenHelper
;
$this
->
adyenLogger
=
$adyenLogger
;
$this
->
checkoutSession
=
$checkoutSession
;
$this
->
storeId
=
$storeManager
->
getStore
()
->
getId
();
// initialize client
$apiKey
=
$this
->
adyenHelper
->
getPosApiKey
(
$this
->
storeId
);
$apiKey
=
$this
->
adyenHelper
->
getPosApiKey
(
$this
->
storeId
);
$client
=
$this
->
adyenHelper
->
initializeAdyenClient
(
$this
->
storeId
,
$apiKey
);
//Set configurable option in M2
...
...
@@ -163,10 +162,14 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
}
}
$quote
->
getPayment
()
->
getMethodInstance
()
->
getInfoInstance
()
->
setAdditionalInformation
(
'serviceID'
,
$serviceID
);
$quote
->
getPayment
()
->
getMethodInstance
()
->
getInfoInstance
()
->
setAdditionalInformation
(
'initiateDate'
,
$initiateDate
);
$quote
->
getPayment
()
->
getMethodInstance
()
->
getInfoInstance
()
->
setAdditionalInformation
(
'serviceID'
,
$serviceID
);
$quote
->
getPayment
()
->
getMethodInstance
()
->
getInfoInstance
()
->
setAdditionalInformation
(
'initiateDate'
,
$initiateDate
);
try
{
$response
=
$service
->
runTenderSync
(
$request
);
...
...
@@ -176,14 +179,18 @@ class AdyenInitiateTerminalApi implements AdyenInitiateTerminalApiInterface
$response
[
'error'
]
=
$e
->
getMessage
();
}
catch
(
\Exception
$e
)
{
//Probably timeout
$quote
->
getPayment
()
->
getMethodInstance
()
->
getInfoInstance
()
->
setAdditionalInformation
(
'terminalResponse'
,
null
);
$quote
->
getPayment
()
->
getMethodInstance
()
->
getInfoInstance
()
->
setAdditionalInformation
(
'terminalResponse'
,
null
);
$quote
->
save
();
$response
[
'error'
]
=
$e
->
getMessage
();
throw
$e
;
}
$quote
->
getPayment
()
->
getMethodInstance
()
->
getInfoInstance
()
->
setAdditionalInformation
(
'terminalResponse'
,
$response
);
$quote
->
getPayment
()
->
getMethodInstance
()
->
getInfoInstance
()
->
setAdditionalInformation
(
'terminalResponse'
,
$response
);
$quote
->
save
();
return
$response
;
...
...
Model/AdyenPaymentMethodManagement.php
View file @
165cb2b2
...
...
@@ -54,5 +54,4 @@ class AdyenPaymentMethodManagement implements \Adyen\Payment\Api\AdyenPaymentMet
return
$this
->
_paymentMethodsHelper
->
getPaymentMethods
(
$cartId
,
$country
);
}
}
\ No newline at end of file
}
Model/AdyenRequestMerchantSession.php
View file @
165cb2b2
...
...
@@ -81,7 +81,7 @@ class AdyenRequestMerchantSession implements AdyenRequestMerchantSessionInterfac
"displayName":"'
.
$displayName
.
'"
}'
;
$this
->
_adyenLogger
->
addAdyenDebug
(
"JSON Requesst is: "
.
print_r
(
$data
,
true
));
$this
->
_adyenLogger
->
addAdyenDebug
(
"JSON Requesst is: "
.
print_r
(
$data
,
true
));
curl_setopt
(
$ch
,
CURLOPT_URL
,
$validationUrl
);
...
...
@@ -92,11 +92,10 @@ class AdyenRequestMerchantSession implements AdyenRequestMerchantSessionInterfac
curl_setopt
(
$ch
,
CURLOPT_SSLCERT
,
$fullPathLocationPEMFile
);
curl_setopt
(
$ch
,
CURLOPT_POST
,
1
);
curl_setopt
(
$ch
,
CURLOPT_POSTFIELDS
,
$data
);
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
array
(
curl_setopt
(
$ch
,
CURLOPT_HTTPHEADER
,
[
'Content-Type: application/json'
,
'Content-Length: '
.
strlen
(
$data
)
)
);
]);
$result
=
curl_exec
(
$ch
);
$httpStatus
=
curl_getinfo
(
$ch
,
CURLINFO_HTTP_CODE
);
...
...
@@ -107,7 +106,7 @@ class AdyenRequestMerchantSession implements AdyenRequestMerchantSessionInterfac
// result not 200 throw error
if
(
$httpStatus
!=
200
&&
$result
)
{
$this
->
_adyenLogger
->
addAdyenDebug
(
"Error Apple, API HTTP Status is: "
.
$httpStatus
.
" result is:"
.
$result
);
}
elseif
(
!
$result
)
{
}
elseif
(
!
$result
)
{
$errno
=
curl_errno
(
$ch
);
$message
=
curl_error
(
$ch
);
$msg
=
"(Network error [errno
$errno
]:
$message
)"
;
...
...
@@ -117,4 +116,4 @@ class AdyenRequestMerchantSession implements AdyenRequestMerchantSessionInterfac
curl_close
(
$ch
);
return
$result
;
}
}
\ No newline at end of file
}
Model/Api/PaymentRequest.php
View file @
165cb2b2
...
...
@@ -78,13 +78,14 @@ class PaymentRequest extends DataObject
$this
->
_appState
=
$context
->
getAppState
();
}
/**
* @param $storeId
* @return mixed
* @throws \Adyen\AdyenException
*/
private
function
createClient
(
$storeId
)
{
$client
=
$this
->
_adyenHelper
->
initializeAdyenClient
(
$storeId
);
/**
* @param $storeId
* @return mixed
* @throws \Adyen\AdyenException
*/
private
function
createClient
(
$storeId
)
{
$client
=
$this
->
_adyenHelper
->
initializeAdyenClient
(
$storeId
);
return
$client
;
}
...
...
@@ -116,7 +117,7 @@ class PaymentRequest extends DataObject
$client
=
$this
->
createClient
(
$storeId
);
$service
=
new
\Adyen\Service\Payment
(
$client
);
$result
=
$service
->
authorise3D
(
$request
);
}
catch
(
\Adyen\AdyenException
$e
)
{
}
catch
(
\Adyen\AdyenException
$e
)
{
throw
new
\Magento\Framework\Exception\LocalizedException
(
__
(
'3D secure failed'
));
}
...
...
@@ -135,7 +136,6 @@ class PaymentRequest extends DataObject
$recurringTypes
=
$this
->
_recurringType
->
getAllowedRecurringTypesForListRecurringCall
();
foreach
(
$recurringTypes
as
$recurringType
)
{
try
{
// merge ONECLICK and RECURRING into one record with recurringType ONECLICK,RECURRING
$listRecurringContractByType
=
...
...
@@ -221,7 +221,7 @@ class PaymentRequest extends DataObject
try
{
$result
=
$service
->
disable
(
$request
);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
$this
->
_adyenLogger
->
info
(
$e
->
getMessage
());
}
...
...
@@ -231,4 +231,4 @@ class PaymentRequest extends DataObject
throw
new
\Magento\Framework\Exception\LocalizedException
(
__
(
'Failed to disable this contract'
));
}
}
}
\ No newline at end of file
}
Model/Billing/Agreement.php
View file @
165cb2b2
...
...
@@ -33,7 +33,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
/**
* Agreement constructor.
*
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
...
...
@@ -55,14 +55,16 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
\Magento\Framework\Data\Collection\AbstractDb
$resourceCollection
=
null
,
array
$data
=
[]
)
{
parent
::
__construct
(
$context
,
$registry
,
$paymentData
,
$billingAgreementFactory
,
$dateFactory
,
$resource
,
$resourceCollection
,
$data
);
parent
::
__construct
(
$context
,
$registry
,
$paymentData
,
$billingAgreementFactory
,
$dateFactory
,
$resource
,
$resourceCollection
,
$data
);
$this
->
_adyenHelper
=
$adyenHelper
;
}
...
...
@@ -93,7 +95,8 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
//Billing agreement SEPA
if
(
isset
(
$data
[
'bank'
][
'iban'
]))
{
$this
->
setAgreementLabel
(
__
(
'%1, %2'
,
$this
->
setAgreementLabel
(
__
(
'%1, %2'
,
$data
[
'bank'
][
'iban'
],
$data
[
'bank'
][
'ownerName'
]
));
...
...
@@ -108,7 +111,8 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
$ccType
=
$ccTypes
[
$ccType
][
'name'
];
}
$label
=
__
(
'%1, %2, **** %3'
,
$label
=
__
(
'%1, %2, **** %3'
,
$ccType
,
$data
[
'card'
][
'holderName'
],
$data
[
'card'
][
'number'
],
...
...
@@ -119,7 +123,6 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
}
if
(
$data
[
'variant'
]
==
'paypal'
)
{
$email
=
""
;
if
(
isset
(
$data
[
'tokenDetails'
][
'tokenData'
][
'EmailId'
]))
{
...
...
@@ -128,7 +131,8 @@ class Agreement extends \Magento\Paypal\Model\Billing\Agreement
$email
=
$data
[
'lastKnownShopperEmail'
];
}
$label
=
__
(
'PayPal %1'
,
$label
=
__
(
'PayPal %1'
,
$email
);
$this
->
setAgreementLabel
(
$label
);
...
...
Model/Config/Backend/Installments.php
View file @
165cb2b2
...
...
@@ -127,7 +127,6 @@ class Installments extends \Magento\Framework\App\Config\Value
// first combine the ccTypes together
$list
=
[];
foreach
(
$value
as
$ccType
=>
$items
)
{
// sort on amount
ksort
(
$items
);
...
...
Model/Config/Source/ApplePayShippingType.php
View file @
165cb2b2
...
...
@@ -24,7 +24,6 @@
namespace
Adyen\Payment\Model\Config\Source
;
class
ApplePayShippingType
implements
\Magento\Framework\Option\ArrayInterface
{
/**
...
...
@@ -46,7 +45,8 @@ class ApplePayShippingType implements \Magento\Framework\Option\ArrayInterface
/**
* @return array
*/
public
function
toOptionArray
()
{
public
function
toOptionArray
()
{
return
$this
->
_adyenHelper
->
getApplePayShippingTypes
();
}
}
\ No newline at end of file
}
Model/Config/Source/CaptureMode.php
View file @
165cb2b2
...
...
@@ -34,7 +34,7 @@ class CaptureMode implements \Magento\Framework\Option\ArrayInterface
/**
* CaptureMode constructor.
*
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public
function
__construct
(
...
...
Model/Config/Source/DemoMode.php
View file @
165cb2b2
...
...
@@ -33,7 +33,7 @@ class DemoMode implements \Magento\Framework\Option\ArrayInterface
/**
* DemoMode constructor.
*
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public
function
__construct
(
...
...
Model/Config/Source/RecurringType.php
View file @
165cb2b2
...
...
@@ -39,8 +39,7 @@ class RecurringType implements \Magento\Framework\Option\ArrayInterface
*/
public
function
__construct
(
\Adyen\Payment\Helper\Data
$adyenHelper
)
{
)
{
$this
->
_adyenHelper
=
$adyenHelper
;
}
...
...
Model/Config/Source/SepaFlow.php
View file @
165cb2b2
...
...
@@ -38,5 +38,4 @@ class SepaFlow implements \Magento\Framework\Option\ArrayInterface
[
'value'
=>
self
::
SEPA_FLOW_AUTHCAP
,
'label'
=>
__
(
'Auth/Cap'
)],
];
}
}
\ No newline at end of file
}
Model/Config/Source/SplitPaymentRefundStrategy.php
View file @
165cb2b2
...
...
@@ -48,5 +48,4 @@ class SplitPaymentRefundStrategy implements \Magento\Framework\Option\ArrayInter
self
::
REFUND_ON_RATIO
=>
__
(
'refund based on ratio'
)
];
}
}
Model/Cron.php
View file @
165cb2b2
...
...
@@ -250,8 +250,7 @@ class Cron
\Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory
$orderStatusCollection
,
SearchCriteriaBuilder
$searchCriteriaBuilder
,
OrderRepository
$orderRepository
)
{
)
{
$this
->
_scopeConfig
=
$scopeConfig
;
$this
->
_adyenLogger
=
$adyenLogger
;
$this
->
_notificationFactory
=
$notificationFactory
;
...
...
@@ -317,7 +316,6 @@ class Cron
// loop over the notifications
$count
=
0
;
foreach
(
$notifications
as
$notification
)
{
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
sprintf
(
"Processing notification %s"
,
$notification
->
getEntityId
())
);
...
...
@@ -349,7 +347,6 @@ class Cron
$this
->
_order
=
$order
;
if
(
!
$this
->
_order
)
{
// order does not exists remove from queue
$notification
->
delete
();
continue
;
...
...
@@ -376,7 +373,6 @@ class Cron
$this
->
_order
->
getState
()
===
\Magento\Sales\Model\Order
::
STATE_PAYMENT_REVIEW
||
$this
->
_eventCode
==
Notification
::
ORDER_CLOSED
)
{
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
'Going to cancel the order'
);
// if payment is API check, check if API result pspreference is the same as reference
...
...
@@ -451,8 +447,11 @@ class Cron
protected
function
_isDuplicate
(
$notification
)
{
return
$notification
->
isDuplicate
(
$notification
->
getPspreference
(),
$notification
->
getEventCode
(),
$notification
->
getSuccess
(),
$notification
->
getOriginalReference
(),
true
$notification
->
getPspreference
(),
$notification
->
getEventCode
(),
$notification
->
getSuccess
(),
$notification
->
getOriginalReference
(),
true
);
}
...
...
@@ -491,7 +490,6 @@ class Cron
}
if
(
$additionalData
&&
is_array
(
$additionalData
))
{
// check if the payment is in status manual review
$fraudManualReview
=
isset
(
$additionalData
[
'fraudManualReview'
])
?
$additionalData
[
'fraudManualReview'
]
:
""
;
...
...
@@ -554,7 +552,6 @@ class Cron
$success
=
(
!
empty
(
$this
->
_reason
))
?
"
$successResult
<br />reason:
$this->_reason
"
:
$successResult
;
if
(
$this
->
_eventCode
==
Notification
::
REFUND
||
$this
->
_eventCode
==
Notification
::
CAPTURE
)
{
$currency
=
$this
->
_order
->
getOrderCurrencyCode
();
// check if it is a full or partial refund
...
...
@@ -567,17 +564,20 @@ class Cron
if
(
$amount
==
$orderAmount
)
{
$this
->
_order
->
setData
(
'adyen_notification_event_code'
,
$this
->
_eventCode
.
" : "
.
strtoupper
(
$successResult
)
'adyen_notification_event_code'
,
$this
->
_eventCode
.
" : "
.
strtoupper
(
$successResult
)
);
}
else
{
$this
->
_order
->
setData
(
'adyen_notification_event_code'
,
"(PARTIAL) "
.
'adyen_notification_event_code'
,
"(PARTIAL) "
.
$this
->
_eventCode
.
" : "
.
strtoupper
(
$successResult
)
);
}
}
else
{
$this
->
_order
->
setData
(
'adyen_notification_event_code'
,
$this
->
_eventCode
.
" : "
.
strtoupper
(
$successResult
)
'adyen_notification_event_code'
,
$this
->
_eventCode
.
" : "
.
strtoupper
(
$successResult
)
);
}
...
...
@@ -595,14 +595,24 @@ class Cron
}
$type
=
'Adyen HTTP Notification(s):'
;
$comment
=
__
(
'%1 <br /> eventCode: %2 <br /> pspReference: %3 <br /> paymentMethod: %4 <br />'
.
' success: %5 %6 %7'
,
$type
,
$this
->
_eventCode
,
$this
->
_pspReference
,
$this
->
_paymentMethod
,
$success
,
$klarnaReservationNumberText
,
$boletoPaidAmountText
);
$comment
=
__
(
'%1 <br /> eventCode: %2 <br /> pspReference: %3 <br /> paymentMethod: %4 <br />'
.
' success: %5 %6 %7'
,
$type
,
$this
->
_eventCode
,
$this
->
_pspReference
,
$this
->
_paymentMethod
,
$success
,
$klarnaReservationNumberText
,
$boletoPaidAmountText
);
// If notification is pending status and pending status is set add the status change to the comment history
if
(
$this
->
_eventCode
==
Notification
::
PENDING
)
{
$pendingStatus
=
$this
->
_getConfigData
(
'pending_status'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
'pending_status'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
);
if
(
$pendingStatus
!=
""
)
{
$this
->
_order
->
addStatusHistoryComment
(
$comment
,
$pendingStatus
);
...
...
@@ -641,7 +651,6 @@ class Cron
||
$this
->
_eventCode
==
Notification
::
HANDLED_EXTERNALLY
||
(
$this
->
_eventCode
==
Notification
::
CAPTURE
&&
$_paymentCode
==
"adyen_pos"
)
)
{
/*
* if current notification is authorisation : false and
* the previous notification was authorisation : true do not update pspreference
...
...
@@ -650,7 +659,6 @@ class Cron
strcmp
(
$this
->
_success
,
'0'
)
==
0
||
strcmp
(
$this
->
_success
,
''
)
==
0
)
{
$previousAdyenEventCode
=
$this
->
_order
->
getData
(
'adyen_notification_event_code'
);
if
(
$previousAdyenEventCode
!=
"AUTHORISATION : TRUE"
)
{
$this
->
_updateOrderPaymentWithAdyenAttributes
(
$additionalData
);
...
...
@@ -689,7 +697,8 @@ class Cron
if
(
$this
->
_klarnaReservationNumber
!=
""
)
{
$this
->
_order
->
getPayment
()
->
setAdditionalInformation
(
'adyen_klarna_number'
,
$this
->
_klarnaReservationNumber
'adyen_klarna_number'
,
$this
->
_klarnaReservationNumber
);
}
if
(
isset
(
$ccLast4
)
&&
$ccLast4
!=
""
)
{
...
...
@@ -725,10 +734,10 @@ class Cron
}
if
(
$this
->
ratepayDescriptor
!==
""
)
{
$this
->
_order
->
getPayment
()
->
setAdditionalInformation
(
'adyen_ratepay_descriptor'
,
$this
->
ratepayDescriptor
'adyen_ratepay_descriptor'
,
$this
->
ratepayDescriptor
);
}
}
/**
...
...
@@ -758,14 +767,14 @@ class Cron
protected
function
_holdCancelOrder
(
$ignoreHasInvoice
)
{
$orderStatus
=
$this
->
_getConfigData
(
'payment_cancelled'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
'payment_cancelled'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
);
// check if order has in invoice only cancel/hold if this is not the case
if
(
$ignoreHasInvoice
||
!
$this
->
_order
->
hasInvoices
())
{
if
(
$orderStatus
==
\Magento\Sales\Model\Order
::
STATE_HOLDED
)
{
// Allow magento to hold order
$this
->
_order
->
setActionFlag
(
\Magento\Sales\Model\Order
::
ACTION_FLAG_HOLD
,
true
);
...
...
@@ -806,7 +815,9 @@ class Cron
break
;
case
Notification
::
REFUND
:
$ignoreRefundNotification
=
$this
->
_getConfigData
(
'ignore_refund_notification'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
'ignore_refund_notification'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
);
if
(
$ignoreRefundNotification
!=
true
)
{
$this
->
_refundOrder
();
...
...
@@ -820,7 +831,10 @@ class Cron
break
;
case
Notification
::
PENDING
:
if
(
$this
->
_getConfigData
(
'send_email_bank_sepa_on_pending'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
())
'send_email_bank_sepa_on_pending'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
)
)
{
// Check if payment is banktransfer or sepa if true then send out order confirmation email
$isBankTransfer
=
$this
->
_isBankTransfer
();
...
...
@@ -905,7 +919,6 @@ class Cron
if
(
$this
->
_order
->
isCanceled
()
||
$this
->
_order
->
getState
()
===
\Magento\Sales\Model\Order
::
STATE_HOLDED
)
{
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
'Order is already cancelled or holded so do nothing'
);
...
...
@@ -932,12 +945,17 @@ class Cron
$customerReference
=
$this
->
_order
->
getCustomerId
();
$listRecurringContracts
=
null
;
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
__
(
'CustomerReference is: %1 and storeId is %2 and RecurringDetailsReference is %3'
,
$customerReference
,
$storeId
,
$recurringDetailReference
)
__
(
'CustomerReference is: %1 and storeId is %2 and RecurringDetailsReference is %3'
,
$customerReference
,
$storeId
,
$recurringDetailReference
)
);
try
{
$listRecurringContracts
=
$this
->
_adyenPaymentRequest
->
getRecurringContractsForShopper
(
$customerReference
,
$storeId
$customerReference
,
$storeId
);
$contractDetail
=
null
;
// get current Contract details and get list of all current ones
...
...
@@ -1010,7 +1028,6 @@ class Cron
// Populate billing agreement data
$billingAgreement
->
parseRecurringContractData
(
$contractDetail
);
if
(
$billingAgreement
->
isValid
())
{
// save into sales_billing_agreement_order
$billingAgreement
->
addOrderRelation
(
$this
->
_order
);
...
...
@@ -1020,7 +1037,6 @@ class Cron
$message
=
__
(
'Failed to create billing agreement for this order.'
);
throw
new
\Exception
(
$message
);
}
}
catch
(
\Exception
$exception
)
{
$message
=
$exception
->
getMessage
();
}
...
...
@@ -1047,7 +1063,6 @@ class Cron
// check if it is a split payment if so save the refunded data
if
(
$this
->
_originalReference
!=
""
)
{
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
'Going to update the refund to split payments table'
);
$orderPayment
=
$this
->
_adyenOrderPaymentCollectionFactory
...
...
@@ -1074,11 +1089,9 @@ class Cron
*/
$lastTransactionId
=
$this
->
_order
->
getPayment
()
->
getLastTransId
();
if
(
$lastTransactionId
!=
$this
->
_pspReference
)
{
// refund is done through adyen backoffice so create a credit memo
$order
=
$this
->
_order
;
if
(
$order
->
canCreditmemo
())
{
$currency
=
$this
->
_order
->
getOrderCurrencyCode
();
$amount
=
$this
->
_adyenHelper
->
originalAmount
(
$this
->
_value
,
$currency
);
$order
->
getPayment
()
->
registerRefundNotification
(
$amount
);
...
...
@@ -1132,7 +1145,6 @@ class Cron
if
(
!
$this
->
_order
->
getEmailSent
())
{
$this
->
_sendOrderMail
();
}
}
if
((
$this
->
_paymentMethod
==
"c_cash"
&&
...
...
@@ -1140,7 +1152,6 @@ class Cron
(
$this
->
_getConfigData
(
'create_shipment'
,
'adyen_pos'
,
$this
->
_order
->
getStoreId
())
&&
$_paymentCode
==
"adyen_pos"
)
)
{
$this
->
_createShipment
();
}
}
...
...
@@ -1171,7 +1182,9 @@ class Cron
private
function
_setPrePaymentAuthorized
()
{
$status
=
$this
->
_getConfigData
(
'payment_pre_authorized'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
'payment_pre_authorized'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
);
// only do this if status in configuration is set
...
...
@@ -1226,7 +1239,9 @@ class Cron
}
$createPendingInvoice
=
(
bool
)
$this
->
_getConfigData
(
'create_pending_invoice'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
'create_pending_invoice'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
);
if
(
!
$createPendingInvoice
)
{
...
...
@@ -1272,18 +1287,26 @@ class Cron
// validate if payment methods allows manual capture
if
(
$this
->
_manualCaptureAllowed
())
{
$captureMode
=
trim
(
$this
->
_getConfigData
(
'capture_mode'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
())
);
'capture_mode'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
));
$sepaFlow
=
trim
(
$this
->
_getConfigData
(
'sepa_flow'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
())
);
'sepa_flow'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
));
$_paymentCode
=
$this
->
_paymentMethodCode
();
$captureModeOpenInvoice
=
$this
->
_getConfigData
(
'auto_capture_openinvoice'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
'auto_capture_openinvoice'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
);
$manualCapturePayPal
=
trim
(
$this
->
_getConfigData
(
'paypal_capture_mode'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
())
);
'paypal_capture_mode'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
));
/*
* if you are using authcap the payment method is manual.
...
...
@@ -1322,7 +1345,6 @@ class Cron
);
return
false
;
}
}
// if auto capture mode for openinvoice is turned on then use auto capture
...
...
@@ -1365,13 +1387,11 @@ class Cron
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
'Capture mode is set to auto capture'
);
return
true
;
}
else
{
// does not allow manual capture so is always immediate capture
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
'This payment method does not allow manual capture'
);
return
true
;
}
}
/**
...
...
@@ -1434,7 +1454,9 @@ class Cron
protected
function
_getFraudManualReviewStatus
()
{
return
$this
->
_getConfigData
(
'fraud_manual_review_status'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
'fraud_manual_review_status'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
);
}
...
...
@@ -1444,7 +1466,9 @@ class Cron
protected
function
_getFraudManualReviewAcceptStatus
()
{
return
$this
->
_getConfigData
(
'fraud_manual_review_accept_status'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
'fraud_manual_review_accept_status'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
);
}
...
...
@@ -1471,7 +1495,8 @@ class Cron
$amount
=
$res
[
0
][
'total_amount'
];
$orderAmount
=
$this
->
_adyenHelper
->
formatAmount
(
$amount
,
$orderCurrencyCode
);
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
sprintf
(
'The grandtotal amount is %s and the total order amount that is authorised is: %s'
,
sprintf
(
'The grandtotal amount is %s and the total order amount that is authorised is: %s'
,
$grandTotal
,
$orderAmount
)
...
...
@@ -1500,7 +1525,6 @@ class Cron
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
'Creating invoice for order'
);
if
(
$this
->
_order
->
canInvoice
())
{
/* We do not use this inside a transaction because order->save()
* is always done on the end of the notification
* and it could result in a deadlock see https://github.com/Adyen/magento/issues/334
...
...
@@ -1515,11 +1539,12 @@ class Cron
$autoCapture
=
$this
->
_isAutoCapture
();
$createPendingInvoice
=
(
bool
)
$this
->
_getConfigData
(
'create_pending_invoice'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
'create_pending_invoice'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
);
if
((
!
$autoCapture
)
&&
(
$createPendingInvoice
))
{
// if amount is zero create a offline invoice
$value
=
(
int
)
$this
->
_value
;
if
(
$value
==
0
)
{
...
...
@@ -1547,7 +1572,6 @@ class Cron
->
save
();
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
'Created invoice entry in the Adyen table'
);
}
catch
(
Exception
$e
)
{
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
'Error saving invoice. The error message is: '
.
$e
->
getMessage
()
...
...
@@ -1594,14 +1618,18 @@ class Cron
}
$status
=
$this
->
_getConfigData
(
'payment_authorized'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
'payment_authorized'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
);
// virtual order can have different status
if
(
$this
->
_order
->
getIsVirtual
())
{
$this
->
_adyenLogger
->
addAdyenNotificationCronjob
(
'Product is a virtual product'
);
$virtualStatus
=
$this
->
_getConfigData
(
'payment_authorized_virtual'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
'payment_authorized_virtual'
,
'adyen_abstract'
,
$this
->
_order
->
getStoreId
()
);
if
(
$virtualStatus
!=
""
)
{
$status
=
$virtualStatus
;
...
...
@@ -1610,13 +1638,11 @@ class Cron
// check for boleto if payment is totally paid
if
(
$this
->
_paymentMethodCode
()
==
"adyen_boleto"
)
{
// check if paid amount is the same as orginal amount
$orginalAmount
=
$this
->
_boletoOriginalAmount
;
$paidAmount
=
$this
->
_boletoPaidAmount
;
if
(
$orginalAmount
!=
$paidAmount
)
{
// not the full amount is paid. Check if it is underpaid or overpaid
// strip the BRL of the string
$orginalAmount
=
str_replace
(
"BRL"
,
""
,
$orginalAmount
);
...
...
@@ -1627,13 +1653,17 @@ class Cron
if
(
$paidAmount
>
$orginalAmount
)
{
$overpaidStatus
=
$this
->
_getConfigData
(
'order_overpaid_status'
,
'adyen_boleto'
,
$this
->
_order
->
getStoreId
()
'order_overpaid_status'
,
'adyen_boleto'
,
$this
->
_order
->
getStoreId
()
);
// check if there is selected a status if not fall back to the default
$status
=
(
!
empty
(
$overpaidStatus
))
?
$overpaidStatus
:
$status
;
}
else
{
$underpaidStatus
=
$this
->
_getConfigData
(
'order_underpaid_status'
,
'adyen_boleto'
,
$this
->
_order
->
getStoreId
()
'order_underpaid_status'
,
'adyen_boleto'
,
$this
->
_order
->
getStoreId
()
);
// check if there is selected a status if not fall back to the default
$status
=
(
!
empty
(
$underpaidStatus
))
?
$underpaidStatus
:
$status
;
...
...
@@ -1722,6 +1752,4 @@ class Cron
$path
=
'payment/'
.
$paymentMethodCode
.
'/'
.
$field
;
return
$this
->
_scopeConfig
->
getValue
(
$path
,
\Magento\Store\Model\ScopeInterface
::
SCOPE_STORE
,
$storeId
);
}
}
Model/Gender.php
View file @
165cb2b2
...
...
@@ -72,4 +72,4 @@ class Gender
}
return
$gender
;
}
}
\ No newline at end of file
}
Model/GuestAdyenPaymentMethodManagement.php
View file @
165cb2b2
...
...
@@ -65,4 +65,4 @@ class GuestAdyenPaymentMethodManagement implements \Adyen\Payment\Api\GuestAdyen
return
$this
->
_paymentMethodsHelper
->
getPaymentMethods
(
$quoteId
,
$country
);
}
}
\ No newline at end of file
}
Model/Invoice.php
View file @
165cb2b2
...
...
@@ -26,8 +26,7 @@ namespace Adyen\Payment\Model;
use
Adyen\Payment\Api\Data\InvoiceInterface
;
class
Invoice
extends
\Magento\Framework\Model\AbstractModel
implements
InvoiceInterface
class
Invoice
extends
\Magento\Framework\Model\AbstractModel
implements
InvoiceInterface
{
/**
* Notification constructor.
...
...
@@ -139,5 +138,4 @@ class Invoice extends \Magento\Framework\Model\AbstractModel
{
return
$this
->
setData
(
self
::
INVOICE_ID
,
$invoiceId
);
}
}
\ No newline at end of file
}
Model/Method/Adapter.php
View file @
165cb2b2
...
...
@@ -96,11 +96,10 @@ class Adapter extends Method\Adapter
$agreement
->
getCustomerReference
(),
$agreement
->
getStoreId
()
);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
throw
new
\Magento\Framework\Exception\LocalizedException
(
__
(
'Failed to disable this contract'
));
}
}
return
$this
;
}
}
Model/Notification.php
View file @
165cb2b2
...
...
@@ -25,8 +25,7 @@ namespace Adyen\Payment\Model;
use
Adyen\Payment\Api\Data\NotificationInterface
;
class
Notification
extends
\Magento\Framework\Model\AbstractModel
implements
NotificationInterface
class
Notification
extends
\Magento\Framework\Model\AbstractModel
implements
NotificationInterface
{
const
AUTHORISATION
=
'AUTHORISATION'
;
...
...
@@ -400,4 +399,4 @@ class Notification extends \Magento\Framework\Model\AbstractModel
{
return
$this
->
setData
(
self
::
UPDATED_AT
,
$timestamp
);
}
}
\ No newline at end of file
}
Model/Order/Payment.php
View file @
165cb2b2
...
...
@@ -25,8 +25,7 @@ namespace Adyen\Payment\Model\Order;
use
Adyen\Payment\Api\Data\OrderPaymentInterface
;
class
Payment
extends
\Magento\Framework\Model\AbstractModel
implements
OrderPaymentInterface
class
Payment
extends
\Magento\Framework\Model\AbstractModel
implements
OrderPaymentInterface
{
/**
...
...
@@ -193,4 +192,4 @@ class Payment extends \Magento\Framework\Model\AbstractModel
{
return
$this
->
setData
(
self
::
UPDATED_AT
,
$updatedAt
);
}
}
\ No newline at end of file
}
Model/RecurringType.php
View file @
165cb2b2
...
...
@@ -23,9 +23,10 @@
namespace
Adyen\Payment\Model
;
class
RecurringType
{
class
RecurringType
{
CONST
NONE
=
''
;
const
NONE
=
''
;
const
ONECLICK
=
'ONECLICK'
;
const
ONECLICK_RECURRING
=
'ONECLICK,RECURRING'
;
const
RECURRING
=
'RECURRING'
;
...
...
@@ -45,4 +46,4 @@ class RecurringType {
{
return
$this
->
_allowedRecurringTypesForListRecurringCall
;
}
}
\ No newline at end of file
}
Model/ResourceModel/Billing/Agreement.php
View file @
165cb2b2
...
...
@@ -29,4 +29,4 @@ namespace Adyen\Payment\Model\ResourceModel\Billing;
class
Agreement
extends
\Magento\Paypal\Model\ResourceModel\Billing\Agreement
{
}
\ No newline at end of file
}
Model/ResourceModel/Invoice.php
View file @
165cb2b2
...
...
@@ -35,4 +35,4 @@ class Invoice extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
$this
->
_init
(
'adyen_invoice'
,
'entity_id'
);
}
}
\ No newline at end of file
}
Model/ResourceModel/Invoice/Collection.php
View file @
165cb2b2
...
...
@@ -33,5 +33,4 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab
{
$this
->
_init
(
'Adyen\Payment\Model\Invoice'
,
'Adyen\Payment\Model\ResourceModel\Invoice'
);
}
}
\ No newline at end of file
}
Model/ResourceModel/Notification.php
View file @
165cb2b2
...
...
@@ -36,7 +36,7 @@ class Notification extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
/**
* Get Notification for duplicate check
*
*
* @param $pspReference
* @param $eventCode
* @param $success
...
...
@@ -62,4 +62,4 @@ class Notification extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
return
$this
->
getConnection
()
->
fetchAll
(
$select
);
}
}
\ No newline at end of file
}
Model/ResourceModel/Notification/Collection.php
View file @
165cb2b2
...
...
@@ -46,4 +46,4 @@ class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\Ab
$this
->
addFieldToFilter
(
'created_at'
,
$dateRange
);
return
$this
;
}
}
\ No newline at end of file
}
Model/ResourceModel/Order/Payment.php
View file @
165cb2b2
...
...
@@ -32,4 +32,4 @@ class Payment extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
$this
->
_init
(
'adyen_order_payment'
,
'entity_id'
);
}
}
\ No newline at end of file
}
Model/Ui/AdyenApplePayConfigProvider.php
View file @
165cb2b2
...
...
@@ -87,7 +87,9 @@ class AdyenApplePayConfigProvider implements ConfigProviderInterface
self
::
CODE
=>
[
'isActive'
=>
true
,
'redirectUrl'
=>
$this
->
_urlBuilder
->
getUrl
(
'checkout/onepage/success/'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]),
'checkout/onepage/success/'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]
),
'merchant_identifier'
=>
$this
->
_adyenHelper
->
getAdyenApplePayMerchantIdentifier
()
]
]
...
...
@@ -103,4 +105,4 @@ class AdyenApplePayConfigProvider implements ConfigProviderInterface
{
return
$this
->
_request
;
}
}
\ No newline at end of file
}
Model/Ui/AdyenBoletoConfigProvider.php
View file @
165cb2b2
...
...
@@ -83,7 +83,9 @@ class AdyenBoletoConfigProvider implements ConfigProviderInterface
self
::
CODE
=>
[
'isActive'
=>
true
,
'redirectUrl'
=>
$this
->
_urlBuilder
->
getUrl
(
'checkout/onepage/success/'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()])
'checkout/onepage/success/'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]
)
],
'adyenBoleto'
=>
[
'boletoTypes'
=>
$this
->
getBoletoAvailableTypes
()
...
...
@@ -121,4 +123,4 @@ class AdyenBoletoConfigProvider implements ConfigProviderInterface
{
return
$this
->
_request
;
}
}
\ No newline at end of file
}
Model/Ui/AdyenCcConfigProvider.php
View file @
165cb2b2
...
...
@@ -84,8 +84,7 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
\Magento\Framework\UrlInterface
$urlBuilder
,
Source
$assetSource
,
\Magento\Payment\Model\CcConfig
$ccConfig
)
{
)
{
$this
->
_paymentHelper
=
$paymentHelper
;
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_request
=
$request
;
...
...
@@ -105,7 +104,9 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
self
::
CODE
=>
[
'isActive'
=>
true
,
'redirectUrl'
=>
$this
->
_urlBuilder
->
getUrl
(
'adyen/process/validate3d/'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()])
'adyen/process/validate3d/'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]
)
]
]
];
...
...
@@ -250,4 +251,4 @@ class AdyenCcConfigProvider implements ConfigProviderInterface
{
return
$this
->
_request
;
}
}
\ No newline at end of file
}
Model/Ui/AdyenGenericConfigProvider.php
View file @
165cb2b2
...
...
@@ -38,7 +38,8 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
*
* @param \Adyen\Payment\Helper\Data $adyenHelper
*/
public
function
__construct
(
\Adyen\Payment\Helper\Data
$adyenHelper
)
{
public
function
__construct
(
\Adyen\Payment\Helper\Data
$adyenHelper
)
{
$this
->
_adyenHelper
=
$adyenHelper
;
}
/**
...
...
@@ -81,4 +82,4 @@ class AdyenGenericConfigProvider implements ConfigProviderInterface
}
return
false
;
}
}
\ No newline at end of file
}
Model/Ui/AdyenHppConfigProvider.php
View file @
165cb2b2
...
...
@@ -81,8 +81,7 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
\Magento\Framework\UrlInterface
$urlBuilder
,
\Magento\Customer\Model\Session
$customerSession
,
\Magento\Checkout\Model\Session
$session
)
{
)
{
$this
->
_paymentHelper
=
$paymentHelper
;
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_request
=
$request
;
...
...
@@ -104,7 +103,9 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
self
::
CODE
=>
[
'isActive'
=>
true
,
'redirectUrl'
=>
$this
->
_urlBuilder
->
getUrl
(
'adyen/process/redirect'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()])
'adyen/process/redirect'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]
)
]
]
];
...
...
@@ -114,14 +115,13 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
// get customer
if
(
$this
->
_customerSession
->
isLoggedIn
())
{
$gender
=
\Adyen\Payment\Model\Gender
::
getAdyenGenderFromMagentoGender
(
$this
->
_customerSession
->
getCustomerData
()
->
getGender
()
);
// format to calendar date
$dob
=
$this
->
_customerSession
->
getCustomerData
()
->
getDob
();
if
(
$dob
)
{
if
(
$dob
)
{
$dob
=
strtotime
(
$dob
);
$dob
=
date
(
'm/d/Y'
,
$dob
);
}
...
...
@@ -159,4 +159,4 @@ class AdyenHppConfigProvider implements ConfigProviderInterface
{
return
$this
->
_request
;
}
}
\ No newline at end of file
}
Model/Ui/AdyenOneclickConfigProvider.php
View file @
165cb2b2
...
...
@@ -90,8 +90,7 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
\Magento\Store\Model\StoreManagerInterface
$storeManager
,
\Magento\Framework\UrlInterface
$urlBuilder
,
\Magento\Payment\Model\CcConfig
$ccConfig
)
{
)
{
$this
->
_adyenHelper
=
$adyenHelper
;
$this
->
_request
=
$request
;
$this
->
_customerSession
=
$customerSession
;
...
...
@@ -112,7 +111,9 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
self
::
CODE
=>
[
'isActive'
=>
true
,
'redirectUrl'
=>
$this
->
_urlBuilder
->
getUrl
(
'adyen/process/validate3d/'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()])
'adyen/process/validate3d/'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]
)
]
]
];
...
...
@@ -266,4 +267,4 @@ class AdyenOneclickConfigProvider implements ConfigProviderInterface
{
return
$this
->
_request
;
}
}
\ No newline at end of file
}
Model/Ui/AdyenPayByMailConfigProvider.php
View file @
165cb2b2
...
...
@@ -85,7 +85,9 @@ class AdyenPayByMailConfigProvider implements ConfigProviderInterface
self
::
CODE
=>
[
'isActive'
=>
true
,
'redirectUrl'
=>
$this
->
_urlBuilder
->
getUrl
(
'adyen/process/redirect'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()])
'adyen/process/redirect'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]
)
]
]
];
...
...
@@ -102,4 +104,4 @@ class AdyenPayByMailConfigProvider implements ConfigProviderInterface
{
return
$this
->
_request
;
}
}
\ No newline at end of file
}
Model/Ui/AdyenPosCloudConfigProvider.php
View file @
165cb2b2
...
...
@@ -70,7 +70,9 @@ class AdyenPosCloudConfigProvider implements ConfigProviderInterface
self
::
CODE
=>
[
'isActive'
=>
true
,
'redirectUrl'
=>
$this
->
urlBuilder
->
getUrl
(
'/checkout/onepage/success/'
,
[
'_secure'
=>
$this
->
getRequest
()
->
isSecure
()])
'/checkout/onepage/success/'
,
[
'_secure'
=>
$this
->
getRequest
()
->
isSecure
()]
)
]
]
];
...
...
Model/Ui/AdyenPosConfigProvider.php
View file @
165cb2b2
...
...
@@ -85,7 +85,9 @@ class AdyenPosConfigProvider implements ConfigProviderInterface
self
::
CODE
=>
[
'isActive'
=>
true
,
'redirectUrl'
=>
$this
->
_urlBuilder
->
getUrl
(
'adyen/process/redirectPos'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()])
'adyen/process/redirectPos'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]
)
]
]
];
...
...
@@ -102,4 +104,4 @@ class AdyenPosConfigProvider implements ConfigProviderInterface
{
return
$this
->
_request
;
}
}
\ No newline at end of file
}
Model/Ui/AdyenSepaConfigProvider.php
View file @
165cb2b2
...
...
@@ -85,7 +85,9 @@ class AdyenSepaConfigProvider implements ConfigProviderInterface
self
::
CODE
=>
[
'isActive'
=>
true
,
'redirectUrl'
=>
$this
->
_urlBuilder
->
getUrl
(
'checkout/onepage/success/'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()])
'checkout/onepage/success/'
,
[
'_secure'
=>
$this
->
_getRequest
()
->
isSecure
()]
)
]
]
];
...
...
@@ -104,4 +106,4 @@ class AdyenSepaConfigProvider implements ConfigProviderInterface
{
return
$this
->
_request
;
}
}
\ No newline at end of file
}
Observer/Adminhtml/BeforeShipmentObserver.php
View file @
165cb2b2
...
...
@@ -33,7 +33,7 @@ use Magento\Payment\Observer\AbstractDataAssignObserver;
class
BeforeShipmentObserver
extends
AbstractDataAssignObserver
{
private
$
_
adyenHelper
;
private
$adyenHelper
;
/**
* BeforeShipmentObserver constructor.
...
...
@@ -42,9 +42,8 @@ class BeforeShipmentObserver extends AbstractDataAssignObserver
*/
public
function
__construct
(
\Adyen\Payment\Helper\Data
$adyenHelper
)
{
$this
->
_adyenHelper
=
$adyenHelper
;
)
{
$this
->
adyenHelper
=
$adyenHelper
;
}
/**
...
...
@@ -58,13 +57,12 @@ class BeforeShipmentObserver extends AbstractDataAssignObserver
$captureOnShipment
=
$this
->
_adyenHelper
->
getConfigData
(
'capture_on_shipment'
,
'adyen_abstract'
,
$order
->
getStoreId
());
if
(
$this
->
isPaymentMethodAdyen
(
$order
)
&&
$captureOnShipment
)
{
$payment
=
$order
->
getPayment
();
$brandCode
=
$payment
->
getAdditionalInformation
(
\Adyen\Payment\Observer\AdyenHppDataAssignObserver
::
BRAND_CODE
);
if
(
$this
->
_
adyenHelper
->
isPaymentMethodOpenInvoiceMethod
(
$brandCode
))
{
if
(
$this
->
adyenHelper
->
isPaymentMethodOpenInvoiceMethod
(
$brandCode
))
{
if
(
$order
->
canInvoice
())
{
try
{
$invoice
=
$order
->
prepareInvoice
();
...
...
@@ -75,8 +73,8 @@ class BeforeShipmentObserver extends AbstractDataAssignObserver
$invoice
->
setTransactionId
(
$pspReference
);
$invoice
->
register
()
->
pay
();
$invoice
->
save
();
}
catch
(
Exception
$e
)
{
throw
new
Exception
(
sprintf
(
'Error saving invoice. The error message is:'
,
$e
->
getMessage
()));
}
catch
(
\
Exception
$e
)
{
throw
new
\
Exception
(
sprintf
(
'Error saving invoice. The error message is:'
,
$e
->
getMessage
()));
}
}
}
...
...
Observer/AdyenHppDataAssignObserver.php
View file @
165cb2b2
...
...
@@ -78,7 +78,7 @@ class AdyenHppDataAssignObserver extends AbstractDataAssignObserver
$additionalInformationKey
,
$additionalData
[
$additionalInformationKey
]
);
}
}
}
}
}
Observer/AdyenOneclickDataAssignObserver.php
View file @
165cb2b2
...
...
@@ -64,7 +64,6 @@ class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver
)
{
$this
->
adyenHelper
=
$adyenHelper
;
$this
->
appState
=
$context
->
getAppState
();
}
/**
...
...
@@ -108,7 +107,6 @@ class AdyenOneclickDataAssignObserver extends AbstractDataAssignObserver
$variant
=
$additionalData
[
'variant'
];
$ccType
=
$this
->
adyenHelper
->
getMagentoCreditCartType
(
$variant
);
$paymentInfo
->
setAdditionalInformation
(
'cc_type'
,
$ccType
);
}
/**
...
...
Setup/InstallSchema.php
View file @
165cb2b2
...
...
@@ -112,4 +112,4 @@ class InstallSchema implements InstallSchemaInterface
$installer
->
endSetup
();
}
}
\ No newline at end of file
}
Setup/UpgradeSchema.php
View file @
165cb2b2
...
...
@@ -123,7 +123,9 @@ class UpgradeSchema implements UpgradeSchemaInterface
'comment'
=>
'Agreement Data'
];
$connection
->
addColumn
(
$setup
->
getTable
(
'paypal_billing_agreement'
),
'agreement_data'
,
$adyenAgreementDataColumn
$setup
->
getTable
(
'paypal_billing_agreement'
),
'agreement_data'
,
$adyenAgreementDataColumn
);
}
...
...
@@ -241,7 +243,8 @@ class UpgradeSchema implements UpgradeSchemaInterface
$connection
->
addColumn
(
$setup
->
getTable
(
'adyen_notification'
),
\Adyen\Payment\Model\Notification
::
ORIGINAL_REFERENCE
,
$column
\Adyen\Payment\Model\Notification
::
ORIGINAL_REFERENCE
,
$column
);
}
...
...
@@ -326,11 +329,13 @@ class UpgradeSchema implements UpgradeSchemaInterface
[
'unsigned'
=>
true
,
'nullable'
=>
true
],
'Adyen OriginalReference of the payment'
)
->
addColumn
(
'acquirer_reference'
,
->
addColumn
(
'acquirer_reference'
,
\Magento\Framework\DB\Ddl\Table
::
TYPE_TEXT
,
255
,
[
'unsigned'
=>
true
,
'nullable'
=>
true
],
'Adyen AcquirerReference of the capture'
)
'Adyen AcquirerReference of the capture'
)
->
addColumn
(
'invoice_id'
,
\Magento\Framework\DB\Ddl\Table
::
TYPE_INTEGER
,
...
...
@@ -354,4 +359,4 @@ class UpgradeSchema implements UpgradeSchemaInterface
$setup
->
getConnection
()
->
createTable
(
$table
);
}
}
\ No newline at end of file
}
registration.php
View file @
165cb2b2
...
...
@@ -23,4 +23,4 @@
use
\Magento\Framework\Component\ComponentRegistrar
;
ComponentRegistrar
::
register
(
ComponentRegistrar
::
MODULE
,
'Adyen_Payment'
,
__DIR__
);
\ No newline at end of file
ComponentRegistrar
::
register
(
ComponentRegistrar
::
MODULE
,
'Adyen_Payment'
,
__DIR__
);
view/frontend/templates/checkout/success.phtml
View file @
165cb2b2
...
...
@@ -25,7 +25,7 @@
* @var \Adyen\Payment\Block\Checkout\Success $block
*/
?>
<?php
if
(
$block
->
isBoletoPayment
())
:
?>
<?php
if
(
$block
->
isBoletoPayment
())
:
?>
<p>
<?php
echo
$block
->
escapeHtml
(
__
(
'Boleto PDF: '
));
?>
<a
href=
"
<?php
echo
$block
->
escapeUrl
(
$block
->
getBoletoPdfUrl
());
?>
"
>
...
...
view/frontend/templates/redirect/hpp/form.phtml
View file @
165cb2b2
...
...
@@ -30,9 +30,9 @@
<form
id=
"adyen_form"
method=
"POST"
action=
"
<?php
echo
$block
->
getFormUrl
()
?>
"
>
<?php
foreach
(
$block
->
getFormFields
()
as
$field
=>
$value
)
{
echo
'<input type="hidden" name="'
.
htmlspecialchars
(
$field
,
ENT_COMPAT
|
ENT_HTML401
,
'UTF-8'
)
.
'" value="'
.
htmlspecialchars
(
$value
,
ENT_COMPAT
|
ENT_HTML401
,
'UTF-8'
)
.
'" />'
;
foreach
(
$block
->
getFormFields
()
as
$field
=>
$value
)
{
echo
'<input type="hidden" name="'
.
htmlspecialchars
(
$field
,
ENT_COMPAT
|
ENT_HTML401
,
'UTF-8'
)
.
'" value="'
.
htmlspecialchars
(
$value
,
ENT_COMPAT
|
ENT_HTML401
,
'UTF-8'
)
.
'" />'
;
}
?>
</form>
...
...
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