diff --git a/src/invoice.js b/src/invoice.js index 7fe82d5..c12ffe1 100644 --- a/src/invoice.js +++ b/src/invoice.js @@ -221,14 +221,16 @@ const template = `
{{texts.notTaxPayerSK}}
{{/if}} {{/unless}} - {{#unless domestic}} -
- {{#if isCreditNote}} - {{texts.taxPaysCustomerCreditNote}} - {{else}} - {{texts.taxPaysCustomerInvoice}} - {{/if}} -
+ {{#unless isFromEuropeanUnion}} + {{#unless domestic}} +
+ {{#if isCreditNote}} + {{texts.taxPaysCustomerCreditNote}} + {{else}} + {{texts.taxPaysCustomerInvoice}} + {{/if}} +
+ {{/unless}} {{/unless}} {{#if note}}
{{note}}
{{/if}} @@ -318,11 +320,44 @@ handlebars.registerHelper('formatPrice', (value, currency) => priceFormatters[cu const domesticCountries = ['The United States of America', 'United Kingdom'] +const europeanUnionCountries = [ + 'Austria', + 'Belgium', + 'Bulgaria', + 'Cyprus', + 'Czech Republic', + 'Germany', + 'Denmark', + 'Estonia', + 'Spain', + 'Finland', + 'France', + 'Greece', + 'Hungary', + 'Croatia', + 'Ireland, Republic', + 'Italy', + 'Lithuania', + 'Luxembourg', + 'Latvia', + 'Malta', + 'Netherlands', + 'Poland', + 'Portugal', + 'Romania', + 'Sweden', + 'Slovenia', + 'Slovakia', +] + export const isDomestic = (vendorCountry, clientCountry) => vendorCountry === clientCountry || domesticCountries.includes(clientCountry) || clientCountry.includes('US') +export const isFromEU = (clientCountry) => + europeanUnionCountries.includes(clientCountry) + export default function renderInvoice(_context, language) { const context = {..._context} @@ -331,6 +366,8 @@ export default function renderInvoice(_context, language) { context.domestic = isDomestic(context.vendorCountry, context.clientCountry) + context.isFromEuropeanUnion = isFromEU(context.clientCountry) + if (context.vendorID && context.vendorID.startsWith('@@')) { context.vendorID = null }