mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for refunds / logging
This commit is contained in:
parent
ed853efd19
commit
ae3a7fa182
@ -73,61 +73,105 @@ class RefundTransaction
|
|||||||
$tresponse = $response->getTransactionResponse();
|
$tresponse = $response->getTransactionResponse();
|
||||||
|
|
||||||
if ($tresponse != null && $tresponse->getMessages() != null) {
|
if ($tresponse != null && $tresponse->getMessages() != null) {
|
||||||
return [
|
|
||||||
'transaction_reference' => $tresponse->getTransId(),
|
$data = [
|
||||||
'success' => true,
|
'transaction_reference' => $tresponse->getTransId(),
|
||||||
'description' => $tresponse->getMessages()[0]->getDescription(),
|
'success' => true,
|
||||||
'code' => $tresponse->getMessages()[0]->getCode(),
|
'description' => $tresponse->getMessages()[0]->getDescription(),
|
||||||
'transaction_response' => $tresponse->getResponseCode(),
|
'code' => $tresponse->getMessages()[0]->getCode(),
|
||||||
];
|
'transaction_response' => $tresponse->getResponseCode(),
|
||||||
|
'payment_id' => $payment->id,
|
||||||
|
'amount' => $amount,
|
||||||
|
];
|
||||||
|
|
||||||
|
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||||
|
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ($tresponse->getErrors() != null) {
|
if ($tresponse->getErrors() != null) {
|
||||||
return [
|
|
||||||
'transaction_reference' => '',
|
$data = [
|
||||||
'transaction_response' => '',
|
'transaction_reference' => '',
|
||||||
'success' => false,
|
'transaction_response' => '',
|
||||||
'description' => $tresponse->getErrors()[0]->getErrorText(),
|
'success' => false,
|
||||||
'code' => $tresponse->getErrors()[0]->getErrorCode(),
|
'description' => $tresponse->getErrors()[0]->getErrorText(),
|
||||||
];
|
'code' => $tresponse->getErrors()[0]->getErrorCode(),
|
||||||
|
'payment_id' => $payment->id,
|
||||||
|
'amount' => $amount,
|
||||||
|
];
|
||||||
|
|
||||||
|
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "Transaction Failed \n";
|
echo "Transaction Failed \n";
|
||||||
$tresponse = $response->getTransactionResponse();
|
$tresponse = $response->getTransactionResponse();
|
||||||
if ($tresponse != null && $tresponse->getErrors() != null) {
|
if ($tresponse != null && $tresponse->getErrors() != null) {
|
||||||
return [
|
|
||||||
'transaction_reference' => '',
|
$data = [
|
||||||
'transaction_response' => '',
|
'transaction_reference' => '',
|
||||||
'success' => false,
|
'transaction_response' => '',
|
||||||
'description' => $tresponse->getErrors()[0]->getErrorText(),
|
'success' => false,
|
||||||
'code' => $tresponse->getErrors()[0]->getErrorCode(),
|
'description' => $tresponse->getErrors()[0]->getErrorText(),
|
||||||
];
|
'code' => $tresponse->getErrors()[0]->getErrorCode(),
|
||||||
|
'payment_id' => $payment->id,
|
||||||
|
'amount' => $amount,
|
||||||
|
];
|
||||||
|
|
||||||
|
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return [
|
|
||||||
'transaction_reference' => '',
|
$data = [
|
||||||
'transaction_response' => '',
|
'transaction_reference' => '',
|
||||||
'success' => false,
|
'transaction_response' => '',
|
||||||
'description' => $response->getMessages()->getMessage()[0]->getText(),
|
'success' => false,
|
||||||
'code' => $response->getMessages()->getMessage()[0]->getCode(),
|
'description' => $response->getMessages()->getMessage()[0]->getText(),
|
||||||
];
|
'code' => $response->getMessages()->getMessage()[0]->getCode(),
|
||||||
|
'payment_id' => $payment->id,
|
||||||
|
'amount' => $amount,
|
||||||
|
];
|
||||||
|
|
||||||
|
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return [
|
|
||||||
|
$data = [
|
||||||
'transaction_reference' => '',
|
'transaction_reference' => '',
|
||||||
'transaction_response' => '',
|
'transaction_response' => '',
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'description' => 'No response returned',
|
'description' => 'No response returned',
|
||||||
'code' => 'No response returned',
|
'code' => 'No response returned',
|
||||||
|
'payment_id' => $payment->id,
|
||||||
|
'amount' => $amount,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
$data = [
|
||||||
'transaction_reference' => '',
|
'transaction_reference' => '',
|
||||||
'transaction_response' => '',
|
'transaction_response' => '',
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'description' => 'No response returned',
|
'description' => 'No response returned',
|
||||||
'code' => 'No response returned',
|
'code' => 'No response returned',
|
||||||
];
|
'payment_id' => $payment->id,
|
||||||
|
'amount' => $amount,
|
||||||
|
];
|
||||||
|
|
||||||
|
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_AUTHORIZE, $this->authorize->client);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user