Current location - Quotes Website - Personality signature - Python uses card swiping according to category columns
Python uses card swiping according to category columns

Writing a credit card payment tool class

1: The auxiliary function generates a WeChat payment signature according to the algorithm

:param cr:

:param uid:

:param para:

:param context:

:return:

'''

keylist = list(para.keys())

keylist.sort()

s = ' for i in range(len(keylist)):

s += str(keylist[i]) + '=' + str(para[ylist[i]])

if i != len(keylist) - 1:

s += '&'

s += '&key=' + key

signmd5 = hashlib.md5()

signmd5.update(s)

sign = (signmd5.hexdigest()).upper()

return sign

2: Submit card payment 3: Query the payment result according to the order number< /p>