mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Return token if response is success
This commit is contained in:
parent
cc53c697bd
commit
6f30c787d1
@ -136,8 +136,7 @@ class CreditCard
|
|||||||
|
|
||||||
$gateway_response = \json_decode($data['gateway_response']);
|
$gateway_response = \json_decode($data['gateway_response']);
|
||||||
|
|
||||||
try {
|
$response = $this->braintree->gateway->paymentMethod()->create([
|
||||||
$payment_method = $this->braintree->gateway->paymentMethod()->create([
|
|
||||||
'customerId' => $customerId,
|
'customerId' => $customerId,
|
||||||
'paymentMethodNonce' => $gateway_response->nonce,
|
'paymentMethodNonce' => $gateway_response->nonce,
|
||||||
'options' => [
|
'options' => [
|
||||||
@ -145,21 +144,11 @@ class CreditCard
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $payment_method->paymentMethod->token;
|
if ($response->success) {
|
||||||
} catch(\Exception $e) {
|
return $response->paymentMethod->token;
|
||||||
SystemLogger::dispatch(
|
|
||||||
$e->getMessage(),
|
|
||||||
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
|
||||||
SystemLog::EVENT_GATEWAY_FAILURE,
|
|
||||||
SystemLog::TYPE_BRAINTREE,
|
|
||||||
$this->braintree->client,
|
|
||||||
$this->braintree->client->company,
|
|
||||||
);
|
|
||||||
|
|
||||||
nlog(['e' => $e->getMessage(), 'class' => \get_class($e)]);
|
|
||||||
|
|
||||||
throw new PaymentFailed($e->getMessage(), $e->getCode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
throw new PaymentFailed($response->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function processSuccessfulPayment($response)
|
private function processSuccessfulPayment($response)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user