encode<V> static method

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

Implementation

static V encode<V>(
  PaymentMethodOptionsPaypal instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.captureMethod != null) {
    container.encodeString(
      'capture_method',
      'manual',
    );
  }
  if (instance.preferredLocale != null) {
    container.encodeString(
      'preferred_locale',
      instance.preferredLocale!,
    );
  }
  if (instance.reference != null) {
    container.encodeString(
      'reference',
      instance.reference!,
    );
  }
  if (instance.setupFutureUsage != null) {
    CheckoutLinkPaymentMethodOptionsSetupFutureUsage.encode(
      instance.setupFutureUsage!,
      container.nestedSingleValueContainer('setup_future_usage').encoder,
    );
  }
  return container.value;
}