Improve WePay guardian

This commit is contained in:
David Bomba 2022-04-28 12:40:07 +10:00
parent 6a148676db
commit b5c0e678cb
9 changed files with 16 additions and 11 deletions

View File

@ -111,7 +111,7 @@ class PaymentFailedMailer implements ShouldQueue
//add client payment failures here.
//
if($contact = $this->client->primary_contact()->first())
if($contact = $this->client->primary_contact()->first() && $this->payment_hash)
{
$mail_obj = (new ClientPaymentFailureObject($this->client, $this->error, $this->company, $this->payment_hash))->build();

View File

@ -54,8 +54,6 @@ class InvoiceFailedEmailNotification
foreach ($event->invitation->company->company_users as $company_user) {
$user = $company_user->user;
// $notification = new EntitySentNotification($event->invitation, 'invoice');
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent', 'invoice_sent_all']);
if (($key = array_search('mail', $methods)) !== false) {
@ -68,9 +66,7 @@ class InvoiceFailedEmailNotification
$first_notification_sent = false;
}
// $notification->method = $methods;
// $user->notify($notification);
}
}
}

View File

@ -28,7 +28,6 @@ class PaymentNotification implements ShouldQueue
public $delay = 5;
/**
* Create the event listener.
*

View File

@ -85,6 +85,9 @@ class CompanyGateway extends BaseModel
'8fdeed552015b3c7b44ed6c8ebd9e992' => 309,
'd6814fc83f45d2935e7777071e629ef9' => 310,
'bbd736b3254b0aabed6ad7fda1298c88' => 311,
'65faab2ab6e3223dbe848b1686490baz' => 320,
'b9886f9257f0c6ee7c302f1c74475f6c' => 321,
'hxd6gwg3ekb9tb3v9lptgx1mqyg69zu9' => 322,
];
protected $touches = [];

View File

@ -502,8 +502,8 @@ class BaseDriver extends AbstractPaymentDriver
/*Generic Global unsuccessful transaction method when the client is present*/
public function processUnsuccessfulTransaction($response, $client_present = true)
{
$error = $response['error'];
$error_code = $response['error_code'];
$error = array_key_exists('error', $response) ? $response['error'] : 'Undefined Error';
$error_code = array_key_exists('error_code', $response) ? $response['error_code'] : 'Undefined Error Code';
$this->unWindGatewayFees($this->payment_hash);

View File

@ -22,6 +22,7 @@ use App\PaymentDrivers\WePayPaymentDriver;
use App\PaymentDrivers\WePay\WePayCommon;
use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request;
use Illuminate\Notifications\Messages\SlackMessage;
use Illuminate\Support\Str;
class ACH
@ -86,6 +87,12 @@ class ACH
$this->wepay_payment_driver->client->company,
);
(new SlackMessage)
->success()
->from(ctrans('texts.notification_bot'))
->image('https://app.invoiceninja.com/favicon.png')
->content("New WePay ACH Failure from Company ID: ". $this->wepay_payment_driver->company_gateway->company->id);
throw new PaymentFailed($e->getMessage(), 400);
}
// display the response

View File

@ -103,7 +103,7 @@ class MarkPaid extends AbstractService
\DB::connection(config('database.default'))->transaction(function () use($payment){
/* Get the last record for the client and set the current balance*/
$client = Client::where('id', $this->invoice->client_id)->lockForUpdate()->first();
$client = Client::withTrashed()->where('id', $this->invoice->client_id)->lockForUpdate()->first();
$client->paid_to_date += $payment->amount;
$client->balance -= $payment->amount;
$client->save();

View File

@ -67,7 +67,7 @@ class MarkSent extends AbstractService
\DB::connection(config('database.default'))->transaction(function () use($adjustment){
/* Get the last record for the client and set the current balance*/
$client = Client::where('id', $this->client->id)->lockForUpdate()->first();
$client = Client::withTrashed()->where('id', $this->client->id)->lockForUpdate()->first();
$client->balance += $adjustment;
$client->save();

View File

@ -8,7 +8,7 @@ Route::get('client/login', 'Auth\ContactLoginController@showLoginForm')->name('c
Route::post('client/login', 'Auth\ContactLoginController@login')->name('client.login.submit');
Route::get('client/register/{company_key?}', 'Auth\ContactRegisterController@showRegisterForm')->name('client.register')->middleware(['domain_db', 'contact_account', 'contact_register','locale']);
Route::post('client/register/{company_key?}', 'Auth\ContactRegisterController@register')->middleware(['domain_db', 'contact_account', 'contact_register', 'locale']);
Route::post('client/register/{company_key?}', 'Auth\ContactRegisterController@register')->middleware(['domain_db', 'contact_account', 'contact_register', 'locale','throttle:10,1']);
Route::get('client/password/reset', 'Auth\ContactForgotPasswordController@showLinkRequestForm')->name('client.password.request')->middleware(['domain_db', 'contact_account','locale']);
Route::post('client/password/email', 'Auth\ContactForgotPasswordController@sendResetLinkEmail')->name('client.password.email')->middleware('locale');