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
b69f9db3
Commit
b69f9db3
authored
Nov 11, 2019
by
cyattilakiss
Committed by
GitHub
Nov 11, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #573 from Adyen/develop
Release 5.0.1
parents
3c5450eb
45bef413
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
137 additions
and
147 deletions
+137
-147
CONTRIBUTING.md
CONTRIBUTING.md
+20
-0
Gateway/Request/ThreeDs2DataBuilder.php
Gateway/Request/ThreeDs2DataBuilder.php
+0
-70
Helper/Data.php
Helper/Data.php
+102
-73
Model/Cron.php
Model/Cron.php
+6
-0
README.md
README.md
+8
-3
composer.json
composer.json
+1
-1
No files found.
CONTRIBUTING.md
0 → 100644
View file @
b69f9db3
# Contribution guidelines
### How to contribute step-by-step
1.
Fork the
`Adyen/adyen-magento2`
repository.
2.
Create a new branch from
`develop`
in your fork. This makes it easier for you to keep track of your changes.
3.
Make the desired changes to the code.
*
If you are adding new functionality or fixing a bug, we recommend you add unit tests that cover it.
4.
Push the changes to your fork.
5.
Create a pull request to the
`Adyen/adyen-magento2`
repository.
6.
In your pull request, please describe in detail:
*
What problem you’re solving
*
Your approach to fixing the problem
*
Any tests you wrote
7.
Check Allow edits from maintainers.
8.
Create the pull request.
9.
Ensure that all checks have passed.
After you create your pull request, one of the code owners will review your code.
We aim to review your request within 2-3 business days.
Gateway/Request/ThreeDs2DataBuilder.php
deleted
100644 → 0
View file @
3c5450eb
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace
Adyen\Payment\Gateway\Request
;
use
Magento\Payment\Gateway\Request\BuilderInterface
;
class
RecurringDataBuilder
implements
BuilderInterface
{
/**
* @var \Magento\Framework\App\State
*/
private
$appState
;
/**
* @var \Adyen\Payment\Helper\Requests
*/
private
$adyenRequestsHelper
;
/**
* RecurringDataBuilder constructor.
*
* @param \Magento\Framework\Model\Context $context
* @param \Adyen\Payment\Helper\Requests $adyenRequestsHelper
*/
public
function
__construct
(
\Magento\Framework\Model\Context
$context
,
\Adyen\Payment\Helper\Requests
$adyenRequestsHelper
)
{
$this
->
appState
=
$context
->
getAppState
();
$this
->
adyenRequestsHelper
=
$adyenRequestsHelper
;
}
/**
* @param array $buildSubject
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
*/
public
function
build
(
array
$buildSubject
)
{
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject
=
\Magento\Payment\Gateway\Helper\SubjectReader
::
readPayment
(
$buildSubject
);
$payment
=
$paymentDataObject
->
getPayment
();
$storeId
=
$payment
->
getOrder
()
->
getStoreId
();
$areaCode
=
$this
->
appState
->
getAreaCode
();
return
$this
->
adyenRequestsHelper
->
buildRecurringData
([],
$areaCode
,
$storeId
,
$payment
);
}
}
Helper/Data.php
View file @
b69f9db3
...
...
@@ -136,6 +136,11 @@ class Data extends AbstractHelper
*/
private
$serializer
;
/**
* @var \Magento\Framework\Component\ComponentRegistrarInterface
*/
private
$componentRegistrar
;
/**
* Data constructor.
* @param \Magento\Framework\App\Helper\Context $context
...
...
@@ -181,7 +186,8 @@ class Data extends AbstractHelper
\Magento\Framework\Locale\ResolverInterface
$localeResolver
,
\Magento\Framework\App\Config\ScopeConfigInterface
$config
,
\Magento\Backend\Helper\Data
$helperBackend
,
\Magento\Framework\Serialize\SerializerInterface
$serializer
\Magento\Framework\Serialize\SerializerInterface
$serializer
,
\Magento\Framework\Component\ComponentRegistrarInterface
$componentRegistrar
)
{
parent
::
__construct
(
$context
);
$this
->
_encryptor
=
$encryptor
;
...
...
@@ -204,6 +210,7 @@ class Data extends AbstractHelper
$this
->
config
=
$config
;
$this
->
helperBackend
=
$helperBackend
;
$this
->
serializer
=
$serializer
;
$this
->
componentRegistrar
=
$componentRegistrar
;
}
/**
...
...
@@ -384,19 +391,19 @@ class Data extends AbstractHelper
return
([
'name'
=>
trim
(
$streetName
),
'house_number'
=>
$streetNr
]);
}
/**
* Street format
* @param string $streetLine
* @return array
*/
public
function
getStreetFromString
(
$streetLine
)
{
$street
=
self
::
formatStreet
([
$streetLine
]);
$streetName
=
$street
[
'0'
];
unset
(
$street
[
'0'
]);
$streetNr
=
implode
(
' '
,
$street
);
return
([
'name'
=>
trim
(
$streetName
),
'house_number'
=>
$streetNr
]);
}
/**
* Street format
* @param string $streetLine
* @return array
*/
public
function
getStreetFromString
(
$streetLine
)
{
$street
=
self
::
formatStreet
([
$streetLine
]);
$streetName
=
$street
[
'0'
];
unset
(
$street
[
'0'
]);
$streetNr
=
implode
(
' '
,
$street
);
return
([
'name'
=>
trim
(
$streetName
),
'house_number'
=>
$streetNr
]);
}
/**
* Fix this one string street + number
...
...
@@ -733,11 +740,15 @@ class Data extends AbstractHelper
public
function
getAPIKey
(
$storeId
=
null
)
{
if
(
$this
->
isDemoMode
(
$storeId
))
{
$apiKey
=
$this
->
_encryptor
->
decrypt
(
trim
(
$this
->
getAdyenAbstractConfigData
(
'api_key_test'
,
$storeId
)));
$apiKey
=
$this
->
_encryptor
->
decrypt
(
trim
(
$this
->
getAdyenAbstractConfigData
(
'api_key_test'
,
$storeId
)));
}
else
{
$apiKey
=
$this
->
_encryptor
->
decrypt
(
trim
(
$this
->
getAdyenAbstractConfigData
(
'api_key_live'
,
$storeId
)));
$apiKey
=
$this
->
_encryptor
->
decrypt
(
trim
(
$this
->
getAdyenAbstractConfigData
(
'api_key_live'
,
$storeId
)));
}
return
$apiKey
;
}
...
...
@@ -864,13 +875,22 @@ class Data extends AbstractHelper
}
/**
* Get adyen magento module's version
* Get adyen magento module's version
from composer.json
*
* @return string
*/
public
function
getModuleVersion
()
{
return
(
string
)
$this
->
_moduleList
->
getOne
(
"Adyen_Payment"
)[
'setup_version'
];
$moduleDir
=
$this
->
componentRegistrar
->
getPath
(
\Magento\Framework\Component\ComponentRegistrar
::
MODULE
,
'Adyen_Payment'
);
$composerJson
=
file_get_contents
(
$moduleDir
.
'/composer.json'
);
$composerJson
=
json_decode
(
$composerJson
,
true
);
if
(
empty
(
$composerJson
[
'version'
]))
{
return
"Version is not available in composer.json"
;
}
return
$composerJson
[
'version'
];
}
public
function
getBoletoTypes
()
...
...
@@ -1023,18 +1043,18 @@ class Data extends AbstractHelper
return
false
;
}
/**
* @param $paymentMethod
* @return bool
*/
public
function
isPaymentMethodAfterpayTouchMethod
(
$paymentMethod
)
{
if
(
strpos
(
$paymentMethod
,
'afterpaytouch'
)
!==
false
)
{
return
true
;
}
/**
* @param $paymentMethod
* @return bool
*/
public
function
isPaymentMethodAfterpayTouchMethod
(
$paymentMethod
)
{
if
(
strpos
(
$paymentMethod
,
'afterpaytouch'
)
!==
false
)
{
return
true
;
}
return
false
;
}
return
false
;
}
/**
* @param $paymentMethod
...
...
@@ -1537,7 +1557,8 @@ class Data extends AbstractHelper
/**
* @return string
*/
public
function
getOrigin
()
{
public
function
getOrigin
()
{
$objectManager
=
\Magento\Framework\App\ObjectManager
::
getInstance
();
$state
=
$objectManager
->
get
(
'Magento\Framework\App\State'
);
$baseUrl
=
$this
->
storeManager
->
getStore
()
->
getBaseUrl
(
\Magento\Framework\UrlInterface
::
URL_TYPE_WEB
);
...
...
@@ -1666,13 +1687,17 @@ class Data extends AbstractHelper
if
(
$billingAgreement
->
getCustomerId
()
===
null
)
{
$billingAgreement
->
setCustomerId
(
$this
->
getCustomerId
(
$order
));
}
$message
=
__
(
'Created billing agreement #%1.'
,
$additionalData
[
'recurring.recurringDetailReference'
]);
$message
=
__
(
'Created billing agreement #%1.'
,
$additionalData
[
'recurring.recurringDetailReference'
]
);
}
else
{
$billingAgreement
->
setIsObjectChanged
(
true
);
$message
=
__
(
'Updated billing agreement #%1.'
,
$additionalData
[
'recurring.recurringDetailReference'
]);
$message
=
__
(
'Updated billing agreement #%1.'
,
$additionalData
[
'recurring.recurringDetailReference'
]
);
}
// Populate billing agreement data
...
...
@@ -1683,8 +1708,10 @@ class Data extends AbstractHelper
if
(
$billingAgreement
->
isValid
()
&&
empty
(
$billingAgreementErrors
))
{
if
(
!
$this
->
agreementResourceModel
->
getOrderRelation
(
$billingAgreement
->
getAgreementId
(),
$order
->
getId
()))
{
if
(
!
$this
->
agreementResourceModel
->
getOrderRelation
(
$billingAgreement
->
getAgreementId
(),
$order
->
getId
()
))
{
// save into sales_billing_agreement_order
$billingAgreement
->
addOrderRelation
(
$order
);
...
...
@@ -1692,8 +1719,10 @@ class Data extends AbstractHelper
// add to order to save agreement
$order
->
addRelatedObject
(
$billingAgreement
);
}
else
{
$message
=
__
(
'Failed to create billing agreement for this order. Reason(s): '
)
.
join
(
', '
,
$billingAgreementErrors
);
$message
=
__
(
'Failed to create billing agreement for this order. Reason(s): '
)
.
join
(
', '
,
$billingAgreementErrors
);
throw
new
\Exception
(
$message
);
}
...
...
@@ -1792,38 +1821,38 @@ class Data extends AbstractHelper
return
$this
->
getAdyenCcConfigDataFlag
(
'threeds2_enabled'
,
$storeId
);
}
/**
* @param $client
* @return \Adyen\Service\Checkout
*/
public
function
createAdyenCheckoutService
(
$client
)
{
return
new
\Adyen\Service\Checkout
(
$client
);
}
/**
* @param $client
* @return \Adyen\Service\Recurring
* @throws \Adyen\AdyenException
*/
public
function
createAdyenRecurringService
(
$client
)
{
return
new
\Adyen\Service\Recurring
(
$client
);
}
/**
* @param string $date
* @param string $format
* @return mixed
*/
public
function
formatDate
(
$date
=
null
,
$format
=
'Y-m-d H:i:s'
)
{
if
(
strlen
(
$date
)
<
0
)
{
$date
=
date
(
'd-m-Y H:i:s'
);
}
$timeStamp
=
new
\DateTime
(
$date
);
return
$timeStamp
->
format
(
$format
);
}
/**
* @param $client
* @return \Adyen\Service\Checkout
*/
public
function
createAdyenCheckoutService
(
$client
)
{
return
new
\Adyen\Service\Checkout
(
$client
);
}
/**
* @param $client
* @return \Adyen\Service\Recurring
* @throws \Adyen\AdyenException
*/
public
function
createAdyenRecurringService
(
$client
)
{
return
new
\Adyen\Service\Recurring
(
$client
);
}
/**
* @param string $date
* @param string $format
* @return mixed
*/
public
function
formatDate
(
$date
=
null
,
$format
=
'Y-m-d H:i:s'
)
{
if
(
strlen
(
$date
)
<
0
)
{
$date
=
date
(
'd-m-Y H:i:s'
);
}
$timeStamp
=
new
\DateTime
(
$date
);
return
$timeStamp
->
format
(
$format
);
}
/**
* @param string|null $type
...
...
@@ -1834,7 +1863,7 @@ class Data extends AbstractHelper
{
$response
=
[
'threeDS2'
=>
false
];
if
(
!
empty
(
$type
))
{
if
(
!
empty
(
$type
))
{
$response
[
'type'
]
=
$type
;
}
...
...
Model/Cron.php
View file @
b69f9db3
...
...
@@ -1512,6 +1512,12 @@ class Cron
case
'dankort'
:
case
'elo'
:
case
'hipercard'
:
case
'mc_applepay'
:
case
'visa_applepay'
:
case
'amex_applepay'
:
case
'discover_applepay'
:
case
'maestro_applepay'
:
case
'paywithgoogle'
:
$manualCaptureAllowed
=
true
;
break
;
default
:
...
...
README.md
View file @
b69f9db3
...
...
@@ -14,9 +14,14 @@ Inside Adyen toggle the following settings on inside the API and Responses secti
## Requirements
This plugin supports Magento2 version 2.2.8 and higher.
## Collaboration
We commit all our new features directly into our GitHub repository.
But you can also request or suggest new features or code changes yourself!
## Contributing
We strongly encourage you to join us in contributing to this repository so everyone can benefit from:
*
New features and functionality
*
Resolved bug fixes and issues
*
Any general improvements
Read our
[
**contribution guidelines**
](
CONTRIBUTING.md
)
to find out how.
## Installation
You can install our plugin through Composer:
...
...
composer.json
View file @
b69f9db3
...
...
@@ -2,7 +2,7 @@
"name"
:
"adyen/module-payment"
,
"description"
:
"Official Magento2 Plugin to connect to Payment Service Provider Adyen."
,
"type"
:
"magento2-module"
,
"version"
:
"5.0.
0
"
,
"version"
:
"5.0.
1
"
,
"license"
:
[
"OSL-3.0"
,
"AFL-3.0"
...
...
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