-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forter adyen support #11
Conversation
Cron/SendQueue.php
Outdated
if ($item->getData('entity_body') == 'approve') { | ||
$this->approve->handleApproveImmediatly($order); | ||
} elseif ($item->getData('entity_body') == 'decline') { | ||
if ($order->canUnhold()) { | ||
$order->unhold()->save(); | ||
} | ||
$this->decline->handlePostTransactionDescision($order); | ||
} elseif ($method == 'adyen_cc' && $order->getPayment()->getAdyenPspReference()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you don't check by entity type "pre_sync_order"? would be more correct
also worth changing the other "ifs" to consider entity_type so the code will be more clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the entity_type was added, regarding the pre_Sync_order it's not that simple because we want the Adyen integration will run after the second running but I change it to support more generic Cron integration for the extension.
Cron/SendQueue.php
Outdated
|
||
$response = $this->abstractApi->sendApiRequest($url, json_encode($data)); | ||
$order->setForterResponse($response); | ||
$response = json_decode($response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to handle failure case
if ($response->status != 'success' || !isset($response->action)) {
$order->setForterStatus('error');
$order->save();
return false;
}
$order->setForterStatus($response->action);
$order->save();
return true;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
} | ||
|
||
$item->setSyncFlag('1'); | ||
$item->save(); | ||
} | ||
} | ||
|
||
private function handleAdyenMethod($order) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's put this whole function inside try/catch
(in another day we can discuss if we want to keep using try catch or stop it - one merchant commented they don't like)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added try/catch with reportToForterOnCatch method on exception
@@ -128,7 +128,11 @@ public function __construct( | |||
*/ | |||
public function buildTransaction($order, $orderStage) | |||
{ | |||
$headers = getallheaders(); | |||
if (getallheaders()) { | |||
$connectionInformation = $this->basicInfoPrepare->getConnectionInformation($order->getRemoteIp(), $headers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you removed $headers = getallheaders();
so this will break - you need to declare $headers first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right, my mistake.
@@ -91,6 +112,20 @@ public function execute(\Magento\Framework\Event\Observer $observer) | |||
try { | |||
$order = $observer->getEvent()->getPayment()->getOrder(); | |||
|
|||
if ($this->config->getIsCron() && $order->getPayment()->getMethod() == 'adyen_cc') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we don't need to check adyen_cc, maybe it can work for any payment method - what do you think?
Don't need to change this now, but I want to know how do we offer the cron feature to anyone who wants - let's talk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory, yes it should work for everyone on Cron, But it's required testing for authorize.net, Braintree, PayPal. I change it and we can test it later (you can just instruct the clients that it's only validate for Adyen right now).
No description provided.