status), ctx, _) if userId == transaction.creator => status match { case PaymentInfoStatus.Approved => ctx.thenPersist(PaymentApproved(transaction.itemId))(_ => ctx.reply(Done)) case PaymentInfoStatus.Rejected => ctx.thenPersist(PaymentRejected(transaction.itemId))(_ => ctx.reply(Done)) } case (_, ctx, _) => ctx.invalidCommand("Only the auction creator can submit payment status") ctx.done } .onEvent { case (PaymentApproved(_), _) => Some(transaction.updateStatus(PaymentConfirmed)) case (PaymentRejected(_), _) => Some(transaction.updateStatus(PaymentPending)) }