@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.
Files changed (185) hide show
  1. package/README.md +5 -5
  2. package/dist/constants.d.ts +131 -0
  3. package/dist/constants.d.ts.map +1 -1
  4. package/dist/constants.js +114 -1
  5. package/dist/constants.js.map +1 -1
  6. package/dist/{index-BBzPjq7o.d.ts → index-XG-N6PcG.d.ts} +1702 -724
  7. package/dist/index-XG-N6PcG.d.ts.map +1 -0
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.js +1247 -200
  10. package/dist/index.js.map +1 -1
  11. package/dist/invoice-response-code-not-needs-schema-DNrfKYLh.js +36 -0
  12. package/dist/invoice-response-code-not-needs-schema-DNrfKYLh.js.map +1 -0
  13. package/dist/invoice-response-codes.d.ts +28 -0
  14. package/dist/invoice-response-codes.d.ts.map +1 -1
  15. package/dist/invoice-response-codes.js +11 -1
  16. package/dist/invoice-response-codes.js.map +1 -1
  17. package/dist/{is-valid-abn-160i38PG.js → is-valid-abn-D7eSygBG.js} +115 -2
  18. package/dist/is-valid-abn-D7eSygBG.js.map +1 -0
  19. package/dist/{is-valid-mod97-0208-CzMOXMO-.js → is-valid-mod97-0208-CjR324eG.js} +11 -1
  20. package/dist/is-valid-mod97-0208-CjR324eG.js.map +1 -0
  21. package/dist/message-level-response-profile-id-B9c0A7S_.js +27 -0
  22. package/dist/message-level-response-profile-id-B9c0A7S_.js.map +1 -0
  23. package/dist/{nodable-parser-CyDZtLCK.js → nodable-parser-CupS2H55.js} +31 -1
  24. package/dist/nodable-parser-CupS2H55.js.map +1 -0
  25. package/dist/schematron.d.ts +57 -1
  26. package/dist/schematron.d.ts.map +1 -1
  27. package/dist/schematron.js +458 -7
  28. package/dist/schematron.js.map +1 -1
  29. package/dist/validations.d.ts +132 -0
  30. package/dist/validations.d.ts.map +1 -1
  31. package/dist/validations.js +11 -2
  32. package/dist/validations.js.map +1 -1
  33. package/dist/values.d.ts +67 -2
  34. package/dist/values.d.ts.map +1 -1
  35. package/dist/xml.d.ts +30 -0
  36. package/dist/xml.d.ts.map +1 -1
  37. package/dist/xml.js +10 -1
  38. package/dist/xml.js.map +1 -1
  39. package/package.json +1 -1
  40. package/src/constants/credit-note-doctype-id.ts +9 -0
  41. package/src/constants/credit-note-process-id.ts +9 -0
  42. package/src/constants/document-scheme.ts +9 -0
  43. package/src/constants/invoice-doctype-id.ts +9 -0
  44. package/src/constants/invoice-process-id.ts +10 -0
  45. package/src/constants/invoice-response-doctype-id.ts +10 -0
  46. package/src/constants/invoice-response-process-id.ts +9 -0
  47. package/src/constants/invoice-response-profile-id.ts +9 -0
  48. package/src/constants/message-level-response-doctype-id.ts +10 -0
  49. package/src/constants/message-level-response-process-id.ts +9 -0
  50. package/src/constants/message-level-response-profile-id.ts +9 -0
  51. package/src/constants/participant-scheme.ts +10 -0
  52. package/src/constants/process-scheme.ts +9 -0
  53. package/src/constants/transport-profile.ts +10 -0
  54. package/src/decoders/fields/decode-invoice-message-document-party.ts +2 -2
  55. package/src/decoders/fields/decode-parties-tax-scheme.ts +2 -2
  56. package/src/decoders/fields/decode-party-legal-entity.ts +2 -2
  57. package/src/decoders/fields/decode-party-tax-scheme.ts +2 -2
  58. package/src/decoders/fields/decode-tax-category.ts +1 -1
  59. package/src/decoders/fields/decode-tax-representative-party.ts +2 -2
  60. package/src/decoders/fields/encode-message-party.ts +2 -2
  61. package/src/decoders/fields/encode-parties-tax-scheme.ts +3 -3
  62. package/src/decoders/fields/encode-party-legal-entity.ts +1 -1
  63. package/src/decoders/fields/encode-party-tax-scheme.ts +2 -2
  64. package/src/decoders/fields/encode-tax-representative-party.ts +2 -2
  65. package/src/invoice-response-codes/invoice-response-code-needs-schema.ts +9 -0
  66. package/src/invoice-response-codes/invoice-response-code-not-needs-schema.ts +9 -0
  67. package/src/invoice-response-codes/invoice-response-codes-order.ts +10 -0
  68. package/src/peppol-validations/add-piva.ts +12 -0
  69. package/src/peppol-validations/check-cf.ts +11 -0
  70. package/src/peppol-validations/check-cf16.ts +12 -0
  71. package/src/peppol-validations/check-piva-se-it.ts +11 -0
  72. package/src/peppol-validations/check-piva.ts +11 -0
  73. package/src/peppol-validations/check-se-orgnr.ts +9 -0
  74. package/src/peppol-validations/greek-tin-verification.ts +9 -0
  75. package/src/peppol-validations/is-valid-abn.ts +9 -0
  76. package/src/peppol-validations/is-valid-gln.ts +10 -0
  77. package/src/peppol-validations/is-valid-iban.ts +10 -0
  78. package/src/peppol-validations/is-valid-mod11.ts +9 -0
  79. package/src/peppol-validations/is-valid-mod97-0208.ts +10 -0
  80. package/src/peppol-validations/luhn-check.ts +9 -0
  81. package/src/schemas/fields/default-customization-id.ts +9 -0
  82. package/src/schemas/fields/default-profile-id.ts +9 -0
  83. package/src/schemas/fields/peppol-additional-document-reference-schema.ts +61 -20
  84. package/src/schemas/fields/peppol-address-schema.ts +25 -2
  85. package/src/schemas/fields/peppol-allowance-charge-schema.ts +63 -9
  86. package/src/schemas/fields/peppol-amount-schema.ts +15 -2
  87. package/src/schemas/fields/peppol-base-line-schema.ts +12 -2
  88. package/src/schemas/fields/peppol-billing-reference-schema.ts +13 -0
  89. package/src/schemas/fields/peppol-binary-object-schema.ts +12 -4
  90. package/src/schemas/fields/peppol-contact-schema.ts +11 -0
  91. package/src/schemas/fields/peppol-credit-note-line-schema.ts +7 -2
  92. package/src/schemas/fields/peppol-delivery-schema.ts +44 -2
  93. package/src/schemas/fields/peppol-identifier-schema.ts +8 -0
  94. package/src/schemas/fields/peppol-invoice-line-period-schema.ts +11 -0
  95. package/src/schemas/fields/peppol-invoice-line-schema.ts +9 -2
  96. package/src/schemas/fields/peppol-invoice-period-schema.ts +2 -2
  97. package/src/schemas/fields/peppol-item-classification-schema.ts +2 -2
  98. package/src/schemas/fields/peppol-line-allowance-charge-schema.ts +56 -8
  99. package/src/schemas/fields/peppol-line-item-schema.ts +66 -6
  100. package/src/schemas/fields/peppol-line-price-allowance-charge-schema.ts +20 -0
  101. package/src/schemas/fields/peppol-line-price-schema.ts +2 -0
  102. package/src/schemas/fields/peppol-order-reference-schema.ts +2 -0
  103. package/src/schemas/fields/peppol-party-base-schema.ts +36 -4
  104. package/src/schemas/fields/peppol-party-legal-entity-schema.ts +10 -2
  105. package/src/schemas/fields/peppol-party-tax-scheme-schema.ts +4 -4
  106. package/src/schemas/fields/peppol-payee-party-schema.ts +8 -8
  107. package/src/schemas/fields/peppol-payment-means-schema.ts +62 -2
  108. package/src/schemas/fields/peppol-payment-terms-schema.ts +2 -0
  109. package/src/schemas/fields/peppol-quantity-schema.ts +4 -2
  110. package/src/schemas/fields/peppol-reference-schema.ts +20 -1
  111. package/src/schemas/fields/peppol-tax-category-schema.ts +12 -2
  112. package/src/schemas/fields/peppol-tax-representative-schema.ts +2 -2
  113. package/src/schemas/fields/peppol-tax-subtotal-category-schema.ts +3 -0
  114. package/src/schemas/fields/peppol-tax-subtotal-schema.ts +2 -0
  115. package/src/schemas/fields/peppol-tax-totals-base-schema.ts +3 -3
  116. package/src/schemas/peppol-billing-base-schema.ts +49 -9
  117. package/src/schemas/peppol-credit-note-schema.ts +2 -2
  118. package/src/schemas/peppol-document-response-document-reference-schema.ts +12 -4
  119. package/src/schemas/peppol-document-response-document-schema.ts +5 -5
  120. package/src/schemas/peppol-document-response-line-response-content-schema.ts +22 -2
  121. package/src/schemas/peppol-document-response-line-response-schema.ts +23 -2
  122. package/src/schemas/peppol-document-schema.ts +69 -6
  123. package/src/schemas/peppol-invoice-response-document-actual-response-schema.ts +53 -4
  124. package/src/schemas/peppol-invoice-response-document-actual-response-status-schema.ts +22 -4
  125. package/src/schemas/peppol-invoice-response-schema.ts +54 -6
  126. package/src/schemas/peppol-invoice-response-status-reason-code-schema.ts +36 -8
  127. package/src/schemas/peppol-invoice-schema.ts +30 -2
  128. package/src/schemas/peppol-message-level-response-document-response-schema.ts +10 -0
  129. package/src/schemas/peppol-message-level-response-party-schema.ts +10 -0
  130. package/src/schemas/peppol-message-level-response-schema.ts +18 -0
  131. package/src/schemas/utils/format-quantity-with-unit.ts +19 -0
  132. package/src/schemas/utils/get-credit-note-type-code-description.ts +12 -0
  133. package/src/schemas/utils/get-invoice-type-code-description.ts +12 -0
  134. package/src/schemas/utils/is-valid-credit-note-type-code.ts +13 -0
  135. package/src/schemas/utils/is-valid-invoice-type-code.ts +13 -0
  136. package/src/schemas/utils/is-valid-process.ts +13 -0
  137. package/src/schemas/utils/peppol-base-64-schema.ts +7 -4
  138. package/src/schemas/utils/peppol-vat-regex-schema.ts +38 -30
  139. package/src/schemas/utils/peppol-xsd-time-schema.ts +12 -2
  140. package/src/schemas/utils/quantity-unit-code-to-intl-unit.ts +34 -0
  141. package/src/schemas/values/additional-document-reference-code-schema.ts +9 -15
  142. package/src/schemas/values/allowance-charge-reason-code-schema.ts +12 -14
  143. package/src/schemas/values/application-response-type-code-schema.ts +10 -14
  144. package/src/schemas/values/charge-reason-code-schema.ts +12 -14
  145. package/src/schemas/values/credit-note-type-code-schema.ts +8 -14
  146. package/src/schemas/values/currency-code-schema.ts +13 -16
  147. package/src/schemas/values/document-type-schemes-schema.ts +9 -5
  148. package/src/schemas/values/document-type-values-schema.ts +5 -6
  149. package/src/schemas/values/duty-tax-fee-category-schema.ts +15 -13
  150. package/src/schemas/values/electronic-codes-schema.ts +10 -12
  151. package/src/schemas/values/icd-codes-schema.ts +8 -12
  152. package/src/schemas/values/invoice-status-code-schema.ts +10 -12
  153. package/src/schemas/values/invoice-type-code-schema.ts +10 -12
  154. package/src/schemas/values/item-classification-codes-schema.ts +10 -12
  155. package/src/schemas/values/mime-codes-schema.ts +12 -14
  156. package/src/schemas/values/op-status-action-schema.ts +10 -12
  157. package/src/schemas/values/op-status-reason-schema.ts +10 -12
  158. package/src/schemas/values/participant-identifier-code-schema.ts +10 -13
  159. package/src/schemas/values/payment-means-code-schema.ts +10 -12
  160. package/src/schemas/values/peppol-country-code-schema.ts +7 -9
  161. package/src/schemas/values/peppol-document-type-code-schema.ts +10 -12
  162. package/src/schemas/values/peppol-document-type-schema.ts +12 -21
  163. package/src/schemas/values/peppol-process-schema.ts +19 -15
  164. package/src/schemas/values/process-from-document-type-schema.ts +3 -3
  165. package/src/schemas/values/quantity-unit-codes-schema.ts +10 -12
  166. package/src/schemas/values/vat-date-code-schema.ts +12 -5
  167. package/src/schemas/values/vatex-code-schema.ts +8 -12
  168. package/src/schematron/errors.ts +14 -0
  169. package/src/schematron/helpers.ts +457 -11
  170. package/src/schematron/run-all-rules.ts +10 -0
  171. package/src/schematron/schematron.ts +25 -0
  172. package/src/xml/builder-options.ts +9 -0
  173. package/src/xml/common-xml-options.ts +9 -0
  174. package/src/xml/nodable-parser.ts +12 -0
  175. package/src/xml/parser-options.ts +9 -0
  176. package/dist/index-BBzPjq7o.d.ts.map +0 -1
  177. package/dist/invoice-response-code-not-needs-schema-p_RKKNLc.js +0 -18
  178. package/dist/invoice-response-code-not-needs-schema-p_RKKNLc.js.map +0 -1
  179. package/dist/is-valid-abn-160i38PG.js.map +0 -1
  180. package/dist/is-valid-mod97-0208-CzMOXMO-.js.map +0 -1
  181. package/dist/message-level-response-profile-id-DBpOW91B.js +0 -9
  182. package/dist/message-level-response-profile-id-DBpOW91B.js.map +0 -1
  183. package/dist/nodable-parser-CyDZtLCK.js.map +0 -1
  184. package/dist/vat-dates.generated-CxFvt7m3.d.ts +0 -68
  185. package/dist/vat-dates.generated-CxFvt7m3.d.ts.map +0 -1
