encode<V> static method

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

Implementation

static V encode<V>(
  InvoiceTaxAmount instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeInt(
    'amount',
    instance.amount,
  );
  container.encodeBool(
    'inclusive',
    instance.inclusive,
  );
  TaxRateOrId.encode(
    instance.taxRate,
    container.nestedSingleValueContainer('tax_rate').encoder,
  );
  if (instance.taxabilityReason != null) {
    CreditNoteTaxAmountTaxabilityReason.encode(
      instance.taxabilityReason!,
      container.nestedSingleValueContainer('taxability_reason').encoder,
    );
  }
  if (instance.taxableAmount != null) {
    container.encodeInt(
      'taxable_amount',
      instance.taxableAmount!,
    );
  }
  return container.value;
}