interface SepayApiPaginationMeta { per_page?: number; total?: number; has_more?: boolean; current_page?: number; page_count?: number; page?: number; total_pages?: number; } interface SepayApiErrorMap { [field: string]: string | string[]; } interface SepayApiEnvelope { code?: number; message?: string; data?: TData; meta?: SepayApiPaginationMeta; errors?: SepayApiErrorMap; [key: string]: unknown; } interface SepayOperationResult { code?: number; message?: string; [key: string]: unknown; } interface SepayDetailResult { item: TData; } interface SepayPaginatedResult { items: TData[]; meta: SepayApiPaginationMeta; } type DateTimeString = string; type DateString = string; type CompanyStatus = "Pending" | "Active" | "Suspended" | "Terminated" | "Cancelled" | "Fraud" | (string & {}); type PaymentCodeFlag = "on" | "off" | (string & {}); type PaymentCodeSuffixCharacterType = "NumberOnly" | "NumberAndLetter" | (string & {}); interface TransactionAmountLimit { min?: number; max?: number; unlimited?: boolean; [key: string]: unknown; } interface CreateTokenResponse { code: number; access_token: string; ttl: number; } type LinkTokenPurpose = "LINK_BANK_ACCOUNT" | "UNLINK_BANK_ACCOUNT" | (string & {}); type LinkTokenStatus = "Active" | "Revoked" | "Expired" | "Completed" | (string & {}); interface CreateLinkTokenRequest { company_xid: string; purpose?: LinkTokenPurpose; bank_account_xid?: string; completion_redirect_uri?: string; is_mobile_app?: 0 | 1; language?: "vi" | "en" | (string & {}); } interface CreateLinkTokenResponse { xid: string; hosted_link_url: string; link_token: string; expires_at: string; } interface GetLinkTokenRequest { link_token?: string; link_token_xid?: string; } interface RevokeLinkTokenRequest { link_token_xid: string; } interface LinkTokenCompanyInfo { xid: string; full_name: string; status: string; } interface LinkTokenSession { xid: string; context?: Record; state?: string; status?: string; result?: Record; finished_at?: string | null; expires_at?: string | null; created_at?: string; updated_at?: string; } interface LinkTokenEvent { xid: string; name: string; metadata?: Record; created_at?: string; } interface LinkTokenDetails { xid: string; purpose: LinkTokenPurpose; status: LinkTokenStatus; completion_redirect_uri?: string | null; is_mobile_app?: 0 | 1; language?: string; session_count?: number; created_at?: string; updated_at?: string; expires_at?: string; company?: LinkTokenCompanyInfo; sessions?: LinkTokenSession[]; events?: LinkTokenEvent[]; [key: string]: unknown; } interface Company { xid: string; full_name: string; short_name?: string | null; status: CompanyStatus; active?: "0" | "1" | number | boolean; configuration?: unknown[]; created_at?: string; updated_at?: string; [key: string]: unknown; } interface CompanyCreateRequest { full_name: string; status: Extract | "Active" | "Pending"; } interface CompanyUpdateRequest { full_name?: string; short_name?: string; status?: CompanyStatus; payment_code?: PaymentCodeFlag; payment_code_prefix?: string; payment_code_suffix_from?: number; payment_code_suffix_to?: number; payment_code_suffix_character_type?: PaymentCodeSuffixCharacterType; transaction_amount?: TransactionAmountLimit | "Unlimited" | null; } interface CompanyListQuery { page?: number; per_page?: number; status?: CompanyStatus; active?: "0" | "1" | number | boolean; } interface CompanyCounterQuery { date?: string; } interface CompanyCounterItem { date: string; transaction: number | string; transaction_in: number | string; transaction_out: number | string; } interface CompanyCounterAggregate { transaction: number | string; transaction_in: number | string; transaction_out: number | string; } interface CompanyCounterData { dates: CompanyCounterItem[]; total: CompanyCounterAggregate; } interface VirtualAccount { xid: string; sub_account: string; sub_holder_name?: string; active?: "0" | "1" | number; created_at?: string; updated_at?: string; [key: string]: unknown; } interface BankAccount { xid: string; company_xid: string; brand_name?: string; account_holder_name?: string; account_number?: string; accumulated?: string | number; account_type?: "individual" | "enterprise" | (string & {}); bank_api_connected?: "0" | "1" | number; active?: "0" | "1" | number; last_transaction?: string | null; identification_number?: string | null; phone_number?: string | null; created_at?: string; updated_at?: string; va_list?: VirtualAccount[]; [key: string]: unknown; } interface BankAccountListQuery { page?: number; per_page?: number; company_xid?: string; brand_name?: string; active?: "0" | "1" | number; } type TransactionTransferType = "in" | "out" | "credit" | "debit" | (string & {}); interface Transaction { transaction_id: string; transaction_date: string; bank_account_xid: string; company_xid: string; brand_name?: string; account_number?: string; va?: string | null; va_xid?: string | null; reference_number?: string; transfer_type?: TransactionTransferType; amount?: number | string; transaction_content?: string; payment_code?: string | null; webhook_success?: 0 | 1 | boolean; accumulated?: number | string; [key: string]: unknown; } interface TransactionListQuery { page?: number; per_page?: number; company_xid?: string; bank_account_xid?: string; transfer_type?: TransactionTransferType; payment_code?: string; webhook_success?: 0 | 1; start_transaction_date?: string; end_transaction_date?: string; [key: string]: string | number | undefined; } interface MockTransactionCreateRequest { company_xid: string; bank_account_xid?: string; amount: number; transfer_type?: Extract | "credit" | "debit"; transaction_content?: string; reference_number?: string; payment_code?: string; transaction_date?: string; } interface MockTransactionCreateResponse { transaction_id: string; reference_number?: string; transaction_date: string; amount: number; transfer_type: "credit" | "debit" | (string & {}); accumulated?: number; [key: string]: unknown; } interface MerchantConfig { transaction_whitelist_remark_keywords: string[]; global_hosted_link_custom_css: string | null; logo_url?: string | null; [key: string]: unknown; } interface MerchantConfigUpdateRequest { transaction_whitelist_remark_keywords?: string[]; global_hosted_link_custom_css?: string; } interface UploadMerchantLogoOptions { formData: FormData; } type WebhookAuthType = "SECRET_KEY" | (string & {}); type BankHubWebhookEventName = "LINK_TOKEN_CREATED" | "LINK_TOKEN_REVOKED" | "LINK_TOKEN_EXPIRED" | "LINK_SESSION_INITIALIZED" | "LINK_SESSION_REINITIALIZED" | "LINK_SESSION_STATE_CHANGED" | "LINK_SESSION_COMPLETED" | "LINK_SESSION_FAILED" | "LINK_SESSION_ABANDONED" | "LINK_SESSION_EXPIRED" | "BANK_ACCOUNT_LINKED" | "BANK_ACCOUNT_UNLINKED" | "BANK_ACCOUNT_INACTIVATED" | "*" | (string & {}); interface WebhookConfig { xid?: string; webhook_url?: string; auth_type?: WebhookAuthType; secret_key?: string; active?: 0 | 1; allow_events?: BankHubWebhookEventName[]; created_at?: string; updated_at?: string; [key: string]: unknown; } interface WebhookUpsertRequest { webhook_url?: string; auth_type?: WebhookAuthType; secret_key?: string; active?: 0 | 1; allow_events?: BankHubWebhookEventName[]; } interface BankHubWebhookEvent> { timestamp: number; xid: string; version: string; event: BankHubWebhookEventName; metadata: TMeta; } interface BankHubIframePostMessageEvent { event: "FINISHED_BANK_ACCOUNT_LINK" | "FINISHED_BANK_ACCOUNT_UNLINK" | "BANKHUB_CLOSE_LINK" | "BANKHUB_TOKEN_EXPIRED" | "BANKHUB_SESSION_EXPIRED" | (string & {}); metadata?: { account_number?: string; account_type?: "individual" | "enterprise" | (string & {}); [key: string]: unknown; }; timestamp?: string; } interface SepayIpnPayload { gateway: string; transaction_date: string; account_number: string; bank_account_xid: string; va: string | null; payment_code: string | null; content: string; transfer_type: "credit" | "debit" | (string & {}); amount: number; reference_code: string; accumulated: number; transaction_id: string; } interface SepayIpnAckResponse { success: boolean; } type AuthMode = "basic" | "bearer" | "none"; interface SepayBankHubClientOptions { baseUrl?: string; sandbox?: boolean; clientId: string; clientSecret: string; timeoutMs?: number; tokenRefreshBufferSeconds?: number; } interface SepayRequestOptions { operation: string; authMode?: AuthMode; params?: Record; headers?: Record; } declare class SepayBankHubClient { private readonly http; private readonly clientId; private readonly clientSecret; private readonly tokenRefreshBufferSeconds; private accessToken; private tokenExpiresAt; constructor(options: SepayBankHubClientOptions); get(path: string, options: SepayRequestOptions): Promise; post(path: string, body: TBody, options: SepayRequestOptions): Promise; createAccessToken(): Promise; setAccessToken(accessToken: string, ttlSeconds?: number): void; private request; private ensureAccessToken; private createBasicAuthorization; private mapAxiosError; private pickMessage; } type SepayBankHubErrorCode = "CONFIGURATION_ERROR" | "AUTHENTICATION_ERROR" | "VALIDATION_ERROR" | "API_ERROR" | "NETWORK_ERROR" | "TIMEOUT_ERROR" | "UNEXPECTED_RESPONSE"; interface SepayBankHubErrorOptions { code: SepayBankHubErrorCode; status?: number; operation?: string; details?: unknown; requestId?: string; retryable?: boolean; cause?: unknown; } declare class SepayBankHubError extends Error { readonly code: SepayBankHubErrorCode; readonly status?: number; readonly operation?: string; readonly details?: unknown; readonly requestId?: string; readonly retryable?: boolean; constructor(message: string, options: SepayBankHubErrorOptions); } declare class SepayBankHubService { private readonly client; readonly auth: { createToken: () => Promise; setAccessToken: (accessToken: string, ttlSeconds?: number) => void; }; readonly linkToken: { create: (payload: CreateLinkTokenRequest) => Promise; get: (payload: GetLinkTokenRequest) => Promise>; revoke: (payload: RevokeLinkTokenRequest) => Promise; }; readonly company: { list: (query?: CompanyListQuery) => Promise>; details: (companyId: string) => Promise>; create: (payload: CompanyCreateRequest) => Promise; update: (companyId: string, payload: CompanyUpdateRequest) => Promise; counter: (companyId: string, query?: CompanyCounterQuery) => Promise; }; readonly bankAccount: { list: (query?: BankAccountListQuery) => Promise>; details: (bankAccountId: string) => Promise>; }; readonly transaction: { list: (query?: TransactionListQuery) => Promise>; details: (transactionId: string) => Promise>; createMock: (payload: MockTransactionCreateRequest) => Promise; }; readonly merchantConfig: { get: () => Promise>; update: (payload: MerchantConfigUpdateRequest) => Promise; uploadLogo: (options: UploadMerchantLogoOptions) => Promise; }; readonly webhook: { get: () => Promise>; upsert: (payload: WebhookUpsertRequest) => Promise; }; constructor(options: SepayBankHubClientOptions | SepayBankHubClient); createAccessToken(): Promise; setAccessToken(accessToken: string, ttlSeconds?: number): void; createLinkToken(payload: CreateLinkTokenRequest): Promise; getLinkToken(payload: GetLinkTokenRequest): Promise>; revokeLinkToken(payload: RevokeLinkTokenRequest): Promise; listCompanies(query?: CompanyListQuery): Promise>; getCompanyDetails(companyId: string): Promise>; createCompany(payload: CompanyCreateRequest): Promise; updateCompany(companyId: string, payload: CompanyUpdateRequest): Promise; getCompanyCounter(companyId: string, query?: CompanyCounterQuery): Promise; listBankAccounts(query?: BankAccountListQuery): Promise>; getBankAccountDetails(bankAccountId: string): Promise>; listTransactions(query?: TransactionListQuery): Promise>; getTransactionDetails(transactionId: string): Promise>; createMockTransaction(payload: MockTransactionCreateRequest): Promise; getMerchantConfig(): Promise>; updateMerchantConfig(payload: MerchantConfigUpdateRequest): Promise; uploadMerchantLogo(options: UploadMerchantLogoOptions): Promise; getWebhookConfig(): Promise>; upsertWebhook(payload: WebhookUpsertRequest): Promise; private req; private toParams; private ensureId; private extractListData; private extractMeta; private extractOperationResult; private extractDataOrSelf; } export { type BankAccount, type BankAccountListQuery, type BankHubIframePostMessageEvent, type BankHubWebhookEvent, type BankHubWebhookEventName, type Company, type CompanyCounterAggregate, type CompanyCounterData, type CompanyCounterItem, type CompanyCounterQuery, type CompanyCreateRequest, type CompanyListQuery, type CompanyStatus, type CompanyUpdateRequest, type CreateLinkTokenRequest, type CreateLinkTokenResponse, type CreateTokenResponse, type DateString, type DateTimeString, type GetLinkTokenRequest, type LinkTokenCompanyInfo, type LinkTokenDetails, type LinkTokenEvent, type LinkTokenPurpose, type LinkTokenSession, type LinkTokenStatus, type MerchantConfig, type MerchantConfigUpdateRequest, type MockTransactionCreateRequest, type MockTransactionCreateResponse, type PaymentCodeFlag, type PaymentCodeSuffixCharacterType, type RevokeLinkTokenRequest, type SepayApiEnvelope, type SepayApiErrorMap, type SepayApiPaginationMeta, SepayBankHubClient, type SepayBankHubClientOptions, SepayBankHubError, type SepayBankHubErrorCode, type SepayBankHubErrorOptions, SepayBankHubService, type SepayDetailResult, type SepayIpnAckResponse, type SepayIpnPayload, type SepayOperationResult, type SepayPaginatedResult, type SepayRequestOptions, type Transaction, type TransactionAmountLimit, type TransactionListQuery, type TransactionTransferType, type UploadMerchantLogoOptions, type VirtualAccount, type WebhookAuthType, type WebhookConfig, type WebhookUpsertRequest };