'Generate the shasign for incoming or outgoing communications.
:param self: the self browse record. It should have a shakey in shakey out
:param string inout: \'in\' (odoo contacting payumoney) or \'out\' (payumoney
contacting odoo).
:param dict values: transaction values
:return string: shasign'

def _payumoney_generate_sign(self, inout, values):

    if (inout not in ('in', 'out')):
        raise Exception("Type    must    be    'in'    or    'out'")
    if (inout == 'in'):
        keys = 'key|txnid|amount|productinfo|firstname|email|udf1|||||||||'.split('|')
        sign = ''.join((('%s|' % (values.get(k) or '')) for k in keys))
        sign += (self.payumoney_merchant_salt or '')
    else:
        keys = '|status||||||||||udf1|email|firstname|productinfo|amount|txnid'.split('|')
        sign = ''.join((('%s|' % (values.get(k) or '')) for k in keys))
        sign = ((self.payumoney_merchant_salt + sign) + self.payumoney_merchant_key)
    shasign = hashlib.sha512(sign).hexdigest()
    return shasign
