UNPKG

@rebilly/framepay

Version:

A wrapper to load Rebilly's FramePay library and provide TypeScript types

1,100 lines (963 loc) 34 kB
import type { coreComponents } from 'rebilly-js-sdk/types'; import EventEmitter from 'eventemitter3'; import type { reportsComponents } from 'rebilly-js-sdk/types'; import type { RiskMetadata } from '@rebilly/risk-data-collector'; export declare interface AddressData { countryCode?: string; } export declare type AllPossibleRuntimePluginReturnTypes = { leadSources?: LeadSourceResult; }; export declare class ApplePay extends PaymentMethod { #private; ApplePayMarkIcon: string; constructor(framepayInstance: FramePay, applePayValidationRequest: DigitalWalletValidationRequest); mount(target: HTMLElement | string): ApplePayElement; } export declare interface ApplePayConfig { buttonColor?: 'black' | 'white' | 'white-outline'; buttonLanguage?: string; buttonType?: 'add-money' | 'book' | 'buy' | 'check-out' | 'continue' | 'contribute' | 'donate' | 'order' | 'pay' | 'plain' | 'reload' | 'rent' | 'set-up' | 'subscribe' | 'support' | 'tip' | 'top-up'; } export declare class ApplePayElement { #private; mount(): void; unmount(): void; destroy(): void; on(eventType: string): void; } /** * Abstraction layer for the IframeElement set to become a bban account field. * Used to hide the internal implementation. */ export declare class BankElement { #private; mount(): void; unmount(): void; destroy(): void; focus(): void; on: IframeElementBusOn; } export declare interface BaseStyleDeclaration { color?: FramepayStyleValue; fontFamily?: FramepayStyleValue; fontSize?: FramepayStyleValue; fontStyle?: FramepayStyleValue; fontVariant?: FramepayStyleValue; fontStretch?: FramepayStyleValue; fontWeight?: FramepayStyleValue; fontFeatureSettings?: FramepayStyleValue; fontKerning?: FramepayStyleValue; webkitFontSmoothing?: FramepayStyleValue; mozOsxFontSmoothing?: FramepayStyleValue; letterSpacing?: FramepayStyleValue; lineHeight?: FramepayStyleValue; textDecoration?: FramepayStyleValue; textShadow?: FramepayStyleValue; textTransform?: FramepayStyleValue; textAlign?: FramepayStyleValue; textRendering?: FramepayStyleValue; } export declare class Bban extends PaymentMethod { mount(target: HTMLElement | string, fieldType: BbanFieldType): BankElement; } export declare interface BbanConfig { bicPlaceholder?: string; bankNamePlaceholder?: string; accountNumber?: string | null; routingNumber?: string | null; type?: { savings?: string | null; checking?: string | null; other?: string | null; }; } export declare type BbanFieldType = keyof BbanSourceMap; export declare type BbanSourceMap = Partial<typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.bankAccount & typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.bban>; export declare interface BillingAddressChangedEvent { billingContact: BillingContact; onBillingAddressUpdated: (newTransactionData: ShippingAddressUpdatableTransactionData) => void; } export declare type BillingAddressChangedHandler = (billingContact: BillingContact, updateTransaction: (newTransactionData: UpdateableTransactionData) => void) => void; export declare interface BillingContact { addressLines?: string[]; administrativeArea?: string; country?: string; countryCode?: string; familyName?: string; givenName?: string; locality?: string; postalCode?: string; subAdministrativeArea?: string; subLocality?: string; } export declare interface ButtonStyleConfig { base?: ButtonStyleDeclaration; focus?: ButtonStyleDeclaration; active?: ButtonStyleDeclaration; } export declare interface ButtonStyleDeclaration { background?: FramepayStyleValue; borderColor?: FramepayStyleValue; borderRadius?: FramepayStyleValue; borderStyle?: FramepayStyleValue; borderWidth?: FramepayStyleValue; color?: FramepayStyleValue; fontFamily?: FramepayStyleValue; fontFeatureSettings?: FramepayStyleValue; fontKerning?: FramepayStyleValue; fontSize?: FramepayStyleValue; fontStretch?: FramepayStyleValue; fontStyle?: FramepayStyleValue; fontVariant?: FramepayStyleValue; fontWeight?: FramepayStyleValue; letterSpacing?: FramepayStyleValue; lineHeight?: FramepayStyleValue; mozOsxFontSmoothing?: FramepayStyleValue; textAlign?: FramepayStyleValue; textDecoration?: FramepayStyleValue; textRendering?: FramepayStyleValue; textShadow?: FramepayStyleValue; textTransform?: FramepayStyleValue; webkitFontSmoothing?: FramepayStyleValue; ':hover'?: ButtonStyleDeclaration; } export declare class Card extends PaymentMethod { Brands: typeof SupportedCardBrands; mount(target: HTMLElement | string, fieldType?: FieldType, extraData?: { initialValue?: string; }): CardElement; } export declare const CARD_CVV_TYPES: { readonly password: "password"; readonly text: "text"; }; export declare const CARD_EXPIRATION_TYPES: { readonly dropdown: "dropdown"; readonly text: "text"; readonly hidden: "hidden"; }; export declare interface CardConfig { number?: { mask: string; }; expiry?: { type: CardExpirationType; }; expiration?: { type: CardExpirationType; }; cvv?: { type: CardCvvType; }; brands?: { allowed?: string[] | null; }; } export declare type CardCvvType = ValueOf<typeof CARD_CVV_TYPES>; /** * Abstraction layer for the IframeElement set to become a payment card field. * Used to hide the internal implementation. */ export declare class CardElement { #private; mount(): void; unmount(): void; /** * Focus on the card field * @param options * @param options.target - For combined card fields, specify the target field to focus on. * For example, this could be "cardNumber" or "cardCvv". */ focus(options?: { target?: string; }): void; destroy(): void; on: IframeElementBusOn; } export declare type CardExpirationType = ValueOf<typeof CARD_EXPIRATION_TYPES>; export declare interface ClassesConfig { base?: string; focus?: string; group?: string; dropdown?: string; secondary?: string; buttons?: string; webkitAutofill?: string; valid?: string; invalid?: string; input?: string; googlePay?: string; } /** * The configuration input directly provided by merchants. */ export declare interface Configuration { publishableKey?: string; applePay?: ApplePayConfig; bankAccount?: unknown; bban?: unknown; card?: CardConfig; classes?: ClassesConfig; googlePay?: GooglePayConfig; i18n?: I18nConfig; icon?: IconConfig; isParamountBankAccount?: boolean; kountAccountId?: string; locale?: string; methods?: 'auto' | ReadyToPayObject[]; organizationId?: string; paypal?: PaypalConfig; placeholders?: PlaceholdersConfig; sandbox?: boolean; style?: StyleConfig; transactionData?: TransactionData; websiteId?: string; samsungPay?: SamsungPayConfig; shadowDOMHostSelector?: string; } export declare interface ControllerTransactionData extends Omit<TransactionData, 'amount'> { amount?: string; shippingOptions?: ShippingOptionItem[] & { options?: ShippingOptionItem[]; defaultSelectedOptionId?: string; }; status?: string; details: { reason?: google.payments.api.ErrorReason; message?: string; }; } export declare type CreatedDelegate<T> = () => T | Promise<T>; export declare type DigitalWalletFieldType = typeof FIELD_TYPES.googlePay | typeof FIELD_TYPES.applePay | typeof FIELD_TYPES.plaid | typeof FIELD_TYPES.paypal | typeof FIELD_TYPES.klarna | typeof FIELD_TYPES.samsungPay; export declare class DigitalWalletValidationRequest { #private; /** * Prepare the digital wallet validation request with the provided dependencies and config. */ constructor({ type }: { type: string; }); /** * Post to the `/digital-wallets/validation` endpoint with the provided data * and return a Promise that will resolve with the response data * or reject with the error object. * @param args.sandbox - whether the request is to be triggered in sandbox mode * @returns Rebilly BE validation response */ post({ data, authorizationToken, organizationId, xsrfToken, sandbox, }: PostArgs): Promise<coreComponents['schemas']['ApplePayValidation']>; } export declare const ELEMENT_TYPES: { readonly card: "card"; readonly bban: "bban"; readonly iban: "iban"; readonly googlePay: "googlePay"; readonly secondary: "secondary"; }; export declare type ElementType = (typeof ELEMENT_TYPES)[keyof typeof ELEMENT_TYPES]; export declare type ExternalPayload = { leadSource?: Record<string, string>; }; export declare interface ExtraData { method?: string; leadSource?: { content?: string; medium?: string; source?: string; campaign?: string; affiliate?: string; }; billingAddress?: reportsComponents['schemas']['ContactObject'] & { fullName?: string; }; shippingDetails?: { address?: ApplePayJS.ApplePayPaymentContact | google.payments.api.Address; option?: ShippingOptionItem | google.payments.api.SelectionOptionData; }; enableEncryptedCVV?: boolean; [key: string]: string | object | boolean | undefined; } export declare type ExtraPayPalConfigs = Record<(typeof supportedExtraPayPalConfigs)[number], (data?: unknown) => void>; /** * Internal field name ids * each field with some unique functionality have unique id * * like "cardNumber" or "cardCvv" or "card" * cardNumber - only card number * cardCvv - only card cvv * card - combined field with cardNumber/cvv and expiration * * * To get the info about supported fields please take a look at * * This is not the api-fields, this is the UI fields, * But, the fields list based on the API (card -> number + expiration + month) * * https://rebilly.github.io/RebillyAPI/#operation/PostToken */ export declare const FIELD_TYPES: { readonly card: "card"; readonly cardNumber: "cardNumber"; readonly khelocardNumber: "khelocardNumber"; readonly cardExpiration: "cardExpiration"; readonly cardExpirationMonth: "cardExpirationMonth"; readonly cardExpirationYear: "cardExpirationYear"; readonly cardCvv: "cardCvv"; readonly bban: "bban"; readonly bbanAccountType: "bbanAccountType"; readonly bbanAccountNumber: "bbanAccountNumber"; readonly bbanRoutingNumber: "bbanRoutingNumber"; readonly bbanBic: "bbanBic"; readonly bbanBankName: "bbanBankName"; readonly iban: "iban"; readonly ibanNumber: "ibanNumber"; readonly ibanBic: "ibanBic"; readonly ibanBankName: "ibanBankName"; readonly cardExpirationMonthList: "cardExpirationMonthList"; readonly cardExpirationYearList: "cardExpirationYearList"; readonly digitalWallet: "digitalWallet"; readonly applePay: "applePay"; readonly googlePay: "googlePay"; readonly samsungPay: "samsungPay"; readonly paypal: "paypal"; readonly plaid: "plaid"; readonly klarna: "klarna"; readonly secondary: "secondary"; }; export declare type FieldError = string | FramepayError; /** * Structure defining a message sent from a field instance to its mounting element. * Used as the content of a Message sent with postMessage. */ export declare class FieldNotification { static TYPES: { readonly focus: "focus"; readonly error: "error"; readonly valid: "valid"; readonly blur: "blur"; readonly ready: "ready"; readonly autoFillStart: "auto-fill-start"; readonly autoFillCancel: "auto-fill-cancel"; }; type: FieldNotificationType; content: NotificationContent | FieldError; constructor({ type, content }: NotificationArgs); } export declare type FieldNotificationType = ValueOf<typeof FieldNotification.TYPES>; export declare type FieldType = ValueOf<typeof FIELD_TYPES>; export declare interface FieldValidationParams { form?: HTMLFormElement; from?: string; force?: boolean; source?: keyof typeof FIELD_TYPES; card?: { panType: null | string; }; } export declare class FramePay { #private; locales: Record<string, string>; version: string; initialized: boolean; errorCodes: { initialized: string; notInitialized: string; noAPIKey: string; badAPIKey: string; invalidJwt: string; multipleAuthorizationTokens: string; mountPointNotFound: string; networkError: string; alreadyMounted: string; invalidTokenForm: string; unexpectedError: string; apiError: string; nonExistingAPIKey: string; apiValidation: string; nameRequired: string; declinedBrandMessageTwoAlternatives: string; declinedBrandMessageMultipleAlternatives: string; organizationIdMissing: string; transactionDataMissing: string; merchantDataMissing: string; unsupportedCardNetwork: string; notReadyToPay: string; googlePayDisplayOptions: string; applePayDisplayOptions: string; samsungPayDisplayOptions: string; paypalDisplayOptions: string; googlePay: string; applePay: string; samsungPay: string; paypal: string; plaid: string; klarna: string; invalidCountryCode: string; invalidCurrencyCode: string; invalidPaymentCard: string; incompleteCvv: string; invalidCardNumber: string; invalidExpirationYearInPast: string; invalidExpirationYearInFuture: string; invalidExpirationMonth: string; invalidExpiration: string; unsupportedCardBin: string; unsupportedCardBrand: string; unavailableCardBrand: string; encryptedCvvNotFound: string; invalidBbanAccount: string; incompleteRoutingNumber: string; invalidLengthRoutingNumber: string; incompleteAccountNumber: string; invalidLengthAccountNumber: string; invalidMaxLengthAccountNumber: string; invalidIBANNumber: string; invalidIBANCountry: string; unsupportedIBANCountry: string; incompleteIBANNumber: string; invalidCustomerFormValues: string; invalidMethodsConfiguration: string; unservicableShippingAddress: string; invalidWebsiteId: string; }; card: Card; bban: Bban; iban: Iban; googlePay: GooglePay; applePay: ApplePay; paypal: PayPal; samsungPay: SamsungPay; plaid: Plaid; klarna: Klarna; bankAccount: Bban; /** * Initialize FramePay and inject a controller in the page. */ initialize({ publishableKey, jwt, ...configuration }?: FramepayInitializeParams): Promise<void>; /** * Trigger an update of current and future mounted element configuration. */ update(configuration?: Configuration): Promise<void>; /** * Create a token for the provided form and elements within (card, bban account, etc.). */ createToken(form: Element | object | null, { xsrfToken, ...extraData }?: { xsrfToken?: string; } & ExtraData): Promise<TokenData>; /** * Subscribe to a global event * @param eventType The event type to subscribe to * @param delegate The delegate to run when the event is fired */ on: FramepayBusOn; /** * Unsubscribe from a global event * @param eventType The event type to unsubscribe from * @param delegate The delegate to unsubscribe */ off: FramepayBusOff; /** * Whether or not there is an encrypted CVV stored for the given card details. * @param cardDetails - Object containing card details * @param cardDetails.bin - The first 6 digits of the card number * @param cardDetails.last4 The last 4 digits of the card number * @param cardDetails.expMonth The expiration month of the card * @param cardDetails.expYear The expiration year of the card * @return Returns true if there is an encrypted CVV stored, false otherwise. */ hasEncryptedCVV(cardDetails: { bin: string; last4: string; expMonth: string; expYear: string; }): Promise<boolean>; /** * Remove stored encrypted CVV for the provided card details. * @param cardDetails - Object containing card details * @param cardDetails.bin - The first 6 digits of the card number * @param cardDetails.last4 The last 4 digits of the card number * @param cardDetails.expMonth The expiration month of the card * @param cardDetails.expYear The expiration year of the card */ removeEncryptedCVV(cardDetails: { bin: string; last4: string; expMonth: string; expYear: string; }): void; /** * Remove all stored encrypted CVVs. */ removeAllEncryptedCVVs(): void; } export declare const FRAMEPAY_EVENTS: { readonly ready: "ready"; readonly error: "error"; readonly tokenReady: "token-ready"; readonly shippingAddressChanged: "shipping-address-changed"; readonly shippingOptionChanged: "shipping-option-changed"; readonly billingAddressChanged: "billing-address-changed"; readonly configurationUpdated: "configuration-updated"; }; export declare type FramepayBusOff = <T extends keyof FramepayEventMap>(event: T, fn: (...args: EventEmitter.ArgumentMap<FramepayEventMap>[T]) => void) => void; export declare type FramepayBusOn = <T extends keyof FramepayEventMap>(event: T, fn: (...args: EventEmitter.ArgumentMap<FramepayEventMap>[T]) => void) => void; export declare interface FramepayError { code: string; type?: string; message?: string; details?: string | string[]; invalidFields?: InvalidField[]; } export declare interface FramepayEventMap { [FRAMEPAY_EVENTS.configurationUpdated]: []; [FRAMEPAY_EVENTS.ready]: []; [FRAMEPAY_EVENTS.error]: [FramepayError]; [FRAMEPAY_EVENTS.tokenReady]: [TokenData, ExtraData?]; [FRAMEPAY_EVENTS.shippingAddressChanged]: Parameters<ShippingAddressChangedHandler>; [FRAMEPAY_EVENTS.shippingOptionChanged]: Parameters<ShippingOptionsChangedHandler>; [FRAMEPAY_EVENTS.billingAddressChanged]: Parameters<BillingAddressChangedHandler>; } export declare interface FramepayInitializeParams extends Configuration { publishableKey?: string; jwt?: string; } export declare type FramepayStyleValue = string | boolean | null; export declare class GooglePay extends PaymentMethod { GooglePayMarkIcon: string; mount(target: HTMLElement | string): GooglePayElement; } export declare interface GooglePayConfig { buttonColor?: google.payments.api.ButtonColor | null; buttonHeight?: string | null; buttonLocale?: string | null; buttonSizeMode?: google.payments.api.ButtonSizeMode | null; buttonType?: google.payments.api.ButtonType | null; shippingAddressRequired?: boolean; } /** * Abstraction layer for the IframeElement set to become a Google Pay field. * Used to hide the internal implementation. */ export declare class GooglePayElement { #private; mount(): void; unmount(): void; destroy(): void; on(eventType: never, _delegate: never): void; } export declare type GooglePayToken = object; export declare interface GooglePayTransactionContent { tokenData: GooglePayToken; transactionData: { amount: number; currency: string; countryCode: string; label: string; }; shipping: { address: google.payments.api.Address; option: google.payments.api.SelectionOptionData; }; email: string; } export declare interface I18nConfig { [locale: string]: { validations: Partial<I18nValidations>; }; } export declare interface I18nValidations { 'declined-brand-multiple-alternatives': string | null; 'declined-brand-two-alternatives': string | null; 'fullname-required': string | null; 'incomplete-account-number': string | null; 'incomplete-cvv': string | null; 'incomplete-iban-number': string | null; 'incomplete-routing-number': string | null; 'invalid-bban-account': string | null; 'invalid-expiration': string | null; 'invalid-expiration-month': string | null; 'invalid-expiration-year-in-future': string | null; 'invalid-expiration-year-in-past': string | null; 'invalid-iban-country': string | null; 'invalid-iban-number': string | null; 'invalid-length-account-number': string | null; 'invalid-length-routing-number': string | null; 'invalid-max-length-account-number': string | null; 'invalid-number': string | null; 'invalid-payment-card': string | null; 'unavailable-card-brand': string | null; 'unexpected-error': string | null; 'unservicable-shipping-address': string | null; 'unsupported-card-bin': string | null; 'unsupported-iban-country': string | null; } export declare class Iban extends PaymentMethod { mount(target: HTMLElement | string, fieldType?: IbanFieldType): IbanElement; } /** * Abstraction layer for the IframeElement set to become a bban account field. * Used to hide the internal implementation. */ export declare class IbanElement { #private; mount(): void; unmount(): void; destroy(): void; focus(): void; on: IframeElementBusOn; } export declare type IbanElementSourceReplaceNames = Partial<typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.iban>; export declare type IbanFieldType = keyof IbanSourceMap | 'iban'; export declare type IbanSourceMap = Partial<typeof PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP.iban>; export declare interface IconConfig { display?: boolean; color?: string; } export declare type IframeElementBusOn = <T extends keyof IframeElementEventMap>(event: T, fn: (...args: EventEmitter.ArgumentMap<IframeElementEventMap>[T]) => void) => void; export declare interface IframeElementEventMap { [FieldNotification.TYPES.ready]: []; [FieldNotification.TYPES.focus]: [{ content: string; }]; [FieldNotification.TYPES.error]: [FramepayError]; [FieldNotification.TYPES.valid]: [ { valid: boolean; source: string; completed?: boolean; } ]; [FieldNotification.TYPES.blur]: [{ content: string; }]; [FieldNotification.TYPES.autoFillStart]: []; [FieldNotification.TYPES.autoFillCancel]: []; change: [ { error?: NotificationContent | FieldError; source: string; completed?: boolean; valid?: boolean; } ]; } export declare interface InvalidField { field?: string; message: string; } export declare class Klarna extends PaymentMethod { mount(target?: HTMLElement | string): KlarnaElement; } export declare class KlarnaElement { #private; mount(): void; unmount(): void; on(eventType: never): void; static waitForKlarnaInitialization(): Promise<void>; } export declare type LeadSource = coreComponents['schemas']['LeadSource']; export declare type LeadSourceResult = { leadSource: LeadSource; }; export declare interface LineItem { label: string; amount: string; status?: string; } export declare function loadFramepay({ scriptLink, styleLink, }?: Partial<Options>): Promise<FramePay>; export declare interface NotificationArgs { type: FieldNotificationType; content?: NotificationContent | FieldError; } export declare interface NotificationContent { completed: boolean; details: string[]; message: string; } declare interface Options { scriptLink?: string; styleLink?: string; } export declare class PaymentMethod { protected parent: FramePay; protected options: PaymentMethodOptions; constructor(framePay: FramePay, options?: PaymentMethodOptions); /** * Find target HTML element */ protected static findTarget(target?: HTMLElement | string): HTMLElement; } export declare interface PaymentMethodOptions { isBankAccountOldField?: boolean; } export declare class PayPal extends PaymentMethod { mount(target?: HTMLElement | string, { extraData }?: { extraData?: ExtraPayPalConfigs; }): PayPalElement; } export declare interface PaypalConfig { buttonColor?: string; buttonHeight?: string | number; buttonShape?: string; } export declare class PayPalElement { #private; mount(): void; unmount(): void; destroy(): void; on(eventType: never, _delegate: never): void; } export declare interface PlaceholdersConfig { bban?: BbanConfig; bankAccount?: BbanConfig; card?: { number?: string | null; expiration?: string | null; cvv?: string | null; expirationSeparator?: string | null; expirationMonth?: string | null; expirationYear?: string | null; expiry?: string | null; expiryMoth?: string | null; expiryYear?: string | null; expirySeparator?: string | null; }; iban?: { bicTitle?: string | null; bicPlaceholder?: string | null; bankNameTitle?: string | null; bankNamePlaceholder?: string | null; accountNumber?: string | null; }; } export declare interface PlaceholderStyleConfig extends BaseStyleDeclaration { wordSpacing?: FramepayStyleValue; opacity?: FramepayStyleValue; content?: FramepayStyleValue; } export declare class Plaid extends PaymentMethod { mount(target: HTMLElement | string, { form, extraData }: PlaidOptions): PlaidElement; } export declare class PlaidElement { #private; mount(): void; unmount(): void; destroy(): void; on(eventType: never, _delegate: never): void; } export declare interface PlaidOptions { form: HTMLElement; extraData?: ExtraData; } export declare interface PostArgs { data: object; organizationId: string; authorizationToken: string; xsrfToken?: string; sandbox: boolean; } export declare type PostTokenData = object; export declare interface PrepareDigitalWalletPayloadArgs { transactionData?: { amount: number; currency: string; label: string; }; riskMetadata?: RiskMetadata; leadSource?: LeadSource; googlePayToken?: GooglePayToken; payPalMerchantSessionId?: string; tokenData?: PostTokenData; formData?: { billingAddress?: object; }; fieldType: DigitalWalletFieldType; } export declare const PUBLIC_FIELD_SOURCE_NAMES_REPLACE_MAP: { bankAccount: { bankAccountType: "bbanAccountType"; bankAccountNumber: "bbanAccountNumber"; bankRoutingNumber: "bbanRoutingNumber"; bic: "bbanBic"; bankName: "bbanBankName"; }; bban: { accountType: "bbanAccountType"; accountNumber: "bbanAccountNumber"; routingNumber: "bbanRoutingNumber"; bic: "bbanBic"; bankName: "bbanBankName"; }; iban: { bic: "ibanBic"; bankName: "ibanBankName"; }; digitalWallet: { applePay: "applePay"; googlePay: "googlePay"; samsungPay: "samsungPay"; }; }; export declare interface ReadyToPayObject { method: string; filters?: string[]; brands?: string[]; feature?: Record<string, string>; } export { RiskMetadata } export declare type RuntimeDelegate<T> = (externalPayload: ExternalPayload) => T | Promise<T>; export declare class SamsungPay extends PaymentMethod { mount(target: HTMLElement | string): SamsungPayElement; } export declare interface SamsungPayConfig { buttonColor?: 'white' | 'black'; } export declare class SamsungPayElement { #private; mount(): void; unmount(): void; destroy(): void; on(eventType: never, _delegate: never): void; } export declare interface SelectionStyleConfig { background?: FramepayStyleValue; backgroundColor?: FramepayStyleValue; color?: FramepayStyleValue; textShadow?: FramepayStyleValue; } export declare interface ShippingAddressChangedEvent { shippingData: AddressData; onShippingAddressUpdated: (newTransactionData: ShippingAddressUpdatableTransactionData) => void; } export declare type ShippingAddressChangedHandler = (shippingData: AddressData, updateTransaction: (newTransactionData: ShippingAddressUpdatableTransactionData) => void) => void; export declare interface ShippingAddressUpdatableTransactionData extends Partial<UpdateableTransactionData> { status: 'success' | 'fail'; shippingOptions?: ShippingOptionItem[]; } export declare interface ShippingData { id: string; label: string; description: string; amount: number; } export declare interface ShippingOptionItem { id: string; label: string; description: string; amount: number; } export declare interface ShippingOptions { defaultSelectedOptionId?: string | null; options?: ShippingOptionItem[]; shippingOptionParameters?: { defaultSelectedOptionId: string | null; shippingOptions: ShippingOptionItem[]; }; } export declare interface ShippingOptionsChangedEvent { shippingData: ShippingData; onShippingOptionUpdated: (newTransactionData: UpdateableTransactionData) => void; } export declare type ShippingOptionsChangedHandler = (shippingData: ShippingData, updateTransaction: (newTransactionData: UpdateableTransactionData) => void) => void; export declare interface ShippingUpdateShippingData { amount?: string; countryCode?: string; postalCode?: string; locality?: string; administrativeArea?: string; } export declare interface StyleConfig { base?: StyleDeclaration; focus?: StyleDeclaration; valid?: StyleDeclaration; invalid?: StyleDeclaration; buttons?: ButtonStyleConfig; } export declare interface StyleDeclaration extends BaseStyleDeclaration { ':focus'?: BaseStyleDeclaration; ':hover'?: BaseStyleDeclaration; ':disabled'?: BaseStyleDeclaration; ':webkitAutofill'?: WebskitAutofillStyleConfig; '::placeholder'?: PlaceholderStyleConfig; '::selection'?: SelectionStyleConfig; } /** * Public FramePay constant Framepay.card.Brands */ export declare const SupportedCardBrands: Record<string, string>; export declare const supportedExtraPayPalConfigs: string[]; export declare type TokenData = coreComponents['schemas']['CompositeToken'] & { id: string; paymentInstrument: coreComponents['schemas']['CompositeToken']['paymentInstrument'] & { encryptedCvv?: string; }; }; export declare class TokenRequest { /** * Post to the `/tokens` endpoint with the provided data and return a Promise * that will resolve with the response data or reject with the error object. * * @param sandbox define whether the request is to be triggered in sandbox mode */ post({ data, authorizationToken, organizationId, xsrfToken, sandbox, }: { data: TokenRequestPayload & { [key: string]: any; }; authorizationToken: string; organizationId: string; xsrfToken: string; sandbox: boolean; }): Promise<TokenData>; } export declare interface TokenRequestPayload { method?: string; paymentInstrument?: { type?: string; amount?: string; currency?: string; descriptor?: string; payload?: PostTokenData; bin?: string; last4?: string; expMonth?: string; expYear?: string; encryptedCvv?: string; cvv?: string; }; billingAddress?: reportsComponents['schemas']['ContactObject']; riskMetadata?: Partial<RiskMetadata> & { extraData?: { payPalMerchantSessionId?: string; }; }; leadSource?: LeadSource; cardExpiry?: { expMonth?: string; expYear?: string; }; enableEncryptedCVV?: boolean; } export declare interface TransactionData { amount: number | null; currency: string | null; label?: string | null; requestShipping?: boolean; shippingOptions?: ShippingOptions; lineItems?: LineItem[]; } export declare interface UpdateableTransactionData { amount: number; lineItems?: LineItem[]; } export declare type ValueOf<T> = T[keyof T]; export declare interface WebskitAutofillStyleConfig { fontSize?: FramepayStyleValue; webkitTextFillColor?: FramepayStyleValue; } export { } declare global { interface Window { Rebilly: FramePay; Framepay: FramePay; } }