27 lines
636 B
Lua
27 lines
636 B
Lua
if Config.Billing ~= 'codemv2' then return end
|
|
|
|
---@param source number
|
|
---@return Invoice[]
|
|
function GetInvoices(source)
|
|
local src = source
|
|
local bills = exports['codem-billingv2']:GetPlayerUnpaidBillings(src)
|
|
local data = {}
|
|
|
|
if bills then
|
|
for _, v in pairs(bills) do
|
|
table.insert(data, {
|
|
id = v.invoiceid,
|
|
price = v.amount,
|
|
label = v.reason,
|
|
})
|
|
end
|
|
end
|
|
|
|
return data
|
|
end
|
|
|
|
RegisterNetEvent('codemBilling:PayInvoice', function(invoiceId)
|
|
local src = source
|
|
exports['codem-billingv2']:PayBilling(src, invoiceId)
|
|
end)
|