Minor fixes for refunds through checkout

This commit is contained in:
David Bomba 2023-09-28 15:52:13 +10:00
parent 5f064a7d49
commit 208aa7ed36

View File

@ -224,6 +224,16 @@ class CheckoutComPaymentDriver extends BaseDriver
$response = $this->gateway->getPaymentsClient()->refundPayment($payment->transaction_reference, $request); $response = $this->gateway->getPaymentsClient()->refundPayment($payment->transaction_reference, $request);
SystemLogger::dispatch(
array_merge(['message' => "Gateway Refund"], $response),
SystemLog::CATEGORY_GATEWAY_RESPONSE,
SystemLog::EVENT_GATEWAY_SUCCESS,
SystemLog::TYPE_CHECKOUT,
$payment->client,
$payment->company,
);
return [ return [
'transaction_reference' => $response['action_id'], 'transaction_reference' => $response['action_id'],
'transaction_response' => json_encode($response), 'transaction_response' => json_encode($response),
@ -231,13 +241,21 @@ class CheckoutComPaymentDriver extends BaseDriver
'description' => $response['reference'], 'description' => $response['reference'],
'code' => 202, 'code' => 202,
]; ];
} catch (CheckoutApiException $e) { } catch (CheckoutApiException $e) {
// API error // API error
throw new PaymentFailed($e->getMessage(), $e->getCode()); throw new PaymentFailed($e->getMessage(), $e->getCode());
} catch (CheckoutArgumentException $e) { } catch (CheckoutArgumentException $e) {
// Bad arguments // Bad arguments
// throw new PaymentFailed($e->getMessage(), $e->getCode()); SystemLogger::dispatch(
$e->getMessage(),
SystemLog::CATEGORY_GATEWAY_RESPONSE,
SystemLog::EVENT_GATEWAY_FAILURE,
SystemLog::TYPE_CHECKOUT,
$payment->client,
$payment->company,
);
return [ return [
'transaction_reference' => null, 'transaction_reference' => null,
@ -246,9 +264,17 @@ class CheckoutComPaymentDriver extends BaseDriver
'description' => $e->getMessage(), 'description' => $e->getMessage(),
'code' => $e->getCode(), 'code' => $e->getCode(),
]; ];
} catch (CheckoutAuthorizationException $e) { } catch (CheckoutAuthorizationException $e) {
// throw new PaymentFailed("The was a problem with the Checkout Gateway Credentials.", $e->getCode()); SystemLogger::dispatch(
$e->getMessage(),
SystemLog::CATEGORY_GATEWAY_RESPONSE,
SystemLog::EVENT_GATEWAY_FAILURE,
SystemLog::TYPE_CHECKOUT,
$payment->client,
$payment->company,
);
return [ return [
'transaction_reference' => null, 'transaction_reference' => null,