@figuredev/orders-sdk
Advanced tools
Comparing version 0.8.2 to 0.9.0
140
dto.ts
@@ -1,20 +0,19 @@ | ||
export type OrderInputDTO = { | ||
id: string | ||
store?: OrderStoreInputDTO | ||
customer?: OrderCustomerInputDTO | ||
price?: OrderPriceInputDTO | ||
state?: OrderStateInputDTO | ||
orderNumber: string | ||
export type OrderDTO = { | ||
id?: string | ||
price?: OrderPriceDTO | ||
state?: OrderStateDTO | ||
orderNumber?: string | ||
acceptLink?: string | ||
declineLink?: string | ||
note?: string | ||
placedAt: string | ||
scheduledFor?: string | ||
items: OrderItemInputDTO[] | ||
deliveryMethod: OrderDeliveryMethodInputDTO | ||
paymentMethod: OrderPaymentInputDTO | ||
placedAt?: string | ||
source?: string | ||
items?: OrderItemDTO | ||
fulfillments?: OrderFulfillmentDTO | ||
payments?: OrderPaymentDTO | ||
pricings?: OrderPricingDTO | ||
} | ||
export type OrderItemInputDTO = { | ||
id: string | ||
export type OrderItemDTO = { | ||
id?: string | ||
name?: string | ||
@@ -25,14 +24,15 @@ price?: number | ||
note?: string | ||
modifiersGroups?: OrderItemModifierGroupInputDTO[] | ||
taxes?: OrderItemTaxInputDTO[] | ||
modifiersGroups?: OrderItemModifierGroupDTO | ||
taxes?: OrderItemTaxDTO | ||
pricings?: OrderItemPricingDTO | ||
} | ||
export type OrderItemModifierGroupInputDTO = { | ||
export type OrderItemModifierGroupDTO = { | ||
id?: string | ||
name?: string | ||
price?: number | ||
modifiers?: OrderItemModifierInputDTO[] | ||
modifiers?: OrderItemModifierDTO | ||
} | ||
export type OrderItemModifierInputDTO = { | ||
export type OrderItemModifierDTO = { | ||
id?: string | ||
@@ -45,3 +45,3 @@ productId?: string | ||
export type OrderItemTaxInputDTO = { | ||
export type OrderItemTaxDTO = { | ||
id?: string | ||
@@ -55,3 +55,25 @@ taxId?: string | ||
export type OrderPriceInputDTO = { | ||
export type OrderItemPricingDTO = { | ||
id?: string | ||
pricingId?: string | ||
name?: string | ||
percentage?: number | ||
absolute?: number | ||
} | ||
export type OrderPricingDTO = { | ||
id?: string | ||
pricingId?: string | ||
type?: OrderPricingType | ||
name?: string | ||
percentage?: number | ||
absolute?: number | ||
} | ||
export enum OrderPricingType { | ||
Normal = "normal", | ||
Delivery = "delivery", | ||
} | ||
export type OrderPriceDTO = { | ||
base?: number | ||
@@ -62,32 +84,70 @@ subtotal?: number | ||
export type OrderCustomerInputDTO = { | ||
firstName?: string | ||
surname?: string | ||
emailAddress?: string | ||
phoneNumber?: string | ||
export type OrderPaymentDTO = { | ||
id?: string | ||
type?: OrderPaymentType | ||
state?: OrderPaymentState | ||
transactionNumber?: string | ||
amount?: number | ||
tip?: number | ||
} | ||
export type OrderStoreInputDTO = { | ||
id?: string | ||
name?: string | ||
export enum OrderPaymentType { | ||
Card = "card", | ||
Cash = "cash", | ||
External = "external", | ||
} | ||
export type OrderDeliveryMethodInputDTO = { | ||
type: "delivery" | "pick-up" | "for-here" | ||
address?: AddressDTO | ||
export enum OrderPaymentState { | ||
Pending = "pending", | ||
processed = "processed", | ||
} | ||
export type OrderStateDTO = { | ||
type?: OrderStateType | ||
} | ||
export enum OrderStateType { | ||
Placed = "placed", | ||
Accepted = "accepted", | ||
Declined = "declined", | ||
Closed = "closed", | ||
} | ||
export type OrderFulfillmentDTO = { | ||
id?: string | ||
type?: OrderFulfillmentType | ||
recipient?: OrderFulfillmentRecipientDTO | ||
note?: string | ||
fee?: number | ||
scheduleType?: OrderFulfillmentScheduleType | ||
scheduledFor?: string | ||
deliveryService?: string | ||
attributes?: OrderFulfillmentAttributesDTO | ||
} | ||
export type OrderPaymentInputDTO = { | ||
type: "card" | "cash" | ||
tip?: number | ||
amount?: number | ||
status?: "paid" | "pending" | ||
export enum OrderFulfillmentType { | ||
Delivery = "placed", | ||
PickUp = "pick-up", | ||
ForHere = "for-here", | ||
} | ||
export type OrderStateInputDTO = { | ||
type?: "Placed" | "Accepted" | "Declined" | "Closed" | ||
export enum OrderFulfillmentScheduleType { | ||
Scheduled = "scheduled", | ||
ASAP = "asap", | ||
} | ||
export type OrderFulfillmentAttributesDTO = { | ||
isEcoFriendly?: boolean | ||
contactFreeDelivery?: boolean | ||
curbsidePickup?: boolean | ||
} | ||
export type OrderFulfillmentRecipientDTO = { | ||
customerId?: string | ||
firstName?: string | ||
surname?: string | ||
emailAddress?: string | ||
phoneNumber?: string | ||
address?: AddressDTO | ||
} | ||
export type AddressDTO = { | ||
@@ -94,0 +154,0 @@ line1?: string |
import axios from "axios" | ||
import { OrderInputDTO } from "./dto" | ||
import { UserContext } from "./utils" | ||
import { OrderDTO } from "./dto" | ||
@@ -13,3 +13,3 @@ type OrdersClientConfig = { | ||
async placeOrder(order: OrderInputDTO, ctx: UserContext) { | ||
async placeOrder(order: OrderDTO, ctx: UserContext) { | ||
return await axios.request({ | ||
@@ -25,5 +25,7 @@ baseURL: this.config.baseUrl, | ||
}, | ||
data: { order: order }, | ||
data: { | ||
order: order, | ||
}, | ||
}) | ||
} | ||
} |
{ | ||
"name": "@figuredev/orders-sdk", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"license": "ISC", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
1
8
4419
170
1