eva-sdk-js
Version:
The JavaScript based SDK for the EVA platform
966 lines (955 loc) • 839 kB
TypeScript
// Generated by dts-bundle v0.7.3
/**
* This method makes the EVA SDK ready for use and configures access to your back-end datastore
* @param {string} authenticationToken Your application authentication token
* @param {number} applicationId The application identifier for your store
* @param {string} endPointURL The URL for the EVA back-end store you want to use
* @return {void} This method doesn't return anything
*/
export function init(authenticationToken: string, applicationId: number, endPointURL?: string): void;
/**
* Expose the settings manager and the means to override the XMLHttpRequest provider
*/
/**
* These are the data providers availabe in eva
*/
/**
* This declares the known settings for the EVA SDK
*/
export interface IEvaSettings {
userAuthenticationToken?: string;
siteAuthenticationToken?: string;
applicationId?: number;
sessionId?: string;
endPointURL: string;
language: string;
version: string;
clientName: string;
productProperties: string[];
appName: string;
appVersion: string;
applicationToken: string;
}
/**
* The settings manager provides methods to get and set EVA client options
* @type {namespace}
*/
export namespace SettingsManager {
/**
* Generates a new session identifier for all future service calls
* @return {string} The current session identifier
*/
function generateSessionID(): string;
/**
* Changes the currently configured site authentication token.
* @return {string} An authorisation token
*/
function setSiteAuthenticationToken(token: string): string;
/**
* Changes the currently configured user authentication token. This token
* will be used in favor of the site authentication token.
* @return {string} An authorisation token
*/
function setUserAuthenticationToken(token: string): string;
/**
* Return the currently configured authentication token
* @return {string} An authorisation token
*/
function getAuthenticationToken(): string;
/**
* Changes the currently configured session identifier
* @return {string} A session identifier
*/
function setSessionId(sessionId: string): string;
/**
* Return the currently configured session identifier
* @return {string} A session identifier
*/
function getSessionId(): string;
/**
* Return the currently configured end point URL
* @return {string} An end point URL
*/
function getEndPointURL(): string;
/**
* Changes the currently configured end point URL
* @return {string} An end point URL
*/
function setEndPointURL(URL: string): string;
/**
* Return the currently configured application identifier
* @return {number} An application identifier
*/
function getApplicationId(): number;
/**
* Changes the currently configured application identifier
* @return {number} An application identifier
*/
function setApplicationId(applicationId: number): number;
/**
* Returns the currently configured client language
* @return {string} Language code (ex. nl-NL)
*/
function getLanguage(): string;
/**
* Changes the currently configured client language
* @return {string} Language code (ex. nl-NL)
*/
function setLanguage(languageCode: string): string;
/**
* Returns the current client version number which is in semver format
* @return {string} Version number (ex. 0.1.0)
*/
function getVersion(): string;
/**
* Returns the current client name
* @return {string} Client name
*/
function getClientName(): string;
/**
* Changes the currently configured client language
* @return {string} Language code (ex. nl-NL)
*/
function setAppDetails(name: string, version: string): string;
/**
* Returns the current app version number which is in semver format
* @return {string} Version number (ex. 0.1.0)
*/
function getAppVersion(): string;
/**
* Returns the current app name
* @return {string} App name
*/
function getAppName(): string;
/**
* Returns the currently configured product properties
*
* @export
* @returns {string[]}
*/
function getProductProperties(): string[];
/**
* Set the currently configured product properties
*
* @export
* @param {string[]} properties
* @returns {string[]}
*/
function setProductProperties(properties: string[]): string[];
/**
* Changes the currently configured application token. This token is sent
* to the EVA backend using the EVA-App-Token header
*
* @return {string} An application token
*/
function setApplicationToken(token: string): string;
/**
* Return the currently configured application token
*
* @return {string} An application token
*/
function getApplicationToken(): string;
}
/**
* For node.js or alternative platforms you can use setTransportProvider to point to an XHR alternative
* @param {any} alternativeXMLHttpRequest Platform specific or alternative XMLHttpRequest implementation
* @return {void} This method does not return anything
*/
export function setTransportProvider(alternativeXMLHttpRequest: any): void;
/**
* Create a new instance of an XMLHttpRequest object
* @return {any} The XMLHttpRequest instance
*/
export function createTransport(): any;
/**
* Possible XMLHttpRequest call methods
* @type {enum}
*/
export enum EXMLHttpRequestMethod {
GET = 0,
POST = 1,
PUT = 2,
DELETE = 3,
PATCH = 4
}
/**
* These are all the parameters that can be provided for an XMLHttpRequest call
* @type {interface}
*/
export interface IXMLHttpRequestParameters {
method: EXMLHttpRequestMethod;
url: string;
contentType?: string;
headers?: any;
data?: any;
username?: string;
password?: string;
}
/**
* Any response is returned along with its HTTP responseStatus code
* @type {interface}
*/
export interface IXMLHttpRequestResponse {
status: number;
response: any;
xhr: XMLHttpRequest;
}
/**
* Provides a wrapper for an XMLHttpRequest call
* @type {class}
*/
export class XHR {
appendURL(url: string, parameters: any): string;
/**
* Sets the XMLHttpRequest timeout to another value then the default 30 seconds
* @param {number} timeout The new timeout value in milliseconds
* @return {number} A timeout in milliseconds
*/
setTimeout(timeout: number): number;
/**
* Return the current XMLHttpRequest timeout value
* @return {number} A timeout in milliseconds
*/
getTimeout(): number;
/**
* Performs an XMLHttpRequest call
* @param {IXMLHttpRequestParameters} params The call parameters
* @return {Promise<IXMLHttpRequestResponse>} A promise that will resolve or reject depending on the call response
*/
call(params: IXMLHttpRequestParameters): Promise<IXMLHttpRequestResponse>;
}
/**
* This module provides access to an EVA Service call and ensures all required
* settings, headers and call conditions are met
*
* @preferred
*/
/**
* Any response is returned along with its HTTP responseStatus code
* @type {interface}
*/
export interface IEVAServiceResponse<REQ, RES> {
request: REQ;
response: RES;
status: number;
xhr: XMLHttpRequest;
}
/**
* Wrapper class for a call to the EVA back-end
* Ensure all proper settings are applied and handles all the type casting of
* request and response for the XMLHttpRequest calls
* @type {class}
*/
export class EVAService<REQ, RES> {
/**
* Constructor for the EVAService class
* @param {string} name The name of the EVA service to call
* @return {void} This method returns nothing
*/
constructor(name: string, path?: string, method?: EXMLHttpRequestMethod);
/**
* Convenience method to get the current session ID
* @return {string} The current sessionID
*/
getSessionID(): string;
/**
* Performs the actual call to the backend
* @param {REQ} requestData The data to be sent as the body for this call
* @return {Promise} Return a promise that will resolve with the call response
*/
call(requestData?: REQ, disableCache?: boolean, timeout?: number): Promise<IEVAServiceResponse<REQ, RES>>;
}
/**
* The applications module provides access to the applications data from the EVA back-end
* @preferred
*/
/**
* Provides access to an order available in EVA
*/
export class Application extends FetchableItem<EVA.Core.Services.ApplicationDto, EVA.Core.Services.GetCurrentApplication, EVA.Core.Services.GetCurrentApplicationResponse> {
fetch(): Promise<IEVAServiceResponse<EVA.Core.Services.GetCurrentApplication, EVA.Core.Services.GetCurrentApplicationResponse>>;
setData(response: EVA.Core.Services.GetCurrentApplicationResponse): EVA.Core.Services.ApplicationDto;
configuration(): Promise<IEVAServiceResponse<EVA.Core.Services.GetApplicationConfiguration, EVA.Core.Services.GetApplicationConfigurationResponse>>;
}
/**
* The applications module provides access to the applications data from the EVA back-end
* @preferred
*/
/**
* Provides access to a babylon Brands (fashion) in EVA
*/
export class Brand extends FetchableItem<EVA.PIM.Core.BrandDto, EVA.PIM.Core.GetBrand, EVA.PIM.Core.GetBrandResponse> {
fetch(): Promise<IEVAServiceResponse<EVA.PIM.Core.GetBrand, EVA.PIM.Core.GetBrandResponse>>;
}
export class Brands extends FetchablePagedList<EVA.Core.Services.ListBrandsResponseBrandDto, EVA.Core.Services.ListBrands, EVA.Core.Services.ListBrandsResponse> {
/**
* Sets the current item details using the fetched service response.
* Extending classes should override this method to pull the details from response
* @param {RES} response The response from the service call
* @return {Array<T>} The item details
*/
setData(response: any): EVA.Core.Services.ListBrandsResponseBrandDto[];
/**
* Fetches the list of items
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.ListBrandsPaged, EVA.Core.Services.ListBrandsResponse>>} A promise resolving when the fetch from the back-end has completed
*/
fetch(): Promise<IEVAServiceResponse<EVA.Core.Services.ListBrands, EVA.Core.Services.ListBrandsResponse>>;
}
export function searchBrands(query: string, pageSize?: number): Promise<IEVAServiceResponse<EVA.Core.Services.SearchBrands, EVA.Core.Services.SearchBrandsResponse>>;
export namespace Discounts {
function searchByQuery(requestBody: EVA.Core.Services.Management.SearchDiscountsByQuery): Promise<EVA.Core.Services.Management.SearchDiscountsByQueryResponse>;
function listManualDiscounts(requestBody: EVA.Core.Services.ListManualDiscounts): Promise<EVA.Core.Services.ListManualDiscountsResponse>;
function getDiscountCoupons(requestBody: EVA.Core.Services.Management.GetDiscountCoupons): Promise<EVA.Core.Services.Management.GetDiscountCouponsResponse>;
}
export namespace DocumentSigning {
function getSigningCodeForOrder(orderId: number): Promise<IEVAServiceResponse<EVA.DocumentSigning.GetSigningCodeForOrder, EVA.DocumentSigning.GetSigningCodeForOrderResponse>>;
function getSigningDataForOrder(hashId: string): Promise<IEVAServiceResponse<EVA.DocumentSigning.GetSigningDataForOrder, EVA.DocumentSigning.GetSigningDataForOrderResponse>>;
function signOrder(signature: string, mimeType: string, hashId: string): Promise<IEVAServiceResponse<EVA.DocumentSigning.SignOrder, EVA.API.RequestMessageWithEmptyResponse>>;
}
export interface IEVALoginOptions {
organizationUnitId?: number;
confirmationToken?: string;
identificationCode?: string;
selectOrganizationByApplicationID?: boolean;
publicLogin?: boolean;
registerApiKey?: boolean;
context?: string;
}
export interface IEVACreateCustomer {
noAccount?: boolean;
autoLogin?: boolean;
}
/**
* General namespace for Users function
*/
export namespace Users {
/**
* Request a token (via e-mail) for a user
*
* @param {string} emailAddress the e-mail adres of the user to request the token for
* @return {Promise} A promise that is fulfilled when the EVA Core service responds
*/
function requestResetPassword(emailAddress: string): Promise<IEVAServiceResponse<EVA.Core.Services.RequestPasswordResetToken, EVA.API.EmptyResponseMessage>>;
/**
* Reset a user password using a token that was received in an e-mail
*
* @param {string} newPassword the new password
* @param {string} token the token to be used for this reset
* @return {Promise} A promise that is fulfilled when the EVA Core service responds
*/
function resetPassword(newPassword: string, token: string): Promise<IEVAServiceResponse<EVA.Core.Services.ResetUserPassword, EVA.Core.Services.ResetUserPasswordResponse>>;
}
/**
* Provides authentication to EVA
*
* id is authentication
*/
export class LoggedInUser extends FetchableItem<EVA.Core.LoggedInUserDto, EVA.Core.Services.GetCurrentUser, EVA.Core.Services.GetCurrentUserResponse> {
orders: CustomerOrderList;
authentication: number;
organisationUnits: Array<EVA.Core.OrganizationUnitDto>;
isAnonymous: boolean;
isEmployee: boolean;
isCustomer: boolean;
static checkEmailAddressAvailability(emailAddress: string): Promise<any>;
static checkNicknameAvailability(nickname: string): Promise<any>;
/**
* Register a new customer and autologin
*
* @param {any} customer EVA.Core.Services.CustomerDto but only EmailAddress
* @return {Promise<any>} A promise that is fulfilled when the EVA Core service responds
*/
static register(customer: any, autoLogin?: boolean, noAccount?: boolean): Promise<any>;
/**
* Register a new customer with company
*
* @param {EVA.Core.Services.CreateCustomerWithCompany} request Create a customer with company request
* @return {Promise<any>} A promise that is fulfilled when the EVA Core service responds
*/
static registerWithCompany(request: EVA.Core.Services.CreateCustomerWithCompany): Promise<EVA.Core.Services.CreateCustomerWithCompanyResponse>;
/**
* Retrieve the company details for a user
* @return {Promise<EVA.Core.CompanyDto>}
*/
static getCompanyForUser(userId: number): Promise<EVA.Core.CompanyDto>;
/**
* Method to update a company that belongs to the logged-in user
*
* @param {EVA.Core.CompanyDto} company The company to update
* @returns {Promise<boolean>} Promise that returns true if update was successful
*/
static updateCompanyForUser(userId: number, company: EVA.Core.CompanyDto): Promise<boolean>;
/**
* Search for customers
*
* @param {string} query The query to search on
* @param {number} limit The page size limit. Defaults to 15
* @param {number} start The item to start the list at. Defaults to 0 and is a 0-based index.
* @return {Promise<any>} A promise that is fulfilled when the EVA Core service responds
*/
static searchUsers(options: {
query?: string;
employeeId?: number;
limit: number;
skip: number;
}): Promise<any>;
/**
* Retrieves and updates current user data
* @return {Promise} A promise that is fulfilled when the EVA Core service responds
*/
fetch(): Promise<IEVAServiceResponse<EVA.Core.Services.GetCurrentUser, EVA.Core.Services.GetCurrentUserResponse>>;
/**
* @param {any} response Provide with body of the response to populate and set properly the data on CurrentUser
* @return {EVA.Core.LoggedInUserDto} The current LoggedInUserDto state
*/
setData(response?: any): EVA.Core.LoggedInUserDto;
/**
* Return the current authentication token
* @return {string} The current authentication token
*/
getAuthenticationToken(): string;
/**
* Perform a login using email adress and password, and optional additional
* data
*
* @param {string} login The email address or username (nickname) to login with
* @param {string} password The password over the login
* @param {IEVALoginOptions?} options An optional structure with additional data for the login
* @return {Promise} Will resolve when succesfully logged in or rejected with the authentication result (EVA.Core.AuthenticationResults) or a general error
*/
login(login: string, password: string, options?: IEVALoginOptions): Promise<IEVAServiceResponse<EVA.Core.Services.Login, EVA.Core.Services.LoginResponse>>;
/**
* Switches the organization of the logged in user
*
* @param {number} organizationUnitId The new organization id
* @returns
* @memberof LoggedInUser
*/
switchOrganization(organizationUnitId: number): Promise<IEVAServiceResponse<EVA.Core.Services.Login, EVA.Core.Services.LoginResponse>>;
/**
* Execute an explicit logout
*
* @return {Promise} A promise resolving when the call to the back-end has completed
*/
logout(): Promise<IEVAServiceResponse<EVA.Core.Services.Logout, EVA.Core.Services.LogoutResponse>>;
/**
* Retrieves third party login options
*
* @return {Promise} A promise resolving when the call to the back-end has completed
*/
getThirdPartyLoginOptions(): Promise<IEVAServiceResponse<EVA.Core.Services.GetAvailableThirdPartiesForLogin, EVA.Core.Services.GetAvailableThirdPartiesForLoginResponse>>;
/**
* Requests third party login.
* Response will contain a redirect url that can be used to perform the login
*
* @return {Promise} A promise resolving when the call to the back-end has completed
*/
requestThirdPartyLogin(loginRequest: EVA.Core.Services.RequestThirdPartyLogin): Promise<IEVAServiceResponse<EVA.Core.Services.RequestThirdPartyLogin, EVA.Core.Services.RequestThirdPartyLoginResponse>>;
/**
* Perform third party login with a token
*
* @return {Promise} A promise resolving when the call to the back-end has completed
*/
authenticateWithThirdPartyLogin(loginRequest: EVA.Core.Services.AuthenticateWithThirdPartyLogin): Promise<IEVAServiceResponse<EVA.Core.Services.AuthenticateWithThirdPartyLogin, EVA.Core.Services.AuthenticateWithThirdPartyLoginResponse>>;
/**
* This call retrieves a paged list of orders belonging to the current user
*
* @param {number} start The item to start the list at. Defaults to 0 and is a 0-based index.
* @param {number} limit The page size limit. Defaults to 15
* @param {EVA.Framework.SortDirection} sortDirection The sorting direction for the list. Defaults to ascending
* @return {Promise<customerOrderList>} A promise resolving when the call to the back-end has completed
*/
getOrders(id: number, limit?: number, start?: number, sortDirection?: EVA.Framework.SortDirection): Promise<CustomerOrderList>;
/**
* This call retrieves a single order
* @param {number} order_id The ID of the order
* @param {boolean} include_failed_payements If set to true, return order even if the payment has not been completed
* @return {Promies<Order>} A promise resolving when the call to the back-end has completed
*/
getOrder(order_id: number, include_failed_payements: boolean): Promise<Order>;
/**
* Update the user
*
* @return {Promise} A promise resolving when the call to the back-end has completed
*/
update(): Promise<IEVAServiceResponse<EVA.Core.Services.UpdateUser, EVA.Core.Services.UpdateUserResponse>>;
/**
* Update the user's email address
*
* @return {Promise} A promise resolving when the call to the back-end has completed
*/
updateUserEmailAddress(newEmailAddress: string): Promise<IEVAServiceResponse<EVA.Core.Services.UpdateUserEmailAddress, EVA.API.RequestMessageWithEmptyResponse>>;
/**
* Change the passowrd of this user
*
* @param {string} newPassword The new password
* @param {string} oldPassword The current / old password
* @return {Promise} A promise resolving when the call to the back-end has completed
*/
changePassword(newPassword: string, oldPassword: string): Promise<IEVAServiceResponse<EVA.Core.Services.ChangeUserPassword, EVA.Core.Services.ChangeUserPasswordResponse>>;
}
export class User extends FetchableItem<EVA.Core.UserDto, EVA.Core.Services.GetUser, EVA.Core.Services.GetUserResponse> {
isAnonymous: boolean;
isEmployee: boolean;
isCustomer: boolean;
/**
* Update the user
*
* @return {Promise} A promise resolving when the call to the back-end has completed
*/
update(userDto: EVA.Core.UserDto): Promise<IEVAServiceResponse<EVA.Core.Services.UpdateUser, EVA.Core.Services.UpdateUserResponse>>;
/**
* Retrieves specific user data
* @return {Promise} A promise that is fulfilled when the EVA Core service responds
*/
fetch(): Promise<IEVAServiceResponse<EVA.Core.Services.GetUser, EVA.Core.Services.GetUserResponse>>;
/**
* @param {any} response Service response containing the user data
* @return {EVA.Core.UserDto} The user data
*/
setData(response?: any): EVA.Core.UserDto;
}
/**
* The orders module provides access to the order data from the EVA back-end
* @preferred
*/
export interface IEVAProduceInvoiceOptions {
downloadInvoice?: boolean;
emailAddress?: string;
invoiceId?: number;
printInvoice?: boolean;
remark?: string;
stationId?: string;
}
export interface IEVAProduceDocumentsOptions {
printInvoice?: boolean;
emailInvoice?: boolean;
printReceipt?: boolean;
stationId?: number;
orderID?: number;
emailAddress?: string;
remark?: string;
}
/**
* Provides access to an order available in EVA
*/
export class Order extends FetchableItem<EVA.Core.OrderDto, EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse> {
/**
* The payment options for the order
* @type {Payment}
*/
payment: Payments;
/**
* Flag to include pending payments in fetch
*
* @type {boolean}
* @memberof Order
*/
includePendingPayments: boolean;
/**
* Flag to include failed payments in fetch
*
* @type {boolean}
* @memberof Order
*/
includeFailedPayments: boolean;
/**
* This class wraps an order from EVA and the operations you can perform on it.
* You should supply the order identifier when creating an instance of this class
*
* @param {number | string} id The identifier of the order to retrieve
* @return {void} This method doesn't return anything
*/
constructor(id?: number | string);
/**
* Returns if the order state 'completed' applies to the order
* @return {boolean} Indicates the state is active
*/
isCompleted(): boolean;
/**
* Returns if the order state 'shipped' applies to the order
* @return {boolean} Indicates the state is active
*/
isShipped(): boolean;
/**
* Returns if the order state 'paid' applies to the order
* @return {boolean} Indicates the state is active
*/
isPaid(): boolean;
/**
* Returns if the order state 'invoiced' applies to the order
* @return {boolean} Indicates the state is active
*/
isInvoiced(): boolean;
/**
* Returns if the order state 'cancelled' applies to the order
* @return {boolean} Indicates the state is active
*/
isCancelled(): boolean;
/**
* Returns the current open amount still to be paid for the order
* @return {number}
*/
getOpenAmount(): number;
/**
* Returns the total value of all the items in the order with VAT
* @return {number} The value of the items in the order with VAT
*/
getTotalAmountInTax(): number;
/**
* Return the current order amounts
*
* @returns {EVA.Core.OrderAmounts}
* @memberof Order
*/
getOrderAmounts(): EVA.Core.OrderAmounts;
/**
* Return order lines by type
* @return {Array<EVA.Core.OrderLineDto>} Array of order lines
*/
getOrderLinesByType(orderLineType: number | EVA.Core.OrderLineTypes): Array<EVA.Core.OrderLineDto>;
/**
* Return the total amount of shipping costs
* @return {number} The total value of the shipping costs
*/
getTotalShippingAmount(inTax?: boolean): number;
/**
* Return the total amount of ShippingCosts
* @return {number} The total value of the shipping costs
*/
getTotalDiscountAmount(inTax?: boolean): number;
/**
* Returns the current order requirement validation data
* @return {EVA.Core.Validation.RequiredData} The order requirement validation data
*/
getRequirements(): EVA.Core.RequiredData;
/**
* Checks if there are any invalid requirements in the current order requirement validation data
* @return {boolean} Indicates if the order requirements are all met or not
*/
isValid(): boolean;
/**
* Fetches and updates the order requirement validation data
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.GetRequiredDataForOrder, EVA.Core.Services.GetRequiredDataForOrderResponse>>} A promise resolving when the fetch from the back-end has completed
*/
validate(requiredFor?: number, storeRequirements?: boolean): Promise<IEVAServiceResponse<EVA.Core.Services.GetRequiredDataForOrder, EVA.Core.Services.GetRequiredDataForOrderResponse>>;
/**
* Returns the list of different organizations where orderline items are te be picked up
* @return {number} The list of organizations
*/
readonly stockOrganizationUnits: Array<any>;
/**
* Returns the list of different organizations where orderline items are te be picked up
* @return {number} The list of organizations
*/
readonly requestedDates: Array<any>;
/**
* Fetches the order details
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>} A promise resolving when the fetch from the back-end has completed
*/
fetch(): Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>;
/**
* Sets the current item details using the fetched service response.
* Extending classes should override this method to pull the details from response
* @param {EVA.Core.Services.GetOrderResponse} response The response from the service call
* @return {EVA.Core.OrderDto} The order details
*/
setData(response: EVA.Core.Services.GetOrderResponse | EVA.Core.ShoppingCartResponse | any): EVA.Core.OrderDto;
/**
* Attaches a customer to the order
* @param {LoggedInUser} customer The current user class that is to be set as the customer for the order
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>} A promise resolving when the fetch from the back-end has completed
*/
setCustomer(customer: LoggedInUser | User): Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>;
/**
* Sets the currency for the order
* @param {string} currencyID The identifier of the currency
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>} A promise resolving when the fetch from the back-end has completed
*/
setCurrency(currencyID: string): Promise<{}>;
/**
* Retrieve the current warehouse data for this order
*
* @see https://newblack1.aha.io/features/EVA-17
*/
getWarehouseData(): Promise<IEVAServiceResponse<EVA.Core.Services.GetWarehouseOrderData, EVA.API.EmptyResponseMessage>>;
/**
* Dictates whether this order will be partially delivered or not
* @param allowPartialPick whether to allow partial pick up or not
* @see https://newblack1.aha.io/features/EVA-17
*/
setWarehouseData(allowPartialPick: boolean): Promise<{}>;
/**
* Sets a requested date on an order line
* @param orderLineID the orderLine we want to modify the requst date of
* @param requestedDate the request date in question
*/
setRequestedDate(orderLines: EVA.Core.Services.SetRequestedDateOrderLineDto[], requestedDate: string): Promise<{}>;
/**
* Attaches a customer to the order
* @param {LoggedInUser} customer The current user class that is to be set as the customer for the order
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>} A promise resolving when the fetch from the back-end has completed
*/
setPickupOrganizationUnit(organizationUnitID: number): Promise<IEVAServiceResponse<EVA.Core.Services.SetPickupOrganizationUnit, EVA.Core.Services.GetOrderResponse>>;
/**
* Places the order. It's usually wise to call validate(...) before trying to place an order
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.PlaceOrder, EVA.Core.Services.PlaceOrderResponse>>} A promise resolving when the fetch from the back-end has completed
*/
placeOrder(): Promise<IEVAServiceResponse<EVA.Core.Services.PlaceOrder, EVA.Core.Services.PlaceOrderResponse>>;
/**
* Ships the order. It's usually wise to call validate(...) before trying to ship an order
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.ShipOrder, EVA.Core.Services.ShipOrderResponse>>} A promise resolving when the fetch from the back-end has completed
*/
shipOrder(lines?: number[], force?: boolean): Promise<IEVAServiceResponse<EVA.Core.Services.ShipOrder, EVA.Core.Services.ShipOrderResponse>>;
produceInvoice(options: IEVAProduceInvoiceOptions): Promise<IEVAServiceResponse<EVA.Core.Services.ProduceInvoice, EVA.API.ResourceResponseMessage>>;
produceDocuments(options: IEVAProduceDocumentsOptions): Promise<IEVAServiceResponse<EVA.Core.Services.ProduceDocuments, EVA.Core.Services.ProduceDocumentsResponse>>;
/**
* Get the download url for this order
*
* @return {Promise<string>} The URL to the download of this order
*/
getDownloadUrl(): Promise<string>;
getReturnableStatusForOrder(): Promise<IEVAServiceResponse<EVA.Core.Services.GetReturnableStatusForOrder, EVA.Core.Services.GetReturnableStatusForOrderResponse>>;
getReturnOrdersForOrder(): Promise<IEVAServiceResponse<EVA.CRM.Core.GetReturnOrdersForOrder, EVA.CRM.Core.GetReturnOrdersForOrderResponse>>;
createCustomerReturn(lines: Array<EVA.CRM.Core.CustomerReturnLine>): Promise<IEVAServiceResponse<EVA.CRM.Core.CreateCustomerReturn, EVA.API.EmptyResponseMessage>>;
createEmployeeReturn(lines: Array<EVA.CRM.Core.ReturnLineDto>): Promise<IEVAServiceResponse<EVA.CRM.Core.ReturnOrderLines, EVA.API.EmptyResponseMessage>>;
/**
* For B2B orders
*
* Fetches the order view details
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.GetConfigurableOrderView, EVA.Core.Services.GetConfigurableOrderViewResponse>>} A promise resolving when the fetch from the back-end has completed
*/
fetchOrderView(logicalLevel?: string, groupByProperty?: string): Promise<IEVAServiceResponse<EVA.Core.Services.GetConfigurableOrderView, EVA.Core.Services.GetConfigurableOrderViewResponse>>;
/**
* Set an order reference for a customer
*
* @param customerReference The reference value to set
* @param customerOrderId The customer order id
* @see https://newblack1.aha.io/features/EVA-15
*/
setCustomerOrderReference(customerReference: string, customerOrderId: string): Promise<IEVAServiceResponse<EVA.Core.Services.SetCustomerReferencesOnOrder, EVA.API.EmptyResponseMessage>>;
/**
* Set the shopping basket to an existing order. Removes any existing items in the shopping cart
* @param {number|Order} order Either an order id or an order class to set as the shopping cart
* @return {Promise} A promise resolving when the call to the back-end has completed
*/
attach(order: number | Order): Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>;
/**
* Clears the entire shopping basket
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>} A promise resolving when the call to the back-end has completed
*/
detach(): Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>;
/**
* Suspends the current order
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.SuspendOrder, EVA.Core.Services.GetOrderResponse>>} A promise resolving when the call to the back-end has completed
*/
suspend(description: string, printReceipt: boolean, stationId?: number): Promise<IEVAServiceResponse<EVA.Core.Services.SuspendOrder, EVA.Core.Services.GetOrderResponse>>;
/**
* Set the order reference
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.ListOrderLines, EVA.Core.Services.ListOrderLinesResponse>>} A promise resolving when the fetch from the back-end has completed
*/
listOrderLines(orderLineIds?: number[], start?: number, limit?: number, shippable?: boolean, invoiceable?: boolean, onlyShippable?: boolean, productTypes?: EVA.Core.ProductTypes): Promise<IEVAServiceResponse<EVA.Core.Services.ListOrderLines, EVA.Core.Services.ListOrderLinesResponse>>;
/**
* Update customer address data for this order
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.ListOrderLines, EVA.Core.Services.ListOrderLinesResponse>>} A promise resolving when the fetch from the back-end has completed
*/
copyAddressesFromCustomer(): Promise<IEVAServiceResponse<EVA.Core.Services.UpdateOrderAddresses, EVA.Core.Services.UpdateOrderAddressesResponse>>;
/**
* Provides access to a list of shipments for this order
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.ListOrderShipments, EVA.Core.Services.ListOrderShipmentsResponse>>} A promise resolving when the fetch from the back-end has completed
*/
listShipments(): Promise<IEVAServiceResponse<EVA.Core.Services.ListOrderShipments, EVA.Core.Services.ListOrderShipmentsResponse>>;
/**
* Provides access to a list of blobs for this order
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.ListBlobsForOrder, EVA.Core.Services.ListBlobsForOrderResponse>>} A promise resolving when the fetch from the back-end has completed
*/
listBlobs(): Promise<IEVAServiceResponse<EVA.Core.Services.ListBlobsForOrder, EVA.Core.Services.ListBlobsForOrderResponse>>;
/**
* Set the billing address of the order using an AddressBook item
*
* @param {number} addressBookId The ID of the AddressBook item
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>} A promise resolving when the fetch from the back-end has completed
*/
setBillingAddressFromAddressBook(addressBookId: number): Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>;
/**
* Set the billing address of the order using an raw address
*
* @param {number} address The address to set as billing address on the order
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>} A promise resolving when the fetch from the back-end has completed
*/
setBillingAddress(address: EVA.Core.AddressDto): Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>;
/**
* Set the shipping address of the order using an AddressBook item
*
* @param {number} addressBookId The ID of the AddressBook item
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>} A promise resolving when the call to the back-end has completed
*/
setShippingAddressFromAddressBook(addressBookId: number): Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>;
/**
* Set the shipping address of the order using an raw address
*
* @param {number} address The address to set as shipping address on the order
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>} A promise resolving when the fetch from the back-end has completed
*/
setShippingAddress(address: EVA.Core.AddressDto): Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>;
/**
* Sets the remarks for an order
*
* @param {string} remarks The remarks content
* @returns {Promise<IEVAServiceResponse<EVA.Core.Services.SetCustomOrderData, EVA.API.EmptyResponseMessage>>}
* @memberof Order
*/
setRemark(remarks: string): Promise<IEVAServiceResponse<EVA.Core.Services.GetOrder, EVA.Core.Services.GetOrderResponse>>;
/**
* Retrieves available discount product options for an order line
*
* @param {number} orderLineId
* @returns {Promise<IEVAServiceResponse<EVA.Core.Services.GetPickProductDiscountOptionsForOrderLine, EVA.Core.Services.GetPickProductDiscountOptionsForOrderLineResponse>>}
* @memberof Order
*/
getDiscountProductOptionsForOrderline(orderLineId: number): Promise<IEVAServiceResponse<EVA.Core.Services.GetPickProductDiscountOptionsForOrderLine, EVA.Core.Services.GetPickProductDiscountOptionsForOrderLineResponse>>;
/**
* Retrieves available discount product options for an order
*
* @param {number} orderId
* @returns {Promise<IEVAServiceResponse<EVA.Core.Services.GetPickProductDiscountOptionsForOrder, EVA.Core.Services.GetPickProductDiscountOptionsForOrderResponse>>}
* @memberof Order
*/
getDiscountProductOptionsForOrder(orderId: number): Promise<IEVAServiceResponse<EVA.Core.Services.GetPickProductDiscountOptionsForOrder, EVA.Core.Services.GetPickProductDiscountOptionsForOrderResponse>>;
/**
* Sets the chosen discount product for an order line
*
* @param {number} orderLineId
* @param {(number | null)} selectionId
* @returns {Promise<IEVAServiceResponse<EVA.Core.Services.SetPickProductDiscountOptionsForOrderLine, EVA.API.EmptyResponseMessage>>}
* @memberof Order
*/
setDiscountProductForOrderline(orderLineId: number, selectionId: number | null): Promise<IEVAServiceResponse<EVA.Core.Services.SetPickProductDiscountOptionsForOrderLine, EVA.API.EmptyResponseMessage>>;
}
/**
* Provides access to a list of customer orders available in EVA
*/
export class CustomerOrderList extends FetchablePagedList<Order, EVA.Core.Services.ListOrdersForCustomer, EVA.Core.Services.ListOrdersForCustomerResponse> {
constructor(id: number, limit?: number, start?: number, sortDirection?: EVA.Framework.SortDirection, sortProperty?: string);
/**
* Sets the current item details using the fetched service response.
* Extending classes should override this method to pull the details from response
* @param {RES} response The response from the service call
* @return {T} The item details
*/
setData(response: any): Order[];
/**
* Fetches the list of items
* @return {Promise<IEVAServiceResponse<EVA.Core.OrderDto, EVA.Core.Services.ListOrdersForCustomer, EVA.Core.Services.ListOrdersForCustomerResponse>>} A promise resolving when the fetch from the back-end has completed
*/
fetch(): Promise<IEVAServiceResponse<EVA.Core.Services.ListOrdersForCustomer, EVA.Core.Services.ListOrdersForCustomerResponse>>;
}
/**
* Provides access to a list of customer orders available in EVA
*/
export class SearchOrderList extends FetchablePagedList<EVA.Core.OrderSearchResultItem, EVA.Core.Services.SearchOrders, EVA.Core.Services.SearchOrdersResponse> {
/**
* Returns the current query string
* @return {string} The configured query string
*/
getQuery(): string;
/**
* Set the organization id to search for
* @param {number} query The organization id
* @return {number} The configured organization id
*/
setOrganizationID(id: number): number;
/**
* Returns the current organization id
* @return {number} The configured organization id
*/
getOrganizationID(): number;
/**
* Set the query to search for
* @param {string} query The new query string
* @return {string} The configured query string
*/
setQuery(query: string): string;
/**
* Returns the current list of order ids
* @return {Array<number>} The configured list of order ids
*/
getOrderIDs(): Array<number>;
/**
* Adds an order ID to the list of orders to retrieve
* @return {Array<number>} The configured list of order ids
*/
addOrderID(id: number): Array<number>;
/**
* Adds an order ID to the list of orders to retrieve
* @return {Array<number>} The configured list of order ids
*/
setOrderIDs(ids: number[]): Array<number>;
/**
* Clears the configured list of order ids
* @return {Array<number>} The configured list of order ids
*/
clearOrderIDs(): Array<number>;
/**
* Fetches the list of items
* @return {Promise<IEVAServiceResponse<EVA.Core.Services.SearchOrders, EVA.Core.Services.SearchOrdersResponse>>} A promise resolving when the fetch from the back-end has completed
*/
fetch(): Promise<IEVAServiceResponse<EVA.Core.Services.SearchOrders, EVA.Core.Services.SearchOrdersResponse>>;
}
/**
* Provides access to a list of customer orders available in EVA
*/
export class OrdersWithReferenceList extends FetchablePagedList<EVA.Core.OrderWithCustomerReferences, EVA.Core.Services.ListOrdersWithCustomerReferences, EVA.Core.Services.ListOrdersWithCustomerReferences> {
/**
* Fetches the list of items
* @return {Promise<IEVAServiceResponse<EVA.Core.OrderDto, EVA.Core.Services.ListOrdersWithReference, EVA.Core.Services.ListOrdersWithReferenceResponse>>} A promise resolving when the fetch from the back-end has completed
*/
fetch(): Promise<IEVAServiceResponse<EVA.Core.Services.ListOrdersWithCustomerReferences, EVA.Core.Services.ListOrdersWithCustomerReferences>>;
}
/**
* Provides access to a list of suspended orders available in EVA
*
* @export
* @class SuspendedOrderList
* @extends {FetchablePagedList<EVA.Core.Services.ListSuspendedOrdersResponseSuspendedOrderDto, EVA.Core.Services.ListSuspendedOrders, EVA.Core.Services.ListSuspendedOrdersResponse>}
*/
export class SuspendedOrderList extends FetchablePagedList<EVA.Core.Services.ListSuspendedOrdersResponseSuspendedOrderDto, EVA.Core.Services.ListSuspendedOrders, EVA.Core.Services.ListSuspendedOrdersResponse> {
/**
* Fetches the list of items
*/
fetch(): Promise<IEVAServiceResponse<EVA.Core.Services.ListSuspendedOrders, EVA.Core.Services.ListSuspendedOrdersResponse>>;
}
/**
* The shopping cart module provides access to shopping cart data from the EVA back-end
* Note that the shopping cart is bound to the current session so there is only 1 of them
* You can regard it as the active order
* @preferred
*/
/**
* Provides access to the shopping cart available in EVA
*/
export class ShoppingCart extends FetchableItem<EVA.Core.OrderDto, EVA.Core.Services.GetShoppingCart, EVA.Core.ShoppingCartResponse> {
/**
* The payment options for the order
* @type {Payment}
*/
payment: Payments;
/**
* Indicates the order/cart is a pickup order (for a single shop)
* @type {boolean}
*/
isPickupOrder: boolean;
/**
* This class wraps the current shopping cart from EVA and the operations you can perform on it.
*
* @return {void} This method doesn't return anything
*/
constructor();
/**
* Returns if the order state 'completed' applies to the order
* @return {boolean} Indicates the state is active
*/
isCompleted(): boolean;
/**
* Returns if the order state 'shipped' applies to the order
* @return {boolean} I