UNPKG

@nkhind/vivawallet-sdk

Version:
29 lines (28 loc) 1.99 kB
import { VivaSmartCheckoutOptions, VivawalletAPIInit } from '../types/Vivawallet.types'; import VivaAuth from '../vivabases/VivaAuth.class'; import { SourceCodeDatas } from '../types/VivaSource.types'; import { VivaTransaction, VivaTransactionDatas, VivaTransactionRefundOptions, VivaTransactionReturn } from '../types/VivaTransactions.types'; import { VivaPaymentOrderOptions } from '../types/VivaOrder.types'; declare class Vivawallet extends VivaAuth { constructor(datas: VivawalletAPIInit); /** ------------------ SOURCE CODE ------------------ */ /** Set the Viva Wallet payment source (needed for Transaction integrations), return `true` if setup is OK, `false` if the payment already exist or on error */ setVivawalletSource(data: SourceCodeDatas): Promise<boolean>; /** ------------------------------------------------- */ /** ------------------ TRANSACTION ------------------ */ /** Return the transaction if exist, or `null` if error/not exist */ getTransactionById(transactionId: string): Promise<VivaTransaction | null>; /** Make transaction by transactionId */ makeTransaction(options: VivaTransactionDatas): Promise<VivaTransactionReturn | null>; /** Allow refund transaction, return `true` if the transaction be refund succefuly */ refundTransaction(transactionId: string, refundOptions: VivaTransactionRefundOptions): Promise<boolean>; /** ------------------------------------------------- */ /** -------------------- PAYMENT -------------------- */ /** Make new VivaWallet order, return `orderCode` */ createOrder(orderData: VivaPaymentOrderOptions): Promise<number | null>; /** Allow cancel operation on non-validate orders, return `true` if the order canceled succefuly */ cancelOrder(orderCode: string | null): Promise<boolean>; } /** Return the smart checkout url with the `orderCode` */ export declare function getSmartCheckout(options: VivaSmartCheckoutOptions): string; export default Vivawallet;