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
07978868
Commit
07978868
authored
Jan 26, 2018
by
Aleffio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PW-365: Added checks, Changed getPaymentRequest to buildPosPaymentRequest
parent
e2ac5f30
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
12 deletions
+22
-12
Gateway/Http/Client/TransactionPosCloudSync.php
Gateway/Http/Client/TransactionPosCloudSync.php
+2
-2
Gateway/Request/MerchantAccountDataBuilder.php
Gateway/Request/MerchantAccountDataBuilder.php
+2
-1
Gateway/Request/PosCloudBuilder.php
Gateway/Request/PosCloudBuilder.php
+3
-4
Gateway/Response/PaymentPosCloudHandler.php
Gateway/Response/PaymentPosCloudHandler.php
+8
-2
Gateway/Validator/PosCloudResponseValidator.php
Gateway/Validator/PosCloudResponseValidator.php
+5
-1
Helper/Data.php
Helper/Data.php
+2
-2
No files found.
Gateway/Http/Client/TransactionPosCloudSync.php
View file @
07978868
...
...
@@ -25,7 +25,7 @@
namespace
Adyen\Payment\Gateway\Http\Client
;
use
Adyen\Util\Util
;
use
Magento\Payment\Gateway\Http\ClientInterface
;
class
TransactionPosCloudSync
implements
ClientInterface
...
...
@@ -75,7 +75,7 @@ class TransactionPosCloudSync implements ClientInterface
$service
=
new
\Adyen\Service\PosPayment
(
$this
->
_client
);
$transactionType
=
\Adyen\TransactionType
::
GOODS_SERVICES
;
$poiId
=
$this
->
_adyenHelper
->
getPoiId
();
$json
=
$service
->
get
PaymentRequest
(
$poiId
,
$request
[
'amount'
][
'value'
],
$request
[
'amount'
][
'currency'
],
$json
=
Util
::
buildPos
PaymentRequest
(
$poiId
,
$request
[
'amount'
][
'value'
],
$request
[
'amount'
][
'currency'
],
$request
[
'reference'
],
$transactionType
);
$params
=
json_decode
(
$json
,
true
);
//Create associative array for passing along
try
{
...
...
Gateway/Request/MerchantAccountDataBuilder.php
View file @
07978868
...
...
@@ -54,8 +54,9 @@ class MerchantAccountDataBuilder implements BuilderInterface
$order
=
$paymentDataObject
->
getOrder
();
$storeId
=
$order
->
getStoreId
();
$payment
=
$paymentDataObject
->
getPayment
();
$method
=
$payment
->
getMethod
();
$merchantAccount
=
$this
->
adyenHelper
->
getAdyenMerchantAccount
(
$
payment
,
$storeId
);
$merchantAccount
=
$this
->
adyenHelper
->
getAdyenMerchantAccount
(
$
method
,
$storeId
);
return
[
"merchantAccount"
=>
$merchantAccount
];
}
...
...
Gateway/Request/PosCloudBuilder.php
View file @
07978868
...
...
@@ -63,17 +63,16 @@ class PosCloudBuilder implements BuilderInterface
$payment
=
$paymentDataObject
->
getPayment
();
$fullOrder
=
$payment
->
getOrder
();
$currencyCode
=
$fullOrder
->
getOrderCurrencyCode
();
$
amount
=
$fullOrder
->
getGrandTotal
();
$
grandTotal
=
$fullOrder
->
getGrandTotal
();
$amount
=
[
'currency'
=>
$currencyCode
,
'value'
=>
$
this
->
adyenHelper
->
formatAmount
(
$amount
,
$currencyCode
)
'value'
=>
$
grandTotal
];
return
[
"amount"
=>
$amount
,
"reference"
=>
$order
->
getOrderIncrementId
(),
"fraudOffset"
=>
"0"
"reference"
=>
$order
->
getOrderIncrementId
()
];
}
}
\ No newline at end of file
Gateway/Response/PaymentPosCloudHandler.php
View file @
07978868
...
...
@@ -26,6 +26,7 @@ namespace Adyen\Payment\Gateway\Response;
use
Magento\Payment\Gateway\Response\HandlerInterface
;
use
Magento\Setup\Exception
;
class
PaymentPosCloudHandler
implements
HandlerInterface
{
...
...
@@ -75,8 +76,13 @@ class PaymentPosCloudHandler implements HandlerInterface
$payment
->
getOrder
()
->
setCanSendNewEmailFlag
(
false
);
// set transaction
$pspReference
=
$response
[
'SaleToPOIResponse'
][
'PaymentResponse'
][
'PaymentResult'
][
'PaymentAcquirerData'
][
'AcquirerTransactionID'
][
'TransactionID'
];
$payment
->
setTransactionId
(
$pspReference
);
if
(
!
empty
(
$response
[
'SaleToPOIResponse'
][
'PaymentResponse'
][
'PaymentResult'
][
'PaymentAcquirerData'
][
'AcquirerTransactionID'
][
'TransactionID'
]))
{
$pspReference
=
$response
[
'SaleToPOIResponse'
][
'PaymentResponse'
][
'PaymentResult'
][
'PaymentAcquirerData'
][
'AcquirerTransactionID'
][
'TransactionID'
];
$payment
->
setTransactionId
(
$pspReference
);
}
else
{
$this
->
adyenLogger
->
error
(
"Missing POS Transaction ID"
);
throw
new
Exception
(
"Missing POS Transaction ID"
);
}
// do not close transaction so you can do a cancel() and void
$payment
->
setIsTransactionClosed
(
false
);
...
...
Gateway/Validator/PosCloudResponseValidator.php
View file @
07978868
...
...
@@ -57,7 +57,11 @@ class PosCloudResponseValidator extends AbstractValidator
$errorMessages
=
[];
$isValid
=
true
;
$response
=
\Magento\Payment\Gateway\Helper\SubjectReader
::
readResponse
(
$validationSubject
);
if
(
$response
[
'SaleToPOIResponse'
][
'PaymentResponse'
][
'Response'
][
'Result'
]
!=
'Success'
)
{
if
((
!
empty
(
$response
[
'SaleToPOIResponse'
][
'PaymentResponse'
][
'Response'
][
'Result'
])
&&
$response
[
'SaleToPOIResponse'
][
'PaymentResponse'
][
'Response'
][
'Result'
]
!=
'Success'
)
||
empty
(
$response
[
'SaleToPOIResponse'
][
'PaymentResponse'
][
'Response'
][
'Result'
])
)
{
$errorMsg
=
__
(
'Problem with POS terminal'
);
$this
->
adyenLogger
->
error
(
$errorMsg
);
$errorMessages
[]
=
$errorMsg
;
...
...
Helper/Data.php
View file @
07978868
...
...
@@ -1203,12 +1203,12 @@ class Data extends AbstractHelper
return
$poiId
;
}
public
function
getAdyenMerchantAccount
(
$
payment
,
$storeId
)
public
function
getAdyenMerchantAccount
(
$
method
,
$storeId
)
{
$merchantAccount
=
$this
->
getAdyenAbstractConfigData
(
"merchant_account"
,
$storeId
);
$merchantAccountPos
=
$this
->
getAdyenPosCloudConfigData
(
'pos_merchant_account'
,
$storeId
);
if
(
$
payment
->
getMethod
()
==
'adyen_pos_cloud'
&&
!
empty
(
$merchantAccountPos
))
{
if
(
$
method
==
'adyen_pos_cloud'
&&
!
empty
(
$merchantAccountPos
))
{
return
$merchantAccountPos
;
}
return
$merchantAccount
;
...
...
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