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
e44908b9
Commit
e44908b9
authored
Apr 23, 2020
by
attilak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove CcAuthorizationDataBuilder, replace with CheckoutDataBuilder
move the logic to CheckoutDataBuilder.php as well
parent
c3dae75f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
100 deletions
+1
-100
Gateway/Request/CcAuthorizationDataBuilder.php
Gateway/Request/CcAuthorizationDataBuilder.php
+0
-99
etc/di.xml
etc/di.xml
+1
-1
No files found.
Gateway/Request/CcAuthorizationDataBuilder.php
deleted
100644 → 0
View file @
c3dae75f
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 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
;
use
Adyen\Payment\Observer\AdyenCcDataAssignObserver
;
class
CcAuthorizationDataBuilder
implements
BuilderInterface
{
/**
* @param array $buildSubject
* @return mixed
*/
public
function
build
(
array
$buildSubject
)
{
/** @var \Magento\Payment\Gateway\Data\PaymentDataObject $paymentDataObject */
$paymentDataObject
=
\Magento\Payment\Gateway\Helper\SubjectReader
::
readPayment
(
$buildSubject
);
$payment
=
$paymentDataObject
->
getPayment
();
$requestBody
=
[];
// If ccType is set use this. For bcmc you need bcmc otherwise it will fail
$requestBody
[
'paymentMethod'
][
'type'
]
=
"scheme"
;
if
(
$cardNumber
=
$payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
ENCRYPTED_CREDIT_CARD_NUMBER
))
{
$requestBody
[
'paymentMethod'
][
'encryptedCardNumber'
]
=
$cardNumber
;
}
if
(
$expiryMonth
=
$payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
ENCRYPTED_EXPIRY_MONTH
))
{
$requestBody
[
'paymentMethod'
][
'encryptedExpiryMonth'
]
=
$expiryMonth
;
}
if
(
$expiryYear
=
$payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
ENCRYPTED_EXPIRY_YEAR
))
{
$requestBody
[
'paymentMethod'
][
'encryptedExpiryYear'
]
=
$expiryYear
;
}
if
(
$holderName
=
$payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
HOLDER_NAME
))
{
$requestBody
[
'paymentMethod'
][
'holderName'
]
=
$holderName
;
}
if
(
$securityCode
=
$payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
ENCRYPTED_SECURITY_CODE
))
{
$requestBody
[
'paymentMethod'
][
'encryptedSecurityCode'
]
=
$securityCode
;
}
// Remove from additional data
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
ENCRYPTED_CREDIT_CARD_NUMBER
);
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
ENCRYPTED_EXPIRY_MONTH
);
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
ENCRYPTED_EXPIRY_YEAR
);
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
ENCRYPTED_SECURITY_CODE
);
$payment
->
unsAdditionalInformation
(
AdyenCcDataAssignObserver
::
HOLDER_NAME
);
// if installments is set and card type is credit card add it into the request
$numberOfInstallments
=
$payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
NUMBER_OF_INSTALLMENTS
)
?:
0
;
$comboCardType
=
$payment
->
getAdditionalInformation
(
AdyenCcDataAssignObserver
::
COMBO_CARD_TYPE
)
?:
'credit'
;
if
(
$numberOfInstallments
>
0
)
{
$requestBody
[
'installments'
][
'value'
]
=
$numberOfInstallments
;
}
// if card type is debit then change the issuer type and unset the installments field
if
(
$comboCardType
==
'debit'
)
{
if
(
$selectedDebitBrand
=
$this
->
getSelectedDebitBrand
(
$payment
->
getAdditionalInformation
(
'cc_type'
)))
{
$requestBody
[
'additionalData'
][
'overwriteBrand'
]
=
true
;
$requestBody
[
'selectedBrand'
]
=
$selectedDebitBrand
;
$requestBody
[
'paymentMethod'
][
'type'
]
=
$selectedDebitBrand
;
}
unset
(
$requestBody
[
'installments'
]);
}
$request
[
'body'
]
=
$requestBody
;
return
$request
;
}
/**
* @param string $brand
* @return string
*/
private
function
getSelectedDebitBrand
(
$brand
)
{
if
(
$brand
==
'VI'
)
{
return
'electron'
;
}
if
(
$brand
==
'MC'
)
{
return
'maestro'
;
}
return
null
;
}
}
\ No newline at end of file
etc/di.xml
View file @
e44908b9
...
...
@@ -557,7 +557,7 @@
<item
name=
"payment"
xsi:type=
"string"
>
Adyen\Payment\Gateway\Request\PaymentDataBuilder
</item>
<item
name=
"browserinfo"
xsi:type=
"string"
>
Adyen\Payment\Gateway\Request\BrowserInfoDataBuilder
</item>
<item
name=
"recurring"
xsi:type=
"string"
>
Adyen\Payment\Gateway\Request\RecurringDataBuilder
</item>
<item
name=
"transaction"
xsi:type=
"string"
>
Adyen\Payment\Gateway\Request\C
cAuthorization
DataBuilder
</item>
<item
name=
"transaction"
xsi:type=
"string"
>
Adyen\Payment\Gateway\Request\C
heckout
DataBuilder
</item>
<item
name=
"vault"
xsi:type=
"string"
>
Adyen\Payment\Gateway\Request\VaultDataBuilder
</item>
<item
name=
"threeds2"
xsi:type=
"string"
>
Adyen\Payment\Gateway\Request\ThreeDS2DataBuilder
</item>
</argument>
...
...
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