@ripwords/myinvois-client 0.1.4 → 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/CHANGELOG.md +13 -0
- package/bun.lock +460 -0
- package/dist/0X-CTIq3y3a.d.ts +210 -0
- package/dist/0X-Cr3M7hci.d.cts +211 -0
- package/dist/1X-Bu4oiv8D.d.ts +111 -0
- package/dist/1X-BywXCqtn.d.ts +19 -0
- package/dist/1X-CWwmfCzo.d.cts +112 -0
- package/dist/1X-ClnJ79HH.d.cts +20 -0
- package/dist/2X-3fSEGIuE.d.ts +39 -0
- package/dist/2X-CV9eYhog.d.cts +40 -0
- package/dist/2X-DNtkJ0tj.d.cts +140 -0
- package/dist/2X-DnG3FY1f.d.ts +139 -0
- package/dist/3X--VWVsC84.d.cts +21 -0
- package/dist/3X-BOxfatu3.d.cts +62 -0
- package/dist/3X-CLdmoel1.d.ts +61 -0
- package/dist/3X-Ynjfgoll.d.ts +20 -0
- package/dist/4X-B5ePdMky.d.ts +30 -0
- package/dist/4X-BTG6o1Gn.d.ts +264 -0
- package/dist/4X-By9PzHaY.d.cts +31 -0
- package/dist/4X-C7fzDWJ_.d.cts +265 -0
- package/dist/5X-B5M0Cv_K.d.cts +22 -0
- package/dist/5X-CNAFsDm2.d.cts +77 -0
- package/dist/5X-CjSz1zxJ.d.ts +76 -0
- package/dist/5X-dhP6fyou.d.ts +21 -0
- package/dist/6X-B9KP_vEn.d.ts +104 -0
- package/dist/6X-BHaY0TCf.d.ts +15 -0
- package/dist/6X-C3elgd-n.d.cts +16 -0
- package/dist/6X-uObUP4VG.d.cts +105 -0
- package/dist/7X-BifJnY24.d.cts +71 -0
- package/dist/7X-C4eX_tAk.d.ts +15 -0
- package/dist/7X-D3idQBl9.d.cts +16 -0
- package/dist/7X-DtkQutx2.d.ts +70 -0
- package/dist/8X-5n9seY3z.d.ts +109 -0
- package/dist/8X-C6UMFvQW.d.cts +19 -0
- package/dist/8X-D6HTLShY.d.ts +18 -0
- package/dist/8X-DioBXCJ0.d.cts +110 -0
- package/dist/9X-BjffnXuq.d.cts +98 -0
- package/dist/9X-CHZKsIdD.d.ts +14 -0
- package/dist/9X-CJjPJgIG.d.cts +15 -0
- package/dist/9X-Cpb6V4JC.d.ts +97 -0
- package/dist/AX-C0w_r3PA.d.ts +110 -0
- package/dist/AX-DrEd2Ov6.d.cts +111 -0
- package/dist/BX-C5jc6myN.d.cts +115 -0
- package/dist/BX-RadlZ-6m.d.ts +114 -0
- package/dist/CX-CT1Zzb9D.d.ts +127 -0
- package/dist/CX-oSgvmn3h.d.cts +128 -0
- package/dist/DX-CtUeTKMM.d.ts +114 -0
- package/dist/DX-ZIG0enmK.d.cts +115 -0
- package/dist/EX-084Yu7Wt.d.ts +106 -0
- package/dist/EX-BpWZ5ADq.d.cts +107 -0
- package/dist/FX-BrbQM0CW.d.ts +126 -0
- package/dist/FX-CvYBEc51.d.cts +127 -0
- package/dist/GX-CU8PZy0G.d.cts +136 -0
- package/dist/GX-gKj8iAAh.d.ts +135 -0
- package/dist/HX-9D-ZXTy5.d.ts +125 -0
- package/dist/HX-DoEErDeE.d.cts +126 -0
- package/dist/IX-DR4Fc92A.d.ts +22 -0
- package/dist/IX-jLAUHe8i.d.cts +23 -0
- package/dist/JX-DIKa9ma-.d.ts +103 -0
- package/dist/JX-DX8BjYQC.d.cts +104 -0
- package/dist/KX-DpsJ_unT.d.ts +150 -0
- package/dist/KX-fZb4_vhw.d.cts +151 -0
- package/dist/LX-D_mI1bk-.d.cts +123 -0
- package/dist/LX-DeXPPWUX.d.ts +122 -0
- package/dist/MX-CKMjg_zK.d.ts +152 -0
- package/dist/MX-DlYZhpkT.d.cts +153 -0
- package/dist/NX-DELEEbad.d.cts +122 -0
- package/dist/NX-oYdb4NDo.d.ts +121 -0
- package/dist/OX-Bid9es3D.d.ts +25 -0
- package/dist/OX-CKPyrIFf.d.cts +26 -0
- package/dist/PX-D7jy9CFk.d.ts +120 -0
- package/dist/PX-SP6NxBtG.d.cts +121 -0
- package/dist/QX-BFWOR4g3.d.ts +58 -0
- package/dist/QX-QZA7E2O-.d.cts +59 -0
- package/dist/RX-DBcgbdeE.d.cts +23 -0
- package/dist/RX-XHgCyMV1.d.ts +22 -0
- package/dist/SX-Cl8RN8oH.d.ts +39 -0
- package/dist/SX-DmiJeCMN.d.cts +40 -0
- package/dist/TX-C1SoDobK.d.cts +31 -0
- package/dist/TX-ZymoIbtr.d.ts +30 -0
- package/dist/UX-D-Ndd1ov.d.ts +17 -0
- package/dist/UX-DFVynFhQ.d.cts +18 -0
- package/dist/VX-B-1b34r7.d.ts +16 -0
- package/dist/VX-DsRum5k3.d.cts +17 -0
- package/dist/WX-0GuMjPNZ.d.ts +25 -0
- package/dist/WX-VReU5R5M.d.cts +26 -0
- package/dist/XX-CF2NANsy.d.ts +827 -0
- package/dist/XX-ChAviUMj.d.cts +828 -0
- package/dist/YX-B51BbNSg.d.ts +19 -0
- package/dist/YX-QfzeMEKx.d.cts +20 -0
- package/dist/ZX-BMJS1iAv.d.ts +21 -0
- package/dist/ZX-Ca2E726a.d.cts +22 -0
- package/dist/api/platform/platformLogin.d.ts +65 -0
- package/dist/api/platform/platformLogin.js +3 -0
- package/dist/certificate-DFK-788s.cjs +62 -0
- package/dist/certificate-DFK-788s.cjs.map +1 -0
- package/dist/certificate-aooIRf9A.js +49 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/classification-codes-B15PbWxz.d.cts +118 -0
- package/dist/classification-codes-BKxV-rO9.d.ts +117 -0
- package/dist/country-code-CQuaiQm2.d.ts +542 -0
- package/dist/country-code-DPeNFMMi.d.cts +543 -0
- package/dist/currencies-BYJK-m6v.d.ts +207 -0
- package/dist/currencies-S5g1gzBU.d.cts +208 -0
- package/dist/document-CARHiGdp.cjs +472 -0
- package/dist/document-CARHiGdp.cjs.map +1 -0
- package/dist/document-D6VKMAtx.js +405 -0
- package/dist/documents-CQy_uB6C.d.cts +858 -0
- package/dist/documents-i5EV868Y.d.ts +857 -0
- package/dist/e-invoice-BuwtFnlI.d.cts +44 -0
- package/dist/e-invoice-CmbLQkHw.d.ts +43 -0
- package/dist/getBaseUrl-CO7Jp27d.cjs +14 -0
- package/dist/getBaseUrl-CO7Jp27d.cjs.map +1 -0
- package/dist/getBaseUrl-R3IdgCu3.js +7 -0
- package/dist/index-0-EvC6Nv.d.ts +15 -0
- package/dist/index-D2_HVwCz.d.cts +16 -0
- package/dist/index.cjs +309 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +233 -0
- package/dist/index.js +308 -0
- package/dist/index10.cjs +0 -0
- package/dist/index11.cjs +34 -0
- package/dist/index11.cjs.map +1 -0
- package/dist/index12.cjs +24 -0
- package/dist/index12.cjs.map +1 -0
- package/dist/index13.cjs +0 -0
- package/dist/index14.cjs +13 -0
- package/dist/index14.cjs.map +1 -0
- package/dist/index15.cjs +4 -0
- package/dist/index16.cjs +13 -0
- package/dist/index17.cjs +3 -0
- package/dist/index18.cjs +340 -0
- package/dist/index18.cjs.map +1 -0
- package/dist/index19.cjs +329 -0
- package/dist/index19.cjs.map +1 -0
- package/dist/index2.cjs +62 -0
- package/dist/index2.cjs.map +1 -0
- package/dist/index20.cjs +140 -0
- package/dist/index20.cjs.map +1 -0
- package/dist/index21.cjs +3 -0
- package/dist/index22.cjs +208 -0
- package/dist/index22.cjs.map +1 -0
- package/dist/index23.cjs +109 -0
- package/dist/index23.cjs.map +1 -0
- package/dist/index24.cjs +137 -0
- package/dist/index24.cjs.map +1 -0
- package/dist/index25.cjs +64 -0
- package/dist/index25.cjs.map +1 -0
- package/dist/index26.cjs +267 -0
- package/dist/index26.cjs.map +1 -0
- package/dist/index27.cjs +79 -0
- package/dist/index27.cjs.map +1 -0
- package/dist/index28.cjs +107 -0
- package/dist/index28.cjs.map +1 -0
- package/dist/index29.cjs +73 -0
- package/dist/index29.cjs.map +1 -0
- package/dist/index3.cjs +532 -0
- package/dist/index3.cjs.map +1 -0
- package/dist/index30.cjs +112 -0
- package/dist/index30.cjs.map +1 -0
- package/dist/index31.cjs +100 -0
- package/dist/index31.cjs.map +1 -0
- package/dist/index32.cjs +18 -0
- package/dist/index32.cjs.map +1 -0
- package/dist/index33.cjs +38 -0
- package/dist/index33.cjs.map +1 -0
- package/dist/index34.cjs +19 -0
- package/dist/index34.cjs.map +1 -0
- package/dist/index35.cjs +29 -0
- package/dist/index35.cjs.map +1 -0
- package/dist/index36.cjs +20 -0
- package/dist/index36.cjs.map +1 -0
- package/dist/index37.cjs +14 -0
- package/dist/index37.cjs.map +1 -0
- package/dist/index38.cjs +14 -0
- package/dist/index38.cjs.map +1 -0
- package/dist/index39.cjs +17 -0
- package/dist/index39.cjs.map +1 -0
- package/dist/index4.cjs +196 -0
- package/dist/index4.cjs.map +1 -0
- package/dist/index40.cjs +13 -0
- package/dist/index40.cjs.map +1 -0
- package/dist/index41.cjs +108 -0
- package/dist/index41.cjs.map +1 -0
- package/dist/index42.cjs +113 -0
- package/dist/index42.cjs.map +1 -0
- package/dist/index43.cjs +126 -0
- package/dist/index43.cjs.map +1 -0
- package/dist/index44.cjs +113 -0
- package/dist/index44.cjs.map +1 -0
- package/dist/index45.cjs +105 -0
- package/dist/index45.cjs.map +1 -0
- package/dist/index46.cjs +125 -0
- package/dist/index46.cjs.map +1 -0
- package/dist/index47.cjs +134 -0
- package/dist/index47.cjs.map +1 -0
- package/dist/index48.cjs +124 -0
- package/dist/index48.cjs.map +1 -0
- package/dist/index49.cjs +21 -0
- package/dist/index49.cjs.map +1 -0
- package/dist/index5.cjs +0 -0
- package/dist/index50.cjs +102 -0
- package/dist/index50.cjs.map +1 -0
- package/dist/index51.cjs +149 -0
- package/dist/index51.cjs.map +1 -0
- package/dist/index52.cjs +121 -0
- package/dist/index52.cjs.map +1 -0
- package/dist/index53.cjs +151 -0
- package/dist/index53.cjs.map +1 -0
- package/dist/index54.cjs +120 -0
- package/dist/index54.cjs.map +1 -0
- package/dist/index55.cjs +24 -0
- package/dist/index55.cjs.map +1 -0
- package/dist/index56.cjs +119 -0
- package/dist/index56.cjs.map +1 -0
- package/dist/index57.cjs +54 -0
- package/dist/index57.cjs.map +1 -0
- package/dist/index58.cjs +21 -0
- package/dist/index58.cjs.map +1 -0
- package/dist/index58.cts.map +1 -0
- package/dist/index59.cjs +35 -0
- package/dist/index59.cjs.map +1 -0
- package/dist/index59.cts.map +1 -0
- package/dist/index6.cjs +25 -0
- package/dist/index6.cjs.map +1 -0
- package/dist/index60.cjs +29 -0
- package/dist/index60.cjs.map +1 -0
- package/dist/index60.cts.map +1 -0
- package/dist/index61.cjs +16 -0
- package/dist/index61.cjs.map +1 -0
- package/dist/index61.cts.map +1 -0
- package/dist/index62.cjs +15 -0
- package/dist/index62.cjs.map +1 -0
- package/dist/index62.cts.map +1 -0
- package/dist/index63.cjs +24 -0
- package/dist/index63.cjs.map +1 -0
- package/dist/index63.cts.map +1 -0
- package/dist/index64.cjs +419 -0
- package/dist/index64.cjs.map +1 -0
- package/dist/index64.cts.map +1 -0
- package/dist/index65.cjs +15 -0
- package/dist/index65.cjs.map +1 -0
- package/dist/index65.cts.map +1 -0
- package/dist/index66.cjs +16 -0
- package/dist/index66.cjs.map +1 -0
- package/dist/index66.cts.map +1 -0
- package/dist/index7.cjs +0 -0
- package/dist/index8.cjs +0 -0
- package/dist/index9.cjs +25 -0
- package/dist/index9.cjs.map +1 -0
- package/dist/msic-codes-C8PJVOaA.d.ts +25 -0
- package/dist/msic-codes-CIKdPqag.d.cts +26 -0
- package/dist/payment-modes-BOTSRC_X.d.ts +43 -0
- package/dist/payment-modes-ghFEXnUl.d.cts +44 -0
- package/dist/platformLogin-PGzMhw1X.cjs +37 -0
- package/dist/platformLogin-PGzMhw1X.cjs.map +1 -0
- package/dist/platformLogin-f0bNAoZI.js +30 -0
- package/dist/signatures-W-_brwdb.d.ts +172 -0
- package/dist/signatures-hFbt_std.d.cts +173 -0
- package/dist/state-codes-BlILGZ9d.d.cts +62 -0
- package/dist/state-codes-oeFKlwXZ.d.ts +61 -0
- package/dist/tax-types-B5sQ8UyN.d.cts +42 -0
- package/dist/tax-types-CsQ76JMf.d.ts +41 -0
- package/dist/types/classification-codes.d.ts +2 -0
- package/dist/types/country-code.d.ts +2 -0
- package/dist/types/currencies.d.ts +2 -0
- package/dist/types/documents.d.ts +18 -0
- package/dist/types/e-invoice.d.ts +2 -0
- package/dist/types/index.d.ts +58 -0
- package/dist/types/msic/0X.d.ts +2 -0
- package/dist/types/msic/1X.d.ts +2 -0
- package/dist/types/msic/2X.d.ts +2 -0
- package/dist/types/msic/3X.d.ts +2 -0
- package/dist/types/msic/4X.d.ts +2 -0
- package/dist/types/msic/5X.d.ts +2 -0
- package/dist/types/msic/6X.d.ts +2 -0
- package/dist/types/msic/7X.d.ts +2 -0
- package/dist/types/msic/8X.d.ts +2 -0
- package/dist/types/msic/9X.d.ts +2 -0
- package/dist/types/msic-codes.d.ts +12 -0
- package/dist/types/payment-modes.d.ts +2 -0
- package/dist/types/signatures.d.ts +2 -0
- package/dist/types/state-codes.d.ts +2 -0
- package/dist/types/tax-types.d.ts +2 -0
- package/dist/types/unit/1X.d.ts +2 -0
- package/dist/types/unit/2X.d.ts +2 -0
- package/dist/types/unit/3X.d.ts +2 -0
- package/dist/types/unit/4X.d.ts +2 -0
- package/dist/types/unit/5X.d.ts +2 -0
- package/dist/types/unit/6X.d.ts +2 -0
- package/dist/types/unit/7X.d.ts +2 -0
- package/dist/types/unit/8X.d.ts +2 -0
- package/dist/types/unit/9X.d.ts +2 -0
- package/dist/types/unit/AX.d.ts +2 -0
- package/dist/types/unit/BX.d.ts +2 -0
- package/dist/types/unit/CX.d.ts +2 -0
- package/dist/types/unit/DX.d.ts +2 -0
- package/dist/types/unit/EX.d.ts +2 -0
- package/dist/types/unit/FX.d.ts +2 -0
- package/dist/types/unit/GX.d.ts +2 -0
- package/dist/types/unit/HX.d.ts +2 -0
- package/dist/types/unit/IX.d.ts +2 -0
- package/dist/types/unit/JX.d.ts +2 -0
- package/dist/types/unit/KX.d.ts +2 -0
- package/dist/types/unit/LX.d.ts +2 -0
- package/dist/types/unit/MX.d.ts +2 -0
- package/dist/types/unit/NX.d.ts +2 -0
- package/dist/types/unit/OX.d.ts +2 -0
- package/dist/types/unit/PX.d.ts +2 -0
- package/dist/types/unit/QX.d.ts +2 -0
- package/dist/types/unit/RX.d.ts +2 -0
- package/dist/types/unit/SX.d.ts +2 -0
- package/dist/types/unit/TX.d.ts +2 -0
- package/dist/types/unit/UX.d.ts +2 -0
- package/dist/types/unit/VX.d.ts +2 -0
- package/dist/types/unit/WX.d.ts +2 -0
- package/dist/types/unit/XX.d.ts +2 -0
- package/dist/types/unit/YX.d.ts +2 -0
- package/dist/types/unit/ZX.d.ts +2 -0
- package/dist/types/unit-types.d.ts +37 -0
- package/dist/unit-types-B41YFOLT.d.ts +55 -0
- package/dist/unit-types-CjWNk2wS.d.cts +56 -0
- package/dist/utils/base64.d.ts +5 -0
- package/dist/utils/base64.js +10 -0
- package/dist/utils/certificate.d.ts +22 -0
- package/dist/utils/certificate.js +3 -0
- package/dist/utils/document.d.ts +135 -0
- package/dist/utils/document.js +3 -0
- package/dist/utils/getBaseUrl.d.ts +4 -0
- package/dist/utils/getBaseUrl.js +3 -0
- package/dist/utils/helpers.d.ts +271 -0
- package/dist/utils/helpers.js +330 -0
- package/dist/utils/signature-diagnostics.d.ts +93 -0
- package/dist/utils/signature-diagnostics.js +326 -0
- package/dist/utils/validation.d.ts +46 -0
- package/dist/utils/validation.js +134 -0
- package/package.json +4 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { Classification, ClassificationCode, ClassificationCodeEnum } from "./classification-codes-BKxV-rO9.js";
|
|
2
|
+
import { Country, CountryCode, CountryCodeEnum, CountryNameEnum } from "./country-code-CQuaiQm2.js";
|
|
3
|
+
import { Currency, CurrencyCode, CurrencyCodeEnum } from "./currencies-BYJK-m6v.js";
|
|
4
|
+
import { EInvoiceType, EInvoiceTypeCode, EInvoiceTypeCodeEnum } from "./e-invoice-CmbLQkHw.js";
|
|
5
|
+
import "./0X-CTIq3y3a.js";
|
|
6
|
+
import "./1X-Bu4oiv8D.js";
|
|
7
|
+
import "./2X-DnG3FY1f.js";
|
|
8
|
+
import "./3X-CLdmoel1.js";
|
|
9
|
+
import "./4X-BTG6o1Gn.js";
|
|
10
|
+
import "./5X-CjSz1zxJ.js";
|
|
11
|
+
import "./6X-B9KP_vEn.js";
|
|
12
|
+
import "./7X-DtkQutx2.js";
|
|
13
|
+
import "./8X-5n9seY3z.js";
|
|
14
|
+
import "./9X-Cpb6V4JC.js";
|
|
15
|
+
import { MSICCode } from "./msic-codes-C8PJVOaA.js";
|
|
16
|
+
import { CanonicalizationMethod, Cert, CertDigest, DigestMethod, IssuerDigitalSignature, IssuerSerial, KeyInfo, QualifyingProperties, Reference, SignatureMethod, SignedInfo, SignedProperties, SignedSignatureProperties, SigningCertificate, Transform, X509Data } from "./signatures-W-_brwdb.js";
|
|
17
|
+
import { TaxType, TaxTypeCode, TaxTypeCodeEnum } from "./tax-types-CsQ76JMf.js";
|
|
18
|
+
import { Address, Buyer, CompleteInvoice, DocumentStatus, DocumentSummary, DocumentValidationResult, DocumentValidationStepResult, FinalDocumentData, GetSubmissionResponse, InvoiceLineItem, InvoiceSubmission, InvoiceV1_1, LegalMonetaryTotal, RegistrationType, ResponseDocument, SignedInfoObject, SignedInvoiceSubmission, SignedPropertiesData, SignedPropertiesObject, SigningCredentials, StandardError, SubmissionResponse, SubmissionStatus, Supplier, TaxCategory, TaxSubtotal, TaxTotal, UBLDocument } from "./documents-i5EV868Y.js";
|
|
19
|
+
import { PaymentMode, PaymentModeCode, PaymentModeCodeEnum } from "./payment-modes-BOTSRC_X.js";
|
|
20
|
+
import "./1X-BywXCqtn.js";
|
|
21
|
+
import "./2X-3fSEGIuE.js";
|
|
22
|
+
import "./3X-Ynjfgoll.js";
|
|
23
|
+
import "./4X-B5ePdMky.js";
|
|
24
|
+
import "./5X-dhP6fyou.js";
|
|
25
|
+
import "./6X-BHaY0TCf.js";
|
|
26
|
+
import "./7X-C4eX_tAk.js";
|
|
27
|
+
import "./8X-D6HTLShY.js";
|
|
28
|
+
import "./9X-CHZKsIdD.js";
|
|
29
|
+
import "./AX-C0w_r3PA.js";
|
|
30
|
+
import "./BX-RadlZ-6m.js";
|
|
31
|
+
import "./CX-CT1Zzb9D.js";
|
|
32
|
+
import "./DX-CtUeTKMM.js";
|
|
33
|
+
import "./EX-084Yu7Wt.js";
|
|
34
|
+
import "./FX-BrbQM0CW.js";
|
|
35
|
+
import "./GX-gKj8iAAh.js";
|
|
36
|
+
import "./HX-9D-ZXTy5.js";
|
|
37
|
+
import "./IX-DR4Fc92A.js";
|
|
38
|
+
import "./JX-DIKa9ma-.js";
|
|
39
|
+
import "./KX-DpsJ_unT.js";
|
|
40
|
+
import "./LX-DeXPPWUX.js";
|
|
41
|
+
import "./MX-CKMjg_zK.js";
|
|
42
|
+
import "./NX-oYdb4NDo.js";
|
|
43
|
+
import "./OX-Bid9es3D.js";
|
|
44
|
+
import "./PX-D7jy9CFk.js";
|
|
45
|
+
import "./QX-BFWOR4g3.js";
|
|
46
|
+
import "./RX-XHgCyMV1.js";
|
|
47
|
+
import "./SX-Cl8RN8oH.js";
|
|
48
|
+
import "./TX-ZymoIbtr.js";
|
|
49
|
+
import "./UX-D-Ndd1ov.js";
|
|
50
|
+
import "./VX-B-1b34r7.js";
|
|
51
|
+
import "./WX-0GuMjPNZ.js";
|
|
52
|
+
import "./YX-B51BbNSg.js";
|
|
53
|
+
import "./ZX-BMJS1iAv.js";
|
|
54
|
+
import "./XX-CF2NANsy.js";
|
|
55
|
+
import { UnitType, UnitTypeCode } from "./unit-types-B41YFOLT.js";
|
|
56
|
+
import { State, StateCode, StateCodeEnum } from "./state-codes-oeFKlwXZ.js";
|
|
57
|
+
import { ClientCredentials, TokenResponse } from "./index-0-EvC6Nv.js";
|
|
58
|
+
|
|
59
|
+
//#region src/index.d.ts
|
|
60
|
+
declare class MyInvoisClient {
|
|
61
|
+
private readonly baseUrl;
|
|
62
|
+
private readonly clientId;
|
|
63
|
+
private readonly clientSecret;
|
|
64
|
+
private readonly onBehalfOf?;
|
|
65
|
+
private readonly signingCredentials;
|
|
66
|
+
private readonly debug;
|
|
67
|
+
private token;
|
|
68
|
+
private tokenExpiration;
|
|
69
|
+
constructor(clientId: string, clientSecret: string, environment: "sandbox" | "production", certificatePem: string, privateKeyPem: string, onBehalfOf?: string, debug?: boolean);
|
|
70
|
+
private refreshToken;
|
|
71
|
+
private getToken;
|
|
72
|
+
private fetch;
|
|
73
|
+
/**
|
|
74
|
+
* Validates a TIN against a NRIC/ARMY/PASSPORT/BRN (Business Registration Number)
|
|
75
|
+
*
|
|
76
|
+
* @param tin - The TIN to validate
|
|
77
|
+
* @param idType - The type of ID to validate against
|
|
78
|
+
* @param idValue - The value of the ID to validate against
|
|
79
|
+
* @returns true if the TIN is valid, false otherwise
|
|
80
|
+
*/
|
|
81
|
+
verifyTin(tin: string, idType: RegistrationType, idValue: string): Promise<boolean>;
|
|
82
|
+
/**
|
|
83
|
+
* Submits one or more e-invoice documents to the MyInvois platform for processing.
|
|
84
|
+
*
|
|
85
|
+
* This method digitally signs each document using the provided certificate and private key,
|
|
86
|
+
* generates document hashes, encodes them for submission, and sends them to the platform.
|
|
87
|
+
* The method includes comprehensive validation warnings for document size and count limits.
|
|
88
|
+
*
|
|
89
|
+
* @param documents - Array of InvoiceV1_1 documents to be submitted
|
|
90
|
+
* @returns Promise resolving to submission response containing the submission data and HTTP status
|
|
91
|
+
* @throws {Error} If PRIVATE_KEY or CERTIFICATE environment variables are missing
|
|
92
|
+
* @throws {Error} If document signing, encoding, or API submission fails
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* // Submit a single invoice
|
|
97
|
+
* const result = await client.submitDocument([invoiceData]);
|
|
98
|
+
* console.log(result.data.submissionUid); // Track submission with this UID
|
|
99
|
+
*
|
|
100
|
+
* // Submit multiple invoices
|
|
101
|
+
* const result = await client.submitDocument([invoice1, invoice2, invoice3]);
|
|
102
|
+
* if (result.status === 202) {
|
|
103
|
+
* console.log('Documents submitted successfully');
|
|
104
|
+
* }
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* - Requires PRIVATE_KEY and CERTIFICATE environment variables for document signing
|
|
109
|
+
* - Each document is digitally signed with XML-DSIG before submission
|
|
110
|
+
* - Documents are base64-encoded for transmission
|
|
111
|
+
* - API limits: Max 100 documents per submission, 5MB total payload, 300KB per document
|
|
112
|
+
* - Debug mode provides detailed logging of payload sizes and validation warnings
|
|
113
|
+
* - Returns HTTP 202 for successful submissions that require processing
|
|
114
|
+
*/
|
|
115
|
+
submitDocument(documents: InvoiceV1_1[]): Promise<{
|
|
116
|
+
data: SubmissionResponse;
|
|
117
|
+
status: number;
|
|
118
|
+
}>;
|
|
119
|
+
getSubmissionStatus(submissionUid: string, pollInterval?: number, maxRetries?: number): Promise<{
|
|
120
|
+
status: SubmissionStatus;
|
|
121
|
+
documentSummary?: DocumentSummary[];
|
|
122
|
+
error?: {
|
|
123
|
+
code: string;
|
|
124
|
+
message: string | null;
|
|
125
|
+
target: string;
|
|
126
|
+
details: {
|
|
127
|
+
code: string;
|
|
128
|
+
message: string;
|
|
129
|
+
target: string;
|
|
130
|
+
}[];
|
|
131
|
+
};
|
|
132
|
+
}>;
|
|
133
|
+
/**
|
|
134
|
+
* Retrieves a document by its unique identifier with the raw document content.
|
|
135
|
+
*
|
|
136
|
+
* @param documentUid - The unique identifier of the document to retrieve
|
|
137
|
+
* @returns Promise resolving to document summary with raw document content as a string
|
|
138
|
+
* @throws {Error} If the document is not found or request fails
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* const document = await client.getDocument('doc-uuid-123');
|
|
143
|
+
* console.log(document.document); // Raw XML/JSON content
|
|
144
|
+
* console.log(document.uuid); // Document UUID
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
getDocument(documentUid: string): Promise<DocumentSummary & {
|
|
148
|
+
document: string;
|
|
149
|
+
}>;
|
|
150
|
+
/**
|
|
151
|
+
* Retrieves detailed information about a document including validation results.
|
|
152
|
+
*
|
|
153
|
+
* @param documentUid - The unique identifier of the document to get details for
|
|
154
|
+
* @returns Promise resolving to document summary with detailed validation results
|
|
155
|
+
* @throws {Error} If the document is not found or request fails
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```typescript
|
|
159
|
+
* const details = await client.getDocumentDetails('doc-uuid-123');
|
|
160
|
+
* console.log(details.validationResults.status); // 'Valid' | 'Invalid' | 'Processing'
|
|
161
|
+
* console.log(details.validationResults.validationSteps); // Array of validation step results
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
getDocumentDetails(documentUid: string): Promise<DocumentSummary & {
|
|
165
|
+
validationResults: {
|
|
166
|
+
status: DocumentValidationResult;
|
|
167
|
+
validationSteps: DocumentValidationStepResult[];
|
|
168
|
+
};
|
|
169
|
+
}>;
|
|
170
|
+
/**
|
|
171
|
+
* Searches for documents based on various filter criteria.
|
|
172
|
+
*
|
|
173
|
+
* @param params - Search parameters object
|
|
174
|
+
* @param params.uuid - Optional specific document UUID to search for
|
|
175
|
+
* @param params.submissionDateFrom - Required start date for submission date range (ISO date string)
|
|
176
|
+
* @param params.submissionDateTo - Optional end date for submission date range (ISO date string)
|
|
177
|
+
* @param params.pageSize - Optional number of results per page (default handled by API)
|
|
178
|
+
* @param params.pageNo - Optional page number for pagination (0-based)
|
|
179
|
+
* @param params.issueDateFrom - Optional start date for issue date range (ISO date string)
|
|
180
|
+
* @param params.issueDateTo - Optional end date for issue date range (ISO date string)
|
|
181
|
+
* @param params.invoiceDirection - Optional filter by invoice direction ('Sent' or 'Received')
|
|
182
|
+
* @param params.status - Optional filter by document status
|
|
183
|
+
* @param params.documentType - Optional filter by e-invoice type code
|
|
184
|
+
* @param params.searchQuery - Optional text search across uuid, buyerTIN, supplierTIN, buyerName, supplierName, internalID, total
|
|
185
|
+
* @returns Promise resolving to array of document summaries matching the search criteria
|
|
186
|
+
* @throws {Error} If the search request fails
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* // Search for documents submitted in the last 30 days
|
|
191
|
+
* const documents = await client.searchDocuments({
|
|
192
|
+
* submissionDateFrom: '2024-01-01',
|
|
193
|
+
* submissionDateTo: '2024-01-31',
|
|
194
|
+
* status: 'Valid',
|
|
195
|
+
* pageSize: 10
|
|
196
|
+
* });
|
|
197
|
+
*
|
|
198
|
+
* // Search by supplier name
|
|
199
|
+
* const supplierDocs = await client.searchDocuments({
|
|
200
|
+
* submissionDateFrom: '2024-01-01',
|
|
201
|
+
* searchQuery: 'ACME Corp',
|
|
202
|
+
* invoiceDirection: 'Received'
|
|
203
|
+
* });
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
searchDocuments({
|
|
207
|
+
uuid,
|
|
208
|
+
submissionDateFrom,
|
|
209
|
+
submissionDateTo,
|
|
210
|
+
pageSize,
|
|
211
|
+
pageNo,
|
|
212
|
+
issueDateFrom,
|
|
213
|
+
issueDateTo,
|
|
214
|
+
invoiceDirection,
|
|
215
|
+
status,
|
|
216
|
+
documentType,
|
|
217
|
+
searchQuery
|
|
218
|
+
}: {
|
|
219
|
+
uuid?: string;
|
|
220
|
+
submissionDateFrom: string;
|
|
221
|
+
submissionDateTo?: string;
|
|
222
|
+
pageSize?: number;
|
|
223
|
+
pageNo?: number;
|
|
224
|
+
issueDateFrom?: string;
|
|
225
|
+
issueDateTo?: string;
|
|
226
|
+
invoiceDirection?: "Sent" | "Received";
|
|
227
|
+
status?: DocumentStatus;
|
|
228
|
+
documentType?: EInvoiceTypeCode;
|
|
229
|
+
searchQuery?: string;
|
|
230
|
+
}): Promise<DocumentSummary[]>;
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
export { Address, Buyer, CanonicalizationMethod, Cert, CertDigest, Classification, ClassificationCode, ClassificationCodeEnum, ClientCredentials, CompleteInvoice, Country, CountryCode, CountryCodeEnum, CountryNameEnum, Currency, CurrencyCode, CurrencyCodeEnum, DigestMethod, DocumentStatus, DocumentSummary, DocumentValidationResult, DocumentValidationStepResult, EInvoiceType, EInvoiceTypeCode, EInvoiceTypeCodeEnum, FinalDocumentData, GetSubmissionResponse, InvoiceLineItem, InvoiceSubmission, InvoiceV1_1, IssuerDigitalSignature, IssuerSerial, KeyInfo, LegalMonetaryTotal, MSICCode, MyInvoisClient, PaymentMode, PaymentModeCode, PaymentModeCodeEnum, QualifyingProperties, Reference, RegistrationType, ResponseDocument, SignatureMethod, SignedInfo, SignedInfoObject, SignedInvoiceSubmission, SignedProperties, SignedPropertiesData, SignedPropertiesObject, SignedSignatureProperties, SigningCertificate, SigningCredentials, StandardError, State, StateCode, StateCodeEnum, SubmissionResponse, SubmissionStatus, Supplier, TaxCategory, TaxSubtotal, TaxTotal, TaxType, TaxTypeCode, TaxTypeCodeEnum, TokenResponse, Transform, UBLDocument, UnitType, UnitTypeCode, X509Data };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { platformLogin } from "./platformLogin-f0bNAoZI.js";
|
|
2
|
+
import { getBaseUrl } from "./getBaseUrl-R3IdgCu3.js";
|
|
3
|
+
import { extractCertificateInfo, validateKeyPair } from "./certificate-aooIRf9A.js";
|
|
4
|
+
import { generateCompleteDocument } from "./document-D6VKMAtx.js";
|
|
5
|
+
|
|
6
|
+
//#region src/index.ts
|
|
7
|
+
var MyInvoisClient = class {
|
|
8
|
+
baseUrl;
|
|
9
|
+
clientId;
|
|
10
|
+
clientSecret;
|
|
11
|
+
onBehalfOf;
|
|
12
|
+
signingCredentials;
|
|
13
|
+
debug;
|
|
14
|
+
token = "";
|
|
15
|
+
tokenExpiration = void 0;
|
|
16
|
+
constructor(clientId, clientSecret, environment, certificatePem, privateKeyPem, onBehalfOf, debug) {
|
|
17
|
+
if (!privateKeyPem || !certificatePem) throw new Error("Missing required environment variables: PRIVATE_KEY and CERTIFICATE");
|
|
18
|
+
if (!validateKeyPair(certificatePem, privateKeyPem)) throw new Error("Certificate and private key do not match");
|
|
19
|
+
this.clientId = clientId;
|
|
20
|
+
this.clientSecret = clientSecret;
|
|
21
|
+
this.baseUrl = getBaseUrl(environment);
|
|
22
|
+
this.onBehalfOf = onBehalfOf;
|
|
23
|
+
this.debug = debug ?? process.env.MYINVOIS_DEBUG === "true" ? true : false;
|
|
24
|
+
const { issuerName, serialNumber } = extractCertificateInfo(certificatePem);
|
|
25
|
+
this.signingCredentials = {
|
|
26
|
+
privateKeyPem,
|
|
27
|
+
certificatePem,
|
|
28
|
+
issuerName,
|
|
29
|
+
serialNumber
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
async refreshToken() {
|
|
33
|
+
const tokenResponse = await platformLogin({
|
|
34
|
+
clientId: this.clientId,
|
|
35
|
+
clientSecret: this.clientSecret,
|
|
36
|
+
baseUrl: this.baseUrl,
|
|
37
|
+
onBehalfOf: this.onBehalfOf,
|
|
38
|
+
debug: this.debug
|
|
39
|
+
});
|
|
40
|
+
this.token = tokenResponse.token;
|
|
41
|
+
this.tokenExpiration = tokenResponse.tokenExpiration;
|
|
42
|
+
}
|
|
43
|
+
async getToken() {
|
|
44
|
+
if (!this.tokenExpiration || this.tokenExpiration < /* @__PURE__ */ new Date() || isNaN(this.tokenExpiration.getTime())) {
|
|
45
|
+
if (this.debug) {
|
|
46
|
+
console.log("Token expired");
|
|
47
|
+
console.log("Refreshing token");
|
|
48
|
+
}
|
|
49
|
+
await this.refreshToken();
|
|
50
|
+
}
|
|
51
|
+
return this.token;
|
|
52
|
+
}
|
|
53
|
+
async fetch(path, options = {}) {
|
|
54
|
+
const token = await this.getToken();
|
|
55
|
+
return fetch(`${this.baseUrl}${path}`, {
|
|
56
|
+
...options,
|
|
57
|
+
headers: {
|
|
58
|
+
...options.headers,
|
|
59
|
+
Authorization: `Bearer ${token}`
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Validates a TIN against a NRIC/ARMY/PASSPORT/BRN (Business Registration Number)
|
|
65
|
+
*
|
|
66
|
+
* @param tin - The TIN to validate
|
|
67
|
+
* @param idType - The type of ID to validate against
|
|
68
|
+
* @param idValue - The value of the ID to validate against
|
|
69
|
+
* @returns true if the TIN is valid, false otherwise
|
|
70
|
+
*/
|
|
71
|
+
async verifyTin(tin, idType, idValue) {
|
|
72
|
+
try {
|
|
73
|
+
const response = await this.fetch(`/api/v1.0/taxpayer/validate/${tin}?idType=${idType}&idValue=${idValue}`, { method: "GET" });
|
|
74
|
+
if (response.status === 200) return true;
|
|
75
|
+
return false;
|
|
76
|
+
} catch (error) {
|
|
77
|
+
if (this.debug) console.error(error);
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Submits one or more e-invoice documents to the MyInvois platform for processing.
|
|
83
|
+
*
|
|
84
|
+
* This method digitally signs each document using the provided certificate and private key,
|
|
85
|
+
* generates document hashes, encodes them for submission, and sends them to the platform.
|
|
86
|
+
* The method includes comprehensive validation warnings for document size and count limits.
|
|
87
|
+
*
|
|
88
|
+
* @param documents - Array of InvoiceV1_1 documents to be submitted
|
|
89
|
+
* @returns Promise resolving to submission response containing the submission data and HTTP status
|
|
90
|
+
* @throws {Error} If PRIVATE_KEY or CERTIFICATE environment variables are missing
|
|
91
|
+
* @throws {Error} If document signing, encoding, or API submission fails
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* // Submit a single invoice
|
|
96
|
+
* const result = await client.submitDocument([invoiceData]);
|
|
97
|
+
* console.log(result.data.submissionUid); // Track submission with this UID
|
|
98
|
+
*
|
|
99
|
+
* // Submit multiple invoices
|
|
100
|
+
* const result = await client.submitDocument([invoice1, invoice2, invoice3]);
|
|
101
|
+
* if (result.status === 202) {
|
|
102
|
+
* console.log('Documents submitted successfully');
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @remarks
|
|
107
|
+
* - Requires PRIVATE_KEY and CERTIFICATE environment variables for document signing
|
|
108
|
+
* - Each document is digitally signed with XML-DSIG before submission
|
|
109
|
+
* - Documents are base64-encoded for transmission
|
|
110
|
+
* - API limits: Max 100 documents per submission, 5MB total payload, 300KB per document
|
|
111
|
+
* - Debug mode provides detailed logging of payload sizes and validation warnings
|
|
112
|
+
* - Returns HTTP 202 for successful submissions that require processing
|
|
113
|
+
*/
|
|
114
|
+
async submitDocument(documents) {
|
|
115
|
+
if (this.debug) console.log(`📦 Preparing to submit ${documents.length} document(s)...`);
|
|
116
|
+
const completeDocument = generateCompleteDocument(documents, this.signingCredentials);
|
|
117
|
+
if (this.debug) {
|
|
118
|
+
console.log("✅ Documents signed successfully");
|
|
119
|
+
console.log("📄 Document structure keys:", Object.keys(completeDocument));
|
|
120
|
+
console.log("📊 Number of invoices:", completeDocument.Invoice.length);
|
|
121
|
+
}
|
|
122
|
+
const documentJson = JSON.stringify(completeDocument);
|
|
123
|
+
if (this.debug) console.log(`📏 Document JSON size: ${documentJson.length} bytes`);
|
|
124
|
+
const crypto = await import("crypto");
|
|
125
|
+
const documentHash = crypto.createHash("sha256").update(documentJson, "utf8").digest("hex");
|
|
126
|
+
const documentBase64 = Buffer.from(documentJson, "utf8").toString("base64");
|
|
127
|
+
if (this.debug) {
|
|
128
|
+
console.log(`🔒 Document hash: ${documentHash.substring(0, 16)}...`);
|
|
129
|
+
console.log(`📦 Base64 size: ${documentBase64.length} bytes`);
|
|
130
|
+
}
|
|
131
|
+
const submissionPayload = { documents: documents.map((doc) => ({
|
|
132
|
+
format: "JSON",
|
|
133
|
+
document: documentBase64,
|
|
134
|
+
documentHash,
|
|
135
|
+
codeNumber: doc.eInvoiceCodeOrNumber
|
|
136
|
+
})) };
|
|
137
|
+
if (this.debug) {
|
|
138
|
+
console.log("🚀 Submission payload structure:");
|
|
139
|
+
console.log("- Format: JSON");
|
|
140
|
+
console.log("- Documents count:", submissionPayload.documents.length);
|
|
141
|
+
console.log("- Total payload size:", JSON.stringify(submissionPayload).length, "bytes");
|
|
142
|
+
const payloadSize = JSON.stringify(submissionPayload).length;
|
|
143
|
+
if (payloadSize > 5 * 1024 * 1024) console.warn("⚠️ WARNING: Payload size exceeds 5MB limit");
|
|
144
|
+
if (documents.length > 100) console.warn("⚠️ WARNING: Document count exceeds 100 document limit");
|
|
145
|
+
if (documentJson.length > 300 * 1024) console.warn("⚠️ WARNING: Document size exceeds 300KB limit");
|
|
146
|
+
}
|
|
147
|
+
const response = await this.fetch("/api/v1.0/documentsubmissions", {
|
|
148
|
+
method: "POST",
|
|
149
|
+
headers: { "Content-Type": "application/json" },
|
|
150
|
+
body: JSON.stringify(submissionPayload)
|
|
151
|
+
});
|
|
152
|
+
if (this.debug) console.log(`📡 API Response status: ${response.status}`);
|
|
153
|
+
const data = await response.json();
|
|
154
|
+
if (this.debug) if (response.status !== 202) {
|
|
155
|
+
console.error("❌ Submission failed with status:", response.status);
|
|
156
|
+
console.error("❌ Response data:", data);
|
|
157
|
+
} else {
|
|
158
|
+
console.log("✅ Submission successful!");
|
|
159
|
+
console.log(`📋 Submission UID: ${data.submissionUid}`);
|
|
160
|
+
console.log(`✅ Accepted documents: ${data.acceptedDocuments?.length || 0}`);
|
|
161
|
+
console.log(`❌ Rejected documents: ${data.rejectedDocuments?.length || 0}`);
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
data,
|
|
165
|
+
status: response.status
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
async getSubmissionStatus(submissionUid, pollInterval = 1e3, maxRetries = 10) {
|
|
169
|
+
try {
|
|
170
|
+
const response = await this.fetch(`/api/v1.0/documentsubmissions/${submissionUid}`);
|
|
171
|
+
const data = await response.json();
|
|
172
|
+
if (this.debug) {
|
|
173
|
+
console.log("Submission:", data);
|
|
174
|
+
if (data.error) console.log("Submission error details:", data.error.details);
|
|
175
|
+
}
|
|
176
|
+
if (data.overallStatus === "Valid") return {
|
|
177
|
+
status: data.overallStatus,
|
|
178
|
+
documentSummary: data.documentSummary
|
|
179
|
+
};
|
|
180
|
+
if (data.overallStatus === "Invalid") return {
|
|
181
|
+
status: "Invalid",
|
|
182
|
+
documentSummary: data.documentSummary
|
|
183
|
+
};
|
|
184
|
+
if (maxRetries > 0) {
|
|
185
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
186
|
+
return await this.getSubmissionStatus(submissionUid, pollInterval, maxRetries - 1);
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
status: "Invalid",
|
|
190
|
+
error: {
|
|
191
|
+
code: "Timeout",
|
|
192
|
+
message: "Submission timed out",
|
|
193
|
+
target: "submission",
|
|
194
|
+
details: []
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
} catch (error) {
|
|
198
|
+
if (maxRetries > 0) {
|
|
199
|
+
if (this.debug) console.log("Request error, retrying...", error);
|
|
200
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
201
|
+
return await this.getSubmissionStatus(submissionUid, pollInterval, maxRetries - 1);
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
status: "Invalid",
|
|
205
|
+
error: {
|
|
206
|
+
code: "Timeout",
|
|
207
|
+
message: "Submission timed out after request errors",
|
|
208
|
+
target: "submission",
|
|
209
|
+
details: []
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Retrieves a document by its unique identifier with the raw document content.
|
|
216
|
+
*
|
|
217
|
+
* @param documentUid - The unique identifier of the document to retrieve
|
|
218
|
+
* @returns Promise resolving to document summary with raw document content as a string
|
|
219
|
+
* @throws {Error} If the document is not found or request fails
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* const document = await client.getDocument('doc-uuid-123');
|
|
224
|
+
* console.log(document.document); // Raw XML/JSON content
|
|
225
|
+
* console.log(document.uuid); // Document UUID
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
async getDocument(documentUid) {
|
|
229
|
+
const response = await this.fetch(`/api/v1.0/documents/${documentUid}/raw`);
|
|
230
|
+
const data = await response.json();
|
|
231
|
+
return data;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Retrieves detailed information about a document including validation results.
|
|
235
|
+
*
|
|
236
|
+
* @param documentUid - The unique identifier of the document to get details for
|
|
237
|
+
* @returns Promise resolving to document summary with detailed validation results
|
|
238
|
+
* @throws {Error} If the document is not found or request fails
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* const details = await client.getDocumentDetails('doc-uuid-123');
|
|
243
|
+
* console.log(details.validationResults.status); // 'Valid' | 'Invalid' | 'Processing'
|
|
244
|
+
* console.log(details.validationResults.validationSteps); // Array of validation step results
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
async getDocumentDetails(documentUid) {
|
|
248
|
+
const response = await this.fetch(`/api/v1.0/documents/${documentUid}/details`);
|
|
249
|
+
const data = await response.json();
|
|
250
|
+
return data;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Searches for documents based on various filter criteria.
|
|
254
|
+
*
|
|
255
|
+
* @param params - Search parameters object
|
|
256
|
+
* @param params.uuid - Optional specific document UUID to search for
|
|
257
|
+
* @param params.submissionDateFrom - Required start date for submission date range (ISO date string)
|
|
258
|
+
* @param params.submissionDateTo - Optional end date for submission date range (ISO date string)
|
|
259
|
+
* @param params.pageSize - Optional number of results per page (default handled by API)
|
|
260
|
+
* @param params.pageNo - Optional page number for pagination (0-based)
|
|
261
|
+
* @param params.issueDateFrom - Optional start date for issue date range (ISO date string)
|
|
262
|
+
* @param params.issueDateTo - Optional end date for issue date range (ISO date string)
|
|
263
|
+
* @param params.invoiceDirection - Optional filter by invoice direction ('Sent' or 'Received')
|
|
264
|
+
* @param params.status - Optional filter by document status
|
|
265
|
+
* @param params.documentType - Optional filter by e-invoice type code
|
|
266
|
+
* @param params.searchQuery - Optional text search across uuid, buyerTIN, supplierTIN, buyerName, supplierName, internalID, total
|
|
267
|
+
* @returns Promise resolving to array of document summaries matching the search criteria
|
|
268
|
+
* @throws {Error} If the search request fails
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```typescript
|
|
272
|
+
* // Search for documents submitted in the last 30 days
|
|
273
|
+
* const documents = await client.searchDocuments({
|
|
274
|
+
* submissionDateFrom: '2024-01-01',
|
|
275
|
+
* submissionDateTo: '2024-01-31',
|
|
276
|
+
* status: 'Valid',
|
|
277
|
+
* pageSize: 10
|
|
278
|
+
* });
|
|
279
|
+
*
|
|
280
|
+
* // Search by supplier name
|
|
281
|
+
* const supplierDocs = await client.searchDocuments({
|
|
282
|
+
* submissionDateFrom: '2024-01-01',
|
|
283
|
+
* searchQuery: 'ACME Corp',
|
|
284
|
+
* invoiceDirection: 'Received'
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
async searchDocuments({ uuid, submissionDateFrom, submissionDateTo, pageSize, pageNo, issueDateFrom, issueDateTo, invoiceDirection, status, documentType, searchQuery }) {
|
|
289
|
+
const queryParams = new URLSearchParams();
|
|
290
|
+
if (uuid) queryParams.set("uuid", uuid);
|
|
291
|
+
if (submissionDateFrom) queryParams.set("submissionDateFrom", submissionDateFrom);
|
|
292
|
+
if (submissionDateTo) queryParams.set("submissionDateTo", submissionDateTo);
|
|
293
|
+
if (pageSize) queryParams.set("pageSize", pageSize.toString());
|
|
294
|
+
if (pageNo) queryParams.set("pageNo", pageNo.toString());
|
|
295
|
+
if (issueDateFrom) queryParams.set("issueDateFrom", issueDateFrom);
|
|
296
|
+
if (issueDateTo) queryParams.set("issueDateTo", issueDateTo);
|
|
297
|
+
if (invoiceDirection) queryParams.set("invoiceDirection", invoiceDirection);
|
|
298
|
+
if (status) queryParams.set("status", status);
|
|
299
|
+
if (documentType) queryParams.set("documentType", documentType);
|
|
300
|
+
if (searchQuery) queryParams.set("searchQuery", searchQuery);
|
|
301
|
+
const response = await this.fetch(`/api/v1.0/documents/search?${queryParams.toString()}`);
|
|
302
|
+
const data = await response.json();
|
|
303
|
+
return data;
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
//#endregion
|
|
308
|
+
export { MyInvoisClient };
|
package/dist/index10.cjs
ADDED
|
File without changes
|
package/dist/index11.cjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/types/state-codes.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing the allowed state codes with descriptive names.
|
|
5
|
+
* Provides a more readable way to reference states.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const code = StateCodeEnum.Selangor;
|
|
9
|
+
* console.log(code); // Output: "10"
|
|
10
|
+
*/
|
|
11
|
+
let StateCodeEnum = /* @__PURE__ */ function(StateCodeEnum$1) {
|
|
12
|
+
StateCodeEnum$1["Johor"] = "01";
|
|
13
|
+
StateCodeEnum$1["Kedah"] = "02";
|
|
14
|
+
StateCodeEnum$1["Kelantan"] = "03";
|
|
15
|
+
StateCodeEnum$1["Melaka"] = "04";
|
|
16
|
+
StateCodeEnum$1["NegeriSembilan"] = "05";
|
|
17
|
+
StateCodeEnum$1["Pahang"] = "06";
|
|
18
|
+
StateCodeEnum$1["PulauPinang"] = "07";
|
|
19
|
+
StateCodeEnum$1["Perak"] = "08";
|
|
20
|
+
StateCodeEnum$1["Perlis"] = "09";
|
|
21
|
+
StateCodeEnum$1["Selangor"] = "10";
|
|
22
|
+
StateCodeEnum$1["Terengganu"] = "11";
|
|
23
|
+
StateCodeEnum$1["Sabah"] = "12";
|
|
24
|
+
StateCodeEnum$1["Sarawak"] = "13";
|
|
25
|
+
StateCodeEnum$1["WPKualaLumpur"] = "14";
|
|
26
|
+
StateCodeEnum$1["WPLabuan"] = "15";
|
|
27
|
+
StateCodeEnum$1["WPPutrajaya"] = "16";
|
|
28
|
+
StateCodeEnum$1["NotApplicable"] = "17";
|
|
29
|
+
return StateCodeEnum$1;
|
|
30
|
+
}({});
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.StateCodeEnum = StateCodeEnum;
|
|
34
|
+
//# sourceMappingURL=index11.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index11.cjs","names":[],"sources":["../src/types/state-codes.d.ts"],"sourcesContent":["/**\n * Represents the allowed codes for Malaysian states and federal territories.\n * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/state-codes/\n */\nexport type StateCode =\n | '01' // Johor\n | '02' // Kedah\n | '03' // Kelantan\n | '04' // Melaka\n | '05' // Negeri Sembilan\n | '06' // Pahang\n | '07' // Pulau Pinang\n | '08' // Perak\n | '09' // Perlis\n | '10' // Selangor\n | '11' // Terengganu\n | '12' // Sabah\n | '13' // Sarawak\n | '14' // Wilayah Persekutuan Kuala Lumpur\n | '15' // Wilayah Persekutuan Labuan\n | '16' // Wilayah Persekutuan Putrajaya\n | '17' // Not Applicable\n\n/**\n * Enum representing the allowed state codes with descriptive names.\n * Provides a more readable way to reference states.\n *\n * @example\n * const code = StateCodeEnum.Selangor;\n * console.log(code); // Output: \"10\"\n */\nexport enum StateCodeEnum {\n Johor = '01',\n Kedah = '02',\n Kelantan = '03',\n Melaka = '04',\n NegeriSembilan = '05',\n Pahang = '06',\n PulauPinang = '07',\n Perak = '08',\n Perlis = '09',\n Selangor = '10',\n Terengganu = '11',\n Sabah = '12',\n Sarawak = '13',\n WPKualaLumpur = '14',\n WPLabuan = '15',\n WPPutrajaya = '16',\n NotApplicable = '17',\n}\n\n/**\n * Interface representing a state code entry.\n * Contains the code and its corresponding name.\n */\nexport interface State {\n code: StateCode\n name: string\n}\n"],"mappings":";;;;;;;;;;AA+BA,IAAY,0DAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}
|
package/dist/index12.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/types/tax-types.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing the allowed tax type codes with descriptive names.
|
|
5
|
+
* Provides a more readable way to reference tax types.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const code = TaxTypeCodeEnum.SalesTax;
|
|
9
|
+
* console.log(code); // Output: "01"
|
|
10
|
+
*/
|
|
11
|
+
let TaxTypeCodeEnum = /* @__PURE__ */ function(TaxTypeCodeEnum$1) {
|
|
12
|
+
TaxTypeCodeEnum$1["SalesTax"] = "01";
|
|
13
|
+
TaxTypeCodeEnum$1["ServiceTax"] = "02";
|
|
14
|
+
TaxTypeCodeEnum$1["TourismTax"] = "03";
|
|
15
|
+
TaxTypeCodeEnum$1["HighValueGoodsTax"] = "04";
|
|
16
|
+
TaxTypeCodeEnum$1["SalesTaxLowValueGoods"] = "05";
|
|
17
|
+
TaxTypeCodeEnum$1["NotApplicable"] = "06";
|
|
18
|
+
TaxTypeCodeEnum$1["TaxExemption"] = "E";
|
|
19
|
+
return TaxTypeCodeEnum$1;
|
|
20
|
+
}({});
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.TaxTypeCodeEnum = TaxTypeCodeEnum;
|
|
24
|
+
//# sourceMappingURL=index12.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index12.cjs","names":[],"sources":["../src/types/tax-types.d.ts"],"sourcesContent":["/**\n * Represents the allowed codes for tax types.\n * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/tax-types/\n */\nexport type TaxTypeCode =\n | '01' // Sales Tax\n | '02' // Service Tax\n | '03' // Tourism Tax\n | '04' // High-Value Goods Tax\n | '05' // Sales Tax on Low Value Goods\n | '06' // Not Applicable\n | 'E' // Tax exemption (where applicable)\n\n/**\n * Enum representing the allowed tax type codes with descriptive names.\n * Provides a more readable way to reference tax types.\n *\n * @example\n * const code = TaxTypeCodeEnum.SalesTax;\n * console.log(code); // Output: \"01\"\n */\nexport enum TaxTypeCodeEnum {\n SalesTax = '01',\n ServiceTax = '02',\n TourismTax = '03',\n HighValueGoodsTax = '04',\n SalesTaxLowValueGoods = '05',\n NotApplicable = '06',\n TaxExemption = 'E',\n}\n\n/**\n * Interface representing a tax type entry.\n * Contains the code and its corresponding description.\n */\nexport interface TaxType {\n code: TaxTypeCode\n description: string\n}\n"],"mappings":";;;;;;;;;;AAqBA,IAAY,8DAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}
|
package/dist/index13.cjs
ADDED
|
File without changes
|
package/dist/index14.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/base64.ts
|
|
3
|
+
function encodeToBase64(content) {
|
|
4
|
+
return Buffer.from(content).toString("base64");
|
|
5
|
+
}
|
|
6
|
+
function decodeFromBase64(content) {
|
|
7
|
+
return Buffer.from(content, "base64").toString("utf-8");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.decodeFromBase64 = decodeFromBase64;
|
|
12
|
+
exports.encodeToBase64 = encodeToBase64;
|
|
13
|
+
//# sourceMappingURL=index14.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index14.cjs","names":["content: string"],"sources":["../src/utils/base64.ts"],"sourcesContent":["export function encodeToBase64(content: string): string {\n return Buffer.from(content).toString('base64')\n}\n\nexport function decodeFromBase64(content: string): string {\n return Buffer.from(content, 'base64').toString('utf-8')\n}\n"],"mappings":";;AAAA,SAAgB,eAAeA,SAAyB;AACtD,QAAO,OAAO,KAAK,QAAQ,CAAC,SAAS,SAAS;AAC/C;AAED,SAAgB,iBAAiBA,SAAyB;AACxD,QAAO,OAAO,KAAK,SAAS,SAAS,CAAC,SAAS,QAAQ;AACxD"}
|
package/dist/index15.cjs
ADDED
package/dist/index16.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_document = require('./document-CARHiGdp.cjs');
|
|
2
|
+
|
|
3
|
+
exports.calculateCertificateDigest = require_document.calculateCertificateDigest;
|
|
4
|
+
exports.calculateDocumentDigest = require_document.calculateDocumentDigest;
|
|
5
|
+
exports.calculateSignedPropertiesDigest = require_document.calculateSignedPropertiesDigest;
|
|
6
|
+
exports.canonicalizeJSON = require_document.canonicalizeJSON;
|
|
7
|
+
exports.createSignedInfoAndSign = require_document.createSignedInfoAndSign;
|
|
8
|
+
exports.createSignedProperties = require_document.createSignedProperties;
|
|
9
|
+
exports.extractCertificateInfo = require_document.extractCertificateInfo;
|
|
10
|
+
exports.generateCleanInvoiceObject = require_document.generateCleanInvoiceObject;
|
|
11
|
+
exports.generateCleanUBLDocument = require_document.generateCleanUBLDocument;
|
|
12
|
+
exports.generateCompleteDocument = require_document.generateCompleteDocument;
|
|
13
|
+
exports.sortObjectKeys = require_document.sortObjectKeys;
|
package/dist/index17.cjs
ADDED