@tutorbot/payment-interface
Version:
Payment API Library for Tutor Platform
71 lines (70 loc) • 2.36 kB
TypeScript
import BaseInterface from './base';
import Stripe from 'stripe';
import { PaymentStatusesEnum } from '../enums/payment-statuses.enum';
export default class StripeInterface extends BaseInterface {
languages: string[];
currencies: string[];
testPayAmount: number;
credentials: {
publicKey?: string;
secretKey?: string;
};
protected apiClient: Stripe;
constructor();
protected init(): void;
protected productionConfigs(): {
publishableKey: string;
secretKey: string;
};
protected developmentConfigs(): {
publishableKey: string;
secretKey: string;
};
fetchTransactionId(queryParams: any): any;
details: () => Promise<{
redirectBackData: any;
checkoutSessionData: Stripe.Response<Stripe.Checkout.Session>;
paymentIntent: Stripe.PaymentIntent;
paymentStatus: PaymentStatusesEnum;
}>;
submit: () => Promise<{
transaction: string;
session: Stripe.Response<Stripe.Checkout.Session>;
publishableKey: any;
}>;
getOrCreateCustomer: ({ customer }: {
customer: any;
}) => Promise<any>;
getOrCreateSource: ({ card, customer }: {
card: any;
customer: any;
}) => Promise<{
isAvailable: boolean;
creditCard: Stripe.Response<Stripe.CustomerSource>;
msg?: undefined;
} | {
isAvailable: boolean;
msg: string;
creditCard?: undefined;
}>;
getCustomerSources: (customerId: any) => Promise<Stripe.CustomerSource[]>;
deleteSource: ({ cardId, customerId }: {
cardId: any;
customerId: any;
}) => Promise<Stripe.Response<Stripe.AccountDebitSource | Stripe.BankAccount | Stripe.Card | Stripe.Source | Stripe.DeletedBankAccount | Stripe.DeletedCard>>;
createSubscription: ({ amount, currency, productName, customer, recharge, interval }: {
amount: any;
currency: any;
productName: any;
customer: any;
recharge: any;
interval?: string;
}) => Promise<Stripe.Response<Stripe.Subscription>>;
updateSubscription: ({ id, recharge }: {
id: any;
recharge: any;
}) => Promise<Stripe.Response<Stripe.Subscription>>;
cancelSubscription: ({ id }: {
id: any;
}) => Promise<Stripe.Response<Stripe.Subscription>>;
}