Updates for einvoicing via self host

This commit is contained in:
David Bomba 2024-11-11 16:56:04 +11:00
parent aeaca12e65
commit 03610cfcba
4 changed files with 41 additions and 0 deletions

View File

@ -24,4 +24,9 @@ class EInvoicingToken extends Model
'token', 'token',
'account_key', 'account_key',
]; ];
public function license()
{
$this->belongsTo(License::class, 'license_key', 'license_key');
}
} }

View File

@ -29,6 +29,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property int|null $product_id * @property int|null $product_id
* @property int|null $recurring_invoice_id * @property int|null $recurring_invoice_id
* @property int|null $e_invoice_quota * @property int|null $e_invoice_quota
* @property bool $is_flagged
* @property-read \App\Models\RecurringInvoice $recurring_invoice * @property-read \App\Models\RecurringInvoice $recurring_invoice
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel company() * @method static \Illuminate\Database\Eloquent\Builder|StaticModel company()
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel exclude($columns) * @method static \Illuminate\Database\Eloquent\Builder|StaticModel exclude($columns)
@ -73,6 +74,10 @@ class License extends StaticModel
public function url() public function url()
{ {
$contact = $this->recurring_invoice->client->contacts()->where('email', $this->email)->first(); $contact = $this->recurring_invoice->client->contacts()->where('email', $this->email)->first();
}
public function e_invoicing_tokens()
{
return $this->hasMany(EInvoicingToken::class, 'license_key', 'license_key');
} }
} }

View File

@ -53,6 +53,11 @@ class SendEDocument implements ShouldQueue
$model = $this->entity::find($this->id); $model = $this->entity::find($this->id);
if($model->company->account->is_flagged){
nlog("Bad Actor");
return; //Bad Actor present.
}
/** Concrete implementation current linked to Storecove only */ /** Concrete implementation current linked to Storecove only */
$p = new Peppol($model); $p = new Peppol($model);
$p->run(); $p->run();

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('licenses', function (Blueprint $table){
$table->boolean('is_flagged')->default(0);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
//
}
};