UNPKG

@abdelrahman.rabie/payment-sdk-react-native

Version:

React Native SDK for payment processing with E_API and E_LINKS support

212 lines (211 loc) 5.58 kB
export declare enum EPaymentStatus { PENDING = "pending", PAID = "paid", EXPIRED = "expired", DECLINED = "declined", CANCELED = "canceled", FAILED = "failed" } export declare enum EPaymentProduct { E_API = "E_API", E_LINKS = "E_LINKS" } export declare enum ELanguages { AR = "ar", EN = "en" } export declare enum EPaymentMethods { KNET = "KNET", MASTERCARD = "MASTERCARD", VISA = "VISA", GOOGLE_PAY = "GOOGLE_PAY", SAMSUNG_PAY = "SAMSUNG_PAY", APPLE_PAY = "APPLE_PAY", APPLE_PAY_CREDIT = "APPLE_PAY_CREDIT", APPLE_PAY_DEBIT = "APPLE_PAY_DEBIT", CREDIT_CARD_GCC = "CREDIT_CARD_GCC", CREDIT_CARD_INTERNATIONAL = "CREDIT_CARD_INTERNATIONAL", CREDIT_CARD_LOCAL = "CREDIT_CARD_LOCAL", CREDIT_CARD = "CREDIT_CARD" } export declare enum EApplePayPaymentStatus { NOT_CAPTURED = "NOT CAPTURED", CAPTURED = "CAPTURED" } export interface IPaymentNetwork { status: string; paymentId: string; trackingId: string; referenceId: string; transactionId: string; authorizationId: string; transactionDate: string; orderId?: string; paymentMethodStatus: "CANCELED" | "DECLINED" | "CAPTURED" | "NOT_CAPTURED" | "FAILURE"; paymentMethod: EPaymentMethods; brand?: EPaymentMethods.VISA | EPaymentMethods.MASTERCARD; } export interface IAmount { value: string; currency: string; discountType: string; discountAmount: string; } export interface ICustomer { description?: string; fullName: string; phoneCode: string; phoneNumber: string; email: string; } export interface IMerchant { logoUrl: string; websiteLink: string; fullNameAr: string; fullNameEn: string; phoneNumber: string; email: string; description: string; } export interface IProduct { qty: number; image: string; price: number; nameAr: string; nameEn: string; } export interface IEAPIPaymentInfoResponse { data: { amount: IAmount; customer: ICustomer; source: { description: string; paymentMethod: EPaymentMethods | null; paymentMethodType: EPaymentMethods.VISA | EPaymentMethods.MASTERCARD | null; }; order: { description: string; ref: string; placedAt: string; products: IProduct[]; }; urls: { description: string; successUrl: string; errorUrl: string; callbackType: string; }; options: { description: string; paymentMethod: EPaymentMethods; mode: string; templateId: string; }; description: string; language?: { description: string; }; metadata?: { key1: string; key2: string; key3: string; key4: string; key5: string; }; references?: { description: string; merchantReference: string; references2: string; }; threeDSecure: boolean; saveCard: boolean; id: string; status: string; product: string; paymentNetwork: IPaymentNetwork | null; ecomReference: string; createdAt: string; expiresAt: string; paymentUrl: string; merchant: IMerchant; availablePaymentMethods: EPaymentMethods[]; }; } export interface IELINKSPaymentInfoResponse { data: { id: string; invoiceNumber: string; neverExpire: boolean; ecomReference: string; amount: IAmount; status: string; attachment: string; paymentMethod: EPaymentMethods | null; paymentMethodBrand: EPaymentMethods.VISA | EPaymentMethods.MASTERCARD | null; customer: ICustomer; merchant: IMerchant; merchantReference: string; description: string; paymentUrl: string; purposeEn: string; purposeAr: string; viewCount: number; mid: string; issuer: { id: string; role: string; email: string; fullName: string; }; notification: { sms: boolean; email: boolean; whatsapp: boolean; }; createdAt: string; expiresAt: string; paidAt: string | null; reminderSent: string | null; notes: string | null; products: IProduct[]; paymentNetwork: IPaymentNetwork | null; availablePaymentMethods: EPaymentMethods[]; }; } export interface IRequestPaymentPayload { paymentMethod: EPaymentMethods; language: ELanguages; walletPaymentData?: IApplePayResponse; } export interface IApplePayResponse { epochTimestamp: number; expiresAt: number; merchantSessionIdentifier: string; nonce: string; merchantIdentifier: string; domainName: string; displayName: string; signature: string; } export interface IApplePayPaymentResponse { data: { status: EApplePayPaymentStatus; }; } export interface IPaymentSDKConfig { baseURL: string; paymentPageApiToken: string; paymentCoreURL?: string; } export interface IPaymentRequest { paymentToken: string; product: EPaymentProduct; paymentMethod: EPaymentMethods; language?: ELanguages; walletPaymentData?: IApplePayResponse; } export interface IPaymentResult { success: boolean; data?: any; error?: string; }