toJson method

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = {};
  data['cartId'] = cartId;
  data['intent'] = intent;
  data['billingType'] = billingType;
  data['paymentId'] = paymentId;
  data['billingToken'] = billingToken;
  if (items != null) {
    data['items'] = items!.map((v) => v.toJson()).toList();
  }
  if (amounts != null) {
    data['amounts'] = amounts!.toJson();
  }
  data['description'] = description;
  if (cancelUrl != null) {
    data['cancelUrl'] = cancelUrl!.toJson();
  }
  if (returnUrl != null) {
    data['returnUrl'] = returnUrl!.toJson();
  }
  if (total != null) {
    data['total'] = total!.toJson();
  }
  if (shippingMethods != null) {
    data['shippingMethods'] =
        shippingMethods!.map((v) => v.toJson()).toList();
  }
  if (shippingAddress != null) {
    data['shippingAddress'] = shippingAddress!.toJson();
  }
  if (billingAddress != null) {
    data['billingAddress'] = billingAddress!.toJson();
  }
  if (totalAllowedOverCaptureAmount != null) {
    data['totalAllowedOverCaptureAmount'] =
        totalAllowedOverCaptureAmount!.toJson();
  }
  return data;
}