public function isValidResponse($response): bool
{
$this->logger->additional($this->utilities->objectToArray($response), 'api');
return $response instanceof Model && $response->isSuccessful();
}
public function isSuccessful()
{
return parent::isSuccessful() && static::isApproved();
}
public function isApproved()
{
$approved = true;
if ($this->getValue('approved') !== null) {
$approved = $this->getValue('approved');
}
return $approved;
}
When you have isValidResponse = false, module execute logError, and your order was cancel with the message.
Now with 5.5
isValidResponse was change to :
public function isValidResponse(array $response): bool
{
if (!isset($response['http_metadata'])) {
return false;
}
$response = $response['http_metadata'];
$this->logger->additional($this->utilities->objectToArray($response), 'api');
return $response instanceof HttpMetadata && in_array($response->getStatusCode(), self::VALID_RESPONSE_CODE);
}
Even if you have an payment_declined isValidResponse is always true.
When you process the callback you don't handle payment_declined :
public function setOrderStatus(OrderInterface $order, array $webhook): void
{
// Initialise state, status & order
$this->state = null;
$this->status = null;
$this->order = $order;
switch ($webhook['event_type']) {
case 'payment_approved':
$this->approved($webhook);
break;
case 'payment_captured':
$this->captured();
break;
case 'payment_voided':
$this->void();
break;
case 'payment_refunded':
$this->refund($webhook);
break;
case 'payment_capture_pending':
$this->capturePending($webhook);
break;
case 'payment_expired':
$this->paymentExpired();
break;
case 'payment_authentication_failed':
$this->paymentAuthenticationFailed();
break;
}
With the last version, order stay in pending status, callback don't do anything ...
I just update module to last version : 5.5
Before (in 4.3.0) : In Callback.php
When you have isValidResponse = false, module execute logError, and your order was cancel with the message.
Now with 5.5 isValidResponse was change to :
Even if you have an payment_declined isValidResponse is always true. When you process the callback you don't handle payment_declined :
With the last version, order stay in pending status, callback don't do anything ...