@figuredev/orders-sdk
Advanced tools
Comparing version 0.15.2 to 0.16.0
@@ -34,3 +34,9 @@ "use strict"; | ||
http_1.createHttpRequest.mockResolvedValueOnce({ | ||
data: [], | ||
data: { | ||
data: [], | ||
pagination: { | ||
next: null, | ||
previous: null, | ||
}, | ||
}, | ||
}); | ||
@@ -41,3 +47,2 @@ const data = yield client.getOrdersPreviews({ | ||
}, { | ||
from: "2021-01-01T00:00:00.000Z", | ||
limit: 10, | ||
@@ -56,5 +61,4 @@ serviceId: "terminal-1", | ||
method: "GET", | ||
url: "/order-previews", | ||
url: "/order/preview", | ||
params: { | ||
from: "2021-01-01T00:00:00.000Z", | ||
limit: 10, | ||
@@ -66,5 +70,57 @@ serviceId: "terminal-1", | ||
}); | ||
expect(data).toEqual([]); | ||
expect(data).toEqual({ | ||
data: [], | ||
pagination: { | ||
next: null, | ||
previous: null, | ||
}, | ||
}); | ||
})); | ||
it(".getOrders", () => __awaiter(void 0, void 0, void 0, function* () { | ||
; | ||
http_1.createHttpRequest.mockResolvedValueOnce({ | ||
data: { | ||
data: [], | ||
pagination: { | ||
next: null, | ||
previous: null, | ||
}, | ||
}, | ||
}); | ||
const data = yield client.getOrders({ | ||
accountId: "account-1", | ||
locationId: "location-1", | ||
}, { | ||
limit: 10, | ||
serviceId: "terminal-1", | ||
customerId: "customer-1", | ||
externalUserId: "external-user-1", | ||
pagination: "some-pagination-key", | ||
}); | ||
expect(http_1.createHttpRequest).toHaveBeenCalledWith({ | ||
baseURL: "https://some-url.com", | ||
headers: { | ||
"twbrds-account-id": "account-1", | ||
"twbrds-location-id": "location-1", | ||
"fgr-service-token": "some-secret-key", | ||
}, | ||
method: "GET", | ||
url: "/order", | ||
params: { | ||
limit: 10, | ||
serviceId: "terminal-1", | ||
customerId: "customer-1", | ||
externalUserId: "external-user-1", | ||
pagination: "some-pagination-key", | ||
}, | ||
}); | ||
expect(data).toEqual({ | ||
data: [], | ||
pagination: { | ||
next: null, | ||
previous: null, | ||
}, | ||
}); | ||
})); | ||
}); | ||
//# sourceMappingURL=sdk.spec.js.map |
import { Maybe } from "@figurepos/fgr-lib-backend/lib/types"; | ||
import { CustomerDTO, CustomerLoyaltyInfoDTO } from "./customer"; | ||
import { InventoryInfoDTO } from "./inventory"; | ||
import { LoyaltyProgramDTO, LoyaltyProgramTransactionDTO } from "./loyaltyPrograms"; | ||
import { OrderDTO, OrderPreviewDTO } from "./order"; | ||
import { OrderDTO } from "./order"; | ||
import { OrderInputDTO } from "./orderInput"; | ||
@@ -9,4 +10,4 @@ import { ReportPreparationTimeByItemDTO, ReportPreparationTimeHourlyDTO } from "./report"; | ||
import { FileUploadTypeDTO, IsoDate, IsoDateTime, PreparedFileUploadDTO } from "./types"; | ||
import { GetOrderPreviewsResponse, GetOrdersParams, GetOrdersResponse } from "./types/api"; | ||
import { UserContext } from "./utils"; | ||
import { CustomerDTO, CustomerLoyaltyInfoDTO } from "./customer"; | ||
declare type OrdersClientConfig = { | ||
@@ -26,9 +27,2 @@ baseUrl: string; | ||
}; | ||
export declare type GetOrdersPreviewsParams = { | ||
from?: IsoDateTime; | ||
limit: number; | ||
serviceId?: string; | ||
customerId?: string; | ||
externalUserId?: string; | ||
}; | ||
export declare type GetReportPreparationTimeByItemParams = { | ||
@@ -65,4 +59,5 @@ locationIds: string[]; | ||
getOrder(ctx: UserContext, id: string): Promise<OrderDTO>; | ||
getOrdersPreviews(ctx: UserContext, params: GetOrdersPreviewsParams): Promise<OrderPreviewDTO[]>; | ||
getOrdersPreviews(ctx: UserContext, params: GetOrdersParams): Promise<GetOrderPreviewsResponse>; | ||
getOrdersCount(ctx: UserContext, params: GetOrdersCountParams): Promise<number>; | ||
getOrders(ctx: UserContext, params: GetOrdersParams): Promise<GetOrdersResponse>; | ||
checkOrderExists(ctx: UserContext, id: string): Promise<boolean>; | ||
@@ -69,0 +64,0 @@ getInventoryInfo(ctx: UserContext, params: GetInventoryInfoParams): Promise<InventoryInfoDTO[]>; |
@@ -40,4 +40,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.get(ctx, "/order-previews", { | ||
from: params.from, | ||
return this.get(ctx, "/order/preview", { | ||
limit: params.limit, | ||
@@ -61,2 +60,7 @@ serviceId: params.serviceId, | ||
} | ||
getOrders(ctx, params) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.get(ctx, "/order", params); | ||
}); | ||
} | ||
checkOrderExists(ctx, id) { | ||
@@ -63,0 +67,0 @@ var _a; |
@@ -37,2 +37,3 @@ import { AddressDTO, IsoDateTime, Maybe, RecipientDTO } from "./types"; | ||
serviceId: string; | ||
serviceName: Maybe<string>; | ||
orderNumber: string; | ||
@@ -50,2 +51,3 @@ state: OrderStateDTO; | ||
items?: OrderItemPreviewDTO[]; | ||
timezone: Maybe<string>; | ||
}; | ||
@@ -391,2 +393,6 @@ export declare type OrderMetadataDTO = { | ||
name: string; | ||
price: Maybe<number>; | ||
productId: Maybe<string>; | ||
totals: Maybe<OrderItemTotalsDTO>; | ||
modifiers: OrderItemModifierPreviewDTO[]; | ||
}; | ||
@@ -426,2 +432,8 @@ export declare type OrderItemAuditDTO = { | ||
}; | ||
export declare type OrderItemModifierPreviewDTO = { | ||
id: string; | ||
name: string; | ||
quantity: Maybe<number>; | ||
productId: Maybe<string>; | ||
}; | ||
export declare type OrderItemTaxDTO = { | ||
@@ -428,0 +440,0 @@ id: string; |
{ | ||
"name": "@figuredev/orders-sdk", | ||
"version": "0.15.2", | ||
"version": "0.16.0", | ||
"license": "ISC", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100302
51
1916