'Method that should be called by the server when receiving an update
for a transaction. State at this point :
- UDPATE ME'

@http.route('/shop/payment/validate', type='http', auth='public', website=True)
def payment_validate(self, transaction_id=None, sale_order_id=None, **post):

    if (transaction_id is None):
        tx = request.website.sale_get_transaction()
    else:
        tx = request.env['payment.transaction'].browse(transaction_id)
    if (sale_order_id is None):
        order = request.website.sale_get_order()
    else:
        order = request.env['sale.order'].sudo().browse(sale_order_id)
        assert (order.id == request.session.get('sale_last_order_id'))
    if ((not order) or (order.amount_total and (not tx))):
        return request.redirect('/shop')
    if (((not order.amount_total) and (not tx)) or (tx.state in ['pending', 'done', 'authorized'])):
        if ((not order.amount_total) and (not tx)):
            order.with_context(send_email=True).action_confirm()
    elif (tx and (tx.state == 'cancel')):
        order.action_cancel()
    request.website.sale_reset()
    if (tx and (tx.state == 'draft')):
        return request.redirect('/shop')
    return request.redirect('/shop/confirmation')
