@chargx/sdk
Version:
SDK for ChargX payment provider
98 lines (97 loc) • 2.28 kB
TypeScript
declare global {
interface Window {
Accept?: {
dispatchData: (options: any, callback: (response: DispatchDataResponse) => void) => void;
};
}
}
declare global {
interface Window {
Chargx?: {
dispatchData: (options: any, callback: (response: DispatchDataResponse) => void) => void;
};
}
}
export type OpaqueData = {
dataDescriptor: string;
dataValue: string;
};
export type AuthData = {
clientKey: string;
apiLoginID: string;
};
export type PretransactResponse = {
authData: AuthData;
isProduction: boolean;
};
export type CardData = {
cardNumber: string;
cardCode: string;
month: string;
year: string;
};
export interface BankData {
routingNumber: string;
accountNumber: string;
nameOnAccount: string;
accountType: "checking" | "savings";
echeckType: "WEB" | "TEL" | "CCD" | "PPD";
}
export type AuthNetEnvironment = "SANDBOX" | "PRODUCTION";
export type PaymentDataWithCard = {
cardData: CardData;
bankData?: undefined;
};
export type PaymentDataWithBank = {
cardData?: undefined;
bankData: BankData;
};
export type PaymentData = PaymentDataWithCard | PaymentDataWithBank;
export type SecureData = {
authData: AuthData;
} & PaymentData;
export type ErrorMessage = {
code: string;
text: string;
};
export type DispatchDataResponse = {
opaqueData: {
dataDescriptor: string;
dataValue: string;
};
messages: {
resultCode: "Ok" | "Error";
message: ErrorMessage[];
};
};
export type CheckCustomerLoyaltyPointsInput = {
email?: string;
cardHash?: string;
};
export type CustomerLoyaltyPoints = {
customerId: string;
loyaltyPoints: number;
};
export type TransactPayloadBillingAddress = {
street: string;
unit?: string;
city: string;
state?: string;
zipCode: string;
countryCode: string;
phone?: string;
};
export type TransactPayload = {
currency: string;
amount: string;
type: string;
opaqueData: OpaqueData;
customer?: {
name?: string;
email?: string;
phone?: string;
};
deductLoyaltyPoints?: string;
cardNumber?: string;
billingAddress?: TransactPayloadBillingAddress;
};