@hachther/mesomb
Version:
JS client for browser to perform mobile payment operation with MeSomb
110 lines (109 loc) • 4.13 kB
TypeScript
import { AOperation } from './AOperation';
import { WalletCreationRequest } from '../types';
import Wallet from '../models/Wallet';
import WalletTransaction from '../models/WalletTransaction';
import PaginatedWallets from '../models/PaginatedWallets';
import PaginatedWalletTransactions from '../models/PaginatedWalletTransactions';
export declare class WalletOperation extends AOperation {
service: string;
constructor({ providerKey, accessKey, secretKey, language, }: {
providerKey: string;
accessKey: string;
secretKey: string;
language?: string;
});
/**
* Create a wallet for a user
*
* @param {WalletCreationRequest} data to create a wallet
* @param {string} [data.firstName] of the wallet owner
* @param {string} data.lastName of the wallet owner
* @param {string} [data.email] of the wallet owner
* @param {string} data.phoneNumber of the wallet owner
* @param {string} [data.country=CM] of the wallet owner
* @param {string} data.gender of the wallet owner
* @param {string} [data.nonce] unique string on each request
* @param {string} [data.number] The unique numeric wallet identifier, if not set we will generate one for you
*
* @returns {Wallet} wallet
*/
createWallet({ firstName, lastName, email, phoneNumber, country, gender, nonce, number: accNumber, }: WalletCreationRequest): Promise<Wallet>;
/**
* Get a wallet by its id
*
* @param {number} id of the wallet to get
*
* @returns {Wallet} wallet
*/
getWallet(id: number): Promise<Wallet>;
/**
* Get a paginated list of wallets
*
* @param {number} page of the wallet to get
*
* @returns {PaginatedWallets} paginated wallets
*/
getWallets(page?: number): Promise<PaginatedWallets>;
/**
* Create a wallet for a user
* @param id of the wallet to update
* @param {WalletCreationRequest} data to update
* @param {string} [data.firstName] of the wallet owner
* @param {string} data.lastName of the wallet owner
* @param {string} [data.email] of the wallet owner
* @param {string} data.phoneNumber of the wallet owner
* @param {string} [data.country=CM] of the wallet owner
* @param {string} data.gender of the wallet owner
* @param {string} [data.nonce] unique string on each request
*/
updateWallet(id: number, { firstName, lastName, email, phoneNumber, country, gender, nonce }: WalletCreationRequest): Promise<Wallet>;
/**
* Get a wallet by its id
*
* @param {number} id of the wallet to get
*/
deleteWallet(id: number): Promise<void>;
/**
* Remove money from a wallet
* @param {number} wallet id
* @param {amount} amount to add
* @param {boolean} force to force the operation if balance is not enough
*
* @returns {WalletTransaction} transaction
*/
removeMoney(wallet: number, amount: number, force?: boolean): Promise<WalletTransaction>;
/**
* Add money to a wallet
*
* @param {number} wallet id
* @param {number} amount to add
*
* @returns {WalletTransaction} transaction
*/
addMoney(wallet: number, amount: number): Promise<WalletTransaction>;
/**
* Transfer money from a wallet to another
*
* @param {number} from wallet id
* @param {number} to wallet id
* @param {number} amount to transfer
* @param {boolean} force to force the operation if balance is not enough
*
* @returns {WalletTransaction} transaction
*/
transferMoney(from: number, to: number, amount: number, force?: boolean): Promise<WalletTransaction>;
/**
* Get a transaction
*
* @param {number} id of the transaction
*
* @returns {WalletTransaction} transaction
*/
getTransaction(id: number): Promise<WalletTransaction>;
/**
* Get a transaction
* @param page of the transaction
* @param wallet id of the wallet
*/
getTransactions(page: number, wallet?: number): Promise<PaginatedWalletTransactions>;
}