ze-seller-order-domain
v3.16.0
Published
## Documentation
Downloads
3
Readme
Getting Started
Documentation
Click here here to check the documentation.
Installation
Install using npm:
npm install -D git+https://github.com/ZXVentures/ze-seller-order-domain.git#<version>
Dependencies
This project is using a modified version of the https://github.com/mongoosejs/mongoose-lean-getters module.
Example
Order
type
import {
Address,
Charging,
Consumer,
Delivery,
DeliveryType,
Item,
Order,
OrderStatus,
Payment,
PaymentCategory,
PaymentType,
Rating,
Seller,
State,
StatusHistory,
} from 'ze-seller-order-domain'
const charging: Charging = {
change: 5.0,
shippingFee: 4.99,
subTotal: 15.99,
total: 20.99,
totalOffer: 0.31,
coupon: {
code: 'BEBIDA_10',
total: 10,
description: 'Cuponzinho para bebida',
},
cashback: 2.0,
discount: 12.0,
totalSamplingsPrice: 0.01,
}
const consumer: Consumer = {
document: '111.111.111-11',
firstName: 'Zé',
lastName: 'Delivery',
phone: '+5511999999999',
email: '[email protected]',
deliveredOrders: 91,
}
const address: Address = {
city: 'São Paulo',
zip: '04000000',
location: {
type: 'Point',
coordinates: [0, 1],
},
neighborhood: 'Pinheiros',
number: '529',
state: 'SP',
street: 'Rua Fradique Coutinho',
complement: 'Ao lado do metrô',
}
const courier: Courier = {
email: '[email protected]',
}
const delivery: Delivery = {
address,
type: DeliveryType.PICKUP,
courier,
shippingDetails: {
startDate: new Date().toISOString(),
endDate: new Date().toISOString(),
},
}
const items: Item[] = [
{
id: 132,
externalId: 132,
image: 'https://picture.com/image.png',
isRgb: false,
name: 'Bebida Láctea 330ml',
price: 1.32,
productId: 98,
quantity: 3,
subTotal: 3.96,
total: 3.96,
totalOffer: 0,
description: 'Geladinha',
samplingId: 'b2380c77-6c19-44ce-9c98-a427c1704f1b',
},
]
const payments: Payment[] = [
{
category: PaymentCategory.ON_DELIVERY,
type: PaymentType.CASH,
},
]
const statusHistory: StatusHistory[] = [
{
id: 1,
date: new Date().toISOString(),
status: OrderStatus.CS_CANCELLEDOC,
createdBy: '[email protected]',
description: 'Cancelado por X',
reasons: ['ATRASADO'],
},
]
const rating: Rating = {
date: new Date().toISOString(),
value: 3,
description: 'Bebida quente',
reasons: ['WARM_DRINK'],
}
const seller: Seller = {
id: 1,
}
export const order: Order = {
id: 90381,
charging,
consumer,
date: new Date().toISOString(),
seller,
delivery,
items,
number: '011231238',
payments,
status: OrderStatus.CS_CANCELLEDOC,
state: State.PENDING,
statusHistory,
description: 'Por favor, trazer sacola',
rating,
expireDate: new Date().toISOString(),
orderedAvailablePocs: [32],
completedDate: new Date().toISOString() | null,
}