encode<V> static method

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

Implementation

static V encode<V>(
  FeeRefund instance,
  Encoder<V> encoder,
) {
  final container = encoder.container<String>();
  container.encodeInt(
    'amount',
    instance.amount,
  );
  if (instance.balanceTransaction != null) {
    BalanceTransactionOrId.encode(
      instance.balanceTransaction!,
      container.nestedSingleValueContainer('balance_transaction').encoder,
    );
  }
  container.encodeDateTime(
    'created',
    instance.created,
  );
  container.encodeString(
    'currency',
    instance.currency,
  );
  ApplicationFeeOrId.encode(
    instance.fee,
    container.nestedSingleValueContainer('fee').encoder,
  );
  container.encodeString(
    'id',
    instance.id,
  );
  if (instance.metadata != null) {
    container.encodeMap(
      'metadata',
      (container) => instance.metadata!.forEach((
        key,
        value,
      ) =>
          container.encodeString(
            key,
            value,
          )),
    );
  }
  container.encodeString(
    'object',
    'fee_refund',
  );
  return container.value;
}