UNPKG

myinvois-sdk

Version:

TypeScript SDK for interacting with the Malaysia e-invoicing system (MyInvois) API

59 lines (58 loc) 2.28 kB
import { HttpClient } from '../utils/http-client'; import { AuthService } from './auth-service'; import { CertificateHandler } from '../utils/certificate-handler'; import { Invoice } from '../models/invoice'; import { SignedInvoice } from '../models/signed-invoice'; import { MyInvoisConfig } from '../config'; /** * Service for invoice operations */ export declare class InvoiceService { private httpClient; private authService; private certificateHandler; private documentSigner; private config; /** * Creates a new invoice service * @param httpClient The HTTP client to use * @param authService The authentication service to use * @param certificateHandler The certificate handler to use * @param config The MyInvois configuration */ constructor(httpClient: HttpClient, authService: AuthService, certificateHandler: CertificateHandler, config: MyInvoisConfig); /** * Sign an invoice * @param invoice The invoice to sign * @returns A promise resolving to the signed invoice */ signInvoice(invoice: Invoice): Promise<SignedInvoice>; /** * Submit a signed invoice * @param signedInvoice The signed invoice to submit * @param authTIN The TIN to use for authentication * @returns A promise resolving to the submission result */ submitInvoice(signedInvoice: SignedInvoice, authTIN?: string): Promise<any>; /** * Submit multiple signed invoices * @param signedInvoices The signed invoices to submit * @param authTIN The TIN to use for authentication * @returns A promise resolving to the submission result */ submitInvoices(signedInvoices: SignedInvoice[], authTIN?: string): Promise<any>; /** * Create a builder for an invoice * @returns An invoice instance for building */ createInvoice(): Invoice; calculateSHA256Hex(input: string): string; /** * Cancel an invoice * @param documentUuid The UUID of the document to cancel * @param reason The reason for cancellation * @param authTIN The TIN to use for authentication * @returns A promise resolving to the cancellation result */ cancelInvoice(documentUuid: string, reason: string, authTIN?: string): Promise<any>; }