encode<V> static method

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

Implementation

static V encode<V>(
  PaymentIntentPaymentMethodOptionsCardInstallments instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.availablePlans != null) {
    container.encodeList(
      'available_plans',
      (container) => instance.availablePlans!
          .forEach((el) => PaymentMethodDetailsCardInstallmentsPlan.encode(
                el,
                container.nestedSingleValueContainer().encoder,
              )),
    );
  }
  container.encodeBool(
    'enabled',
    instance.enabled,
  );
  if (instance.plan != null) {
    PaymentIntentPaymentMethodOptionsCardInstallmentsPlan.encode(
      instance.plan!,
      container.nestedSingleValueContainer('plan').encoder,
    );
  }
  return container.value;
}