UNPKG

gamemoney-frorff

Version:
271 lines (270 loc) 7.94 kB
/// <reference types="node" /> import { TSignType, IResponse } from './request'; import { SignPrivateKeyInput } from 'crypto'; export interface IConfig { privateKey?: SignPrivateKeyInput; hmacKey: string; project: number; } export interface ICreateInvoiceRequest { type: string; user: number; ip: string; amount: number; comment: string; success_url?: string; fail_url?: string; wallet: string; project_invoice?: number | string; currency?: string; user_currency?: string; language?: string; [index: string]: any; } export interface ICreateInvoiceResponse extends IResponse { invoice: number; type: 'message' | 'redirect' | 'error'; data: string; } export interface IGetInvoiceStatusRequestWithProjectInvoiceID { invoice: number; } export interface IGetInvoiceStatusRequestWithGamemoneyInvoiceID { project_invoice: string; } export declare type IGetInvoiceStatusRequest = IGetInvoiceStatusRequestWithProjectInvoiceID | IGetInvoiceStatusRequestWithGamemoneyInvoiceID; export interface IGetInvoiceStatusResponse extends IResponse { project: string; invoice: string; status: string; amount: string; net_amount: string; recieved_amount: string; user: string; type: string; wallet: string; project_invoice: string; currency_project: string; currency_user: string; date_create: string; date_pay: string; rate: string; } export interface IGetInvoiceListRequest { start: string; finish: string; [index: string]: any; } export interface IGetInvoiceListResponse extends IResponse { list: IGetInvoiceStatusResponse[]; is_limit_exceeded: 'yes' | 'no'; } export interface ICancelCheckoutRequest { projectId: number | string; [index: string]: any; } export interface IGetCheckoutStatusRequest { projectId: number | string; [index: string]: any; } export interface IRefund { id: string; amount: string; net_amount: string; paid_amount: string; comment: string; } export interface IGetCheckoutStatusResponse extends IResponse { id: string; project: string; projectId: string; amount: number; net_amount: number; paid_amount: number; status: string; user: string; wallet: string; description: string; comment: string; redirect_url: string; type: string; currency_project: string; currency_user: string; date_create: string; rate: string; refunds: IRefund[]; } export interface IGetCheckoutListRequest { start: string; finish: string; [index: string]: any; } export interface IGetCheckoutListResponse extends IResponse { list: IGetCheckoutStatusResponse[]; } export interface ICreateCheckoutRequest { projectId: number | string; user: number; ip: string; amount: number | string; wallet: string; description: string; type: string; currency?: string; userCurrency?: string; [index: string]: any; } export interface IAddCardRequest { user: number; redirect: string; [index: string]: any; } export interface IAddCardResponse extends IResponse { url: string; } export interface IGetCardListRequest { user: number; [index: string]: any; } export interface IGetCardListResponse extends IResponse { pans: string[]; } export interface IDeleteCardRequest { user: number; pan: string; [index: string]: any; } export interface IPrepareExchangeRequest { minAmount: number; maxAmount: number; from: string; to: string; livetime?: number; [index: string]: any; } export interface IPrepareExchangeResponse extends IResponse { id: string; rate: string; exchanged_amount_from: string; exchanged_amount_to: string; } export interface IConvertExchangeRequest { id: number; amount: number; [index: string]: any; } export interface IFastConvertExchangeRequest { amount: number; from: string; to: string; [index: string]: any; } export interface IFastConvertExchangeResponse extends IResponse { id: string; rate: string; } export interface IGetExchangeInfoRequest { minAmount: number; maxAmount: number; from: string; to: string; livetime?: number; } export interface IGetExchangeRateRequest { from: string; to: string; } export interface IGetExchangeInfoResponse extends IResponse { rate: string; exchanged_amount_from: string; exchanged_amount_to: string; } export interface IGetExchangeRateResponse extends IResponse { buy: number; sell: number; } export interface IGetExchangeStatusRequest { id?: number; externalId?: string; } export interface IGetExchangeStatusResponse extends IResponse { id: string; from: string; to: string; rate: string; amount_from: string; amount_to: string; status: string; } export interface IGetBalanceStatisticsRequest { currency: string; [index: string]: any; } export interface IGetBalanceStatisticsResponse extends IResponse { project: string; currency: string; project_income: string; project_outcome: string; project_balance: string; contract_income: string; contract_outcome: string; contract_balance: string; } export interface IGetDaysBalanceStatisticsRequest { currency: string; start: string; finish: string; [index: string]: any; } export interface IDaysBalance { date: string; income: string; outcome: string; } export interface IGetDaysBalanceStatisticsResponse extends IResponse { project: string; currency: string; days_balance: IDaysBalance[]; } export interface IPaySystem { type: string; fee: string; fixed_fee: string; currency: string; } export interface IGetPayTypesStatisticsResponse extends IResponse { project: string; invoice: IPaySystem[]; checkout: IPaySystem[]; } export interface ICreateTerminalResponse extends IResponse { url: string; } export declare class GameMoney { request: any; private config; constructor(config: IConfig); send(url: string, body?: any, signType?: TSignType): Promise<any>; generateHmacSignature(body: any): string; createInvoice(body: ICreateInvoiceRequest): Promise<ICreateInvoiceResponse>; getInvoiceStatus(body: IGetInvoiceStatusRequest): Promise<IGetInvoiceStatusResponse>; getInvoiceList(body: IGetInvoiceListRequest): Promise<IGetInvoiceListResponse>; createCheckout(body: ICreateCheckoutRequest): Promise<IResponse>; cancelCheckout(body: ICancelCheckoutRequest): Promise<IResponse>; getCheckoutStatus(body: IGetCheckoutStatusRequest): Promise<IGetCheckoutStatusResponse>; getCheckoutList(body: IGetCheckoutListRequest): Promise<IGetCheckoutListResponse>; addCard(body: IAddCardRequest): Promise<IAddCardResponse>; getCardList(body: IGetCardListRequest): Promise<IGetCardListResponse>; deleteCard(body: IDeleteCardRequest): Promise<IResponse>; prepareExchange(body: IPrepareExchangeRequest): Promise<IPrepareExchangeResponse>; convertExchange(body: IConvertExchangeRequest): Promise<IResponse>; fastConvertExchange(body: IFastConvertExchangeRequest): Promise<IFastConvertExchangeResponse>; getExchangeInfo(body: IGetExchangeInfoRequest): Promise<IGetExchangeInfoResponse>; getExchangeRate(body: IGetExchangeRateRequest): Promise<IGetExchangeRateResponse>; getExchangeStatus(body: IGetExchangeStatusRequest): Promise<IGetExchangeStatusResponse>; getBalanceStatistics(body: IGetBalanceStatisticsRequest): Promise<IGetBalanceStatisticsResponse>; getDaysBalanceStatistics(body: IGetDaysBalanceStatisticsRequest): Promise<IGetDaysBalanceStatisticsResponse>; getPayTypesStatistics(): Promise<IGetPayTypesStatisticsResponse>; createTerminal(body: ICreateInvoiceRequest): Promise<ICreateTerminalResponse>; } export { verifyRsaSignature } from './utils';