Merge pull request #7292 from turbo124/v5-develop

v5.3.69
This commit is contained in:
David Bomba 2022-03-17 12:20:12 +11:00 committed by GitHub
commit f3a94904ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
86 changed files with 898 additions and 553 deletions

View File

@ -1 +1 @@
5.3.68
5.3.69

View File

@ -482,7 +482,7 @@ class CheckData extends Command
payments.id = paymentables.payment_id
WHERE paymentable_type = ?
AND paymentables.deleted_at is NULL
AND payments.amount > 0
AND paymentables.amount > 0
AND payments.is_deleted = 0
AND payments.client_id = ?;
"), [App\Models\Credit::class, $client->id] );

View File

@ -128,6 +128,13 @@ class EmailTemplateDefaults
return $invoice_message;
}
public static function emailInvoiceReminderTemplate()
{
$invoice_message = '<p>$client<br><br>'.self::transformText('reminder_message').'</p><div class="center">$view_button</div>';
return $invoice_message;
}
public static function emailQuoteSubject()
{
return ctrans('texts.quote_subject', ['number'=>'$number', 'account'=>'$company.name']);

View File

@ -66,7 +66,7 @@ class BaseTransaction implements TransactionInterface
$data['payment'],
$data['client'],
$data['credit'],
$data['metadata'],
['metadata' => $data['metadata']],
['event_id' => $this->event_id, 'timestamp' =>time()],
);
// return [

View File

@ -217,6 +217,12 @@ class LoginController extends BaseController
$cu = CompanyUser::query()
->where('user_id', auth()->user()->id);
$truth = app()->make(TruthSource::class);
$truth->setCompanyUser($cu->first());
$truth->setUser(auth()->user());
$truth->setCompany($user->account->default_company);
if(!$cu->exists())
return response()->json(['message' => 'User not linked to any companies'], 403);

View File

@ -101,7 +101,6 @@ class InvoiceController extends Controller
return $this->makePayment((array) $transformed_ids);
} elseif ($request->input('action') == 'download') {
return $this->downloadInvoices((array) $transformed_ids);
// return $this->downloadInvoicePDF((array) $transformed_ids);
}
return redirect()
@ -113,7 +112,7 @@ class InvoiceController extends Controller
{
$data['invoices'] = Invoice::whereIn('id', $ids)
->whereClientId(auth()->user()->client->id)
->whereClientId(auth()->guard('contact')->user()->client->id)
->withTrashed()
->get();
@ -135,7 +134,7 @@ class InvoiceController extends Controller
private function makePayment(array $ids)
{
$invoices = Invoice::whereIn('id', $ids)
->whereClientId(auth()->user()->client->id)
->whereClientId(auth()->guard('contact')->user()->client->id)
->withTrashed()
->get();
@ -172,14 +171,14 @@ class InvoiceController extends Controller
});
//format totals
$formatted_total = Number::formatMoney($total, auth()->user()->client);
$formatted_total = Number::formatMoney($total, auth()->guard('contact')->user()->client);
$payment_methods = auth()->user()->client->service()->getPaymentMethods($total);
$payment_methods = auth()->guard('contact')->user()->client->service()->getPaymentMethods($total);
//if there is only one payment method -> lets return straight to the payment page
$data = [
'settings' => auth()->user()->client->getMergedSettings(),
'settings' => auth()->guard('contact')->user()->client->getMergedSettings(),
'invoices' => $invoices,
'formatted_total' => $formatted_total,
'payment_methods' => $payment_methods,
@ -201,7 +200,7 @@ class InvoiceController extends Controller
{
$invoices = Invoice::whereIn('id', $ids)
->withTrashed()
->whereClientId(auth()->user()->client->id)
->whereClientId(auth()->guard('contact')->user()->client->id)
->get();
//generate pdf's of invoices locally
@ -212,9 +211,8 @@ class InvoiceController extends Controller
//if only 1 pdf, output to buffer for download
if ($invoices->count() == 1) {
$invoice = $invoices->first();
$invitation = $invoice->invitations->first();
$file = $invoice->service()->getInvoicePdf(auth()->user());
$file = $invoice->service()->getInvoicePdf(auth()->guard('contact')->user());
// return response()->download(file_get_contents(public_path($file)));

View File

@ -14,6 +14,7 @@ namespace App\Http\Controllers;
use App\DataMapper\Analytics\AccountDeleted;
use App\DataMapper\CompanySettings;
use App\DataMapper\DefaultSettings;
use App\Factory\CompanyFactory;
use App\Http\Requests\Company\CreateCompanyRequest;
use App\Http\Requests\Company\DefaultCompanyRequest;
use App\Http\Requests\Company\DestroyCompanyRequest;
@ -229,9 +230,13 @@ class CompanyController extends BaseController
'permissions' => '',
'settings' => null,
'notifications' => CompanySettings::notificationDefaults(),
//'settings' => DefaultSettings::userSettings(),
]);
if(auth()->user()->company()->account->companies()->where('is_large', 1)->exists())
{
$company->account->companies()->update(['is_large' => true]);
}
/*
* Required dependencies
*/
@ -417,7 +422,6 @@ class CompanyController extends BaseController
if ($request->hasFile('company_logo') || (is_array($request->input('settings')) && !array_key_exists('company_logo', $request->input('settings'))))
$this->removeLogo($company);
$company = $this->company_repo->save($request->all(), $company);
$company->saveSettings($request->input('settings'), $company);

View File

@ -8,6 +8,7 @@ use App\Http\Requests\Document\EditDocumentRequest;
use App\Http\Requests\Document\ShowDocumentRequest;
use App\Http\Requests\Document\StoreDocumentRequest;
use App\Http\Requests\Document\UpdateDocumentRequest;
use App\Jobs\Document\ZipDocuments;
use App\Models\Document;
use App\Repositories\DocumentRepository;
use App\Transformers\DocumentTransformer;
@ -173,10 +174,16 @@ class DocumentController extends BaseController
$documents = Document::withTrashed()->whereIn('id', $this->transformKeys($ids))->company()->get();
if (! $invoices) {
if (! $documents) {
return response()->json(['message' => ctrans('texts.no_documents_found')]);
}
if($action == 'download'){
ZipDocuments::dispatch($documents->pluck('id'), auth()->user()->company(), auth()->user());
return response()->json(['message' => ctrans('texts.sent_message')], 200);
}
/*
* Send the other actions to the switch
*/

View File

@ -147,7 +147,7 @@ class PreviewController extends BaseController
->build();
if (request()->query('html') == 'true') {
return $maker->getCompiledHTML;
return $maker->getCompiledHTML();
}
//if phantom js...... inject here..
@ -266,7 +266,7 @@ class PreviewController extends BaseController
DB::connection(config('database.default'))->rollBack();
if (request()->query('html') == 'true') {
return $maker->getCompiledHTML;
return $maker->getCompiledHTML();
}

View File

@ -380,7 +380,7 @@ class UserController extends BaseController
*/
public function update(UpdateUserRequest $request, User $user)
{
$old_company_user = $user->company_user();
$old_company_user = $user->company_users()->where('company_id', auth()->user()->company()->id)->first();
$old_user = json_encode($user);
$old_user_email = $user->getOriginal('email');
@ -395,14 +395,8 @@ class UserController extends BaseController
$user->save();
UserEmailChanged::dispatch($new_user, json_decode($old_user), auth()->user()->company());
}
if(
strcasecmp($old_company_user->permissions, $user->company_user()->permissions) != 0 ||
$old_company_user->is_admin != $user->company_user()->is_admin
){
$user->company_user()->update(["permissions_updated_at" => now()]);
}
$user->company_users()->update(["permissions_updated_at" => now()]);
event(new UserWasUpdated($user, auth()->user(), auth()->user()->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));

View File

@ -41,7 +41,6 @@ class QueryLogging
$timeStart = microtime(true);
DB::enableQueryLog();
$response = $next($request);
// hide requests made by debugbar
if (strstr($request->url(), '_debugbar') === false) {
@ -73,6 +72,6 @@ class QueryLogging
}
return $response;
return $next($request);
}
}

View File

@ -66,9 +66,8 @@ class StartupCheck
$this->buildTemplates();
}
$response = $next($request);
return $next($request);
return $response;
}

View File

@ -32,6 +32,7 @@ class TokenAuth
public function handle($request, Closure $next)
{
if ($request->header('X-API-TOKEN') && ($company_token = CompanyToken::with(['user', 'company', 'cu'])->where('token', $request->header('X-API-TOKEN'))->first())) {
$user = $company_token->user;
$error = [

View File

@ -0,0 +1,118 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Jobs\Document;
use App\Jobs\Entity\CreateEntityPdf;
use App\Jobs\Mail\NinjaMailerJob;
use App\Jobs\Mail\NinjaMailerObject;
use App\Jobs\Util\UnlinkFile;
use App\Libraries\MultiDB;
use App\Mail\DownloadDocuments;
use App\Mail\DownloadInvoices;
use App\Models\Company;
use App\Models\Document;
use App\Models\User;
use App\Utils\TempFile;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use ZipArchive;
class ZipDocuments implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $document_ids;
private $company;
private $user;
public $settings;
public $tries = 1;
/**
* @param $invoices
* @param Company $company
* @param $email
* @deprecated confirm to be deleted
* Create a new job instance.
*
*/
public function __construct($document_ids, Company $company, User $user)
{
$this->document_ids = $document_ids;
$this->company = $company;
$this->user = $user;
$this->settings = $company->settings;
}
/**
* Execute the job.
*
* @return void
* @throws \ZipStream\Exception\FileNotFoundException
* @throws \ZipStream\Exception\FileNotReadableException
* @throws \ZipStream\Exception\OverflowException
*/
public function handle()
{
MultiDB::setDb($this->company->db);
# create new zip object
$zipFile = new \PhpZip\ZipFile();
$file_name = date('Y-m-d').'_'.str_replace(' ', '_', trans('texts.documents')).'.zip';
$path = $this->company->file_path();
try{
$documents = Document::whereIn('id', $this->document_ids)->get();
foreach ($documents as $document) {
$zipFile->addFromString($document->name, $document->getFile());
}
Storage::put($path.$file_name, $zipFile->outputAsString());
$nmo = new NinjaMailerObject;
$nmo->mailable = new DownloadDocuments(Storage::url($path.$file_name), $this->company);
$nmo->to_user = $this->user;
$nmo->settings = $this->settings;
$nmo->company = $this->company;
NinjaMailerJob::dispatch($nmo);
UnlinkFile::dispatch(config('filesystems.default'), $path.$file_name)->delay(now()->addHours(1));
}
catch(\PhpZip\Exception\ZipException $e){
nlog("could not make zip => ". $e->getMessage());
}
finally{
$zipFile->close();
}
}
}

View File

@ -69,16 +69,5 @@ class CompanySizeCheck implements ShouldQueue
});
// Company::where('is_large', false)->cursor()->each(function ($company) {
// if ($company->invoices()->count() > 500 || $company->products()->count() > 500 || $company->clients()->count() > 500) {
// nlog("Marking company {$company->id} as large");
// $company->account->companies->update(['is_large' => true])
// }
// });
}
}

View File

