Add UTM to billing portal purchase

This commit is contained in:
David Bomba 2023-04-29 11:10:52 +10:00
parent 3e46aad567
commit d05b41e452
2 changed files with 4 additions and 3 deletions

View File

@ -405,6 +405,8 @@ class BillingPortalPurchase extends Component
$context = 'whitelabel';
}
$utm = isset($this->request_data['utm']) ? $this->request_data['utm'] : null;
Cache::put($this->hash, [
'subscription_id' => $this->subscription->hashed_id,
'email' => $this->email ?? $this->contact->email,
@ -412,6 +414,7 @@ class BillingPortalPurchase extends Component
'invoice_id' => $this->invoice->hashed_id,
'context' => $context,
'campaign' => $this->campaign,
'utm' => $utm,
], now()->addMinutes(60));
$this->emit('beforePaymentEventsCompleted');

View File

@ -381,7 +381,6 @@ class BaseDriver extends AbstractPaymentDriver
* When a successful payment is made, we need to append the gateway fee
* to an invoice.
*
* @param PaymentResponseRequest $request The incoming payment request
* @return void Success/Failure
*/
public function confirmGatewayFee() :void
@ -395,7 +394,7 @@ class BaseDriver extends AbstractPaymentDriver
/*Hydrate invoices*/
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_invoices, 'invoice_id')))->withTrashed()->get();
$invoices->each(function ($invoice) use ($fee_total) {
$invoices->each(function ($invoice) {
if (collect($invoice->line_items)->contains('type_id', '3')) {
$invoice->service()->toggleFeesPaid()->save();
}
@ -421,7 +420,6 @@ class BaseDriver extends AbstractPaymentDriver
/**
* Return the contact if possible.
*
* @return ClientContact The ClientContact object
*/
public function getContact()
{