-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(chowly-api-client): send order to chowly ref #2778
- Loading branch information
Showing
14 changed files
with
546 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './order.enum'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export enum DayOfWeekEnum { | ||
MONDAY = 'monday', | ||
TUESDAY = 'tuesday', | ||
WEDNESDAY = 'wednesday', | ||
THURSDAY = 'thursday', | ||
FRIDAY = 'friday', | ||
SATURDAY = 'saturday', | ||
SUNDAY = 'sunday', | ||
} | ||
|
||
export enum ServiceTypeEnum { | ||
DELIVERY = 'Delivery', | ||
PICKUP = 'Pick-Up', | ||
} | ||
|
||
export enum PaymentTypeEnum { | ||
CASH = 'cash', | ||
CREDIT = 'credit', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { ICustomer } from '../interface'; | ||
import { RetrieveInfo } from '../model'; | ||
|
||
export interface IPayload { | ||
customer: ICustomer; | ||
info: RetrieveInfo; | ||
items: IRetrieveItem[]; | ||
configuration: Record<string, any>; | ||
} | ||
|
||
export interface IRetrieveItem { | ||
id: string; | ||
'menu-item-name': string; | ||
quantity: string; | ||
price: string; | ||
'special-instructions': string; | ||
'menu-choices': string; | ||
'menu-choices-hash': IMenuChoice; | ||
'customer-name': string | null; | ||
} | ||
|
||
interface IChoice { | ||
name: string; | ||
price: number; | ||
} | ||
|
||
export type IMenuChoice = Record<string, IChoice[]>; | ||
|
||
export interface IGetOrder { | ||
order: IRetrieveOrder; | ||
} | ||
|
||
export interface IRetrieveOrder { | ||
guid: string; | ||
payload: IPayload; | ||
external_id: string; | ||
created_at: string; | ||
completed_at: string | null; | ||
error_at: string | null; | ||
error_string: string | null; | ||
ticket_payload: null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export * from './chowly.interface'; | ||
export * from './configuration.interface'; | ||
export * from './order.interface'; | ||
export * from './get-order.interface'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { DayOfWeekEnum, ServiceTypeEnum, PaymentTypeEnum } from '../enum'; | ||
import { ITimePeriod } from './chowly.interface'; | ||
|
||
export interface ICustomer { | ||
id: string; | ||
name: string; | ||
phone: string; | ||
email: string | null; | ||
address1?: string; | ||
address2: string | null; | ||
city?: string; | ||
state?: string; | ||
zip?: string; | ||
cross_street: string | null; | ||
special_instructions: string | null; | ||
} | ||
|
||
export interface IOrderInfo { | ||
id: string; | ||
scheduled_time: IScheduledTime[] | null; | ||
pickup_code: string | null; | ||
service_type: ServiceTypeEnum; | ||
payment_is_cash: boolean; | ||
payment_type: PaymentTypeEnum; | ||
tip_payment_is_cash: boolean; | ||
tip_payment_type: PaymentTypeEnum; | ||
subtotal: string; | ||
delivery_charge: string; | ||
sales_tax: string; | ||
tip: string; | ||
total: string; | ||
coupon_description: string | null; | ||
coupon_amount?: string; | ||
} | ||
|
||
export interface IOrderItem { | ||
id: string; | ||
name: string; | ||
external_id: string | null; | ||
price: string; | ||
quantity: string; | ||
notes: string | null; | ||
mods: IMod[]; | ||
} | ||
|
||
export interface IMod { | ||
id: string; | ||
name: string; | ||
category: string | null; | ||
external_id: string | null; | ||
price: string; | ||
quantity: string; | ||
} | ||
|
||
export interface ICreateOrder { | ||
customer: ICustomer; | ||
info: IOrderInfo; | ||
items: IOrderItem[]; | ||
id?: string; | ||
} | ||
|
||
export interface IScheduledTime { | ||
time_periods: ITimePeriod[]; | ||
enabled: boolean; | ||
day_of_week: DayOfWeekEnum; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { IOrderInfo, ICustomer, IOrderItem, IScheduledTime, IMod, ICreateOrder } from '../interface'; | ||
import { ServiceTypeEnum, PaymentTypeEnum } from '../enum'; | ||
|
||
export class Order implements ICreateOrder { | ||
customer: Customer; | ||
info: Info; | ||
items: ItemOrder[]; | ||
id: string; | ||
} | ||
|
||
export class Customer implements ICustomer { | ||
id: string; | ||
name: string; | ||
phone: string; | ||
email: string | null; | ||
address1?: string; | ||
address2: string | null; | ||
city?: string; | ||
state?: string; | ||
zip?: string; | ||
cross_street: string | null; | ||
special_instructions: string | null; | ||
} | ||
|
||
export class Info implements IOrderInfo { | ||
id: string; | ||
scheduled_time: IScheduledTime[] | null; | ||
pickup_code: string | null; | ||
service_type: ServiceTypeEnum; | ||
payment_is_cash: boolean; | ||
payment_type: PaymentTypeEnum; | ||
tip_payment_is_cash: boolean; | ||
tip_payment_type: PaymentTypeEnum; | ||
subtotal: string; | ||
delivery_charge: string; | ||
sales_tax: string; | ||
tip: string; | ||
total: string; | ||
coupon_description: string | null; | ||
coupon_amount?: string; | ||
} | ||
|
||
export class ItemOrder implements IOrderItem { | ||
id: string; | ||
name: string; | ||
external_id: string | null; | ||
price: string; | ||
quantity: string; | ||
notes: string | null; | ||
mods: Mods[]; | ||
} | ||
|
||
export class Mods implements IMod { | ||
id: string; | ||
name: string; | ||
category: string | null; | ||
external_id: string | null; | ||
price: string; | ||
quantity: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { IGetOrder, IPayload, IRetrieveItem, IRetrieveOrder, IMenuChoice } from '../interface'; | ||
import { ServiceTypeEnum, PaymentTypeEnum } from '../enum'; | ||
import { Customer } from './create-order.model'; | ||
|
||
export class ReadOrder implements IGetOrder { | ||
order: RetrieveOrder; | ||
} | ||
class RetrieveOrder implements IRetrieveOrder { | ||
guid: string; | ||
payload: Payload; | ||
external_id: string; | ||
created_at: string; | ||
completed_at: string | null; | ||
error_at: string | null; | ||
error_string: string | null; | ||
ticket_payload: null; | ||
} | ||
|
||
export class Payload implements IPayload { | ||
customer: Customer; | ||
info: RetrieveInfo; | ||
items: RetrieveItems[]; | ||
configuration: Record<string, any>; | ||
} | ||
|
||
export class RetrieveInfo { | ||
'order-id': string; | ||
'special-notes2': string; | ||
'service-type': ServiceTypeEnum; | ||
'payment-is-cash': string; | ||
'tip-payment-is-cash': string; | ||
'payment-type': PaymentTypeEnum; | ||
'tip-payment-type': PaymentTypeEnum; | ||
subtotal: number; | ||
'delivery-charge': number; | ||
'sales-tax': number; | ||
tax_exempt: null; | ||
tip: number; | ||
total: number; | ||
is_future: string; | ||
future_at: string; | ||
placed_at: string; | ||
'coupon-description': string; | ||
'coupon-amount': number; | ||
} | ||
|
||
export class RetrieveItems implements IRetrieveItem { | ||
id: string; | ||
'menu-item-name': string; | ||
quantity: string; | ||
price: string; | ||
'special-instructions': string; | ||
'menu-choices': string; | ||
'menu-choices-hash': IMenuChoice; | ||
'customer-name': string | null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from './chowly.model'; | ||
export * from './create-order.model'; | ||
export * from './get-order.model'; |
Oops, something went wrong.