///
///
declare global {
interface Window {
google: typeof google;
ApplePaySession: typeof ApplePaySession;
}
// HostedForm comes from the HPF script we load. API reference is here: https://network.gateway.mastercard.com/api/documentation/apiDocumentation/session/version/74/hs-function/api/documentation/integrationGuidelines/hostedPaymentForm/HPFJS/paymentFormFieldsReference.html?locale=en_US
interface SessionDetails {
cardNumber?: string;
cardSecurityCode?: string;
cardExpiryMonth: string;
cardExpiryYear: string;
}
type FieldInErrorValue = 'invalid' | 'missing';
interface CreateUpdateSessionResponse {
status: string;
session: string;
cardBrand: string;
cardScheme: string;
cardFundingMethod: string;
cardLocalBrand: string;
fieldsInError: {
cardNumber: FieldInErrorValue;
cardSecurityCode: FieldInErrorValue;
cardExpiryMonth: FieldInErrorValue;
cardExpiryYear: FieldInErrorValue;
};
}
interface HostedForm {
callback(): void;
createSession(
sessionDetails: SessionDetails,
createSessionCallback: (createSessionResponse: CreateUpdateSessionResponse) => void
): void;
setMerchant(merchantId: string): void;
showVisaCheckout(
sessionId?: string,
options: {
acceptedCards: 'MASTERCARD' | 'AMEX' | 'DISCOVER' | 'VISA';
paymentConfirmation: 'CONFIRM_AT_PROVIDER' | 'CONFIRM_AT_MERCHANT';
paymentConfirmationMessage: string;
merchant: {
logo: URL;
displayName: string;
};
locale: string;
country: 'AUS';
order: {
amount: number;
currency: 'AUD';
};
},
callback: () => void
): void;
updateSession(
sessionId: string,
sessionDetails: SessionDetails,
updateSessionCallback: (updateSessionResponse: CreateUpdateSessionResponse) => void
): void;
}
const HostedForm: HostedForm;
}
export {};