mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Improve error handling within PayTrace
This commit is contained in:
parent
98012e0ef3
commit
394d3b327d
@ -99,6 +99,29 @@ class CreditCard
|
|||||||
|
|
||||||
$response = $this->paytrace->gatewayRequest('/v1/customer/pt_protect_create', $post_data);
|
$response = $this->paytrace->gatewayRequest('/v1/customer/pt_protect_create', $post_data);
|
||||||
|
|
||||||
|
if(!$response->success)
|
||||||
|
{
|
||||||
|
|
||||||
|
$error = 'Error creating customer in gateway';
|
||||||
|
$error_code = isset($response->response_code) ? $response->response_code : 'PT_ERR';
|
||||||
|
|
||||||
|
if(isset($response->errors))
|
||||||
|
{
|
||||||
|
foreach($response->errors as $err)
|
||||||
|
{
|
||||||
|
$error = end($err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'response' => $response,
|
||||||
|
'error' => $error,
|
||||||
|
'error_code' => $error_code,
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->paytrace->processUnsuccessfulTransaction($data);
|
||||||
|
}
|
||||||
|
|
||||||
$cgt = [];
|
$cgt = [];
|
||||||
$cgt['token'] = $response->customer_id;
|
$cgt['token'] = $response->customer_id;
|
||||||
$cgt['payment_method_id'] = GatewayType::CREDIT_CARD;
|
$cgt['payment_method_id'] = GatewayType::CREDIT_CARD;
|
||||||
@ -124,7 +147,6 @@ class CreditCard
|
|||||||
$profile = $this->paytrace->gatewayRequest('/v1/customer/export', [
|
$profile = $this->paytrace->gatewayRequest('/v1/customer/export', [
|
||||||
'integrator_id' => $this->paytrace->company_gateway->getConfigField('integratorId'),
|
'integrator_id' => $this->paytrace->company_gateway->getConfigField('integratorId'),
|
||||||
'customer_id' => $customer_id,
|
'customer_id' => $customer_id,
|
||||||
// 'include_bin' => true,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $profile->customers[0];
|
return $profile->customers[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user