@motopays/pay-form
Version:
motopays ui, card payments, pay form 2.6.6
362 lines (357 loc) • 10.2 kB
TypeScript
// Generated by dts-bundle-generator v9.5.1
import { CreditCardTypeCardBrandId } from 'credit-card-type/dist/types';
export type TOrderType = "regular" | "free-trial" | "gems";
export type TPaymentInitiator = "customer" | "merchant";
export type TButtonStateUntilFilled = "enabled" | "disabled" | "hidden-enabled";
export type TLanguageCode = "en-US" | "es-ES" | "fr-FR" | string;
export type TPaymentFlow = "default" | "invoice-overridden" | "payment-overridden";
export interface ITextContainer {
text: Partial<Record<TLanguageCode, string>>;
}
export interface IUserPreferenceCheckbox extends ITextContainer {
name: string;
defaultValue?: boolean;
}
export type TCheckboxShape = "circle" | "square";
export interface IUserPreferencesSettings extends ITextContainer {
checkboxes?: IUserPreferenceCheckbox[];
shape?: TCheckboxShape;
}
export interface IChargeTermsSettings extends ITextContainer {
checkboxes?: Partial<Record<TLanguageCode, string>>[];
shape?: TCheckboxShape;
}
export interface ILink extends ITextContainer {
href: string;
}
export interface IMerchantInfoSettings extends ITextContainer {
links?: ILink[];
}
export interface IServicesUrls {
processing: string;
billingProfiles: string;
}
export interface IRequiredFieldsBehavior {
showStars?: boolean;
markAsInvalidUntilCorrect?: boolean;
buttonStateUntilFilled?: TButtonStateUntilFilled;
}
export type TComponentType = "available-card-brands" | "card-list" | "requisites" | "phone-number" | "charge-terms" | "pay-button" | "apm-list" | "user-preferences" | "merchant-info" | "protected-by" | "no-methods" | "master";
export type TSecurityCodeLabel = "CVV" | "CVC" | "CID" | "CVN" | "CVE" | "CVP2";
export interface ISecurityCodeLabels extends Record<TSecurityCodeLabel, string> {
}
export interface ILanguage {
header: string;
errors: {
notCheckedCheckboxes: string;
invalidCardHolder: string;
invalidCardNumber: string;
invalidCardExpiration: string;
invalidCvv: string;
invalidPhoneNumber: string;
};
requisites: {
paymentDetailsHeader: string;
cardNumberPlaceholder: string;
cardExpirationPlaceholder: string;
cvvPlaceholder?: ISecurityCodeLabels;
cvvHint: string;
cardHolderHeader: string;
cardHolderPlaceholder: string;
};
phone: {
header: string;
placeholder: string;
};
apms: {
orUseAlternative: string;
or: string;
};
totalHeader: string;
pay: string;
taxDescription?: string;
availableCardBrandsHeader: string;
transactionProtectedBy: string;
existingCards: {
manageCardsHeader: string;
addNewCard: string;
removeCard: string;
confirmRemoveCard: string;
cancel: string;
verifyCardCodeLabel?: string;
};
paymentResult: {
success: string;
failure: {
main: string;
paymentFailed: string;
};
};
noAvailablePaymentMethods: string;
paymentProcessing: string;
notifications: {
cardDeleted: {
title: string;
text: string;
};
error: {
default: {
title: string;
text: string;
};
};
};
close: string;
master: {
selectAll: string;
};
confirmPayment: string;
}
export interface ILanguageSettings {
code: TLanguageCode;
languages?: Partial<Record<TLanguageCode, ILanguage>>;
}
export interface IResultComponentsStructure {
aboveResult: TComponentType[];
belowResult: TComponentType[];
}
export interface IEvents {
analytics: {
optional: boolean;
required: boolean;
};
error: boolean;
}
export interface IPaymentFlowSettings {
tokenizeCard?: boolean;
type?: TPaymentFlow;
}
export interface IMasterSettings extends ITextContainer {
shape?: TCheckboxShape;
}
export interface IGooglePayIntegratorSettings {
button?: Omit<google.payments.api.ButtonOptions, "onClick" | "allowedPaymentMethods">;
allowedAuthMethods?: google.payments.api.CardAuthMethod[];
}
export interface ISettings {
isCloseButtonVisible?: boolean;
isProblemTipsListVisible?: boolean;
isSignatureRequired?: boolean;
isHeaderVisible?: boolean;
isTaxVisible?: boolean;
closePaymentRedirect?: boolean;
languageSettings?: ILanguageSettings;
urls: IServicesUrls;
components?: TComponentType[];
resultComponentsStructure?: IResultComponentsStructure;
master?: IMasterSettings;
merchantInfo?: IMerchantInfoSettings;
chargeTerms?: IChargeTermsSettings;
userPreferences?: IUserPreferencesSettings;
availableCardBrands?: CreditCardTypeCardBrandId[];
requiredFieldsBehavior?: IRequiredFieldsBehavior;
events?: IEvents;
apmsCollapse?: boolean;
paymentFlow?: IPaymentFlowSettings;
googlePay?: IGooglePayIntegratorSettings;
}
export interface ISimple<Value = any> {
[key: string]: Value;
}
export type TAmountType = "gross-without-gst" | "net" | "gross";
export interface IBillingAddress {
addressLine: string;
city: string;
state: string;
country: string;
zip: string;
}
export interface IPaymentSettings {
userAuthToken?: string;
userId: string;
paymentId: string;
amount: number;
amountType?: TAmountType;
tax?: number;
orderType?: TOrderType;
currency: string;
merchantId: string;
initiator?: TPaymentInitiator;
webhookUrl?: string;
returnUrl?: string;
description?: string;
email: string;
details?: ISimple<any>;
phoneNumber?: string;
ipAddress?: string;
signature?: string;
billingAddress?: IBillingAddress;
}
declare enum ChallengeWindowSizeType {
SMALL = 1,
MEDIUM = 2,
LARGE = 3,
EXTRA_LARGE = 4,
FULL_SCREEN = 5
}
export interface IBrowserInfo {
timezoneOffsetUtcMinutes: number;
locale: string;
userAgent: string;
javaEnabled: boolean;
javaScriptEnabled: boolean;
colorDepth: number;
height: number;
width: number;
challengeWindowSize: ChallengeWindowSizeType;
}
export interface IDeviceInfo {
id?: string;
fonts?: string[];
networkParameters?: string;
batteryLevelAndChargingStatus?: string;
browserData: IBrowserInfo;
}
export interface IRedirectData {
location: string;
}
export interface IThreeDsData {
paReq: string;
acsurl: string;
termUrl: string;
md: string;
}
export interface IAction {
name: string;
data: IThreeDsData | IRedirectData | any;
}
export interface IOrder {
invoiceId: string;
details: string;
}
export type TPaymentState = "completed" | "rejected" | "needAction";
export interface IPaymentInfo {
completeProcessingTime?: Date;
currency: string;
paymentType: string;
paymentSystem: string;
paymentRequisites?: string;
price: number;
}
export interface IRejectionDetails {
hardDecline: boolean;
message?: string;
problemSolvingTips: string[];
rejectionCode: number;
}
export interface IPayment {
paymentId: string;
state: TPaymentState;
rebillAnchor: string;
info: IPaymentInfo;
rejectionDetails?: IRejectionDetails;
}
export interface ITaxInfo {
abbreviation: string;
price: number;
priceNet: number;
tax: number;
}
export interface IUser {
id: string;
}
export interface IPaymentResponse {
ip: string;
merchant: string;
action?: IAction;
order: IOrder;
payment: IPayment;
taxInfo: ITaxInfo;
user: IUser;
signature?: string;
}
interface IBillingAddress$1 {
addressLine: string;
city: string;
state: string;
country: string;
zip: string;
}
type TAmountType$1 = "GrossWithoutGst" | "Net" | "Gross";
type TOrderType$1 = "Regular" | "FreeTrial" | "Gems";
interface IOrder$1 {
amount?: number;
amountType?: TAmountType$1;
currency: string;
description?: string;
details?: string;
type?: TOrderType$1;
tax?: number;
}
export interface IPayer {
id: string;
email: string;
phoneNumber?: string;
ipAddress?: string;
deviceInfo: IDeviceInfo;
billingAddress?: IBillingAddress$1;
}
type TPaymentInitiator$1 = "Customer" | "Merchant";
export interface IRejectionPreferences {
showResolvingTips: boolean;
}
export interface IRequisites {
anchor: string;
cardHolder: string;
cardNumber: string;
cvv: string;
expiration: string;
paymentToken: string;
type: string;
}
export interface IPaymentRequest {
id: string;
initiator?: TPaymentInitiator$1;
returnUrl?: string;
webhookUrl?: string;
order: IOrder$1;
payer: IPayer;
requisites: IRequisites;
signature?: string;
rejectionPreferences: IRejectionPreferences;
}
export interface IInvoiceRequest {
invoice: string;
ei?: 1 | 2;
es?: {
uo?: boolean;
};
}
declare class ServiceAction<Type extends string, Payload = unknown | undefined> {
type: Type;
payload?: Payload | undefined;
constructor(type: Type, payload?: Payload | undefined);
}
export interface ICardAnalytics {
last4Digits: string;
}
export interface ICardListAnalytics {
toggle: boolean;
}
export interface IChargeTermsAnalytics {
text: string;
}
export interface IUserPreferencesAnalytics {
name: string;
text: string;
}
export type TAnalyticsServiceAction = ServiceAction<"init-start"> | ServiceAction<"loading-finish"> | ServiceAction<"card-number-field-focus"> | ServiceAction<"expiration-date-field-focus"> | ServiceAction<"cvv-field-focus"> | ServiceAction<"card-holder-field-focus"> | ServiceAction<"number-field-focus"> | ServiceAction<"master-click"> | ServiceAction<"master-focus"> | ServiceAction<`charge-term-checkbox${`-${number}`}-focus`, IChargeTermsAnalytics> | ServiceAction<`charge-term-checkbox${`-${number}`}-check`, IChargeTermsAnalytics> | ServiceAction<`charge-term-checkbox${`-${number}`}-uncheck`, IChargeTermsAnalytics> | ServiceAction<`user-preference-checkbox${`-${number}`}-focus`, IUserPreferencesAnalytics> | ServiceAction<`user-preference-checkbox${`-${number}`}-check`, IUserPreferencesAnalytics> | ServiceAction<`user-preference-checkbox${`-${number}`}-uncheck`, IUserPreferencesAnalytics> | ServiceAction<"pay-button-focus"> | ServiceAction<"pay-button-click"> | ServiceAction<`${string}-button-focus`> | ServiceAction<`${string}-button-click`> | ServiceAction<"add-card-button-focus"> | ServiceAction<"add-card-button-click"> | ServiceAction<"card-options-button-click", ICardAnalytics> | ServiceAction<"cards-toggle-button-click", ICardListAnalytics> | ServiceAction<"remove-card-button-click", ICardAnalytics> | ServiceAction<"select-card-button-click", ICardAnalytics> | ServiceAction<"apms-show-button-click", ICardAnalytics>;
export interface IApmsShowAnalytics {
show: boolean;
}
export {
CreditCardTypeCardBrandId,
IBillingAddress$1 as IBillingAddressRequest,
IOrder$1 as IOrderRequest,
};
export {};