mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
payment failure emails
This commit is contained in:
parent
2ab99e8132
commit
58970fab99
@ -344,8 +344,6 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
else
|
||||
$error = $e->getMessage();
|
||||
|
||||
$amount = optional($this->payment_hash->data)->value ?? optional($this->payment_hash->data)->amount;
|
||||
|
||||
AutoBillingFailureMailer::dispatch(
|
||||
$gateway->client,
|
||||
$error,
|
||||
@ -364,6 +362,36 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
throw new PaymentFailed($error, $e->getCode());
|
||||
}
|
||||
|
||||
public function tokenBillingFailed($gateway, $e)
|
||||
{
|
||||
$this->unWindGatewayFees($this->payment_hash);
|
||||
|
||||
if ($e instanceof CheckoutHttpException) {
|
||||
$error = $e->getBody();
|
||||
}
|
||||
else if ($e instanceof Exception) {
|
||||
$error = $e->getMessage();
|
||||
}
|
||||
else
|
||||
$error = $e->getMessage();
|
||||
|
||||
AutoBillingFailureMailer::dispatch(
|
||||
$gateway->client,
|
||||
$error,
|
||||
$gateway->client->company,
|
||||
$this->payment_hash
|
||||
);
|
||||
|
||||
SystemLogger::dispatch(
|
||||
$gateway->payment_hash,
|
||||
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||
SystemLog::EVENT_GATEWAY_ERROR,
|
||||
$gateway::SYSTEM_LOG_TYPE,
|
||||
$gateway->client,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper method for checking if resource is good.
|
||||
*
|
||||
|
@ -77,7 +77,7 @@ class Charge
|
||||
'confirm' => true,
|
||||
'description' => $description,
|
||||
]);
|
||||
info("attempting token billing");
|
||||
|
||||
SystemLogger::dispatch($response, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->stripe->client);
|
||||
} catch (CardException $e) {
|
||||
// Since it's a decline, \Stripe\Exception\CardException will be caught
|
||||
@ -89,7 +89,7 @@ info("attempting token billing");
|
||||
'param' => $e->getError()->param,
|
||||
'message' => $e->getError()->message,
|
||||
];
|
||||
$this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
||||
$this->stripe->tokenBillingFailed($this->stripe, $e);
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client);
|
||||
} catch (RateLimitException $e) {
|
||||
@ -103,7 +103,7 @@ info("attempting token billing");
|
||||
'message' => 'Too many requests made to the API too quickly',
|
||||
];
|
||||
|
||||
$this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
||||
$this->stripe->tokenBillingFailed($this->stripe, $e);
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client);
|
||||
} catch (InvalidRequestException $e) {
|
||||
@ -117,7 +117,7 @@ info("attempting token billing");
|
||||
'message' => 'Invalid parameters were supplied to Stripe\'s API',
|
||||
];
|
||||
|
||||
$this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
||||
$this->stripe->tokenBillingFailed($this->stripe, $e);
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client);
|
||||
} catch (AuthenticationException $e) {
|
||||
@ -131,7 +131,7 @@ info("attempting token billing");
|
||||
'message' => 'Authentication with Stripe\'s API failed',
|
||||
];
|
||||
|
||||
$this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
||||
$this->stripe->tokenBillingFailed($this->stripe, $e);
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client);
|
||||
} catch (ApiConnectionException $e) {
|
||||
@ -145,7 +145,7 @@ info("attempting token billing");
|
||||
'message' => 'Network communication with Stripe failed',
|
||||
];
|
||||
|
||||
$this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
||||
$this->stripe->tokenBillingFailed($this->stripe, $e);
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client);
|
||||
} catch (ApiErrorException $e) {
|
||||
@ -157,7 +157,7 @@ info("attempting token billing");
|
||||
'message' => 'API Error',
|
||||
];
|
||||
|
||||
$this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
||||
$this->stripe->tokenBillingFailed($this->stripe, $e);
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client);
|
||||
} catch (Exception $e) {
|
||||
@ -171,7 +171,7 @@ info("attempting token billing");
|
||||
'message' => $e->getMessage(),
|
||||
];
|
||||
|
||||
$this->stripe->processInternallyFailedPayment($this->stripe, $e);
|
||||
$this->stripe->tokenBillingFailed($this->stripe, $e);
|
||||
|
||||
SystemLogger::dispatch($data, SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->stripe->client);
|
||||
}
|
||||
|
@ -66,7 +66,6 @@ trait UserNotifies
|
||||
|
||||
public function findCompanyUserNotificationType($company_user, $required_permissions) :array
|
||||
{
|
||||
nlog("find company user notification type");
|
||||
|
||||
if ($company_user->company->is_disabled) {
|
||||
return [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user