mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Improve subscription service
This commit is contained in:
parent
445ba94201
commit
0c267131c4
@ -92,7 +92,7 @@ class SubscriptionService
|
|||||||
'client' => $recurring_invoice->client->hashed_id,
|
'client' => $recurring_invoice->client->hashed_id,
|
||||||
'subscription' => $this->subscription->hashed_id,
|
'subscription' => $this->subscription->hashed_id,
|
||||||
'contact' => auth('contact')->user()->hashed_id,
|
'contact' => auth('contact')->user()->hashed_id,
|
||||||
'account_key' => auth('contact')->user()->account->account_key,
|
'account_key' => $recurring_invoice->client->custom_value2,
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->triggerWebhook($context);
|
$response = $this->triggerWebhook($context);
|
||||||
@ -109,7 +109,7 @@ class SubscriptionService
|
|||||||
'invoice' => $this->encodePrimaryKey($payment_hash->fee_invoice_id),
|
'invoice' => $this->encodePrimaryKey($payment_hash->fee_invoice_id),
|
||||||
'client' => $invoice->client->hashed_id,
|
'client' => $invoice->client->hashed_id,
|
||||||
'subscription' => $this->subscription->hashed_id,
|
'subscription' => $this->subscription->hashed_id,
|
||||||
'account_key' => auth('contact')->user()->account->account_key,
|
'account_key' => $invoice->client->custom_value2,
|
||||||
];
|
];
|
||||||
|
|
||||||
//execute any webhooks
|
//execute any webhooks
|
||||||
@ -129,6 +129,7 @@ class SubscriptionService
|
|||||||
'contact' => $contact->hashed_id,
|
'contact' => $contact->hashed_id,
|
||||||
'contact_email' => $contact->email,
|
'contact_email' => $contact->email,
|
||||||
'client' => $contact->client->hashed_id,
|
'client' => $contact->client->hashed_id,
|
||||||
|
'account_key' => $contact->client->custom_value2,
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->triggerWebhook($context);
|
$response = $this->triggerWebhook($context);
|
||||||
@ -179,6 +180,7 @@ class SubscriptionService
|
|||||||
'recurring_invoice' => $recurring_invoice->hashed_id,
|
'recurring_invoice' => $recurring_invoice->hashed_id,
|
||||||
'client' => $recurring_invoice->client->hashed_id,
|
'client' => $recurring_invoice->client->hashed_id,
|
||||||
'subscription' => $this->subscription->hashed_id,
|
'subscription' => $this->subscription->hashed_id,
|
||||||
|
'account_key' => $recurring_invoice->client->custom_value2,
|
||||||
];
|
];
|
||||||
|
|
||||||
//execute any webhooks
|
//execute any webhooks
|
||||||
@ -451,6 +453,7 @@ class SubscriptionService
|
|||||||
'client' => $new_recurring_invoice->client->hashed_id,
|
'client' => $new_recurring_invoice->client->hashed_id,
|
||||||
'subscription' => $target_subscription->hashed_id,
|
'subscription' => $target_subscription->hashed_id,
|
||||||
'contact' => auth('contact')->user()->hashed_id,
|
'contact' => auth('contact')->user()->hashed_id,
|
||||||
|
'account_key' => $new_recurring_invoice->client->custom_value2,
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->triggerWebhook($context);
|
$response = $this->triggerWebhook($context);
|
||||||
@ -571,6 +574,7 @@ class SubscriptionService
|
|||||||
'client' => $recurring_invoice->client->hashed_id,
|
'client' => $recurring_invoice->client->hashed_id,
|
||||||
'subscription' => $this->subscription->hashed_id,
|
'subscription' => $this->subscription->hashed_id,
|
||||||
'contact' => auth('contact')->user()->hashed_id,
|
'contact' => auth('contact')->user()->hashed_id,
|
||||||
|
'account_key' => $recurring_invoice->client->custom_value2,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -767,8 +771,6 @@ class SubscriptionService
|
|||||||
$response = false;
|
$response = false;
|
||||||
|
|
||||||
$body = array_merge($context, [
|
$body = array_merge($context, [
|
||||||
'company_key' => $this->subscription->company->company_key,
|
|
||||||
'account_key' => $this->subscription->company->account->key,
|
|
||||||
'db' => $this->subscription->company->db,
|
'db' => $this->subscription->company->db,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -920,6 +922,7 @@ class SubscriptionService
|
|||||||
'recurring_invoice' => $recurring_invoice->hashed_id,
|
'recurring_invoice' => $recurring_invoice->hashed_id,
|
||||||
'client' => $recurring_invoice->client->hashed_id,
|
'client' => $recurring_invoice->client->hashed_id,
|
||||||
'contact' => auth('contact')->user()->hashed_id,
|
'contact' => auth('contact')->user()->hashed_id,
|
||||||
|
'account_key' => $recurring_invoice->client->custom_value2,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->triggerWebhook($context);
|
$this->triggerWebhook($context);
|
||||||
@ -1042,7 +1045,7 @@ class SubscriptionService
|
|||||||
'client' => $invoice->client->hashed_id,
|
'client' => $invoice->client->hashed_id,
|
||||||
'contact' => $invoice->client->primary_contact()->first() ? $invoice->client->primary_contact()->first()->hashed_id: $invoice->client->contacts->first()->hashed_id,
|
'contact' => $invoice->client->primary_contact()->first() ? $invoice->client->primary_contact()->first()->hashed_id: $invoice->client->contacts->first()->hashed_id,
|
||||||
'invoice' => $invoice->hashed_id,
|
'invoice' => $invoice->hashed_id,
|
||||||
'account_key' => $invoice->client->custom
|
'account_key' => $invoice->client->custom_value2,
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->triggerWebhook($context);
|
$response = $this->triggerWebhook($context);
|
||||||
|
635
composer.lock
generated
635
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -110,14 +110,14 @@
|
|||||||
document.getElementById('handlePlanChange').addEventListener('click', function() {
|
document.getElementById('handlePlanChange').addEventListener('click', function() {
|
||||||
|
|
||||||
if(document.getElementById("newPlan").value.length > 1)
|
if(document.getElementById("newPlan").value.length > 1)
|
||||||
location.href = 'https://invoiceninja.invoicing.co/client/subscriptions/{{ $current_recurring_id }}/plan_switch/' + document.getElementById("newPlan").value + '';
|
location.href = 'http://devhosted.test:8000/client/subscriptions/{{ $current_recurring_id }}/plan_switch/' + document.getElementById("newPlan").value + '';
|
||||||
|
|
||||||
});
|
});
|
||||||
@else
|
@else
|
||||||
document.getElementById('handleNewPlan').addEventListener('click', function() {
|
document.getElementById('handleNewPlan').addEventListener('click', function() {
|
||||||
|
|
||||||
if(document.getElementById("newPlan").value.length > 1)
|
if(document.getElementById("newPlan").value.length > 1)
|
||||||
location.href = 'https://invoiceninja.invoicing.co/client/subscriptions/' + document.getElementById("newPlan").value + '/purchase';
|
location.href = 'http://devhosted.test:8000/client/subscriptions/' + document.getElementById("newPlan").value + '/purchase';
|
||||||
|
|
||||||
});
|
});
|
||||||
@endif
|
@endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user