encode<V> static method

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

Implementation

static V encode<V>(
  PaymentIntentNextAction instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.alipayHandleRedirect != null) {
    PaymentIntentNextActionAlipayHandleRedirect.encode(
      instance.alipayHandleRedirect!,
      container.nestedSingleValueContainer('alipay_handle_redirect').encoder,
    );
  }
  if (instance.boletoDisplayDetails != null) {
    PaymentIntentNextActionBoleto.encode(
      instance.boletoDisplayDetails!,
      container.nestedSingleValueContainer('boleto_display_details').encoder,
    );
  }
  if (instance.cardAwaitNotification != null) {
    PaymentIntentNextActionCardAwaitNotification.encode(
      instance.cardAwaitNotification!,
      container.nestedSingleValueContainer('card_await_notification').encoder,
    );
  }
  if (instance.cashappHandleRedirectOrDisplayQrCode != null) {
    PaymentIntentNextActionCashappHandleRedirectOrDisplayQrCode.encode(
      instance.cashappHandleRedirectOrDisplayQrCode!,
      container
          .nestedSingleValueContainer(
              'cashapp_handle_redirect_or_display_qr_code')
          .encoder,
    );
  }
  if (instance.displayBankTransferInstructions != null) {
    PaymentIntentNextActionDisplayBankTransferInstructions.encode(
      instance.displayBankTransferInstructions!,
      container
          .nestedSingleValueContainer('display_bank_transfer_instructions')
          .encoder,
    );
  }
  if (instance.konbiniDisplayDetails != null) {
    PaymentIntentNextActionKonbini.encode(
      instance.konbiniDisplayDetails!,
      container.nestedSingleValueContainer('konbini_display_details').encoder,
    );
  }
  if (instance.oxxoDisplayDetails != null) {
    PaymentIntentNextActionDisplayOxxoDetails.encode(
      instance.oxxoDisplayDetails!,
      container.nestedSingleValueContainer('oxxo_display_details').encoder,
    );
  }
  if (instance.paynowDisplayQrCode != null) {
    PaymentIntentNextActionPaynowDisplayQrCode.encode(
      instance.paynowDisplayQrCode!,
      container.nestedSingleValueContainer('paynow_display_qr_code').encoder,
    );
  }
  if (instance.pixDisplayQrCode != null) {
    PaymentIntentNextActionPixDisplayQrCode.encode(
      instance.pixDisplayQrCode!,
      container.nestedSingleValueContainer('pix_display_qr_code').encoder,
    );
  }
  if (instance.promptpayDisplayQrCode != null) {
    PaymentIntentNextActionPromptpayDisplayQrCode.encode(
      instance.promptpayDisplayQrCode!,
      container
          .nestedSingleValueContainer('promptpay_display_qr_code')
          .encoder,
    );
  }
  if (instance.redirectToUrl != null) {
    PaymentIntentNextActionRedirectToUrl.encode(
      instance.redirectToUrl!,
      container.nestedSingleValueContainer('redirect_to_url').encoder,
    );
  }
  if (instance.swishHandleRedirectOrDisplayQrCode != null) {
    PaymentIntentNextActionSwishHandleRedirectOrDisplayQrCode.encode(
      instance.swishHandleRedirectOrDisplayQrCode!,
      container
          .nestedSingleValueContainer(
              'swish_handle_redirect_or_display_qr_code')
          .encoder,
    );
  }
  container.encodeString(
    'type',
    instance.type,
  );
  if (instance.useStripeSdk != null) {
    container.encodePrimitive(
      'use_stripe_sdk',
      instance.useStripeSdk!,
    );
  }
  if (instance.verifyWithMicrodeposits != null) {
    PaymentIntentNextActionVerifyWithMicrodeposits.encode(
      instance.verifyWithMicrodeposits!,
      container
          .nestedSingleValueContainer('verify_with_microdeposits')
          .encoder,
    );
  }
  if (instance.wechatPayDisplayQrCode != null) {
    PaymentIntentNextActionWechatPayDisplayQrCode.encode(
      instance.wechatPayDisplayQrCode!,
      container
          .nestedSingleValueContainer('wechat_pay_display_qr_code')
          .encoder,
    );
  }
  if (instance.wechatPayRedirectToAndroidApp != null) {
    PaymentIntentNextActionWechatPayRedirectToAndroidApp.encode(
      instance.wechatPayRedirectToAndroidApp!,
      container
          .nestedSingleValueContainer('wechat_pay_redirect_to_android_app')
          .encoder,
    );
  }
  if (instance.wechatPayRedirectToIosApp != null) {
    PaymentIntentNextActionWechatPayRedirectToIosApp.encode(
      instance.wechatPayRedirectToIosApp!,
      container
          .nestedSingleValueContainer('wechat_pay_redirect_to_ios_app')
          .encoder,
    );
  }
  return container.value;
}