encode<V> static method

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

Implementation

static V encode<V>(
  SubscriptionScheduleDefaultSettings instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.applicationFeePercent != null) {
    container.encodeDouble(
      'application_fee_percent',
      instance.applicationFeePercent!,
    );
  }
  if (instance.automaticTax != null) {
    SessionAutomaticTax.encode(
      instance.automaticTax!,
      container.nestedSingleValueContainer('automatic_tax').encoder,
    );
  }
  if (instance.billingCycleAnchor != null) {
    SubscriptionSchedulesResourceDefaultSettingsBillingCycleAnchor.encode(
      instance.billingCycleAnchor!,
      container.nestedSingleValueContainer('billing_cycle_anchor').encoder,
    );
  }
  if (instance.billingThresholds != null) {
    SubscriptionScheduleBillingThresholds.encode(
      instance.billingThresholds!,
      container.nestedSingleValueContainer('billing_thresholds').encoder,
    );
  }
  if (instance.collectionMethod != null) {
    InvoiceCollectionMethod.encode(
      instance.collectionMethod!,
      container.nestedSingleValueContainer('collection_method').encoder,
    );
  }
  if (instance.defaultPaymentMethod != null) {
    container.encodeString(
      'default_payment_method',
      instance.defaultPaymentMethod!,
    );
  }
  if (instance.description != null) {
    container.encodeString(
      'description',
      instance.description!,
    );
  }
  if (instance.invoiceSettings != null) {
    SubscriptionScheduleInvoiceSettings.encode(
      instance.invoiceSettings!,
      container.nestedSingleValueContainer('invoice_settings').encoder,
    );
  }
  if (instance.onBehalfOf != null) {
    container.encodeString(
      'on_behalf_of',
      instance.onBehalfOf!,
    );
  }
  if (instance.transferData != null) {
    SessionTransferData.encode(
      instance.transferData!,
      container.nestedSingleValueContainer('transfer_data').encoder,
    );
  }
  return container.value;
}