UNPKG

@motopays/pay-form

Version:

motopays ui, card payments, pay form

253 lines (248 loc) 7.5 kB
// Generated by dts-bundle-generator v9.5.1 import { CreditCardTypeCardBrandId } from 'credit-card-type/dist/types'; export type TAmountType = "gross-without-gst" | "net" | "gross"; 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 interface ITextContainer { text: Partial<Record<TLanguageCode, string>>; } export interface IUserPreferenceCheckbox extends ITextContainer { name: string; defaultValue?: boolean; } export interface IUserPreferencesSettings extends ITextContainer { checkboxes?: IUserPreferenceCheckbox[]; } export interface IChargeTermsSettings extends ITextContainer { checkboxes?: Partial<Record<TLanguageCode, string>>[]; } 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"; 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; }; 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; } 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 ISettings { isCloseButtonVisible?: boolean; isProblemTipsListVisible?: boolean; isSignatureRequired?: boolean; isHeaderVisible?: boolean; isTaxVisible?: boolean; closePaymentRedirect?: boolean; languageSettings?: ILanguageSettings; urls: IServicesUrls; components?: TComponentType[]; resultComponentsStructure?: IResultComponentsStructure; merchantInfo?: IMerchantInfoSettings; chargeTerms?: IChargeTermsSettings; userPreferences?: IUserPreferencesSettings; availableCardBrands?: CreditCardTypeCardBrandId[]; requiredFieldsBehavior?: IRequiredFieldsBehavior; events?: IEvents; apmsCollapse?: boolean; } export interface ISimple<Value = any> { [key: string]: Value; } 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; } 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; } 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<`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, }; export {};