UNPKG

@arc-publishing/sdk-sales

Version:
159 lines (158 loc) 4.38 kB
import { APIErrorResponse } from '@arc-publishing/sdk-subs-core/lib/utils/APIErrorResponse'; import { Address } from '@arc-publishing/sdk-subs-core/lib/types/address'; import { PaymentMethod } from './subscription'; type OrderType = 'Parent' | 'Renewal'; type OrderStatus = '1' | '2' | '3' | '4' | 'Pending' | 'PartiallyPaid' | 'Paid' | 'Cancelled'; export interface Order { orderNumber?: string; } export interface CreateOrderResponse extends Order { email: string; phone: string; firstName?: string | null; lastName?: string | null; secondLastName?: string | null; total: number; subtotal: number; tax: number; shipping: number; items: Array<CartItem>; currency: string; status: OrderStatus; subscriptionIDs: string | null; orderDateUTC: string | null; } export interface OrderDetails extends Order { email: string; orderType: OrderType; phone: string; status: string; subtotal: number; total: number; totalTax: number; shipping: number; items: Array<CartItem>; payments: Array<OrderPayment> | null; billingAddress: Address; shippingAddress: Address | null; subscriptionIDs: Array<number>; currency: string; firstName: string | null; lastName: string | null; secondLastName: string | null; orderDate: number; orderID: number; clientID: string; } export interface OrderHistoryEntry extends Order { orderDate: number; orderType: OrderType; orderStatus: OrderStatus; totalAmount: number; tax: number; currency: string; products: Array<Product>; paymentGateway: string; lastFour: string; nameOnPayment: string | null; creditCardBrand: string; } interface Product { sku: string; name: string; quantity: number; } export interface PaginatedOrders { start: number; pageSize: number; maxResults: number; orders: Array<OrderHistoryEntry>; } export interface Cart { currency: string; items: Array<CartItem>; shipping: number; subtotal: number; tax: number; total: number; } export interface CartItem { sku: string; quantity: number; shortDescription?: string | null; name: string; price: number; tax: number; subtotal: number; total: number; priceCode: string; } export interface OrderPayment { amount: number; paymentID: number; paymentMethod: PaymentMethod; financialTransactions: Array<FinancialTransaction>; remainingAmountToRefund: number; } export interface FinancialTransaction { amount: number; tax: number; subtotal: number; transactionType: string; transactionDate: number; billingAddress: Address; } export interface PaymentProviderDetails { paymentMethodType: number; paymentMethodID: number; validationCurrency?: string; validationAmount?: number; } export interface InitializePaymentOptions { applePayValidationUrl?: string; } export interface FinalizePaymentOptions { email?: string; address?: Address; phone?: string; browserInfo?: string; firstName?: string; lastName?: string; } export interface FinalizePaymentOptionsPayU { paymentMethod?: string; identificationNumber?: string; payerId?: string; cardHolderName?: string; firstSix?: string; lastFour?: string; } export interface InitializedPayment { orderNumber: string; parameter1?: string | null; parameter2?: string | null; parameter3?: string | null; parameter4?: string | null; } export interface InitializedPaymentUpdate { parameter1?: string | null; parameter2?: string | null; parameter3?: string | null; parameter4?: string | null; } export interface FinalizePaymentResponse { redirectURL: string; creditCardFirstSix: string; creditCardLastFour: string; cardholderName: string; creditCardTypeID: number; paymentProviderID: number; token: string; expiration: string; identificationNumber: string; } export declare function isOrderResponse(order: APIErrorResponse | Order): order is Order; export declare function isPaginatedOrders(po: any): po is PaginatedOrders; export declare function isCart(c: APIErrorResponse | Cart): c is Cart; export declare function isInitializedPayment(i: APIErrorResponse | InitializedPayment): i is InitializedPayment; export {};