createTransaction method

Future<CreateTransactionResponse> createTransaction(
  1. String wholesalerTransactionId,
  2. String cornerStoreId,
  3. double totalAmount,
  4. List<Products> products,
)

Implementation

Future<CreateTransactionResponse> createTransaction(
    String wholesalerTransactionId,
    String cornerStoreId,
    double totalAmount,
    List<Products> products) async {
  final response = await client.post('/v1/transaction', data: {
    'wholesalerTransactionId': wholesalerTransactionId,
    'cornerStoreId': cornerStoreId,
    'totalAmount': totalAmount,
    'products': products.map((product) => product.toMap()).toList(),
  });

  return CreateTransactionResponse(response.data as Map<String, dynamic>);
}