create method
dynamic
create({})
Implementation
create({
required bool testMode,
required String apiKey,
required String customerId,
required void Function(Map<String, dynamic>) onError,
required void Function(CreateCustomerModel data) onDone,
}) async {
final String url = testMode
? 'https://uatcheckout.thawani.om/api/v1/customers'
: 'https://checkout.thawani.om/api/v1/customers';
await Request.post(url: url, data: {
'client_customer_id': customerId
}, headers: {
'Content-Type': "application/json",
'thawani-api-key': apiKey
}).then((value) {
// print(value);
if (value['status'] == 200) {
onDone(CreateCustomerModel.fromJson(value['data']));
} else {
onError(value);
}
});
}