@@ -4,9 +4,19 @@ import { PeppolIdentifier } from '#/schemas/fields/peppol-identifier-schema.ts';
4
4
  import { PeppolItemClassification } from '#/schemas/fields/peppol-item-classification-schema.ts';
5
5
  import { PeppolTaxCategory } from '#/schemas/fields/peppol-tax-category-schema.ts';
6
6
  import { opaque } from '#/schemas/utils/opaque.ts';
7
- import { icdCodesSchema } from '#/schemas/values/icd-codes-schema.ts';
8
- import { peppolCountryCodeSchema } from '#/schemas/values/peppol-country-code-schema.ts';
7
+ import { PeppolIcdCode } from '#/schemas/values/icd-codes-schema.ts';
8
+ import { PeppolCountryCodeValue } from '#/schemas/values/peppol-country-code-schema.ts';
9
9
 
10
+ /**
11
+ * @description An additional property of the item, expressed as an attribute name and value pair.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * { name: 'Colour', value: 'Blue' }
16
+ * ```;
17
+ *
18
+ * @see {@link PeppolLineItem}
19
+ */
10
20
  export class PeppolAdditionalItemProperties extends opaque<PeppolAdditionalItemProperties>()(
11
21
  Schema.Struct({
12
22
  /**
@@ -28,6 +38,16 @@ export class PeppolAdditionalItemProperties extends opaque<PeppolAdditionalItemP
28
38
  })
29
39
  ) {}
30
40
 
41
+ /**
42
+ * @description A code classifying the item by its type or nature, identified by a scheme such as CPV.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * { itemClassification: { id: '09348023', listId: 'STI' } }
47
+ * ```;
48
+ *
49
+ * @see {@link PeppolItemClassification}
50
+ */
31
51
  export class PeppolCommodityClassifications extends opaque<PeppolCommodityClassifications>()(
32
52
  Schema.Struct({
33
53
  /**
@@ -44,6 +64,16 @@ export class PeppolCommodityClassifications extends opaque<PeppolCommodityClassi
44
64
  })
45
65
  ) {}
46
66
 
67
+ /**
68
+ * @description The country from which the item originates, identified by an ISO 3166-1 country code.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * { identificationCode: 'NO' }
73
+ * ```;
74
+ *
75
+ * @see {@link PeppolLineItem}
76
+ */
47
77
  export class PeppolOriginCountryCode extends opaque<PeppolOriginCountryCode>()(
48
78
  Schema.Struct({
49
79
  /**
@@ -53,10 +83,20 @@ export class PeppolOriginCountryCode extends opaque<PeppolOriginCountryCode>()(
53
83
  *
54
84
  * @name `cbc:IdentificationCode`
55
85
  */
56
- identificationCode: peppolCountryCodeSchema,
86
+ identificationCode: PeppolCountryCodeValue,
57
87
  })
58
88
  ) {}
59
89
 
90
+ /**
91
+ * @description An item identifier based on a registered scheme, such as a GTIN or EAN.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * { id: { id: '21382183120983', schemeId: '0088' } }
96
+ * ```;
97
+ *
98
+ * @see {@link PeppolIdentifier}
99
+ */
60
100
  export class PeppolStandardItemIdentification extends opaque<PeppolStandardItemIdentification>()(
61
101
  Schema.Struct({
62
102
  /**
@@ -83,12 +123,22 @@ export class PeppolStandardItemIdentification extends opaque<PeppolStandardItemI
83
123
  *
84
124
  * @name `@schemeID`
85
125
  */
86
- schemeId: icdCodesSchema,
126
+ schemeId: PeppolIcdCode,
87
127
  })
88
128
  ),
89
129
  })
90
130
  ) {}
91
131
 
132
+ /**
133
+ * @description An identifier assigned by the Seller for the item.
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * { id: '987323' }
138
+ * ```;
139
+ *
140
+ * @see {@link PeppolLineItem}
141
+ */
92
142
  export class PeppolSellersItemIdentification extends opaque<PeppolSellersItemIdentification>()(
93
143
  Schema.Struct({
94
144
  /**
@@ -105,6 +155,16 @@ export class PeppolSellersItemIdentification extends opaque<PeppolSellersItemIde
105
155
  })
106
156
  ) {}
107
157
 
158
+ /**
159
+ * @description An identifier assigned by the Buyer for the item.
160
+ *
161
+ * @example
162
+ * ```ts
163
+ * { id: '12345' }
164
+ * ```;
165
+ *
166
+ * @see {@link PeppolLineItem}
167
+ */
108
168
  export class PeppolBuyersItemIdentification extends opaque<PeppolBuyersItemIdentification>()(
109
169
  Schema.Struct({
110
170
  /**
@@ -122,6 +182,8 @@ export class PeppolBuyersItemIdentification extends opaque<PeppolBuyersItemIdent
122
182
  ) {}
123
183
 
124
184
  /**
185
+ * @description The item details for an invoice or credit note line, including its name, identifiers, classification, and line VAT category.
186
+ *
125
187
  * @summary Item details on invoice/credit-note line
126
188
  *
127
189
  * @name cac:Item
@@ -192,5 +254,3 @@ export class PeppolLineItem extends opaque<PeppolLineItem>()(
192
254
  additionalItemProperties: Schema.optional(Schema.Array(PeppolAdditionalItemProperties)),
193
255
  })
194
256
  ) {}
195
-
196
- export type PeppolItem = PeppolLineItem;
@@ -3,6 +3,16 @@ import { Schema } from 'effect';
3
3
  import { PeppolAmount } from '#/schemas/fields/peppol-amount-schema.ts';
4
4
  import { opaque } from '#/schemas/utils/opaque.ts';
5
5
 
6
+ /**
7
+ * @description A price level allowance or charge applied to the item price, expressed as an amount and a charge indicator.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * { amount: { value: 200, currencyId: 'EUR' }, chargeIndicator: false }
12
+ * ```;
13
+ *
14
+ * @see {@link PeppolLinePriceAllowanceCharge}
15
+ */
6
16
  class PriceAllowanceCharge extends opaque<PriceAllowanceCharge>()(
7
17
  Schema.Struct({
8
18
  /**
@@ -28,6 +38,16 @@ class PriceAllowanceCharge extends opaque<PriceAllowanceCharge>()(
28
38
  })
29
39
  ) {}
30
40
 
41
+ /**
42
+ * @description A price level allowance on the item price. Only allowances are allowed at price level, so the charge indicator is fixed to false.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * { amount: { value: 200, currencyId: 'EUR' }, chargeIndicator: false }
47
+ * ```;
48
+ *
49
+ * @see {@link PeppolLinePrice}
50
+ */
31
51
  export class PeppolLinePriceAllowanceCharge extends opaque<PeppolLinePriceAllowanceCharge>()(
32
52
  PriceAllowanceCharge.pipe(
33
53
  Schema.fieldsAssign({
@@ -6,6 +6,8 @@ import { PeppolQuantity } from '#/schemas/fields/peppol-quantity-schema.ts';
6
6
  import { opaque } from '#/schemas/utils/opaque.ts';
7
7
 
8
8
  /**
9
+ * @description The price details of an invoice or credit note line, including the price amount and any price level allowance.
10
+ *
9
11
  * @summary Price details on invoice line
10
12
  *
11
13
  * @name cac:Price
@@ -3,6 +3,8 @@ import { Schema } from 'effect';
3
3
  import { opaque } from '#/schemas/utils/opaque.ts';
4
4
 
5
5
  /**
6
+ * @description A reference to the purchase order or sales order that the invoice relates to.
7
+ *
6
8
  * @summary ORDER AND SALES ORDER REFERENCE
7
9
  *
8
10
  * @name cac:OrderReference
@@ -6,9 +6,19 @@ import { PeppolIdentifier } from '#/schemas/fields/peppol-identifier-schema.ts';
6
6
  import { PeppolPartyLegalEntity } from '#/schemas/fields/peppol-party-legal-entity-schema.ts';
7
7
  import { PeppolPartyTaxScheme } from '#/schemas/fields/peppol-party-tax-scheme-schema.ts';
8
8
  import { opaque } from '#/schemas/utils/opaque.ts';
9
- import { electronicCodesSchema } from '#/schemas/values/electronic-codes-schema.ts';
10
- import { icdCodesSchema } from '#/schemas/values/icd-codes-schema.ts';
9
+ import { PeppolElectronicAddressCode } from '#/schemas/values/electronic-codes-schema.ts';
10
+ import { PeppolIcdCode } from '#/schemas/values/icd-codes-schema.ts';
11
11
 
12
+ /**
13
+ * @description A name by which the Buyer or Seller is known, other than its registered name.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * { name: 'SupplierTradingName Ltd.' }
18
+ * ```;
19
+ *
20
+ * @see {@link PeppolPartySchema}
21
+ */
12
22
  export class PeppolPartyName extends opaque<PeppolPartyName>()(
13
23
  Schema.Struct({
14
24
  /**
@@ -23,6 +33,16 @@ export class PeppolPartyName extends opaque<PeppolPartyName>()(
23
33
  })
24
34
  ) {}
25
35
 
36
+ /**
37
+ * @description An identifier of the Buyer or Seller, with an optional identification scheme.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * { id: { id: '99887766', schemeId: '0088' } }
42
+ * ```;
43
+ *
44
+ * @see {@link PeppolPartySchema}
45
+ */
26
46
  export class PeppolPartyIdentification extends opaque<PeppolPartyIdentification>()(
27
47
  Schema.Struct({
28
48
  /**
@@ -52,12 +72,22 @@ export class PeppolPartyIdentification extends opaque<PeppolPartyIdentification>
52
72
  *
53
73
  * @name `@schemeID`
54
74
  */
55
- schemeId: Schema.optional(icdCodesSchema),
75
+ schemeId: Schema.optional(PeppolIcdCode),
56
76
  })
57
77
  ),
58
78
  })
59
79
  ) {}
60
80
 
81
+ /**
82
+ * @description The Buyer or Seller electronic address to which the application level response to the invoice may be delivered.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * { id: '9482348239847239874', schemeId: '0088' }
87
+ * ```;
88
+ *
89
+ * @see {@link PeppolPartySchema}
90
+ */
61
91
  export class PeppolPartyEndpointId extends opaque<PeppolPartyEndpointId>()(
62
92
  PeppolIdentifier.pipe(
63
93
  Schema.fieldsAssign({
@@ -79,12 +109,14 @@ export class PeppolPartyEndpointId extends opaque<PeppolPartyEndpointId>()(
79
109
  *
80
110
  * @name `@schemeID`
81
111
  */
82
- schemeId: electronicCodesSchema,
112
+ schemeId: PeppolElectronicAddressCode,
83
113
  })
84
114
  )
85
115
  ) {}
86
116
 
87
117
  /**
118
+ * @description The common party substructure shared by the supplier, customer, and other party roles.
119
+ *
88
120
  * @summary Party common substructure
89
121
  *
90
122
  * @name cac:Party
@@ -3,6 +3,16 @@ import { Schema } from 'effect';
3
3
  import { PeppolIdentifier } from '#/schemas/fields/peppol-identifier-schema.ts';
4
4
  import { opaque } from '#/schemas/utils/opaque.ts';
5
5
 
6
+ /**
7
+ * @description The legal entity details of a party, including the registered name and optional company identifiers.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * { registrationName: 'SupplierOfficialName Ltd', companyId: { id: 'GB983294' } }
12
+ * ```;
13
+ *
14
+ * @see {@link PeppolPartySchema}
15
+ */
6
16
  export class PeppolPartyLegalEntity extends opaque<PeppolPartyLegalEntity>()(
7
17
  Schema.Struct({
8
18
  /**
@@ -28,5 +38,3 @@ export class PeppolPartyLegalEntity extends opaque<PeppolPartyLegalEntity>()(
28
38
  registrationName: Schema.String,
29
39
  })
30
40
  ) {}
31
-
32
- export type PeppolPartyLegalEntitySchema = PeppolPartyLegalEntity;
@@ -2,7 +2,7 @@ import { Effect, Schema } from 'effect';
2
2
 
3
3
  import { opaque } from '#/schemas/utils/opaque.ts';
4
4
 
5
- class PeppolTaxSchemeId extends opaque<PeppolTaxSchemeId>()(
5
+ export class PeppolPartyTaxSchemeId extends opaque<PeppolPartyTaxSchemeId>()(
6
6
  Schema.Struct({
7
7
  /**
8
8
  * @description Mandatory element. For Seller VAT identifier (BT-31), use value “VAT”, for the seller tax registration identifier (BT-32), use != "VAT"
@@ -14,6 +14,8 @@ class PeppolTaxSchemeId extends opaque<PeppolTaxSchemeId>()(
14
14
  ) {}
15
15
 
16
16
  /**
17
+ * @description The Seller tax registration details, combining a tax identifier such as a VAT number with the tax scheme.
18
+ *
17
19
  * @name cac:PartyTaxScheme (0..2)
18
20
  */
19
21
  export class PeppolPartyTaxScheme extends opaque<PeppolPartyTaxScheme>()(
@@ -34,8 +36,6 @@ export class PeppolPartyTaxScheme extends opaque<PeppolPartyTaxScheme>()(
34
36
  *
35
37
  * @name `cac:TaxScheme`
36
38
  */
37
- taxSchemeId: PeppolTaxSchemeId,
39
+ taxSchemeId: PeppolPartyTaxSchemeId,
38
40
  })
39
41
  ) {}
40
-
41
- export type PeppolPartyTaxSchema = PeppolPartyTaxScheme;
@@ -2,11 +2,11 @@ import { Schema } from 'effect';
2
2
 
3
3
  import { PeppolIdentifier } from '#/schemas/fields/peppol-identifier-schema.ts';
4
4
  import { opaque } from '#/schemas/utils/opaque.ts';
5
- import { icdCodesSchema } from '#/schemas/values/icd-codes-schema.ts';
5
+ import { PeppolIcdCode } from '#/schemas/values/icd-codes-schema.ts';
6
6
 
7
- class PeppolPartyName extends opaque<PeppolPartyName>()(Schema.Struct({ name: Schema.String })) {}
7
+ export class PeppolPayeePartyName extends opaque<PeppolPayeePartyName>()(Schema.Struct({ name: Schema.String })) {}
8
8
 
9
- class PeppolPartyLegalEntity extends opaque<PeppolPartyLegalEntity>()(
9
+ export class PeppolPayeePartyLegalEntity extends opaque<PeppolPayeePartyLegalEntity>()(
10
10
  Schema.Struct({
11
11
  /**
12
12
  * @description An identifier issued by an official registrar that identifies the payee as a legal entity or person.
@@ -39,14 +39,14 @@ class PeppolPartyLegalEntity extends opaque<PeppolPartyLegalEntity>()(
39
39
  *
40
40
  * @name `@schemeID`
41
41
  */
42
- schemeId: Schema.optional(icdCodesSchema),
42
+ schemeId: Schema.optional(PeppolIcdCode),
43
43
  })
44
44
  )
45
45
  ),
46
46
  })
47
47
  ) {}
48
48
 
49
- class PeppolPartyIdentification extends opaque<PeppolPartyIdentification>()(
49
+ export class PeppolPayeePartyIdentification extends opaque<PeppolPayeePartyIdentification>()(
50
50
  Schema.Struct({
51
51
  /**
52
52
  * @description This element is used for both the identification of the Payee, or the unique banking reference identifier of Payee (assigned by the Payee
@@ -97,13 +97,13 @@ export class PeppolPayeeParty extends opaque<PeppolPayeeParty>()(
97
97
  *
98
98
  * @name `cac:PartyIdentification`
99
99
  */
100
- partyIdentification: Schema.optional(PeppolPartyIdentification),
100
+ partyIdentification: Schema.optional(PeppolPayeePartyIdentification),
101
101
  /**
102
102
  * @summary PARTY LEGAL ENTITY
103
103
  *
104
104
  * @name `cac:PartyLegalEntity`
105
105
  */
106
- partyLegalEntity: Schema.optional(PeppolPartyLegalEntity),
106
+ partyLegalEntity: Schema.optional(PeppolPayeePartyLegalEntity),
107
107
  /**
108
108
  * @description The name of the payee.
109
109
  *
@@ -114,6 +114,6 @@ export class PeppolPayeeParty extends opaque<PeppolPayeeParty>()(
114
114
  *
115
115
  * @name `cac:PartyName`
116
116
  */
117
- partyName: PeppolPartyName,
117
+ partyName: PeppolPayeePartyName,
118
118
  })
119
119
  ) {}
@@ -2,8 +2,18 @@ import { Schema } from 'effect';
2
2
 
3
3
  import { PeppolIsoDateString } from '#/schemas/peppol-iso-date-string.ts';
4
4
  import { opaque } from '#/schemas/utils/opaque.ts';
5
- import { paymentMeansCodeSchema } from '#/schemas/values/payment-means-code-schema.ts';
5
+ import { PeppolPaymentMeansCodeValue } from '#/schemas/values/payment-means-code-schema.ts';
6
6
 
7
+ /**
8
+ * @description The account to be debited by a direct debit.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * { id: '12345676543' }
13
+ * ```;
14
+ *
15
+ * @see {@link PeppolPaymentMandate}
16
+ */
7
17
  export class PeppolPaymentMandatePayerFinancialAccountId extends opaque<PeppolPaymentMandatePayerFinancialAccountId>()(
8
18
  Schema.Struct({
9
19
  /**
@@ -20,6 +30,16 @@ export class PeppolPaymentMandatePayerFinancialAccountId extends opaque<PeppolPa
20
30
  })
21
31
  ) {}
22
32
 
33
+ /**
34
+ * @description A group of business terms to specify a direct debit, including the mandate reference and the debited account.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * { id: 'MandateReference', payerFinancialAccountId: { id: '12345676543' } }
39
+ * ```;
40
+ *
41
+ * @see {@link PeppolPaymentMeans}
42
+ */
23
43
  export class PeppolPaymentMandate extends opaque<PeppolPaymentMandate>()(
24
44
  Schema.Struct({
25
45
  /**
@@ -44,6 +64,16 @@ export class PeppolPaymentMandate extends opaque<PeppolPaymentMandate>()(
44
64
  })
45
65
  ) {}
46
66
 
67
+ /**
68
+ * @description The payment service provider where the payee payment account is held, such as a BIC or national clearing code.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * { id: 'BIC324098' }
73
+ * ```;
74
+ *
75
+ * @see {@link PeppolPayeeFinancialAccount}
76
+ */
47
77
  export class PeppolPayeeFinancialAccountFinancialInstitutionBranch extends opaque<PeppolPayeeFinancialAccountFinancialInstitutionBranch>()(
48
78
  Schema.Struct({
49
79
  /**
@@ -61,6 +91,16 @@ export class PeppolPayeeFinancialAccountFinancialInstitutionBranch extends opaqu
61
91
  })
62
92
  ) {}
63
93
 
94
+ /**
95
+ * @description The payment account to which payment should be made, such as an IBAN or BBAN, including the financial institution branch.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * { id: 'IBAN32423940', name: 'AccountName' }
100
+ * ```;
101
+ *
102
+ * @see {@link PeppolPaymentMeans}
103
+ */
64
104
  export class PeppolPayeeFinancialAccount extends opaque<PeppolPayeeFinancialAccount>()(
65
105
  Schema.Struct({
66
106
  /**
@@ -94,6 +134,16 @@ export class PeppolPayeeFinancialAccount extends opaque<PeppolPayeeFinancialAcco
94
134
  })
95
135
  ) {}
96
136
 
137
+ /**
138
+ * @description The card used for payment, including the card holder name and the primary account number.
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * { networkId: 'VISA', primaryAccountNumberId: '1234' }
143
+ * ```;
144
+ *
145
+ * @see {@link PeppolPaymentMeans}
146
+ */
97
147
  export class PeppolCardAccount extends opaque<PeppolCardAccount>()(
98
148
  Schema.Struct({
99
149
  /**
@@ -125,6 +175,16 @@ export class PeppolCardAccount extends opaque<PeppolCardAccount>()(
125
175
  })
126
176
  ) {}
127
177
 
178
+ /**
179
+ * @description The means by which a payment is expected to be or has been settled, expressed as a UNCL 4461 code and optional text.
180
+ *
181
+ * @example
182
+ * ```ts
183
+ * { code: '30', name: 'Credit transfer' }
184
+ * ```;
185
+ *
186
+ * @see {@link PeppolPaymentMeans}
187
+ */
128
188
  export class PeppolPaymentMeansCode extends opaque<PeppolPaymentMeansCode>()(
129
189
  Schema.Struct({
130
190
  /**
@@ -137,7 +197,7 @@ export class PeppolPaymentMeansCode extends opaque<PeppolPaymentMeansCode>()(
137
197
  *
138
198
  * @name `#text`
139
199
  */
140
- code: paymentMeansCodeSchema,
200
+ code: PeppolPaymentMeansCodeValue,
141
201
  /**
142
202
  * @description The means, expressed as text, for how a payment is expected to be or has been settled.
143
203
  *
@@ -3,6 +3,8 @@ import { Schema } from 'effect';
3
3
  import { opaque } from '#/schemas/utils/opaque.ts';
4
4
 
5
5
  /**
6
+ * @description A textual description of the payment terms that apply to the amount due for payment.
7
+ *
6
8
  * @summary PAYMENT TERMS
7
9
  *
8
10
  * @name cac:PaymentTerms
@@ -1,9 +1,11 @@
1
1
  import { Schema } from 'effect';
2
2
 
3
3
  import { opaque } from '#/schemas/utils/opaque.ts';
4
- import { quantityUnitCodesSchema } from '#/schemas/values/quantity-unit-codes-schema.ts';
4
+ import { PeppolQuantityUnitCode } from '#/schemas/values/quantity-unit-codes-schema.ts';
5
5
 
6
6
  /**
7
+ * @description A quantity value with an optional unit of measure code.
8
+ *
7
9
  * @summary Quantity with optional unit code
8
10
  *
9
11
  * @name `cbc:* (+ @unitCode)`
@@ -13,7 +15,7 @@ export class PeppolQuantity extends opaque<PeppolQuantity>()(
13
15
  /**
14
16
  * @name `@unitCode`
15
17
  */
16
- unitCode: Schema.optional(quantityUnitCodesSchema),
18
+ unitCode: Schema.optional(PeppolQuantityUnitCode),
17
19
  /**
18
20
  * @name `#text (value)`
19
21
  */
@@ -2,8 +2,27 @@ import { Schema } from 'effect';
2
2
 
3
3
  import { opaque } from '#/schemas/utils/opaque.ts';
4
4
 
5
+ /**
6
+ * @description A reference identifier, such as an order or sales order reference.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * { id: '123' }
11
+ * ```;
12
+ */
5
13
  export class PeppolReferenceId extends opaque<PeppolReferenceId>()(Schema.Struct({ id: Schema.String })) {}
6
14
 
15
+ /**
16
+ * @description A schema for an optional reference identifier, accepting either {@link PeppolReferenceId} or `undefined`.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * peppolReferenceSchema; // Schema.Union([PeppolReferenceId, Schema.Undefined])
21
+ * ```;
22
+ */
7
23
  export const peppolReferenceSchema = Schema.Union([PeppolReferenceId, Schema.Undefined]);
8
24
 
9
- export type PeppolReferenceSchema = typeof peppolReferenceSchema.Type;
25
+ /**
26
+ * @description The decoded type of {@link peppolReferenceSchema}, either a {@link PeppolReferenceId} or `undefined`.
27
+ */
28
+ export type PeppolReferenceSchema = Schema.Schema.Type<typeof peppolReferenceSchema>;
@@ -1,8 +1,18 @@
1
1
  import { Effect, Schema } from 'effect';
2
2
 
3
3
  import { opaque } from '#/schemas/utils/opaque.ts';
4
- import { peppolDutyTaxFeeCategorySchema } from '#/schemas/values/duty-tax-fee-category-schema.ts';
4
+ import { PeppolDutyTaxFeeCategoryCode } from '#/schemas/values/duty-tax-fee-category-schema.ts';
5
5
 
6
+ /**
7
+ * @description The tax scheme identifier for a tax category, defaulting to `VAT` when the element is absent.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * { id: 'VAT' }
12
+ * ```;
13
+ *
14
+ * @see {@link PeppolTaxCategory}
15
+ */
6
16
  export class PeppolTaxSchemeId extends opaque<PeppolTaxSchemeId>()(
7
17
  Schema.Struct({
8
18
  /**
@@ -28,7 +38,7 @@ export class PeppolTaxCategory extends opaque<PeppolTaxCategory>()(
28
38
  *
29
39
  * @name `cbc:ID`
30
40
  */
31
- id: peppolDutyTaxFeeCategorySchema,
41
+ id: PeppolDutyTaxFeeCategoryCode,
32
42
  /**
33
43
  * @description The VAT rate, represented as percentage that applies to the invoiced item.
34
44
  *
@@ -5,6 +5,8 @@ import { PeppolPartyTaxScheme } from '#/schemas/fields/peppol-party-tax-scheme-s
5
5
  import { opaque } from '#/schemas/utils/opaque.ts';
6
6
 
7
7
  /**
8
+ * @description The party acting as the Seller tax representative, including its name, postal address, and tax scheme.
9
+ *
8
10
  * @summary SELLER TAX REPRESENTATIVE PARTY
9
11
  *
10
12
  * @name cac:TaxRepresentativeParty
@@ -22,5 +24,3 @@ export class PeppolTaxRepresentative extends opaque<PeppolTaxRepresentative>()(
22
24
  partyTaxScheme: PeppolPartyTaxScheme,
23
25
  })
24
26
  ) {}
25
-
26
- export type PeppolTaxRepresentativeParty = PeppolTaxRepresentative;
@@ -28,4 +28,7 @@ export class PeppolTaxSubTotalCategory extends opaque<PeppolTaxSubTotalCategory>
28
28
  })
29
29
  ) {}
30
30
 
31
+ /**
32
+ * @description The encoded form of {@link PeppolTaxSubTotalCategory}, accepted by the decoder before branded code values are applied.
33
+ */
31
34
  export interface PeppolTaxSubTotalCategoryEncoded extends Schema.Codec.Encoded<typeof PeppolTaxSubTotalCategory> {}
@@ -5,6 +5,8 @@ import { PeppolTaxSubTotalCategory } from '#/schemas/fields/peppol-tax-subtotal-
5
5
  import { opaque } from '#/schemas/utils/opaque.ts';
6
6
 
7
7
  /**
8
+ * @description A VAT breakdown line for a single tax category, giving the taxable amount and the tax amount.
9
+ *
8
10
  * @summary VAT breakdown (TaxSubtotal)
9
11
  *
10
12
  * @name cac:TaxSubtotal
@@ -5,11 +5,13 @@ import { PeppolTaxSubTotal } from '#/schemas/fields/peppol-tax-subtotal-schema.t
5
5
  import { opaque } from '#/schemas/utils/opaque.ts';
6
6
 
7
7
  /**
8
+ * @description The total tax amount for the document, with an optional breakdown into tax subtotals.
9
+ *
8
10
  * @summary TAX TOTAL
9
11
  *
10
12
  * @name cac:TaxTotal (1..2)
11
13
  */
12
- export class PeppolTaxTotalsBase extends opaque<PeppolTaxTotalsBase>()(
14
+ export class PeppolTaxTotal extends opaque<PeppolTaxTotal>()(
13
15
  Schema.Struct({
14
16
  /**
15
17
  * @example
@@ -24,5 +26,3 @@ export class PeppolTaxTotalsBase extends opaque<PeppolTaxTotalsBase>()(
24
26
  taxSubtotals: Schema.optional(Schema.Array(PeppolTaxSubTotal)),
25
27
  })
26
28
  ) {}
27
-
28
- export type PeppolTaxTotal = PeppolTaxTotalsBase;