I have a payment system as shown below. The payment can be made through multiple gift coupons. The gift coupons are issued along with a purchase. The customer can make use o
Two separate transactions. If transaction 2 fails, then transaction 1 should be rolled-back.
Card is an account. Record transactions against that account. If calcuated balance (adding up all transactions) hits zero (or less, shouldn't happen) then card is 'used'- don't record 'used' in the DB though. Just derive it from the balance.