Refunds and transaction retries

Implemented refunds for transactions with status == MUST_BE_RETURN and also retry to send all failed transactions by duplicating them.