diff --git a/app/Services/BillingSubscription/BillingSubscriptionService.php b/app/Services/BillingSubscription/BillingSubscriptionService.php index 9d406b4b2d44..1ce2b296b602 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()