-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(revshare): missing bits to complete the feature (#3094)
## Roadmap 👉 https://getlago.canny.io/feature-requests/p/calculate-revenue-share ## Context Current problem: companies with **partners** selling for them cannot have a **revenue share** system in Lago. We want to propose **self-billing** into Lago, a billing arrangement where the **customer** creates and issues the invoice on **behalf** of the **supplier** for goods or services received. ## Description * exclude self billed invoices in customer overdue balance calculations * Add query filters for customer account_type, and invoices and credit notes self_billed * Add account_type to graphQL customer portal customer object * Add account_type filter to graphql customers resolver and Api endpoint * Add self_billed filter to graphql invoices resolver and Api endpoint * Add self_billed filter to graphql credit notes resolver and Api endpoint * Add self_billed to credit note and fee API serializer * Update self_billed pdf invoices translations * Adapt template for self_billed one_off invoices
- Loading branch information
Showing
44 changed files
with
725 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
module Queries | ||
class CustomersQueryFiltersContract < Dry::Validation::Contract | ||
params do | ||
required(:filters).hash do | ||
optional(:account_type).array(:string, included_in?: Customer::ACCOUNT_TYPES.values) | ||
end | ||
|
||
optional(:search_term).maybe(:string) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
table.invoice-resume-table width="100%" | ||
tr | ||
td.body-2 = I18n.t('invoice.item') | ||
td.body-2 = I18n.t('invoice.units') | ||
td.body-2 = I18n.t('invoice.unit_price') | ||
td.body-2 = I18n.t('invoice.tax_rate') | ||
td.body-2 = I18n.t('invoice.amount') | ||
- if one_off? | ||
- fees.each do |fee| | ||
tr | ||
td | ||
.body-1 = fee.invoice_name | ||
.body-3 = fee.description | ||
td.body-2 = fee.units | ||
td.body-2 = MoneyHelper.format(fee.unit_amount) | ||
td.body-2 == TaxHelper.applied_taxes(fee) | ||
td.body-2 = MoneyHelper.format(fee.amount) | ||
|
||
table.total-table width="100%" | ||
tr | ||
td.body-2 | ||
td.body-2 = I18n.t('invoice.sub_total_without_tax') | ||
td.body-2 = MoneyHelper.format(sub_total_excluding_taxes_amount) | ||
- if applied_taxes.present? | ||
- applied_taxes.order(tax_rate: :desc).each do |applied_tax| | ||
tr | ||
- if applied_tax.applied_on_whole_invoice? | ||
td.body-2 | ||
td.body-2 = I18n.t('invoice.tax_name_only.' + applied_tax.tax_code) | ||
td.body-2 | ||
- else | ||
td.body-2 | ||
td.body-2 = I18n.t('invoice.tax_name', name: applied_tax.tax_name, rate: applied_tax.tax_rate, amount: MoneyHelper.format(applied_tax.taxable_amount)) | ||
td.body-2 = MoneyHelper.format(applied_tax.amount) | ||
- else | ||
tr | ||
td.body-2 | ||
td.body-2 = I18n.t('invoice.tax_name_with_details', name: 'Tax', rate: 0) | ||
td.body-2 = MoneyHelper.format(0.to_money(currency)) | ||
tr | ||
td.body-2 | ||
td.body-2 = I18n.t('invoice.sub_total_with_tax') | ||
td.body-2 = MoneyHelper.format(sub_total_including_taxes_amount) | ||
tr | ||
td.body-2 | ||
td.body-1 = I18n.t('invoice.total_due') | ||
td.body-1 = MoneyHelper.format(total_amount) |
Oops, something went wrong.