create method
Future<PaymentMethodCompleteModel>
create(
- String description,
- CreditCard? data,
- bool setAsDefault,
- String? token,
- String? itemType,
Implementation
Future<PaymentMethodCompleteModel> create(
String description,
CreditCard? data,
bool setAsDefault,
String? token,
String? itemType,
) async {
Object paymentmethod;
if (data == null && token != null) {
paymentmethod = {
'description': description,
'setAsDefault': setAsDefault,
'token': token,
};
} else {
paymentmethod = {
description: description,
data: data?.toMap(),
setAsDefault: setAsDefault,
itemType: itemType,
};
}
var result = await apiResource.post(data: paymentmethod);
return PaymentMethodCompleteModel.fromMap(result);
}