@ -86,8 +86,8 @@ class TransactionLog implements ShouldQueue
*/
public function handle()
{
if(!Ninja::isHosted())
return;
// if(!Ninja::isHosted())
// return;
$this->setTransformer();

View File

@ -0,0 +1,108 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Jobs\Payment;
use App\Events\Payment\PaymentWasEmailed;
use App\Events\Payment\PaymentWasEmailedAndFailed;
use App\Jobs\Mail\NinjaMailerJob;
use App\Jobs\Mail\NinjaMailerObject;
use App\Libraries\MultiDB;
use App\Mail\Engine\PaymentEmailEngine;
use App\Mail\TemplateEmail;
use App\Models\ClientContact;
use App\Models\Company;
use App\Models\Payment;
use App\Utils\Ninja;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\App;
class EmailRefundPayment implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $payment;
public $email_builder;
private $contact;
private $company;
public $settings;
/**
* Create a new job instance.
*
* @param Payment $payment
* @param $email_builder
* @param $contact
* @param $company
*/
public function __construct(Payment $payment, Company $company, ClientContact $contact)
{
$this->payment = $payment;
$this->contact = $contact;
$this->company = $company;
$this->settings = $payment->client->getMergedSettings();
}
/**
* Execute the job.
*
*
* @return void
*/
public function handle()
{
if ($this->company->is_disabled)
return true;
if ($this->contact->email) {
MultiDB::setDb($this->company->db);
$this->payment->load('invoices');
$this->contact->load('client');
App::forgetInstance('translator');
$t = app('translator');
App::setLocale($this->contact->preferredLocale());
$t->replace(Ninja::transformTranslations($this->settings));
$template_data['body'] = ctrans('texts.refunded_payment') . ' $payment.refunded <br><br>$invoices';
$template_data['subject'] = ctrans('texts.refunded_payment');
$email_builder = (new PaymentEmailEngine($this->payment, $this->contact, $template_data))->build();
$invitation = null;
if($this->payment->invoices && $this->payment->invoices->count() >=1)
$invitation = $this->payment->invoices->first()->invitations()->first();
$nmo = new NinjaMailerObject;
$nmo->mailable = new TemplateEmail($email_builder, $this->contact, $invitation);
$nmo->to_user = $this->contact;
$nmo->settings = $this->settings;
$nmo->company = $this->company;
$nmo->entity = $this->payment;
NinjaMailerJob::dispatch($nmo);
event(new PaymentWasEmailed($this->payment, $this->payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
}
}
}

View File

@ -41,8 +41,6 @@ class InvoiceEmailFailedActivity implements ShouldQueue
*/
public function handle($event)
{
nlog("inside activity_repo");
MultiDB::setDb($event->company->db);
if(strpos($event->message, 'shared/public') !== false)

View File

@ -38,8 +38,7 @@ class InvoiceFailedEmailNotification
*/
public function handle($event)
{
nlog("inside a failed notification");
MultiDB::setDb($event->company->db);
$first_notification_sent = true;

View File

@ -58,7 +58,6 @@ class InvoicePaidActivity implements ShouldQueue
if($event->invoice->subscription()->exists())
{
nlog("subscription exists");
$event->invoice->subscription->service()->planPaid($event->invoice);
}

View File

@ -48,8 +48,6 @@ class SendVerificationNotification implements ShouldQueue
*/
public function handle($event)
{
nlog("In Send Verification Notification");
MultiDB::setDB($event->company->db);
$event->user->service()->invite($event->company);

View File

@ -12,6 +12,7 @@
namespace App\Mail\Company;
use App\Utils\Ninja;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
@ -48,6 +49,10 @@ class CompanyDeleted extends Mailable
*/
public function build()
{
App::forgetInstance('translator');
App::setLocale($this->account->default_company->getLocale());
$t = app('translator');
$t->replace(Ninja::transformTranslations($this->settings));
return $this->from(config('mail.from.address'), config('mail.from.name'))
->subject(ctrans('texts.company_deleted'))

View File

@ -0,0 +1,56 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Mail;
use App\Models\Company;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;
class DownloadDocuments extends Mailable
{
// use Queueable, SerializesModels;
public $file_path;
public $company;
public function __construct($file_path, Company $company)
{
$this->file_path = $file_path;
$this->company = $company;
}
/**
* Build the message.
*/
public function build()
{
App::setLocale($this->company->getLocale());
return $this->from(config('mail.from.address'), config('mail.from.name'))
->subject(ctrans('texts.download_files'))
->text('email.admin.download_documents_text', [
'url' => $this->file_path,
])
->view('email.admin.download_documents', [
'url' => $this->file_path,
'logo' => $this->company->present()->logo,
'whitelabel' => $this->company->account->isPaid() ? true : false,
'settings' => $this->company->settings,
'greeting' => $this->company->present()->name(),
]);
}
}

View File

@ -143,6 +143,7 @@ class PaymentEmailEngine extends BaseEmailEngine
$data['$payment.number'] = &$data['$number'];
$data['$entity'] = ['value' => '', 'label' => ctrans('texts.payment')];
$data['$payment.amount'] = ['value' => Number::formatMoney($this->payment->amount, $this->client) ?: '&nbsp;', 'label' => ctrans('texts.amount')];
$data['$payment.refunded'] = ['value' => Number::formatMoney($this->payment->refunded, $this->client) ?: '&nbsp;', 'label' => ctrans('texts.refund')];
$data['$amount'] = &$data['$payment.amount'];
$data['$payment.date'] = ['value' => $this->translateDate($this->payment->date, $this->client->date_format(), $this->client->locale()), 'label' => ctrans('texts.payment_date')];
$data['$transaction_reference'] = ['value' => $this->payment->transaction_reference, 'label' => ctrans('texts.transaction_reference')];
@ -230,12 +231,14 @@ class PaymentEmailEngine extends BaseEmailEngine
$data['$view_link'] = ['value' => '<a class="button" href="'.$this->payment->getLink().'">'.ctrans('texts.view_payment').'</a>', 'label' => ctrans('texts.view_payment')];
$data['$view_button'] = &$data['$view_link'];
$data['$viewLink'] = &$data['$view_link'];
$data['$paymentLink'] = &$data['$view_link'];
$data['$portalButton'] = ['value' => "<a href='{$this->payment->getPortalLink()}'>".ctrans('texts.login')."</a>", 'label' =>''];
$data['$portal_url'] = &$data['$portalButton'];
$data['$view_url'] = ['value' => $this->payment->getLink(), 'label' => ctrans('texts.view_payment')];
$data['$signature'] = ['value' => $this->settings->email_signature ?: '&nbsp;', 'label' => ''];
$data['$emailSignature'] = &$data['$signature'];
$data['$invoices'] = ['value' => $this->formatInvoices(), 'label' => ctrans('texts.invoices')];
$data['$invoice_references'] = ['value' => $this->formatInvoiceReferences(), 'label' => ctrans('texts.invoices')];

View File

@ -21,6 +21,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
/**
@ -189,7 +190,7 @@ class BaseModel extends Model
public function numberFormatter()
{
$number = strlen($this->number) > 1 ? $this->number : class_basename($this);
$number = strlen($this->number) >= 1 ? $this->number : class_basename($this) . "_" . Str::random(5); ;
$formatted_number = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $number);
// Remove any runs of periods (thanks falstro!)

View File

@ -153,7 +153,7 @@ class Client extends BaseModel implements HasLocalePreference
public function gateway_tokens()
{
return $this->hasMany(ClientGatewayToken::class)->orderBy('is_default', 'ASC');
return $this->hasMany(ClientGatewayToken::class)->orderBy('is_default', 'DESC');
}
public function expenses()
@ -582,149 +582,6 @@ class Client extends BaseModel implements HasLocalePreference
return 'USD';
}
/**
* Generates an array of payment urls per client
* for a given amount.
*
* The route produced will provide the
* company_gateway and payment_type ids
*
* The invoice/s will need to be injected
* upstream of this method as they are not
* included in this logic.
*
* @param float $amount The amount to be charged
* @return array Array of payment labels and urls
* @deprecated 5.0.38 - see service()->getPaymentMethods($amount);
*/
// public function getPaymentMethods($amount) :array
// {
// //this method will get all the possible gateways a client can pay with
// //but we also need to consider payment methods that are already stored
// //so we MUST filter the company gateways and remove duplicates.
// //Also need to harvest the list of client gateway tokens and present these
// //for instant payment
// $company_gateways = $this->getSetting('company_gateway_ids');
// //we need to check for "0" here as we disable a payment gateway for a client with the number "0"
// if ($company_gateways || $company_gateways == '0') {
// $transformed_ids = $this->transformKeys(explode(',', $company_gateways));
// $gateways = $this->company
// ->company_gateways
// ->whereIn('id', $transformed_ids)
// ->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
// ->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority
// return array_search($model->id, $transformed_ids);// this closure sorts for us
// });
// } else {
// $gateways = $this->company
// ->company_gateways
// ->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
// ->where('is_deleted', false);
// }
// $payment_methods = [];
// foreach ($gateways as $gateway) {
// foreach ($gateway->driver($this)->gatewayTypes() as $type) {
// if (isset($gateway->fees_and_limits) && property_exists($gateway->fees_and_limits, $type)) {
// if ($this->validGatewayForAmount($gateway->fees_and_limits->{$type}, $amount)) {
// $payment_methods[] = [$gateway->id => $type];
// }
// } else {
// $payment_methods[] = [$gateway->id => $type];
// }
// }
// }
// $payment_methods_collections = collect($payment_methods);
// //** Plucks the remaining keys into its own collection
// $payment_methods_intersect = $payment_methods_collections->intersectByKeys($payment_methods_collections->flatten(1)->unique());
// // handle custom gateways as they are not unique'd()---------------------------------------------------------
// // we need to split the query here as we allow multiple custom gateways, so we must show all of them, they query logic
// // above only pulls in unique gateway types.. ie.. we only allow 1 credit card gateway, but many custom gateways.
// if ($company_gateways || $company_gateways == '0') {
// $transformed_ids = $this->transformKeys(explode(',', $company_gateways));
// $gateways = $this->company
// ->company_gateways
// ->whereIn('id', $transformed_ids)
// ->where('gateway_key', '=', '54faab2ab6e3223dbe848b1686490baa')
// ->sortby(function ($model) use ($transformed_ids) { //company gateways are sorted in order of priority
// return array_search($model->id, $transformed_ids);// this closure sorts for us
// });
// } else {
// $gateways = $this->company
// ->company_gateways
// ->where('gateway_key', '=', '54faab2ab6e3223dbe848b1686490baa')
// ->where('is_deleted', false);
// }
// //note we have to use GatewayType::CREDIT_CARD as alias for CUSTOM
// foreach ($gateways as $gateway) {
// foreach ($gateway->driver($this)->gatewayTypes() as $type) {
// if (isset($gateway->fees_and_limits) && property_exists($gateway->fees_and_limits, $type)) {
// if ($this->validGatewayForAmount($gateway->fees_and_limits->{GatewayType::CREDIT_CARD}, $amount)) {
// $payment_methods_intersect->push([$gateway->id => $type]);
// }
// } else {
// $payment_methods_intersect->push([$gateway->id => NULL]);
// }
// }
// }
// //handle custom gateways as they are not unique'd()---------------------------------------------------------
// $payment_urls = [];
// foreach ($payment_methods_intersect as $key => $child_array) {
// foreach ($child_array as $gateway_id => $gateway_type_id) {
// $gateway = CompanyGateway::find($gateway_id);
// $fee_label = $gateway->calcGatewayFeeLabel($amount, $this);
// if(!$gateway_type_id){
// $payment_urls[] = [
// 'label' => $gateway->getConfigField('name') . $fee_label,
// 'company_gateway_id' => $gateway_id,
// 'gateway_type_id' => GatewayType::CREDIT_CARD,
// ];
// }
// else
// {
// $payment_urls[] = [
// 'label' => $gateway->getTypeAlias($gateway_type_id) . $fee_label,
// 'company_gateway_id' => $gateway_id,
// 'gateway_type_id' => $gateway_type_id,
// ];
// }
// }
// }
// if (($this->getSetting('use_credits_payment') == 'option' || $this->getSetting('use_credits_payment') == 'always') && $this->service()->getCreditBalance() > 0) {
// // Show credits as only payment option if both statements are true.
// if (
// $this->service()->getCreditBalance() > $amount
// && $this->getSetting('use_credits_payment') == 'always') {
// $payment_urls = [];
// }
// $payment_urls[] = [
// 'label' => ctrans('texts.apply_credit'),
// 'company_gateway_id' => CompanyGateway::GATEWAY_CREDIT,
// 'gateway_type_id' => GatewayType::CREDIT,
// ];
// }
// return $payment_urls;
// }
public function validGatewayForAmount($fees_and_limits_for_payment_type, $amount) :bool
{
if (isset($fees_and_limits_for_payment_type)) {

View File

@ -33,6 +33,7 @@ class Company extends BaseModel
use CompanySettingsSaver;
use ThrottlesEmail;
use AppSetup;
use \Awobaz\Compoships\Compoships;
const ENTITY_RECURRING_INVOICE = 'recurring_invoice';
const ENTITY_CREDIT = 'credit';
@ -471,7 +472,7 @@ class Company extends BaseModel
public function company_users()
{
return $this->hasMany(CompanyUser::class);
return $this->hasMany(CompanyUser::class)->withTrashed();
}
public function owner()
@ -508,6 +509,11 @@ class Company extends BaseModel
return $this->slack_webhook_url;
}
public function file_path()
{
return $this->company_key.'/';
}
public function rBits()
{
$user = $this->owner();

View File

@ -338,21 +338,44 @@ class CompanyGateway extends BaseModel
$fee = 0;
if ($fees_and_limits->fee_amount) {
$fee += $fees_and_limits->fee_amount;
}
if ($fees_and_limits->fee_percent) {
if($fees_and_limits->fee_percent == 100){ //unusual edge case if the user wishes to charge a fee of 100% 09/01/2022
$fee += $amount;
}
elseif ($fees_and_limits->adjust_fee_percent) {
$fee += round(($amount / (1 - $fees_and_limits->fee_percent / 100) - $amount), 2);
} else {
$fee += round(($amount * $fees_and_limits->fee_percent / 100), 2);
}
}
if($fees_and_limits->adjust_fee_percent)
{
$adjusted_fee = 0;
if ($fees_and_limits->fee_amount) {
$adjusted_fee += $fees_and_limits->fee_amount + $amount;
}
if ($fees_and_limits->fee_percent) {
$divisor = 1 - ($fees_and_limits->fee_percent/100);
$gross_amount = round($adjusted_fee/$divisor,2);
$fee = $gross_amount - $amount;
}
}
else
{
if ($fees_and_limits->fee_amount) {
$fee += $fees_and_limits->fee_amount;
}
if ($fees_and_limits->fee_percent) {
if($fees_and_limits->fee_percent == 100){ //unusual edge case if the user wishes to charge a fee of 100% 09/01/2022
$fee += $amount;
}
else
$fee += round(($amount * $fees_and_limits->fee_percent / 100), 2);
//elseif ($fees_and_limits->adjust_fee_percent) {
// $fee += round(($amount / (1 - $fees_and_limits->fee_percent / 100) - $amount), 2);
//} else {
//}
}
}
/* Cap fee if we have to here. */
if ($fees_and_limits->fee_cap > 0 && ($fee > $fees_and_limits->fee_cap)) {
$fee = $fees_and_limits->fee_cap;

View File

@ -17,6 +17,7 @@ class CompanyToken extends BaseModel
{
use SoftDeletes;
use Filterable;
use \Awobaz\Compoships\Compoships;
protected $fillable = [
'name',

View File

@ -17,6 +17,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class CompanyUser extends Pivot
{
use SoftDeletes;
use \Awobaz\Compoships\Compoships;
// protected $guarded = ['id'];

View File

@ -135,4 +135,9 @@ class Document extends BaseModel
{
return Storage::disk($this->disk)->path($this->url);
}
public function getFile()
{
return Storage::get($this->url);
}
}

View File

@ -228,6 +228,11 @@ class Invoice extends BaseModel
return $this->hasMany(Task::class);
}
public function task()
{
return $this->hasOne(Task::class);
}
public function expenses()
{
return $this->hasMany(Expense::class);

View File

@ -232,8 +232,6 @@ class Payment extends BaseModel
public function refund(array $data) :self
{
return $this->service()->refundPayment($data);
//return $this->processRefund($data);
}
/**

View File

@ -44,6 +44,7 @@ class User extends Authenticatable implements MustVerifyEmail
use UserSettings;
use Filterable;
use HasFactory;
use \Awobaz\Compoships\Compoships;
protected $guard = 'user';
@ -190,9 +191,7 @@ class User extends Authenticatable implements MustVerifyEmail
$truth = app()->make(TruthSource::class);
if ($this->company){
return $this->company;
}
elseif($truth->getCompany()){
return $truth->getCompany();
@ -203,9 +202,7 @@ class User extends Authenticatable implements MustVerifyEmail
return $company_token->company;
}
// return false;
throw new \Exception('No Company Found');
//return Company::find(config('ninja.company_id'));
}
public function companyIsSet()
@ -252,18 +249,19 @@ class User extends Authenticatable implements MustVerifyEmail
public function company_user()
{
// return $this->hasOneThrough(CompanyUser::class, CompanyToken::class, 'user_id', 'user_id', 'id', 'user_id')
// ->withTrashed();
if($this->companyId())
return $this->belongsTo(CompanyUser::class)->where('company_id', $this->companyId())->withTrashed();
$truth = app()->make(TruthSource::class);
if($truth->getCompanyUser()){
if($truth->getCompanyUser())
return $truth->getCompanyUser();
}
return $this->token()->cu;
// return $this->hasOneThrough(CompanyUser::class, CompanyToken::class, 'user_id', 'user_id', 'id', 'user_id')
// ->withTrashed();
}
/**

View File

@ -256,7 +256,7 @@ class AuthorizeCreditCard
$code = "Error";
$description = "There was an error processing the payment";
if ($response->getErrors() != null) {
if ($response && $response->getErrors() != null) {
$code = $response->getErrors()[0]->getErrorCode();
$description = $response->getErrors()[0]->getErrorText();
}

View File

@ -51,8 +51,8 @@ class ChargePaymentProfile
$description = "Invoices: {$invoice_numbers} for {$amount} for client {$this->authorize->client->present()->name()}";
$order = new OrderType();
$order->setInvoiceNumber($invoice_numbers);
$order->setDescription($description);
$order->setInvoiceNumber(substr($invoice_numbers,0,19));
$order->setDescription(substr($description,0,255));
$transactionRequestType = new TransactionRequestType();
$transactionRequestType->setTransactionType('authCaptureTransaction');

View File

@ -205,7 +205,7 @@ class BrowserPay implements MethodInterface
$response = ApplePayDomain::create([
'domain_name' => $domain,
]);
], $this->stripe->stripe_connect_auth);
$config->apple_pay_domain_id = $response->id;

View File

@ -107,7 +107,7 @@ class UpdatePaymentMethods
$additional_data = ['gateway_customer_reference' => $customer->id];
if($customer->default_source === $method->id)
$additional_data = ['gateway_customer_reference' => $customer->id, 'is_default', 1];
$additional_data = ['gateway_customer_reference' => $customer->id, 'is_default' => 1];
$this->stripe->storeGatewayToken($data, $additional_data);

View File

@ -169,7 +169,7 @@ class StripePaymentDriver extends BaseDriver
&& $this->client->currency()
&& ($this->client->currency()->code == 'EUR')
&& isset($this->client->country)
&& in_array($this->client->country->iso_3166_3, ['AUS', 'DNK', 'DEU', 'ITA', 'LUX', 'NOR', 'SVN', 'GBR', 'EST', 'GRC', 'JPN', 'PRT', 'ESP', 'USA', 'BEL', 'FIN'])) { // TODO: More has to be added https://stripe.com/docs/payments/sepa-debit
&& in_array($this->client->country->iso_3166_3, ['AUT', 'BEL', 'CHE', 'CYP', 'CZE', 'BGR', 'DNK', 'DEU', 'ESP', 'FIN', 'FRA', 'HUN', 'IRL', 'ITA', 'LVA', 'LUX', 'LTA', 'MLT', 'NLD', 'NOR', 'POL', 'ROU', 'SVK', 'SVN', 'SWE', 'GBR', 'EST', 'GRC', 'PRT' ])) { // TODO: More has to be added https://stripe.com/docs/payments/sepa-debit
$types[] = GatewayType::SEPA;
}

View File

@ -214,13 +214,29 @@ class ACH
public function paymentResponse($request)
{
// nlog($request->all());
$token = ClientGatewayToken::find($this->decodePrimaryKey($request->input('source')));
$token_meta = $token->meta;
if(!property_exists($token_meta, 'state') || $token_meta->state != "authorized")
return redirect()->route('client.payment_methods.verification', ['payment_method' => $token->hashed_id, 'method' => GatewayType::BANK_TRANSFER]);
if(!property_exists($token_meta, 'state') || $token_meta->state != "authorized"){
$response = $this->wepay_payment_driver->wepay->request('/payment_bank', [
'client_id' => config('ninja.wepay.client_id'),
'client_secret' => config('ninja.wepay.client_secret'),
'payment_bank_id' => $token->token,
]);
if($response->state == 'authorized')
{
$meta = $token->meta;
$meta->state = $response->state;
$token->meta = $meta;
$token->save();
}
else
return redirect()->route('client.payment_methods.verification', ['payment_method' => $token->hashed_id, 'method' => GatewayType::BANK_TRANSFER]);
}
$app_fee = (config('ninja.wepay.fee_ach_multiplier') * $this->wepay_payment_driver->payment_hash->data->amount_with_fee) + config('ninja.wepay.fee_fixed');

View File

@ -19,6 +19,7 @@ use App\Utils\TruthSource;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Queue\Events\JobProcessing;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\RateLimiter;
@ -61,17 +62,10 @@ class AppServiceProvider extends ServiceProvider
]);
}
// Queue::before(function (JobProcessing $event) {
// // \Log::info('Event Job '.$event->connectionName);
// \Log::error('Event Job '.$event->job->getJobId);
// // \Log::info('Event Job '.$event->job->payload());
// });
//! Update Posted AT
// Queue::after(function (JobProcessed $event) {
// // \Log::info('Event Job '.$event->connectionName);
// \Log::error('Event Job '.$event->job->getJobId);
// // \Log::info('Event Job '.$event->job->payload());
// });
/* Ensure we don't have stale state in jobs */
Queue::before(function (JobProcessing $event) {
App::forgetInstance('truthsource');
});
app()->instance(TruthSource::class, new TruthSource());

View File

@ -157,7 +157,6 @@ class InstantPayment
$payable_invoice_collection = collect();
foreach ($payable_invoices as $payable_invoice) {
// nlog($payable_invoice);
$payable_invoice['amount'] = Number::parseFloat($payable_invoice['amount']);

View File

@ -60,7 +60,7 @@ class AutoBillInvoice extends AbstractService
/* Mark the invoice as paid if there is no balance */
if ((int)$this->invoice->balance == 0)
return $this->invoice->service()->markPaid()->workFlow()->save();
return $this->invoice->service()->markPaid()->save();
//if the credits cover the payments, we stop here, build the payment with credits and exit early
if ($this->client->getSetting('use_credits_payment') != 'off')

View File

@ -31,6 +31,8 @@ class HandleRestore extends AbstractService
public function run()
{
$this->invoice->restore();
if (!$this->invoice->is_deleted) {
return $this->invoice;
}
@ -39,63 +41,64 @@ class HandleRestore extends AbstractService
foreach ($this->invoice->payments as $payment) {
//restore the payment record
$payment->restore();
// $payment->restore();
$this->invoice->restore();
//determine the paymentable amount before paymentable restoration
$pre_restore_amount = $payment->paymentables()
->where('paymentable_type', '=', 'invoices')
->sum(\DB::raw('amount'));
// //determine the paymentable amount before paymentable restoration
// $pre_restore_amount = $payment->paymentables()
// ->where('paymentable_type', '=', 'invoices')
// ->sum(\DB::raw('amount'));
nlog("first pre restore amount = {$pre_restore_amount}");
// nlog("first pre restore amount = {$pre_restore_amount}");
$pre_restore_amount -= $payment->paymentables()
->where('paymentable_type', '=', 'invoices')
->sum(\DB::raw('refunded'));
// $pre_restore_amount -= $payment->paymentables()
// ->where('paymentable_type', '=', 'invoices')
// ->sum(\DB::raw('refunded'));
nlog("second pre restore amount = {$pre_restore_amount}");
// nlog("second pre restore amount = {$pre_restore_amount}");
//restore the paymentables
$payment->paymentables()
->where('paymentable_type', '=', 'invoices')
->where('paymentable_id', $this->invoice->id)
->restore();
// $payment->paymentables()
// ->where('paymentable_type', '=', 'invoices')
// ->where('paymentable_id', $this->invoice->id)
// ->restore();
//determine the post restore paymentable amount (we need to increment the payment amount by the difference between pre and post)
$payment_amount = $payment->paymentables()
->where('paymentable_type', '=', 'invoices')
->sum(\DB::raw('amount'));
// $payment_amount = $payment->paymentables()
// ->where('paymentable_type', '=', 'invoices')
// ->sum(\DB::raw('amount'));
nlog("first payment_amount = {$payment_amount}");
// nlog("first payment_amount = {$payment_amount}");
$payment_amount -= $payment->paymentables()
->where('paymentable_type', '=', 'invoices')
->sum(\DB::raw('refunded'));
// $payment_amount -= $payment->paymentables()
// ->where('paymentable_type', '=', 'invoices')
// ->sum(\DB::raw('refunded'));
nlog("second payment_amount = {$payment_amount}");
// nlog("second payment_amount = {$payment_amount}");
nlog($payment->amount . " == " . $payment_amount);
// nlog($payment->amount . " == " . $payment_amount);
if ($payment->amount == $payment_amount) {
$payment->is_deleted = false;
$payment->save();
// if ($payment->amount == $payment_amount) {
// $payment->is_deleted = false;
// $payment->save();
$this->payment_total += $payment_amount;
} else {
$payment->is_deleted = false;
$payment->amount += ($payment_amount - $pre_restore_amount);
$payment->applied += ($payment_amount - $pre_restore_amount);
$payment->save();
// $this->payment_total += $payment_amount;
// } else {
// $payment->is_deleted = false;
// $payment->amount += ($payment_amount - $pre_restore_amount);
// $payment->applied += ($payment_amount - $pre_restore_amount);
// $payment->save();
$this->payment_total += ($payment_amount - $pre_restore_amount);
}
// $this->payment_total += ($payment_amount - $pre_restore_amount);
// }
}
//adjust ledger balance
$this->invoice->ledger()->updateInvoiceBalance($this->invoice->balance, "Restored invoice {$this->invoice->number}")->save();
//adjust paid to dates
$this->invoice->client->service()->updatePaidToDate($this->payment_total)->save();
// $this->invoice->client->service()->updatePaidToDate($this->payment_total)->save();
$this->invoice->client->service()->updateBalance($this->invoice->balance)->save();
@ -104,6 +107,9 @@ nlog("second payment_amount = {$payment_amount}");
$this->windBackInvoiceNumber();
$this->invoice->is_deleted = false;
$this->invoice->save();
return $this->invoice;
}

View File

@ -72,14 +72,21 @@ class MarkInvoiceDeleted extends AbstractService
private function adjustPaidToDate()
{
$this->invoice->client->service()->updatePaidToDate($this->adjustment_amount * -1)->save(); //reduces the paid to date by the payment totals
$client = $this->invoice->client->fresh();
$client->paid_to_date += $this->adjustment_amount * -1;
$client->save();
// $this->invoice->client->service()->updatePaidToDate($this->adjustment_amount * -1)->save(); //reduces the paid to date by the payment totals
return $this;
}
private function adjustBalance()
{
$this->invoice->client->service()->updateBalance($this->balance_adjustment * -1)->save(); //reduces the client balance by the invoice amount.
$client = $this->invoice->client->fresh();
$client->balance += $this->balance_adjustment * -1;
$client->save();
// $this->invoice->client->service()->updateBalance($this->balance_adjustment * -1)->save(); //reduces the client balance by the invoice amount.
return $this;
}

View File

@ -96,6 +96,11 @@ class MarkPaid extends AbstractService
$payment->ledger()
->updatePaymentBalance($payment->amount * -1);
// $client = $this->invoice->client->fresh();
// $client->paid_to_date += $payment->amount;
// $client->balance += $payment->amount * -1;
// $client->save();
$this->invoice
->client
->service()
@ -103,10 +108,10 @@ class MarkPaid extends AbstractService
->updatePaidToDate($payment->amount)
->save();
$this->invoice
->service()
->workFlow()
->save();
$this->invoice = $this->invoice
->service()
->workFlow()
->save();
/* Update Invoice balance */
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));

View File

@ -90,6 +90,8 @@ class DeletePayment
if(!$paymentable_invoice->is_deleted)
{
$paymentable_invoice->restore();
$paymentable_invoice->service()
->updateBalance($net_deletable)
->updatePaidToDate($net_deletable * -1)
@ -112,6 +114,8 @@ class DeletePayment
}
else {
$paymentable_invoice->restore();
//If the invoice is deleted we only update the meta data on the invoice
//and reduce the clients paid to date
$paymentable_invoice->service()
@ -134,8 +138,10 @@ class DeletePayment
});
}
$this->payment
->client
$client = $this->payment->client->fresh();
$client
->service()
->updatePaidToDate(($this->payment->amount - $this->payment->refunded)*-1)
->save();
@ -143,7 +149,7 @@ class DeletePayment
$transaction = [
'invoice' => [],
'payment' => [],
'client' => $this->payment->client->transaction_event(),
'client' => $client->transaction_event(),
'credit' => [],
'metadata' => [],
];
@ -161,8 +167,8 @@ class DeletePayment
$multiplier = 1;
if($paymentable_credit->pivot->amount < 0)
$multiplier = -1;
if($paymentable_credit->pivot->amount < 0)
$multiplier = -1;
$paymentable_credit->service()
->updateBalance($paymentable_credit->pivot->amount*$multiplier*-1)
@ -170,18 +176,13 @@ class DeletePayment
->setStatus(Credit::STATUS_SENT)
->save();
$this->payment
->client
->service()
->updatePaidToDate(($paymentable_credit->pivot->amount)*-1)
->save();
$client = $this->payment->client->fresh();
$client
->service()
->updatePaidToDate(($paymentable_credit->pivot->amount)*-1)
->save();
//01-03-2022
// $paymentable_credit->service()
// ->updateBalance($paymentable_credit->pivot->amount*$multiplier)
// ->updatePaidToDate($paymentable_credit->pivot->amount*-1)
// ->setStatus(Credit::STATUS_SENT)
// ->save();
});
}

View File

@ -15,6 +15,7 @@ use App\Exceptions\PaymentRefundFailed;
use App\Factory\CreditFactory;
use App\Factory\InvoiceItemFactory;
use App\Jobs\Ninja\TransactionLog;
use App\Jobs\Payment\EmailRefundPayment;
use App\Models\Activity;
use App\Models\Credit;
use App\Models\Invoice;
@ -64,6 +65,14 @@ class RefundPayment
->processGatewayRefund() //process the gateway refund if needed
->save();
if(array_key_exists('email_receipt', $this->refund_data) && $this->refund_data['email_receipt'] == 'true'){
$contact = $this->payment->client->contacts()->whereNotNull('email')->first();
EmailRefundPayment::dispatch($this->payment, $this->payment->company, $contact);
}
$transaction = [
'invoice' => [],
'payment' => $this->payment->transaction_event(),

View File

@ -645,8 +645,8 @@ class Design extends BaseDesign
if ($this->type === self::STATEMENT) {
return [
['element' => 'div', 'properties' => ['style' => 'display: flex; flex-direction: column;'], 'elements' => [
['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: flex; align-items: flex-start;'], 'elements' => [
['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']],
['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: block; align-items: flex-start; page-break-inside: avoid; visible !important;'], 'elements' => [
['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'overflow: visible !important; display: block; page-break-inside: avoid; height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']],
]],
]],
];
@ -667,8 +667,8 @@ class Design extends BaseDesign
['element' => 'span', 'content' => strtr(str_replace("labels", "", $_variables['values']['$entity.terms']), $_variables['labels']), 'properties' => ['data-ref' => 'total_table-terms', 'style' => 'text-align: left;']],
]],
['element' => 'img', 'properties' => ['style' => 'max-width: 50%; height: auto;', 'src' => '$contact.signature', 'id' => 'contact-signature']],
['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: flex; align-items: flex-start;'], 'elements' => [
['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']],
['element' => 'div', 'properties' => ['style' => 'margin-top: 1.5rem; display: block; align-items: flex-start; page-break-inside: avoid; visible !important;'], 'elements' => [
['element' => 'img', 'properties' => ['src' => '$invoiceninja.whitelabel', 'style' => 'overflow: visible !important; display: block; page-break-inside: avoid; height: 2.5rem;', 'hidden' => $this->entity->user->account->isPaid() ? 'true' : 'false', 'id' => 'invoiceninja-whitelabel-logo']],
]],
]],
['element' => 'div', 'properties' => ['class' => 'totals-table-right-side', 'dir' => '$dir'], 'elements' => []],

View File

@ -379,7 +379,7 @@ document.addEventListener('DOMContentLoaded', function() {
'allow_unsafe_links' => false,
]);
return $converter->convertToHtml($markdown);
return $converter->convert($markdown);
}
// public function processMarkdownOnLineItems(array &$items): void

View File

@ -95,7 +95,7 @@ trait PdfMakerUtilities
if (array_key_exists('process_markdown', $this->data) && array_key_exists('content', $child) && $this->data['process_markdown']) {
$child['content'] = str_replace("<br>", "\r", $child['content']);
$child['content'] = $this->commonmark->convertToHtml($child['content'] ?? '');
$child['content'] = $this->commonmark->convert($child['content'] ?? '');
}
}

View File

@ -16,7 +16,6 @@ use App\Models\Company;
use App\Models\CompanyToken;
use App\Models\CompanyUser;
use App\Models\User;
use App\Utils\TruthSource;
class CompanyUserTransformer extends EntityTransformer
{
@ -80,12 +79,7 @@ class CompanyUserTransformer extends EntityTransformer
public function includeToken(CompanyUser $company_user)
{
$truth = app()->make(TruthSource::class);
if($truth->getCompanyToken())
$token = $truth->getCompanyToken();
else
$token = $company_user->tokens->where('company_id', $company_user->company_id)->where('user_id', $company_user->user_id)->first();
$token = $company_user->tokens->where('company_id', $company_user->company_id)->where('user_id', $company_user->user_id)->first();
$transformer = new CompanyTokenTransformer($this->serializer);

View File

@ -541,7 +541,6 @@ class HtmlEngine
$data['$payments'] = ['value' => $payment_list, 'label' => ctrans('texts.payments')];
}
$arrKeysLength = array_map('strlen', array_keys($data));
array_multisort($arrKeysLength, SORT_DESC, $data);

View File

@ -180,12 +180,12 @@ class SystemHealth
$result = ['success' => false];
if ($request && !config('ninja.preconfigured_install')) {
config(['database.connections.db-ninja-01.host' => $request->input('db_host')]);
config(['database.connections.db-ninja-01.port' => $request->input('db_port')]);
config(['database.connections.db-ninja-01.database' => $request->input('db_database')]);
config(['database.connections.db-ninja-01.username' => $request->input('db_username')]);
config(['database.connections.db-ninja-01.password' => $request->input('db_password')]);
config(['database.default' => 'db-ninja-01']);
config(['database.connections.mysql.host' => $request->input('db_host')]);
config(['database.connections.mysql.port' => $request->input('db_port')]);
config(['database.connections.mysql.database' => $request->input('db_database')]);
config(['database.connections.mysql.username' => $request->input('db_username')]);
config(['database.connections.mysql.password' => $request->input('db_password')]);
config(['database.default' => 'mysql']);
DB::purge('db-ninja-01');
}

View File

@ -90,7 +90,6 @@ class TemplateEngine
if (strlen($this->entity) > 1 && strlen($this->entity_id) > 1) {
$class = 'App\Models\\'.ucfirst($this->entity);
$this->entity_obj = $class::withTrashed()->where('id', $this->decodePrimaryKey($this->entity_id))->company()->first();
nlog("the entity id = ".$this->entity_obj->id);
} else {
$this->mockEntity();
}
@ -168,7 +167,7 @@ class TemplateEngine
'allow_unsafe_links' => false,
]);
$this->body = $converter->convertToHtml($this->body);
$this->body = $converter->convert($this->body);
}
private function entityValues($contact)

