encode<V> static method

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

Implementation

static V encode<V>(
  PaymentIntentCard instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.captureMethod != null) {
    SessionCaptureMethod.encode(
      instance.captureMethod!,
      container.nestedSingleValueContainer('capture_method').encoder,
    );
  }
  if (instance.cvcToken != null) {
    container.encodeString(
      'cvc_token',
      instance.cvcToken!,
    );
  }
  if (instance.installments != null) {
    InvoiceInstallments.encode(
      instance.installments!,
      container.nestedSingleValueContainer('installments').encoder,
    );
  }
  if (instance.mandateOptions != null) {
    PaymentIntentCardMandateOptions.encode(
      instance.mandateOptions!,
      container.nestedSingleValueContainer('mandate_options').encoder,
    );
  }
  if (instance.moto != null) {
    container.encodeBool(
      'moto',
      instance.moto!,
    );
  }
  if (instance.network != null) {
    container.encodeString(
      'network',
      instance.network!,
    );
  }
  if (instance.requestExtendedAuthorization != null) {
    PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization.encode(
      instance.requestExtendedAuthorization!,
      container
          .nestedSingleValueContainer('request_extended_authorization')
          .encoder,
    );
  }
  if (instance.requestIncrementalAuthorization != null) {
    PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization.encode(
      instance.requestIncrementalAuthorization!,
      container
          .nestedSingleValueContainer('request_incremental_authorization')
          .encoder,
    );
  }
  if (instance.requestMulticapture != null) {
    PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization.encode(
      instance.requestMulticapture!,
      container.nestedSingleValueContainer('request_multicapture').encoder,
    );
  }
  if (instance.requestOvercapture != null) {
    PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization.encode(
      instance.requestOvercapture!,
      container.nestedSingleValueContainer('request_overcapture').encoder,
    );
  }
  if (instance.requestThreeDSecure != null) {
    CheckoutCardPaymentMethodOptionsRequestThreeDSecure.encode(
      instance.requestThreeDSecure!,
      container.nestedSingleValueContainer('request_three_d_secure').encoder,
    );
  }
  if (instance.requireCvcRecollection != null) {
    container.encodeBool(
      'require_cvc_recollection',
      instance.requireCvcRecollection!,
    );
  }
  if (instance.setupFutureUsage != null) {
    PaymentIntentSetupFutureUsage.encode(
      instance.setupFutureUsage!,
      container.nestedSingleValueContainer('setup_future_usage').encoder,
    );
  }
  if (instance.statementDescriptorSuffixKana != null) {
    container.encodeString(
      'statement_descriptor_suffix_kana',
      instance.statementDescriptorSuffixKana!,
    );
  }
  if (instance.statementDescriptorSuffixKanji != null) {
    container.encodeString(
      'statement_descriptor_suffix_kanji',
      instance.statementDescriptorSuffixKanji!,
    );
  }
  if (instance.threeDSecure != null) {
    PaymentIntentThreeDSecure.encode(
      instance.threeDSecure!,
      container.nestedSingleValueContainer('three_d_secure').encoder,
    );
  }
  return container.value;
}