@apicart/store-sdk
Version:
Apicart SDK for integrating store into any web application
50 lines (28 loc) • 1.8 kB
TypeScript
import Cart from '../../Entity/Cart/Cart';
import CartItemParameter from '../../Entity/Cart/CartItemParameter';
import Order from '../../Entity/Order/Order';
import Customer from '../../Entity/Customer/Customer';
import PaymentMethod from '../../Entity/Payment/PaymentMethod';
import ShippingMethod from '../../Entity/Shipping/ShippingMethod';
interface DataSourceInterface
{
findCart(hash: string): Promise<Cart | null>;
fullCartSynchronization(cart: Cart): Promise<boolean>;
addCartItem(cartHash: string, dataUrl: string, quantity: number, parameters: CartItemParameter[]): Promise<boolean>;
removeCartItem(cartHash: string, dataUrl: string, quantity: number | null): Promise<boolean>;
addCartParameters(cartHash: string, parameters: Record<string, any>): Promise<boolean>;
removeCartParameters(cartHash: string, keys: string[]): Promise<boolean>;
finishCart(cartHash: string): Promise<Order | null>;
findCustomer(hash: string): Promise<Customer | null>;
fullCustomerSynchronization(customer: Customer): Promise<boolean>;
addCustomerParameters(customerHash: string, parameters: Record<string, any>): Promise<boolean>;
removeCustomerParameters(customerHash: string, keys: string[]): Promise<boolean>;
findOrder(hash: string): Promise<Order | null>;
changeOrderState(orderHash: string, orderStateCode: string): Promise<boolean>;
addOrderParameters(orderHash: string, parameters: any[]): Promise<boolean>;
removeOrderParameters(orderHash: string, keys: string[]): Promise<boolean>;
findPaymentMethod(id: number): Promise<PaymentMethod | null>;
findPaymentMethods(onlyEnabled: boolean): Promise<PaymentMethod[] | null>;
findShippingMethod(id: number): Promise<ShippingMethod | null>;
findShippingMethods(onlyEnabled: boolean): Promise<ShippingMethod[] | null>;
}