This commit is contained in:
David Bomba 2023-02-18 08:36:51 +11:00
parent 7d07cfb2f7
commit e28b75e83f
22 changed files with 49 additions and 91 deletions

View File

@ -48,5 +48,4 @@ class InvoiceWasPaid
$this->company = $company; $this->company = $company;
$this->event_vars = $event_vars; $this->event_vars = $event_vars;
} }
} }

View File

@ -468,7 +468,6 @@ class BankTransactionController extends BaseController
$bank_transactions = BankTransaction::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get(); $bank_transactions = BankTransaction::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
if ($action == 'convert_matched') { //catch this action if ($action == 'convert_matched') { //catch this action
$this->bank_transaction_repo->convert_matched($bank_transactions); $this->bank_transaction_repo->convert_matched($bank_transactions);
} else { } else {
$bank_transactions->each(function ($bank_transaction, $key) use ($action) { $bank_transactions->each(function ($bank_transaction, $key) use ($action) {

View File

@ -13,7 +13,6 @@ namespace App\Jobs\Entity;
use App\Exceptions\FilePermissionsFailure; use App\Exceptions\FilePermissionsFailure;
use App\Libraries\MultiDB; use App\Libraries\MultiDB;
use App\Models\Account;
use App\Models\Credit; use App\Models\Credit;
use App\Models\CreditInvitation; use App\Models\CreditInvitation;
use App\Models\Design; use App\Models\Design;

View File

@ -28,7 +28,8 @@ class ClientLedgerBalanceUpdate implements ShouldQueue
public $tries = 1; public $tries = 1;
public $deleteWhenMissingModels = true; public $deleteWhenMissingModels = true;
public function __construct(public Company $company, public Client $client) public function __construct(public Company $company, public Client $client)
{} {
}
/** /**
* Execute the job. * Execute the job.
@ -68,5 +69,4 @@ class ClientLedgerBalanceUpdate implements ShouldQueue
{ {
return [(new WithoutOverlapping($this->client->id))->dontRelease()]; return [(new WithoutOverlapping($this->client->id))->dontRelease()];
} }
} }

View File

@ -158,8 +158,8 @@ class WebhookSingle implements ShouldQueue
$this->company $this->company
))->handle(); ))->handle();
/* Some 400's should never be repeated */ /* Some 400's should never be repeated */
if(in_array($e->getResponse()->getStatusCode(), [404, 410])){ if (in_array($e->getResponse()->getStatusCode(), [404, 410])) {
$this->fail(); $this->fail();
return; return;
} }
@ -227,7 +227,6 @@ class WebhookSingle implements ShouldQueue
private function resolveClient() private function resolveClient()
{ {
//make sure it isn't an instance of the Client Model //make sure it isn't an instance of the Client Model
if (!$this->entity instanceof \App\Models\Client && if (!$this->entity instanceof \App\Models\Client &&
!$this->entity instanceof \App\Models\Vendor && !$this->entity instanceof \App\Models\Vendor &&
@ -238,7 +237,6 @@ class WebhookSingle implements ShouldQueue
} }
return null; return null;
} }
public function failed($exception = null) public function failed($exception = null)

View File

@ -67,7 +67,6 @@ class CreditCreatedNotification implements ShouldQueue
$nmo->to_user = $user; $nmo->to_user = $user;
(new NinjaMailerJob($nmo))->handle(); (new NinjaMailerJob($nmo))->handle();
} }
/* Override the methods in the Notification Class */ /* Override the methods in the Notification Class */

View File

@ -63,9 +63,7 @@ class CreditEmailedNotification implements ShouldQueue
$nmo->to_user = $user; $nmo->to_user = $user;
(new NinjaMailerJob($nmo))->handle(); (new NinjaMailerJob($nmo))->handle();
} }
} }
} }
} }

View File

@ -56,6 +56,5 @@ class InvoicePaidActivity implements ShouldQueue
if ($event->invoice->subscription()->exists()) { if ($event->invoice->subscription()->exists()) {
$event->invoice->subscription->service()->planPaid($event->invoice); $event->invoice->subscription->service()->planPaid($event->invoice);
} }
} }
} }

View File

@ -16,7 +16,6 @@ use App\Jobs\Mail\NinjaMailerJob;
use App\Jobs\Mail\NinjaMailerObject; use App\Jobs\Mail\NinjaMailerObject;
use App\Libraries\MultiDB; use App\Libraries\MultiDB;
use App\Mail\Admin\EntitySentObject; use App\Mail\Admin\EntitySentObject;
use App\Notifications\Admin\EntitySentNotification;
use App\Utils\Traits\Notifications\UserNotifies; use App\Utils\Traits\Notifications\UserNotifies;
use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Contracts\Queue\ShouldQueue;
@ -62,9 +61,7 @@ class QuoteEmailedNotification implements ShouldQueue
$nmo->to_user = $user; $nmo->to_user = $user;
(new NinjaMailerJob($nmo))->handle(); (new NinjaMailerJob($nmo))->handle();
} }
} }
} }
} }

