encode<V> static method

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

Implementation

static V encode<V>(
  SubscriptionSchedulesResourceDefaultSettings instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  if (instance.applicationFeePercent != null) {
    container.encodeDouble(
      'application_fee_percent',
      instance.applicationFeePercent!,
    );
  }
  if (instance.automaticTax != null) {
    SubscriptionSchedulesResourceDefaultSettingsAutomaticTax.encode(
      instance.automaticTax!,
      container.nestedSingleValueContainer('automatic_tax').encoder,
    );
  }
  container.encodeString(
    'billing_cycle_anchor',
    instance.billingCycleAnchor,
  );
  if (instance.billingThresholds != null) {
    SubscriptionBillingThresholds.encode(
      instance.billingThresholds!,
      container.nestedSingleValueContainer('billing_thresholds').encoder,
    );
  }
  if (instance.collectionMethod != null) {
    SubscriptionSchedulePhaseConfigurationCollectionMethod.encode(
      instance.collectionMethod!,
      container.nestedSingleValueContainer('collection_method').encoder,
    );
  }
  if (instance.defaultPaymentMethod != null) {
    PaymentMethodOrId.encode(
      instance.defaultPaymentMethod!,
      container.nestedSingleValueContainer('default_payment_method').encoder,
    );
  }
  if (instance.description != null) {
    container.encodeString(
      'description',
      instance.description!,
    );
  }
  InvoiceSettingSubscriptionScheduleSetting.encode(
    instance.invoiceSettings,
    container.nestedSingleValueContainer('invoice_settings').encoder,
  );
  if (instance.onBehalfOf != null) {
    AccountOrId.encode(
      instance.onBehalfOf!,
      container.nestedSingleValueContainer('on_behalf_of').encoder,
    );
  }
  if (instance.transferData != null) {
    SubscriptionTransferData.encode(
      instance.transferData!,
      container.nestedSingleValueContainer('transfer_data').encoder,
    );
  }
  return container.value;
}