@tutorbot/payment-interface
Version:
Payment API Library for Tutor Platform
52 lines (51 loc) • 1.37 kB
TypeScript
import { AxiosInstance } from 'axios/index';
import BaseInterface from './base';
import { PaymentStatusesEnum } from '../enums/payment-statuses.enum';
declare enum STATUSES {
CREATED = "CREATED",
SAVED = "SAVED",
APPROVED = "APPROVED",
VOIDED = "VOIDED",
COMPLETED = "COMPLETED",
PAYER_ACTION_REQUIRED = "PAYER_ACTION_REQUIRED"
}
interface PaypalOrderInterface {
id: string;
status: STATUSES;
}
export default class PaypalInterface extends BaseInterface {
languages: string[];
currencies: string[];
testPayAmount: number;
apiClient: AxiosInstance;
credentials: {
clientId?: string;
secret?: string;
};
constructor();
protected init(): Promise<void>;
protected productionConfigs(): {
baseURL: string;
clientId: string;
secret: string;
};
protected developmentConfigs(): {
baseURL: string;
clientId: string;
secret: string;
};
fetchTransactionId(queryParams: {
paymentID?: string;
}): string;
details: () => Promise<{
paymentData: PaypalOrderInterface;
redirectBackData: any;
paymentStatus: PaymentStatusesEnum;
}>;
submit: () => Promise<false | {
transaction: string;
redirect: string;
}>;
refund: (amount: number) => Promise<boolean>;
}
export {};