toMap method

Map<String, dynamic> toMap()

Implementation

Map<String, dynamic> toMap() {
  return token!.isNotEmpty
      ? {
          'source': {
            'type': "token",
            'token': token,
          },
          "amount": amount,
          'reference': reference,
          'description': description,
          'customer': customer.toMap(),
          'currency': currency,
          '3ds': {
            "enabled": is3dsEnabled,
          },
        }
      : {
          if (isPayout)
            'destination': {
              "type": "id",
              "id": cardId,
              "first_name": customer.name,
              "last_name": customer.name
            }
          else
            'source': {
              'type': "id",
              'id': cardId,
            },
          "amount": amount,
          'reference': reference,
          'description': description,
          'customer': customer.toMap(),
          'currency': currency,
          '3ds': {
            "enabled": is3dsEnabled,
          },
        };
}