PageSourceSearch

https://invoicecraftly.com/_assets/js/features/invoice-route-advisor/private-work/scenario.922e4573bb0d.js

js invoicecraftly.com collected 2026-10-02 01:34:14 UTC 2,022 bytes, 61 lines download raw bytes

1export const PRIVATE_WORK_SCENARIO = Object.freeze({
2  DK_ONE_OFF: 'private-work-dk'
3});
4
5export const PRIVATE_WORK_SCENARIO_CONFLICT = Object.freeze({
6  MISSING_DOCUMENT: 'missing-document',
7  WRONG_MARKET: 'wrong-market',
8  WRONG_DOCUMENT_TYPE: 'wrong-document-type',
9  SELLER_CVR_PRESENT: 'seller-cvr-present',
10  SELLER_VAT_IDENTIFIER_PRESENT: 'seller-vat-identifier-present',
11  SELLER_VAT_NUMBER_PRESENT: 'seller-vat-number-present',
12  POSITIVE_VAT_PRESENT: 'positive-vat-present',
13  VAT_CATEGORY_PRESENT: 'vat-category-present'
14});
15
16function hasText(value) {
17  return typeof value === 'string' && value.trim().length > 0;
18}
19
20export function inspectDanishPrivateWorkInvoice(invoice) {
21  const conflicts = [];
22
23  if (!invoice || typeof invoice !== 'object') {
24    conflicts.push(PRIVATE_WORK_SCENARIO_CONFLICT.MISSING_DOCUMENT);
25    return Object.freeze({ canApply: false, conflicts: Object.freeze(conflicts) });
26  }
27
28  if (invoice.localization?.marketId !== 'denmark') {
29    conflicts.push(PRIVATE_WORK_SCENARIO_CONFLICT.WRONG_MARKET);
30  }
31  if (invoice.label !== 'Invoice') {
32    conflicts.push(PRIVATE_WORK_SCENARIO_CONFLICT.WRONG_DOCUMENT_TYPE);
33  }
34  if (hasText(invoice.seller?.taxId)) {
35    conflicts.push(PRIVATE_WORK_SCENARIO_CONFLICT.SELLER_CVR_PRESENT);
36  }
37  if (hasText(invoice.seller?.vatIdentifier)) {
38    conflicts.push(PRIVATE_WORK_SCENARIO_CONFLICT.SELLER_VAT_IDENTIFIER_PRESENT);
39  }
40  if (hasText(invoice.seller?.registration?.vatNumber)) {
41    conflicts.push(PRIVATE_WORK_SCENARIO_CONFLICT.SELLER_VAT_NUMBER_PRESENT);
42  }
43
44  for (const item of invoice.items || []) {
45    if (Number(item?.taxRate) > 0) {
46      conflicts.push(PRIVATE_WORK_SCENARIO_CONFLICT.POSITIVE_VAT_PRESENT);
47      break;
48    }
49  }
50  for (const item of invoice.items || []) {
51    if (hasText(item?.vatCategoryCode)) {
52      conflicts.push(PRIVATE_WORK_SCENARIO_CONFLICT.VAT_CATEGORY_PRESENT);
53      break;
54    }
55  }
56
57  return Object.freeze({
58    canApply: conflicts.length === 0,
59    conflicts: Object.freeze(conflicts)
60  });
61}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.