encode<V> static method

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

Implementation

static V encode<V>(
  InvoicePayOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.forgive != null) {
    container.encodeBool(
      'forgive',
      instance.forgive!,
    );
  }
  if (instance.mandate != null) {
    container.encodeString(
      'mandate',
      instance.mandate!,
    );
  }
  if (instance.offSession != null) {
    container.encodeBool(
      'off_session',
      instance.offSession!,
    );
  }
  if (instance.paidOutOfBand != null) {
    container.encodeBool(
      'paid_out_of_band',
      instance.paidOutOfBand!,
    );
  }
  if (instance.paymentMethod != null) {
    container.encodeString(
      'payment_method',
      instance.paymentMethod!,
    );
  }
  if (instance.source != null) {
    container.encodeString(
      'source',
      instance.source!,
    );
  }
  return container.value;
}