Enabled changing broadband services and adjusting invoices

This commit is contained in:
Deon George
2022-06-12 18:32:54 +10:00
parent c8162b8eb9
commit c1080481ec
8 changed files with 379 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ use App\Traits\SiteID;
* + Charge Date should not be null
* + Attributes should be a collection array
* + type should not be null
* + It would be useful, given an array of Charges to call a function that renders them into invoice format. This may provide consistence and be the single view of how charges do look on an invoice.
*/
class Charge extends Model
{
@@ -22,7 +23,9 @@ class Charge extends Model
];
protected $dates = [
'charged_at',
'start_at',
'stop_at',
'charged_at', // @todo Dont remember what this attribute is for
];
public const sweep = [
@@ -75,6 +78,6 @@ class Charge extends Model
public function getTypeNameAttribute(): string
{
return Arr::get(InvoiceItem::type,$this->attribute('type'));
return Arr::get(InvoiceItem::type,$this->type);
}
}

View File

@@ -30,7 +30,9 @@ class InvoiceItem extends Model
// Array of items that can be updated with PushNew
protected $pushable = ['taxes'];
// @todo Change these to CONSTS so it's easier to reference through out the code
public const type = [
0 => 'Service Charge',
1 => 'Hardware', // *
2 => 'Service Relocation Fee', // * Must have corresponding SERVICE_ID
3 => 'Service Change', // * Must have corresponding SERVICE_ID

View File

@@ -31,6 +31,7 @@ use App\Traits\SiteID;
* + billing_charge : Charge for this service each invoice period // @todo change to "charge"
* + billing_interval : The period that this service is billed for by default
* + billing_interval_string : The period that this service is billed for by default as a name
* + billed_to : When this service has been billed to // @todo rename all references to invoice_to
* + category : The type of service this is, eg: broadband, phone
* + contract_term : The term that this service must be active
* + contract_end : The date that the contract ends for this service
@@ -100,6 +101,7 @@ class Service extends Model implements IDs
* to see if it can proceed further if not, it'll wait here for user/admin intervention
*
* @var array
* @todo This needs an overhaul, its not implemented correctly.
*/
private const ACTION_PROGRESS = [
// Order Submitted @todo redo
@@ -256,6 +258,14 @@ class Service extends Model implements IDs
'enter_method'=>'action_request_enter_redirect',
'title'=>'Change Service',
],
'CHANGE-PENDING' => [
'next'=>[
'ACTIVE'=>['wholesaler'],
],
'enter_method'=>'action_request_enter_redirect',
'title'=>'Activate Change',
],
];
/* INTERFACES */
@@ -1221,8 +1231,8 @@ class Service extends Model implements IDs
$o->quantity = $oo->quantity;
$o->item_type = $oo->type;
$o->price_base = $oo->amount;
$o->start_at = $oo->date_charge;
$o->stop_at = $oo->date_charge;
$o->start_at = $oo->start_at;
$o->stop_at = $oo->stop_at;
$o->module_id = 30; // @todo This shouldnt be hard coded
$o->module_ref = $oo->id;
$o->site_id = 1; // @todo