toJson method
Implementation
Map<String, dynamic> toJson() {
Map<String, dynamic> rtv = {
'memberId': memberId,
'giftCardNo': giftCardNo,
'orderId': orderId,
'numPpl': numPpl ?? 1,
'tixNo': tixNo ?? "",
'tableNo': tableNo ?? "",
'serviceType': serviceType,
'staffName': staffName,
'subtotal': subtotalInCents,
'tax': taxInCents,
'tip': tipInCents,
'disc': discInCents,
'serviceCharge': serviceChargeInCents,
'amt': amtInCents,
};
final appliedCashbackMap = appliedCashbacks.map((e) {
return {
'tranId': e.tranId,
'amtDebited': e.amtDebited,
'type': e.type
};
}).toList();
rtv["appliedCashbacks"] = appliedCashbackMap;
if(paymentByTypes != null) {
Map<String, int> transformedMap = {};
paymentByTypes!.forEach((key, value) {
transformedMap[key.toString()] = value;
});
rtv["paymentByTypes"] = transformedMap;
}
return rtv;
}