@ripwords/myinvois-client 0.1.6 → 0.1.7

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 (81) hide show
  1. package/package.json +5 -8
  2. package/.prettierrc +0 -8
  3. package/CHANGELOG.md +0 -152
  4. package/bun.lock +0 -460
  5. package/myinvois-cert.conf.template +0 -23
  6. package/scripts/gen-cert.sh +0 -159
  7. package/src/api/platform/platformLogin.ts +0 -34
  8. package/src/index.ts +0 -530
  9. package/src/types/classification-codes.d.ts +0 -115
  10. package/src/types/country-code.d.ts +0 -790
  11. package/src/types/currencies.d.ts +0 -383
  12. package/src/types/documents.d.ts +0 -869
  13. package/src/types/e-invoice.d.ts +0 -41
  14. package/src/types/index.d.ts +0 -24
  15. package/src/types/msic/0X.d.ts +0 -408
  16. package/src/types/msic/1X.d.ts +0 -210
  17. package/src/types/msic/2X.d.ts +0 -266
  18. package/src/types/msic/3X.d.ts +0 -114
  19. package/src/types/msic/4X.d.ts +0 -520
  20. package/src/types/msic/5X.d.ts +0 -144
  21. package/src/types/msic/6X.d.ts +0 -200
  22. package/src/types/msic/7X.d.ts +0 -132
  23. package/src/types/msic/8X.d.ts +0 -210
  24. package/src/types/msic/9X.d.ts +0 -186
  25. package/src/types/msic-codes.d.ts +0 -31
  26. package/src/types/payment-modes.d.ts +0 -41
  27. package/src/types/signatures.d.ts +0 -169
  28. package/src/types/state-codes.d.ts +0 -59
  29. package/src/types/tax-types.d.ts +0 -39
  30. package/src/types/unit/1X.d.ts +0 -16
  31. package/src/types/unit/2X.d.ts +0 -62
  32. package/src/types/unit/3X.d.ts +0 -17
  33. package/src/types/unit/4X.d.ts +0 -44
  34. package/src/types/unit/5X.d.ts +0 -26
  35. package/src/types/unit/6X.d.ts +0 -12
  36. package/src/types/unit/7X.d.ts +0 -12
  37. package/src/types/unit/8X.d.ts +0 -15
  38. package/src/types/unit/9X.d.ts +0 -11
  39. package/src/types/unit/AX.d.ts +0 -202
  40. package/src/types/unit/BX.d.ts +0 -212
  41. package/src/types/unit/CX.d.ts +0 -238
  42. package/src/types/unit/DX.d.ts +0 -212
  43. package/src/types/unit/EX.d.ts +0 -196
  44. package/src/types/unit/FX.d.ts +0 -236
  45. package/src/types/unit/GX.d.ts +0 -254
  46. package/src/types/unit/HX.d.ts +0 -234
  47. package/src/types/unit/IX.d.ts +0 -28
  48. package/src/types/unit/JX.d.ts +0 -190
  49. package/src/types/unit/KX.d.ts +0 -284
  50. package/src/types/unit/LX.d.ts +0 -228
  51. package/src/types/unit/MX.d.ts +0 -288
  52. package/src/types/unit/NX.d.ts +0 -226
  53. package/src/types/unit/OX.d.ts +0 -34
  54. package/src/types/unit/PX.d.ts +0 -224
  55. package/src/types/unit/QX.d.ts +0 -94
  56. package/src/types/unit/RX.d.ts +0 -28
  57. package/src/types/unit/SX.d.ts +0 -56
  58. package/src/types/unit/TX.d.ts +0 -44
  59. package/src/types/unit/UX.d.ts +0 -14
  60. package/src/types/unit/VX.d.ts +0 -13
  61. package/src/types/unit/WX.d.ts +0 -34
  62. package/src/types/unit/XX.d.ts +0 -825
  63. package/src/types/unit/YX.d.ts +0 -17
  64. package/src/types/unit/ZX.d.ts +0 -19
  65. package/src/types/unit-types.d.ts +0 -86
  66. package/src/utils/base64.ts +0 -7
  67. package/src/utils/certificate.ts +0 -60
  68. package/src/utils/document.ts +0 -852
  69. package/src/utils/getBaseUrl.ts +0 -5
  70. package/src/utils/helpers.ts +0 -552
  71. package/src/utils/signature-diagnostics.ts +0 -583
  72. package/src/utils/validation.ts +0 -268
  73. package/test/MyInvoiClientWithRealData.test.ts +0 -40
  74. package/test/MyInvoisClient.test.ts +0 -204
  75. package/test/base64.test.ts +0 -43
  76. package/test/dynamicInvoiceFeatures.test.ts +0 -451
  77. package/test/signAndSubmitInvoice.test.ts +0 -452
  78. package/test/signature-diagnostics.test.ts +0 -130
  79. package/tsconfig.json +0 -39
  80. package/tsdown.config.ts +0 -31
  81. package/vitest.config.ts +0 -8
