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

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

    data = self._sips_data_to_object(data.get('Data'))
    reference = data.get('transactionReference')
    if (not reference):
        custom = json.loads((data.pop('returnContext', False) or '{}'))
        reference = custom.get('reference')
    payment_tx = self.search([('reference', '=', reference)])
    if ((not payment_tx) or (len(payment_tx) > 1)):
        error_msg = (_('Sips:    received    data    for    reference    %s') % reference)
        if (not payment_tx):
            error_msg += _(';    no    order    found')
        else:
            error_msg += _(';    multiple    order    found')
        _logger.error(error_msg)
        raise ValidationError(error_msg)
    return payment_tx
