1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 00:41:34 +02:00

Billing Subs

This commit is contained in:
David Bomba 2021-03-20 13:57:03 +11:00
parent ba91c96c40
commit 6be79ad022

View File

@ -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()