15 lines
462 B
Python
15 lines
462 B
Python
from hashlib import sha256
|
|
|
|
from subscription.gateway import Gateway
|
|
|
|
|
|
def generate_signature(self):
|
|
from subscription.conf import merchant_code, merchant_key, currency
|
|
return sha256(str(
|
|
merchant_key + merchant_code + str(1) + Gateway.get_int_without_decimal(
|
|
get_int_without_decimal()) + currency).encode('utf-8')).hexdigest()
|
|
|
|
|
|
def get_int_without_decimal(number):
|
|
return str(int(number * (10 ** str(number)[::-1].find('.'))))
|