encode<V> static method

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

Implementation

static V encode<V>(
  UpcomingSubscriptionItemsItemPriceData instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeString(
    'currency',
    instance.currency,
  );
  container.encodeString(
    'product',
    instance.product,
  );
  SessionRecurring.encode(
    instance.recurring,
    container.nestedSingleValueContainer('recurring').encoder,
  );
  if (instance.taxBehavior != null) {
    ShippingRateCurrencyOptionTaxBehavior.encode(
      instance.taxBehavior!,
      container.nestedSingleValueContainer('tax_behavior').encoder,
    );
  }
  if (instance.unitAmount != null) {
    container.encodeInt(
      'unit_amount',
      instance.unitAmount!,
    );
  }
  if (instance.unitAmountDecimal != null) {
    container.encodeString(
      'unit_amount_decimal',
      instance.unitAmountDecimal!,
    );
  }
  return container.value;
}