@ripwords/myinvois-client 0.2.36 → 0.2.37
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/dist/api/documentSubmission.d.ts +1 -1
- package/dist/api/documentSubmission.js +1 -1
- package/dist/api/platformLogin.d.ts +1 -1
- package/dist/api/platformLogin.js +1 -1
- package/dist/{apiQueue-BE3-DB1A.js → apiQueue-CfneHIgD.js} +53 -19
- package/dist/{apiQueue-DDXeQJDC.cjs → apiQueue-CiZxlntc.cjs} +54 -20
- package/dist/apiQueue-CiZxlntc.cjs.map +1 -0
- package/dist/{documentSubmission-BBg9_Fqr.cjs → documentSubmission-M4UlirJ7.cjs} +7 -6
- package/dist/documentSubmission-M4UlirJ7.cjs.map +1 -0
- package/dist/{documentSubmission-jWGDM-Cv.js → documentSubmission-ZAgXsd3X.js} +6 -5
- package/dist/index.cjs +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -5
- package/dist/index10.cjs +187 -16
- package/dist/index10.cjs.map +1 -1
- package/dist/index12.cjs +16 -25
- package/dist/index12.cjs.map +1 -1
- package/dist/index13.cjs +0 -24
- package/dist/index15.cjs +29 -0
- package/dist/index15.cjs.map +1 -0
- package/dist/index16.cjs +25 -0
- package/dist/index16.cjs.map +1 -0
- package/dist/index17.cjs +0 -5
- package/dist/index18.cjs +33 -6
- package/dist/index18.cjs.map +1 -0
- package/dist/index19.cjs +23 -4
- package/dist/{index13.cjs.map → index19.cjs.map} +1 -1
- package/dist/index2.cjs +4 -61
- package/dist/index20.cjs +0 -3
- package/dist/index21.cjs +0 -3
- package/dist/index22.cjs +0 -6
- package/dist/index23.cjs +3 -207
- package/dist/index24.cjs +9 -105
- package/dist/index24.cjs.map +1 -1
- package/dist/index25.cjs +4 -136
- package/dist/index26.cjs +21 -63
- package/dist/index27.cjs +2 -266
- package/dist/index28.cjs +2 -78
- package/dist/index29.cjs +326 -103
- package/dist/index29.cjs.map +1 -1
- package/dist/index3.cjs +6 -531
- package/dist/index30.cjs +189 -69
- package/dist/index30.cjs.map +1 -1
- package/dist/index31.cjs +203 -107
- package/dist/index31.cjs.map +1 -1
- package/dist/index32.cjs +104 -95
- package/dist/index32.cjs.map +1 -1
- package/dist/index33.cjs +136 -3
- package/dist/{index25.cjs.map → index33.cjs.map} +1 -1
- package/dist/index34.cjs +60 -9
- package/dist/index34.cjs.map +1 -1
- package/dist/index35.cjs +266 -4
- package/dist/{index27.cjs.map → index35.cjs.map} +1 -1
- package/dist/index36.cjs +78 -21
- package/dist/{index28.cjs.map → index36.cjs.map} +1 -1
- package/dist/index37.cjs +106 -2
- package/dist/index37.cjs.map +1 -0
- package/dist/index38.cjs +72 -2
- package/dist/index38.cjs.map +1 -0
- package/dist/index39.cjs +108 -326
- package/dist/index39.cjs.map +1 -1
- package/dist/index4.cjs +4 -195
- package/dist/index40.cjs +96 -189
- package/dist/index40.cjs.map +1 -1
- package/dist/index5.cjs +3 -0
- package/dist/index6.cjs +2 -24
- package/dist/index62.cts.map +1 -1
- package/dist/index65.cts.map +1 -1
- package/dist/index67.cts.map +1 -1
- package/dist/index7.cjs +6 -0
- package/dist/index8.cjs +62 -0
- package/dist/{index2.cjs.map → index8.cjs.map} +1 -1
- package/dist/index9.cjs +526 -23
- package/dist/index9.cjs.map +1 -1
- package/dist/{platformLogin-CqI9OLYP.js → platformLogin-B6f18bB7.js} +2 -2
- package/dist/{platformLogin-Ch6hFKoU.cjs → platformLogin-BVTUzLjd.cjs} +3 -3
- package/dist/platformLogin-BVTUzLjd.cjs.map +1 -0
- package/dist/utils/apiQueue.js +1 -1
- package/package.json +1 -1
- package/dist/apiQueue-DDXeQJDC.cjs.map +0 -1
- package/dist/documentSubmission-BBg9_Fqr.cjs.map +0 -1
- package/dist/index23.cjs.map +0 -1
- package/dist/index26.cjs.map +0 -1
- package/dist/index3.cjs.map +0 -1
- package/dist/index4.cjs.map +0 -1
- package/dist/index6.cjs.map +0 -1
- package/dist/platformLogin-Ch6hFKoU.cjs.map +0 -1
package/dist/index67.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index67.cts","names":[],"sources":["../src/index.d.ts"],"sourcesContent":["import { DocumentStatus, DocumentSummary, DocumentTypeResponse, DocumentTypesResponse, DocumentTypeVersionResponse, DocumentValidationResult, DocumentValidationStepResult, EInvoiceTypeCode, NotificationResponse, NotificationSearchParams, RegistrationType, StandardError, SubmissionResponse, SubmissionStatus, TaxpayerQRCodeResponse, TinSearchParams, TinSearchResponse, AllDocumentsV1_1 } from './types';\nexport type * from './types/index.d.ts';\nexport declare class MyInvoisClient {\n private readonly baseUrl;\n private readonly clientId;\n private readonly clientSecret;\n private readonly environment;\n private onBehalfOf?;\n private readonly signingCredentials;\n private readonly debug;\n private token;\n private tokenExpiration;\n constructor(clientId: string, clientSecret: string, environment: 'sandbox' | 'production', certificatePem: string, privateKeyPem: string, onBehalfOf?: string, debug?: boolean);\n updateOnBehalfOf(onBehalfOf: string): Promise<void>;\n private refreshToken;\n private getToken;\n private fetch;\n /**\n * Validates a TIN against a NRIC/ARMY/PASSPORT/BRN (Business Registration Number)\n *\n * This method verifies if a given Tax Identification Number (TIN) is valid by checking it against\n * the provided identification type and value through the MyInvois platform's validation service.\n *\n * @param tin - The TIN to validate\n * @param idType - The type of ID to validate against ('NRIC', 'ARMY', 'PASSPORT', or 'BRN')\n * @param idValue - The value of the ID to validate against\n * @returns Promise resolving to true if the TIN is valid, false otherwise\n *\n * @example\n * ```typescript\n * // Validate TIN against NRIC\n * const isValid = await client.verifyTin('C12345678901234', 'NRIC', '123456789012');\n * if (isValid) {\n * console.log('TIN is valid');\n * }\n *\n * // Validate TIN against Business Registration Number\n * const isValidBusiness = await client.verifyTin('C98765432109876', 'BRN', '123456-K');\n * ```\n *\n * @remarks\n * - Returns false if validation fails due to network errors or invalid credentials\n * - Debug mode provides error logging for troubleshooting validation failures\n * - This is a non-blocking validation that won't throw exceptions on failure\n */\n verifyTin(tin: string, idType: RegistrationType, idValue: string): Promise<boolean>;\n /**\n * Searches for a Tax Identification Number (TIN) using taxpayer information.\n *\n * This method allows searching for a TIN using either a taxpayer name or a combination\n * of identification type and value. The search is flexible and supports multiple\n * identification types including NRIC, ARMY, PASSPORT, and BRN.\n *\n * @param params - Search parameters object\n * @param params.taxpayerName - Optional name of the taxpayer to search for\n * @param params.idType - Optional type of ID to search with (NRIC, ARMY, PASSPORT, BRN)\n * @param params.idValue - Optional value of the ID to search with\n * @returns Promise resolving to TIN search response or standard error\n *\n * @example\n * ```typescript\n * // Search by taxpayer name\n * const result = await client.searchTin({ taxpayerName: 'John Doe' });\n * if ('tin' in result) {\n * console.log('Found TIN:', result.tin);\n * }\n *\n * // Search by ID type and value\n * const result = await client.searchTin({\n * idType: 'NRIC',\n * idValue: '123456789012'\n * });\n * ```\n *\n * @remarks\n * - Either taxpayerName or both idType and idValue must be provided\n * - Returns StandardError object if search criteria are invalid or inconclusive\n * - Debug mode provides detailed error logging for troubleshooting\n * - Search results are not guaranteed to be unique\n */\n searchTin(params: TinSearchParams): Promise<TinSearchResponse>;\n /**\n * Retrieves taxpayer information from a QR code.\n *\n * This method decodes a QR code containing taxpayer information and returns\n * detailed taxpayer data including TIN, name, contact details, and business information.\n *\n * @param qrCodeText - The QR code text to decode\n * @returns Promise resolving to taxpayer QR code response or standard error\n *\n * @example\n * ```typescript\n * // Get taxpayer info from QR code\n * const taxpayerInfo = await client.getTaxpayerQRCode('QR_CODE_TEXT');\n * if ('tin' in taxpayerInfo) {\n * console.log('Taxpayer TIN:', taxpayerInfo.tin);\n * console.log('Business Name:', taxpayerInfo.name);\n * console.log('Address:', taxpayerInfo.addressLine1);\n * }\n * ```\n *\n * @remarks\n * - QR code must be in the correct format specified by MyInvois\n * - Returns StandardError if QR code is invalid or cannot be decoded\n * - Debug mode provides detailed error logging\n */\n getTaxpayerQRCode(qrCodeText: string): Promise<TaxpayerQRCodeResponse>;\n /**\n * Performs an action on a document such as rejection or cancellation.\n *\n * This method allows updating the status of a document to either rejected or cancelled,\n * along with providing a reason for the action. Useful for managing document workflow\n * and maintaining audit trails.\n *\n * @param documentUid - The unique identifier of the document\n * @param status - The new status to set ('rejected' or 'cancelled')\n * @param reason - The reason for the status change\n * @returns Promise resolving to document action response containing UUID, status, and any errors\n *\n * @example\n * ```typescript\n * // Reject a document with reason\n * const result = await client.performDocumentAction(\n * 'doc-123',\n * 'rejected',\n * 'Invalid tax calculation'\n * );\n *\n * // Cancel a document\n * const result = await client.performDocumentAction(\n * 'doc-456',\n * 'cancelled',\n * 'Duplicate submission'\n * );\n * ```\n *\n * @remarks\n * - Only valid for documents in appropriate states\n * - Reason is required and should be descriptive\n * - Action is irreversible once completed\n * - Returns error if document cannot be found or action is invalid\n */\n performDocumentAction(documentUid: string, status: 'rejected' | 'cancelled', reason: string): Promise<{\n uuid: string;\n status: string;\n error: StandardError;\n }>;\n /**\n * Submits one or more e-invoice documents to the MyInvois platform for processing.\n *\n * This method digitally signs each document using the provided certificate and private key,\n * generates document hashes, encodes them for submission, and sends them to the platform.\n * The method includes comprehensive validation warnings for document size and count limits.\n *\n * @param documents - Array of InvoiceV1_1 documents to be submitted\n * @returns Promise resolving to submission response containing the submission data and HTTP status\n * @throws {Error} If PRIVATE_KEY or CERTIFICATE environment variables are missing\n * @throws {Error} If document signing, encoding, or API submission fails\n *\n * @example\n * ```typescript\n * // Submit a single invoice\n * const result = await client.submitDocument([invoiceData]);\n * console.log(result.data.submissionUid); // Track submission with this UID\n *\n * // Submit multiple invoices\n * const result = await client.submitDocument([invoice1, invoice2, invoice3]);\n * if (result.status === 202) {\n * console.log('Documents submitted successfully');\n * }\n * ```\n *\n * @remarks\n * - Requires PRIVATE_KEY and CERTIFICATE environment variables for document signing\n * - Each document is digitally signed with XML-DSIG before submission\n * - Documents are base64-encoded for transmission\n * - API limits: Max 100 documents per submission, 5MB total payload, 300KB per document\n * - Debug mode provides detailed logging of payload sizes and validation warnings\n * - Returns HTTP 202 for successful submissions that require processing\n */\n submitDocument(documents: AllDocumentsV1_1[]): Promise<{\n data: SubmissionResponse;\n status: number;\n }>;\n /**\n * Polls the MyInvois platform to get the current status of a document submission.\n *\n * This method continuously checks the submission status until it receives a final result\n * (Valid or Invalid) or reaches the maximum retry limit. It's designed to handle the\n * asynchronous nature of document processing on the MyInvois platform.\n *\n * @param submissionUid - The unique identifier of the submission to check\n * @param pollInterval - Time in milliseconds between status checks (default: 1000ms)\n * @param maxRetries - Maximum number of retry attempts (default: 10)\n * @returns Promise resolving to submission status object with document summary and any errors\n *\n * @example\n * ```typescript\n * // Check submission status with default polling\n * const result = await client.getSubmissionStatus('submission-uid-123');\n * if (result.status === 'Valid') {\n * console.log('All documents processed successfully');\n * console.log('Document summaries:', result.documentSummary);\n * }\n *\n * // Custom polling interval and retry count\n * const result = await client.getSubmissionStatus(\n * 'submission-uid-123',\n * 2000, // Poll every 2 seconds\n * 20 // Try up to 20 times\n * );\n * ```\n *\n * @remarks\n * - Automatically retries on network errors until maxRetries is reached\n * - Returns 'Invalid' status with timeout error if submission processing takes too long\n * - Debug mode provides detailed logging of polling attempts and responses\n * - Use reasonable poll intervals to avoid overwhelming the API\n */\n getSubmissionStatus(submissionUid: string, pollInterval?: number, maxRetries?: number, pageNo?: number, pageSize?: number): Promise<{\n status: SubmissionStatus;\n documentSummary?: DocumentSummary[];\n error?: {\n code: string;\n message: string | null;\n target: string;\n details: {\n code: string;\n message: string;\n target: string;\n }[];\n };\n }>;\n /**\n * Retrieves a document by its unique identifier with the raw document content.\n *\n * @param documentUid - The unique identifier of the document to retrieve\n * @returns Promise resolving to document summary with raw document content as a string\n * @throws {Error} If the document is not found or request fails\n *\n * @example\n * ```typescript\n * const document = await client.getDocument('doc-uuid-123');\n * console.log(document.document); // Raw XML/JSON content\n * console.log(document.uuid); // Document UUID\n * ```\n */\n getDocument(documentUid: string): Promise<DocumentSummary & {\n document: string;\n }>;\n /**\n * Retrieves detailed information about a document including validation results.\n *\n * @param documentUid - The unique identifier of the document to get details for\n * @returns Promise resolving to document summary with detailed validation results\n * @throws {Error} If the document is not found or request fails\n *\n * @example\n * ```typescript\n * const details = await client.getDocumentDetails('doc-uuid-123');\n * console.log(details.validationResults.status); // 'Valid' | 'Invalid' | 'Processing'\n * console.log(details.validationResults.validationSteps); // Array of validation step results\n * ```\n */\n getDocumentDetails(documentUid: string): Promise<DocumentSummary & {\n validationResults: {\n status: DocumentValidationResult;\n validationSteps: DocumentValidationStepResult[];\n };\n }>;\n /**\n * Searches for documents based on various filter criteria.\n *\n * @param params - Search parameters object\n * @param params.uuid - Optional specific document UUID to search for\n * @param params.submissionDateFrom - Required start date for submission date range (ISO date string)\n * @param params.submissionDateTo - Optional end date for submission date range (ISO date string)\n * @param params.pageSize - Optional number of results per page (default handled by API)\n * @param params.pageNo - Optional page number for pagination (0-based)\n * @param params.issueDateFrom - Optional start date for issue date range (ISO date string)\n * @param params.issueDateTo - Optional end date for issue date range (ISO date string)\n * @param params.invoiceDirection - Optional filter by invoice direction ('Sent' or 'Received')\n * @param params.status - Optional filter by document status\n * @param params.documentType - Optional filter by e-invoice type code\n * @param params.searchQuery - Optional text search across uuid, buyerTIN, supplierTIN, buyerName, supplierName, internalID, total\n * @returns Promise resolving to array of document summaries matching the search criteria\n * @throws {Error} If the search request fails\n *\n * @example\n * ```typescript\n * // Search for documents submitted in the last 30 days\n * const documents = await client.searchDocuments({\n * submissionDateFrom: '2024-01-01',\n * submissionDateTo: '2024-01-31',\n * status: 'Valid',\n * pageSize: 10\n * });\n *\n * // Search by supplier name\n * const supplierDocs = await client.searchDocuments({\n * submissionDateFrom: '2024-01-01',\n * searchQuery: 'ACME Corp',\n * invoiceDirection: 'Received'\n * });\n * ```\n */\n searchDocuments({ uuid, submissionDateFrom, submissionDateTo, pageSize, pageNo, issueDateFrom, issueDateTo, invoiceDirection, status, documentType, searchQuery, }: {\n uuid?: string;\n submissionDateFrom: string;\n submissionDateTo?: string;\n pageSize?: number;\n pageNo?: number;\n issueDateFrom?: string;\n issueDateTo?: string;\n invoiceDirection?: 'Sent' | 'Received';\n status?: DocumentStatus;\n documentType?: EInvoiceTypeCode;\n searchQuery?: string;\n }): Promise<DocumentSummary[]>;\n /**\n * Retrieves notifications from the MyInvois platform based on specified search criteria.\n *\n * This method allows you to search for system notifications, alerts, and messages\n * sent by the MyInvois platform regarding document processing, system updates,\n * or account-related information.\n *\n * @param params - Search parameters object for filtering notifications\n * @param params.dateFrom - Optional start date for notification date range (ISO date string)\n * @param params.dateTo - Optional end date for notification date range (ISO date string)\n * @param params.type - Optional notification type filter\n * @param params.language - Optional language preference for notifications\n * @param params.status - Optional notification status filter\n * @param params.pageNo - Optional page number for pagination (0-based)\n * @param params.pageSize - Optional number of results per page\n * @returns Promise resolving to notification response object or standard error\n *\n * @example\n * ```typescript\n * // Get all notifications from the last 7 days\n * const notifications = await client.getNotifications({\n * dateFrom: '2024-01-01',\n * dateTo: '2024-01-07',\n * pageSize: 20\n * });\n *\n * // Get unread notifications only\n * const unreadNotifications = await client.getNotifications({\n * status: 0, // Assuming 0 = unread\n * language: 'en'\n * });\n *\n * // Paginated notification retrieval\n * const firstPage = await client.getNotifications({\n * dateFrom: '2024-01-01',\n * pageNo: 0,\n * pageSize: 10\n * });\n * ```\n *\n * @remarks\n * - All parameters are optional, allowing flexible filtering\n * - Returns paginated results when pageNo and pageSize are specified\n * - Date parameters should be in ISO format (YYYY-MM-DD)\n * - May return StandardError object if the request fails\n */\n getNotifications({ dateFrom, dateTo, type, language, status, pageNo, pageSize, }: NotificationSearchParams): Promise<NotificationResponse>;\n getDocumentTypes(): Promise<DocumentTypesResponse>;\n /**\n * Retrieves detailed information about a specific document type from the MyInvois platform.\n *\n * This method fetches metadata and configuration details for a specific document type,\n * including supported versions, validation rules, and structural requirements.\n * Useful for understanding document format requirements before submission.\n *\n * @param id - The unique identifier of the document type to retrieve\n * @returns Promise resolving to document type response object or standard error\n *\n * @example\n * ```typescript\n * // Get details for e-invoice document type\n * const invoiceType = await client.getDocumentType(1);\n * if ('id' in invoiceType) {\n * console.log('Document type name:', invoiceType.name);\n * console.log('Available versions:', invoiceType.versionNumber);\n * console.log('Description:', invoiceType.description);\n * }\n *\n * // Handle potential errors\n * const documentType = await client.getDocumentType(999);\n * if ('error' in documentType) {\n * console.error('Failed to retrieve document type:', documentType.error.message);\n * }\n * ```\n *\n * @remarks\n * - Returns StandardError object if the document type ID doesn't exist\n * - Document type information includes validation schemas and business rules\n * - Use this method to discover supported document formats and versions\n * - Essential for understanding submission requirements for different document types\n */\n getDocumentType(id: number): Promise<DocumentTypeResponse>;\n /**\n * Generates a shareable QR code URL for a specific document.\n *\n * This method retrieves the document details using its unique identifier,\n * then constructs a URL that can be used to access or share the document\n * via the MyInvois platform. The URL format differs between sandbox and\n * production environments.\n *\n * @param documentUid - The unique identifier of the document\n * @returns Promise resolving to a string containing the QR code URL\n *\n * @example\n * ```typescript\n * const qrCodeUrl = await client.getDocumentQrCode('abc123');\n * console.log('Shareable QR code URL:', qrCodeUrl);\n * // Output (sandbox): https://preprod.myinvois.hasil.gov.my/abc123/share/longId\n * // Output (production): https://myinvois.hasil.gov.my/abc123/share/longId\n * ```\n *\n * @remarks\n * - The returned URL can be embedded in a QR code for document sharing.\n * - The method fetches the document to obtain its longId, which is required for the URL.\n * - Ensure the documentUid is valid and accessible by the current client.\n */\n getDocumentQrCode(documentUid: string, longId?: string): Promise<string | null>;\n /**\n * Retrieves detailed information about a specific version of a document type.\n *\n * This method fetches version-specific metadata, schema definitions, and validation rules\n * for a particular document type version. Essential for understanding the exact format\n * and requirements for document submission in a specific version.\n *\n * @param id - The unique identifier of the document type\n * @param versionId - The unique identifier of the specific version to retrieve\n * @returns Promise resolving to document type version response object or standard error\n *\n * @example\n * ```typescript\n * // Get specific version details for e-invoice\n * const invoiceV1_1 = await client.getDocumentTypeVersion(1, 1);\n * if ('id' in invoiceV1_1) {\n * console.log('Version number:', invoiceV1_1.versionNumber);\n * console.log('Schema:', invoiceV1_1.jsonSchema);\n * console.log('Status:', invoiceV1_1.status);\n * }\n *\n * // Compare different versions\n * const [v1_0, v1_1] = await Promise.all([\n * client.getDocumentTypeVersion(1, 0),\n * client.getDocumentTypeVersion(1, 1)\n * ]);\n *\n * // Handle version not found\n * const result = await client.getDocumentTypeVersion(1, 999);\n * if ('error' in result) {\n * console.error('Version not found:', result.error.message);\n * }\n * ```\n *\n * @remarks\n * - Returns StandardError object if document type ID or version ID doesn't exist\n * - Version information includes JSON schema for validation\n * - Different versions may have different validation rules and field requirements\n * - Use this to ensure your documents conform to the specific version requirements\n * - Version status indicates if the version is active, deprecated, or under development\n */\n getDocumentTypeVersion(id: number, versionId: number): Promise<DocumentTypeVersionResponse>;\n static fromP12(clientId: string, clientSecret: string, environment: 'sandbox' | 'production', p12Input: Buffer | string, passphrase: string, onBehalfOf?: string, debug?: boolean): MyInvoisClient;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAW,iBAAiB;CAAC;CAAK,MAAE;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index67.cts","names":[],"sources":["../src/index.d.ts"],"sourcesContent":["import { DocumentStatus, DocumentSummary, DocumentTypeResponse, DocumentTypesResponse, DocumentTypeVersionResponse, DocumentValidationResult, DocumentValidationStepResult, EInvoiceTypeCode, NotificationResponse, NotificationSearchParams, RegistrationType, StandardError, SubmissionResponse, SubmissionStatus, TaxpayerQRCodeResponse, TinSearchParams, TinSearchResponse, AllDocumentsV1_1 } from './types';\nexport type * from './types/index.d.ts';\nexport declare class MyInvoisClient {\n private readonly baseUrl;\n private readonly clientId;\n private readonly clientSecret;\n private readonly environment;\n private onBehalfOf?;\n private readonly signingCredentials;\n private readonly debug;\n private token;\n private tokenExpiration;\n private requestCount;\n constructor(clientId: string, clientSecret: string, environment: 'sandbox' | 'production', certificatePem: string, privateKeyPem: string, onBehalfOf?: string, debug?: boolean);\n updateOnBehalfOf(onBehalfOf: string): Promise<void>;\n private refreshToken;\n private getToken;\n private fetch;\n /**\n * Validates a TIN against a NRIC/ARMY/PASSPORT/BRN (Business Registration Number)\n *\n * This method verifies if a given Tax Identification Number (TIN) is valid by checking it against\n * the provided identification type and value through the MyInvois platform's validation service.\n *\n * @param tin - The TIN to validate\n * @param idType - The type of ID to validate against ('NRIC', 'ARMY', 'PASSPORT', or 'BRN')\n * @param idValue - The value of the ID to validate against\n * @returns Promise resolving to true if the TIN is valid, false otherwise\n *\n * @example\n * ```typescript\n * // Validate TIN against NRIC\n * const isValid = await client.verifyTin('C12345678901234', 'NRIC', '123456789012');\n * if (isValid) {\n * console.log('TIN is valid');\n * }\n *\n * // Validate TIN against Business Registration Number\n * const isValidBusiness = await client.verifyTin('C98765432109876', 'BRN', '123456-K');\n * ```\n *\n * @remarks\n * - Returns false if validation fails due to network errors or invalid credentials\n * - Debug mode provides error logging for troubleshooting validation failures\n * - This is a non-blocking validation that won't throw exceptions on failure\n */\n verifyTin(tin: string, idType: RegistrationType, idValue: string): Promise<boolean>;\n /**\n * Searches for a Tax Identification Number (TIN) using taxpayer information.\n *\n * This method allows searching for a TIN using either a taxpayer name or a combination\n * of identification type and value. The search is flexible and supports multiple\n * identification types including NRIC, ARMY, PASSPORT, and BRN.\n *\n * @param params - Search parameters object\n * @param params.taxpayerName - Optional name of the taxpayer to search for\n * @param params.idType - Optional type of ID to search with (NRIC, ARMY, PASSPORT, BRN)\n * @param params.idValue - Optional value of the ID to search with\n * @returns Promise resolving to TIN search response or standard error\n *\n * @example\n * ```typescript\n * // Search by taxpayer name\n * const result = await client.searchTin({ taxpayerName: 'John Doe' });\n * if ('tin' in result) {\n * console.log('Found TIN:', result.tin);\n * }\n *\n * // Search by ID type and value\n * const result = await client.searchTin({\n * idType: 'NRIC',\n * idValue: '123456789012'\n * });\n * ```\n *\n * @remarks\n * - Either taxpayerName or both idType and idValue must be provided\n * - Returns StandardError object if search criteria are invalid or inconclusive\n * - Debug mode provides detailed error logging for troubleshooting\n * - Search results are not guaranteed to be unique\n */\n searchTin(params: TinSearchParams): Promise<TinSearchResponse>;\n /**\n * Retrieves taxpayer information from a QR code.\n *\n * This method decodes a QR code containing taxpayer information and returns\n * detailed taxpayer data including TIN, name, contact details, and business information.\n *\n * @param qrCodeText - The QR code text to decode\n * @returns Promise resolving to taxpayer QR code response or standard error\n *\n * @example\n * ```typescript\n * // Get taxpayer info from QR code\n * const taxpayerInfo = await client.getTaxpayerQRCode('QR_CODE_TEXT');\n * if ('tin' in taxpayerInfo) {\n * console.log('Taxpayer TIN:', taxpayerInfo.tin);\n * console.log('Business Name:', taxpayerInfo.name);\n * console.log('Address:', taxpayerInfo.addressLine1);\n * }\n * ```\n *\n * @remarks\n * - QR code must be in the correct format specified by MyInvois\n * - Returns StandardError if QR code is invalid or cannot be decoded\n * - Debug mode provides detailed error logging\n */\n getTaxpayerQRCode(qrCodeText: string): Promise<TaxpayerQRCodeResponse>;\n /**\n * Performs an action on a document such as rejection or cancellation.\n *\n * This method allows updating the status of a document to either rejected or cancelled,\n * along with providing a reason for the action. Useful for managing document workflow\n * and maintaining audit trails.\n *\n * @param documentUid - The unique identifier of the document\n * @param status - The new status to set ('rejected' or 'cancelled')\n * @param reason - The reason for the status change\n * @returns Promise resolving to document action response containing UUID, status, and any errors\n *\n * @example\n * ```typescript\n * // Reject a document with reason\n * const result = await client.performDocumentAction(\n * 'doc-123',\n * 'rejected',\n * 'Invalid tax calculation'\n * );\n *\n * // Cancel a document\n * const result = await client.performDocumentAction(\n * 'doc-456',\n * 'cancelled',\n * 'Duplicate submission'\n * );\n * ```\n *\n * @remarks\n * - Only valid for documents in appropriate states\n * - Reason is required and should be descriptive\n * - Action is irreversible once completed\n * - Returns error if document cannot be found or action is invalid\n */\n performDocumentAction(documentUid: string, status: 'rejected' | 'cancelled', reason: string): Promise<{\n uuid: string;\n status: string;\n error: StandardError;\n }>;\n /**\n * Submits one or more e-invoice documents to the MyInvois platform for processing.\n *\n * This method digitally signs each document using the provided certificate and private key,\n * generates document hashes, encodes them for submission, and sends them to the platform.\n * The method includes comprehensive validation warnings for document size and count limits.\n *\n * @param documents - Array of InvoiceV1_1 documents to be submitted\n * @returns Promise resolving to submission response containing the submission data and HTTP status\n * @throws {Error} If PRIVATE_KEY or CERTIFICATE environment variables are missing\n * @throws {Error} If document signing, encoding, or API submission fails\n *\n * @example\n * ```typescript\n * // Submit a single invoice\n * const result = await client.submitDocument([invoiceData]);\n * console.log(result.data.submissionUid); // Track submission with this UID\n *\n * // Submit multiple invoices\n * const result = await client.submitDocument([invoice1, invoice2, invoice3]);\n * if (result.status === 202) {\n * console.log('Documents submitted successfully');\n * }\n * ```\n *\n * @remarks\n * - Requires PRIVATE_KEY and CERTIFICATE environment variables for document signing\n * - Each document is digitally signed with XML-DSIG before submission\n * - Documents are base64-encoded for transmission\n * - API limits: Max 100 documents per submission, 5MB total payload, 300KB per document\n * - Debug mode provides detailed logging of payload sizes and validation warnings\n * - Returns HTTP 202 for successful submissions that require processing\n */\n submitDocument(documents: AllDocumentsV1_1[]): Promise<{\n data: SubmissionResponse;\n status: number;\n }>;\n /**\n * Polls the MyInvois platform to get the current status of a document submission.\n *\n * This method continuously checks the submission status until it receives a final result\n * (Valid or Invalid) or reaches the maximum retry limit. It's designed to handle the\n * asynchronous nature of document processing on the MyInvois platform.\n *\n * @param submissionUid - The unique identifier of the submission to check\n * @param pollInterval - Time in milliseconds between status checks (default: 1000ms)\n * @param maxRetries - Maximum number of retry attempts (default: 10)\n * @returns Promise resolving to submission status object with document summary and any errors\n *\n * @example\n * ```typescript\n * // Check submission status with default polling\n * const result = await client.getSubmissionStatus('submission-uid-123');\n * if (result.status === 'Valid') {\n * console.log('All documents processed successfully');\n * console.log('Document summaries:', result.documentSummary);\n * }\n *\n * // Custom polling interval and retry count\n * const result = await client.getSubmissionStatus(\n * 'submission-uid-123',\n * 2000, // Poll every 2 seconds\n * 20 // Try up to 20 times\n * );\n * ```\n *\n * @remarks\n * - Automatically retries on network errors until maxRetries is reached\n * - Returns 'Invalid' status with timeout error if submission processing takes too long\n * - Debug mode provides detailed logging of polling attempts and responses\n * - Use reasonable poll intervals to avoid overwhelming the API\n */\n getSubmissionStatus(submissionUid: string, pollInterval?: number, maxRetries?: number, pageNo?: number, pageSize?: number): Promise<{\n status: SubmissionStatus;\n documentSummary?: DocumentSummary[];\n error?: {\n code: string;\n message: string | null;\n target: string;\n details: {\n code: string;\n message: string;\n target: string;\n }[];\n };\n }>;\n /**\n * Retrieves a document by its unique identifier with the raw document content.\n *\n * @param documentUid - The unique identifier of the document to retrieve\n * @returns Promise resolving to document summary with raw document content as a string\n * @throws {Error} If the document is not found or request fails\n *\n * @example\n * ```typescript\n * const document = await client.getDocument('doc-uuid-123');\n * console.log(document.document); // Raw XML/JSON content\n * console.log(document.uuid); // Document UUID\n * ```\n */\n getDocument(documentUid: string): Promise<DocumentSummary & {\n document: string;\n }>;\n /**\n * Retrieves detailed information about a document including validation results.\n *\n * @param documentUid - The unique identifier of the document to get details for\n * @returns Promise resolving to document summary with detailed validation results\n * @throws {Error} If the document is not found or request fails\n *\n * @example\n * ```typescript\n * const details = await client.getDocumentDetails('doc-uuid-123');\n * console.log(details.validationResults.status); // 'Valid' | 'Invalid' | 'Processing'\n * console.log(details.validationResults.validationSteps); // Array of validation step results\n * ```\n */\n getDocumentDetails(documentUid: string): Promise<DocumentSummary & {\n validationResults: {\n status: DocumentValidationResult;\n validationSteps: DocumentValidationStepResult[];\n };\n }>;\n /**\n * Searches for documents based on various filter criteria.\n *\n * @param params - Search parameters object\n * @param params.uuid - Optional specific document UUID to search for\n * @param params.submissionDateFrom - Required start date for submission date range (ISO date string)\n * @param params.submissionDateTo - Optional end date for submission date range (ISO date string)\n * @param params.pageSize - Optional number of results per page (default handled by API)\n * @param params.pageNo - Optional page number for pagination (0-based)\n * @param params.issueDateFrom - Optional start date for issue date range (ISO date string)\n * @param params.issueDateTo - Optional end date for issue date range (ISO date string)\n * @param params.invoiceDirection - Optional filter by invoice direction ('Sent' or 'Received')\n * @param params.status - Optional filter by document status\n * @param params.documentType - Optional filter by e-invoice type code\n * @param params.searchQuery - Optional text search across uuid, buyerTIN, supplierTIN, buyerName, supplierName, internalID, total\n * @returns Promise resolving to array of document summaries matching the search criteria\n * @throws {Error} If the search request fails\n *\n * @example\n * ```typescript\n * // Search for documents submitted in the last 30 days\n * const documents = await client.searchDocuments({\n * submissionDateFrom: '2024-01-01',\n * submissionDateTo: '2024-01-31',\n * status: 'Valid',\n * pageSize: 10\n * });\n *\n * // Search by supplier name\n * const supplierDocs = await client.searchDocuments({\n * submissionDateFrom: '2024-01-01',\n * searchQuery: 'ACME Corp',\n * invoiceDirection: 'Received'\n * });\n * ```\n */\n searchDocuments({ uuid, submissionDateFrom, submissionDateTo, pageSize, pageNo, issueDateFrom, issueDateTo, invoiceDirection, status, documentType, searchQuery, }: {\n uuid?: string;\n submissionDateFrom: string;\n submissionDateTo?: string;\n pageSize?: number;\n pageNo?: number;\n issueDateFrom?: string;\n issueDateTo?: string;\n invoiceDirection?: 'Sent' | 'Received';\n status?: DocumentStatus;\n documentType?: EInvoiceTypeCode;\n searchQuery?: string;\n }): Promise<DocumentSummary[]>;\n /**\n * Retrieves notifications from the MyInvois platform based on specified search criteria.\n *\n * This method allows you to search for system notifications, alerts, and messages\n * sent by the MyInvois platform regarding document processing, system updates,\n * or account-related information.\n *\n * @param params - Search parameters object for filtering notifications\n * @param params.dateFrom - Optional start date for notification date range (ISO date string)\n * @param params.dateTo - Optional end date for notification date range (ISO date string)\n * @param params.type - Optional notification type filter\n * @param params.language - Optional language preference for notifications\n * @param params.status - Optional notification status filter\n * @param params.pageNo - Optional page number for pagination (0-based)\n * @param params.pageSize - Optional number of results per page\n * @returns Promise resolving to notification response object or standard error\n *\n * @example\n * ```typescript\n * // Get all notifications from the last 7 days\n * const notifications = await client.getNotifications({\n * dateFrom: '2024-01-01',\n * dateTo: '2024-01-07',\n * pageSize: 20\n * });\n *\n * // Get unread notifications only\n * const unreadNotifications = await client.getNotifications({\n * status: 0, // Assuming 0 = unread\n * language: 'en'\n * });\n *\n * // Paginated notification retrieval\n * const firstPage = await client.getNotifications({\n * dateFrom: '2024-01-01',\n * pageNo: 0,\n * pageSize: 10\n * });\n * ```\n *\n * @remarks\n * - All parameters are optional, allowing flexible filtering\n * - Returns paginated results when pageNo and pageSize are specified\n * - Date parameters should be in ISO format (YYYY-MM-DD)\n * - May return StandardError object if the request fails\n */\n getNotifications({ dateFrom, dateTo, type, language, status, pageNo, pageSize, }: NotificationSearchParams): Promise<NotificationResponse>;\n getDocumentTypes(): Promise<DocumentTypesResponse>;\n /**\n * Retrieves detailed information about a specific document type from the MyInvois platform.\n *\n * This method fetches metadata and configuration details for a specific document type,\n * including supported versions, validation rules, and structural requirements.\n * Useful for understanding document format requirements before submission.\n *\n * @param id - The unique identifier of the document type to retrieve\n * @returns Promise resolving to document type response object or standard error\n *\n * @example\n * ```typescript\n * // Get details for e-invoice document type\n * const invoiceType = await client.getDocumentType(1);\n * if ('id' in invoiceType) {\n * console.log('Document type name:', invoiceType.name);\n * console.log('Available versions:', invoiceType.versionNumber);\n * console.log('Description:', invoiceType.description);\n * }\n *\n * // Handle potential errors\n * const documentType = await client.getDocumentType(999);\n * if ('error' in documentType) {\n * console.error('Failed to retrieve document type:', documentType.error.message);\n * }\n * ```\n *\n * @remarks\n * - Returns StandardError object if the document type ID doesn't exist\n * - Document type information includes validation schemas and business rules\n * - Use this method to discover supported document formats and versions\n * - Essential for understanding submission requirements for different document types\n */\n getDocumentType(id: number): Promise<DocumentTypeResponse>;\n /**\n * Generates a shareable QR code URL for a specific document.\n *\n * This method retrieves the document details using its unique identifier,\n * then constructs a URL that can be used to access or share the document\n * via the MyInvois platform. The URL format differs between sandbox and\n * production environments.\n *\n * @param documentUid - The unique identifier of the document\n * @returns Promise resolving to a string containing the QR code URL\n *\n * @example\n * ```typescript\n * const qrCodeUrl = await client.getDocumentQrCode('abc123');\n * console.log('Shareable QR code URL:', qrCodeUrl);\n * // Output (sandbox): https://preprod.myinvois.hasil.gov.my/abc123/share/longId\n * // Output (production): https://myinvois.hasil.gov.my/abc123/share/longId\n * ```\n *\n * @remarks\n * - The returned URL can be embedded in a QR code for document sharing.\n * - The method fetches the document to obtain its longId, which is required for the URL.\n * - Ensure the documentUid is valid and accessible by the current client.\n */\n getDocumentQrCode(documentUid: string, longId?: string): Promise<string | null>;\n /**\n * Retrieves detailed information about a specific version of a document type.\n *\n * This method fetches version-specific metadata, schema definitions, and validation rules\n * for a particular document type version. Essential for understanding the exact format\n * and requirements for document submission in a specific version.\n *\n * @param id - The unique identifier of the document type\n * @param versionId - The unique identifier of the specific version to retrieve\n * @returns Promise resolving to document type version response object or standard error\n *\n * @example\n * ```typescript\n * // Get specific version details for e-invoice\n * const invoiceV1_1 = await client.getDocumentTypeVersion(1, 1);\n * if ('id' in invoiceV1_1) {\n * console.log('Version number:', invoiceV1_1.versionNumber);\n * console.log('Schema:', invoiceV1_1.jsonSchema);\n * console.log('Status:', invoiceV1_1.status);\n * }\n *\n * // Compare different versions\n * const [v1_0, v1_1] = await Promise.all([\n * client.getDocumentTypeVersion(1, 0),\n * client.getDocumentTypeVersion(1, 1)\n * ]);\n *\n * // Handle version not found\n * const result = await client.getDocumentTypeVersion(1, 999);\n * if ('error' in result) {\n * console.error('Version not found:', result.error.message);\n * }\n * ```\n *\n * @remarks\n * - Returns StandardError object if document type ID or version ID doesn't exist\n * - Version information includes JSON schema for validation\n * - Different versions may have different validation rules and field requirements\n * - Use this to ensure your documents conform to the specific version requirements\n * - Version status indicates if the version is active, deprecated, or under development\n */\n getDocumentTypeVersion(id: number, versionId: number): Promise<DocumentTypeVersionResponse>;\n static fromP12(clientId: string, clientSecret: string, environment: 'sandbox' | 'production', p12Input: Buffer | string, passphrase: string, onBehalfOf?: string, debug?: boolean): MyInvoisClient;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAW,iBAAiB;CAAC;CAAK,MAAE;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;CAAA,MAAA;AAAA"}
|
package/dist/index7.cjs
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
require('./formatIdValue-i67o4kyD.cjs');
|
|
2
|
+
const require_taxpayerValidation = require('./taxpayerValidation-D_jGaVty.cjs');
|
|
3
|
+
|
|
4
|
+
exports.taxpayerQRCode = require_taxpayerValidation.taxpayerQRCode;
|
|
5
|
+
exports.tinSearch = require_taxpayerValidation.tinSearch;
|
|
6
|
+
exports.verifyTin = require_taxpayerValidation.verifyTin;
|
package/dist/index8.cjs
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/types/classification-codes.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing the allowed classification codes with descriptive names.
|
|
5
|
+
* Provides a more readable way to reference classification codes.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const code = ClassificationCodeEnum.ComputerSmartphoneOrTablet;
|
|
9
|
+
* console.log(code); // Output: "003"
|
|
10
|
+
*/
|
|
11
|
+
let ClassificationCodeEnum = /* @__PURE__ */ function(ClassificationCodeEnum$1) {
|
|
12
|
+
ClassificationCodeEnum$1["BreastfeedingEquipment"] = "001";
|
|
13
|
+
ClassificationCodeEnum$1["ChildCareCentresAndKindergartensFees"] = "002";
|
|
14
|
+
ClassificationCodeEnum$1["ComputerSmartphoneOrTablet"] = "003";
|
|
15
|
+
ClassificationCodeEnum$1["ConsolidatedEInvoice"] = "004";
|
|
16
|
+
ClassificationCodeEnum$1["ConstructionMaterials"] = "005";
|
|
17
|
+
ClassificationCodeEnum$1["Disbursement"] = "006";
|
|
18
|
+
ClassificationCodeEnum$1["Donation"] = "007";
|
|
19
|
+
ClassificationCodeEnum$1["ECommerceEInvoiceToBuyer"] = "008";
|
|
20
|
+
ClassificationCodeEnum$1["ECommerceSelfBilledToSellerLogistics"] = "009";
|
|
21
|
+
ClassificationCodeEnum$1["EducationFees"] = "010";
|
|
22
|
+
ClassificationCodeEnum$1["GoodsOnConsignmentConsignor"] = "011";
|
|
23
|
+
ClassificationCodeEnum$1["GoodsOnConsignmentConsignee"] = "012";
|
|
24
|
+
ClassificationCodeEnum$1["GymMembership"] = "013";
|
|
25
|
+
ClassificationCodeEnum$1["InsuranceEducationMedicalBenefits"] = "014";
|
|
26
|
+
ClassificationCodeEnum$1["InsuranceTakafulLife"] = "015";
|
|
27
|
+
ClassificationCodeEnum$1["InterestFinancingExpenses"] = "016";
|
|
28
|
+
ClassificationCodeEnum$1["InternetSubscription"] = "017";
|
|
29
|
+
ClassificationCodeEnum$1["LandAndBuilding"] = "018";
|
|
30
|
+
ClassificationCodeEnum$1["MedicalExamLearningDisabilities"] = "019";
|
|
31
|
+
ClassificationCodeEnum$1["MedicalExamVaccination"] = "020";
|
|
32
|
+
ClassificationCodeEnum$1["MedicalExpensesSeriousDiseases"] = "021";
|
|
33
|
+
ClassificationCodeEnum$1["Others"] = "022";
|
|
34
|
+
ClassificationCodeEnum$1["PetroleumOperations"] = "023";
|
|
35
|
+
ClassificationCodeEnum$1["PrivateRetirementSchemeDeferredAnnuity"] = "024";
|
|
36
|
+
ClassificationCodeEnum$1["MotorVehicle"] = "025";
|
|
37
|
+
ClassificationCodeEnum$1["SubscriptionBooksJournalsEtc"] = "026";
|
|
38
|
+
ClassificationCodeEnum$1["Reimbursement"] = "027";
|
|
39
|
+
ClassificationCodeEnum$1["RentalOfMotorVehicle"] = "028";
|
|
40
|
+
ClassificationCodeEnum$1["EVChargingFacilities"] = "029";
|
|
41
|
+
ClassificationCodeEnum$1["RepairAndMaintenance"] = "030";
|
|
42
|
+
ClassificationCodeEnum$1["ResearchAndDevelopment"] = "031";
|
|
43
|
+
ClassificationCodeEnum$1["ForeignIncome"] = "032";
|
|
44
|
+
ClassificationCodeEnum$1["SelfBilledBettingGaming"] = "033";
|
|
45
|
+
ClassificationCodeEnum$1["SelfBilledImportationGoods"] = "034";
|
|
46
|
+
ClassificationCodeEnum$1["SelfBilledImportationServices"] = "035";
|
|
47
|
+
ClassificationCodeEnum$1["SelfBilledOthers"] = "036";
|
|
48
|
+
ClassificationCodeEnum$1["SelfBilledMonetaryPaymentToAgents"] = "037";
|
|
49
|
+
ClassificationCodeEnum$1["SportsEquipmentRentalFeesEtc"] = "038";
|
|
50
|
+
ClassificationCodeEnum$1["SupportingEquipmentDisabledPerson"] = "039";
|
|
51
|
+
ClassificationCodeEnum$1["VoluntaryContributionProvidentFund"] = "040";
|
|
52
|
+
ClassificationCodeEnum$1["DentalExamTreatment"] = "041";
|
|
53
|
+
ClassificationCodeEnum$1["FertilityTreatment"] = "042";
|
|
54
|
+
ClassificationCodeEnum$1["TreatmentHomeCareNursingEtc"] = "043";
|
|
55
|
+
ClassificationCodeEnum$1["VouchersGiftCardsLoyaltyPoints"] = "044";
|
|
56
|
+
ClassificationCodeEnum$1["SelfBilledNonMonetaryPaymentToAgents"] = "045";
|
|
57
|
+
return ClassificationCodeEnum$1;
|
|
58
|
+
}({});
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
exports.ClassificationCodeEnum = ClassificationCodeEnum;
|
|
62
|
+
//# sourceMappingURL=index8.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"index8.cjs","names":[],"sources":["../src/types/classification-codes.d.ts"],"sourcesContent":["/**\n * Represents the allowed classification codes for e-Invoice items.\n * Based on the documentation: https://sdk.myinvois.hasil.gov.my/codes/classification-codes/\n */\nexport type ClassificationCode =\n | '001' // Breastfeeding equipment\n | '002' // Child care centres and kindergartens fees\n | '003' // Computer, smartphone or tablet\n | '004' // Consolidated e-Invoice\n | '005' // Construction materials (as specified under Fourth Schedule of the Lembaga Pembangunan Industri Pembinaan Malaysia Act 1994)\n | '006' // Disbursement\n | '007' // Donation\n | '008' // e-Commerce - e-Invoice to buyer / purchaser\n | '009' // e-Commerce - Self-billed e-Invoice to seller, logistics, etc.\n | '010' // Education fees\n | '011' // Goods on consignment (Consignor)\n | '012' // Goods on consignment (Consignee)\n | '013' // Gym membership\n | '014' // Insurance - Education and medical benefits\n | '015' // Insurance - Takaful or life insurance\n | '016' // Interest and financing expenses\n | '017' // Internet subscription\n | '018' // Land and building\n | '019' // Medical examination for learning disabilities and early intervention or rehabilitation treatments of learning disabilities\n | '020' // Medical examination or vaccination expenses\n | '021' // Medical expenses for serious diseases\n | '022' // Others\n | '023' // Petroleum operations (as defined in Petroleum (Income Tax) Act 1967)\n | '024' // Private retirement scheme or deferred annuity scheme\n | '025' // Motor vehicle\n | '026' // Subscription of books / journals / magazines / newspapers / other similar publications\n | '027' // Reimbursement\n | '028' // Rental of motor vehicle\n | '029' // EV charging facilities (Installation, rental, sale / purchase or subscription fees)\n | '030' // Repair and maintenance\n | '031' // Research and development\n | '032' // Foreign income\n | '033' // Self-billed - Betting and gaming\n | '034' // Self-billed - Importation of goods\n | '035' // Self-billed - Importation of services\n | '036' // Self-billed - Others\n | '037' // Self-billed - Monetary payment to agents, dealers or distributors\n | '038' // Sports equipment, rental / entry fees for sports facilities, registration in sports competition or sports training fees imposed by associations / sports clubs / companies registered with the Sports Commissioner or Companies Commission of Malaysia and carrying out sports activities as listed under the Sports Development Act 1997\n | '039' // Supporting equipment for disabled person\n | '040' // Voluntary contribution to approved provident fund\n | '041' // Dental examination or treatment\n | '042' // Fertility treatment\n | '043' // Treatment and home care nursing, daycare centres and residential care centers\n | '044' // Vouchers, gift cards, loyalty points, etc\n | '045' // Self-billed - Non-monetary payment to agents, dealers or distributors\n\n/**\n * Enum representing the allowed classification codes with descriptive names.\n * Provides a more readable way to reference classification codes.\n *\n * @example\n * const code = ClassificationCodeEnum.ComputerSmartphoneOrTablet;\n * console.log(code); // Output: \"003\"\n */\nexport enum ClassificationCodeEnum {\n BreastfeedingEquipment = '001',\n ChildCareCentresAndKindergartensFees = '002',\n ComputerSmartphoneOrTablet = '003',\n ConsolidatedEInvoice = '004',\n ConstructionMaterials = '005',\n Disbursement = '006',\n Donation = '007',\n ECommerceEInvoiceToBuyer = '008',\n ECommerceSelfBilledToSellerLogistics = '009',\n EducationFees = '010',\n GoodsOnConsignmentConsignor = '011',\n GoodsOnConsignmentConsignee = '012',\n GymMembership = '013',\n InsuranceEducationMedicalBenefits = '014',\n InsuranceTakafulLife = '015',\n InterestFinancingExpenses = '016',\n InternetSubscription = '017',\n LandAndBuilding = '018',\n MedicalExamLearningDisabilities = '019',\n MedicalExamVaccination = '020',\n MedicalExpensesSeriousDiseases = '021',\n Others = '022',\n PetroleumOperations = '023',\n PrivateRetirementSchemeDeferredAnnuity = '024',\n MotorVehicle = '025',\n SubscriptionBooksJournalsEtc = '026',\n Reimbursement = '027',\n RentalOfMotorVehicle = '028',\n EVChargingFacilities = '029',\n RepairAndMaintenance = '030',\n ResearchAndDevelopment = '031',\n ForeignIncome = '032',\n SelfBilledBettingGaming = '033',\n SelfBilledImportationGoods = '034',\n SelfBilledImportationServices = '035',\n SelfBilledOthers = '036',\n SelfBilledMonetaryPaymentToAgents = '037',\n SportsEquipmentRentalFeesEtc = '038',\n SupportingEquipmentDisabledPerson = '039',\n VoluntaryContributionProvidentFund = '040',\n DentalExamTreatment = '041',\n FertilityTreatment = '042',\n TreatmentHomeCareNursingEtc = '043',\n VouchersGiftCardsLoyaltyPoints = '044',\n SelfBilledNonMonetaryPaymentToAgents = '045',\n}\n\n/**\n * Interface representing a classification code entry.\n * Contains the code and its corresponding description.\n */\nexport interface Classification {\n code: ClassificationCode\n description: string\n}\n"],"mappings":";;;;;;;;;;AA2DA,IAAY,4EAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACD"}
|