@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
|
@@ -3,7 +3,7 @@ import { Effect, Schema } from 'effect';
|
|
|
3
3
|
import { DEFAULT_CUSTOMIZATION_ID } from '#/schemas/fields/default-customization-id.ts';
|
|
4
4
|
import { DEFAULT_PROFILE_ID } from '#/schemas/fields/default-profile-id.ts';
|
|
5
5
|
import { PeppolAdditionalDocumentReference } from '#/schemas/fields/peppol-additional-document-reference-schema.ts';
|
|
6
|
-
import {
|
|
6
|
+
import { PeppolAllowanceCharge } from '#/schemas/fields/peppol-allowance-charge-schema.ts';
|
|
7
7
|
import { PeppolBillingReference } from '#/schemas/fields/peppol-billing-reference-schema.ts';
|
|
8
8
|
import { PeppolDelivery } from '#/schemas/fields/peppol-delivery-schema.ts';
|
|
9
9
|
import { PeppolInvoicePeriod } from '#/schemas/fields/peppol-invoice-period-schema.ts';
|
|
@@ -14,11 +14,21 @@ import { PeppolPayeeParty } from '#/schemas/fields/peppol-payee-party-schema.ts'
|
|
|
14
14
|
import { PeppolPaymentMeans } from '#/schemas/fields/peppol-payment-means-schema.ts';
|
|
15
15
|
import { PeppolPaymentTerms } from '#/schemas/fields/peppol-payment-terms-schema.ts';
|
|
16
16
|
import { PeppolTaxRepresentative } from '#/schemas/fields/peppol-tax-representative-schema.ts';
|
|
17
|
-
import {
|
|
17
|
+
import { PeppolTaxTotal } from '#/schemas/fields/peppol-tax-totals-base-schema.ts';
|
|
18
18
|
import { PeppolIsoDateString } from '#/schemas/peppol-iso-date-string.ts';
|
|
19
19
|
import { opaque } from '#/schemas/utils/opaque.ts';
|
|
20
|
-
import {
|
|
20
|
+
import { PeppolCurrencyCode } from '#/schemas/values/currency-code-schema.ts';
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* @description Wraps the `cac:ContractDocumentReference` element: an identifier of a contract that the billing document references.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* { id: '123Contractref' }
|
|
28
|
+
* ```;
|
|
29
|
+
*
|
|
30
|
+
* @see {@link PeppolBillingBase}
|
|
31
|
+
*/
|
|
22
32
|
export class PeppolContractDocumentReference extends opaque<PeppolContractDocumentReference>()(
|
|
23
33
|
Schema.Struct({
|
|
24
34
|
/**
|
|
@@ -35,6 +45,16 @@ export class PeppolContractDocumentReference extends opaque<PeppolContractDocume
|
|
|
35
45
|
})
|
|
36
46
|
) {}
|
|
37
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @description Wraps the `cac:OriginatorDocumentReference` element: the identification of the call for tender or lot the invoice relates to.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* { id: 'PPID-123' }
|
|
54
|
+
* ```;
|
|
55
|
+
*
|
|
56
|
+
* @see {@link PeppolBillingBase}
|
|
57
|
+
*/
|
|
38
58
|
export class PeppolOriginatorDocumentReference extends opaque<PeppolOriginatorDocumentReference>()(
|
|
39
59
|
Schema.Struct({
|
|
40
60
|
/**
|
|
@@ -51,6 +71,16 @@ export class PeppolOriginatorDocumentReference extends opaque<PeppolOriginatorDo
|
|
|
51
71
|
})
|
|
52
72
|
) {}
|
|
53
73
|
|
|
74
|
+
/**
|
|
75
|
+
* @description Wraps the `cac:ReceiptDocumentReference` element: an identifier of a referenced receiving advice.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* { id: 'rec98' }
|
|
80
|
+
* ```;
|
|
81
|
+
*
|
|
82
|
+
* @see {@link PeppolBillingBase}
|
|
83
|
+
*/
|
|
54
84
|
export class PeppolReceiptDocumentReference extends opaque<PeppolReceiptDocumentReference>()(
|
|
55
85
|
Schema.Struct({
|
|
56
86
|
/**
|
|
@@ -67,6 +97,16 @@ export class PeppolReceiptDocumentReference extends opaque<PeppolReceiptDocument
|
|
|
67
97
|
})
|
|
68
98
|
) {}
|
|
69
99
|
|
|
100
|
+
/**
|
|
101
|
+
* @description Wraps the `cac:DespatchDocumentReference` element: an identifier of a referenced despatch advice.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* { id: 'desp98' }
|
|
106
|
+
* ```;
|
|
107
|
+
*
|
|
108
|
+
* @see {@link PeppolBillingBase}
|
|
109
|
+
*/
|
|
70
110
|
export class PeppolDespatchDocumentReference extends opaque<PeppolDespatchDocumentReference>()(
|
|
71
111
|
Schema.Struct({
|
|
72
112
|
/**
|
|
@@ -86,8 +126,8 @@ export class PeppolDespatchDocumentReference extends opaque<PeppolDespatchDocume
|
|
|
86
126
|
/**
|
|
87
127
|
* @description Base schema for a billing document.
|
|
88
128
|
*
|
|
89
|
-
* @see {@link
|
|
90
|
-
* @see {@link
|
|
129
|
+
* @see {@link PeppolCreditNote} - the credit note schema
|
|
130
|
+
* @see {@link PeppolInvoice} - the invoice schema
|
|
91
131
|
*/
|
|
92
132
|
export class PeppolBillingBase extends opaque<PeppolBillingBase>()(
|
|
93
133
|
Schema.Struct({
|
|
@@ -182,7 +222,7 @@ export class PeppolBillingBase extends opaque<PeppolBillingBase>()(
|
|
|
182
222
|
*
|
|
183
223
|
* @name `cbc:DocumentCurrencyCode`
|
|
184
224
|
*/
|
|
185
|
-
documentCurrencyCode:
|
|
225
|
+
documentCurrencyCode: PeppolCurrencyCode,
|
|
186
226
|
/**
|
|
187
227
|
* @description The currency used for VAT accounting and reporting purposes as accepted or required in the country of the Seller. Shall be used in combination
|
|
188
228
|
* with the Invoice total VAT amount in accounting currency (BT-111), when the VAT accounting currency code differs from the Invoice currency
|
|
@@ -195,7 +235,7 @@ export class PeppolBillingBase extends opaque<PeppolBillingBase>()(
|
|
|
195
235
|
*
|
|
196
236
|
* @name `cbc:TaxCurrencyCode`
|
|
197
237
|
*/
|
|
198
|
-
taxCurrencyCode: Schema.optional(
|
|
238
|
+
taxCurrencyCode: Schema.optional(PeppolCurrencyCode),
|
|
199
239
|
/**
|
|
200
240
|
* @description A textual value that specifies where to book the relevant data into the Buyer's financial accounts.
|
|
201
241
|
*
|
|
@@ -345,7 +385,7 @@ export class PeppolBillingBase extends opaque<PeppolBillingBase>()(
|
|
|
345
385
|
*
|
|
346
386
|
* @name cac:AllowanceCharge
|
|
347
387
|
*/
|
|
348
|
-
allowanceCharges: Schema.optional(Schema.Array(
|
|
388
|
+
allowanceCharges: Schema.optional(Schema.Array(PeppolAllowanceCharge)),
|
|
349
389
|
|
|
350
390
|
/**
|
|
351
391
|
* @description When tax currency code is provided, two instances of the tax total must be present, but only one with tax subtotal.
|
|
@@ -354,7 +394,7 @@ export class PeppolBillingBase extends opaque<PeppolBillingBase>()(
|
|
|
354
394
|
*
|
|
355
395
|
* @name cac:TaxTotal
|
|
356
396
|
*/
|
|
357
|
-
taxTotals: Schema.Array(
|
|
397
|
+
taxTotals: Schema.Array(PeppolTaxTotal).check(Schema.isMinLength(1), Schema.isMaxLength(2)),
|
|
358
398
|
|
|
359
399
|
/**
|
|
360
400
|
* @summary DOCUMENT TOTALS
|
|
@@ -3,7 +3,7 @@ import { Schema } from 'effect';
|
|
|
3
3
|
import { PeppolCreditNoteLine } from '#/schemas/fields/peppol-credit-note-line-schema.ts';
|
|
4
4
|
import { PeppolBillingBase } from '#/schemas/peppol-billing-base-schema.ts';
|
|
5
5
|
import { opaque } from '#/schemas/utils/opaque.ts';
|
|
6
|
-
import {
|
|
6
|
+
import { PeppolCreditNoteTypeCode } from '#/schemas/values/credit-note-type-code-schema.ts';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @description Main UBL Credit Note schema (camelCase properties) Effect port of `creditNoteSchema` (`z.extend(billingBaseSchema, ...)` →
|
|
@@ -26,6 +26,6 @@ export class PeppolCreditNote extends opaque<PeppolCreditNote>()(
|
|
|
26
26
|
*
|
|
27
27
|
* @name cbc:CreditNoteTypeCode
|
|
28
28
|
*/
|
|
29
|
-
creditNoteTypeCode:
|
|
29
|
+
creditNoteTypeCode: PeppolCreditNoteTypeCode,
|
|
30
30
|
})
|
|
31
31
|
) {}
|
|
@@ -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 { PeppolDocumentTypeCode } from '#/schemas/values/peppol-document-type-code-schema.ts';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @description Wraps `cac:DocumentReference` inside a message level response: identifies the business document the response is based on.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* { id: 'EnvelopeID-12345', versionId: '2' }
|
|
12
|
+
* ```;
|
|
13
|
+
*
|
|
14
|
+
* @see {@link PeppolMessageLevelResponseDocumentResponse}
|
|
15
|
+
*/
|
|
6
16
|
export class PeppolDocumentResponseDocumentReference extends opaque<PeppolDocumentResponseDocumentReference>()(
|
|
7
17
|
Schema.Struct({
|
|
8
18
|
/**
|
|
@@ -23,7 +33,7 @@ export class PeppolDocumentResponseDocumentReference extends opaque<PeppolDocume
|
|
|
23
33
|
*
|
|
24
34
|
* @name `cbc:DocumentTypeCode`
|
|
25
35
|
*/
|
|
26
|
-
documentTypeCode: Schema.optional(
|
|
36
|
+
documentTypeCode: Schema.optional(PeppolDocumentTypeCode),
|
|
27
37
|
/**
|
|
28
38
|
* @description The version of the document that has been identifier with the document identifier.
|
|
29
39
|
*
|
|
@@ -37,5 +47,3 @@ export class PeppolDocumentResponseDocumentReference extends opaque<PeppolDocume
|
|
|
37
47
|
versionId: Schema.optional(Schema.String),
|
|
38
48
|
})
|
|
39
49
|
) {}
|
|
40
|
-
|
|
41
|
-
export type PeppolMessageLevelDocumentResponseDocumentReference = PeppolDocumentResponseDocumentReference;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
2
|
|
|
3
3
|
import { opaque } from '#/schemas/utils/opaque.ts';
|
|
4
|
-
import {
|
|
4
|
+
import { PeppolApplicationResponseTypeCode } from '#/schemas/values/application-response-type-code-schema.ts';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
+
* @description Wraps `cac:Response` inside a message level response: the overall response code and an optional textual note.
|
|
8
|
+
*
|
|
7
9
|
* @summary Response information
|
|
8
10
|
*
|
|
9
11
|
* @name `cac:Response`
|
|
10
12
|
*
|
|
11
13
|
* @cardinality (1..1)
|
|
12
14
|
*
|
|
13
|
-
* @see {@link
|
|
15
|
+
* @see {@link PeppolMessageLevelResponseDocumentResponse}
|
|
14
16
|
*/
|
|
15
17
|
export class PeppolDocumentResponseDocument extends opaque<PeppolDocumentResponseDocument>()(
|
|
16
18
|
Schema.Struct({
|
|
@@ -25,7 +27,7 @@ export class PeppolDocumentResponseDocument extends opaque<PeppolDocumentRespons
|
|
|
25
27
|
*
|
|
26
28
|
* @name `cbc:ResponseCode`
|
|
27
29
|
*/
|
|
28
|
-
responseCode:
|
|
30
|
+
responseCode: PeppolApplicationResponseTypeCode,
|
|
29
31
|
/**
|
|
30
32
|
* @description Used to meake any comments or instructions relevant to the response. The use of this element requires manual assessment by the receiver.
|
|
31
33
|
*
|
|
@@ -34,5 +36,3 @@ export class PeppolDocumentResponseDocument extends opaque<PeppolDocumentRespons
|
|
|
34
36
|
description: Schema.optional(Schema.String),
|
|
35
37
|
})
|
|
36
38
|
) {}
|
|
37
|
-
|
|
38
|
-
export type PeppolMessageLevelResponseDocumentResponseDocument = PeppolDocumentResponseDocument;
|
|
@@ -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 { PeppolApplicationResponseTypeCode } from '#/schemas/values/application-response-type-code-schema.ts';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @description Wraps `cac:Status` inside a line response: the coded reason for an issue found in the document.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* { statusReasonCode: 'SV' }
|
|
12
|
+
* ```;
|
|
13
|
+
*
|
|
14
|
+
* @see {@link PeppolDocumentResponseLineResponseContent}
|
|
15
|
+
*/
|
|
6
16
|
export class PeppolStatus extends opaque<PeppolStatus>()(
|
|
7
17
|
Schema.Struct({
|
|
8
18
|
/**
|
|
@@ -16,6 +26,16 @@ export class PeppolStatus extends opaque<PeppolStatus>()(
|
|
|
16
26
|
})
|
|
17
27
|
) {}
|
|
18
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @description A response to a particular line in the business document: the line response code, a description of the issue and its coded status.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* { responseCode: 'RE', description: 'Validation gives error [CL-T77-R0002]', status: { statusReasonCode: 'SV' } }
|
|
35
|
+
* ```;
|
|
36
|
+
*
|
|
37
|
+
* @see {@link PeppolDocumentResponseLineResponse}
|
|
38
|
+
*/
|
|
19
39
|
export class PeppolDocumentResponseLineResponseContent extends opaque<PeppolDocumentResponseLineResponseContent>()(
|
|
20
40
|
Schema.Struct({
|
|
21
41
|
/**
|
|
@@ -29,7 +49,7 @@ export class PeppolDocumentResponseLineResponseContent extends opaque<PeppolDocu
|
|
|
29
49
|
*
|
|
30
50
|
* @name `cbc:ResponseCode`
|
|
31
51
|
*/
|
|
32
|
-
responseCode:
|
|
52
|
+
responseCode: PeppolApplicationResponseTypeCode,
|
|
33
53
|
/**
|
|
34
54
|
* @description The description of the issued identifier in the transaction document.
|
|
35
55
|
*
|
|
@@ -3,6 +3,16 @@ import { Schema } from 'effect';
|
|
|
3
3
|
import { PeppolDocumentResponseLineResponseContent } from '#/schemas/peppol-document-response-line-response-content-schema.ts';
|
|
4
4
|
import { opaque } from '#/schemas/utils/opaque.ts';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @description Wraps `cac:LineReference` inside a line response: an XPath pointing at the element that caused the reported issue.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* { lineId: '/Invoice/cac:InvoiceLine[1]' }
|
|
12
|
+
* ```;
|
|
13
|
+
*
|
|
14
|
+
* @see {@link PeppolDocumentResponseLineResponse}
|
|
15
|
+
*/
|
|
6
16
|
export class PeppolLineReference extends opaque<PeppolLineReference>()(
|
|
7
17
|
Schema.Struct({
|
|
8
18
|
/**
|
|
@@ -20,6 +30,19 @@ export class PeppolLineReference extends opaque<PeppolLineReference>()(
|
|
|
20
30
|
})
|
|
21
31
|
) {}
|
|
22
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @description Wraps `cac:LineResponse` inside a message level response: pairs a line reference with the response for that line.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* {
|
|
39
|
+
* lineReference: { lineId: '/Invoice/cac:InvoiceLine[1]' },
|
|
40
|
+
* response: { responseCode: 'RE', description: 'Invalid tax category', status: { statusReasonCode: 'SV' } }
|
|
41
|
+
* }
|
|
42
|
+
* ```;
|
|
43
|
+
*
|
|
44
|
+
* @see {@link PeppolMessageLevelResponseDocumentResponse}
|
|
45
|
+
*/
|
|
23
46
|
export class PeppolDocumentResponseLineResponse extends opaque<PeppolDocumentResponseLineResponse>()(
|
|
24
47
|
Schema.Struct({
|
|
25
48
|
/**
|
|
@@ -36,5 +59,3 @@ export class PeppolDocumentResponseLineResponse extends opaque<PeppolDocumentRes
|
|
|
36
59
|
response: PeppolDocumentResponseLineResponseContent,
|
|
37
60
|
})
|
|
38
61
|
) {}
|
|
39
|
-
|
|
40
|
-
export type PeppolMessageLevelDocumentResponseLineResponse = PeppolDocumentResponseLineResponse;
|
|
@@ -37,9 +37,49 @@ type PeppolDocumentObject = typeof peppolDocumentObjectSchema.Encoded;
|
|
|
37
37
|
|
|
38
38
|
const parseXml = (value: string): XmlNode => parseXmlNodable(value);
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @description Type guard that returns `true` when a decoded value is a {@link PeppolInvoice}.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* isPeppolInvoice(doc); // true for a UBL Invoice
|
|
46
|
+
* ```;
|
|
47
|
+
*
|
|
48
|
+
* @see {@link PeppolDocumentSchema}
|
|
49
|
+
*/
|
|
40
50
|
export const isPeppolInvoice = Schema.is(PeppolInvoice);
|
|
51
|
+
/**
|
|
52
|
+
* @description Type guard that returns `true` when a decoded value is a {@link PeppolCreditNote}.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* isPeppolCreditNote(doc); // true for a UBL CreditNote
|
|
57
|
+
* ```;
|
|
58
|
+
*
|
|
59
|
+
* @see {@link PeppolDocumentSchema}
|
|
60
|
+
*/
|
|
41
61
|
export const isPeppolCreditNote = Schema.is(PeppolCreditNote);
|
|
62
|
+
/**
|
|
63
|
+
* @description Type guard that returns `true` when a decoded value is a {@link PeppolMessageLevelResponse}.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* isPeppolMessageLevelResponse(doc); // true for an MLR ApplicationResponse
|
|
68
|
+
* ```;
|
|
69
|
+
*
|
|
70
|
+
* @see {@link PeppolDocumentSchema}
|
|
71
|
+
*/
|
|
42
72
|
export const isPeppolMessageLevelResponse = Schema.is(PeppolMessageLevelResponse);
|
|
73
|
+
/**
|
|
74
|
+
* @description Type guard that returns `true` when a decoded value is a {@link PeppolInvoiceResponse}.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* isPeppolInvoiceResponse(doc); // true for an invoice response ApplicationResponse
|
|
79
|
+
* ```;
|
|
80
|
+
*
|
|
81
|
+
* @see {@link PeppolDocumentSchema}
|
|
82
|
+
*/
|
|
43
83
|
export const isPeppolInvoiceResponse = Schema.is(PeppolInvoiceResponse);
|
|
44
84
|
|
|
45
85
|
/**
|
|
@@ -85,7 +125,8 @@ const encodeDocumentXml = Effect.fn('encode-peppol-document-xml')(function* (val
|
|
|
85
125
|
} else {
|
|
86
126
|
const rootNodes = Object.keys(value);
|
|
87
127
|
return yield* Effect.fail(
|
|
88
|
-
|
|
128
|
+
// oxlint-disable-next-line typescript/no-explicit-any this is safe since it is only for logging purposes
|
|
129
|
+
new SchemaIssue.InvalidValue({ message: `Unsupported document type: ${(value as any)?.profileId}\n${rootNodes.join(',')}` }, value, options)
|
|
89
130
|
);
|
|
90
131
|
}
|
|
91
132
|
|
|
@@ -94,17 +135,33 @@ const encodeDocumentXml = Effect.fn('encode-peppol-document-xml')(function* (val
|
|
|
94
135
|
|
|
95
136
|
/**
|
|
96
137
|
* @description Union of every supported PEPPOL business document. Members discriminate cleanly: invoice vs credit note via `invoiceLines`/`creditNoteLines`,
|
|
97
|
-
* message-level vs invoice response via the `profileId` literal.
|
|
138
|
+
* message-level vs invoice response via the `profileId` literal. Decodes and encodes XML strings by dispatching on the root element;
|
|
139
|
+
* `ApplicationResponse` is split on `cbc:ProfileID`.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* const doc = Schema.decodeUnknownSync(PeppolDocumentSchema)(xml); // decoded document union
|
|
144
|
+
* ```;
|
|
145
|
+
*
|
|
146
|
+
* @see {@link PeppolDocumentDecoded}
|
|
147
|
+
* @see {@link PeppolDocumentEncoded}
|
|
98
148
|
*/
|
|
99
|
-
export
|
|
149
|
+
export class PeppolDocumentSchema extends peppolDocumentObjectSchema.pipe(
|
|
100
150
|
Schema.encodeTo(Schema.String, {
|
|
101
151
|
encode: SchemaGetter.transformEffect((value, options) => encodeDocumentXml(value, options)),
|
|
102
152
|
decode: SchemaGetter.transformEffect((value, options) => decodeDocumentXml(value, options)),
|
|
103
153
|
})
|
|
104
|
-
)
|
|
154
|
+
) {}
|
|
105
155
|
|
|
106
|
-
|
|
107
|
-
|
|
156
|
+
/**
|
|
157
|
+
* @description Encoded form of {@link PeppolDocumentSchema}: the XML string representation.
|
|
158
|
+
*/
|
|
159
|
+
export type PeppolDocumentEncoded = Schema.Codec.Encoded<typeof PeppolDocumentSchema>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @description Decoded form of {@link PeppolDocumentSchema}: the union of supported document classes.
|
|
163
|
+
*/
|
|
164
|
+
export type PeppolDocumentDecoded = Schema.Schema.Type<typeof PeppolDocumentSchema>;
|
|
108
165
|
|
|
109
166
|
/**
|
|
110
167
|
* @description This defines the types of documents that are sent/received through the peppol network.
|
|
@@ -114,5 +171,11 @@ export type PeppolDocument = PeppolInvoice | PeppolCreditNote;
|
|
|
114
171
|
* @description This defines the types of message that are sent/received through the peppol network.
|
|
115
172
|
*/
|
|
116
173
|
export type PeppolMessage = PeppolMessageLevelResponse | PeppolInvoiceResponse;
|
|
174
|
+
/**
|
|
175
|
+
* @description Every document type supported by {@link PeppolDocumentSchema}: the billing documents and the response messages.
|
|
176
|
+
*/
|
|
117
177
|
export type PeppolAllDocuments = PeppolDocument | PeppolMessage;
|
|
178
|
+
/**
|
|
179
|
+
* @description A line from either a {@link PeppolInvoice} or a {@link PeppolCreditNote}.
|
|
180
|
+
*/
|
|
118
181
|
export type PeppolDocumentLine = PeppolInvoiceLine | PeppolCreditNoteLine;
|
|
@@ -6,9 +6,40 @@ import { PeppolInvoiceResponseDocumentActualResponseStatus } from '#/schemas/pep
|
|
|
6
6
|
import { PeppolIsoDateString } from '#/schemas/peppol-iso-date-string.ts';
|
|
7
7
|
import { opaque } from '#/schemas/utils/opaque.ts';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* @description Response codes that require a clarification in `cac:Status`: `UQ`, `RE` and `CA`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* withStatusCodes; // Schema.Literals(['UQ', 'RE', 'CA'])
|
|
15
|
+
* ```;
|
|
16
|
+
*
|
|
17
|
+
* @see {@link PeppolInvoiceResponseDocumentActualResponseWithStatus}
|
|
18
|
+
*/
|
|
9
19
|
export const withStatusCodes = Schema.Literals(invoiceResponseCodeNeedsSchema);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @description Response codes that do not require a clarification in `cac:Status`: `AB`, `AP`, `IP` and `PD`.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* withoutStatusCodes; // Schema.Literals(['AB', 'AP', 'IP', 'PD'])
|
|
27
|
+
* ```;
|
|
28
|
+
*
|
|
29
|
+
* @see {@link PeppolInvoiceResponseDocumentActualResponseWithoutStatus}
|
|
30
|
+
*/
|
|
10
31
|
export const withoutStatusCodes = Schema.Literals(invoiceResponseCodeNotNeedsSchema);
|
|
11
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @description Invoice response for statuses that do not require a clarification; the `cac:Status` group is optional.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* { responseCode: 'AP', effectiveDate: '2018-08-02' }
|
|
39
|
+
* ```;
|
|
40
|
+
*
|
|
41
|
+
* @see {@link PeppolInvoiceResponseDocumentActualResponse}
|
|
42
|
+
*/
|
|
12
43
|
export class PeppolInvoiceResponseDocumentActualResponseWithoutStatus extends opaque<PeppolInvoiceResponseDocumentActualResponseWithoutStatus>()(
|
|
13
44
|
Schema.Struct({
|
|
14
45
|
/**
|
|
@@ -40,6 +71,16 @@ export class PeppolInvoiceResponseDocumentActualResponseWithoutStatus extends op
|
|
|
40
71
|
})
|
|
41
72
|
) {}
|
|
42
73
|
|
|
74
|
+
/**
|
|
75
|
+
* @description Invoice response for statuses that require a clarification; at least one `cac:Status` group is mandatory.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* { responseCode: 'RE', status: [{ statusReason: 'TAX reference not found' }] }
|
|
80
|
+
* ```;
|
|
81
|
+
*
|
|
82
|
+
* @see {@link PeppolInvoiceResponseDocumentActualResponse}
|
|
83
|
+
*/
|
|
43
84
|
export class PeppolInvoiceResponseDocumentActualResponseWithStatus extends opaque<PeppolInvoiceResponseDocumentActualResponseWithStatus>()(
|
|
44
85
|
Schema.Struct({
|
|
45
86
|
/**
|
|
@@ -74,9 +115,17 @@ export class PeppolInvoiceResponseDocumentActualResponseWithStatus extends opaqu
|
|
|
74
115
|
})
|
|
75
116
|
) {}
|
|
76
117
|
|
|
77
|
-
|
|
118
|
+
/**
|
|
119
|
+
* @description Union of the invoice response variants selected by `cbc:ResponseCode`: one that requires a clarification and one that does not.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* { responseCode: 'AP', effectiveDate: '2018-08-02' }
|
|
124
|
+
* ```;
|
|
125
|
+
*
|
|
126
|
+
* @see {@link PeppolInvoiceResponseDocumentResponse}
|
|
127
|
+
*/
|
|
128
|
+
export class PeppolInvoiceResponseDocumentActualResponse extends Schema.Union([
|
|
78
129
|
PeppolInvoiceResponseDocumentActualResponseWithStatus,
|
|
79
130
|
PeppolInvoiceResponseDocumentActualResponseWithoutStatus,
|
|
80
|
-
])
|
|
81
|
-
|
|
82
|
-
export type InvoiceResponseDocumentActualResponse = typeof peppolInvoiceResponseDocumentActualResponseSchema.Type;
|
|
131
|
+
]) {}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { PeppolInvoiceResponseStatusReasonCode } from '#/schemas/peppol-invoice-response-status-reason-code-schema.ts';
|
|
4
4
|
import { opaque } from '#/schemas/utils/opaque.ts';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @description Wraps `cac:Condition` inside a status: a detail code and its optional value that further explains the clarification.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* { attributeId: 'BT-75', description: 'EU123456789' }
|
|
12
|
+
* ```;
|
|
13
|
+
*
|
|
14
|
+
* @see {@link PeppolInvoiceResponseDocumentActualResponseStatus}
|
|
15
|
+
*/
|
|
6
16
|
export class PeppolInvoiceResponseCondition extends opaque<PeppolInvoiceResponseCondition>()(
|
|
7
17
|
Schema.Struct({
|
|
8
18
|
/**
|
|
@@ -30,6 +40,16 @@ export class PeppolInvoiceResponseCondition extends opaque<PeppolInvoiceResponse
|
|
|
30
40
|
})
|
|
31
41
|
) {}
|
|
32
42
|
|
|
43
|
+
/**
|
|
44
|
+
* @description Wraps `cac:Status` inside an invoice response: an optional clarification code and description plus any condition details.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* { statusReasonCode: { value: 'REF', listId: 'OPStatusReason' }, statusReason: 'TAX reference not found' }
|
|
49
|
+
* ```;
|
|
50
|
+
*
|
|
51
|
+
* @see {@link PeppolInvoiceResponseDocumentActualResponse}
|
|
52
|
+
*/
|
|
33
53
|
export class PeppolInvoiceResponseDocumentActualResponseStatus extends opaque<PeppolInvoiceResponseDocumentActualResponseStatus>()(
|
|
34
54
|
Schema.Struct({
|
|
35
55
|
/**
|
|
@@ -39,7 +59,7 @@ export class PeppolInvoiceResponseDocumentActualResponseStatus extends opaque<Pe
|
|
|
39
59
|
*
|
|
40
60
|
* @name `cbc:StatusReasonCode`
|
|
41
61
|
*/
|
|
42
|
-
statusReasonCode: Schema.optional(
|
|
62
|
+
statusReasonCode: Schema.optional(PeppolInvoiceResponseStatusReasonCode),
|
|
43
63
|
/**
|
|
44
64
|
* @description The description of the clarification given for the invoice status.
|
|
45
65
|
*
|
|
@@ -59,5 +79,3 @@ export class PeppolInvoiceResponseDocumentActualResponseStatus extends opaque<Pe
|
|
|
59
79
|
condition: Schema.optional(Schema.Array(PeppolInvoiceResponseCondition)),
|
|
60
80
|
})
|
|
61
81
|
) {}
|
|
62
|
-
|
|
63
|
-
export type InvoiceResponseDocumentActualResponseStatus = PeppolInvoiceResponseDocumentActualResponseStatus;
|
|
@@ -4,13 +4,23 @@ import { INVOICE_RESPONSE_PROFILE_ID } from '#/constants/invoice-response-profil
|
|
|
4
4
|
import { PeppolContact } from '#/schemas/fields/peppol-contact-schema.ts';
|
|
5
5
|
import { PeppolIdentifier } from '#/schemas/fields/peppol-identifier-schema.ts';
|
|
6
6
|
import { PeppolPartyLegalEntity } from '#/schemas/fields/peppol-party-legal-entity-schema.ts';
|
|
7
|
-
import {
|
|
7
|
+
import { PeppolInvoiceResponseDocumentActualResponse } from '#/schemas/peppol-invoice-response-document-actual-response-schema.ts';
|
|
8
8
|
import { PeppolIsoDateString } from '#/schemas/peppol-iso-date-string.ts';
|
|
9
9
|
import { PeppolMessageLevelResponseParty } from '#/schemas/peppol-message-level-response-party-schema.ts';
|
|
10
10
|
import { PeppolMessageLevelResponse } from '#/schemas/peppol-message-level-response-schema.ts';
|
|
11
11
|
import { opaque } from '#/schemas/utils/opaque.ts';
|
|
12
|
-
import {
|
|
12
|
+
import { PeppolDocumentTypeCode } from '#/schemas/values/peppol-document-type-code-schema.ts';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @description Wraps `cac:PartyName` for the seller or buyer on an invoice response: the party's legal or trading name.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* { name: 'Seller Business Name AS' }
|
|
20
|
+
* ```;
|
|
21
|
+
*
|
|
22
|
+
* @see {@link PeppolInvoiceResponseDocumentResponseParty}
|
|
23
|
+
*/
|
|
14
24
|
export class PeppolInvoiceResponseDocumentResponsePartyName extends opaque<PeppolInvoiceResponseDocumentResponsePartyName>()(
|
|
15
25
|
Schema.Struct({
|
|
16
26
|
/**
|
|
@@ -25,6 +35,16 @@ export class PeppolInvoiceResponseDocumentResponsePartyName extends opaque<Peppo
|
|
|
25
35
|
})
|
|
26
36
|
) {}
|
|
27
37
|
|
|
38
|
+
/**
|
|
39
|
+
* @description Party used for the sender and receiver of an invoice response. Extends {@link PeppolMessageLevelResponseParty}.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* { partyLegalEntity: { registrationName: 'Seller Business Name AS' } }
|
|
44
|
+
* ```;
|
|
45
|
+
*
|
|
46
|
+
* @see {@link PeppolInvoiceResponse}
|
|
47
|
+
*/
|
|
28
48
|
export class PeppolInvoiceResponseParty extends opaque<PeppolInvoiceResponseParty>()(
|
|
29
49
|
PeppolMessageLevelResponseParty.pipe(
|
|
30
50
|
Schema.fieldsAssign({
|
|
@@ -37,6 +57,16 @@ export class PeppolInvoiceResponseParty extends opaque<PeppolInvoiceResponsePart
|
|
|
37
57
|
)
|
|
38
58
|
) {}
|
|
39
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @description Sender party of an invoice response. Extends {@link PeppolInvoiceResponseParty} with optional `cac:Contact` details.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* { partyLegalEntity: { registrationName: 'Seller Business Name AS' } }
|
|
66
|
+
* ```;
|
|
67
|
+
*
|
|
68
|
+
* @see {@link PeppolInvoiceResponse}
|
|
69
|
+
*/
|
|
40
70
|
export class PeppolInvoiceResponseSenderParty extends opaque<PeppolInvoiceResponseSenderParty>()(
|
|
41
71
|
PeppolInvoiceResponseParty.pipe(
|
|
42
72
|
Schema.fieldsAssign({
|
|
@@ -69,8 +99,16 @@ export class PeppolInvoiceResponseDocumentResponseParty extends opaque<PeppolInv
|
|
|
69
99
|
})
|
|
70
100
|
) {}
|
|
71
101
|
|
|
72
|
-
|
|
73
|
-
|
|
102
|
+
/**
|
|
103
|
+
* @description Wraps `cac:DocumentReference` inside an invoice response: identifies the invoice the status applies to.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* { id: 'inv-99876', issueDate: '2018-08-01', documentTypeCode: '380' }
|
|
108
|
+
* ```;
|
|
109
|
+
*
|
|
110
|
+
* @see {@link PeppolInvoiceResponseDocumentResponse}
|
|
111
|
+
*/
|
|
74
112
|
export class PeppolInvoiceResponseDocumentReference extends opaque<PeppolInvoiceResponseDocumentReference>()(
|
|
75
113
|
Schema.Struct({
|
|
76
114
|
/**
|
|
@@ -102,10 +140,20 @@ export class PeppolInvoiceResponseDocumentReference extends opaque<PeppolInvoice
|
|
|
102
140
|
*
|
|
103
141
|
* @summary Identifier type code
|
|
104
142
|
*/
|
|
105
|
-
documentTypeCode:
|
|
143
|
+
documentTypeCode: PeppolDocumentTypeCode,
|
|
106
144
|
})
|
|
107
145
|
) {}
|
|
108
146
|
|
|
147
|
+
/**
|
|
148
|
+
* @description Wraps `cac:DocumentResponse` inside an invoice response: the response, the referenced invoice and optional parties.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* { response: { responseCode: 'AP', effectiveDate: '2018-08-02' }, documentReference: { id: 'inv-99876', documentTypeCode: '380' } }
|
|
153
|
+
* ```;
|
|
154
|
+
*
|
|
155
|
+
* @see {@link PeppolInvoiceResponse}
|
|
156
|
+
*/
|
|
109
157
|
export class PeppolInvoiceResponseDocumentResponse extends opaque<PeppolInvoiceResponseDocumentResponse>()(
|
|
110
158
|
Schema.Struct({
|
|
111
159
|
/**
|
|
@@ -115,7 +163,7 @@ export class PeppolInvoiceResponseDocumentResponse extends opaque<PeppolInvoiceR
|
|
|
115
163
|
*
|
|
116
164
|
* @cardinality (1..1)
|
|
117
165
|
*/
|
|
118
|
-
response:
|
|
166
|
+
response: PeppolInvoiceResponseDocumentActualResponse,
|
|
119
167
|
/**
|
|
120
168
|
* @summary Document reference
|
|
121
169
|
*
|