Create data mapper for cached data / billing context

This commit is contained in:
Benjamin Beganović 2021-03-22 13:56:26 +01:00
parent 6e714747bd
commit d5ad6088f6
2 changed files with 48 additions and 2 deletions

View File

@ -0,0 +1,47 @@
<?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://opensource.org/licenses/AAL
*/
namespace App\DataMapper\Billing;
class BillingContextMapper
{
/**
* @var int
*/
public $billing_subscription_id;
/**
* @var string
*/
public $email;
/**
* @var int
*/
public $client_id;
/**
* @var int
*/
public $invoice_id;
/**
* @var string[]
*/
public $casts = [
'billing_subscription_id' => 'integer',
'email' => 'string',
'client_id' => 'integer',
'invoice_id' => 'integer',
];
}

View File

@ -284,8 +284,7 @@ class BillingPortalPurchase extends Component
'billing_subscription_id' => $this->billing_subscription->id,
'email' => $this->email ?? $this->contact->email,
'client_id' => $this->contact->client->id,
'invoice_id' => $this->invoice->id,
'subscription_id' => $this->billing_subscription->id],
'invoice_id' => $this->invoice->id],
now()->addMinutes(60)
);