zinari-pay
Version:
zinari-pay is a comprehensive package for integrating ZinariPays cryptocurrency payment gateway into web & mobile applications.
156 lines (155 loc) • 4.94 kB
TypeScript
import { AppMode, AppTransactionStatus, CryptoCurrency, Currency, TransactionType } from "./index.enums";
import { JSX } from "preact";
export interface ZinariPayConfig {
appId: string;
apiKey: string;
publicKey: string;
log?: boolean;
}
export interface AppProps {
onCreateTransaction: (values: {
cryptocurrency: CryptoCurrency;
notificationEmailAddress?: string;
}) => Promise<TransactionStatusResponse>;
onGetTransactionStatus: (id: string) => Promise<TransactionStatusResponse>;
onInitiateTransaction: (transactionData?: InitiateTransactionData, remount?: boolean) => Promise<void>;
onSetNotificationEmail: (email: string) => void;
showNotificationRequest?: boolean;
closeOnCompleted: boolean;
isLoadingAppInfo: boolean;
amount: number;
appError?: string;
clientNotificationEmailAddress?: string;
appInfo?: AppInfo;
onUnmount: () => void;
onMarkAsPaid: (transactionId: string) => Promise<void>;
clientOnConfirmed?: (values?: any) => void;
clientDetails: any;
}
export interface InitiateTransactionData {
amount: number;
details?: any;
amountPlusFees?: any;
closeOnCompleted?: boolean;
notificationEmailAddress?: string;
payLinkId?: string;
onConfirmed?: (values?: any) => void;
onSuccess?: (values?: any) => void;
onFailure?: (values?: any) => void;
onIncomplete?: (values?: any) => void;
onExcess?: (values?: any) => void;
onCancel?: (values?: any) => void;
}
export interface OngoingTransactionProps {
isLoading?: boolean;
isLoadingAppInfo?: boolean;
showNotificationRequest?: boolean;
onSetNotificationEmail: (email: string) => void;
onInitiateTransaction: (transactionData?: InitiateTransactionData, remount?: boolean) => Promise<void>;
clientNotificationEmailAddress?: string;
clientOnConfirmed?: (values?: any) => void;
clientDetails: any;
appInfo?: AppInfo;
closeOnCompleted: boolean;
amount: number;
appError?: string;
onRetryAppLoad: () => void;
onMarkAsPaid: (transactionId: string) => Promise<void>;
onCreateTransaction: (values: {
isCompletion?: boolean;
cryptocurrency: CryptoCurrency;
notificationEmailAddress?: string;
}) => Promise<TransactionStatusResponse>;
onGetTransactionStatus: (id: string) => Promise<TransactionStatusResponse>;
onCloseModal: () => void;
}
export interface ButtonProps {
isLoading?: boolean;
disabled?: boolean;
id?: string;
className?: string;
onClick?: () => void;
children?: preact.ComponentChildren;
style?: any;
}
export interface ModalProps {
open: boolean;
inDevMode: boolean;
amount: number;
logoUrl?: string;
currency?: string;
notificationEmailAddress?: string;
hideCloseIcon?: boolean;
onClose?: () => void;
children: JSX.Element | JSX.Element[];
}
export interface TransactionFormProps {
appName: string;
fiatCurrency: string;
amount: number;
transactionDetails?: TransactionStatusResponse;
selectedCoin?: CryptoCurrency;
onMakePayment: (coin: CryptoCurrency) => Promise<void>;
onExitModal: () => void;
onMarkAsPaid: (transactionId: string) => Promise<void>;
appCurrencies?: CryptoCurrency[];
onComplete: () => void;
onCompletePayment: (coin: CryptoCurrency) => Promise<void>;
}
export interface CurrencySelectorProps {
appName?: string;
disabled: boolean;
appCurrencies?: CryptoCurrency[];
onSetSelectedCoin: (selectedCoin: CryptoCurrency) => void;
}
export interface AppInfo {
name: string;
mode: AppMode;
logoUrl?: string;
taxRate: number;
feeRate: number;
fiatCurrency: Currency;
customerPaysTax: boolean;
customerPaysFees: boolean;
appCurrencies: CryptoCurrency[];
}
export interface CompanyDetailsProps {
companyLogoUrl?: string;
customerPaysTax?: boolean;
customerPaysFees?: boolean;
fiatTax?: number;
fiatFee?: number;
cryptocurrencyTax?: number;
exchangeRate?: number;
cryptocurrencyFee?: number;
type?: TransactionType;
appName?: string;
fiatCurrency: string;
cryptocurrency?: string;
amount: number;
amountReceived?: number;
cryptocurrencyAmount?: number;
transactionStatus?: AppTransactionStatus;
}
export interface TransactionStatusResponse {
id: string;
address: string;
currency: string;
status: AppTransactionStatus;
cryptocurrencyAmount: number;
blockchainConfirmations: number;
fiatTax: number;
fiatFee: number;
cryptocurrencyTax: number;
exchangeRate: number;
cryptocurrencyFee: number;
type?: TransactionType;
details?: any;
fiatAmount?: number;
fiatCurrency?: Currency;
amountReceived?: number;
webhookUrlCalled?: boolean;
markedAsPaid: boolean;
cryptocurrency?: CryptoCurrency;
blockchainTransactionId?: string;
}