encode<V> static method

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

Implementation

static V encode<V>(
  TerminalReaderProcessSetupIntentOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeBool(
    'customer_consent_collected',
    instance.customerConsentCollected,
  );
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.processConfig != null) {
    TerminalReaderReaderResourceRefundPaymentConfig.encode(
      instance.processConfig!,
      container.nestedSingleValueContainer('process_config').encoder,
    );
  }
  container.encodeString(
    'setup_intent',
    instance.setupIntent,
  );
  return container.value;
}