encode<V> static method

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

Implementation

static V encode<V>(
  ApplicationFee instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  AccountOrId.encode(
    instance.account,
    container.nestedSingleValueContainer('account').encoder,
  );
  container.encodeInt(
    'amount',
    instance.amount,
  );
  container.encodeInt(
    'amount_refunded',
    instance.amountRefunded,
  );
  ApplicationOrId.encode(
    instance.application,
    container.nestedSingleValueContainer('application').encoder,
  );
  if (instance.balanceTransaction != null) {
    BalanceTransactionOrId.encode(
      instance.balanceTransaction!,
      container.nestedSingleValueContainer('balance_transaction').encoder,
    );
  }
  ChargeOrId.encode(
    instance.charge,
    container.nestedSingleValueContainer('charge').encoder,
  );
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'currency',
    instance.currency,
  );
  container.encodeString(
    'id',
    instance.id,
  );
  container.encodeBool(
    'livemode',
    instance.livemode,
  );
  container.encodeString(
    'object',
    'application_fee',
  );
  if (instance.originatingTransaction != null) {
    ChargeOrId.encode(
      instance.originatingTransaction!,
      container.nestedSingleValueContainer('originating_transaction').encoder,
    );
  }
  container.encodeBool(
    'refunded',
    instance.refunded,
  );
  ApplicationFeeRefunds.encode(
    instance.refunds,
    container.nestedSingleValueContainer('refunds').encoder,
  );
  return container.value;
}