View File

@ -305,18 +305,18 @@ trait MakesInvoiceValues
// 08-02-2022 - fix for regression below
// $data[$key][$table_type.'.quantity'] = Number::formatValue($item->quantity, $this->client->currency());
$data[$key][$table_type.'.quantity'] = Number::formatValueNoTrailingZeroes($item->quantity, $this->client->currency());
$data[$key][$table_type.'.quantity'] = ($item->quantity == 0) ? '' : Number::formatValueNoTrailingZeroes($item->quantity, $this->client->currency());
$data[$key][$table_type.'.unit_cost'] = Number::formatMoneyNoRounding($item->cost, $this->client);
$data[$key][$table_type.'.unit_cost'] = ($item->cost == 0) ? '' : Number::formatMoneyNoRounding($item->cost, $this->client);
$data[$key][$table_type.'.cost'] = Number::formatMoney($item->cost, $this->client);
$data[$key][$table_type.'.cost'] = ($item->cost == 0) ? '' : Number::formatMoney($item->cost, $this->client);
$data[$key][$table_type.'.line_total'] = Number::formatMoney($item->line_total, $this->client);
$data[$key][$table_type.'.line_total'] = ($item->line_total == 0) ? '' :Number::formatMoney($item->line_total, $this->client);
if(property_exists($item, 'gross_line_total'))
$data[$key][$table_type.'.gross_line_total'] = Number::formatMoney($item->gross_line_total, $this->client);
$data[$key][$table_type.'.gross_line_total'] = ($item->gross_line_total == 0) ? '' :Number::formatMoney($item->gross_line_total, $this->client);
else
$data[$key][$table_type.'.gross_line_total'] = 0;
$data[$key][$table_type.'.gross_line_total'] = '';
if (isset($item->discount) && $item->discount > 0) {
if ($item->is_amount_discount) {

View File

@ -81,7 +81,7 @@ trait PaymentEmailBuilder
'allow_unsafe_links' => false,
]);
$data = $converter->convertToHtml($data);
$data = $converter->convert($data);
}
return $data;