@@ -1,869 +0,0 @@
1
- import type { ClassificationCode } from './classification-codes.d.ts'
2
- import type { CurrencyCode } from './currencies.d.ts'
3
- import type { EInvoiceTypeCode } from './e-invoice.d.ts'
4
- import type { MSICCode } from './msic-codes.d.ts'
5
- import type { IssuerDigitalSignature } from './signatures.d.ts'
6
- import type { TaxTypeCode } from './tax-types.d.ts'
7
-
8
- export type RegistrationType = 'BRN' | 'NRIC' | 'PASSPORT' | 'ARMY'
9
-
10
- // Based on https://sdk.myinvois.hasil.gov.my/documents/invoice-v1-1/
11
-
12
- /**
13
- * Represents a physical address.
14
- * Based on the Address section of the documentation.
15
- */
16
- export interface Address {
17
- /** Main address line. Max 150 chars.
18
- * @example Lot 66
19
- */
20
- addressLine0: string
21
- /** City name. Max 50 chars. */
22
- cityName: string
23
- /** State code. Refer to /codes/state-codes/. Max 50 chars. */
24
- state: string
25
- /** Country code (ISO 3166-1). Refer to /codes/countries/. Max 3 chars. */
26
- country: string // MYS
27
- }
28
-
29
- /**
30
- * Represents the supplier information.
31
- * Based on the Supplier section of the documentation.
32
- */
33
- export interface Supplier {
34
- /** Supplier's name. Max 300 chars.
35
- * @example Test Supplier Sdn Bhd
36
- */
37
- name: string
38
- /** Supplier's Tax Identification Number (TIN). Max 14 chars.
39
- * @example 1234567890
40
- */
41
- tin: string
42
- /**
43
- * Supplier's Registration Type. NRIC, BRN, PASSPORT
44
- * @example NRIC
45
- */
46
- registrationType: RegistrationType
47
- /**
48
- * Supplier's Registration / Identification Number / Passport Number.
49
- * Format depends on schemeID: NRIC (12), BRN (20), PASSPORT (12)
50
- * @example BRN: 202001234567
51
- */
52
- registrationNumber: string
53
- /** Supplier's address. */
54
- address: Address
55
- /** Supplier's contact number (E.164 standard). Max 20 chars.
56
- * @example +60123456789
57
- */
58
- contactNumber: string
59
- /**
60
- * Supplier's industry classification code. Max 10 chars.
61
- * @example 41001
62
- */
63
- industryClassificationCode: MSICCode['code']
64
- /**
65
- * Supplier's industry classification description. Max 300 chars.
66
- * @example Other retail sale in non-specialised stores
67
- */
68
- industryClassificationDescription: MSICCode['description']
69
- }
70
-
71
- /**
72
- * Represents the buyer information.
73
- * Based on the Buyer section of the documentation.
74
- */
75
- export interface Buyer {
76
- /** Buyer's name. Max 300 chars.
77
- * @example Hebat Group
78
- */
79
- name: string
80
- /** Buyer's Tax Identification Number (TIN). Max 14 chars.
81
- * @example C12345678901
82
- */
83
- tin: string
84
- /**
85
- * Buyer's Registration Type. NRIC, BRN, PASSPORT
86
- * @example BRN
87
- */
88
- registrationType: RegistrationType
89
- /**
90
- * Buyer's Registration / Identification Number / Passport Number.
91
- * Format depends on schemeID: NRIC (12), BRN (20), PASSPORT (12).
92
- * @example BRN: 202001234567
93
- */
94
- registrationNumber: string
95
- /**
96
- * Buyer's SST registration number. Max 35 chars.
97
- * Mandatory for SST-registrants.
98
- * Allows up to two numbers separated by ';'.
99
- * @example W10-1909-32000060
100
- */
101
- sstRegistrationNumber: string
102
- /** Buyer's address. */
103
- address: Address
104
- /** Buyer's contact number (E.164 standard). Max 20 chars.
105
- * @example +60123456789
106
- */
107
- contactNumber: string
108
- }
109
-
110
- /**
111
- * Represents a single line item in an invoice.
112
- * Based on the Invoice Line Item section of the documentation.
113
- * https://sdk.myinvois.hasil.gov.my/documents/invoice-v1-1/#invoice-line-item
114
- */
115
- export interface InvoiceLineItem {
116
- /**
117
- * Item classification code. Refer to /codes/item-classifications/. Max 50 chars.
118
- * @example 001
119
- */
120
- itemClassificationCode: ClassificationCode
121
- /**
122
- * Item description. Max 300 chars.
123
- * @example Laptop
124
- */
125
- itemDescription: string
126
- /**
127
- * Unit price before tax. Max 18 digits, 6 decimal places.
128
- * @example 1500.00
129
- */
130
- unitPrice: number
131
- /**
132
- * Tax type code. Refer to /codes/tax-types/. Max 2 chars.
133
- * @example 01
134
- */
135
- taxType: TaxTypeCode
136
- /**
137
- * Tax rate. Max 18 digits, 2 decimal places.
138
- * @example 6.00
139
- */
140
- taxRate: number
141
- /**
142
- * Tax amount. Max 18 digits, 2 decimal places.
143
- * @example 90.00
144
- */
145
- taxAmount: number
146
- /**
147
- * Tax exemption reason code. Refer to /codes/tax-exemption-reasons/. Max 2 chars.
148
- * Mandatory if tax rate is 0%.
149
- * @example 02
150
- */
151
- taxExemptionReasonCode?: string
152
- /**
153
- * Tax exemption reason amount. Max 18 digits, 2 decimal places.
154
- * Mandatory if tax rate is 0%.
155
- * @example 1500.00
156
- */
157
- taxExemptionReasonAmount?: number
158
- /**
159
- * Total taxable amount per line (Quantity * Unit Price - Discount Amount). Max 18 digits, 2 decimal places.
160
- * @example 1500.00
161
- */
162
- totalTaxableAmountPerLine: number
163
- /**
164
- * Total amount per line including tax (Total Taxable Amount Per Line + Tax Amount). Max 18 digits, 2 decimal places.
165
- * @example 1590.00
166
- */
167
- totalAmountPerLine: number
168
- }
169
-
170
- /** Represents monetary totals for the invoice. Based on UBL cac:LegalMonetaryTotal. */
171
- export interface LegalMonetaryTotal {
172
- /** Total amount exclusive of taxes. Max 18 digits, 2 decimal places. */
173
- taxExclusiveAmount: number
174
- /** Total amount inclusive of taxes. Max 18 digits, 2 decimal places. */
175
- taxInclusiveAmount: number
176
- /** The final payable amount. Max 18 digits, 2 decimal places. */
177
- payableAmount: number
178
- }
179
-
180
- /** Represents tax category information. Based on UBL cac:TaxCategory. */
181
- export interface TaxCategory {
182
- /** Tax type code. Refer to /codes/tax-types/. Max 2 chars. */
183
- taxTypeCode: TaxTypeCode
184
- /** Tax rate percentage. Max 18 digits, 2 decimal places. */
185
- taxRate: number
186
- }
187
-
188
- /** Represents a subtotal for a specific tax category. Based on UBL cac:TaxSubtotal. */
189
- export interface TaxSubtotal {
190
- /** Taxable amount for this category. Max 18 digits, 2 decimal places. */
191
- taxableAmount: number
192
- /** Tax amount for this category. Max 18 digits, 2 decimal places. */
193
- taxAmount: number
194
- /** Tax category details. */
195
- taxCategory: TaxCategory
196
- }
197
-
198
- /** Represents the total tax amount for the invoice. Based on UBL cac:TaxTotal. */
199
- export interface TaxTotal {
200
- /** Total tax amount for the entire invoice. Max 18 digits, 2 decimal places. */
201
- taxAmount: number
202
- }
203
-
204
- /**
205
- * Represents the core Invoice v1.1 document structure.
206
- * Based on the Core section of the documentation.
207
- */
208
- export interface InvoiceV1_1 {
209
- /** Supplier information. */
210
- supplier: Supplier
211
- /** Buyer information. */
212
- buyer: Buyer
213
- /** e-Invoice version. Fixed value '1.1'. */
214
- eInvoiceVersion: '1.1'
215
- /** e-Invoice type code. Refer to /codes/e-invoice-types/. Max 2 chars. */
216
- eInvoiceTypeCode: EInvoiceTypeCode // e.g., '01'
217
- /** Document reference number used by Supplier. Max 50 chars. */
218
- eInvoiceCodeOrNumber: string // e.g., 'INV12345'
219
- /** Date of issuance (YYYY-MM-DD) in UTC. Max 10 chars. */
220
- eInvoiceDate: string // e.g., '2017-11-26'
221
- /** Time of issuance (HH:mm:ssZ) in UTC. Max 9 chars. */
222
- eInvoiceTime: string // e.g., '15:30:00Z'
223
- /** Issuer's digital signature. Refer to /signature/ documentation. */
224
- issuerDigitalSignature: IssuerDigitalSignature
225
- /** Invoice currency code. Refer to /codes/currencies/. Max 3 chars. */
226
- invoiceCurrencyCode: CurrencyCode // e.g., 'MYR'
227
- /** Invoice line items. */
228
- invoiceLineItems: InvoiceLineItem[]
229
- /**
230
- * Currency exchange rate to MYR. Max 15 decimal places.
231
- * Mandatory if InvoiceCurrencyCode is not MYR.
232
- */
233
- currencyExchangeRate?: number // e.g., 1.0 or 4.75
234
-
235
- /** Overall monetary totals for the invoice. */
236
- legalMonetaryTotal: LegalMonetaryTotal
237
- /** Total tax amounts and subtotals. */
238
- taxTotal: TaxTotal
239
- }
240
-
241
- export type SubmissionStatus =
242
- | 'InProgress'
243
- | 'Valid'
244
- | 'PartiallyValid'
245
- | 'Invalid'
246
-
247
- export type DocumentStatus = 'Valid' | 'Invalid' | 'Cancelled' | 'Submitted'
248
-
249
- export type StandardError = {
250
- code: string
251
- message: string
252
- target: string
253
- details: {
254
- code: string
255
- message: string
256
- target: string
257
- }[]
258
- }
259
-
260
- export type DocumentValidationResult = 'Valid' | 'Invalid' | 'Pending'
261
- export interface DocumentValidationStepResult {
262
- name: string
263
- status: DocumentValidationResult
264
- error?: StandardError
265
- }
266
- export interface DocumentSummary {
267
- uuid: string
268
- submissionUid: string
269
- longId: string
270
- internalId: string
271
- typeName: string
272
- typeVersionName: string
273
- issuerTin: string
274
- issuerName: string
275
- receiverId: string
276
- receiverName: string
277
- dateTimeIssued: string
278
- dateTimeReceived: string
279
- dateTimeValidated: string
280
- totalPayableAmount: number
281
- totalExcludingTax: number
282
- totalDiscount: number
283
- totalNetAmount: number
284
- status: DocumentStatus
285
- cancelDateTime: string | null
286
- rejectRequestDateTime: string | null
287
- documentStatusReason: string | null
288
- createdByUserId: string
289
- }
290
-
291
- export interface GetSubmissionResponse {
292
- submissionUid?: string
293
- documentCount?: number
294
- dateTimeReceived?: string
295
- overallStatus?: SubmissionStatus
296
- documentSummary?: DocumentSummary[]
297
- error?: StandardError
298
- }
299
-
300
- export interface ResponseDocument {
301
- invoiceCodeNumber: string
302
- error?: StandardError
303
- }
304
- export interface SubmissionResponse {
305
- submissionUid: string
306
- acceptedDocuments: ResponseDocument[]
307
- rejectedDocuments: ResponseDocument[]
308
- }
309
-
310
- export interface SigningCredentials {
311
- /** Private key in PEM format for signing */
312
- privateKeyPem: string
313
- /** Certificate in PEM format */
314
- certificatePem: string
315
- /** Certificate issuer name (e.g., "CN=Trial LHDNM Sub CA V1, OU=Terms of use at https://www.posdigicert.com.my, O=LHDNM, C=MY") */
316
- issuerName: string
317
- /** Certificate serial number as string */
318
- serialNumber: string
319
- }
320
-
321
- export interface FinalDocumentData {
322
- signatureValue: string // Base64 encoded RSA signature (Sig from Step 4)
323
- propsDigest: string // Base64 encoded hash of SignedProperties (PropsDigest from Step 7)
324
- docDigest: string // Base64 encoded hash of Canonicalized Document (DocDigest from Step 3)
325
- certificatePem: string // Signing certificate in PEM format
326
- }
327
-
328
- export interface SignedPropertiesData {
329
- certDigest: string // Base64 encoded SHA-256 hash of certificate (Step 5)
330
- signingTime: string // ISO 8601 UTC timestamp string (e.g., 2023-10-26T10:30:00Z)
331
- issuerName: string // Certificate Issuer Name
332
- serialNumber: string // Certificate Serial Number
333
- }
334
-
335
- export interface InvoiceSubmission {
336
- /** Invoice ID */
337
- ID: {
338
- _: string
339
- }[]
340
-
341
- /** Issue date in YYYY-MM-DD format */
342
- IssueDate: {
343
- _: string
344
- }[]
345
-
346
- /** Issue time in HH:mm:ssZ format */
347
- IssueTime: {
348
- _: string
349
- }[]
350
-
351
- /** Invoice type code with version */
352
- InvoiceTypeCode: {
353
- _: string
354
- listVersionID: string
355
- }[]
356
-
357
- /** Document currency code */
358
- DocumentCurrencyCode: {
359
- _: string
360
- }[]
361
-
362
- /** Supplier party information */
363
- AccountingSupplierParty: {
364
- Party: {
365
- IndustryClassificationCode: {
366
- _: string
367
- name: string
368
- }[]
369
- PartyIdentification: {
370
- ID: {
371
- _: string
372
- schemeID: string
373
- }[]
374
- }[]
375
- PostalAddress: {
376
- CityName: {
377
- _: string
378
- }[]
379
- CountrySubentityCode: {
380
- _: string
381
- }[]
382
- AddressLine: {
383
- Line: {
384
- _: string
385
- }[]
386
- }[]
387
- Country: {
388
- IdentificationCode: {
389
- _: string
390
- listID: string
391
- listAgencyID: string
392
- }[]
393
- }[]
394
- }[]
395
- PartyLegalEntity: {
396
- RegistrationName: {
397
- _: string
398
- }[]
399
- }[]
400
- Contact: {
401
- Telephone: {
402
- _: string
403
- }[]
404
- }[]
405
- }[]
406
- }[]
407
-
408
- /** Customer party information */
409
- AccountingCustomerParty: {
410
- Party: {
411
- PartyIdentification: {
412
- ID: {
413
- _: string
414
- schemeID: string
415
- }[]
416
- }[]
417
- PostalAddress: {
418
- CityName: {
419
- _: string
420
- }[]
421
- CountrySubentityCode: {
422
- _: string
423
- }[]
424
- AddressLine: {
425
- Line: {
426
- _: string
427
- }[]
428
- }[]
429
- Country: {
430
- IdentificationCode: {
431
- _: string
432
- listID: string
433
- listAgencyID: string
434
- }[]
435
- }[]
436
- }[]
437
- PartyLegalEntity: {
438
- RegistrationName: {
439
- _: string
440
- }[]
441
- }[]
442
- Contact: {
443
- Telephone: {
444
- _: string
445
- }[]
446
- }[]
447
- }[]
448
- }[]
449
-
450
- /** Tax total */
451
- TaxTotal: {
452
- TaxAmount: {
453
- _: number
454
- currencyID: string
455
- }[]
456
- TaxSubtotal: {
457
- TaxableAmount: {
458
- _: number
459
- currencyID: string
460
- }[]
461
- TaxAmount: {
462
- _: number
463
- currencyID: string
464
- }[]
465
- TaxCategory: {
466
- ID: {
467
- _: string
468
- }[]
469
- TaxScheme: {
470
- ID: {
471
- _: string
472
- schemeAgencyID: string
473
- schemeID: string
474
- }[]
475
- }[]
476
- }[]
477
- }[]
478
- }[]
479
-
480
- /** Legal monetary total */
481
- LegalMonetaryTotal: {
482
- LineExtensionAmount: {
483
- _: number
484
- currencyID: string
485
- }[]
486
- TaxExclusiveAmount: {
487
- _: number
488
- currencyID: string
489
- }[]
490
- TaxInclusiveAmount: {
491
- _: number
492
- currencyID: string
493
- }[]
494
- PayableAmount: {
495
- _: number
496
- currencyID: string
497
- }[]
498
- }[]
499
-
500
- /** Invoice line items */
501
- InvoiceLine: {
502
- ID: {
503
- _: string
504
- }[]
505
- Item: {
506
- CommodityClassification: {
507
- ItemClassificationCode: {
508
- _: string
509
- listID: string
510
- }[]
511
- }[]
512
- Description: {
513
- _: string
514
- }[]
515
- }[]
516
- ItemPriceExtension: {
517
- Amount: {
518
- _: number
519
- currencyID: string
520
- }[]
521
- }[]
522
- LineExtensionAmount: {
523
- _: number
524
- currencyID: string
525
- }[]
526
- Price: {
527
- PriceAmount: {
528
- _: number
529
- currencyID: string
530
- }[]
531
- }[]
532
- TaxTotal: {
533
- TaxAmount: {
534
- _: number
535
- currencyID: string
536
- }[]
537
- TaxSubtotal: {
538
- TaxableAmount: {
539
- _: number
540
- currencyID: string
541
- }[]
542
- TaxAmount: {
543
- _: number
544
- currencyID: string
545
- }[]
546
- TaxCategory: {
547
- ID: {
548
- _: string
549
- }[]
550
- TaxScheme: {
551
- ID: {
552
- _: string
553
- schemeAgencyID: string
554
- schemeID: string
555
- }[]
556
- }[]
557
- }[]
558
- }[]
559
- }[]
560
- }[]
561
-
562
- /** Tax exchange rate - Mandatory where applicable */
563
- TaxExchangeRate?: {
564
- SourceCurrencyCode: {
565
- _: string
566
- }[]
567
- TargetCurrencyCode: {
568
- _: string
569
- }[]
570
- CalculationRate: {
571
- _: number
572
- }[]
573
- }[]
574
-
575
- /** UBL Extensions for signatures (optional - only present in signed documents) */
576
- UBLExtensions?: {
577
- UBLExtension: {
578
- ExtensionURI: {
579
- _: string
580
- }[]
581
- ExtensionContent: {
582
- UBLDocumentSignatures: {
583
- SignatureInformation: {
584
- ID: {
585
- _: string
586
- }[]
587
- ReferencedSignatureID: {
588
- _: string
589
- }[]
590
- Signature: {
591
- Id: string
592
- Object: {
593
- QualifyingProperties: {
594
- Target: string
595
- SignedProperties: {
596
- Id: string
597
- SignedSignatureProperties: {
598
- SigningTime: {
599
- _: string
600
- }[]
601
- SigningCertificate: {
602
- Cert: {
603
- CertDigest: {
604
- DigestMethod: {
605
- Algorithm: string
606
- }[]
607
- DigestValue: {
608
- _: string
609
- }[]
610
- }[]
611
- IssuerSerial: {
612
- X509IssuerName: {
613
- _: string
614
- }[]
615
- X509SerialNumber: {
616
- _: string
617
- }[]
618
- }[]
619
- }[]
620
- }[]
621
- }[]
622
- }[]
623
- }[]
624
- }[]
625
- KeyInfo: {
626
- X509Data: {
627
- X509Certificate: {
628
- _: string
629
- }[]
630
- X509SubjectName: {
631
- _: string
632
- }[]
633
- X509IssuerSerial: {
634
- X509IssuerName: {
635
- _: string
636
- }[]
637
- X509SerialNumber: {
638
- _: string
639
- }[]
640
- }[]
641
- }[]
642
- }[]
643
- SignatureValue: {
644
- _: string
645
- }[]
646
- SignedInfo: {
647
- CanonicalizationMethod: {
648
- _: string
649
- Algorithm: string
650
- }[]
651
- SignatureMethod: {
652
- _: string
653
- Algorithm: string
654
- }[]
655
- Reference: {
656
- Id: string
657
- Type: string
658
- URI: string
659
- DigestMethod: {
660
- _: string
661
- Algorithm: string
662
- }[]
663
- DigestValue: {
664
- _: string
665
- }[]
666
- }[]
667
- }[]
668
- }[]
669
- }[]
670
- }[]
671
- }[]
672
- }[]
673
- }[]
674
-
675
- /** Signature reference (optional - only present in signed documents) */
676
- Signature?: {
677
- ID: {
678
- _: string
679
- }[]
680
- SignatureMethod: {
681
- _: string
682
- }[]
683
- }[]
684
- }
685
-
686
- /** Represents the complete UBL document structure with namespace declarations */
687
- export interface UBLDocument {
688
- /** UBL Invoice namespace */
689
- _D: string
690
- /** UBL CommonAggregateComponents namespace */
691
- _A: string
692
- /** UBL CommonBasicComponents namespace */
693
- _B: string
694
- /** Array of invoice submissions */
695
- Invoice: InvoiceSubmission[]
696
- }
697
-
698
- /** Represents the signed properties structure for digital signatures */
699
- export interface SignedPropertiesObject {
700
- SignedProperties: {
701
- /** Unique identifier for the signed properties */
702
- Id: string
703
- /** Signed signature properties containing signing details */
704
- SignedSignatureProperties: {
705
- /** Signing timestamp */
706
- SigningTime: {
707
- _: string
708
- }[]
709
- /** Signing certificate information */
710
- SigningCertificate: {
711
- /** Certificate details */
712
- Cert: {
713
- /** Certificate digest information */
714
- CertDigest: {
715
- /** Digest method algorithm */
716
- DigestMethod: {
717
- Algorithm: string
718
- }[]
719
- /** Base64 encoded digest value */
720
- DigestValue: {
721
- _: string
722
- }[]
723
- }[]
724
- /** Certificate issuer and serial information */
725
- IssuerSerial: {
726
- /** X.509 issuer distinguished name */
727
- X509IssuerName: {
728
- _: string
729
- }[]
730
- /** X.509 certificate serial number */
731
- X509SerialNumber: {
732
- _: string
733
- }[]
734
- }[]
735
- }[]
736
- }[]
737
- }[]
738
- }[]
739
- }
740
-
741
- /** Represents the signed info structure for digital signatures */
742
- export interface SignedInfoObject {
743
- /** Canonicalization method */
744
- CanonicalizationMethod: {
745
- _: string
746
- Algorithm: string
747
- }[]
748
- /** Signature method */
749
- SignatureMethod: {
750
- _: string
751
- Algorithm: string
752
- }[]
753
- /** References being signed */
754
- Reference: {
755
- Id: string
756
- Type: string
757
- URI: string
758
- DigestMethod: {
759
- _: string
760
- Algorithm: string
761
- }[]
762
- DigestValue: {
763
- _: string
764
- }[]
765
- }[]
766
- }
767
-
768
- /** Represents a complete signed invoice with all signature elements */
769
- export interface SignedInvoiceSubmission extends InvoiceSubmission {
770
- /** UBL Extensions for signatures - required for signed documents */
771
- UBLExtensions: {
772
- UBLExtension: {
773
- ExtensionURI: {
774
- _: string
775
- }[]
776
- ExtensionContent: {
777
- UBLDocumentSignatures: {
778
- SignatureInformation: {
779
- ID: {
780
- _: string
781
- }[]
782
- ReferencedSignatureID: {
783
- _: string
784
- }[]
785
- Signature: {
786
- Id: string
787
- Object: {
788
- QualifyingProperties: {
789
- Target: string
790
- SignedProperties: {
791
- Id: string
792
- SignedSignatureProperties: {
793
- SigningTime: {
794
- _: string
795
- }[]
796
- SigningCertificate: {
797
- Cert: {
798
- CertDigest: {
799
- DigestMethod: {
800
- Algorithm: string
801
- }[]
802
- DigestValue: {
803
- _: string
804
- }[]
805
- }[]
806
- IssuerSerial: {
807
- X509IssuerName: {
808
- _: string
809
- }[]
810
- X509SerialNumber: {
811
- _: string
812
- }[]
813
- }[]
814
- }[]
815
- }[]
816
- }[]
817
- }[]
818
- }[]
819
- }[]
820
- KeyInfo: {
821
- X509Data: {
822
- X509Certificate: {
823
- _: string
824
- }[]
825
- X509SubjectName: {
826
- _: string
827
- }[]
828
- X509IssuerSerial: {
829
- X509IssuerName: {
830
- _: string
831
- }[]
832
- X509SerialNumber: {
833
- _: string
834
- }[]
835
- }[]
836
- }[]
837
- }[]
838
- SignatureValue: {
839
- _: string
840
- }[]
841
- SignedInfo: SignedInfoObject[]
842
- }[]
843
- }[]
844
- }[]
845
- }[]
846
- }[]
847
- }[]
848
-
849
- /** Signature reference - required for signed documents */
850
- Signature: {
851
- ID: {
852
- _: string
853
- }[]
854
- SignatureMethod: {
855
- _: string
856
- }[]
857
- }[]
858
- }
859
-
860
- export interface CompleteInvoice {
861
- /** UBL Invoice namespace */
862
- _D: string
863
- /** UBL CommonAggregateComponents namespace */
864
- _A: string
865
- /** UBL CommonBasicComponents namespace */
866
- _B: string
867
- /** Array of signed invoice submissions */
868
- Invoice: SignedInvoiceSubmission[]
869
- }