amountPaid property

Decimal get amountPaid

Sum of all successful purchase leg amounts (excludes refund legs).

Implementation

Decimal get amountPaid {
  return paymentLegs
      .where((leg) => leg.isSuccess && !leg.isRefund)
      .fold(Decimal.zero, (sum, leg) => sum + leg.amount);
}