encode<V> static method

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

Implementation

static V encode<V>(
  SetupIntentConfirmOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.confirmationToken != null) {
    container.encodeString(
      'confirmation_token',
      instance.confirmationToken!,
    );
  }
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.mandateData != null) {
    PaymentIntentConfirmOptionsMandateData.encode(
      instance.mandateData!,
      container.nestedSingleValueContainer('mandate_data').encoder,
    );
  }
  if (instance.paymentMethod != null) {
    container.encodeString(
      'payment_method',
      instance.paymentMethod!,
    );
  }
  if (instance.paymentMethodData != null) {
    PaymentIntentPaymentMethodData.encode(
      instance.paymentMethodData!,
      container.nestedSingleValueContainer('payment_method_data').encoder,
    );
  }
  if (instance.paymentMethodOptions != null) {
    SetupIntentCreateOptionsPaymentMethodOptions.encode(
      instance.paymentMethodOptions!,
      container.nestedSingleValueContainer('payment_method_options').encoder,
    );
  }
  if (instance.returnUrl != null) {
    container.encodeString(
      'return_url',
      instance.returnUrl!,
    );
  }
  if (instance.useStripeSdk != null) {
    container.encodeBool(
      'use_stripe_sdk',
      instance.useStripeSdk!,
    );
  }
  return container.value;
}