From 6be79ad0225336f57db1b65ee5ca9b9afd155f4d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 20 Mar 2021 13:57:03 +1100 Subject: [PATCH] Billing Subs --- .../BillingSubscriptionService.php | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/Services/BillingSubscription/BillingSubscriptionService.php b/app/Services/BillingSubscription/BillingSubscriptionService.php index 9d406b4b2d..1ce2b296b6 100644 --- a/app/Services/BillingSubscription/BillingSubscriptionService.php +++ b/app/Services/BillingSubscription/BillingSubscriptionService.php @@ -103,14 +103,32 @@ class BillingSubscriptionService //do we have a promocode? enter this as a line item. if(strlen($data['coupon']) >=1) - $line_items = $this->createPromoLine($data); + $line_items[] = $this->createPromoLine($data); return $line_items; } private function createPromoLine($data) { + + $product = $this->billing_subscription->product; + + $price = 0; + $item = new InvoiceItem; + $item->quantity = 1; + $item->product_key = ctrans('texts.promo_code'); + $item->notes = ctrans('texts.promo_code'); + $item->cost = $price; + $item->tax_rate1 = $product->tax_rate1 ?: 0; + $item->tax_name1 = $product->tax_name1 ?: ''; + $item->tax_rate2 = $product->tax_rate2 ?: 0; + $item->tax_name2 = $product->tax_name2 ?: ''; + $item->tax_rate3 = $product->tax_rate3 ?: 0; + $item->tax_name3 = $product->tax_name3 ?: ''; + + return $item; + } private function convertInvoiceToRecurring()