encode<V> static method

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

Implementation

static V encode<V>(
  PaymentIntentTypeSpecificPaymentMethodOptionsClient instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.captureMethod != null) {
    container.encodeString(
      'capture_method',
      instance.captureMethod!,
    );
  }
  if (instance.installments != null) {
    PaymentFlowsInstallmentOptions.encode(
      instance.installments!,
      container.nestedSingleValueContainer('installments').encoder,
    );
  }
  if (instance.requireCvcRecollection != null) {
    container.encodeBool(
      'require_cvc_recollection',
      instance.requireCvcRecollection!,
    );
  }
  if (instance.setupFutureUsage != null) {
    CheckoutAcssDebitPaymentMethodOptionsSetupFutureUsage.encode(
      instance.setupFutureUsage!,
      container.nestedSingleValueContainer('setup_future_usage').encoder,
    );
  }
  if (instance.verificationMethod != null) {
    CheckoutAcssDebitPaymentMethodOptionsVerificationMethod.encode(
      instance.verificationMethod!,
      container.nestedSingleValueContainer('verification_method').encoder,
    );
  }
  return container.value;
}