Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1740 Lượt xem

How do I compute sha512 key for a new payment acquirer using the following parameters: signaturekey ; MerchantID ; u_reference ; u_amount ; u_currency. Output example should be something like this(Combined String): 

ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;M19-U-959;UPO-12345;10000;USD

Note: The combined string should be in UPPERCASE before the SHA512 hash computation like the example above.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

First import the following library in your python file,

from hashlib import sha512

now convert your parameters to uppercase using the .upper() 

key = str("%s:%s:%s:%s:%s" % (
signaturekey.upper(), MerchantID.upper(), u_reference.upper(), u_amount.upper(), u_currency.upper()))
hash = sha512(key.encode('utf-8')).hexdigest()

Now the variable hash will contain the SHA512 encrypted value for your key.


Regards


Ảnh đại diện
Huỷ bỏ
Tác giả

Hi Savya,
I tried something like this:
def _generate_sign(self):
signaturekey = 'signature',
MerchantID= 'MID',
u_reference= 'reference',
u_amount= 'amount',
u_currency= 'currency',
key = str("%s;%s;%s;%s;%s" % (signaturekey, MerchantID, u_reference, u_amount, u_currency))
shasign = sha512(key.encode('utf-8')).hexdigest()
return shasign

I get the following error:
Server Error:
We are not able to redirect you to the payment form. _generate_sign() takes 1 positional argument but 3 were given

I'm not sure if I'm doing the right thing.

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 2 24
2870
1
thg 2 24
2002
0
thg 5 21
1866
1
thg 5 25
3813
2
thg 10 23
56