View File

@ -89,7 +89,7 @@ trait QuoteEmailBuilder
'allow_unsafe_links' => true,
]);
$data = $converter->convertToHtml($data);
$data = $converter->convert($data);
}
return $data;

View File

@ -33,6 +33,7 @@
"afosto/yaac": "^1.4",
"asm/php-ansible": "^3",
"authorizenet/authorizenet": "^2.0",
"awobaz/compoships": "^2.1",
"bacon/bacon-qr-code": "^2.0",
"beganovich/snappdf": "^1.7",
"braintree/braintree_php": "^6.0",
@ -68,7 +69,7 @@
"livewire/livewire": "^2.6",
"mollie/mollie-api-php": "^2.36",
"nelexa/zip": "^4.0",
"nwidart/laravel-modules": "^8.0",
"nwidart/laravel-modules": "8.3",
"omnipay/paypal": "^3.0",
"payfast/payfast-php-sdk": "^1.1",
"pragmarx/google2fa": "^8.0",

326
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f92ff75d01d04fc5c6105ad78b57476b",
"content-hash": "757a9ac77c2ab087200bef004b00c6e1",
"packages": [
{
"name": "afosto/yaac",
@ -110,16 +110,16 @@
},
{
"name": "apimatic/unirest-php",
"version": "2.1.0",
"version": "2.2.1",
"source": {
"type": "git",
"url": "https://github.com/apimatic/unirest-php.git",
"reference": "e07351d5f70b445664e2dc4042bbc237ec7d4c93"
"reference": "847149c56d850081c07d5677e9647fa0c15e595f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/apimatic/unirest-php/zipball/e07351d5f70b445664e2dc4042bbc237ec7d4c93",
"reference": "e07351d5f70b445664e2dc4042bbc237ec7d4c93",
"url": "https://api.github.com/repos/apimatic/unirest-php/zipball/847149c56d850081c07d5677e9647fa0c15e595f",
"reference": "847149c56d850081c07d5677e9647fa0c15e595f",
"shasum": ""
},
"require": {
@ -168,9 +168,9 @@
"support": {
"email": "opensource@apimatic.io",
"issues": "https://github.com/apimatic/unirest-php/issues",
"source": "https://github.com/apimatic/unirest-php/tree/2.1.0"
"source": "https://github.com/apimatic/unirest-php/tree/2.2.1"
},
"time": "2021-11-12T05:20:21+00:00"
"time": "2022-03-12T08:37:06+00:00"
},
{
"name": "asm/php-ansible",
@ -322,6 +322,66 @@
},
"time": "2021-03-31T18:22:14+00:00"
},
{
"name": "awobaz/compoships",
"version": "2.1.3",
"source": {
"type": "git",
"url": "https://github.com/topclaudy/compoships.git",
"reference": "c5b107f16a2a8650fb2dbc21babd4a65a0f48585"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/topclaudy/compoships/zipball/c5b107f16a2a8650fb2dbc21babd4a65a0f48585",
"reference": "c5b107f16a2a8650fb2dbc21babd4a65a0f48585",
"shasum": ""
},
"require": {
"illuminate/database": ">=5.6 <10.0"
},
"require-dev": {
"ext-sqlite3": "*"
},
"suggest": {
"awobaz/blade-active": "Blade directives for the Laravel 'Active' package",
"awobaz/eloquent-auto-append": "Automatically append accessors to model serialization",
"awobaz/eloquent-mutators": "Reusable mutators (getters/setters) for Laravel 5's Eloquent",
"awobaz/syntactic": "Syntactic sugar for named and indexed parameters call."
},
"type": "library",
"autoload": {
"psr-4": {
"Awobaz\\Compoships\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Claudin J. Daniel",
"email": "cdaniel@awobaz.com"
}
],
"description": "Laravel relationships with support for composite/multiple keys",
"keywords": [
"laravel",
"laravel composite keys",
"laravel relationships"
],
"support": {
"issues": "https://github.com/topclaudy/compoships/issues",
"source": "https://github.com/topclaudy/compoships/tree/2.1.3"
},
"funding": [
{
"url": "https://paypal.me/awobaz",
"type": "custom"
}
],
"time": "2021-11-29T22:11:22+00:00"
},
{
"name": "aws/aws-crt-php",
"version": "v1.0.2",
@ -374,16 +434,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.212.2",
"version": "3.213.0",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "dd2ff1ca2d7c37bfb7c3fed24cb8ad8bad604ec5"
"reference": "61875282d6ec1c441ca0af94fc00a5f516db12ef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/dd2ff1ca2d7c37bfb7c3fed24cb8ad8bad604ec5",
"reference": "dd2ff1ca2d7c37bfb7c3fed24cb8ad8bad604ec5",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/61875282d6ec1c441ca0af94fc00a5f516db12ef",
"reference": "61875282d6ec1c441ca0af94fc00a5f516db12ef",
"shasum": ""
},
"require": {
@ -459,22 +519,22 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.212.2"
"source": "https://github.com/aws/aws-sdk-php/tree/3.213.0"
},
"time": "2022-03-04T19:27:01+00:00"
"time": "2022-03-14T18:26:52+00:00"
},
{
"name": "bacon/bacon-qr-code",
"version": "2.0.6",
"version": "2.0.7",
"source": {
"type": "git",
"url": "https://github.com/Bacon/BaconQrCode.git",
"reference": "0069435e2a01a57193b25790f105a5d3168653c1"
"reference": "d70c840f68657ce49094b8d91f9ee0cc07fbf66c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/0069435e2a01a57193b25790f105a5d3168653c1",
"reference": "0069435e2a01a57193b25790f105a5d3168653c1",
"url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/d70c840f68657ce49094b8d91f9ee0cc07fbf66c",
"reference": "d70c840f68657ce49094b8d91f9ee0cc07fbf66c",
"shasum": ""
},
"require": {
@ -513,9 +573,9 @@
"homepage": "https://github.com/Bacon/BaconQrCode",
"support": {
"issues": "https://github.com/Bacon/BaconQrCode/issues",
"source": "https://github.com/Bacon/BaconQrCode/tree/2.0.6"
"source": "https://github.com/Bacon/BaconQrCode/tree/2.0.7"
},
"time": "2022-02-04T20:16:05+00:00"
"time": "2022-03-14T02:02:36+00:00"
},
{
"name": "beganovich/snappdf",
@ -1340,16 +1400,16 @@
},
{
"name": "composer/semver",
"version": "3.2.9",
"version": "3.3.0",
"source": {
"type": "git",
"url": "https://github.com/composer/semver.git",
"reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649"
"reference": "f79c90ad4e9b41ac4dfc5d77bf398cf61fbd718b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/semver/zipball/a951f614bd64dcd26137bc9b7b2637ddcfc57649",
"reference": "a951f614bd64dcd26137bc9b7b2637ddcfc57649",
"url": "https://api.github.com/repos/composer/semver/zipball/f79c90ad4e9b41ac4dfc5d77bf398cf61fbd718b",
"reference": "f79c90ad4e9b41ac4dfc5d77bf398cf61fbd718b",
"shasum": ""
},
"require": {
@ -1401,7 +1461,7 @@
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/semver/issues",
"source": "https://github.com/composer/semver/tree/3.2.9"
"source": "https://github.com/composer/semver/tree/3.3.0"
},
"funding": [
{
@ -1417,7 +1477,7 @@
"type": "tidelift"
}
],
"time": "2022-02-04T13:58:43+00:00"
"time": "2022-03-15T08:35:57+00:00"
},
{
"name": "composer/spdx-licenses",
@ -1788,16 +1848,16 @@
},
{
"name": "doctrine/dbal",
"version": "3.3.2",
"version": "3.3.3",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "35eae239ef515d55ebb24e9d4715cad09a4f58ed"
"reference": "82331b861727c15b1f457ef05a8729e508e7ead5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/35eae239ef515d55ebb24e9d4715cad09a4f58ed",
"reference": "35eae239ef515d55ebb24e9d4715cad09a4f58ed",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/82331b861727c15b1f457ef05a8729e508e7ead5",
"reference": "82331b861727c15b1f457ef05a8729e508e7ead5",
"shasum": ""
},
"require": {
@ -1812,14 +1872,14 @@
"require-dev": {
"doctrine/coding-standard": "9.0.0",
"jetbrains/phpstorm-stubs": "2021.1",
"phpstan/phpstan": "1.4.0",
"phpstan/phpstan": "1.4.6",
"phpstan/phpstan-strict-rules": "^1.1",
"phpunit/phpunit": "9.5.11",
"phpunit/phpunit": "9.5.16",
"psalm/plugin-phpunit": "0.16.1",
"squizlabs/php_codesniffer": "3.6.2",
"symfony/cache": "^5.2|^6.0",
"symfony/console": "^2.7|^3.0|^4.0|^5.0|^6.0",
"vimeo/psalm": "4.16.1"
"vimeo/psalm": "4.22.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
@ -1879,7 +1939,7 @@
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/3.3.2"
"source": "https://github.com/doctrine/dbal/tree/3.3.3"
},
"funding": [
{
@ -1895,7 +1955,7 @@
"type": "tidelift"
}
],
"time": "2022-02-05T16:33:45+00:00"
"time": "2022-03-09T15:39:50+00:00"
},
{
"name": "doctrine/deprecations",
@ -2336,12 +2396,12 @@
"source": {
"type": "git",
"url": "https://github.com/eWAYPayment/eway-rapid-php.git",
"reference": "a3be37ad46f14038fb2c87d94ec9d8ad8560842a"
"reference": "5581c8279774aabe58ea3aca9bfd7f62759ce7cd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/eWAYPayment/eway-rapid-php/zipball/a3be37ad46f14038fb2c87d94ec9d8ad8560842a",
"reference": "a3be37ad46f14038fb2c87d94ec9d8ad8560842a",
"url": "https://api.github.com/repos/eWAYPayment/eway-rapid-php/zipball/5581c8279774aabe58ea3aca9bfd7f62759ce7cd",
"reference": "5581c8279774aabe58ea3aca9bfd7f62759ce7cd",
"shasum": ""
},
"require": {
@ -2384,7 +2444,7 @@
"issues": "https://github.com/eWAYPayment/eway-rapid-php/issues",
"source": "https://github.com/eWAYPayment/eway-rapid-php/tree/v1.4.0"
},
"time": "2021-11-25T11:39:45+00:00"
"time": "2021-12-08T00:21:16+00:00"
},
{
"name": "fakerphp/faker",
@ -2775,16 +2835,16 @@
},
{
"name": "google/apiclient-services",
"version": "v0.237.0",
"version": "v0.239.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-api-php-client-services.git",
"reference": "c10652adc29b4242237075acde318e83f88ab918"
"reference": "ce8e34d618bdef9e824fd1728d505a468818712c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/c10652adc29b4242237075acde318e83f88ab918",
"reference": "c10652adc29b4242237075acde318e83f88ab918",
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/ce8e34d618bdef9e824fd1728d505a468818712c",
"reference": "ce8e34d618bdef9e824fd1728d505a468818712c",
"shasum": ""
},
"require": {
@ -2813,9 +2873,9 @@
],
"support": {
"issues": "https://github.com/googleapis/google-api-php-client-services/issues",
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.237.0"
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.239.0"
},
"time": "2022-02-23T22:58:02+00:00"
"time": "2022-03-13T01:20:35+00:00"
},
{
"name": "google/auth",
@ -3881,16 +3941,16 @@
},
{
"name": "laravel/framework",
"version": "v8.83.3",
"version": "v8.83.4",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "b4ed222a188cca74ca9062296e525d26ae54a0ce"
"reference": "97a549f1a83cfb32dab1eecab4c4d40a984a72b5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/b4ed222a188cca74ca9062296e525d26ae54a0ce",
"reference": "b4ed222a188cca74ca9062296e525d26ae54a0ce",
"url": "https://api.github.com/repos/laravel/framework/zipball/97a549f1a83cfb32dab1eecab4c4d40a984a72b5",
"reference": "97a549f1a83cfb32dab1eecab4c4d40a984a72b5",
"shasum": ""
},
"require": {
@ -4050,7 +4110,7 @@
"issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework"
},
"time": "2022-03-03T15:14:29+00:00"
"time": "2022-03-08T16:12:54+00:00"
},
{
"name": "laravel/serializable-closure",
@ -5351,16 +5411,16 @@
},
{
"name": "monolog/monolog",
"version": "2.3.5",
"version": "2.4.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "fd4380d6fc37626e2f799f29d91195040137eba9"
"reference": "d7fd7450628561ba697b7097d86db72662f54aef"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd4380d6fc37626e2f799f29d91195040137eba9",
"reference": "fd4380d6fc37626e2f799f29d91195040137eba9",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/d7fd7450628561ba697b7097d86db72662f54aef",
"reference": "d7fd7450628561ba697b7097d86db72662f54aef",
"shasum": ""
},
"require": {
@ -5382,7 +5442,7 @@
"phpstan/phpstan": "^0.12.91",
"phpunit/phpunit": "^8.5",
"predis/predis": "^1.1",
"rollbar/rollbar": "^1.3",
"rollbar/rollbar": "^1.3 || ^2 || ^3",
"ruflin/elastica": ">=0.90@dev",
"swiftmailer/swiftmailer": "^5.3|^6.0"
},
@ -5434,7 +5494,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.3.5"
"source": "https://github.com/Seldaek/monolog/tree/2.4.0"
},
"funding": [
{
@ -5446,7 +5506,7 @@
"type": "tidelift"
}
],
"time": "2021-10-01T21:08:31+00:00"
"time": "2022-03-14T12:44:37+00:00"
},
{
"name": "mtdowling/jmespath.php",
@ -7889,16 +7949,16 @@
},
{
"name": "razorpay/razorpay",
"version": "2.8.1",
"version": "v2.8.2",
"source": {
"type": "git",
"url": "https://github.com/razorpay/razorpay-php.git",
"reference": "4ad7b6a5bd9896305858ec0a861f66020e39f628"
"reference": "f36ad5ec74522d2930ffad3b160dddc454e42f4d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/razorpay/razorpay-php/zipball/4ad7b6a5bd9896305858ec0a861f66020e39f628",
"reference": "4ad7b6a5bd9896305858ec0a861f66020e39f628",
"url": "https://api.github.com/repos/razorpay/razorpay-php/zipball/f36ad5ec74522d2930ffad3b160dddc454e42f4d",
"reference": "f36ad5ec74522d2930ffad3b160dddc454e42f4d",
"shasum": ""
},
"require": {
@ -7947,7 +8007,7 @@
"issues": "https://github.com/Razorpay/razorpay-php/issues",
"source": "https://github.com/Razorpay/razorpay-php"
},
"time": "2021-11-08T11:13:39+00:00"
"time": "2022-03-08T13:36:42+00:00"
},
{
"name": "react/promise",
@ -8379,16 +8439,16 @@
},
{
"name": "sentry/sentry",
"version": "3.3.7",
"version": "3.4.0",
"source": {
"type": "git",
"url": "https://github.com/getsentry/sentry-php.git",
"reference": "32e5415803ff0349ccb5e5b5e77b016320762786"
"reference": "a92443883df6a55cbe7a062f76949f23dda66772"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/32e5415803ff0349ccb5e5b5e77b016320762786",
"reference": "32e5415803ff0349ccb5e5b5e77b016320762786",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/a92443883df6a55cbe7a062f76949f23dda66772",
"reference": "a92443883df6a55cbe7a062f76949f23dda66772",
"shasum": ""
},
"require": {
@ -8400,7 +8460,7 @@
"php": "^7.2|^8.0",
"php-http/async-client-implementation": "^1.0",
"php-http/client-common": "^1.5|^2.0",
"php-http/discovery": "^1.6.1",
"php-http/discovery": "^1.11",
"php-http/httplug": "^1.1|^2.0",
"php-http/message": "^1.5",
"psr/http-factory": "^1.0",
@ -8434,7 +8494,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.3.x-dev"
"dev-master": "3.4.x-dev"
}
},
"autoload": {
@ -8468,7 +8528,7 @@
],
"support": {
"issues": "https://github.com/getsentry/sentry-php/issues",
"source": "https://github.com/getsentry/sentry-php/tree/3.3.7"
"source": "https://github.com/getsentry/sentry-php/tree/3.4.0"
},
"funding": [
{
@ -8480,7 +8540,7 @@
"type": "custom"
}
],
"time": "2022-01-19T08:46:27+00:00"
"time": "2022-03-13T12:38:01+00:00"
},
{
"name": "sentry/sentry-laravel",
@ -9235,16 +9295,16 @@
},
{
"name": "symfony/filesystem",
"version": "v5.4.5",
"version": "v5.4.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "797680071ea8f71b94eb958680c50d0e002638f5"
"reference": "d53a45039974952af7f7ebc461ccdd4295e29440"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/797680071ea8f71b94eb958680c50d0e002638f5",
"reference": "797680071ea8f71b94eb958680c50d0e002638f5",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/d53a45039974952af7f7ebc461ccdd4295e29440",
"reference": "d53a45039974952af7f7ebc461ccdd4295e29440",
"shasum": ""
},
"require": {
@ -9279,7 +9339,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v5.4.5"
"source": "https://github.com/symfony/filesystem/tree/v5.4.6"
},
"funding": [
{
@ -9295,7 +9355,7 @@
"type": "tidelift"
}
],
"time": "2022-02-27T10:31:47+00:00"
"time": "2022-03-02T12:42:23+00:00"
},
{
"name": "symfony/finder",
@ -9527,16 +9587,16 @@
},
{
"name": "symfony/http-foundation",
"version": "v5.4.5",
"version": "v5.4.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "dd68a3b24262a902bc338fc7c9a2a61b7ab2029f"
"reference": "34e89bc147633c0f9dd6caaaf56da3b806a21465"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/dd68a3b24262a902bc338fc7c9a2a61b7ab2029f",
"reference": "dd68a3b24262a902bc338fc7c9a2a61b7ab2029f",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/34e89bc147633c0f9dd6caaaf56da3b806a21465",
"reference": "34e89bc147633c0f9dd6caaaf56da3b806a21465",
"shasum": ""
},
"require": {
@ -9580,7 +9640,7 @@
"description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-foundation/tree/v5.4.5"
"source": "https://github.com/symfony/http-foundation/tree/v5.4.6"
},
"funding": [
{
@ -9596,20 +9656,20 @@
"type": "tidelift"
}
],
"time": "2022-02-21T15:00:19+00:00"
"time": "2022-03-05T21:03:43+00:00"
},
{
"name": "symfony/http-kernel",
"version": "v5.4.5",
"version": "v5.4.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "c770c90bc71f1db911e2d996c991fdafe273ac84"
"reference": "d41f29ae9af1b5f40c7ebcddf09082953229411d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/c770c90bc71f1db911e2d996c991fdafe273ac84",
"reference": "c770c90bc71f1db911e2d996c991fdafe273ac84",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/d41f29ae9af1b5f40c7ebcddf09082953229411d",
"reference": "d41f29ae9af1b5f40c7ebcddf09082953229411d",
"shasum": ""
},
"require": {
@ -9692,7 +9752,7 @@
"description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-kernel/tree/v5.4.5"
"source": "https://github.com/symfony/http-kernel/tree/v5.4.6"
},
"funding": [
{
@ -9708,7 +9768,7 @@
"type": "tidelift"
}
],
"time": "2022-02-28T07:57:55+00:00"
"time": "2022-03-05T21:14:51+00:00"
},
{
"name": "symfony/mime",
@ -11172,16 +11232,16 @@
},
{
"name": "symfony/translation",
"version": "v5.4.5",
"version": "v5.4.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "7e4d52d39e5d86f3f04bef46fa29a1091786bc73"
"reference": "a7ca9fdfffb0174209440c2ffa1dee228e15d95b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/7e4d52d39e5d86f3f04bef46fa29a1091786bc73",
"reference": "7e4d52d39e5d86f3f04bef46fa29a1091786bc73",
"url": "https://api.github.com/repos/symfony/translation/zipball/a7ca9fdfffb0174209440c2ffa1dee228e15d95b",
"reference": "a7ca9fdfffb0174209440c2ffa1dee228e15d95b",
"shasum": ""
},
"require": {
@ -11249,7 +11309,7 @@
"description": "Provides tools to internationalize your application",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/translation/tree/v5.4.5"
"source": "https://github.com/symfony/translation/tree/v5.4.6"
},
"funding": [
{
@ -11265,7 +11325,7 @@
"type": "tidelift"
}
],
"time": "2022-02-09T15:49:12+00:00"
"time": "2022-03-02T12:56:28+00:00"
},
{
"name": "symfony/translation-contracts",
@ -11347,16 +11407,16 @@
},
{
"name": "symfony/var-dumper",
"version": "v5.4.5",
"version": "v5.4.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "6efddb1cf6af5270b21c48c6103e81f920c220f0"
"reference": "294e9da6e2e0dd404e983daa5aa74253d92c05d0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/6efddb1cf6af5270b21c48c6103e81f920c220f0",
"reference": "6efddb1cf6af5270b21c48c6103e81f920c220f0",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/294e9da6e2e0dd404e983daa5aa74253d92c05d0",
"reference": "294e9da6e2e0dd404e983daa5aa74253d92c05d0",
"shasum": ""
},
"require": {
@ -11416,7 +11476,7 @@
"dump"
],
"support": {
"source": "https://github.com/symfony/var-dumper/tree/v5.4.5"
"source": "https://github.com/symfony/var-dumper/tree/v5.4.6"
},
"funding": [
{
@ -11432,7 +11492,7 @@
"type": "tidelift"
}
],
"time": "2022-02-21T15:00:19+00:00"
"time": "2022-03-02T12:42:23+00:00"
},
{
"name": "tijsverkoyen/css-to-inline-styles",
@ -13817,16 +13877,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.14",
"version": "9.2.15",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "9f4d60b6afe5546421462b76cd4e633ebc364ab4"
"reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f4d60b6afe5546421462b76cd4e633ebc364ab4",
"reference": "9f4d60b6afe5546421462b76cd4e633ebc364ab4",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2e9da11878c4202f97915c1cb4bb1ca318a63f5f",
"reference": "2e9da11878c4202f97915c1cb4bb1ca318a63f5f",
"shasum": ""
},
"require": {
@ -13882,7 +13942,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.14"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.15"
},
"funding": [
{
@ -13890,7 +13950,7 @@
"type": "github"
}
],
"time": "2022-02-28T12:38:02+00:00"
"time": "2022-03-07T09:28:20+00:00"
},
{
"name": "phpunit/php-file-iterator",
@ -14135,16 +14195,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.16",
"version": "9.5.19",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc"
"reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5ff8c545a50226c569310a35f4fa89d79f1ddfdc",
"reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/35ea4b7f3acabb26f4bb640f8c30866c401da807",
"reference": "35ea4b7f3acabb26f4bb640f8c30866c401da807",
"shasum": ""
},
"require": {
@ -14174,7 +14234,7 @@
"sebastian/global-state": "^5.0.1",
"sebastian/object-enumerator": "^4.0.3",
"sebastian/resource-operations": "^3.0.3",
"sebastian/type": "^2.3.4",
"sebastian/type": "^3.0",
"sebastian/version": "^3.0.2"
},
"require-dev": {
@ -14222,7 +14282,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.16"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.19"
},
"funding": [
{
@ -14234,7 +14294,7 @@
"type": "github"
}
],
"time": "2022-02-23T17:10:58+00:00"
"time": "2022-03-15T09:57:31+00:00"
},
{
"name": "sebastian/cli-parser",
@ -15093,28 +15153,28 @@
},
{
"name": "sebastian/type",
"version": "2.3.4",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/type.git",
"reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914"
"reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914",
"reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad",
"reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
"phpunit/phpunit": "^9.5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
"dev-master": "3.0-dev"
}
},
"autoload": {
@ -15137,7 +15197,7 @@
"homepage": "https://github.com/sebastianbergmann/type",
"support": {
"issues": "https://github.com/sebastianbergmann/type/issues",
"source": "https://github.com/sebastianbergmann/type/tree/2.3.4"
"source": "https://github.com/sebastianbergmann/type/tree/3.0.0"
},
"funding": [
{
@ -15145,7 +15205,7 @@
"type": "github"
}
],
"time": "2021-06-15T12:49:02+00:00"
"time": "2022-03-15T09:54:48+00:00"
},
{
"name": "sebastian/version",
@ -15202,16 +15262,16 @@
},
{
"name": "swagger-api/swagger-ui",
"version": "v4.6.1",
"version": "v4.6.2",
"source": {
"type": "git",
"url": "https://github.com/swagger-api/swagger-ui.git",
"reference": "1dd3ef62adfd79c9a71cd046ff2b7c7bbabf2751"
"reference": "d191c1ca18443a77273e9912ac2603ce1f7dc216"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/1dd3ef62adfd79c9a71cd046ff2b7c7bbabf2751",
"reference": "1dd3ef62adfd79c9a71cd046ff2b7c7bbabf2751",
"url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/d191c1ca18443a77273e9912ac2603ce1f7dc216",
"reference": "d191c1ca18443a77273e9912ac2603ce1f7dc216",
"shasum": ""
},
"type": "library",
@ -15257,9 +15317,9 @@
],
"support": {
"issues": "https://github.com/swagger-api/swagger-ui/issues",
"source": "https://github.com/swagger-api/swagger-ui/tree/v4.6.1"
"source": "https://github.com/swagger-api/swagger-ui/tree/v4.6.2"
},
"time": "2022-03-02T21:44:06+00:00"
"time": "2022-03-10T11:36:38+00:00"
},
{
"name": "symfony/debug",
@ -15586,16 +15646,16 @@
},
{
"name": "zircote/swagger-php",
"version": "4.2.10",
"version": "4.2.11",
"source": {
"type": "git",
"url": "https://github.com/zircote/swagger-php.git",
"reference": "7263e95f5fff5524a697e2a75ceb6f9902453d01"
"reference": "1c7a04e381b07e14aae080a61e02f2fe9cdea424"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/7263e95f5fff5524a697e2a75ceb6f9902453d01",
"reference": "7263e95f5fff5524a697e2a75ceb6f9902453d01",
"url": "https://api.github.com/repos/zircote/swagger-php/zipball/1c7a04e381b07e14aae080a61e02f2fe9cdea424",
"reference": "1c7a04e381b07e14aae080a61e02f2fe9cdea424",
"shasum": ""
},
"require": {
@ -15655,9 +15715,9 @@
],
"support": {
"issues": "https://github.com/zircote/swagger-php/issues",
"source": "https://github.com/zircote/swagger-php/tree/4.2.10"
"source": "https://github.com/zircote/swagger-php/tree/4.2.11"
},
"time": "2022-03-04T01:21:38+00:00"
"time": "2022-03-06T19:16:21+00:00"
}
],
"aliases": [],
@ -15677,5 +15737,5 @@
"platform-dev": {
"php": "^7.3|^7.4|^8.0"
},
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.0.0"
}

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.3.68',
'app_tag' => '5.3.68',
'app_version' => '5.3.69',
'app_tag' => '5.3.69',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

