mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Updates for logic
This commit is contained in:
parent
c010c99547
commit
f3f91f75b8
@ -37,8 +37,10 @@ class Methods extends Component
|
|||||||
|
|
||||||
public function handleSelect(string $company_gateway_id, string $gateway_type_id)
|
public function handleSelect(string $company_gateway_id, string $gateway_type_id)
|
||||||
{
|
{
|
||||||
|
/** @var \App\Models\ClientContact $contact */
|
||||||
|
$contact = auth()->guard('contact')->user();
|
||||||
|
|
||||||
$this->dispatch('purchase.context', property: 'client_id', value: auth()->guard('contact')->user()->client->hashed_id);
|
$this->dispatch('purchase.context', property: 'client_id', value: $contact->client->hashed_id);
|
||||||
|
|
||||||
nlog($this->context);
|
nlog($this->context);
|
||||||
|
|
||||||
@ -50,12 +52,10 @@ class Methods extends Component
|
|||||||
->adjustInventory()
|
->adjustInventory()
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
|
Cache::put($this->context['hash'], [
|
||||||
|
|
||||||
Cache::put($this->hash, [
|
|
||||||
'subscription_id' => $this->subscription->hashed_id,
|
'subscription_id' => $this->subscription->hashed_id,
|
||||||
'email' => auth()->guard('contact')->user()->email,
|
'email' => $contact->email,
|
||||||
'client_id' => auth()->guard('contact')->user()->client->hashed_id,
|
'client_id' => $contact->client->hashed_id,
|
||||||
'invoice_id' => $invoice->hashed_id,
|
'invoice_id' => $invoice->hashed_id,
|
||||||
'context' => 'purchase',
|
'context' => 'purchase',
|
||||||
'campaign' => $this->context['campaign'],
|
'campaign' => $this->context['campaign'],
|
||||||
|
@ -47,6 +47,97 @@ class Purchase extends Component
|
|||||||
|
|
||||||
public string $id;
|
public string $id;
|
||||||
|
|
||||||
|
/** $context = [
|
||||||
|
* 'hash' => string,
|
||||||
|
* 'quantity' => int,
|
||||||
|
* 'request_data' => [
|
||||||
|
* 'q' => string,
|
||||||
|
* ],
|
||||||
|
* 'campaign => ?string,
|
||||||
|
* 'bundle' => $bundle,
|
||||||
|
* 'contact' => [
|
||||||
|
* 'first_name' => ?string,
|
||||||
|
* 'last_name' => ?string,
|
||||||
|
* 'phone' => ?string,
|
||||||
|
* 'custom_value1' => ?string,
|
||||||
|
* 'custom_value2' => ?string,
|
||||||
|
* 'custom_value3' => ?string,
|
||||||
|
* 'custom_value4' => ?string,
|
||||||
|
* 'email' => ?string,
|
||||||
|
* 'email_verified_at' => ?int,
|
||||||
|
* 'confirmation_code' => ?string,
|
||||||
|
* 'is_primary' => bool,
|
||||||
|
* 'confirmed' => bool,
|
||||||
|
* 'last_login' => ?datetime,
|
||||||
|
* 'failed_logins' => ?int,
|
||||||
|
* 'accepted_terms_version' => ?string,
|
||||||
|
* 'avatar' => ?string,
|
||||||
|
* 'avatar_type' => ?string,
|
||||||
|
* 'avatar_size' => ?string,
|
||||||
|
* 'is_locked' => bool,
|
||||||
|
* 'send_email' => bool,
|
||||||
|
* 'contact_key' => string,
|
||||||
|
* 'created_at' => int,
|
||||||
|
* 'updated_at' => int,
|
||||||
|
* 'deleted_at' => int,
|
||||||
|
* 'hashed_id' => string,
|
||||||
|
* ],
|
||||||
|
* 'client_id' => string,
|
||||||
|
* 'quantity' => int,
|
||||||
|
* 'products' => [
|
||||||
|
* [
|
||||||
|
* 'product_key' => string,
|
||||||
|
* 'quantity' => int,
|
||||||
|
* 'total_raw' => float,
|
||||||
|
* 'total' => string,
|
||||||
|
* ],
|
||||||
|
* ]
|
||||||
|
* ];
|
||||||
|
*
|
||||||
|
* $bundle =[
|
||||||
|
* 'optional_one_time_products' => array,
|
||||||
|
* 'one_time_products' => array,
|
||||||
|
* 'optional_recurring_products' => array,
|
||||||
|
* 'recurring_products' => [
|
||||||
|
* 'hashed_id' => [
|
||||||
|
* 'product' => [
|
||||||
|
* 'id' => int,
|
||||||
|
* 'company_id' => int,
|
||||||
|
* 'user_id' => int,
|
||||||
|
* 'assigned_user_id' => ?int,
|
||||||
|
* 'project_id' => ?int,
|
||||||
|
* 'vendor_id' => ?int,
|
||||||
|
* 'custom_value1' => ?string,
|
||||||
|
* 'custom_value2' => ?string,
|
||||||
|
* 'custom_value3' => ?string,
|
||||||
|
* 'custom_value4' => ?string,
|
||||||
|
* 'product_key' => ?string,
|
||||||
|
* 'notes' => ?string,
|
||||||
|
* 'cost' => float,
|
||||||
|
* 'price' => float,
|
||||||
|
* 'quantity' => float,
|
||||||
|
* 'tax_name1' => ?string,
|
||||||
|
* 'tax_rate1' => float,
|
||||||
|
* 'tax_name2' => ?string,
|
||||||
|
* 'tax_rate2' => float,
|
||||||
|
* 'tax_name3' => ?string,
|
||||||
|
* 'tax_rate3' => float,
|
||||||
|
* 'deleted_at' => ?int,
|
||||||
|
* 'created_at' => ?int,
|
||||||
|
* 'updated_at' => ?int,
|
||||||
|
* 'is_deleted' => bool,
|
||||||
|
* 'in_stock_quantity' => ?int,
|
||||||
|
* 'stock_notification' => bool,
|
||||||
|
* 'stock_notification_threshold' => ?int,
|
||||||
|
* 'max_quantity' => ?int,
|
||||||
|
* 'product_image' => ?string,
|
||||||
|
* 'tax_id' => ?int,
|
||||||
|
* 'hashed_id' => ?string,
|
||||||
|
* ],
|
||||||
|
* ],
|
||||||
|
* ],
|
||||||
|
* ] $bundle
|
||||||
|
*/
|
||||||
public array $context = [];
|
public array $context = [];
|
||||||
|
|
||||||
#[On('purchase.context')]
|
#[On('purchase.context')]
|
||||||
|
@ -133,6 +133,7 @@ class Summary extends Component
|
|||||||
if (isset($this->context['bundle']) === false) {
|
if (isset($this->context['bundle']) === false) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
$products = [];
|
||||||
|
|
||||||
foreach ($this->context['bundle']['recurring_products'] as $key => $item) {
|
foreach ($this->context['bundle']['recurring_products'] as $key => $item) {
|
||||||
$products[] = [
|
$products[] = [
|
||||||
|
@ -35,7 +35,6 @@ class SubscriptionCalculator
|
|||||||
{
|
{
|
||||||
|
|
||||||
$invoice_repo = new InvoiceRepository();
|
$invoice_repo = new InvoiceRepository();
|
||||||
$subscription_repo = new SubscriptionRepository();
|
|
||||||
|
|
||||||
$invoice = InvoiceFactory::create($this->subscription->company_id, $this->subscription->user_id);
|
$invoice = InvoiceFactory::create($this->subscription->company_id, $this->subscription->user_id);
|
||||||
$invoice->subscription_id = $this->subscription->id;
|
$invoice->subscription_id = $this->subscription->id;
|
||||||
@ -55,7 +54,6 @@ class SubscriptionCalculator
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Build Line Items
|
* Build Line Items
|
||||||
*
|
|
||||||
* @param array $context
|
* @param array $context
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user