encode<V> static method

V encode<V>(
  1. SourceMandateNotification instance,
  2. Encoder<V> encoder
)

Implementation

static V encode<V>(
  SourceMandateNotification instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.acssDebit != null) {
    SourceMandateNotificationAcssDebitData.encode(
      instance.acssDebit!,
      container.nestedSingleValueContainer('acss_debit').encoder,
    );
  }
  if (instance.amount != null) {
    container.encodeInt(
      'amount',
      instance.amount!,
    );
  }
  if (instance.bacsDebit != null) {
    SourceMandateNotificationBacsDebitData.encode(
      instance.bacsDebit!,
      container.nestedSingleValueContainer('bacs_debit').encoder,
    );
  }
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'source_mandate_notification',
  );
  container.encodeString(
    'reason',
    instance.reason,
  );
  if (instance.sepaDebit != null) {
    SourceMandateNotificationSepaDebitData.encode(
      instance.sepaDebit!,
      container.nestedSingleValueContainer('sepa_debit').encoder,
    );
  }
  Source.encode(
    instance.source,
    container.nestedSingleValueContainer('source').encoder,
  );
  container.encodeString(
    'status',
    instance.status,
  );
  container.encodeString(
    'type',
    instance.type,
  );
  return container.value;
}