View File

@ -58,6 +58,5 @@ class AppStoreRenewSubscription implements ShouldQueue
} }
$account->save(); $account->save();
} }
} }

View File

@ -11,12 +11,12 @@
namespace App\Listeners\Subscription; namespace App\Listeners\Subscription;
use Carbon\Carbon; use App\Libraries\MultiDB;
use App\Models\Account; use App\Models\Account;
use App\Models\Company; use App\Models\Company;
use App\Libraries\MultiDB;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Notifications\Ninja\RenewalFailureNotification; use App\Notifications\Ninja\RenewalFailureNotification;
use Carbon\Carbon;
use Illuminate\Contracts\Queue\ShouldQueue;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRenewed; use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRenewed;
class PlayStoreRenewSubscription implements ShouldQueue class PlayStoreRenewSubscription implements ShouldQueue
@ -44,6 +44,4 @@ class PlayStoreRenewSubscription implements ShouldQueue
return; return;
} }
} }
} }

View File

@ -12,11 +12,11 @@
namespace App\Mail\Admin; namespace App\Mail\Admin;
use App\Mail\Engine\PaymentEmailEngine; use App\Mail\Engine\PaymentEmailEngine;
use App\Models\Payment;
use App\Utils\Ninja; use App\Utils\Ninja;
use App\Utils\Number; use App\Utils\Number;
use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\App;
use stdClass; use stdClass;
use App\Models\Payment;
class EntityPaidObject class EntityPaidObject
{ {

View File

@ -388,7 +388,6 @@ class PaymentEmailEngine extends BaseEmailEngine
*/ */
private function buildViewButton(string $link, string $text): string private function buildViewButton(string $link, string $text): string
{ {
return ' return '
<!--[if (gte mso 9)|(IE)]> <!--[if (gte mso 9)|(IE)]>
<table align="center" cellspacing="0" cellpadding="0" style="width: 600px;"> <table align="center" cellspacing="0" cellpadding="0" style="width: 600px;">

View File

@ -75,7 +75,7 @@ class CompanyGateway extends BaseModel
// const TYPE_PAYFAST = 310; // const TYPE_PAYFAST = 310;
// const TYPE_PAYTRACE = 311; // const TYPE_PAYTRACE = 311;
// const TYPE_MOLLIE = 312; // const TYPE_MOLLIE = 312;
// const TYPE_EWAY = 313; // const TYPE_EWAY = 313;
// const TYPE_FORTE = 314; // const TYPE_FORTE = 314;
public $gateway_consts = [ public $gateway_consts = [

View File

@ -12,7 +12,6 @@
namespace App\Models; namespace App\Models;
use App\Jobs\Entity\CreateEntityPdf; use App\Jobs\Entity\CreateEntityPdf;
use App\Utils\Ninja;
use App\Utils\Traits\Inviteable; use App\Utils\Traits\Inviteable;
use App\Utils\Traits\MakesDates; use App\Utils\Traits\MakesDates;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;

View File

@ -11,9 +11,7 @@
namespace App\Models; namespace App\Models;
use App\Events\Quote\QuoteWasUpdated;
use App\Jobs\Entity\CreateEntityPdf; use App\Jobs\Entity\CreateEntityPdf;
use App\Utils\Ninja;
use App\Utils\Traits\Inviteable; use App\Utils\Traits\Inviteable;
use App\Utils\Traits\MakesDates; use App\Utils\Traits\MakesDates;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;

View File

@ -13,7 +13,6 @@ namespace App\Models;
use App\Services\Scheduler\SchedulerService; use App\Services\Scheduler\SchedulerService;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Carbon;
/** /**
* @property bool paused * @property bool paused
@ -88,5 +87,4 @@ class Scheduler extends BaseModel
return $this->remaining_cycles - 1; return $this->remaining_cycles - 1;
} }
} }
} }

View File

@ -11,39 +11,34 @@
namespace App\PaymentDrivers; namespace App\PaymentDrivers;
use Exception; use App\Events\Invoice\InvoiceWasPaid;
use App\Utils\Ninja; use App\Events\Payment\PaymentWasCreated;
use App\Exceptions\PaymentFailed;
use App\Factory\PaymentFactory;
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
use App\Jobs\Mail\NinjaMailer;
use App\Jobs\Mail\NinjaMailerJob;
use App\Jobs\Mail\NinjaMailerObject;
use App\Jobs\Mail\PaymentFailedMailer;
use App\Jobs\Util\SystemLogger;
use App\Mail\Admin\ClientPaymentFailureObject;
use App\Models\Client; use App\Models\Client;
use App\Utils\Helpers; use App\Models\ClientContact;
use App\Models\ClientGatewayToken;
use App\Models\CompanyGateway;
use App\Models\GatewayType;
use App\Models\Invoice; use App\Models\Invoice;
use App\Models\Payment; use App\Models\Payment;
use App\Models\SystemLog;
use App\Models\GatewayType;
use App\Models\PaymentHash; use App\Models\PaymentHash;
use App\Models\PaymentType; use App\Models\SystemLog;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use App\Models\ClientContact;
use App\Jobs\Mail\NinjaMailer;
use App\Models\CompanyGateway;
use Illuminate\Support\Carbon;
use App\Factory\PaymentFactory;
use App\Jobs\Util\SystemLogger;
use App\Utils\Traits\MakesHash;
use App\Models\TransactionEvent;
use App\Exceptions\PaymentFailed;
use App\Jobs\Mail\NinjaMailerJob;
use App\Jobs\Ninja\TransactionLog;
use App\Models\ClientGatewayToken;
use App\Jobs\Mail\NinjaMailerObject;
use App\Utils\Traits\SystemLogTrait;
use App\Events\Invoice\InvoiceWasPaid;
use App\Jobs\Mail\PaymentFailedMailer;
use App\Events\Payment\PaymentWasCreated;
use App\Mail\Admin\ClientPaymentFailureObject;
use App\Services\Subscription\SubscriptionService; use App\Services\Subscription\SubscriptionService;
use Checkout\Library\Exceptions\CheckoutHttpException; use App\Utils\Helpers;
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest; use App\Utils\Ninja;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\SystemLogTrait;
use Illuminate\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
/** /**
* Class BaseDriver. * Class BaseDriver.
@ -154,33 +149,24 @@ class BaseDriver extends AbstractPaymentDriver
} }
if ($this->company_gateway->require_custom_value1) { if ($this->company_gateway->require_custom_value1) {
$fields[] = ['name' => 'client_custom_value1', 'label' => $this->helpers->makeCustomField($this->client->company->custom_fields, 'client1'), 'type' => 'text', 'validation' => 'required']; $fields[] = ['name' => 'client_custom_value1', 'label' => $this->helpers->makeCustomField($this->client->company->custom_fields, 'client1'), 'type' => 'text', 'validation' => 'required'];
} }
if ($this->company_gateway->require_custom_value2) { if ($this->company_gateway->require_custom_value2) {
$fields[] = ['name' => 'client_custom_value2', 'label' => $this->helpers->makeCustomField($this->client->company->custom_fields, 'client2'), 'type' => 'text', 'validation' => 'required']; $fields[] = ['name' => 'client_custom_value2', 'label' => $this->helpers->makeCustomField($this->client->company->custom_fields, 'client2'), 'type' => 'text', 'validation' => 'required'];
} }
if ($this->company_gateway->require_custom_value3) { if ($this->company_gateway->require_custom_value3) {
$fields[] = ['name' => 'client_custom_value3', 'label' => $this->helpers->makeCustomField($this->client->company->custom_fields, 'client3'), 'type' => 'text', 'validation' => 'required']; $fields[] = ['name' => 'client_custom_value3', 'label' => $this->helpers->makeCustomField($this->client->company->custom_fields, 'client3'), 'type' => 'text', 'validation' => 'required'];
} }
if ($this->company_gateway->require_custom_value4) { if ($this->company_gateway->require_custom_value4) {
$fields[] = ['name' => 'client_custom_value4', 'label' => $this->helpers->makeCustomField($this->client->company->custom_fields, 'client4'), 'type' => 'text', 'validation' => 'required']; $fields[] = ['name' => 'client_custom_value4', 'label' => $this->helpers->makeCustomField($this->client->company->custom_fields, 'client4'), 'type' => 'text', 'validation' => 'required'];
} }
return $fields; return $fields;
} }
/** /**
@ -373,11 +359,11 @@ class BaseDriver extends AbstractPaymentDriver
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars())); event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
if (property_exists($this->payment_hash->data, 'billing_context') && $status == Payment::STATUS_COMPLETED) { if (property_exists($this->payment_hash->data, 'billing_context') && $status == Payment::STATUS_COMPLETED) {
if (is_int($this->payment_hash->data->billing_context->subscription_id)) {
if(is_int($this->payment_hash->data->billing_context->subscription_id))
$billing_subscription = \App\Models\Subscription::find($this->payment_hash->data->billing_context->subscription_id); $billing_subscription = \App\Models\Subscription::find($this->payment_hash->data->billing_context->subscription_id);
else } else {
$billing_subscription = \App\Models\Subscription::find($this->decodePrimaryKey($this->payment_hash->data->billing_context->subscription_id)); $billing_subscription = \App\Models\Subscription::find($this->decodePrimaryKey($this->payment_hash->data->billing_context->subscription_id));
}
// To access campaign hash => $this->payment_hash->data->billing_context->campaign; // To access campaign hash => $this->payment_hash->data->billing_context->campaign;
// To access campaign data => Cache::get(CAMPAIGN_HASH) // To access campaign data => Cache::get(CAMPAIGN_HASH)
@ -398,7 +384,6 @@ class BaseDriver extends AbstractPaymentDriver
*/ */
public function confirmGatewayFee() :void public function confirmGatewayFee() :void
{ {
/*Payment invoices*/ /*Payment invoices*/
$payment_invoices = $this->payment_hash->invoices(); $payment_invoices = $this->payment_hash->invoices();
@ -412,7 +397,6 @@ class BaseDriver extends AbstractPaymentDriver
if (collect($invoice->line_items)->contains('type_id', '3')) { if (collect($invoice->line_items)->contains('type_id', '3')) {
$invoice->service()->toggleFeesPaid()->save(); $invoice->service()->toggleFeesPaid()->save();
} }
}); });
} }
@ -510,7 +494,7 @@ class BaseDriver extends AbstractPaymentDriver
public function sendFailureMail($error) public function sendFailureMail($error)
{ {
if(is_object($error)){ if (is_object($error)) {
$error = 'Payment Aborted'; $error = 'Payment Aborted';
} }

View File

@ -11,11 +11,11 @@
namespace App\Services\Email; namespace App\Services\Email;
use App\Models\User;
use App\Models\Client; use App\Models\Client;
use App\Models\Vendor;
use App\Models\Company;
use App\Models\ClientContact; use App\Models\ClientContact;
use App\Models\Company;
use App\Models\User;
use App\Models\Vendor;
use App\Models\VendorContact; use App\Models\VendorContact;
use Illuminate\Mail\Mailables\Address; use Illuminate\Mail\Mailables\Address;

View File

@ -105,7 +105,6 @@ class MailEntity implements ShouldQueue
*/ */
public function configureMailer(): self public function configureMailer(): self
{ {
$this->mail = Mail::mailer($this->mailer); $this->mail = Mail::mailer($this->mailer);
if ($this->client_postmark_secret) { if ($this->client_postmark_secret) {
@ -208,7 +207,6 @@ class MailEntity implements ShouldQueue
public function trySending(): void public function trySending(): void
{ {
try { try {
$this->mail->send($this->mailable); $this->mail->send($this->mailable);
/* Count the amount of emails sent across all the users accounts */ /* Count the amount of emails sent across all the users accounts */

View File

@ -11,12 +11,12 @@
namespace App\Services\Scheduler; namespace App\Services\Scheduler;
use App\Models\Client;
use App\Models\Scheduler;
use App\Utils\Traits\MakesHash;
use App\Models\RecurringInvoice;
use App\Utils\Traits\MakesDates;
use App\DataMapper\Schedule\EmailStatement; use App\DataMapper\Schedule\EmailStatement;
use App\Models\Client;
use App\Models\RecurringInvoice;
use App\Models\Scheduler;
use App\Utils\Traits\MakesDates;
use App\Utils\Traits\MakesHash;
class SchedulerService class SchedulerService
{ {

View File

@ -179,14 +179,11 @@ class Number
} elseif ($swapSymbol) { } elseif ($swapSymbol) {
return "{$value} ".trim($symbol); return "{$value} ".trim($symbol);
} elseif ($entity->getSetting('show_currency_code') === false) { } elseif ($entity->getSetting('show_currency_code') === false) {
/* Ensures we place the negative symbol ahead of the currency symbol*/
/* Ensures we place the negative symbol ahead of the currency symbol*/ if ($_value < 0) {
if($_value < 0){ $value = substr($value, 1);
$symbol = "-{$symbol}";
$value = substr($value, 1); }
$symbol = "-{$symbol}";
}
return "{$symbol}{$value}"; return "{$symbol}{$value}";
} else { } else {