mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-12 14:12:44 +01:00
Refactor SubscriptionPlanSwitch class and add handleRff method
This commit is contained in:
parent
735cc552af
commit
3dfe5db4fd
@ -44,7 +44,7 @@ class SubscriptionPlanSwitch extends Component
|
|||||||
/**
|
/**
|
||||||
* @var ClientContact
|
* @var ClientContact
|
||||||
*/
|
*/
|
||||||
public $contact;
|
public ClientContact $contact;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
@ -66,6 +66,7 @@ class SubscriptionPlanSwitch extends Component
|
|||||||
'invoice' => null,
|
'invoice' => null,
|
||||||
'company_gateway_id' => null,
|
'company_gateway_id' => null,
|
||||||
'payment_method_id' => null,
|
'payment_method_id' => null,
|
||||||
|
'show_rff' => false,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,6 +76,12 @@ class SubscriptionPlanSwitch extends Component
|
|||||||
|
|
||||||
public $company;
|
public $company;
|
||||||
|
|
||||||
|
public ?string $first_name;
|
||||||
|
|
||||||
|
public ?string $last_name;
|
||||||
|
|
||||||
|
public ?string $email;
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
MultiDB::setDb($this->company->db);
|
MultiDB::setDb($this->company->db);
|
||||||
@ -84,6 +91,31 @@ class SubscriptionPlanSwitch extends Component
|
|||||||
$this->methods = $this->contact->client->service()->getPaymentMethods($this->amount);
|
$this->methods = $this->contact->client->service()->getPaymentMethods($this->amount);
|
||||||
|
|
||||||
$this->hash = Str::uuid()->toString();
|
$this->hash = Str::uuid()->toString();
|
||||||
|
|
||||||
|
$this->state['show_rff'] = auth()->guard('contact')->user()->showRff();
|
||||||
|
|
||||||
|
$this->first_name = $this->contact->first_name;
|
||||||
|
|
||||||
|
$this->last_name = $this->contact->last_name;
|
||||||
|
|
||||||
|
$this->email = $this->contact->email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handleRff()
|
||||||
|
{
|
||||||
|
$this->validate([
|
||||||
|
'first_name' => ['required'],
|
||||||
|
'last_name' => ['required'],
|
||||||
|
'email' => ['required', 'email'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->contact->update([
|
||||||
|
'first_name' => $this->first_name,
|
||||||
|
'last_name' => $this->last_name,
|
||||||
|
'email' => $this->email,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->state['show_rff'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleBeforePaymentEvents(): void
|
public function handleBeforePaymentEvents(): void
|
||||||
|
Loading…
Reference in New Issue
Block a user