encode<V> static method

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

Implementation

static V encode<V>(
  ApiErrors instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.charge != null) {
    container.encodeString(
      'charge',
      instance.charge!,
    );
  }
  if (instance.code != null) {
    container.encodeString(
      'code',
      instance.code!,
    );
  }
  if (instance.declineCode != null) {
    container.encodeString(
      'decline_code',
      instance.declineCode!,
    );
  }
  if (instance.docUrl != null) {
    container.encodeString(
      'doc_url',
      instance.docUrl!,
    );
  }
  if (instance.message != null) {
    container.encodeString(
      'message',
      instance.message!,
    );
  }
  if (instance.param != null) {
    container.encodeString(
      'param',
      instance.param!,
    );
  }
  if (instance.paymentIntent != null) {
    PaymentIntent.encode(
      instance.paymentIntent!,
      container.nestedSingleValueContainer('payment_intent').encoder,
    );
  }
  if (instance.paymentMethod != null) {
    PaymentMethod.encode(
      instance.paymentMethod!,
      container.nestedSingleValueContainer('payment_method').encoder,
    );
  }
  if (instance.paymentMethodType != null) {
    container.encodeString(
      'payment_method_type',
      instance.paymentMethodType!,
    );
  }
  if (instance.requestLogUrl != null) {
    container.encodeString(
      'request_log_url',
      instance.requestLogUrl!,
    );
  }
  if (instance.setupIntent != null) {
    SetupIntent.encode(
      instance.setupIntent!,
      container.nestedSingleValueContainer('setup_intent').encoder,
    );
  }
  if (instance.source != null) {
    PaymentSource.encode(
      instance.source!,
      container.nestedSingleValueContainer('source').encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  return container.value;
}