addCustomer method
Future<Customer>
addCustomer(
{ - required Customer customer,
})
Implementation
Future<Customer> addCustomer({required Customer customer}) async {
try {
final response = await _client.post(
url: '$_baseUrl/Customer/AddCustomer/businessId=$_businessId',
requestData: customer.toJson(),
user: _authService?.user,
);
if (response?.data == null) {
throw Exception('No data returned from addCustomer');
}
return Customer.fromJson(response!.data as Map<String, dynamic>);
} catch (e, st) {
_logger.error(
_caller,
'Failed to add customer',
error: e,
stackTrace: st,
);
rethrow;
}
}