2
public/css/app.css vendored

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/*! For license information please see stripe-browserpay.js.LICENSE.txt */
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.clientSecret=null===(e=document.querySelector("meta[name=stripe-pi-client-secret]"))||void 0===e?void 0:e.content}var n,r,o;return n=t,(r=[{key:"init",value:function(){var e,t,n={};return document.querySelector("meta[name=stripe-account-id]")&&(n.apiVersion="2020-08-27",n.stripeAccount=null===(t=document.querySelector("meta[name=stripe-account-id]"))||void 0===t?void 0:t.content),this.stripe=Stripe(null===(e=document.querySelector("meta[name=stripe-publishable-key]"))||void 0===e?void 0:e.content,n),this.elements=this.stripe.elements(),this}},{key:"createPaymentRequest",value:function(){return this.paymentRequest=this.stripe.paymentRequest(JSON.parse(document.querySelector("meta[name=payment-request-data").content)),this}},{key:"createPaymentRequestButton",value:function(){this.paymentRequestButton=this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest})}},{key:"handlePaymentRequestEvents",value:function(e,t){document.querySelector("#errors").hidden=!0,this.paymentRequest.on("paymentmethod",(function(n){e.confirmCardPayment(t,{payment_method:n.paymentMethod.id},{handleActions:!1}).then((function(r){r.error?(n.complete("fail"),document.querySelector("#errors").innerText=r.error.message,document.querySelector("#errors").hidden=!1):(n.complete("success"),"requires_action"===r.paymentIntent.status?e.confirmCardPayment(t).then((function(e){e.error?(n.complete("fail"),document.querySelector("#errors").innerText=e.error.message,document.querySelector("#errors").hidden=!1):(document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent),document.getElementById("server-response").submit())})):(document.querySelector('input[name="gateway_response"]').value=JSON.stringify(r.paymentIntent),document.getElementById("server-response").submit()))}))}))}},{key:"handle",value:function(){var e=this;this.init().createPaymentRequest().createPaymentRequestButton(),this.paymentRequest.canMakePayment().then((function(t){var n;if(t)return e.paymentRequestButton.mount("#payment-request-button");document.querySelector("#errors").innerHTML=JSON.parse(null===(n=document.querySelector("meta[name=no-available-methods]"))||void 0===n?void 0:n.content),document.querySelector("#errors").hidden=!1})),this.handlePaymentRequestEvents(this.stripe,this.clientSecret)}}])&&e(n.prototype,r),o&&e(n,o),t}())).handle()})();
(()=>{function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.clientSecret=null===(e=document.querySelector("meta[name=stripe-pi-client-secret]"))||void 0===e?void 0:e.content}var n,r,o;return n=t,(r=[{key:"init",value:function(){var e,t,n={};return document.querySelector("meta[name=stripe-account-id]")&&(n.apiVersion="2020-08-27",n.stripeAccount=null===(t=document.querySelector("meta[name=stripe-account-id]"))||void 0===t?void 0:t.content),this.stripe=Stripe(null===(e=document.querySelector("meta[name=stripe-publishable-key]"))||void 0===e?void 0:e.content,n),this.elements=this.stripe.elements(),this}},{key:"createPaymentRequest",value:function(){return this.paymentRequest=this.stripe.paymentRequest(JSON.parse(document.querySelector("meta[name=payment-request-data").content)),this}},{key:"createPaymentRequestButton",value:function(){this.paymentRequestButton=this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest})}},{key:"handlePaymentRequestEvents",value:function(e,t){document.querySelector("#errors").hidden=!0,this.paymentRequest.on("paymentmethod",(function(n){e.confirmCardPayment(t,{payment_method:n.paymentMethod.id},{handleActions:!1}).then((function(r){r.error?(document.querySelector("#errors").innerText=r.error.message,document.querySelector("#errors").hidden=!1,n.complete("fail")):(n.complete("success"),"requires_action"===r.paymentIntent.status?e.confirmCardPayment(t).then((function(e){e.error?(n.complete("fail"),document.querySelector("#errors").innerText=e.error.message,document.querySelector("#errors").hidden=!1):(document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent),document.getElementById("server-response").submit())})):(document.querySelector('input[name="gateway_response"]').value=JSON.stringify(r.paymentIntent),document.getElementById("server-response").submit()))}))}))}},{key:"handle",value:function(){var e=this;this.init().createPaymentRequest().createPaymentRequestButton(),this.paymentRequest.canMakePayment().then((function(t){var n;if(t)return e.paymentRequestButton.mount("#payment-request-button");document.querySelector("#errors").innerHTML=JSON.parse(null===(n=document.querySelector("meta[name=no-available-methods]"))||void 0===n?void 0:n.content),document.querySelector("#errors").hidden=!1})),this.handlePaymentRequestEvents(this.stripe,this.clientSecret)}}])&&e(n.prototype,r),o&&e(n,o),t}())).handle()})();

