Commandes (Dart)
Le module StoreOrderModule permet de gérer les commandes.
Accès : applite.app.store.order
Méthodes
list
Liste toutes les commandes.
final response = await applite.app.store.order.list(
ListOrdersParams(
apiKey: 'api_key',
appId: 'app_id',
),
);
for (final order in response.data) {
print('${order.ref} - ${order.status} - ${order.total} FCFA');
}create
Crée une nouvelle commande.
final response = await applite.app.store.order.create(
CreateOrderParams(
apiKey: 'api_key',
appId: 'app_id',
customerId: 'customer_id',
sellerId: 'seller_id',
items: [
OrderItem(
productId: 'product_id',
variantId: 'variant_id',
quantity: 2,
price: 2500,
),
],
shippingTotal: 1000,
shippingAddress: Address(
street: '123 Rue Example',
city: 'Abidjan',
country: 'CI',
),
),
);
print('Commande créée: ${response.data.ref}');get
Récupère les détails d’une commande.
final response = await applite.app.store.order.get(
GetOrderParams(
apiKey: 'api_key',
appId: 'app_id',
id: 'order_id',
),
);
if (response.data != null) {
final order = response.data!;
print('Commande: ${order.ref}');
print('Client: ${order.customer?.fullname}');
print('Total: ${order.total} FCFA');
}update
Met à jour une commande.
final response = await applite.app.store.order.update(
UpdateOrderParams(
apiKey: 'api_key',
appId: 'app_id',
id: 'order_id',
status: OrderStatus.confirmed,
fulfillmentStatus: FulfillmentStatus.fulfilled,
),
);delete
Supprime une commande.
final response = await applite.app.store.order.delete(
DeleteOrderParams(
apiKey: 'api_key',
appId: 'app_id',
id: 'order_id',
),
);Types
OrderStatus
enum OrderStatus {
pending,
confirmed,
processing,
shipped,
delivered,
cancelled,
}PaymentStatus
enum PaymentStatus {
pending,
paid,
refunded,
failed,
}FulfillmentStatus
enum FulfillmentStatus {
unfulfilled,
partial,
fulfilled,
}Last updated on