mysterium-vpn-js
Version:
Javascript SDK for Mysterium node
78 lines (77 loc) • 2.25 kB
TypeScript
/**
* Copyright (c) 2020 BlockDev AG
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { HttpInterface } from '../http/interface';
export interface Money {
amount: number;
currency: string;
}
export interface PaymentGateway {
currencies: string[];
name: string;
orderOptions: {
minimum: number;
suggested: number[];
};
}
export interface CreatePaymentOrderRequest {
mystAmount?: string;
amountUsd?: string;
payCurrency: string;
country: string;
state?: string;
projectId?: string;
gatewayCallerData: {
country?: string;
lightningNetwork?: boolean;
};
}
export interface PaymentOrder {
id: string;
status: string;
identity: string;
gatewayName: string;
receiveMyst: string;
payAmount: string;
payCurrency: string;
country: string;
state?: string;
currency: string;
itemsSubTotal: string;
taxRate: string;
taxSubTotal: string;
orderTotal: string;
publicGatewayData?: {
secureForm?: string;
createdAt?: Date;
expireAt?: Date;
lightningNetwork?: boolean;
paymentAddress?: string;
paymentUrl?: string;
};
}
export interface RegistrationPaymentResponse {
paid: boolean;
}
export interface BeneficiaryAsyncResponse {
readonly address: string;
}
export interface BeneficiaryAsyncChangeRequest {
readonly identity: string;
readonly address: string;
}
export declare class PaymentAPI {
private http;
constructor(http: HttpInterface);
gateways(optionsCurrency?: string): Promise<PaymentGateway[]>;
createOrder(id: string, gateway: string, req: CreatePaymentOrderRequest): Promise<PaymentOrder>;
orders(id: string): Promise<PaymentOrder[]>;
order(id: string, orderId: string): Promise<PaymentOrder>;
invoice(id: string, orderId: string): Promise<any>;
registrationPayment(id: string): Promise<RegistrationPaymentResponse>;
changeBeneficiaryAsync({ identity, address, }: BeneficiaryAsyncChangeRequest): Promise<BeneficiaryAsyncResponse>;
getBeneficiaryAsync(identity: string): Promise<BeneficiaryAsyncResponse>;
}