encode<V> static method

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

Implementation

static V encode<V>(
  PaymentIntentUpdateOptions instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.amount != null) {
    container.encodeInt(
      'amount',
      instance.amount!,
    );
  }
  if (instance.applicationFeeAmount != null) {
    container.encodeInt(
      'application_fee_amount',
      instance.applicationFeeAmount!,
    );
  }
  if (instance.captureMethod != null) {
    PaymentIntentCaptureMethod.encode(
      instance.captureMethod!,
      container.nestedSingleValueContainer('capture_method').encoder,
    );
  }
  if (instance.currency != null) {
    container.encodeString(
      'currency',
      instance.currency!,
    );
  }
  if (instance.customer != null) {
    container.encodeString(
      'customer',
      instance.customer!,
    );
  }
  if (instance.description != null) {
    container.encodeString(
      'description',
      instance.description!,
    );
  }
  if (instance.expand != null) {
    container.encodeList(
      'expand',
      (container) =>
          instance.expand!.forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.metadata != null) {
    container.encodeMap(
      'metadata',
      (container) => instance.metadata!.forEach((
        key,
        value,
      ) =>
          container.encodeString(
            key,
            value,
          )),
    );
  }
  if (instance.paymentMethod != null) {
    container.encodeString(
      'payment_method',
      instance.paymentMethod!,
    );
  }
  if (instance.paymentMethodConfiguration != null) {
    container.encodeString(
      'payment_method_configuration',
      instance.paymentMethodConfiguration!,
    );
  }
  if (instance.paymentMethodData != null) {
    PaymentIntentPaymentMethodData.encode(
      instance.paymentMethodData!,
      container.nestedSingleValueContainer('payment_method_data').encoder,
    );
  }
  if (instance.paymentMethodOptions != null) {
    PaymentIntentCreateOptionsPaymentMethodOptions.encode(
      instance.paymentMethodOptions!,
      container.nestedSingleValueContainer('payment_method_options').encoder,
    );
  }
  if (instance.paymentMethodTypes != null) {
    container.encodeList(
      'payment_method_types',
      (container) => instance.paymentMethodTypes!
          .forEach((el) => container.encodeString(el)),
    );
  }
  if (instance.receiptEmail != null) {
    container.encodeString(
      'receipt_email',
      instance.receiptEmail!,
    );
  }
  if (instance.setupFutureUsage != null) {
    container.encodeString(
      'setup_future_usage',
      instance.setupFutureUsage!,
    );
  }
  if (instance.shipping != null) {
    ChargeCreateOptionsShipping.encode(
      instance.shipping!,
      container.nestedSingleValueContainer('shipping').encoder,
    );
  }
  if (instance.statementDescriptor != null) {
    container.encodeString(
      'statement_descriptor',
      instance.statementDescriptor!,
    );
  }
  if (instance.statementDescriptorSuffix != null) {
    container.encodeString(
      'statement_descriptor_suffix',
      instance.statementDescriptorSuffix!,
    );
  }
  if (instance.transferData != null) {
    PaymentFlowsAmountDetailsResourceTip.encode(
      instance.transferData!,
      container.nestedSingleValueContainer('transfer_data').encoder,
    );
  }
  if (instance.transferGroup != null) {
    container.encodeString(
      'transfer_group',
      instance.transferGroup!,
    );
  }
  return container.value;
}