encode<V> static method

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

Implementation

static V encode<V>(
  FundingInstructionsBankTransferFinancialAddress instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.aba != null) {
    FundingInstructionsBankTransferAbaRecord.encode(
      instance.aba!,
      container.nestedSingleValueContainer('aba').encoder,
    );
  }
  if (instance.iban != null) {
    FundingInstructionsBankTransferIbanRecord.encode(
      instance.iban!,
      container.nestedSingleValueContainer('iban').encoder,
    );
  }
  if (instance.sortCode != null) {
    FundingInstructionsBankTransferSortCodeRecord.encode(
      instance.sortCode!,
      container.nestedSingleValueContainer('sort_code').encoder,
    );
  }
  if (instance.spei != null) {
    FundingInstructionsBankTransferSpeiRecord.encode(
      instance.spei!,
      container.nestedSingleValueContainer('spei').encoder,
    );
  }
  if (instance.supportedNetworks != null) {
    container.encodeList(
      'supported_networks',
      (container) => instance.supportedNetworks!
          .forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.swift != null) {
    FundingInstructionsBankTransferSwiftRecord.encode(
      instance.swift!,
      container.nestedSingleValueContainer('swift').encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  if (instance.zengin != null) {
    FundingInstructionsBankTransferZenginRecord.encode(
      instance.zengin!,
      container.nestedSingleValueContainer('zengin').encoder,
    );
  }
  return container.value;
}