1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

White label license server

This commit is contained in:
David Bomba 2024-02-16 18:33:45 +11:00
parent 0394d98d59
commit ceb4708b5d
3 changed files with 26 additions and 4 deletions

View File

@ -17,7 +17,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* App\Models\License
*
* @property int $id
* @property int|null $created_at
* @property \Carbon\Carbon $created_at
* @property int|null $updated_at
* @property int|null $deleted_at
* @property string|null $first_name
@ -28,6 +28,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property string|null $transaction_reference
* @property int|null $product_id
* @property int|null $recurring_invoice_id
* @property-read \App\Models\RecurringInvoice $recurring_invoice
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel company()
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel exclude($columns)
* @method static \Illuminate\Database\Eloquent\Builder|License newModelQuery()
@ -53,4 +54,24 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class License extends StaticModel
{
use SoftDeletes;
}
protected $casts = [
'created_at' => 'date',
];
public function expiry(): string
{
return $this->created_at->addYear()->format('Y-m-d');
}
public function recurring_invoice()
{
return $this->belongsTo(RecurringInvoice::class);
}
public function url()
{
$contact = $this->recurring_invoice->client->contacts()->where('email', $this->email)->first();
}
}

View File

@ -47,6 +47,7 @@ use App\Utils\Traits\SubscriptionHooker;
use Carbon\Carbon;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Support\Str;
use Illuminate\Mail\Mailables\Address;
class SubscriptionService
{
@ -208,7 +209,7 @@ class SubscriptionService
$invitation = $invoice->invitations()->first();
$email_object = new EmailObject();
$email_object->to = [$contact->email];
$email_object->to = [new Address($contact->email, $contact->present()->name())];
$email_object->subject = ctrans('texts.white_label_link') . " " .ctrans('texts.payment_subject');
$email_object->body = ctrans('texts.white_label_body', ['license_key' => $license_key]);
$email_object->client_id = $invoice->client_id;

View File

@ -4925,7 +4925,7 @@ $lang = array(
'no_assigned_tasks' => 'No billable tasks for this project',
'authorization_failure' => 'Insufficient permissions to perform this action',
'authorization_sms_failure' => 'Please verify your account to send emails.',
'white_label_body' => 'Thank you for purchasing a white label license. <br><br> Your license key is: <br><br> :license_key',
'white_label_body' => 'Thank you for purchasing a white label license. <br><br> Your license key is: <br><br> :license_key <br><br> You can manage your license here: https://invoiceninja.invoicing.co/client/login',
'payment_type_Klarna' => 'Klarna',
'payment_type_Interac E Transfer' => 'Interac E Transfer',
'xinvoice_payable' => 'Payable within :payeddue days net until :paydate',