@ripwords/myinvois-client 0.0.1

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.
@@ -0,0 +1,186 @@
1
+ export type MSIC_9X_CODE =
2
+ | '90001'
3
+ | '90002'
4
+ | '90003'
5
+ | '90004'
6
+ | '90005'
7
+ | '90006'
8
+ | '90007'
9
+ | '90009'
10
+ | '91011'
11
+ | '91012'
12
+ | '91021'
13
+ | '91022'
14
+ | '91031'
15
+ | '91032'
16
+ | '92000'
17
+ | '93111'
18
+ | '93112'
19
+ | '93113'
20
+ | '93114'
21
+ | '93115'
22
+ | '93116'
23
+ | '93117'
24
+ | '93118'
25
+ | '93119'
26
+ | '93120'
27
+ | '93191'
28
+ | '93192'
29
+ | '93193'
30
+ | '93199'
31
+ | '93210'
32
+ | '93291'
33
+ | '93292'
34
+ | '93293'
35
+ | '93294'
36
+ | '93295'
37
+ | '93296'
38
+ | '93297'
39
+ | '93299'
40
+ | '94110'
41
+ | '94120'
42
+ | '94200'
43
+ | '94910'
44
+ | '94920'
45
+ | '94990'
46
+ | '95111'
47
+ | '95112'
48
+ | '95113'
49
+ | '95121'
50
+ | '95122'
51
+ | '95123'
52
+ | '95124'
53
+ | '95125'
54
+ | '95126'
55
+ | '95127'
56
+ | '95211'
57
+ | '95212'
58
+ | '95213'
59
+ | '95214'
60
+ | '95221'
61
+ | '95222'
62
+ | '95230'
63
+ | '95240'
64
+ | '95291'
65
+ | '95292'
66
+ | '95293'
67
+ | '95294'
68
+ | '95295'
69
+ | '95296'
70
+ | '95299'
71
+ | '96011'
72
+ | '96012'
73
+ | '96013'
74
+ | '96014'
75
+ | '96020'
76
+ | '96031'
77
+ | '96032'
78
+ | '96033'
79
+ | '96034'
80
+ | '96035'
81
+ | '96091'
82
+ | '96092'
83
+ | '96093'
84
+ | '96094'
85
+ | '96095'
86
+ | '96096'
87
+ | '96097'
88
+ | '96099'
89
+ | '97000'
90
+ | '98100'
91
+ | '98200'
92
+ | '99000'
93
+
94
+ export enum MSIC_9X {
95
+ THEATRICAL_PRODUCTION = '90001',
96
+ CONCERT_HALLS = '90002',
97
+ VISUAL_ARTISTS = '90003',
98
+ WRITERS = '90004',
99
+ JOURNALISTS = '90005',
100
+ ART_RESTORATION = '90006',
101
+ ARTS_EVENT_PRODUCTION = '90007',
102
+ OTHER_CREATIVE_ARTS = '90009',
103
+ LIBRARIES = '91011',
104
+ PHOTO_LIBRARIES = '91012',
105
+ MUSEUMS = '91021',
106
+ HISTORICAL_SITES = '91022',
107
+ BOTANICAL_ZOOLOGICAL = '91031',
108
+ NATURE_RESERVES = '91032',
109
+ GAMBLING = '92000',
110
+ SPORTS_FACILITIES = '93111',
111
+ AUTO_RACING = '93112',
112
+ EQUESTRIAN = '93113',
113
+ SWIMMING_FACILITIES = '93114',
114
+ ATHLETICS_FACILITIES = '93115',
115
+ GOLF_COURSES = '93116',
116
+ BOWLING_CENTRES = '93117',
117
+ FITNESS_CENTRES = '93118',
118
+ SPORTS_EVENTS = '93119',
119
+ SPORTS_CLUBS = '93120',
120
+ SPORTS_PROMOTERS = '93191',
121
+ SPORTS_REGULATORS = '93192',
122
+ SPORTS_PROMOTION = '93193',
123
+ OTHER_SPORTS = '93199',
124
+ AMUSEMENT_PARKS = '93210',
125
+ RECREATION_PARKS = '93291',
126
+ RECREATIONAL_TRANSPORT = '93292',
127
+ LEISURE_EQUIPMENT_RENTAL = '93293',
128
+ RECREATIONAL_FAIRS = '93294',
129
+ DISCOTHEQUES = '93295',
130
+ EVENT_PRODUCTION = '93296',
131
+ CYBER_CAFE = '93297',
132
+ OTHER_RECREATION = '93299',
133
+ BUSINESS_ORGANIZATIONS = '94110',
134
+ PROFESSIONAL_ORGANIZATIONS = '94120',
135
+ TRADE_UNIONS = '94200',
136
+ RELIGIOUS_ORGANIZATIONS = '94910',
137
+ POLITICAL_ORGANIZATIONS = '94920',
138
+ OTHER_ORGANIZATIONS = '94990',
139
+ ELECTRONIC_REPAIR = '95111',
140
+ COMPUTER_REPAIR = '95112',
141
+ PDA_REPAIR = '95113',
142
+ CORDLESS_PHONE_REPAIR = '95121',
143
+ MOBILE_PHONE_REPAIR = '95122',
144
+ MODEM_REPAIR = '95123',
145
+ FAX_REPAIR = '95124',
146
+ COMMUNICATIONS_REPAIR = '95125',
147
+ RADIO_REPAIR = '95126',
148
+ CAMERA_REPAIR = '95127',
149
+ TV_REPAIR = '95211',
150
+ VIDEO_PLAYER_REPAIR = '95212',
151
+ CD_PLAYER_REPAIR = '95213',
152
+ VIDEO_CAMERA_REPAIR = '95214',
153
+ APPLIANCE_REPAIR = '95221',
154
+ GARDEN_EQUIPMENT_REPAIR = '95222',
155
+ FOOTWEAR_REPAIR = '95230',
156
+ FURNITURE_REPAIR = '95240',
157
+ BICYCLE_REPAIR = '95291',
158
+ CLOTHING_REPAIR = '95292',
159
+ JEWELRY_REPAIR = '95293',
160
+ WATCH_REPAIR = '95294',
161
+ SPORTS_EQUIPMENT_REPAIR = '95295',
162
+ MUSICAL_INSTRUMENT_REPAIR = '95296',
163
+ OTHER_REPAIRS = '95299',
164
+ LAUNDRY = '96011',
165
+ CARPET_CLEANING = '96012',
166
+ UNIFORM_RENTAL = '96013',
167
+ DIAPER_SERVICE = '96014',
168
+ BEAUTY_SERVICES = '96020',
169
+ MORTUARY_SERVICES = '96031',
170
+ FUNERAL_SERVICES = '96032',
171
+ FUNERAL_PARLOUR_RENTAL = '96033',
172
+ GRAVE_SALES = '96034',
173
+ GRAVE_MAINTENANCE = '96035',
174
+ WELLNESS_SERVICES = '96091',
175
+ ASTROLOGY_SERVICES = '96092',
176
+ DATING_SERVICES = '96093',
177
+ PET_CARE = '96094',
178
+ GENEALOGY = '96095',
179
+ PERSONAL_SERVICES = '96096',
180
+ VENDING_MACHINES = '96097',
181
+ OTHER_SERVICES = '96099',
182
+ DOMESTIC_PERSONNEL = '97000',
183
+ HOUSEHOLD_GOODS_PRODUCTION = '98100',
184
+ HOUSEHOLD_SERVICES = '98200',
185
+ EXTRATERRITORIAL_ORGANIZATIONS = '99000',
186
+ }
@@ -0,0 +1,37 @@
1
+ import type { MSIC_0X_CODE } from './msic/0X.d.ts'
2
+ import type { MSIC_1X_CODE } from './msic/1X.d.ts'
3
+ import type { MSIC_2X_CODE } from './msic/2X.d.ts'
4
+ import type { MSIC_3X_CODE } from './msic/3X.d.ts'
5
+ import type { MSIC_4X_CODE } from './msic/4X.d.ts'
6
+ import type { MSIC_5X_CODE } from './msic/5X.d.ts'
7
+ import type { MSIC_6X_CODE } from './msic/6X.d.ts'
8
+ import type { MSIC_7X_CODE } from './msic/7X.d.ts'
9
+ import type { MSIC_8X_CODE } from './msic/8X.d.ts'
10
+ import type { MSIC_9X_CODE } from './msic/9X.d.ts'
11
+
12
+ export type MSICCode = {
13
+ code: string
14
+ description: string
15
+ msicCategoryReference: string
16
+ }
17
+
18
+ /**
19
+ * Represents the allowed 5-digit Malaysia Standard Industrial Classification (MSIC) codes.
20
+ * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/msic-codes/
21
+ * Interface representing an MSIC code entry.
22
+ * Contains the 5-digit code and its description.
23
+ */
24
+ export interface MsicEntry {
25
+ code:
26
+ | MSIC_0X_CODE
27
+ | MSIC_1X_CODE
28
+ | MSIC_2X_CODE
29
+ | MSIC_3X_CODE
30
+ | MSIC_4X_CODE
31
+ | MSIC_5X_CODE
32
+ | MSIC_6X_CODE
33
+ | MSIC_7X_CODE
34
+ | MSIC_8X_CODE
35
+ | MSIC_9X_CODE
36
+ description: string
37
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Represents the allowed codes for payment modes.
3
+ * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/payment-methods/
4
+ */
5
+ export type PaymentModeCode =
6
+ | '01' // Cash
7
+ | '02' // Cheque
8
+ | '03' // Bank Transfer
9
+ | '04' // Credit Card
10
+ | '05' // Debit Card
11
+ | '06' // e-Wallet / Digital Wallet
12
+ | '07' // Digital Bank
13
+ | '08' // Others
14
+
15
+ /**
16
+ * Enum representing the allowed payment mode codes with descriptive names.
17
+ * Provides a more readable way to reference payment modes.
18
+ *
19
+ * @example
20
+ * const mode = PaymentModeCodeEnum.Cash;
21
+ * console.log(mode); // Output: "01"
22
+ */
23
+ export enum PaymentModeCodeEnum {
24
+ Cash = '01',
25
+ Cheque = '02',
26
+ BankTransfer = '03',
27
+ CreditCard = '04',
28
+ DebitCard = '05',
29
+ EWalletDigitalWallet = '06',
30
+ DigitalBank = '07',
31
+ Others = '08',
32
+ }
33
+
34
+ /**
35
+ * Interface representing a payment mode entry.
36
+ * Contains the code and its corresponding description.
37
+ */
38
+ export interface PaymentMode {
39
+ code: PaymentModeCode
40
+ description: string
41
+ }
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Represents the Digest Method structure used within the signature.
3
+ */
4
+ export interface DigestMethod {
5
+ /** Algorithm used for digest. Should be http://www.w3.org/2001/04/xmlenc#sha256 */
6
+ Algorithm: string
7
+ }
8
+
9
+ /**
10
+ * Represents the Cert Digest structure.
11
+ */
12
+ export interface CertDigest {
13
+ /** Digest method details. */
14
+ "ds:DigestMethod": DigestMethod
15
+ /** Base64 encoded HEX-SHA256 certificate information (CertDigest). */
16
+ "ds:DigestValue": string // base64binary
17
+ }
18
+
19
+ /**
20
+ * Represents the Issuer Serial structure within the Signing Certificate.
21
+ */
22
+ export interface IssuerSerial {
23
+ /** CN of the certificate issuer (Organization name). */
24
+ "ds:X509IssuerName": string
25
+ /** Digital certificate serial number. */
26
+ "ds:X509SerialNumber": string // xsd:normalizedString -> string
27
+ }
28
+
29
+ /**
30
+ * Represents the Certificate structure within Signing Certificate.
31
+ */
32
+ export interface Cert {
33
+ /** Certificate digest details. */
34
+ "xades:CertDigest": CertDigest
35
+ /** Issuer details. */
36
+ "xades:IssuerSerial": IssuerSerial
37
+ }
38
+
39
+ /**
40
+ * Represents the Signing Certificate structure.
41
+ */
42
+ export interface SigningCertificate {
43
+ /** Certificate details. */
44
+ "xades:Cert": Cert
45
+ }
46
+
47
+ /**
48
+ * Represents the Signed Signature Properties.
49
+ */
50
+ export interface SignedSignatureProperties {
51
+ /** UTC timestamp of signing (YYYY-MM-DDTHH:mm:ssZ). */
52
+ "xades:SigningTime": string // dateTime
53
+ /** Signing certificate details. */
54
+ "xades:SigningCertificate": SigningCertificate
55
+ // Note: Other optional properties like SignaturePolicyIdentifier might exist
56
+ }
57
+
58
+ /**
59
+ * Represents the Signed Properties structure.
60
+ */
61
+ export interface SignedProperties {
62
+ /** Target attribute, should be 'signature'. */
63
+ Target: string
64
+ /** ID attribute, should be 'id-xades-signed-props'. */
65
+ Id: string
66
+ /** Signed signature properties. */
67
+ "xades:SignedSignatureProperties": SignedSignatureProperties
68
+ }
69
+
70
+ /**
71
+ * Represents the Qualifying Properties structure (Object element).
72
+ */
73
+ export interface QualifyingProperties {
74
+ /** Target attribute, should be 'signature'. */
75
+ Target: string
76
+ /** Signed properties details. */
77
+ "xades:SignedProperties": SignedProperties
78
+ // Note: UnsignedProperties might exist but are not detailed in the mandatory part
79
+ }
80
+
81
+ /**
82
+ * Represents the X509 Data structure within KeyInfo.
83
+ */
84
+ export interface X509Data {
85
+ /** Base64 encoded X509 certificate. */
86
+ "ds:X509Certificate": string // base64binary
87
+ }
88
+
89
+ /**
90
+ * Represents the Key Information structure.
91
+ */
92
+ export interface KeyInfo {
93
+ /** X509 certificate data. */
94
+ "ds:X509Data": X509Data
95
+ }
96
+
97
+ /**
98
+ * Represents the Transform structure within Reference.
99
+ */
100
+ export interface Transform {
101
+ /** Algorithm attribute for the transform. */
102
+ Algorithm: string
103
+ }
104
+
105
+ /**
106
+ * Represents a Reference within SignedInfo.
107
+ */
108
+ export interface Reference {
109
+ /** ID attribute for the reference (e.g., 'id-doc-signed-data', 'id-xades-signed-props'). */
110
+ Id?: string
111
+ /** URI attribute for the reference (e.g., '', '#id-xades-signed-props'). */
112
+ URI: string
113
+ /** Optional Transforms applied. */
114
+ "ds:Transforms"?: {
115
+ "ds:Transform": Transform | Transform[] // Can be single or multiple transforms
116
+ }
117
+ /** Digest method details. */
118
+ "ds:DigestMethod": DigestMethod
119
+ /** Base64 encoded digest value (DocDigest or PropsDigest). */
120
+ "ds:DigestValue": string // base64binary
121
+ }
122
+
123
+ /**
124
+ * Represents the Canonicalization Method structure.
125
+ */
126
+ export interface CanonicalizationMethod {
127
+ /** Algorithm used for canonicalization. Should be http://www.w3.org/2006/12/xml-c14n11 */
128
+ Algorithm: string
129
+ }
130
+
131
+ /**
132
+ * Represents the Signature Method structure.
133
+ */
134
+ export interface SignatureMethod {
135
+ /** Algorithm used for signing. Should be http://www.w3.org/2001/04/xmldsig-more#rsa-sha256 */
136
+ Algorithm: string
137
+ }
138
+
139
+ /**
140
+ * Represents the Signed Information structure.
141
+ */
142
+ export interface SignedInfo {
143
+ /** Canonicalization method details. */
144
+ "ds:CanonicalizationMethod": CanonicalizationMethod
145
+ /** Signature method details. */
146
+ "ds:SignatureMethod": SignatureMethod
147
+ /** References to signed data and properties. Should contain two references. */
148
+ "ds:Reference": [Reference, Reference] // Expecting two: one for document, one for signed properties
149
+ }
150
+
151
+ /**
152
+ * Represents the root Signature element (IssuerDigitalSignature).
153
+ * Based on the documentation: https://sdk.myinvois.hasil.gov.my/signature/
154
+ * Conforms to XAdES enveloped signature requirements for UBL.
155
+ */
156
+ export interface IssuerDigitalSignature {
157
+ /** ID attribute, should be 'DocSig'. */
158
+ Id: string
159
+ /** Signed information details. */
160
+ "ds:SignedInfo": SignedInfo
161
+ /** Base64 encoded signature value (Sig). */
162
+ "ds:SignatureValue": string // base64binary
163
+ /** Public key information (certificate). */
164
+ "ds:KeyInfo": KeyInfo
165
+ /** Object containing signed properties. */
166
+ "ds:Object": {
167
+ "xades:QualifyingProperties": QualifyingProperties
168
+ }
169
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Represents the allowed codes for Malaysian states and federal territories.
3
+ * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/state-codes/
4
+ */
5
+ export type StateCode =
6
+ | '01' // Johor
7
+ | '02' // Kedah
8
+ | '03' // Kelantan
9
+ | '04' // Melaka
10
+ | '05' // Negeri Sembilan
11
+ | '06' // Pahang
12
+ | '07' // Pulau Pinang
13
+ | '08' // Perak
14
+ | '09' // Perlis
15
+ | '10' // Selangor
16
+ | '11' // Terengganu
17
+ | '12' // Sabah
18
+ | '13' // Sarawak
19
+ | '14' // Wilayah Persekutuan Kuala Lumpur
20
+ | '15' // Wilayah Persekutuan Labuan
21
+ | '16' // Wilayah Persekutuan Putrajaya
22
+ | '17' // Not Applicable
23
+
24
+ /**
25
+ * Enum representing the allowed state codes with descriptive names.
26
+ * Provides a more readable way to reference states.
27
+ *
28
+ * @example
29
+ * const code = StateCodeEnum.Selangor;
30
+ * console.log(code); // Output: "10"
31
+ */
32
+ export enum StateCodeEnum {
33
+ Johor = '01',
34
+ Kedah = '02',
35
+ Kelantan = '03',
36
+ Melaka = '04',
37
+ NegeriSembilan = '05',
38
+ Pahang = '06',
39
+ PulauPinang = '07',
40
+ Perak = '08',
41
+ Perlis = '09',
42
+ Selangor = '10',
43
+ Terengganu = '11',
44
+ Sabah = '12',
45
+ Sarawak = '13',
46
+ WPKualaLumpur = '14',
47
+ WPLabuan = '15',
48
+ WPPutrajaya = '16',
49
+ NotApplicable = '17',
50
+ }
51
+
52
+ /**
53
+ * Interface representing a state code entry.
54
+ * Contains the code and its corresponding name.
55
+ */
56
+ export interface State {
57
+ code: StateCode
58
+ name: string
59
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Represents the allowed codes for tax types.
3
+ * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/tax-types/
4
+ */
5
+ export type TaxTypeCode =
6
+ | '01' // Sales Tax
7
+ | '02' // Service Tax
8
+ | '03' // Tourism Tax
9
+ | '04' // High-Value Goods Tax
10
+ | '05' // Sales Tax on Low Value Goods
11
+ | '06' // Not Applicable
12
+ | 'E' // Tax exemption (where applicable)
13
+
14
+ /**
15
+ * Enum representing the allowed tax type codes with descriptive names.
16
+ * Provides a more readable way to reference tax types.
17
+ *
18
+ * @example
19
+ * const code = TaxTypeCodeEnum.SalesTax;
20
+ * console.log(code); // Output: "01"
21
+ */
22
+ export enum TaxTypeCodeEnum {
23
+ SalesTax = '01',
24
+ ServiceTax = '02',
25
+ TourismTax = '03',
26
+ HighValueGoodsTax = '04',
27
+ SalesTaxLowValueGoods = '05',
28
+ NotApplicable = '06',
29
+ TaxExemption = 'E',
30
+ }
31
+
32
+ /**
33
+ * Interface representing a tax type entry.
34
+ * Contains the code and its corresponding description.
35
+ */
36
+ export interface TaxType {
37
+ code: TaxTypeCode
38
+ description: string
39
+ }