'Given a data dict coming from payumoney, verify it and find the related
transaction record.'

@api.model
def _payumoney_form_get_tx_from_data(self, data):

    reference = data.get('txnid')
    pay_id = data.get('mihpayid')
    shasign = data.get('hash')
    if ((not reference) or (not pay_id) or (not shasign)):
        raise ValidationError((_('PayUmoney:    received    data    with    missing    reference    (%s)    or    pay_id    (%s)    or    shashign    (%s)') % (reference, pay_id, shasign)))
    transaction = self.search([('reference', '=', reference)])
    if (not transaction):
        error_msg = (_('PayUmoney:    received    data    for    reference    %s;    no    order    found') % reference)
        raise ValidationError(error_msg)
    elif (len(transaction) > 1):
        error_msg = (_('PayUmoney:    received    data    for    reference    %s;    multiple    orders    found') % reference)
        raise ValidationError(error_msg)
    shasign_check = transaction.acquirer_id._payumoney_generate_sign('out', data)
    if (shasign_check.upper() != shasign.upper()):
        raise ValidationError((_('PayUmoney:    invalid    shasign,    received    %s,    computed    %s,    for    data    %s') % (shasign, shasign_check, data)))
    return transaction
