feat(billing): renewals, coupons, VAT numbering, billing cycles and invoice payment tracking
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
ea9a53f742
commit
25f23d541e
@@ -8,6 +8,7 @@ use App\Models\Invoice;
|
||||
use App\Models\InvoiceItem;
|
||||
use App\Models\Order;
|
||||
use App\Repositories\Api\BaseApiRepository;
|
||||
use App\Support\VatNumbering;
|
||||
|
||||
class InvoiceRepository extends BaseApiRepository implements InvoiceRepositoryInterface
|
||||
{
|
||||
@@ -37,6 +38,7 @@ class InvoiceRepository extends BaseApiRepository implements InvoiceRepositoryIn
|
||||
// sub_total là tổng TRƯỚC giảm giá, để sub_total - discount_amount = total.
|
||||
'sub_total' => (int) $order->total + $discount,
|
||||
'discount_amount' => $discount,
|
||||
'coupon_code' => $order->coupon_code,
|
||||
'tax' => 0,
|
||||
'total' => $order->total,
|
||||
'status' => InvoiceStatus::UNPAID->value,
|
||||
@@ -78,7 +80,7 @@ class InvoiceRepository extends BaseApiRepository implements InvoiceRepositoryIn
|
||||
}
|
||||
}
|
||||
|
||||
return $invoice;
|
||||
return VatNumbering::settle($invoice);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user