Refactor for payment failure mailers

This commit is contained in:
David Bomba 2021-10-17 22:21:56 +11:00
parent 6641320567
commit f962e3a2fa
5 changed files with 16 additions and 5 deletions

View File

@ -176,7 +176,7 @@ abstract class QueryFilters
public function is_deleted($value) public function is_deleted($value)
{ {
return $this->builder->where('is_deleted', $value); return $this->builder->where('is_deleted', $value)->withTrashed();
} }

View File

@ -474,7 +474,7 @@ class BaseDriver extends AbstractPaymentDriver
$invoices->first()->invitations->each(function ($invitation) use ($nmo){ $invoices->first()->invitations->each(function ($invitation) use ($nmo){
if (!$invitation->contact->trashed() && $invitation->contact->email) { if (!$invitation->contact->trashed()) {
$nmo->to_user = $invitation->contact; $nmo->to_user = $invitation->contact;
NinjaMailerJob::dispatch($nmo); NinjaMailerJob::dispatch($nmo);

View File

@ -83,8 +83,12 @@ class CreditCard
$response_status = ErrorCode::getStatus($response->ResponseMessage); $response_status = ErrorCode::getStatus($response->ResponseMessage);
if(!$response_status['success']) if(!$response_status['success']){
throw new PaymentFailed($response_status['message'], 400);
$this->eway_driver->sendFailureMail($response_status['message']);
throw new PaymentFailed($response_status['message'], 400);
}
//success //success
$cgt = []; $cgt = [];
@ -158,6 +162,8 @@ class CreditCard
$this->logResponse($response, false); $this->logResponse($response, false);
$this->eway_driver->sendFailureMail($response_status['message']);
throw new PaymentFailed($response_status['message'], 400); throw new PaymentFailed($response_status['message'], 400);
} }
@ -237,6 +243,8 @@ class CreditCard
$this->logResponse($response, false); $this->logResponse($response, false);
$this->eway_driver->sendFailureMail($response_status['message']);
throw new PaymentFailed($response_status['message'], 400); throw new PaymentFailed($response_status['message'], 400);
} }

View File

@ -105,6 +105,9 @@ class Hosted implements MethodInterface
]); ]);
if (! property_exists($this->razorpay->payment_hash->data, 'order_id')) { if (! property_exists($this->razorpay->payment_hash->data, 'order_id')) {
$this->razorpay->sendFailureMail("Missing [order_id] property. ");
throw new PaymentFailed('Missing [order_id] property. Please contact the administrator. Reference: ' . $this->razorpay->payment_hash->hash); throw new PaymentFailed('Missing [order_id] property. Please contact the administrator. Reference: ' . $this->razorpay->payment_hash->hash);
} }

View File

@ -193,7 +193,7 @@ class ACH
return $this->processUnsuccessfulPayment($state); return $this->processUnsuccessfulPayment($state);
} catch (Exception $e) { } catch (Exception $e) {
if ($e instanceof CardException) { if ($e instanceof CardException) {
return redirect()->route('client.payment_methods.verification', ['payment_method' => $source->hashed_id, 'method' => GatewayType::BANK_TRANSFER]); return redirect()->route('client.payment_methods.verification', ['payment_method' => $cgt->hashed_id, 'method' => GatewayType::BANK_TRANSFER]);
} }
throw new PaymentFailed($e->getMessage(), $e->getCode()); throw new PaymentFailed($e->getMessage(), $e->getCode());