toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['payment_method'] = paymentMethod;
  data['payment_method_title'] = paymentMethodTitle;
  data['set_paid'] = setPaid;
  data['status'] = status;
  data['currency'] = currency;
  if (customerId != null) {
    data['customer_id'] = customerId;
  }
  if (customerNote != null) {
    data['customer_note'] = customerNote;
  }
  if (parentId != null) {
    data['parent_id'] = parentId;
  }
  if (transactionId != null) {
    data['transaction_id'] = transactionId;
  }
  if (metaData != null) {
    data['meta_data'] = metaData!.map((v) => v.toJson()).toList();
  }
  if (feeLines != null) {
    data['fee_lines'] = feeLines!.map((v) => v.toJson()).toList();
  }
  if (couponLines != null) {
    data['coupon_lines'] = couponLines!.map((v) => v.toJson()).toList();
  }
  if (billing != null) {
    data['billing'] = billing!.toJson();
  }
  if (shipping != null) {
    data['shipping'] = shipping!.toJson();
  }
  if (lineItems != null) {
    data['line_items'] = lineItems!.map((v) => v.toJson()).toList();
  }
  if (shippingLines != null) {
    data['shipping_lines'] = shippingLines!.map((v) => v.toJson()).toList();
  }
  return data;
}