@hachther/mesomb
Version:
JS client for browser to perform mobile payment operation with MeSomb
53 lines (52 loc) • 3.3 kB
TypeScript
import { AOperation } from './AOperation';
import { MoneyContributeRequest } from '../types';
import ContributionResponse from '../models/ContributionResponse';
export declare class FundraisingOperation extends AOperation {
protected service: string;
constructor({ fundKey, accessKey, secretKey, language, }: {
fundKey: string;
accessKey: string;
secretKey: string;
language?: string;
});
/**
* Collect money a user account
* [Check the documentation here](https://mesomb.hachther.com/en/api/schema/)
*
* @param {MoneyContributeRequest} params - amount to collect
* @param {'MTN' | 'ORANGE' | 'AIRTEL'} params.service - payment service with the possible values MTN, ORANGE, AIRTEL
* @param {string} params.payer - account number to collect from
* @param {string} [params.nonce] - unique string on each request
* @param {string} [params.country='CM'] - 2 letters country code of the service (configured during your service registration in MeSomb)
* @param {string} [params.currency='XAF'] - currency of your service depending on your country
* @param {string} [params.mode] - asynchronous or synchronous
* @param {boolean} [params.conversion=false] - true in case of foreign currently defined if you want to rely on MeSomb to convert the amount in the local currency
* @param {LocationRequest} [params.location] - Map containing the location of the customer with the following attributes: town, region and location all string.
* @param {boolean} [params.anonymous=false] - true if the contribution is anonymous
* @param {boolean} [params.acceptTerms=true] - true if the contributor accept the terms
* @param {Contact} [params.contact] - Contact of the contributor with the following attributes: phoneNumber string, email string. If contribution is anonymous, this field is not required
* @param {FullName} [params.fullName] - Full name of the contributor with the following attributes: firstName string, lastName string. If contribution is anonymous, this field is not required
* @param {string} [params.trxID] - if you want to include your contribution ID in the request
*
* @return TransactionResponse
*/
makeContribution({ contact, service, payer, fullName, amount, anonymous, location, acceptTerms, nonce, trxID, mode, country, currency, conversion, }: MoneyContributeRequest): Promise<ContributionResponse>;
/**
* Fetch contributions base on MeSomb IDs or external IDs
*
* @param {string[]} ids - ids of the contributions
* @param {'MESOMB' | 'EXTERNAL'} [source='MESOMB'] - origin of the ID of the contributions (MESOMB for MeSomb and EXTERNAL for your system)
*
* @return Contribution[]
*/
getContributions(ids: string[], source?: 'MESOMB' | 'EXTERNAL'): Promise<Record<string, any>[]>;
/**
* Check contributions base on MeSomb IDs or external IDs
*
* @param {string[]} ids - ids of the contributions
* @param {'MESOMB' | 'EXTERNAL'} [source='MESOMB'] - origin of the ID of the contributions (MESOMB for MeSomb and EXTERNAL for your system)
*
* @return Contribution[]
*/
checkContributions(ids: string[], source?: string): Promise<Record<string, any>[]>;
}