225 lines
4.5 KiB
TypeScript

export interface DeliveryDetailsResponse {
delivery: Delivery;
}
export interface Delivery {
id: string;
orderId: string;
deliveryPartnerId: string;
deliveryNumber: string;
status: DeliveryStatus;
estimatedDistanceKm: string | null;
actualDistanceKm: string | null;
proofOfPickupKey: string | null;
proofOfDeliveryKey: string | null;
pickedUpAt: string | null;
deliveredAt: string | null;
order: DeliveryOrder;
}
export type DeliveryStatus =
| 'PENDING'
| 'ACCEPTED'
| 'ARRIVED_AT_PICKUP'
| 'OUT_FOR_DELIVERY'
| 'PICKED_UP'
| 'IN_TRANSIT'
| 'ARRIVED_AT_DROPOFF'
| 'DELIVERED'
| 'CANCELLED';
export interface DeliveryOrder {
id: string;
orderNumber: string;
customerId: string;
merchantId: string;
couponCode: string | null;
appliedPromotionId: string | null;
status: OrderStatus;
orderType: OrderType;
paymentMethodId: string;
paymentMethod: string;
currency: string;
subtotal: string;
deliveryFee: string;
platformFee: string;
serviceFee: string;
taxAmount: string;
discountAmount: string;
totalAmount: string;
pickupAddress: DeliveryAddress;
dropAddress: DeliveryAddress;
metadata: DeliveryMetadata;
version: number;
createdAt: string;
updatedAt: string;
deletedAt: string | null;
customer: DeliveryCustomer;
merchant: DeliveryMerchant;
orderItems: DeliveryOrderItem[];
}
export type OrderStatus =
| 'PLACED'
| 'CONFIRMED'
| 'PREPARING'
| 'READY_FOR_PICKUP'
| 'OUT_FOR_DELIVERY'
| 'DELIVERED'
| 'CANCELLED';
export type OrderType = 'DELIVERY' | 'PICKUP';
export interface DeliveryAddress {
city: string;
label: string | null;
phone: string;
state: string;
landmark: string;
latitude: number;
longitude: number;
postalCode: string;
houseNumber: string;
addressLine1: string;
}
export interface DeliveryMetadata {
idempotencyKey: string;
trackingHistory: TrackingHistory;
}
export interface TrackingHistory {
PLACED?: string;
CONFIRMED?: string;
PREPARING?: string;
READY_FOR_PICKUP?: string;
PICKED_UP?: string;
OUT_FOR_DELIVERY?: string;
DELIVERED?: string;
CANCELLED?: string;
}
export interface DeliveryCustomer {
id: string;
userId: string;
customerCode: string;
createdAt: string;
deletedAt: string | null;
user: DeliveryUser;
}
export interface DeliveryUser {
id: string;
name: string;
phone: string;
profileImage: string | null;
}
export interface DeliveryMerchant {
id: string;
name: string;
imageUrl: string | null;
addresses: MerchantAddress[];
}
export interface MerchantAddress {
id: string;
mapAddress: string;
latitude: string;
longitude: string;
city: string;
landmark: string;
phone: string;
}
export interface DeliveryOrderItem {
id: string;
orderId: string;
productId: string;
itemType: 'PRODUCT' | 'SERVICE';
name: string;
quantity: string;
unitPrice: string;
totalAmount: string;
attributes: Record<string, any>;
}
//pickup
export interface PickupOrderResponse {
message: string;
delivery: PickupDelivery;
}
export interface PickupDelivery {
id: string;
orderId: string;
deliveryPartnerId: string;
deliveryNumber: string;
status: DeliveryStatus;
estimatedDistanceKm: number | null;
actualDistanceKm: number | null;
proofOfPickupKey: string | null;
proofOfDeliveryKey: string | null;
pickedUpAt: string | null;
deliveredAt: string | null;
order: PickupOrder;
}
export interface PickupOrder {
id: string;
orderNumber: string;
dropAddress: DeliveryAddress;
customer: PickupCustomer;
}
export interface PickupCustomer {
id: string;
userId: string;
customerCode: string;
createdAt: string;
deletedAt: string | null;
user: PickupUser;
}
export interface PickupUser {
name: string;
phone: string;
}
//order History
export type OrderHistoryResponse = OrderHistoryItem[];
export interface OrderHistoryItem {
id: string;
orderId: string;
deliveryPartnerId: string;
deliveryNumber: string;
status: DeliveryStatus;
estimatedDistanceKm: number | null;
actualDistanceKm: string | null;
proofOfPickupKey: string | null;
proofOfDeliveryKey: string | null;
pickedUpAt: string | null;
deliveredAt: string | null;
order: OrderHistoryOrder;
}
export interface OrderHistoryOrder {
id: string;
orderNumber: string;
subtotal: string;
deliveryFee: string;
totalAmount: string;
currency: string;
pickupAddress: DeliveryAddress;
dropAddress: DeliveryAddress;
createdAt: string;
merchant: OrderHistoryMerchant;
}
export interface OrderHistoryMerchant {
id: string;
name: string;
imageUrl: string | null;
}