mtn-open-api
Version:
A Node.js package for interacting with MTN Open API
282 lines (277 loc) • 16.2 kB
TypeScript
import { OpenAPIV3 } from 'openapi-types';
interface IHashMapGeneric<T> {
[id: string]: T;
}
declare class Client {
base_url: string;
headers: IHashMapGeneric<string>;
constructor({ schema, base_url, headers, }?: {
base_url?: string;
schema?: OpenAPIV3.Document;
headers?: IHashMapGeneric<string>;
});
makeRequest(httpMethod: string, path: string, headers: IHashMapGeneric<string>, params: IHashMapGeneric<string>): Promise<any>;
validateParameters(httpMethod: string, path: string, headers: IHashMapGeneric<string>, params: IHashMapGeneric<string>, operationDetails: OpenAPIV3.OperationObject): void;
private validateRequiredParameters;
private replacePathVariables;
}
/**
* Mtn Open Api
* Visit https://momodeveloper.mtn.com/ for documentation
*/
declare namespace MtnOpenApi {
/**
* Sandbox User Provisioning
*/
class SandboxProvisioning extends Client {
constructor({ schema, base_url, headers, }?: {
base_url?: string;
schema?: OpenAPIV3.Document;
headers?: IHashMapGeneric<string>;
});
/**
* Used to create an API user in the sandbox target environment.
*/
postV10Apiuser(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Used to create an API key for an API user in the sandbox target environment.
*/
postV10ApiuserApikey(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Used to get API user information.
*/
getV10Apiuser(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
}
/**
* Enable remote collection of bills, fees or taxes
*/
class Collection extends Client {
constructor({ schema, base_url, headers, }?: {
base_url?: string;
schema?: OpenAPIV3.Document;
headers?: IHashMapGeneric<string>;
});
/**
* Get the balance of own account.
*/
getAccountBalance(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Operation is used to check if an account holder is registered and active in the system.
*/
validateAccountHolderStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to request a payment from a consumer (Payer). The payer will be asked to authorize the payment. The transaction will be executed once the payer has authorized the payment. The requesttopay will be in status PENDING until the transaction is authorized or declined by the payer or it is timed out by the system.
Status of the transaction can be validated by using the GET /requesttopay/\<resourceId\>
*/
requesttoPay(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to get the status of a request to pay. X-Reference-Id that was passed in the post is used as reference to the request.
*/
requesttoPayTransactionStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to claim a consent by the account holder for the requested scopes.
*/
bcAuthorize(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation returns personal information of the account holder. The operation does not need any consent by the account holder.
*/
getBasicUserinfo(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to send additional Notification to an End User.
*/
requesttoPayDeliveryNotification(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Get the balance of own account. Currency parameter passed in GET
*/
getAccountBalanceInSpecificCurrency(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to request a withdrawal (cash-out) from a consumer (Payer). The payer will be asked to authorize the withdrawal. The transaction will be executed once the payer has authorized the withdrawal
*/
requestToWithdrawV1(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to request a withdrawal (cash-out) from a consumer (Payer). The payer will be asked to authorize the withdrawal. The transaction will be executed once the payer has authorized the withdrawal
*/
requestToWithdrawV2(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to get the status of a request to withdraw. X-Reference-Id that was passed in the post is used as reference to the request.
*/
requestToWithdrawTransactionStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* A merchant may use this in order to create an invoice that can be paid by an intended payer via any channel at a later stage.
*/
createInvoice(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to get the status of an invoice. X-Reference-Id that was passed in the post is used as reference to the request
*/
getInvoiceStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to delete an invoice. The ReferenceId is associated with the invoice to be cancelled
*/
cancelInvoice(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Preapproval operation is used to create a pre-approval.
*/
preApproval(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to get the status of a pre-approval. X-Reference-Id that was passed in the post is used as reference to the request.
*/
getPreApprovalStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to claim a consent by the account holder for the requested scopes.
*/
createOauth2token(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to claim a consent by the account holder for the requested scopes.
*/
getUserInfoWithConsent(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to create an access token which can then be used to authorize and authenticate towards the other end-points of the API.
*/
createAccessToken(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Making it possible to perform payments via the partner gateway. This may be used to pay for external bills or to perform air-time top-ups.
*/
createPayments(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to get the status of a Payment. X-Reference-Id that was passed in the post is used as reference to the request
*/
getPaymentStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
}
/**
* Automatically deposit funds to multiple users
*/
class Disbursement extends Client {
constructor({ schema, base_url, headers, }?: {
base_url?: string;
schema?: OpenAPIV3.Document;
headers?: IHashMapGeneric<string>;
});
/**
* Get the balance of own account.
*/
getAccountBalance(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Operation is used to check if an account holder is registered and active in the system.
*/
validateAccountHolderStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to get the status of a transfer. X-Reference-Id that was passed in the post is used as reference to the request.
*/
getTransferStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation returns personal information of the account holder. The operation does not need any consent by the account holder.
*/
getBasicUserinfo(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to claim a consent by the account holder for the requested scopes.
*/
bcAuthorize(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Get the balance of own account. Currency parameter passed in GET
*/
getAccountBalanceInSpecificCurrency(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* deposit operation is used to deposit an amount from the owner’s account to a payee account.<br> Status of the transaction can be validated by using the GET /deposit/\{referenceId\}
*/
depositV1(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* deposit operation is used to deposit an amount from the owner’s account to a payee account.<br> Status of the transaction can be validated by using the GET /deposit/\{referenceId\}
*/
depositV2(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to get the status of a deposit. X-Reference-Id that was passed in the post is used as reference to the request.
*/
getDepositStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* refund operation is used to refund an amount from the owner’s account to a payee account.<br> Status of the transaction can be validated by using the GET /refund/\{referenceId\}
*/
refundV1(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* refund operation is used to refund an amount from the owner’s account to a payee account.<br> Status of the transaction can be validated by using the GET /refund/\{referenceId\}
*/
refundV2(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to get the status of a refund. X-Reference-Id that was passed in the post is used as reference to the request.
*/
getRefundStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to claim a consent by the account holder for the requested scopes.
*/
createOauth2token(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to claim a consent by the account holder for the requested scopes.
*/
getUserInfoWithConsent(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to create an access token which can then be used to authorize and authenticate towards the other end-points of the API.
*/
createAccessToken(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Transfer operation is used to transfer an amount from the own account to a payee account.<br> Status of the transaction can validated by using the GET /transfer/\{referenceId\}
*/
transfer(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
}
/**
* Remit funds to local recipients from the diaspora with ease
*/
class Remittance extends Client {
constructor({ schema, base_url, headers, }?: {
base_url?: string;
schema?: OpenAPIV3.Document;
headers?: IHashMapGeneric<string>;
});
/**
* Get the balance of own account.
*/
getAccountBalance(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Operation is used to check if an account holder is registered and active in the system.
*/
validateAccountHolderStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Transfer operation is used to transfer an amount from the own account to a payee account.<br> Status of the transaction can validated by using the GET /transfer/\{referenceId\}
*/
transfer(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to get the status of a transfer. X-Reference-Id that was passed in the post is used as reference to the request.
*/
getTransferStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation returns personal information of the account holder. The operation does not need any consent by the account holder.
*/
getBasicUserinfo(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to claim a consent by the account holder for the requested scopes.
*/
bcAuthorize(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Get the balance of own account. Currency parameter passed in GET
*/
getAccountBalanceInSpecificCurrency(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to claim a consent by the account holder for the requested scopes.
*/
createOauth2token(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to claim a consent by the account holder for the requested scopes.
*/
getUserInfoWithConsent(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to create an access token which can then be used to authorize and authenticate towards the other end-points of the API.
*/
createAccessToken(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* Cash transfer operation is used to transfer an amount from the owner’s account to a payee account. Status of the transaction can be validated by using GET /cashtransfer/{referenceId}
*/
cashTransfer(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
/**
* This operation is used to get the status of a transfer. X-Reference-Id that was passed in the post is used as reference to the request.
*/
getCashTransferStatus(params?: IHashMapGeneric<string>, headers?: IHashMapGeneric<string>): Promise<any>;
}
}
declare const SandboxProvisioning: typeof MtnOpenApi.SandboxProvisioning;
declare const Collection: typeof MtnOpenApi.Collection;
declare const Disbursement: typeof MtnOpenApi.Disbursement;
declare const Remittance: typeof MtnOpenApi.Remittance;
export { Collection, Disbursement, Remittance, SandboxProvisioning, MtnOpenApi as default };