encode<V> static method

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

Implementation

static V encode<V>(
  Mandate instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  CustomerAcceptance.encode(
    instance.customerAcceptance,
    container.nestedSingleValueContainer('customer_acceptance').encoder,
  );
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  if (instance.multiUse != null) {
    MandateMultiUse.encode(
      instance.multiUse!,
      container.nestedSingleValueContainer('multi_use').encoder,
    );
  }
  container.encodeString(
    'object',
    'mandate',
  );
  if (instance.onBehalfOf != null) {
    container.encodeString(
      'on_behalf_of',
      instance.onBehalfOf!,
    );
  }
  PaymentMethodOrId.encode(
    instance.paymentMethod,
    container.nestedSingleValueContainer('payment_method').encoder,
  );
  MandatePaymentMethodDetails.encode(
    instance.paymentMethodDetails,
    container.nestedSingleValueContainer('payment_method_details').encoder,
  );
  if (instance.singleUse != null) {
    MandateSingleUse.encode(
      instance.singleUse!,
      container.nestedSingleValueContainer('single_use').encoder,
    );
  }
  AccountCapabilitiesAcssDebitPayments.encode(
    instance.status,
    container.nestedSingleValueContainer('status').encoder,
  );
  container.encodeString(
    'type',
    instance.type,
  );
  return container.value;
}