mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
cs fixer
This commit is contained in:
parent
f5a5946cb7
commit
5a42b89d55
@ -190,14 +190,12 @@ class BackupUpdate extends Command
|
||||
->where('filename', '!=', '')
|
||||
->cursor()
|
||||
->each(function ($backup) {
|
||||
|
||||
$backup_bin = Storage::disk('s3')->get($backup->filename);
|
||||
|
||||
if ($backup_bin) {
|
||||
Storage::disk($this->option('disk'))->put($backup->filename, $backup_bin);
|
||||
|
||||
nlog("Backups - Moving {$backup->filename} to {$this->option('disk')}");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -12,36 +12,36 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App;
|
||||
use Exception;
|
||||
use App\Models\User;
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Quote;
|
||||
use App\Models\Client;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\Account;
|
||||
use App\Models\Company;
|
||||
use App\Models\Contact;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\CompanyUser;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\CompanyLedger;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\VendorContact;
|
||||
use App\Models\QuoteInvitation;
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\CreditInvitation;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\DataMapper\ClientSettings;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Factory\ClientContactFactory;
|
||||
use App\Factory\VendorContactFactory;
|
||||
use App\Jobs\Company\CreateCompanyToken;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyLedger;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\CompanyUser;
|
||||
use App\Models\Contact;
|
||||
use App\Models\Credit;
|
||||
use App\Models\CreditInvitation;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Models\Payment;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Models\Quote;
|
||||
use App\Models\QuoteInvitation;
|
||||
use App\Models\RecurringInvoiceInvitation;
|
||||
use App\Models\User;
|
||||
use App\Models\Vendor;
|
||||
use App\Models\VendorContact;
|
||||
use App\Utils\Ninja;
|
||||
use Exception;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
/*
|
||||
@ -176,13 +176,11 @@ class CheckData extends Command
|
||||
if (CompanyToken::where('user_id', $cu->user_id)->where('company_id', $cu->company_id)->where('is_system', 1)->doesntExist()) {
|
||||
$this->logMessage("Creating missing company token for user # {$cu->user_id} for company id # {$cu->company_id}");
|
||||
|
||||
if($cu->company && $cu->user)
|
||||
if ($cu->company && $cu->user) {
|
||||
(new CreateCompanyToken($cu->company, $cu->user, 'System'))->handle();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,13 +84,13 @@ class ClientSettings extends BaseSettings
|
||||
*/
|
||||
public static function buildClientSettings($company_settings, $client_settings)
|
||||
{
|
||||
|
||||
if (! $client_settings) {
|
||||
return $company_settings;
|
||||
}
|
||||
|
||||
if(is_array($client_settings))
|
||||
if (is_array($client_settings)) {
|
||||
$client_settings = (object)$client_settings;
|
||||
}
|
||||
|
||||
foreach ($company_settings as $key => $value) {
|
||||
/* pseudo code
|
||||
|
@ -33,5 +33,4 @@ class ScheduleInvoice
|
||||
* @var string
|
||||
*/
|
||||
public string $entity_id = '';
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ use App\Models\Company;
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
|
@ -13,11 +13,11 @@ namespace App\Events\Invoice;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Invoice;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class InvoiceWasCreated.
|
||||
|
@ -12,8 +12,8 @@
|
||||
namespace App\Export\CSV;
|
||||
|
||||
use App\Models\Client;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class BaseExport
|
||||
{
|
||||
@ -34,7 +34,6 @@ class BaseExport
|
||||
protected function filterByClients($query)
|
||||
{
|
||||
if (isset($this->input['client_id']) && $this->input['client_id'] != 'all') {
|
||||
|
||||
$client = Client::withTrashed()->find($this->input['client_id']);
|
||||
$this->client_description = $client->present()->name;
|
||||
return $query->where('client_id', $this->input['client_id']);
|
||||
|
@ -11,15 +11,15 @@
|
||||
|
||||
namespace App\Export\CSV;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use League\Csv\Writer;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Company;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Product;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Utils\Ninja;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use League\Csv\Writer;
|
||||
|
||||
class ProductSalesExport extends BaseExport
|
||||
{
|
||||
@ -117,8 +117,7 @@ class ProductSalesExport extends BaseExport
|
||||
});
|
||||
|
||||
|
||||
$grouped = $this->sales->groupBy('product_key')->map(function ($key, $value){
|
||||
|
||||
$grouped = $this->sales->groupBy('product_key')->map(function ($key, $value) {
|
||||
$data = [
|
||||
'product' => $value,
|
||||
'quantity' => $key->sum('quantity'),
|
||||
@ -183,7 +182,6 @@ class ProductSalesExport extends BaseExport
|
||||
$this->sales->push($entity);
|
||||
|
||||
return $entity;
|
||||
|
||||
}
|
||||
|
||||
private function decorateAdvancedFields(Invoice $invoice, $entity) :array
|
||||
@ -199,31 +197,31 @@ class ProductSalesExport extends BaseExport
|
||||
$entity['date'] = Carbon::parse($invoice->date)->format($this->company->date_format());
|
||||
|
||||
$entity['discount'] = $this->calculateDiscount($invoice, $entity);
|
||||
$entity['markup'] = round(((($entity['price'] - $entity['discount'] - $entity['cost']) / $unit_cost) * 100),2);
|
||||
$entity['markup'] = round(((($entity['price'] - $entity['discount'] - $entity['cost']) / $unit_cost) * 100), 2);
|
||||
|
||||
$entity['net_total'] = $entity['price'] - $entity['discount'];
|
||||
$entity['profit'] = $entity['price'] - $entity['discount'] - $entity['cost'];
|
||||
|
||||
if(strlen($entity['tax_name1']) > 1) {
|
||||
if (strlen($entity['tax_name1']) > 1) {
|
||||
$entity['tax_name1'] = $entity['tax_name1'] . ' [' . $entity['tax_rate1'] . '%]';
|
||||
$entity['tax_amount1'] = $this->calculateTax($invoice, $entity['line_total'], $entity['tax_rate1']);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
$entity['tax_amount1'] = 0;
|
||||
}
|
||||
|
||||
if(strlen($entity['tax_name2']) > 1) {
|
||||
if (strlen($entity['tax_name2']) > 1) {
|
||||
$entity['tax_name2'] = $entity['tax_name2'] . ' [' . $entity['tax_rate2'] . '%]';
|
||||
$entity['tax_amount2'] = $this->calculateTax($invoice, $entity['line_total'], $entity['tax_rate2']);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
$entity['tax_amount2'] = 0;
|
||||
}
|
||||
|
||||
if(strlen($entity['tax_name3']) > 1) {
|
||||
if (strlen($entity['tax_name3']) > 1) {
|
||||
$entity['tax_name3'] = $entity['tax_name3'] . ' [' . $entity['tax_rate3'] . '%]';
|
||||
$entity['tax_amount3'] = $this->calculateTax($invoice, $entity['line_total'], $entity['tax_rate3']);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
$entity['tax_amount3'] = 0;
|
||||
}
|
||||
|
||||
return $entity;
|
||||
}
|
||||
@ -240,13 +238,11 @@ class ProductSalesExport extends BaseExport
|
||||
{
|
||||
$amount = $amount - ($amount * ($invoice->discount / 100));
|
||||
|
||||
if($invoice->uses_inclusive_taxes) {
|
||||
if ($invoice->uses_inclusive_taxes) {
|
||||
return round($amount - ($amount / (1 + ($tax_rate / 100))), 2);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return round(($amount * $tax_rate / 100), 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -258,15 +254,15 @@ class ProductSalesExport extends BaseExport
|
||||
* @param mixed $entity
|
||||
* @return float
|
||||
*/
|
||||
private function calculateDiscount(Invoice $invoice , $entity) :float
|
||||
private function calculateDiscount(Invoice $invoice, $entity) :float
|
||||
{
|
||||
if($entity['discount'] == 0)
|
||||
if ($entity['discount'] == 0) {
|
||||
return 0;
|
||||
|
||||
if($invoice->is_amount_discount && $entity['discount'] != 0) {
|
||||
return $entity['discount'];
|
||||
}
|
||||
elseif(!$invoice->is_amount_discount && $entity['discount'] != 0) {
|
||||
|
||||
if ($invoice->is_amount_discount && $entity['discount'] != 0) {
|
||||
return $entity['discount'];
|
||||
} elseif (!$invoice->is_amount_discount && $entity['discount'] != 0) {
|
||||
return round($entity['line_total'] * ($entity['discount'] / 100), 2);
|
||||
}
|
||||
|
||||
|
@ -86,8 +86,8 @@ class CreditFilters extends QueryFilters
|
||||
->orWhere('credits.custom_value2', 'like', '%'.$filter.'%')
|
||||
->orWhere('credits.custom_value3', 'like', '%'.$filter.'%')
|
||||
->orWhere('credits.custom_value4', 'like', '%'.$filter.'%')
|
||||
->orWhereHas('client', function ($q) use ($filter){
|
||||
$q->where('name', 'like', '%'.$filter.'%');
|
||||
->orWhereHas('client', function ($q) use ($filter) {
|
||||
$q->where('name', 'like', '%'.$filter.'%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -108,8 +108,8 @@ class InvoiceFilters extends QueryFilters
|
||||
->orWhere('custom_value2', 'like', '%'.$filter.'%')
|
||||
->orWhere('custom_value3', 'like', '%'.$filter.'%')
|
||||
->orWhere('custom_value4', 'like', '%'.$filter.'%')
|
||||
->orWhereHas('client', function ($q) use ($filter){
|
||||
$q->where('name', 'like', '%'.$filter.'%');
|
||||
->orWhereHas('client', function ($q) use ($filter) {
|
||||
$q->where('name', 'like', '%'.$filter.'%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -63,8 +63,8 @@ class PurchaseOrderFilters extends QueryFilters
|
||||
$po_status[] = PurchaseOrder::STATUS_CANCELLED;
|
||||
}
|
||||
|
||||
if (count($status_parameters) >=1) {
|
||||
$query->whereIn('status_id', $status_parameters);
|
||||
if (count($po_status) >=1) {
|
||||
$query->whereIn('status_id', $po_status);
|
||||
}
|
||||
});
|
||||
|
||||
@ -94,7 +94,7 @@ class PurchaseOrderFilters extends QueryFilters
|
||||
->orWhere('custom_value2', 'like', '%'.$filter.'%')
|
||||
->orWhere('custom_value3', 'like', '%'.$filter.'%')
|
||||
->orWhere('custom_value4', 'like', '%'.$filter.'%')
|
||||
->orWhereHas('vendor', function ($q) use ($filter){
|
||||
->orWhereHas('vendor', function ($q) use ($filter) {
|
||||
$q->where('name', 'like', '%'.$filter.'%');
|
||||
});
|
||||
});
|
||||
|
@ -38,9 +38,9 @@ class QuoteFilters extends QueryFilters
|
||||
->orWhere('custom_value2', 'like', '%'.$filter.'%')
|
||||
->orWhere('custom_value3', 'like', '%'.$filter.'%')
|
||||
->orWhere('custom_value4', 'like', '%'.$filter.'%')
|
||||
->orWhereHas('client', function ($q) use ($filter){
|
||||
$q->where('name', 'like', '%'.$filter.'%');
|
||||
});
|
||||
->orWhereHas('client', function ($q) use ($filter) {
|
||||
$q->where('name', 'like', '%'.$filter.'%');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -377,7 +377,7 @@ class LoginController extends BaseController
|
||||
|
||||
if (auth()->user()->company_users()->count() != auth()->user()->tokens()->distinct('company_id')->count()) {
|
||||
auth()->user()->companies->each(function ($company) {
|
||||
if (!CompanyToken::where('user_id', auth()->user()->id)->where('company_id', $company->id)->where('is_system',true)->exists()) {
|
||||
if (!CompanyToken::where('user_id', auth()->user()->id)->where('company_id', $company->id)->where('is_system', true)->exists()) {
|
||||
(new CreateCompanyToken($company, auth()->user(), 'Google_O_Auth'))->handle();
|
||||
}
|
||||
});
|
||||
|
@ -531,7 +531,6 @@ class BankTransactionController extends BaseController
|
||||
*/
|
||||
public function match(MatchBankTransactionRequest $request)
|
||||
{
|
||||
|
||||
$bts = (new MatchBankTransactions(auth()->user()->company()->id, auth()->user()->company()->db, $request->all()))->handle();
|
||||
|
||||
return $this->listResponse($bts);
|
||||
|
@ -12,24 +12,24 @@
|
||||
|
||||
namespace App\Http\Controllers\ClientPortal;
|
||||
|
||||
use App\Factory\PaymentFactory;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
||||
use App\Models\CompanyGateway;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use Illuminate\View\View;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\PaymentHash;
|
||||
use App\Models\PaymentType;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\CompanyGateway;
|
||||
use App\Factory\PaymentFactory;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use App\PaymentDrivers\Stripe\BankTransfer;
|
||||
use App\Services\ClientPortal\InstantPayment;
|
||||
use App\Services\Subscription\SubscriptionService;
|
||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
/**
|
||||
* Class PaymentController.
|
||||
@ -64,15 +64,14 @@ class PaymentController extends Controller
|
||||
$data = false;
|
||||
$gateway = false;
|
||||
|
||||
if($payment->gateway_type_id == GatewayType::DIRECT_DEBIT && $payment->type_id == PaymentType::DIRECT_DEBIT){
|
||||
|
||||
if ($payment->gateway_type_id == GatewayType::DIRECT_DEBIT && $payment->type_id == PaymentType::DIRECT_DEBIT) {
|
||||
if (method_exists($payment->company_gateway->driver($payment->client), 'getPaymentIntent')) {
|
||||
$stripe = $payment->company_gateway->driver($payment->client);
|
||||
$payment_intent = $stripe->getPaymentIntent($payment->transaction_reference);
|
||||
|
||||
$bt = new BankTransfer($stripe);
|
||||
|
||||
match($payment->currency->code){
|
||||
match ($payment->currency->code) {
|
||||
'MXN' => $data = $bt->formatDataforMx($payment_intent),
|
||||
'EUR' => $data = $bt->formatDataforEur($payment_intent),
|
||||
'JPY' => $data = $bt->formatDataforJp($payment_intent),
|
||||
|
@ -15,7 +15,6 @@ namespace App\Http\Controllers\ClientPortal;
|
||||
use App\Events\Payment\Methods\MethodDeleted;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ClientPortal\PaymentMethod\CreatePaymentMethodRequest;
|
||||
use App\Http\Requests\ClientPortal\PaymentMethod\VerifyPaymentMethodRequest;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\ClientGatewayToken;
|
||||
use App\Models\GatewayType;
|
||||
|
@ -12,16 +12,16 @@
|
||||
|
||||
namespace App\Http\Controllers\ClientPortal;
|
||||
|
||||
use App\Utils\Number;
|
||||
use Illuminate\View\View;
|
||||
use App\DataMapper\InvoiceItem;
|
||||
use App\Factory\InvoiceFactory;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use App\Repositories\InvoiceRepository;
|
||||
use App\Http\Requests\ClientPortal\PrePayments\StorePrePaymentRequest;
|
||||
use App\Repositories\InvoiceRepository;
|
||||
use App\Utils\Number;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\View\View;
|
||||
|
||||
/**
|
||||
* Class PrePaymentController.
|
||||
@ -38,7 +38,6 @@ class PrePaymentController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'title' => ctrans('texts.amount'). " " .auth()->guard('contact')->user()->client->currency()->code." (".auth()->guard('contact')->user()->client->currency()->symbol . ")",
|
||||
'allows_recurring' => auth()->guard('contact')->user()->client->getSetting('client_initiated_payments_recurring'),
|
||||
@ -51,7 +50,6 @@ class PrePaymentController extends Controller
|
||||
|
||||
public function process(StorePrePaymentRequest $request)
|
||||
{
|
||||
|
||||
$invoice = InvoiceFactory::create(auth()->guard('contact')->user()->company_id, auth()->guard('contact')->user()->user_id);
|
||||
$invoice->due_date = now()->format('Y-m-d');
|
||||
$invoice->is_proforma = true;
|
||||
@ -114,7 +112,5 @@ class PrePaymentController extends Controller
|
||||
];
|
||||
|
||||
return $this->render('invoices.payment', $data);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -44,7 +44,6 @@ class SubscriptionPurchaseController extends Controller
|
||||
|
||||
public function upgrade(Subscription $subscription, Request $request)
|
||||
{
|
||||
|
||||
App::setLocale($subscription->company->locale());
|
||||
|
||||
/* Make sure the contact is logged into the correct company for this subscription */
|
||||
|
@ -11,37 +11,37 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Account;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyUser;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\Uploadable;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Jobs\Company\CreateCompany;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use App\Mail\Company\CompanyDeleted;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use Turbo124\Beacon\Facades\LightLogs;
|
||||
use App\Repositories\CompanyRepository;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Jobs\Company\CreateCompanyToken;
|
||||
use App\Transformers\CompanyTransformer;
|
||||
use App\DataMapper\Analytics\AccountDeleted;
|
||||
use App\Transformers\CompanyUserTransformer;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use App\Jobs\Company\CreateCompanyPaymentTerms;
|
||||
use App\Jobs\Company\CreateCompanyTaskStatuses;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\Http\Requests\Company\CreateCompanyRequest;
|
||||
use App\Http\Requests\Company\DefaultCompanyRequest;
|
||||
use App\Http\Requests\Company\DestroyCompanyRequest;
|
||||
use App\Http\Requests\Company\EditCompanyRequest;
|
||||
use App\Http\Requests\Company\ShowCompanyRequest;
|
||||
use App\Http\Requests\Company\StoreCompanyRequest;
|
||||
use App\Http\Requests\Company\CreateCompanyRequest;
|
||||
use App\Http\Requests\Company\UpdateCompanyRequest;
|
||||
use App\Http\Requests\Company\UploadCompanyRequest;
|
||||
use App\Http\Requests\Company\DefaultCompanyRequest;
|
||||
use App\Http\Requests\Company\DestroyCompanyRequest;
|
||||
use App\Jobs\Company\CreateCompany;
|
||||
use App\Jobs\Company\CreateCompanyPaymentTerms;
|
||||
use App\Jobs\Company\CreateCompanyTaskStatuses;
|
||||
use App\Jobs\Company\CreateCompanyToken;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use App\Mail\Company\CompanyDeleted;
|
||||
use App\Models\Account;
|
||||
use App\Models\Company;
|
||||
use App\Models\CompanyUser;
|
||||
use App\Repositories\CompanyRepository;
|
||||
use App\Transformers\CompanyTransformer;
|
||||
use App\Transformers\CompanyUserTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use App\Utils\Traits\Uploadable;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Turbo124\Beacon\Facades\LightLogs;
|
||||
|
||||
/**
|
||||
* Class CompanyController.
|
||||
@ -489,8 +489,7 @@ class CompanyController extends BaseController
|
||||
|
||||
try {
|
||||
Storage::disk(config('filesystems.default'))->deleteDirectory($company->company_key);
|
||||
}
|
||||
catch(\Exception $e) {
|
||||
} catch(\Exception $e) {
|
||||
}
|
||||
|
||||
$account->delete();
|
||||
@ -502,9 +501,6 @@ class CompanyController extends BaseController
|
||||
LightLogs::create(new AccountDeleted())
|
||||
->increment()
|
||||
->batch();
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
$company_id = $company->id;
|
||||
|
||||
|
@ -11,26 +11,26 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Quote;
|
||||
use App\Events\Credit\CreditWasEmailed;
|
||||
use App\Events\Quote\QuoteWasEmailed;
|
||||
use App\Http\Requests\Email\SendEmailRequest;
|
||||
use App\Jobs\Entity\EmailEntity;
|
||||
use App\Jobs\PurchaseOrder\PurchaseOrderEmail;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Services\Email\Email;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Jobs\Entity\EmailEntity;
|
||||
use App\Models\Quote;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Services\Email\Email;
|
||||
use App\Services\Email\EmailObject;
|
||||
use App\Events\Quote\QuoteWasEmailed;
|
||||
use App\Transformers\QuoteTransformer;
|
||||
use App\Events\Credit\CreditWasEmailed;
|
||||
use App\Transformers\CreditTransformer;
|
||||
use App\Transformers\InvoiceTransformer;
|
||||
use App\Http\Requests\Email\SendEmailRequest;
|
||||
use App\Jobs\PurchaseOrder\PurchaseOrderEmail;
|
||||
use App\Transformers\PurchaseOrderTransformer;
|
||||
use App\Transformers\QuoteTransformer;
|
||||
use App\Transformers\RecurringInvoiceTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Mail\Mailables\Address;
|
||||
|
||||
class EmailController extends BaseController
|
||||
@ -136,8 +136,9 @@ class EmailController extends BaseController
|
||||
$mo->email_template_body = $request->input('template');
|
||||
$mo->email_template_subject = str_replace("template", "subject", $request->input('template'));
|
||||
|
||||
if($request->has('cc_email'))
|
||||
if ($request->has('cc_email')) {
|
||||
$mo->cc[] = new Address($request->cc_email);
|
||||
}
|
||||
|
||||
// if ($entity == 'purchaseOrder' || $entity == 'purchase_order' || $template == 'purchase_order' || $entity == 'App\Models\PurchaseOrder') {
|
||||
// return $this->sendPurchaseOrder($entity_obj, $data, $template);
|
||||
@ -152,7 +153,6 @@ class EmailController extends BaseController
|
||||
$mo->invitation_id = $invitation->id;
|
||||
|
||||
Email::dispatch($mo, $invitation->company);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
@ -193,7 +193,7 @@ class EmailController extends BaseController
|
||||
$this->entity_transformer = RecurringInvoiceTransformer::class;
|
||||
}
|
||||
|
||||
if($entity_obj instanceof PurchaseOrder){
|
||||
if ($entity_obj instanceof PurchaseOrder) {
|
||||
$this->entity_type = PurchaseOrder::class;
|
||||
$this->entity_transformer = PurchaseOrderTransformer::class;
|
||||
}
|
||||
@ -217,8 +217,7 @@ class EmailController extends BaseController
|
||||
|
||||
private function resolveClass(string $entity): string
|
||||
{
|
||||
|
||||
match($entity){
|
||||
match ($entity) {
|
||||
'invoice' => $class = Invoice::class,
|
||||
'App\Models\Invoice' => $class = Invoice::class,
|
||||
'credit' => $class = Credit::class,
|
||||
@ -232,6 +231,5 @@ class EmailController extends BaseController
|
||||
};
|
||||
|
||||
return $class;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -163,19 +163,15 @@ class ImportController extends Controller
|
||||
$bestDelimiter = ' ';
|
||||
$count = 0;
|
||||
foreach ($delimiters as $delimiter) {
|
||||
|
||||
// if (substr_count($csvfile, $delimiter) > $count) {
|
||||
// $count = substr_count($csvfile, $delimiter);
|
||||
// $bestDelimiter = $delimiter;
|
||||
// }
|
||||
|
||||
if (substr_count(strstr($csvfile,"\n",true), $delimiter) > $count) {
|
||||
if (substr_count(strstr($csvfile, "\n", true), $delimiter) > $count) {
|
||||
$count = substr_count($csvfile, $delimiter);
|
||||
$bestDelimiter = $delimiter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
return $bestDelimiter;
|
||||
}
|
||||
|
@ -11,13 +11,13 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use stdClass;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\Account;
|
||||
use App\Utils\CurlUtils;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Http\Request;
|
||||
use stdClass;
|
||||
|
||||
class LicenseController extends BaseController
|
||||
{
|
||||
@ -155,15 +155,13 @@ class LicenseController extends BaseController
|
||||
|
||||
/* Catch claim license requests */
|
||||
if (config('ninja.environment') == 'selfhost' && request()->has('license_key')) {
|
||||
|
||||
// $response = Http::get( "http://ninja.test:8000/claim_license", [
|
||||
$response = Http::get( "https://invoicing.co/claim_license", [
|
||||
$response = Http::get("https://invoicing.co/claim_license", [
|
||||
'license_key' => $request->input('license_key'),
|
||||
'product_id' => 3,
|
||||
]);
|
||||
|
||||
if($response->successful()) {
|
||||
|
||||
if ($response->successful()) {
|
||||
$payload = $response->json();
|
||||
|
||||
$account = auth()->user()->account;
|
||||
@ -179,8 +177,7 @@ class LicenseController extends BaseController
|
||||
];
|
||||
|
||||
return response()->json($error, 200);
|
||||
}else {
|
||||
|
||||
} else {
|
||||
$error = [
|
||||
'message' => trans('texts.white_label_license_error'),
|
||||
'errors' => new stdClass,
|
||||
@ -188,7 +185,6 @@ class LicenseController extends BaseController
|
||||
|
||||
return response()->json($error, 400);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$error = [
|
||||
@ -197,7 +193,6 @@ class LicenseController extends BaseController
|
||||
];
|
||||
|
||||
return response()->json($error, 400);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -210,6 +205,5 @@ class LicenseController extends BaseController
|
||||
$account->plan_expires = null;
|
||||
$account->save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ use App\Libraries\MultiDB;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Credit;
|
||||
use App\Models\GroupSetting;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\InvoiceInvitation;
|
||||
use App\Models\Quote;
|
||||
@ -37,7 +36,6 @@ use App\Services\PdfMaker\Design;
|
||||
use App\Services\PdfMaker\Design as PdfDesignModel;
|
||||
use App\Services\PdfMaker\Design as PdfMakerDesign;
|
||||
use App\Services\PdfMaker\PdfMaker;
|
||||
use App\Services\Preview\StubBuilder;
|
||||
use App\Utils\HostedPDF\NinjaPdf;
|
||||
use App\Utils\HtmlEngine;
|
||||
use App\Utils\Ninja;
|
||||
|
@ -11,29 +11,29 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Account;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Factory\RecurringInvoiceFactory;
|
||||
use App\Filters\RecurringInvoiceFilters;
|
||||
use App\Jobs\RecurringInvoice\UpdateRecurring;
|
||||
use App\Repositories\RecurringInvoiceRepository;
|
||||
use App\Transformers\RecurringInvoiceTransformer;
|
||||
use App\Events\RecurringInvoice\RecurringInvoiceWasCreated;
|
||||
use App\Events\RecurringInvoice\RecurringInvoiceWasUpdated;
|
||||
use App\Factory\RecurringInvoiceFactory;
|
||||
use App\Filters\RecurringInvoiceFilters;
|
||||
use App\Http\Requests\RecurringInvoice\ActionRecurringInvoiceRequest;
|
||||
use App\Http\Requests\RecurringInvoice\BulkRecurringInvoiceRequest;
|
||||
use App\Http\Requests\RecurringInvoice\CreateRecurringInvoiceRequest;
|
||||
use App\Http\Requests\RecurringInvoice\DestroyRecurringInvoiceRequest;
|
||||
use App\Http\Requests\RecurringInvoice\EditRecurringInvoiceRequest;
|
||||
use App\Http\Requests\RecurringInvoice\ShowRecurringInvoiceRequest;
|
||||
use App\Http\Requests\RecurringInvoice\StoreRecurringInvoiceRequest;
|
||||
use App\Http\Requests\RecurringInvoice\ActionRecurringInvoiceRequest;
|
||||
use App\Http\Requests\RecurringInvoice\CreateRecurringInvoiceRequest;
|
||||
use App\Http\Requests\RecurringInvoice\UpdateRecurringInvoiceRequest;
|
||||
use App\Http\Requests\RecurringInvoice\UploadRecurringInvoiceRequest;
|
||||
use App\Http\Requests\RecurringInvoice\DestroyRecurringInvoiceRequest;
|
||||
use App\Jobs\RecurringInvoice\UpdateRecurring;
|
||||
use App\Models\Account;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Repositories\RecurringInvoiceRepository;
|
||||
use App\Transformers\RecurringInvoiceTransformer;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SavesDocuments;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
/**
|
||||
* Class RecurringInvoiceController.
|
||||
@ -406,10 +406,9 @@ class RecurringInvoiceController extends BaseController
|
||||
*/
|
||||
public function bulk(BulkRecurringInvoiceRequest $request)
|
||||
{
|
||||
|
||||
$percentage_increase = request()->has('percentage_increase') ? request()->input('percentage_increase') : 0;
|
||||
|
||||
if(in_array($request->action, ['increase_prices', 'update_prices'])) {
|
||||
if (in_array($request->action, ['increase_prices', 'update_prices'])) {
|
||||
UpdateRecurring::dispatch($request->ids, auth()->user()->company(), auth()->user(), $request->action, $percentage_increase);
|
||||
|
||||
return response()->json(['message' => 'Update in progress.'], 200);
|
||||
@ -417,7 +416,7 @@ class RecurringInvoiceController extends BaseController
|
||||
|
||||
$recurring_invoices = RecurringInvoice::withTrashed()->find($request->ids);
|
||||
|
||||
$recurring_invoices->each(function ($recurring_invoice, $key) use($request){
|
||||
$recurring_invoices->each(function ($recurring_invoice, $key) use ($request) {
|
||||
if (auth()->user()->can('edit', $recurring_invoice)) {
|
||||
$this->performAction($recurring_invoice, $request->action, true);
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Factory\SchedulerFactory;
|
||||
use App\Filters\SchedulerFilters;
|
||||
use App\Http\Requests\TaskScheduler\DestroySchedulerRequest;
|
||||
use App\Http\Requests\TaskScheduler\CreateSchedulerRequest;
|
||||
use App\Http\Requests\TaskScheduler\DestroySchedulerRequest;
|
||||
use App\Http\Requests\TaskScheduler\ShowSchedulerRequest;
|
||||
use App\Http\Requests\TaskScheduler\StoreSchedulerRequest;
|
||||
use App\Http\Requests\TaskScheduler\UpdateSchedulerRequest;
|
||||
|
@ -12,22 +12,22 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Webhook;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Response;
|
||||
use App\Factory\WebhookFactory;
|
||||
use App\Filters\WebhookFilters;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Http\Requests\Webhook\CreateWebhookRequest;
|
||||
use App\Http\Requests\Webhook\DestroyWebhookRequest;
|
||||
use App\Http\Requests\Webhook\EditWebhookRequest;
|
||||
use App\Http\Requests\Webhook\RetryWebhookRequest;
|
||||
use App\Http\Requests\Webhook\ShowWebhookRequest;
|
||||
use App\Http\Requests\Webhook\StoreWebhookRequest;
|
||||
use App\Http\Requests\Webhook\UpdateWebhookRequest;
|
||||
use App\Jobs\Util\WebhookSingle;
|
||||
use App\Models\Webhook;
|
||||
use App\Repositories\BaseRepository;
|
||||
use App\Transformers\WebhookTransformer;
|
||||
use App\Http\Requests\Webhook\EditWebhookRequest;
|
||||
use App\Http\Requests\Webhook\ShowWebhookRequest;
|
||||
use App\Http\Requests\Webhook\RetryWebhookRequest;
|
||||
use App\Http\Requests\Webhook\StoreWebhookRequest;
|
||||
use App\Http\Requests\Webhook\CreateWebhookRequest;
|
||||
use App\Http\Requests\Webhook\UpdateWebhookRequest;
|
||||
use App\Http\Requests\Webhook\DestroyWebhookRequest;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class WebhookController extends BaseController
|
||||
{
|
||||
@ -493,7 +493,7 @@ class WebhookController extends BaseController
|
||||
|
||||
public function retry(RetryWebhookRequest $request, Webhook $webhook)
|
||||
{
|
||||
match($request->entity) {
|
||||
match ($request->entity) {
|
||||
'invoice' => $includes ='client',
|
||||
'payment' => $includes ='invoices,client',
|
||||
'project' => $includes ='client',
|
||||
@ -506,7 +506,7 @@ class WebhookController extends BaseController
|
||||
|
||||
$entity = $class::withTrashed()->where('id', $this->decodePrimaryKey($request->entity_id))->company()->first();
|
||||
|
||||
if(!$entity){
|
||||
if (!$entity) {
|
||||
return response()->json(['message' => ctrans('texts.record_not_found')], 400);
|
||||
}
|
||||
|
||||
|
@ -11,24 +11,24 @@
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Client;
|
||||
use App\Models\Invoice;
|
||||
use Livewire\Component;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Models\Subscription;
|
||||
use App\Models\ClientContact;
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\Factory\ClientFactory;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Mail\ContactPasswordlessLogin;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Subscription;
|
||||
use App\Repositories\ClientContactRepository;
|
||||
use App\Repositories\ClientRepository;
|
||||
use App\Services\Subscription\SubscriptionService;
|
||||
use App\Utils\Ninja;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use App\Mail\ContactPasswordlessLogin;
|
||||
use App\Repositories\ClientRepository;
|
||||
use App\Repositories\ClientContactRepository;
|
||||
use App\Services\Subscription\SubscriptionService;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Component;
|
||||
|
||||
class BillingPortalPurchase extends Component
|
||||
{
|
||||
@ -401,7 +401,7 @@ class BillingPortalPurchase extends Component
|
||||
$context = 'purchase';
|
||||
|
||||
// if(Ninja::isHosted() && $this->subscription->service()->recurring_products()->first()?->id == SubscriptionService::WHITE_LABEL) {
|
||||
if(Ninja::isHosted() && $this->subscription->service()->recurring_products()->first()?->product_key == 'whitelabel') {
|
||||
if (Ninja::isHosted() && $this->subscription->service()->recurring_products()->first()?->product_key == 'whitelabel') {
|
||||
$context = 'whitelabel';
|
||||
}
|
||||
|
||||
|
@ -172,8 +172,7 @@ class BillingPortalPurchasev2 extends Component
|
||||
$this->contact = auth()->guard('contact')->user();
|
||||
$this->authenticated = true;
|
||||
$this->payment_started = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$this->bundle = collect();
|
||||
}
|
||||
|
||||
@ -276,7 +275,6 @@ class BillingPortalPurchasev2 extends Component
|
||||
*/
|
||||
public function handleCoupon()
|
||||
{
|
||||
|
||||
$this->resetErrorBag('coupon');
|
||||
$this->resetValidation('coupon');
|
||||
|
||||
|
@ -232,8 +232,9 @@ class RequiredClientInfo extends Component
|
||||
if ($cg && $cg->update_details) {
|
||||
$payment_gateway = $cg->driver($this->client)->init();
|
||||
|
||||
if(method_exists($payment_gateway, "updateCustomer"))
|
||||
if (method_exists($payment_gateway, "updateCustomer")) {
|
||||
$payment_gateway->updateCustomer();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -29,10 +29,11 @@ class UploadBankIntegrationRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadBankTransactionRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -38,10 +38,11 @@ class StoreClientRequest extends Request
|
||||
|
||||
public function rules()
|
||||
{
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -38,10 +38,11 @@ class UpdateClientRequest extends Request
|
||||
{
|
||||
/* Ensure we have a client name, and that all emails are unique*/
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadClientRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -15,7 +15,6 @@ class StorePrePaymentRequest extends FormRequest
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -30,5 +29,4 @@ class StorePrePaymentRequest extends FormRequest
|
||||
'amount' => 'required|bail|',
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,10 +29,11 @@ class UploadCompanyRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -43,10 +43,11 @@ class StoreCreditRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -42,10 +42,11 @@ class UpdateCreditRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadCreditRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadExpenseRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadGroupSettingRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -37,10 +37,11 @@ class StoreInvoiceRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -39,10 +39,11 @@ class UpdateInvoiceRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadInvoiceRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
@ -45,6 +46,5 @@ class UploadInvoiceRequest extends Request
|
||||
|
||||
public function prepareForValidation()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -112,10 +112,11 @@ class StorePaymentRequest extends Request
|
||||
|
||||
];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -44,10 +44,11 @@ class UpdatePaymentRequest extends Request
|
||||
$rules['number'] = Rule::unique('payments')->where('company_id', auth()->user()->company()->id)->ignore($this->payment->id);
|
||||
}
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadPaymentRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -12,10 +12,6 @@
|
||||
namespace App\Http\Requests\Preview;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Credit;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Quote;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Utils\Traits\CleanLineItems;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace App\Http\Requests\Preview;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\PurchaseOrder;
|
||||
use App\Utils\Traits\CleanLineItems;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
|
@ -28,10 +28,11 @@ class StoreProductRequest extends Request
|
||||
|
||||
public function rules()
|
||||
{
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace App\Http\Requests\Product;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Product;
|
||||
use App\Utils\Traits\ChecksEntityStatus;
|
||||
|
||||
class UpdateProductRequest extends Request
|
||||
@ -31,10 +30,11 @@ class UpdateProductRequest extends Request
|
||||
|
||||
public function rules()
|
||||
{
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -28,10 +28,11 @@ class UploadProductRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
$rules = [];
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
namespace App\Http\Requests\Project;
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Project;
|
||||
|
||||
class CreateProjectRequest extends Request
|
||||
{
|
||||
@ -24,6 +24,5 @@ class CreateProjectRequest extends Request
|
||||
public function authorize() : bool
|
||||
{
|
||||
return auth()->user()->can('create', Project::class);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ class ShowProjectRequest extends Request
|
||||
{
|
||||
// return auth()->user()->isAdmin();
|
||||
return auth()->user()->can('view', $this->project);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,10 +42,11 @@ class StoreProjectRequest extends Request
|
||||
$rules['number'] = Rule::unique('projects')->where('company_id', auth()->user()->company()->id);
|
||||
}
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -37,10 +37,11 @@ class UpdateProjectRequest extends Request
|
||||
$rules['number'] = Rule::unique('projects')->where('company_id', auth()->user()->company()->id)->ignore($this->project->id);
|
||||
}
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadProjectRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -47,10 +47,11 @@ class StorePurchaseOrderRequest extends Request
|
||||
$rules['is_amount_discount'] = ['boolean'];
|
||||
$rules['line_items'] = 'array';
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -50,10 +50,11 @@ class UpdatePurchaseOrderRequest extends Request
|
||||
$rules['discount'] = 'sometimes|numeric';
|
||||
$rules['is_amount_discount'] = ['boolean'];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadPurchaseOrderRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -39,10 +39,11 @@ class StoreQuoteRequest extends Request
|
||||
|
||||
$rules['client_id'] = 'required|exists:clients,id,company_id,'.auth()->user()->company()->id;
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -37,10 +37,11 @@ class UpdateQuoteRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadQuoteRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -48,10 +48,11 @@ class StoreRecurringExpenseRequest extends Request
|
||||
$rules['tax_amount2'] = 'numeric';
|
||||
$rules['tax_amount3'] = 'numeric';
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -48,10 +48,11 @@ class UpdateRecurringExpenseRequest extends Request
|
||||
$rules['tax_amount3'] = 'numeric';
|
||||
$rules['category_id'] = 'bail|nullable|sometimes|exists:expense_categories,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadRecurringExpenseRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -38,10 +38,11 @@ class StoreRecurringInvoiceRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -38,10 +38,11 @@ class UpdateRecurringInvoiceRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadRecurringInvoiceRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -37,10 +37,11 @@ class StoreRecurringQuoteRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -37,10 +37,11 @@ class UpdateRecurringQuoteRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadRecurringQuoteRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -58,6 +58,5 @@ class GenericReportRequest extends Request
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -59,10 +59,11 @@ class StoreTaskRequest extends Request
|
||||
}
|
||||
}];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -66,10 +66,11 @@ class UpdateTaskRequest extends Request
|
||||
}
|
||||
}];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -12,11 +12,9 @@
|
||||
namespace App\Http\Requests\User;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
|
||||
class DetachCompanyUserRequest extends Request
|
||||
{
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
|
@ -41,10 +41,11 @@ class StoreVendorRequest extends Request
|
||||
|
||||
$rules['currency_id'] = 'bail|required|exists:currencies,id';
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
@ -57,7 +58,6 @@ class StoreVendorRequest extends Request
|
||||
|
||||
public function prepareForValidation()
|
||||
{
|
||||
|
||||
$input = $this->all();
|
||||
|
||||
if (!array_key_exists('currency_id', $input) || empty($input['currency_id'])) {
|
||||
|
@ -44,10 +44,11 @@ class UpdateVendorRequest extends Request
|
||||
$rules['contacts.*.email'] = 'nullable|distinct';
|
||||
$rules['currency_id'] = 'bail|sometimes|exists:currencies,id';
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -29,10 +29,11 @@ class UploadVendorRequest extends Request
|
||||
{
|
||||
$rules = [];
|
||||
|
||||
if($this->file('documents') && is_array($this->file('documents')))
|
||||
if ($this->file('documents') && is_array($this->file('documents'))) {
|
||||
$rules['documents.*'] = $this->file_validation;
|
||||
elseif($this->file('documents'))
|
||||
} elseif ($this->file('documents')) {
|
||||
$rules['documents'] = $this->file_validation;
|
||||
}
|
||||
|
||||
if ($this->file('file') && is_array($this->file('file'))) {
|
||||
$rules['file.*'] = $this->file_validation;
|
||||
|
@ -84,17 +84,15 @@ class PaymentAppliedValidAmount implements Rule
|
||||
|
||||
$inv = $inv_collection->firstWhere('id', $invoice['invoice_id']);
|
||||
|
||||
if($inv->balance < $invoice['amount']) {
|
||||
|
||||
if ($inv->balance < $invoice['amount']) {
|
||||
$this->message = 'Amount cannot be greater than invoice balance';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(round($payment_amounts, 3) >= round($invoice_amounts, 3)) {
|
||||
if (round($payment_amounts, 3) >= round($invoice_amounts, 3)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ class PortalComposer
|
||||
$data[] = ['title' => ctrans('texts.subscriptions'), 'url' => 'client.subscriptions.index', 'icon' => 'calendar'];
|
||||
}
|
||||
|
||||
if(property_exists($this->settings, 'client_initiated_payments') && $this->settings->client_initiated_payments) {
|
||||
if (property_exists($this->settings, 'client_initiated_payments') && $this->settings->client_initiated_payments) {
|
||||
$data[] = ['title' => ctrans('texts.pre_payment'), 'url' => 'client.pre_payments.index', 'icon' => 'dollar-sign'];
|
||||
}
|
||||
|
||||
|
@ -130,12 +130,10 @@ class BaseImport
|
||||
// $count = substr_count($csvfile, $delimiter);
|
||||
// $bestDelimiter = $delimiter;
|
||||
// }
|
||||
if (substr_count(strstr($csvfile,"\n",true), $delimiter) > $count) {
|
||||
if (substr_count(strstr($csvfile, "\n", true), $delimiter) > $count) {
|
||||
$count = substr_count($csvfile, $delimiter);
|
||||
$bestDelimiter = $delimiter;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return $bestDelimiter;
|
||||
}
|
||||
@ -641,8 +639,6 @@ class BaseImport
|
||||
|
||||
public function preTransform(array $data, $entity_type)
|
||||
{
|
||||
|
||||
|
||||
$keys = array_shift($data);
|
||||
ksort($keys);
|
||||
|
||||
@ -666,11 +662,10 @@ class BaseImport
|
||||
ksort($keys);
|
||||
|
||||
$data = array_map(function ($row) use ($keys) {
|
||||
|
||||
$row_count = count($row);
|
||||
$key_count = count($keys);
|
||||
|
||||
if($key_count > $row_count) {
|
||||
if ($key_count > $row_count) {
|
||||
$row = array_pad($row, $key_count, ' ');
|
||||
}
|
||||
|
||||
|
@ -68,22 +68,17 @@ class AdjustProductInventory implements ShouldQueue
|
||||
// $p->saveQuietly();
|
||||
// }
|
||||
|
||||
collect($this->invoice->line_items)->filter(function ($item){
|
||||
collect($this->invoice->line_items)->filter(function ($item) {
|
||||
return $item->type_id == '1';
|
||||
})->each(function ($i){
|
||||
|
||||
})->each(function ($i) {
|
||||
$p = Product::where('product_key', $i->product_key)->where('company_id', $this->company->id)->first();
|
||||
|
||||
if ($p) {
|
||||
|
||||
$p->in_stock_quantity += $i->quantity;
|
||||
|
||||
$p->saveQuietly();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public function handleRestoredInvoice()
|
||||
@ -112,8 +107,6 @@ class AdjustProductInventory implements ShouldQueue
|
||||
$p->saveQuietly();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function middleware()
|
||||
@ -157,12 +150,8 @@ class AdjustProductInventory implements ShouldQueue
|
||||
} elseif ($this->company->stock_notification && $p->stock_notification && $this->company->inventory_notification_threshold && $p->in_stock_quantity <= $this->company->inventory_notification_threshold) {
|
||||
$this->notifyStocklevels($p, 'company');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function existingInventoryAdjustment()
|
||||
@ -189,8 +178,6 @@ class AdjustProductInventory implements ShouldQueue
|
||||
$p->saveQuietly();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function notifyStocklevels(Product $product, string $notification_level)
|
||||
|
@ -584,8 +584,9 @@ class NinjaMailerJob implements ShouldQueue
|
||||
$guzzle = new \GuzzleHttp\Client();
|
||||
$url = 'https://login.microsoftonline.com/common/oauth2/v2.0/token';
|
||||
|
||||
if(!$user->oauth_user_refresh_token || $user->oauth_user_refresh_token == '')
|
||||
if (!$user->oauth_user_refresh_token || $user->oauth_user_refresh_token == '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$token = json_decode($guzzle->post($url, [
|
||||
'form_params' => [
|
||||
|
@ -21,8 +21,9 @@ use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Turbo124\Beacon\Facades\LightLogs;
|
||||
use Illuminate\Support\Facades\Redis;
|
||||
use Turbo124\Beacon\Facades\LightLogs;
|
||||
|
||||
class AdjustEmailQuota implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
@ -78,14 +79,11 @@ class AdjustEmailQuota implements ShouldQueue
|
||||
|
||||
$keys = $redis->keys($prefix);
|
||||
|
||||
if(is_array($keys))
|
||||
{
|
||||
if (is_array($keys)) {
|
||||
$redis->pipeline(function ($pipe) use ($keys) {
|
||||
|
||||
foreach ($keys as $key) {
|
||||
$pipe->del($key);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
$keys = null;
|
||||
@ -101,7 +99,5 @@ class AdjustEmailQuota implements ShouldQueue
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -215,7 +215,6 @@ class SendReminders implements ShouldQueue
|
||||
|
||||
EmailEntity::dispatch($invitation, $invitation->company, $template)->delay(10);
|
||||
event(new InvoiceWasEmailed($invoice->invitations->first(), $invoice->company, Ninja::eventVars(), $template));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -73,8 +73,9 @@ class EmailPayment implements ShouldQueue
|
||||
|
||||
$this->payment->load('invoices');
|
||||
|
||||
if(!$this->contact)
|
||||
if (!$this->contact) {
|
||||
$this->contact = $this->payment->client->contacts()->first();
|
||||
}
|
||||
|
||||
$this->contact->load('client');
|
||||
|
||||
|
@ -811,7 +811,7 @@ class Import implements ShouldQueue
|
||||
$modified['updated_at'] = Carbon::parse($modified['updated_at']);
|
||||
}
|
||||
|
||||
if(!array_key_exists('currency_id', $modified) || !$modified['currency_id']) {
|
||||
if (!array_key_exists('currency_id', $modified) || !$modified['currency_id']) {
|
||||
$modified['currency_id'] = $this->company->settings->currency_id;
|
||||
}
|
||||
|
||||
|
@ -11,24 +11,22 @@
|
||||
|
||||
namespace App\Jobs\Util;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Invoice;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\DataMapper\InvoiceItem;
|
||||
use App\Jobs\Entity\EmailEntity;
|
||||
use App\Models\TransactionEvent;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Jobs\Ninja\TransactionLog;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\TransactionEvent;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use App\Utils\Traits\MakesReminders;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use App\Events\Invoice\InvoiceWasEmailed;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use App\Events\Invoice\InvoiceReminderWasEmailed;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
class ReminderJob implements ShouldQueue
|
||||
{
|
||||
|
@ -12,8 +12,8 @@
|
||||
namespace App\Listeners\Payment;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||
|
||||
class PaymentBalanceActivity implements ShouldQueue
|
||||
@ -35,11 +35,9 @@ class PaymentBalanceActivity implements ShouldQueue
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
|
||||
MultiDB::setDb($event->company->db);
|
||||
|
||||
$event->payment->client->service()->updatePaymentBalance();
|
||||
|
||||
}
|
||||
|
||||
public function middleware($event): array
|
||||
|
@ -11,15 +11,13 @@
|
||||
|
||||
namespace App\Listeners\Payment;
|
||||
|
||||
use App\Models\Activity;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Activity;
|
||||
use App\Repositories\ActivityRepository;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use App\Utils\Traits\Notifications\UserNotifies;
|
||||
|
||||
class PaymentEmailedActivity implements ShouldQueue
|
||||
{
|
||||
|
||||
protected $activity_repo;
|
||||
|
||||
/**
|
||||
@ -52,6 +50,5 @@ class PaymentEmailedActivity implements ShouldQueue
|
||||
$fields->payment_id = $event->payment->id;
|
||||
|
||||
$this->activity_repo->save($fields, $event->payment, $event->event_vars);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -388,11 +388,9 @@ class PaymentEmailEngine extends BaseEmailEngine
|
||||
*/
|
||||
private function buildViewButton(string $link, string $text): string
|
||||
{
|
||||
|
||||
|
||||
if ($this->settings->email_style == 'plain') {
|
||||
return '<a href="'. $link .'" target="_blank">'. $text .'</a>';
|
||||
}
|
||||
if ($this->settings->email_style == 'plain') {
|
||||
return '<a href="'. $link .'" target="_blank">'. $text .'</a>';
|
||||
}
|
||||
|
||||
|
||||
return '
|
||||
|
@ -311,7 +311,6 @@ class Payment extends BaseModel
|
||||
$pt = new PaymentType();
|
||||
|
||||
return $pt->name($this->type_id);
|
||||
|
||||
}
|
||||
|
||||
public function gateway_type()
|
||||
|
@ -152,8 +152,9 @@ class PaymentType extends StaticModel
|
||||
|
||||
public function name($id)
|
||||
{
|
||||
if(isset($this->type_names[$id]))
|
||||
if (isset($this->type_names[$id])) {
|
||||
return ctrans("texts.".$this->type_names[$id]);
|
||||
}
|
||||
|
||||
return ctrans('texts.manual_entry');
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
|
||||
/**
|
||||
* App\Models\Product
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace App\Notifications\Ninja;
|
||||
|
||||
use App\Models\Company;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
|
@ -11,36 +11,36 @@
|
||||
|
||||
namespace App\PaymentDrivers;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Number;
|
||||
use App\Events\Invoice\InvoiceWasPaid;
|
||||
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\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\Payment;
|
||||
use App\Models\SystemLog;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\PaymentHash;
|
||||
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\Exceptions\PaymentFailed;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\Models\ClientGatewayToken;
|
||||
use Illuminate\Support\Facades\App;
|
||||
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\Models\SystemLog;
|
||||
use App\Services\Subscription\SubscriptionService;
|
||||
use App\Http\Requests\ClientPortal\Payments\PaymentResponseRequest;
|
||||
use App\Utils\Helpers;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Number;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Utils\Traits\SystemLogTrait;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* Class BaseDriver.
|
||||
@ -753,7 +753,6 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
]);
|
||||
|
||||
return sprintf('%s: %s', ctrans('texts.invoices'), \implode(', ', collect($this->payment_hash->invoices())->pluck('invoice_number')->toArray()));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,7 +140,6 @@ class CreditCard
|
||||
|
||||
try {
|
||||
$result = $this->braintree->gateway->transaction()->sale($data);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
if ($e instanceof \Braintree\Exception\Authorization) {
|
||||
$this->braintree->sendFailureMail(ctrans('texts.generic_gateway_error'));
|
||||
|
@ -12,16 +12,16 @@
|
||||
|
||||
namespace App\PaymentDrivers;
|
||||
|
||||
use App\Jobs\Util\SystemLogger;
|
||||
use App\Models\ClientGatewayToken;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Payment;
|
||||
use App\Models\SystemLog;
|
||||
use App\Utils\HtmlEngine;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\PaymentHash;
|
||||
use App\Models\PaymentType;
|
||||
use App\Jobs\Util\SystemLogger;
|
||||
use App\Models\SystemLog;
|
||||
use App\Utils\HtmlEngine;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use App\Models\ClientGatewayToken;
|
||||
|
||||
/**
|
||||
* Class CustomPaymentDriver.
|
||||
@ -97,9 +97,7 @@ class CustomPaymentDriver extends BaseDriver
|
||||
*/
|
||||
public function processPaymentResponse($request)
|
||||
{
|
||||
|
||||
if ($request->has('gateway_response')) {
|
||||
|
||||
$this->client = auth()->guard('contact')->user()->client;
|
||||
|
||||
$state = [
|
||||
@ -109,8 +107,7 @@ class CustomPaymentDriver extends BaseDriver
|
||||
|
||||
$payment_hash = PaymentHash::where('hash', $request->payment_hash)->first();
|
||||
|
||||
if($payment_hash)
|
||||
{
|
||||
if ($payment_hash) {
|
||||
$this->payment_hash = $payment_hash;
|
||||
|
||||
$payment_hash->data = array_merge((array) $payment_hash->data, $state);
|
||||
@ -122,27 +119,26 @@ class CustomPaymentDriver extends BaseDriver
|
||||
if ($gateway_response->status == 'COMPLETED') {
|
||||
$this->logSuccessfulGatewayResponse(['response' => json_decode($request->gateway_response), 'data' => $payment_hash], SystemLog::TYPE_CUSTOM);
|
||||
|
||||
$data = [
|
||||
'payment_method' => '',
|
||||
'payment_type' => PaymentType::CREDIT_CARD_OTHER,
|
||||
'amount' => $payment_hash->amount_with_fee(),
|
||||
'transaction_reference' => $gateway_response?->purchase_units[0]?->payments?->captures[0]?->id,
|
||||
'gateway_type_id' => GatewayType::PAYPAL,
|
||||
];
|
||||
$data = [
|
||||
'payment_method' => '',
|
||||
'payment_type' => PaymentType::CREDIT_CARD_OTHER,
|
||||
'amount' => $payment_hash->amount_with_fee(),
|
||||
'transaction_reference' => $gateway_response?->purchase_units[0]?->payments?->captures[0]?->id,
|
||||
'gateway_type_id' => GatewayType::PAYPAL,
|
||||
];
|
||||
|
||||
$payment = $this->createPayment($data, Payment::STATUS_COMPLETED);
|
||||
$payment = $this->createPayment($data, Payment::STATUS_COMPLETED);
|
||||
|
||||
SystemLogger::dispatch(
|
||||
['response' => $payment_hash->data->server_response, 'data' => $data],
|
||||
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||
SystemLog::EVENT_GATEWAY_SUCCESS,
|
||||
SystemLog::TYPE_STRIPE,
|
||||
$this->client,
|
||||
$this->client->company,
|
||||
);
|
||||
|
||||
return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
|
||||
SystemLogger::dispatch(
|
||||
['response' => $payment_hash->data->server_response, 'data' => $data],
|
||||
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||
SystemLog::EVENT_GATEWAY_SUCCESS,
|
||||
SystemLog::TYPE_STRIPE,
|
||||
$this->client,
|
||||
$this->client->company,
|
||||
);
|
||||
|
||||
return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ class DirectDebit implements MethodInterface
|
||||
|
||||
private function resolveScheme(string $scheme): int
|
||||
{
|
||||
match($scheme){
|
||||
match ($scheme) {
|
||||
'sepa_core' => $type = GatewayType::SEPA,
|
||||
default => $type = GatewayType::DIRECT_DEBIT,
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user