@endevops/peppol-schema 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/constants.d.ts +131 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +114 -1
- package/dist/constants.js.map +1 -1
- package/dist/{index-BBzPjq7o.d.ts → index-XG-N6PcG.d.ts} +1702 -724
- package/dist/index-XG-N6PcG.d.ts.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1247 -200
- package/dist/index.js.map +1 -1
- package/dist/invoice-response-code-not-needs-schema-DNrfKYLh.js +36 -0
- package/dist/invoice-response-code-not-needs-schema-DNrfKYLh.js.map +1 -0
- package/dist/invoice-response-codes.d.ts +28 -0
- package/dist/invoice-response-codes.d.ts.map +1 -1
- package/dist/invoice-response-codes.js +11 -1
- package/dist/invoice-response-codes.js.map +1 -1
- package/dist/{is-valid-abn-160i38PG.js → is-valid-abn-D7eSygBG.js} +115 -2
- package/dist/is-valid-abn-D7eSygBG.js.map +1 -0
- package/dist/{is-valid-mod97-0208-CzMOXMO-.js → is-valid-mod97-0208-CjR324eG.js} +11 -1
- package/dist/is-valid-mod97-0208-CjR324eG.js.map +1 -0
- package/dist/message-level-response-profile-id-B9c0A7S_.js +27 -0
- package/dist/message-level-response-profile-id-B9c0A7S_.js.map +1 -0
- package/dist/{nodable-parser-CyDZtLCK.js → nodable-parser-CupS2H55.js} +31 -1
- package/dist/nodable-parser-CupS2H55.js.map +1 -0
- package/dist/schematron.d.ts +57 -1
- package/dist/schematron.d.ts.map +1 -1
- package/dist/schematron.js +458 -7
- package/dist/schematron.js.map +1 -1
- package/dist/validations.d.ts +132 -0
- package/dist/validations.d.ts.map +1 -1
- package/dist/validations.js +11 -2
- package/dist/validations.js.map +1 -1
- package/dist/values.d.ts +67 -2
- package/dist/values.d.ts.map +1 -1
- package/dist/xml.d.ts +30 -0
- package/dist/xml.d.ts.map +1 -1
- package/dist/xml.js +10 -1
- package/dist/xml.js.map +1 -1
- package/package.json +1 -1
- package/src/constants/credit-note-doctype-id.ts +9 -0
- package/src/constants/credit-note-process-id.ts +9 -0
- package/src/constants/document-scheme.ts +9 -0
- package/src/constants/invoice-doctype-id.ts +9 -0
- package/src/constants/invoice-process-id.ts +10 -0
- package/src/constants/invoice-response-doctype-id.ts +10 -0
- package/src/constants/invoice-response-process-id.ts +9 -0
- package/src/constants/invoice-response-profile-id.ts +9 -0
- package/src/constants/message-level-response-doctype-id.ts +10 -0
- package/src/constants/message-level-response-process-id.ts +9 -0
- package/src/constants/message-level-response-profile-id.ts +9 -0
- package/src/constants/participant-scheme.ts +10 -0
- package/src/constants/process-scheme.ts +9 -0
- package/src/constants/transport-profile.ts +10 -0
- package/src/decoders/fields/decode-invoice-message-document-party.ts +2 -2
- package/src/decoders/fields/decode-parties-tax-scheme.ts +2 -2
- package/src/decoders/fields/decode-party-legal-entity.ts +2 -2
- package/src/decoders/fields/decode-party-tax-scheme.ts +2 -2
- package/src/decoders/fields/decode-tax-category.ts +1 -1
- package/src/decoders/fields/decode-tax-representative-party.ts +2 -2
- package/src/decoders/fields/encode-message-party.ts +2 -2
- package/src/decoders/fields/encode-parties-tax-scheme.ts +3 -3
- package/src/decoders/fields/encode-party-legal-entity.ts +1 -1
- package/src/decoders/fields/encode-party-tax-scheme.ts +2 -2
- package/src/decoders/fields/encode-tax-representative-party.ts +2 -2
- package/src/invoice-response-codes/invoice-response-code-needs-schema.ts +9 -0
- package/src/invoice-response-codes/invoice-response-code-not-needs-schema.ts +9 -0
- package/src/invoice-response-codes/invoice-response-codes-order.ts +10 -0
- package/src/peppol-validations/add-piva.ts +12 -0
- package/src/peppol-validations/check-cf.ts +11 -0
- package/src/peppol-validations/check-cf16.ts +12 -0
- package/src/peppol-validations/check-piva-se-it.ts +11 -0
- package/src/peppol-validations/check-piva.ts +11 -0
- package/src/peppol-validations/check-se-orgnr.ts +9 -0
- package/src/peppol-validations/greek-tin-verification.ts +9 -0
- package/src/peppol-validations/is-valid-abn.ts +9 -0
- package/src/peppol-validations/is-valid-gln.ts +10 -0
- package/src/peppol-validations/is-valid-iban.ts +10 -0
- package/src/peppol-validations/is-valid-mod11.ts +9 -0
- package/src/peppol-validations/is-valid-mod97-0208.ts +10 -0
- package/src/peppol-validations/luhn-check.ts +9 -0
- package/src/schemas/fields/default-customization-id.ts +9 -0
- package/src/schemas/fields/default-profile-id.ts +9 -0
- package/src/schemas/fields/peppol-additional-document-reference-schema.ts +61 -20
- package/src/schemas/fields/peppol-address-schema.ts +25 -2
- package/src/schemas/fields/peppol-allowance-charge-schema.ts +63 -9
- package/src/schemas/fields/peppol-amount-schema.ts +15 -2
- package/src/schemas/fields/peppol-base-line-schema.ts +12 -2
- package/src/schemas/fields/peppol-billing-reference-schema.ts +13 -0
- package/src/schemas/fields/peppol-binary-object-schema.ts +12 -4
- package/src/schemas/fields/peppol-contact-schema.ts +11 -0
- package/src/schemas/fields/peppol-credit-note-line-schema.ts +7 -2
- package/src/schemas/fields/peppol-delivery-schema.ts +44 -2
- package/src/schemas/fields/peppol-identifier-schema.ts +8 -0
- package/src/schemas/fields/peppol-invoice-line-period-schema.ts +11 -0
- package/src/schemas/fields/peppol-invoice-line-schema.ts +9 -2
- package/src/schemas/fields/peppol-invoice-period-schema.ts +2 -2
- package/src/schemas/fields/peppol-item-classification-schema.ts +2 -2
- package/src/schemas/fields/peppol-line-allowance-charge-schema.ts +56 -8
- package/src/schemas/fields/peppol-line-item-schema.ts +66 -6
- package/src/schemas/fields/peppol-line-price-allowance-charge-schema.ts +20 -0
- package/src/schemas/fields/peppol-line-price-schema.ts +2 -0
- package/src/schemas/fields/peppol-order-reference-schema.ts +2 -0
- package/src/schemas/fields/peppol-party-base-schema.ts +36 -4
- package/src/schemas/fields/peppol-party-legal-entity-schema.ts +10 -2
- package/src/schemas/fields/peppol-party-tax-scheme-schema.ts +4 -4
- package/src/schemas/fields/peppol-payee-party-schema.ts +8 -8
- package/src/schemas/fields/peppol-payment-means-schema.ts +62 -2
- package/src/schemas/fields/peppol-payment-terms-schema.ts +2 -0
- package/src/schemas/fields/peppol-quantity-schema.ts +4 -2
- package/src/schemas/fields/peppol-reference-schema.ts +20 -1
- package/src/schemas/fields/peppol-tax-category-schema.ts +12 -2
- package/src/schemas/fields/peppol-tax-representative-schema.ts +2 -2
- package/src/schemas/fields/peppol-tax-subtotal-category-schema.ts +3 -0
- package/src/schemas/fields/peppol-tax-subtotal-schema.ts +2 -0
- package/src/schemas/fields/peppol-tax-totals-base-schema.ts +3 -3
- package/src/schemas/peppol-billing-base-schema.ts +49 -9
- package/src/schemas/peppol-credit-note-schema.ts +2 -2
- package/src/schemas/peppol-document-response-document-reference-schema.ts +12 -4
- package/src/schemas/peppol-document-response-document-schema.ts +5 -5
- package/src/schemas/peppol-document-response-line-response-content-schema.ts +22 -2
- package/src/schemas/peppol-document-response-line-response-schema.ts +23 -2
- package/src/schemas/peppol-document-schema.ts +69 -6
- package/src/schemas/peppol-invoice-response-document-actual-response-schema.ts +53 -4
- package/src/schemas/peppol-invoice-response-document-actual-response-status-schema.ts +22 -4
- package/src/schemas/peppol-invoice-response-schema.ts +54 -6
- package/src/schemas/peppol-invoice-response-status-reason-code-schema.ts +36 -8
- package/src/schemas/peppol-invoice-schema.ts +30 -2
- package/src/schemas/peppol-message-level-response-document-response-schema.ts +10 -0
- package/src/schemas/peppol-message-level-response-party-schema.ts +10 -0
- package/src/schemas/peppol-message-level-response-schema.ts +18 -0
- package/src/schemas/utils/format-quantity-with-unit.ts +19 -0
- package/src/schemas/utils/get-credit-note-type-code-description.ts +12 -0
- package/src/schemas/utils/get-invoice-type-code-description.ts +12 -0
- package/src/schemas/utils/is-valid-credit-note-type-code.ts +13 -0
- package/src/schemas/utils/is-valid-invoice-type-code.ts +13 -0
- package/src/schemas/utils/is-valid-process.ts +13 -0
- package/src/schemas/utils/peppol-base-64-schema.ts +7 -4
- package/src/schemas/utils/peppol-vat-regex-schema.ts +38 -30
- package/src/schemas/utils/peppol-xsd-time-schema.ts +12 -2
- package/src/schemas/utils/quantity-unit-code-to-intl-unit.ts +34 -0
- package/src/schemas/values/additional-document-reference-code-schema.ts +9 -15
- package/src/schemas/values/allowance-charge-reason-code-schema.ts +12 -14
- package/src/schemas/values/application-response-type-code-schema.ts +10 -14
- package/src/schemas/values/charge-reason-code-schema.ts +12 -14
- package/src/schemas/values/credit-note-type-code-schema.ts +8 -14
- package/src/schemas/values/currency-code-schema.ts +13 -16
- package/src/schemas/values/document-type-schemes-schema.ts +9 -5
- package/src/schemas/values/document-type-values-schema.ts +5 -6
- package/src/schemas/values/duty-tax-fee-category-schema.ts +15 -13
- package/src/schemas/values/electronic-codes-schema.ts +10 -12
- package/src/schemas/values/icd-codes-schema.ts +8 -12
- package/src/schemas/values/invoice-status-code-schema.ts +10 -12
- package/src/schemas/values/invoice-type-code-schema.ts +10 -12
- package/src/schemas/values/item-classification-codes-schema.ts +10 -12
- package/src/schemas/values/mime-codes-schema.ts +12 -14
- package/src/schemas/values/op-status-action-schema.ts +10 -12
- package/src/schemas/values/op-status-reason-schema.ts +10 -12
- package/src/schemas/values/participant-identifier-code-schema.ts +10 -13
- package/src/schemas/values/payment-means-code-schema.ts +10 -12
- package/src/schemas/values/peppol-country-code-schema.ts +7 -9
- package/src/schemas/values/peppol-document-type-code-schema.ts +10 -12
- package/src/schemas/values/peppol-document-type-schema.ts +12 -21
- package/src/schemas/values/peppol-process-schema.ts +19 -15
- package/src/schemas/values/process-from-document-type-schema.ts +3 -3
- package/src/schemas/values/quantity-unit-codes-schema.ts +10 -12
- package/src/schemas/values/vat-date-code-schema.ts +12 -5
- package/src/schemas/values/vatex-code-schema.ts +8 -12
- package/src/schematron/errors.ts +14 -0
- package/src/schematron/helpers.ts +457 -11
- package/src/schematron/run-all-rules.ts +10 -0
- package/src/schematron/schematron.ts +25 -0
- package/src/xml/builder-options.ts +9 -0
- package/src/xml/common-xml-options.ts +9 -0
- package/src/xml/nodable-parser.ts +12 -0
- package/src/xml/parser-options.ts +9 -0
- package/dist/index-BBzPjq7o.d.ts.map +0 -1
- package/dist/invoice-response-code-not-needs-schema-p_RKKNLc.js +0 -18
- package/dist/invoice-response-code-not-needs-schema-p_RKKNLc.js.map +0 -1
- package/dist/is-valid-abn-160i38PG.js.map +0 -1
- package/dist/is-valid-mod97-0208-CzMOXMO-.js.map +0 -1
- package/dist/message-level-response-profile-id-DBpOW91B.js +0 -9
- package/dist/message-level-response-profile-id-DBpOW91B.js.map +0 -1
- package/dist/nodable-parser-CyDZtLCK.js.map +0 -1
- package/dist/vat-dates.generated-CxFvt7m3.d.ts +0 -68
- package/dist/vat-dates.generated-CxFvt7m3.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Predicate } from 'effect';
|
|
2
2
|
|
|
3
3
|
import type { XmlNode } from '#/helpers/get-prop.ts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { PeppolInvoiceResponseDocumentResponseParty } from '#/schemas/peppol-invoice-response-schema.ts';
|
|
5
5
|
import type { RecursivePartial } from '#/types.ts';
|
|
6
6
|
|
|
7
7
|
import { decodeIdentifier } from '#/decoders/fields/decode-identifier.ts';
|
|
@@ -11,7 +11,7 @@ import { strOrUnd } from '#/helpers/str-or-und.ts';
|
|
|
11
11
|
export const decodeInvoiceMessageDocumentParty = Effect.fn(function* (
|
|
12
12
|
party: XmlNode,
|
|
13
13
|
...path: Array<string>
|
|
14
|
-
): Effect.fn.Return<RecursivePartial<
|
|
14
|
+
): Effect.fn.Return<RecursivePartial<PeppolInvoiceResponseDocumentResponseParty> | undefined> {
|
|
15
15
|
const val = yield* getProp(party, ...path);
|
|
16
16
|
if (Predicate.isNullish(val)) return undefined;
|
|
17
17
|
const partyName = yield* getProp(val, 'cac:PartyName');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Predicate } from 'effect';
|
|
2
2
|
|
|
3
3
|
import type { XmlNode } from '#/helpers/get-prop.ts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { PeppolPartyTaxScheme } from '#/schemas/fields/peppol-party-tax-scheme-schema.ts';
|
|
5
5
|
import type { RecursivePartial } from '#/types.ts';
|
|
6
6
|
|
|
7
7
|
import { decodePartyTaxScheme } from '#/decoders/fields/decode-party-tax-scheme.ts';
|
|
@@ -10,7 +10,7 @@ import { getArray } from '#/helpers/get-array.ts';
|
|
|
10
10
|
export const decodePartiesTaxScheme = Effect.fn(function* (
|
|
11
11
|
doc: XmlNode,
|
|
12
12
|
...path: Array<string>
|
|
13
|
-
): Effect.fn.Return<RecursivePartial<Array<
|
|
13
|
+
): Effect.fn.Return<RecursivePartial<Array<PeppolPartyTaxScheme>> | undefined> {
|
|
14
14
|
const node = yield* getArray(doc, ...path);
|
|
15
15
|
if (node.length === 0) return undefined;
|
|
16
16
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Predicate } from 'effect';
|
|
2
2
|
|
|
3
3
|
import type { XmlNode } from '#/helpers/get-prop.ts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { PeppolPartyLegalEntity } from '#/schemas/fields/peppol-party-legal-entity-schema.ts';
|
|
5
5
|
import type { RecursivePartial } from '#/types.ts';
|
|
6
6
|
|
|
7
7
|
import { decodeIdentifier } from '#/decoders/fields/decode-identifier.ts';
|
|
@@ -11,7 +11,7 @@ import { strOrUnd } from '#/helpers/str-or-und.ts';
|
|
|
11
11
|
export const decodePartyLegalEntity = Effect.fn(function* (
|
|
12
12
|
node: XmlNode,
|
|
13
13
|
...path: Array<string>
|
|
14
|
-
): Effect.fn.Return<RecursivePartial<
|
|
14
|
+
): Effect.fn.Return<RecursivePartial<PeppolPartyLegalEntity> | undefined> {
|
|
15
15
|
const partyLegalEntityNode = yield* getProp(node, ...path);
|
|
16
16
|
if (Predicate.isNullish(partyLegalEntityNode)) return undefined;
|
|
17
17
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Predicate } from 'effect';
|
|
2
2
|
|
|
3
3
|
import type { XmlNode } from '#/helpers/get-prop.ts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { PeppolPartyTaxScheme } from '#/schemas/fields/peppol-party-tax-scheme-schema.ts';
|
|
5
5
|
import type { RecursivePartial } from '#/types.ts';
|
|
6
6
|
|
|
7
7
|
import { decodeSimpleIdentifer } from '#/decoders/fields/decode-simple-identifier.ts';
|
|
@@ -11,7 +11,7 @@ import { strOrUnd } from '#/helpers/str-or-und.ts';
|
|
|
11
11
|
export const decodePartyTaxScheme = Effect.fn(function* (
|
|
12
12
|
doc: XmlNode,
|
|
13
13
|
...path: Array<string>
|
|
14
|
-
): Effect.fn.Return<RecursivePartial<
|
|
14
|
+
): Effect.fn.Return<RecursivePartial<PeppolPartyTaxScheme> | undefined> {
|
|
15
15
|
const node = yield* getProp(doc, ...path);
|
|
16
16
|
if (Predicate.isNullish(node)) return undefined;
|
|
17
17
|
|
|
@@ -12,7 +12,7 @@ import { strOrUnd } from '#/helpers/str-or-und.ts';
|
|
|
12
12
|
export const decodeTaxCategory = Effect.fn(function* (
|
|
13
13
|
doc: XmlNode,
|
|
14
14
|
...path: Array<string>
|
|
15
|
-
): Effect.fn.Return<RecursivePartial<PeppolAllowanceCharge['taxCategory']> | undefined> {
|
|
15
|
+
): Effect.fn.Return<RecursivePartial<(typeof PeppolAllowanceCharge.Type)['taxCategory']> | undefined> {
|
|
16
16
|
const taxCategory = yield* getProp(doc, ...path);
|
|
17
17
|
if (Predicate.isNullish(taxCategory)) {
|
|
18
18
|
return undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Predicate } from 'effect';
|
|
2
2
|
|
|
3
3
|
import type { XmlNode } from '#/helpers/get-prop.ts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { PeppolTaxRepresentative } from '#/schemas/fields/peppol-tax-representative-schema.ts';
|
|
5
5
|
import type { RecursivePartial } from '#/types.ts';
|
|
6
6
|
|
|
7
7
|
import { decodeAddress } from '#/decoders/fields/decode-address.ts';
|
|
@@ -12,7 +12,7 @@ import { strOrUnd } from '#/helpers/str-or-und.ts';
|
|
|
12
12
|
export const decodeTaxRepresentativeParty = Effect.fn(function* (
|
|
13
13
|
doc: XmlNode,
|
|
14
14
|
...path: Array<string>
|
|
15
|
-
): Effect.fn.Return<RecursivePartial<
|
|
15
|
+
): Effect.fn.Return<RecursivePartial<PeppolTaxRepresentative> | undefined> {
|
|
16
16
|
const taxRepresentative = yield* getProp(doc, ...path);
|
|
17
17
|
if (Predicate.isNullish(taxRepresentative)) return undefined;
|
|
18
18
|
|
|
@@ -2,14 +2,14 @@ import { Effect, Predicate } from 'effect';
|
|
|
2
2
|
|
|
3
3
|
import type { PeppolContact } from '#/schemas/fields/peppol-contact-schema.ts';
|
|
4
4
|
import type { PeppolIdentifier } from '#/schemas/fields/peppol-identifier-schema.ts';
|
|
5
|
-
import type {
|
|
5
|
+
import type { PeppolInvoiceResponseDocumentResponseParty, PeppolInvoiceResponseParty } from '#/schemas/peppol-invoice-response-schema.ts';
|
|
6
6
|
import type { PeppolMessageLevelResponseParty } from '#/schemas/peppol-message-level-response-party-schema.ts';
|
|
7
7
|
|
|
8
8
|
import { encodeContact } from '#/decoders/fields/encode-contact.ts';
|
|
9
9
|
import { encodeIdentifier } from '#/decoders/fields/encode-identifier.ts';
|
|
10
10
|
import { encodePartyLegalEntity } from '#/decoders/fields/encode-party-legal-entity.ts';
|
|
11
11
|
|
|
12
|
-
type ResponseParty = PeppolMessageLevelResponseParty | PeppolInvoiceResponseParty |
|
|
12
|
+
type ResponseParty = PeppolMessageLevelResponseParty | PeppolInvoiceResponseParty | PeppolInvoiceResponseDocumentResponseParty;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @description The response party union exposes different fields per variant; reading the optional ones through a shared view keeps the encoder branch-free.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Effect, Predicate } from 'effect';
|
|
2
2
|
|
|
3
3
|
import type { XmlNode } from '#/helpers/get-prop.ts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { PeppolPartyTaxScheme } from '#/schemas/fields/peppol-party-tax-scheme-schema.ts';
|
|
5
5
|
|
|
6
6
|
import { encodePartyTaxScheme } from '#/decoders/fields/encode-party-tax-scheme.ts';
|
|
7
7
|
|
|
8
|
-
export const encodePartiesTaxScheme = Effect.fn(function* (partiesTaxScheme: Array<
|
|
8
|
+
export const encodePartiesTaxScheme = Effect.fn(function* (partiesTaxScheme: Array<PeppolPartyTaxScheme> | undefined): Effect.fn.Return<XmlNode> {
|
|
9
9
|
if (Predicate.isNullish(partiesTaxScheme) || partiesTaxScheme.length === 0) return undefined;
|
|
10
10
|
|
|
11
11
|
return yield* Effect.forEach(
|
|
12
12
|
partiesTaxScheme,
|
|
13
|
-
Effect.fn(function* (partyTaxScheme:
|
|
13
|
+
Effect.fn(function* (partyTaxScheme: PeppolPartyTaxScheme) {
|
|
14
14
|
return yield* encodePartyTaxScheme(partyTaxScheme);
|
|
15
15
|
})
|
|
16
16
|
);
|
|
@@ -3,7 +3,7 @@ import { Effect } from 'effect';
|
|
|
3
3
|
import { encodeIdentifier } from '#/decoders/fields/encode-identifier.ts';
|
|
4
4
|
|
|
5
5
|
export const encodePartyLegalEntity = Effect.fn(function* (legalEntity: {
|
|
6
|
-
registrationName?: string;
|
|
6
|
+
registrationName?: string | undefined;
|
|
7
7
|
companyId?: Parameters<typeof encodeIdentifier>[0];
|
|
8
8
|
companyLegalForm?: string | undefined;
|
|
9
9
|
}) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Effect, Predicate } from 'effect';
|
|
2
2
|
|
|
3
3
|
import type { XmlNode } from '#/helpers/get-prop.ts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { PeppolPartyTaxScheme } from '#/schemas/fields/peppol-party-tax-scheme-schema.ts';
|
|
5
5
|
|
|
6
6
|
import { encodeSimpleIdentifier } from '#/decoders/fields/encode-simple-identifier.ts';
|
|
7
7
|
|
|
8
|
-
export const encodePartyTaxScheme = Effect.fn(function* (partyTaxScheme:
|
|
8
|
+
export const encodePartyTaxScheme = Effect.fn(function* (partyTaxScheme: PeppolPartyTaxScheme | undefined): Effect.fn.Return<XmlNode> {
|
|
9
9
|
if (Predicate.isNullish(partyTaxScheme)) return undefined;
|
|
10
10
|
|
|
11
11
|
return { 'cbc:CompanyID': partyTaxScheme.companyId, 'cac:TaxScheme': yield* encodeSimpleIdentifier(partyTaxScheme.taxSchemeId) };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Effect, Predicate } from 'effect';
|
|
2
2
|
|
|
3
3
|
import type { XmlNode } from '#/helpers/get-prop.ts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { PeppolTaxRepresentative } from '#/schemas/fields/peppol-tax-representative-schema.ts';
|
|
5
5
|
|
|
6
6
|
import { encodeAddress } from '#/decoders/fields/encode-address.ts';
|
|
7
7
|
import { encodePartyTaxScheme } from '#/decoders/fields/encode-party-tax-scheme.ts';
|
|
8
8
|
|
|
9
9
|
export const encodeTaxRepresentativeParty = Effect.fn(function* (
|
|
10
|
-
taxRepresentativeParty:
|
|
10
|
+
taxRepresentativeParty: PeppolTaxRepresentative | undefined
|
|
11
11
|
): Effect.fn.Return<XmlNode> {
|
|
12
12
|
if (Predicate.isNullish(taxRepresentativeParty)) {
|
|
13
13
|
return undefined;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Invoice response status codes that require a clarification. The codes are Under query (UQ), Rejected (RE), and Conditionally accepted (CA).
|
|
3
|
+
* Consumed by {@link withStatusCodes}, where the `status` array must contain at least one entry.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* invoiceResponseCodeNeedsSchema; // ['UQ', 'RE', 'CA']
|
|
8
|
+
* ```;
|
|
9
|
+
*/
|
|
1
10
|
export const invoiceResponseCodeNeedsSchema = ['UQ', 'RE', 'CA'] as const;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Invoice response status codes that do not require a clarification. The codes are Message acknowledgement (AB), Accepted (AP), In process (IP), and
|
|
3
|
+
* Paid (PD). Consumed by {@link withoutStatusCodes}, where `status` is optional.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* invoiceResponseCodeNotNeedsSchema; // ['AB', 'AP', 'IP', 'PD']
|
|
8
|
+
* ```;
|
|
9
|
+
*/
|
|
1
10
|
export const invoiceResponseCodeNotNeedsSchema = ['AB', 'AP', 'IP', 'PD'] as const;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { InvoiceStatusCodesKeys } from '#/values/invoice-status-codes.generated';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @description Map of allowed status transitions for an invoice response, keyed by the current status code. Each value lists the status codes that may follow the
|
|
5
|
+
* key. Keys and values are {@link InvoiceStatusCodesKeys}. The terminal statuses PD and RE map to empty arrays.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* invoiceResponseCodesOrder.UQ; // ['CA', 'AP', 'RE']
|
|
10
|
+
* invoiceResponseCodesOrder.PD; // []
|
|
11
|
+
* ```;
|
|
12
|
+
*/
|
|
3
13
|
export const invoiceResponseCodesOrder: Record<InvoiceStatusCodesKeys, Array<InvoiceStatusCodesKeys>> = {
|
|
4
14
|
AB: ['IP', 'UQ', 'AP', 'CA', 'PD', 'RE'],
|
|
5
15
|
AP: ['PD'],
|
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description Helper function for calculating weighted sum for Italian PIVA validation.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* addPIVA('123', 0); // 8
|
|
9
|
+
* ```;
|
|
10
|
+
*
|
|
11
|
+
* @param arg - The digit string to sum, processed one character at a time.
|
|
12
|
+
* @param pari - Parity flag toggled at each recursion; `1` maps the digit through the `0246813579` table, `0` keeps it as is.
|
|
13
|
+
*
|
|
14
|
+
* @returns The weighted sum, or `0` when `arg` contains a non-digit.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link checkPIVA}
|
|
5
17
|
*/
|
|
6
18
|
export function addPIVA(arg: string, pari: number): number {
|
|
7
19
|
if (!/^\d+$/.test(arg)) return 0;
|
|
@@ -3,6 +3,17 @@ import { normalizeSpace } from './normalize-space.ts';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @description Validates both 16 and 11 character Italian fiscal codes.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* checkCF('RSSMRA80A01H501U'); // true
|
|
10
|
+
* ```;
|
|
11
|
+
*
|
|
12
|
+
* @param arg - The fiscal code to validate. Whitespace is normalised first.
|
|
13
|
+
*
|
|
14
|
+
* @returns `true` when the normalised code is a valid 16 character personal fiscal code or an 11 digit VAT code, otherwise `false`.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link checkCF16}
|
|
6
17
|
*/
|
|
7
18
|
export function checkCF(arg: string): boolean {
|
|
8
19
|
const s = normalizeSpace(arg);
|
|
@@ -2,6 +2,18 @@ import { normalizeSpace } from './normalize-space.ts';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description Validates 16-character Italian fiscal codes.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* checkCF16('RSSMRA80A01H501U'); // true
|
|
9
|
+
* ```;
|
|
10
|
+
*
|
|
11
|
+
* @param arg - The fiscal code to validate. Whitespace is normalised first.
|
|
12
|
+
*
|
|
13
|
+
* @returns `true` when the normalised code is 16 characters and matches `{6 letters}{2 digits}{letter}{2 digits}{letter}{3 digits}{letter}`,
|
|
14
|
+
* otherwise `false`.
|
|
15
|
+
*
|
|
16
|
+
* @see {@link checkCF}
|
|
5
17
|
*/
|
|
6
18
|
export function checkCF16(arg: string): boolean {
|
|
7
19
|
const s = normalizeSpace(arg);
|
|
@@ -2,6 +2,17 @@ import { checkPIVA } from './check-piva.ts';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description Validates Italian VAT numbers with IT prefix.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* checkPIVAseIT('IT00743110157'); // true
|
|
9
|
+
* ```;
|
|
10
|
+
*
|
|
11
|
+
* @param arg - The VAT identifier including its two letter country prefix.
|
|
12
|
+
*
|
|
13
|
+
* @returns `true` when the prefix is not `IT`, or when the 11 digit Italian part passes {@link checkPIVA}; otherwise `false`.
|
|
14
|
+
*
|
|
15
|
+
* @see {@link checkPIVA}
|
|
5
16
|
*/
|
|
6
17
|
export function checkPIVAseIT(arg: string): boolean {
|
|
7
18
|
const paese = arg.substring(0, 2);
|
|
@@ -2,6 +2,17 @@ import { addPIVA } from './add-piva.ts';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description Validates Italian VAT numbers (PIVA)
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* checkPIVA('00743110157'); // 0
|
|
9
|
+
* ```;
|
|
10
|
+
*
|
|
11
|
+
* @param arg - The Italian VAT number without the `IT` prefix.
|
|
12
|
+
*
|
|
13
|
+
* @returns `0` when valid, otherwise the non-zero remainder of {@link addPIVA}, or `1` when `arg` contains a non-digit.
|
|
14
|
+
*
|
|
15
|
+
* @see {@link addPIVA}
|
|
5
16
|
*/
|
|
6
17
|
export function checkPIVA(arg: string): number {
|
|
7
18
|
if (!/^\d+$/.test(arg)) return 1;
|
|
@@ -2,6 +2,15 @@ import { normalizeSpace } from './normalize-space.ts';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description Validates Swedish organization numbers (0007)
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* checkSEOrgnr('5560160680'); // true
|
|
9
|
+
* ```;
|
|
10
|
+
*
|
|
11
|
+
* @param number - The organization number to validate. Whitespace is normalised first.
|
|
12
|
+
*
|
|
13
|
+
* @returns `true` when the normalised number is 10 digits and its Luhn check digit matches, otherwise `false`.
|
|
5
14
|
*/
|
|
6
15
|
export function checkSEOrgnr(number: string): boolean {
|
|
7
16
|
const s = normalizeSpace(number);
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @description Greek TIN verification.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* greekTinVerification('123456783'); // true
|
|
7
|
+
* ```;
|
|
8
|
+
*
|
|
9
|
+
* @param val - The nine digit Greek tax identification number.
|
|
10
|
+
*
|
|
11
|
+
* @returns `true` when the value is nine digits and the computed checksum matches the last digit, otherwise `false`.
|
|
3
12
|
*/
|
|
4
13
|
export function greekTinVerification(val: string): boolean {
|
|
5
14
|
if (!/^\d{9}$/.test(val)) return false;
|
|
@@ -2,6 +2,15 @@ import { normalizeSpace } from './normalize-space.ts';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description Australian Business Number (ABN) validation.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* isValidABN('51 824 753 556'); // true
|
|
9
|
+
* ```;
|
|
10
|
+
*
|
|
11
|
+
* @param val - The ABN to validate. Whitespace is normalised first.
|
|
12
|
+
*
|
|
13
|
+
* @returns `true` when the normalised value is 11 digits and the weighted checksum is divisible by 89, otherwise `false`.
|
|
5
14
|
*/
|
|
6
15
|
export function isValidABN(val: string): boolean {
|
|
7
16
|
const s = normalizeSpace(val);
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @description [GLN](https://en.wikipedia.org/wiki/Global_Location_Number) check (GS1)
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* isValidGLN('1234567890128'); // { success: true }
|
|
7
|
+
* ```;
|
|
8
|
+
*
|
|
9
|
+
* @param val - The GLN to validate. Whitespace is stripped first.
|
|
10
|
+
*
|
|
11
|
+
* @returns `{ success: true }` when the computed check digit matches the last digit, otherwise `{ success: false, expected, actual }` with the
|
|
12
|
+
* computed and supplied check digits.
|
|
3
13
|
*/
|
|
4
14
|
export function isValidGLN(val: string): { success: true } | { success: false; expected: number; actual: number } {
|
|
5
15
|
const value = (val ?? '').replace(/\s+/g, '');
|
|
@@ -2,6 +2,16 @@ import { normalizeSpace } from './normalize-space.ts';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description IBAN validation using mod 97 algorithm.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* isValidIBAN('GB82 WEST 1234 5698 7654 32'); // true
|
|
9
|
+
* ```;
|
|
10
|
+
*
|
|
11
|
+
* @param iban - The IBAN to validate, with or without spaces.
|
|
12
|
+
*
|
|
13
|
+
* @returns `true` when the normalised value matches the `{2 letters}{2 digits}{up to 30 alphanumerics}` shape and its mod 97 remainder is 1,
|
|
14
|
+
* otherwise `false`.
|
|
5
15
|
*/
|
|
6
16
|
export function isValidIBAN(iban: string): boolean {
|
|
7
17
|
const s = normalizeSpace(iban).replace(/[ \t\r\n]/g, '');
|
|
@@ -2,6 +2,15 @@ import { normalizeSpace } from './normalize-space.ts';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description Validates Norwegian organization numbers using mod11 algorithm.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* isValidMod11('923609016'); // true
|
|
9
|
+
* ```;
|
|
10
|
+
*
|
|
11
|
+
* @param val - The organization number to validate. Whitespace is normalised first.
|
|
12
|
+
*
|
|
13
|
+
* @returns `true` when the normalised value is at least two digits and its mod 11 check digit matches, otherwise `false`.
|
|
5
14
|
*/
|
|
6
15
|
export function isValidMod11(val: string): boolean {
|
|
7
16
|
const s = normalizeSpace(val);
|
|
@@ -2,6 +2,16 @@ import { normalizeSpace } from './normalize-space.ts';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description Belgian enterprise number validation (mod 97-0208)
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* isValidMod97_0208('0123456749'); // { success: true }
|
|
9
|
+
* ```;
|
|
10
|
+
*
|
|
11
|
+
* @param val - The enterprise number to validate. Whitespace is normalised first.
|
|
12
|
+
*
|
|
13
|
+
* @returns `{ success: true }` when the last two digits equal `97 - (first eight digits % 97)`, otherwise `{ success: false, expected, actual }` with
|
|
14
|
+
* the computed and supplied check digits.
|
|
5
15
|
*/
|
|
6
16
|
export function isValidMod97_0208(val: string): { success: true } | { success: false; expected: number; actual: number } {
|
|
7
17
|
const s = normalizeSpace(val);
|
|
@@ -2,6 +2,15 @@ import { normalizeSpace } from './normalize-space.ts';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description Luhn algorithm check (used for credit card validation)
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* luhnCheck('4242424242424242'); // true
|
|
9
|
+
* ```;
|
|
10
|
+
*
|
|
11
|
+
* @param number - The numeric string to check. Whitespace is normalised first.
|
|
12
|
+
*
|
|
13
|
+
* @returns `true` when the value contains only digits and its Luhn checksum is divisible by 10, otherwise `false`.
|
|
5
14
|
*/
|
|
6
15
|
export function luhnCheck(number: string): boolean {
|
|
7
16
|
const s = normalizeSpace(number);
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description The default PEPPOL BIS Billing 3.0 customization identifier, which identifies the EN 16931 compliant billing rule set. Used as the decoding default
|
|
3
|
+
* for the `customizationId` field of {@link PeppolBillingBase}.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* DEFAULT_CUSTOMIZATION_ID; // 'urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0'
|
|
8
|
+
* ```;
|
|
9
|
+
*/
|
|
1
10
|
export const DEFAULT_CUSTOMIZATION_ID = 'urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0' as const;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description The default PEPPOL BIS Billing 3.0 profile identifier, which identifies the billing process the document follows. Used as the decoding default for
|
|
3
|
+
* the `profileId` field of {@link PeppolBillingBase}.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* DEFAULT_PROFILE_ID; // 'urn:fdc:peppol.eu:2017:poacc:billing:01:1.0'
|
|
8
|
+
* ```;
|
|
9
|
+
*/
|
|
1
10
|
export const DEFAULT_PROFILE_ID = 'urn:fdc:peppol.eu:2017:poacc:billing:01:1.0' as const;
|
|
@@ -3,8 +3,19 @@ import { Schema } from 'effect';
|
|
|
3
3
|
import { PeppolBinaryObject } from '#/schemas/fields/peppol-binary-object-schema.ts';
|
|
4
4
|
import { PeppolIdentifier } from '#/schemas/fields/peppol-identifier-schema.ts';
|
|
5
5
|
import { opaque } from '#/schemas/utils/opaque.ts';
|
|
6
|
-
import {
|
|
6
|
+
import { PeppolAdditionalDocumentReferenceCode } from '#/schemas/values/additional-document-reference-code-schema.ts';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @description A reference to a supporting document that is stored outside the Invoice, identified by a URI. Wraps the `cac:ExternalReference` element of an
|
|
10
|
+
* attachment group.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* { uri: 'http://www.example.com/index.html' }
|
|
15
|
+
* ```;
|
|
16
|
+
*
|
|
17
|
+
* @see {@link PeppolAttachment}
|
|
18
|
+
*/
|
|
8
19
|
export class PeppolAttachmentExternalReference extends opaque<PeppolAttachmentExternalReference>()(
|
|
9
20
|
Schema.Struct({
|
|
10
21
|
/**
|
|
@@ -22,6 +33,23 @@ export class PeppolAttachmentExternalReference extends opaque<PeppolAttachmentEx
|
|
|
22
33
|
})
|
|
23
34
|
) {}
|
|
24
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @description The attachment of a supporting document to the Invoice, either embedded as a Base64 binary object or referenced by URI. Wraps the `cac:Attachment`
|
|
38
|
+
* element of an additional supporting document.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* {
|
|
43
|
+
* embeddedDocumentBinaryObject: {
|
|
44
|
+
* content: 'aHR0cHM6Ly90ZXN0LXZlZmEuZGlmaS5uby9wZXBwb2xiaXM=',
|
|
45
|
+
* mimeCode: 'text/csv',
|
|
46
|
+
* filename: 'Hours - spent.csv'
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* ```;
|
|
50
|
+
*
|
|
51
|
+
* @see {@link PeppolAdditionalDocumentReference}
|
|
52
|
+
*/
|
|
25
53
|
export class PeppolAttachment extends opaque<PeppolAttachment>()(
|
|
26
54
|
Schema.Struct({
|
|
27
55
|
/**
|
|
@@ -46,26 +74,39 @@ export class PeppolAttachment extends opaque<PeppolAttachment>()(
|
|
|
46
74
|
})
|
|
47
75
|
) {}
|
|
48
76
|
|
|
77
|
+
/**
|
|
78
|
+
* @description The identifier of an additional supporting document, an invoiced object reference or a project reference, together with an optional identification
|
|
79
|
+
* scheme identifier.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* { id: '9873242' }
|
|
84
|
+
* ```;
|
|
85
|
+
*
|
|
86
|
+
* @see {@link PeppolAdditionalDocumentReference}
|
|
87
|
+
*/
|
|
49
88
|
export class PeppolId extends opaque<PeppolId>()(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
89
|
+
PeppolIdentifier.pipe(
|
|
90
|
+
Schema.fieldsAssign({
|
|
91
|
+
/**
|
|
92
|
+
* @description An identifier for an object on which the invoice is based (with DocumentTypeCode=130), given by the Seller, the identifier for the supporting
|
|
93
|
+
* document or the project reference identifier (DocumentTypeCode=50).
|
|
94
|
+
*
|
|
95
|
+
* @summary Invoiced object identifier, Supporting document reference or project reference
|
|
96
|
+
*
|
|
97
|
+
* @name `#text`
|
|
98
|
+
*/
|
|
99
|
+
id: Schema.String,
|
|
100
|
+
/**
|
|
101
|
+
* @description The identification scheme identifier of the Invoiced object identifier.
|
|
102
|
+
*
|
|
103
|
+
* @summary Scheme identifier
|
|
104
|
+
*
|
|
105
|
+
* @name `@schemeID`
|
|
106
|
+
*/
|
|
107
|
+
schemeId: Schema.optional(PeppolAdditionalDocumentReferenceCode),
|
|
108
|
+
})
|
|
109
|
+
)
|
|
69
110
|
) {}
|
|
70
111
|
|
|
71
112
|
/**
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
2
|
|
|
3
3
|
import { opaque } from '#/schemas/utils/opaque.ts';
|
|
4
|
-
import {
|
|
4
|
+
import { PeppolCountryCodeValue } from '#/schemas/values/peppol-country-code-schema.ts';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @description An additional address line that supplements the main address line. Wraps the `cac:AddressLine` element, whose `cbc:Line` value carries the text.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* { line: 'Building 23' }
|
|
12
|
+
* ```;
|
|
13
|
+
*
|
|
14
|
+
* @see {@link PeppolAddress}
|
|
15
|
+
*/
|
|
6
16
|
export class PeppolAddressLine extends opaque<PeppolAddressLine>()(
|
|
7
17
|
Schema.Struct({
|
|
8
18
|
/**
|
|
@@ -16,6 +26,16 @@ export class PeppolAddressLine extends opaque<PeppolAddressLine>()(
|
|
|
16
26
|
})
|
|
17
27
|
) {}
|
|
18
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @description The country of an address, expressed as a two-letter ISO 3166-1 alpha-2 code. Wraps the `cac:Country` element and its `cbc:IdentificationCode`.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* { identificationCode: 'GB' }
|
|
35
|
+
* ```;
|
|
36
|
+
*
|
|
37
|
+
* @see {@link PeppolAddress}
|
|
38
|
+
*/
|
|
19
39
|
export class PeppolCountryCode extends opaque<PeppolCountryCode>()(
|
|
20
40
|
Schema.Struct({
|
|
21
41
|
/**
|
|
@@ -28,11 +48,14 @@ export class PeppolCountryCode extends opaque<PeppolCountryCode>()(
|
|
|
28
48
|
*
|
|
29
49
|
* @name `cbc:IdentificationCode`
|
|
30
50
|
*/
|
|
31
|
-
identificationCode:
|
|
51
|
+
identificationCode: PeppolCountryCodeValue,
|
|
32
52
|
})
|
|
33
53
|
) {}
|
|
34
54
|
|
|
35
55
|
/**
|
|
56
|
+
* @description The postal address of a party, used for the seller, buyer, payee and delivery locations. Carries the street lines, city, postal zone, country
|
|
57
|
+
* subdivision, country code and optional additional address lines.
|
|
58
|
+
*
|
|
36
59
|
* @summary Postal address
|
|
37
60
|
*
|
|
38
61
|
* @name `cac:PostalAddress`
|