encode<V> static method

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

Implementation

static V encode<V>(
  PaymentIntentConfirmOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.captureMethod != null) {
    PaymentIntentCaptureMethod.encode(
      instance.captureMethod!,
      container.nestedSingleValueContainer('capture_method').encoder,
    );
  }
  if (instance.confirmationToken != null) {
    container.encodeString(
      'confirmation_token',
      instance.confirmationToken!,
    );
  }
  if (instance.errorOnRequiresAction != null) {
    container.encodeBool(
      'error_on_requires_action',
      instance.errorOnRequiresAction!,
    );
  }
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.mandate != null) {
    container.encodeString(
      'mandate',
      instance.mandate!,
    );
  }
  if (instance.mandateData != null) {
    PaymentIntentConfirmOptionsMandateData.encode(
      instance.mandateData!,
      container.nestedSingleValueContainer('mandate_data').encoder,
    );
  }
  if (instance.offSession != null) {
    container.encodePrimitive(
      'off_session',
      instance.offSession!,
    );
  }
  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) {
    PaymentIntentCreateOptionsPaymentMethodOptions.encode(
      instance.paymentMethodOptions!,
      container.nestedSingleValueContainer('payment_method_options').encoder,
    );
  }
  if (instance.radarOptions != null) {
    RadarRadarOptions.encode(
      instance.radarOptions!,
      container.nestedSingleValueContainer('radar_options').encoder,
    );
  }
  if (instance.receiptEmail != null) {
    container.encodeString(
      'receipt_email',
      instance.receiptEmail!,
    );
  }
  if (instance.returnUrl != null) {
    container.encodeString(
      'return_url',
      instance.returnUrl!,
    );
  }
  if (instance.setupFutureUsage != null) {
    PaymentIntentUpdateOptionsSetupFutureUsage.encode(
      instance.setupFutureUsage!,
      container.nestedSingleValueContainer('setup_future_usage').encoder,
    );
  }
  if (instance.shipping != null) {
    ChargeCreateOptionsShipping.encode(
      instance.shipping!,
      container.nestedSingleValueContainer('shipping').encoder,
    );
  }
  if (instance.useStripeSdk != null) {
    container.encodeBool(
      'use_stripe_sdk',
      instance.useStripeSdk!,
    );
  }
  return container.value;
}