encode<V> static method

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

Implementation

static V encode<V>(
  TreasuryTransactionFlowDetails instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.creditReversal != null) {
    TreasuryCreditReversal.encode(
      instance.creditReversal!,
      container.nestedSingleValueContainer('credit_reversal').encoder,
    );
  }
  if (instance.debitReversal != null) {
    TreasuryDebitReversal.encode(
      instance.debitReversal!,
      container.nestedSingleValueContainer('debit_reversal').encoder,
    );
  }
  if (instance.inboundTransfer != null) {
    TreasuryInboundTransfer.encode(
      instance.inboundTransfer!,
      container.nestedSingleValueContainer('inbound_transfer').encoder,
    );
  }
  if (instance.issuingAuthorization != null) {
    IssuingAuthorization.encode(
      instance.issuingAuthorization!,
      container.nestedSingleValueContainer('issuing_authorization').encoder,
    );
  }
  if (instance.outboundPayment != null) {
    TreasuryOutboundPayment.encode(
      instance.outboundPayment!,
      container.nestedSingleValueContainer('outbound_payment').encoder,
    );
  }
  if (instance.outboundTransfer != null) {
    TreasuryOutboundTransfer.encode(
      instance.outboundTransfer!,
      container.nestedSingleValueContainer('outbound_transfer').encoder,
    );
  }
  if (instance.receivedCredit != null) {
    TreasuryReceivedCredit.encode(
      instance.receivedCredit!,
      container.nestedSingleValueContainer('received_credit').encoder,
    );
  }
  if (instance.receivedDebit != null) {
    TreasuryReceivedDebit.encode(
      instance.receivedDebit!,
      container.nestedSingleValueContainer('received_debit').encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  return container.value;
}