Motivation
The flow of order processing is such that when a dna sample is rejected, then Event::OrderFailed will be emitted.
Currently the Order.status is not yet updated to OrderStatus::Failed, but the plan is to do that.
Then the escrow will do the refund in the ethereum network.
In this case, the refund_order extrinsic have to be called separately by escrow backend to update Order.status to OrderStatus::Refunded.
Now, the Order.status will change from OrderStatus::Failed to OrderStatus::Refunded.
Since all failed orders will be refunded, maybe we only need one of the 2 statuses.
Suggested Solution
Remove the refund_order extrinsic. update the Order.status to OrderStatus::Failed on DnaSampleRejected event.
Also, because the payment is done in the ethereum network and escrow backend (in the future might be a smart contract), maybe there is no need to mark the Order.status to OrderStatus::Refunded, rather Order.status = OrderStatus::Failed is sufficient
Alternatives
Just an idea..
Keep the refund_order extrinsic and OrderStatus::Refunded enum.
Have 2 status fields on Order struct. Order.fulfillment_status and Order.payment_status.
Order.fulfillment_status -> Failed / Fulfilled / OnProgress
Order.payment_status -> Unpaid / Paid / Refunded