encode<V> static method

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

Implementation

static V encode<V>(
  OutboundPaymentsPaymentMethodDetails instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  TreasurySharedResourceBillingDetails.encode(
    instance.billingDetails,
    container.nestedSingleValueContainer('billing_details').encoder,
  );
  if (instance.financialAccount != null) {
    OutboundPaymentsPaymentMethodDetailsFinancialAccount.encode(
      instance.financialAccount!,
      container.nestedSingleValueContainer('financial_account').encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  if (instance.usBankAccount != null) {
    OutboundPaymentsPaymentMethodDetailsUsBankAccount.encode(
      instance.usBankAccount!,
      container.nestedSingleValueContainer('us_bank_account').encoder,
    );
  }
  return container.value;
}