View File

@ -36,9 +36,9 @@
"/js/clients/payments/stripe-eps.js": "/js/clients/payments/stripe-eps.js?id=6bed81ba3f73a695de95",
"/js/clients/payments/stripe-ideal.js": "/js/clients/payments/stripe-ideal.js?id=188426574f27660936e2",
"/js/clients/payments/stripe-przelewy24.js": "/js/clients/payments/stripe-przelewy24.js?id=e240b907ad163cac04c0",
"/js/clients/payments/stripe-browserpay.js": "/js/clients/payments/stripe-browserpay.js?id=71e49866d66a6d85b88a",
"/js/clients/payments/stripe-browserpay.js": "/js/clients/payments/stripe-browserpay.js?id=1e6e12709a43473e4406",
"/js/clients/payments/stripe-fpx.js": "/js/clients/payments/stripe-fpx.js?id=765874308d4374726b25",
"/css/app.css": "/css/app.css?id=3e08340d820da80e900b",
"/css/app.css": "/css/app.css?id=1347051cc03a8dd2a17c",
"/css/card-js.min.css": "/css/card-js.min.css?id=62afeb675235451543ad",
"/vendor/clipboard.min.js": "/vendor/clipboard.min.js?id=ad98572d415d2f245284"
}

View File

@ -68,12 +68,12 @@ class StripeBrowserPay {
)
.then(function (confirmResult) {
if (confirmResult.error) {
ev.complete('fail');
document.querySelector('#errors').innerText =
confirmResult.error.message;
document.querySelector('#errors').hidden = false;
ev.complete('fail');
} else {
ev.complete('success');

View File

@ -4279,7 +4279,7 @@ $LANG = array(
'company_import_failure_subject' => 'Error importing :company',
'company_import_failure_body' => 'There was an error importing the company data, the error message was:',
'recurring_invoice_due_date' => 'Due Date',
'amount_cents' => 'Amount in pennies,pence or cents',
'amount_cents' => 'Amount in pennies,pence or cents. ie for $0.10 please enter 10',
'default_payment_method_label' => 'Default Payment Method',
'default_payment_method' => 'Make this your preferred way of paying.',
'already_default_payment_method' => 'This is your preferred way of paying.',
@ -4568,7 +4568,8 @@ $LANG = array(
'small' => 'Small',
'quotes_backup_subject' => 'Your quotes are ready for download',
'credits_backup_subject' => 'Your credits are ready for download',
'document_download_subject' => 'Your documents are ready for download',
'reminder_message' => 'Reminder for invoice :number for :balance',
);
return $LANG;

View File

@ -0,0 +1,10 @@
@component('email.template.admin', ['logo' => $logo, 'settings' => $settings])
<div class="center">
<h1>{{ ctrans('texts.document_download_subject') }}</h1>
<p>{{ ctrans('texts.download_timeframe') }}</p>
<a target="_blank" class="button" href="{{ $url }}">
{{ ctrans('texts.download') }}
</a>
</div>
@endcomponent

View File

@ -0,0 +1,5 @@
{!! ctrans('texts.invoices_backup_subject') !!}
{!! ctrans('texts.download_timeframe') !!}
{!! $url !!}

View File

@ -1,4 +1,4 @@
{!! ctrans('texts.invoices_backup_subject') !!}
{!! ctrans('texts.document_download_subject') !!}
{!! ctrans('texts.download_timeframe') !!}

View File

@ -22,43 +22,33 @@
color-scheme: light dark;
supported-color-schemes: light dark;
}
@if(isset($settings) && $settings->email_style === 'dark')
body {
background-color: #1a1a1a !important;
color: #ffffff !important;
}
div, tr, td {
border-color: #222222 !important;
}
h1, h2, h3, p, td {
color: #ffffff !important;
}
p {
color: #bbbbbc !important;
}
.dark-bg-base {
background-color: #222222 !important;
}
.dark-bg {
background-color: #3a3a3c !important;
}
.dark-text-white p {
color: #ffffff !important;
}
hr {
border-color: #474849 !important;
}
@endif
/** Content-specific styles. **/
#content .button {
display: inline-block;
@ -72,7 +62,6 @@
font-weight: 600;
margin-bottom: 30px;
}
#content h1 {
font-family: 'canada-type-gibson', 'roboto', Arial, Helvetica, sans-serif;
font-weight: 600;
@ -80,17 +69,14 @@
margin-top: 20px;
margin-bottom: 30px;
}
#content > p {
font-size: 16px;
font-family: 'roboto', Arial, Helvetica, sans-serif;
font-weight: 500;
}
#content .center {
text-align: center;
}
#content .left {
text-align: left !important;
}
@ -185,4 +171,4 @@
</table>
</body>
</html>
</html>

