discontinuedPackage hipay has been discontinued.

toMap method

Map<String, dynamic> toMap()

Implementation

Map<String, dynamic> toMap() {
  Map<String, dynamic> data = {
    'amount': amount,
    'paymentMethod': paymentMethod.name,
    'description': description
  };
  if (customer != null) {
    data['customer'] = customer?.toMap();
  }
  if (customerId != null) {
    data['customerId'] = customerId;
  }
  if (paymentMethod == HipayPaymentMethod.pix) {
    data['pix'] = {
      'expiresIn': expiresIn.toUtc().toIso8601String(),
    };
  }
  if (splits?.isNotEmpty ?? false) {
    data['splits'] = splits?.map((x) => x.toMap()).toList();
  }
  return data;
}