mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 15:34:37 -04:00
Merge pull request #5196 from beganovich/v5-2003-fix-billing-subscription-integration
(v5) Construct the billing service with correct dependency
This commit is contained in:
commit
d804dc6f17
@ -262,6 +262,7 @@ class BillingPortalPurchase extends Component
|
||||
'client_contact_id' => $this->contact->hashed_id,
|
||||
]],
|
||||
'user_input_promo_code' => $this->coupon,
|
||||
'coupon' => $this->coupon,
|
||||
'quantity' => $this->quantity,
|
||||
];
|
||||
|
||||
@ -273,6 +274,7 @@ class BillingPortalPurchase extends Component
|
||||
->save();
|
||||
|
||||
Cache::put($this->hash, [
|
||||
'billing_subscription_id' => $this->billing_subscription->id,
|
||||
'email' => $this->email ?? $this->contact->email,
|
||||
'client_id' => $this->contact->client->id,
|
||||
'invoice_id' => $this->invoice->id,
|
||||
|
@ -241,7 +241,11 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
|
||||
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
||||
|
||||
//(new BillingSubscriptionService)->completePurchase($this->payment_hash);
|
||||
if (property_exists($this->payment_hash->data, 'billing_context')) {
|
||||
$billing_subscription = \App\Models\BillingSubscription::find($this->payment_hash->data->billing_context->billing_subscription_id);
|
||||
|
||||
(new BillingSubscriptionService($billing_subscription))->completePurchase($this->payment_hash);
|
||||
}
|
||||
|
||||
return $payment->service()->applyNumber()->save();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user