View File

@ -53,7 +53,7 @@
#header, #header-spacer {
height: 160px;
padding: 3rem;
margin-bottom: 3rem;
margin-bottom: 1rem;
}
.company-logo {
height: 100%;
@ -232,7 +232,7 @@
#footer, #footer-spacer {
height: 160px;
padding: 1rem 3rem;
margin-top: 3rem;
margin-top: 1rem;
}
[data-ref="total_table-footer"] {

View File

@ -16,7 +16,10 @@
}
@page {
margin: $global_margin;
margin-left: $global_margin;
margin-right: $global_margin;
margin-top: 0;
margin-bottom: 0;
size: $page_size $page_layout;
}
@ -96,7 +99,7 @@
}
[data-ref="table"] {
margin-top: 3.5rem;
margin-top: 0.5rem;
/* margin-bottom: 200px; */
min-width: 100%;
table-layout: fixed;
@ -153,10 +156,6 @@
font-weight: bold !important;
}
#table-totals {
page-break-inside: avoid;
}
#table-totals > *:last-child {
border-bottom-left-radius: 1rem;
border-bottom-right-radius: 1rem;
@ -171,6 +170,8 @@
padding-top: 0.5rem;
padding-bottom: 0.8rem;
margin-right: .5rem;
page-break-inside:auto;
overflow: visible !important;
}
#table-totals .totals-table-right-side>* {
@ -349,7 +350,7 @@
$entity_images
<div class="repeating-footer" id="footer">
<div class="repeating-footerx" id="footer">
<p data-ref="total_table-footer">$entity_footer</p>

View File

@ -16,7 +16,10 @@
}
@page {
margin: $global_margin;
margin-left: $global_margin;
margin-right: $global_margin;
margin-bottom: 0;
margin-top: 0;
size: $page_size $page_layout;
}
@ -91,7 +94,7 @@
}
[data-ref="table"] {
margin-top: 3rem;
margin-top: 1rem;
/* margin-bottom: 200px; */
min-width: 100%;
table-layout: fixed;
@ -138,16 +141,14 @@
}
#table-totals {
page-break-inside: avoid;
}
#table-totals {
margin-top: 1rem;
margin-top: 0rem;
display: grid;
grid-template-columns: 2fr 1fr;
padding-top: .5rem;
padding-right: 1rem;
gap: 80px;
page-break-inside:auto;
overflow: visible !important;
}
#table-totals .totals-table-right-side > * {
@ -316,7 +317,7 @@
$entity_images
<div class="repeating-footer" id="footer">
<div class="repeating-footerx" id="footer">
<p data-ref="total_table-footer">$entity_footer</p>

View File

@ -16,7 +16,10 @@
}
@page {
margin: $global_margin;
margin-left: $global_margin;
margin-right: $global_margin;
margin-top: 0;
margin-bottom: 0;
size: $page_size $page_layout;
}
@ -61,7 +64,7 @@
.entity-label-wrapper {
display: grid;
grid-template-columns: 2fr 1fr;
margin-top: 3rem;
margin-top: 1rem;
}
.entity-label-wrapper .entity-label > * {
@ -130,16 +133,14 @@
}
#table-totals {
page-break-inside: avoid;
}
#table-totals {
margin-top: 1rem;
margin-top: 0rem;
display: grid;
grid-template-columns: 2fr 1fr;
padding-top: 1rem;
margin-right: .75rem;
gap: 80px;
page-break-inside:auto;
overflow: visible !important;
}
#table-totals .totals-table-right-side>* {
@ -306,7 +307,7 @@
$entity_images
<div class="repeating-footer" id="footer">
<div class="repeating-footerx" id="footer">
<p data-ref="total_table-footer">$entity_footer</p>

View File

@ -43,7 +43,7 @@
.client-entity-wrapper {
display: flex;
margin-top: 3rem;
margin-top: 1rem;
gap: 20px;
margin-left: 10px;
line-height: var(--line-height);
@ -133,17 +133,15 @@
}
#table-totals {
page-break-inside: avoid;
}
#table-totals {
margin-top: 1rem;
margin-top: 0.5rem;
display: grid;
grid-template-columns: 2fr 1fr;
padding-top: 0.5rem;
padding-left: 1rem;
margin-right: .75rem;
gap: 80px;
page-break-inside:auto;
overflow: visible !important;
}
#table-totals .totals-table-right-side>* {
@ -316,7 +314,7 @@
$entity_images
<div class="repeating-footer" id="footer">
<div class="repeating-footerx" id="footer">
<p data-ref="total_table-footer">$entity_footer</p>
<script>

View File

@ -140,10 +140,6 @@
text-align: right;
}
#table-totals {
page-break-inside: avoid;
}
#table-totals {
margin-top: 1rem;
display: grid;
@ -151,6 +147,8 @@
padding-top: 0.5rem;
margin-right: .75rem;
gap: 80px;
page-break-inside:auto;
overflow: visible !important;
}
#table-totals .totals-table-right-side>* {
@ -231,7 +229,7 @@
.repeating-header-space, **/
.repeating-footer,
.repeating-footer-space {
height: 160px;
height: 0;
}
.repeating-header {
position: fixed;
@ -357,7 +355,7 @@
$entity_images
<div class="repeating-footer" id="footer">
<div class="repeating-footerx" id="footer">
<p data-ref="total_table-footer">$entity_footer</p>
<script>

View File

@ -106,10 +106,6 @@
text-align: right;
}
#table-totals {
page-break-inside: avoid;
}
#table-totals {
margin-top: 0rem;
display: grid;
@ -118,6 +114,8 @@
padding-left: 1rem;
margin-right: .75rem;
gap: 80px;
page-break-inside:auto;
overflow: visible !important;
}
#table-totals .totals-table-right-side>* {
@ -290,7 +288,7 @@
$entity_images
<div class="repeating-footer" id="footer">
<div class="repeating-footerx" id="footer">
<p data-ref="total_table-footer">$entity_footer</p>
<script>

View File

@ -11,7 +11,7 @@
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: $font_name, Helvetica, sans-serif;
font-size: $font_size;
font-size: "$font_size";
zoom: 80%;
}
@ -102,7 +102,7 @@
[data-ref="table"] {
padding-left: 3rem;
padding-right: 3rem;
margin-top: 3rem;
margin-top: 1rem;
/* margin-bottom: 200px; */
min-width: 100%;
table-layout: fixed;
@ -154,10 +154,6 @@
text-align: right;
}
#table-totals {
page-break-inside: avoid;
}
#table-totals {
margin-top: 1rem;
display: grid;
@ -166,6 +162,8 @@
padding-left: 3rem;
padding-right: 3rem;
margin-right: .75rem;
page-break-inside:auto;
overflow: visible !important;
}
#table-totals .totals-table-right-side>* {

View File

@ -1,4 +1,4 @@
@if ($entity->documents->count() > 0 || $entity->company->documents->count() > 0 || ($entity->expense && $entity->expense->invoice_documents))
@if ($entity->documents->count() > 0 || $entity->company->documents->count() > 0 || ($entity->expense && $entity->expense->invoice_documents) || ($entity->task && $entity->company->invoice_task_documents))
<div class="bg-white shadow sm:rounded-lg my-4">
<div class="px-4 py-5 sm:p-6">
<div class="sm:flex sm:items-start sm:justify-between">
@ -62,6 +62,27 @@
</div>
@endforeach
@endif
@if($entity->task && $entity->company->invoice_task_documents)
@foreach ($entity->task->documents as $document)
<div class="inline-flex items-center space-x-1">
<a href="{{ route('client.documents.show', $document->hashed_id) }}" target="_blank"
class="block text-sm button-link text-primary">{{ Illuminate\Support\Str::limit($document->name, 40) }}</a>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
class="text-primary h-6 w-4">
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
<polyline points="15 3 21 3 21 9"></polyline>
<line x1="10" y1="14" x2="21" y2="3"></line>
</svg>
@if (!$loop->last)
<span>&mdash;</span>
@endif
</div>
@endforeach
@endif
</div>
</div>
</div>

View File

@ -57,8 +57,7 @@
{{ $payment->translateDate($payment->date, $payment->client->date_format(), $payment->client->locale()) }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
{{ $payment->translatedType(); }}
{{ $payment->translatedType() }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm leading-5 text-gray-500">
{!! \App\Utils\Number::formatMoney($payment->amount, $payment->client) !!}

View File

@ -11,7 +11,7 @@
<input type="hidden" name="source" value="{{ $token->token }}">
@component('portal.ninja2020.components.general.card-element', ['title' => '#1 ' . ctrans('texts.amount_cents')])
<input type="text" name="transactions[]" class="w-full input" required dusk="verification-1st" value="{{ old('transactions.0') }}">
<input type="number" pattern="[0-9]" min="1" step="1" name="transactions[]" class="w-full input" required dusk="verification-1st" value="{{ old('transactions.0') }}">
@error('transactions.0')
<div class="validation validation-fail">
@ -21,7 +21,7 @@
@endcomponent
@component('portal.ninja2020.components.general.card-element', ['title' => '#2 ' . ctrans('texts.amount_cents')])
<input type="text" name="transactions[]" class="w-full input" required dusk="verification-2nd" value="{{ old('transactions.1') }}">
<input type="number" pattern="[0-9]" min="1" step="1" name="transactions[]" class="w-full input" required dusk="verification-2nd" value="{{ old('transactions.1') }}">
@error('transactions.1')
<div class="validation validation-fail">

View File

@ -326,6 +326,7 @@ class CompanyGatewayApiTest extends TestCase
$fee = new FeesAndLimits;
$fee->fee_amount = 0;
$fee->fee_percent = 100;
$fee->adjust_fee_percent = false;
// $fee->fee_tax_name1 = 'GST';
// $fee->fee_tax_rate1 = '10.0';

View File

@ -66,7 +66,7 @@ class CompanyGatewayResolutionTest extends TestCase
$data[1]['fee_tax_rate2'] = 10;
$data[1]['fee_tax_name3'] = 'GST';
$data[1]['fee_tax_rate3'] = 10;
$data[1]['adjust_fee_percent'] = true;
$data[1]['adjust_fee_percent'] = false;
$data[1]['fee_cap'] = 0;
$data[1]['is_enabled'] = true;
@ -80,7 +80,7 @@ class CompanyGatewayResolutionTest extends TestCase
$data[2]['fee_tax_rate2'] = 10;
$data[2]['fee_tax_name3'] = 'GST';
$data[2]['fee_tax_rate3'] = 10;
$data[2]['adjust_fee_percent'] = true;
$data[2]['adjust_fee_percent'] = false;
$data[2]['fee_cap'] = 0;
$data[2]['is_enabled'] = true;
@ -186,4 +186,58 @@ class CompanyGatewayResolutionTest extends TestCase
$this->assertEquals(2, count($this->client->service()->getPaymentMethods($amount)));
}
public function testEnableFeeAdjustment()
{
$data = [];
$data[1]['min_limit'] = -1;
$data[1]['max_limit'] = -1;
$data[1]['fee_amount'] = 0.3;
$data[1]['fee_percent'] = 1.75;
$data[1]['fee_tax_name1'] = '';
$data[1]['fee_tax_rate1'] = 0;
$data[1]['fee_tax_name2'] = '';
$data[1]['fee_tax_rate2'] = 0;
$data[1]['fee_tax_name3'] = '';
$data[1]['fee_tax_rate3'] = 0;
$data[1]['adjust_fee_percent'] = true;
$data[1]['fee_cap'] = 0;
$data[1]['is_enabled'] = true;
$data[2]['min_limit'] = -1;
$data[2]['max_limit'] = -1;
$data[2]['fee_amount'] = 0.30;
$data[2]['fee_percent'] = 1.75;
$data[2]['fee_tax_name1'] = '';
$data[2]['fee_tax_rate1'] = 0;
$data[2]['fee_tax_name2'] = '';
$data[2]['fee_tax_rate2'] = 0;
$data[2]['fee_tax_name3'] = '';
$data[2]['fee_tax_rate3'] = 0;
$data[2]['adjust_fee_percent'] = true;
$data[2]['fee_cap'] = 0;
$data[2]['is_enabled'] = true;
//disable ach here
$json_config = json_decode(config('ninja.testvars.stripe'));
$this->cg = new CompanyGateway;
$this->cg->company_id = $this->company->id;
$this->cg->user_id = $this->user->id;
$this->cg->gateway_key = 'd14dd26a37cecc30fdd65700bfb55b23';
$this->cg->require_cvv = true;
$this->cg->require_billing_address = true;
$this->cg->require_shipping_address = true;
$this->cg->update_details = true;
$this->cg->config = encrypt(json_encode($json_config));
$this->cg->fees_and_limits = $data;
$this->cg->save();
$fee = $this->cg->calcGatewayFee(89, GatewayType::CREDIT_CARD, false);
$this->assertEquals(1.89, $fee);
}
}

View File

@ -127,7 +127,7 @@ class CompanyGatewayTest extends TestCase
$data[1]['fee_tax_rate2'] = 0;
$data[1]['fee_tax_name3'] = '';
$data[1]['fee_tax_rate3'] = 0;
$data[1]['adjust_fee_percent'] = true;
$data[1]['adjust_fee_percent'] = false;
$data[1]['fee_cap'] = 0;
$data[1]['is_enabled'] = true;
@ -166,7 +166,7 @@ class CompanyGatewayTest extends TestCase
$data[1]['fee_tax_rate2'] = 10;
$data[1]['fee_tax_name3'] = 'GST';
$data[1]['fee_tax_rate3'] = 10;
$data[1]['adjust_fee_percent'] = true;
$data[1]['adjust_fee_percent'] = false;
$data[1]['fee_cap'] = 0;
$data[1]['is_enabled'] = true;

View File

@ -436,11 +436,11 @@ class DeleteInvoiceTest extends TestCase
$this->assertFalse((bool)$invoice_one->is_deleted);
$this->assertNull($invoice_one->deleted_at);
$payment = $payment->fresh();
// $payment = $payment->fresh();
$this->assertEquals(40, $payment->fresh()->applied);
$this->assertEquals(40, $payment->fresh()->amount);
$this->assertEquals(40, $client->fresh()->paid_to_date);
// $this->assertEquals(40, $payment->fresh()->applied);
// $this->assertEquals(40, $payment->fresh()->amount);
// $this->assertEquals(40, $client->fresh()->paid_to_date);
}

View File

@ -175,7 +175,7 @@ class LoginTest extends TestCase
$this->assertTrue($user->companies !== null);
$this->assertTrue($user->company_users !== null);
$this->assertTrue($user->company_users->first() !== null);
$this->assertTrue($user->company_user()->account !== null);
$this->assertTrue($user->account !== null);
$this->assertEquals($user->email, 'test@example.com');
$this->assertTrue(\Hash::check('123456', $user->password));