mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 14:39:19 +00:00
Merge branch 'version-13-hotfix' into e-commerce-refactor
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import urllib
|
||||
from urllib.parse import quote
|
||||
import hashlib
|
||||
import hmac
|
||||
import base64
|
||||
@@ -68,8 +69,9 @@ def calc_md5(string):
|
||||
"""
|
||||
md = hashlib.md5()
|
||||
md.update(string)
|
||||
return base64.encodestring(md.digest()).strip('\n') if six.PY2 \
|
||||
else base64.encodebytes(md.digest()).decode().strip()
|
||||
return base64.encodebytes(md.digest()).decode().strip()
|
||||
|
||||
|
||||
|
||||
def remove_empty(d):
|
||||
"""
|
||||
@@ -177,7 +179,6 @@ class MWS(object):
|
||||
'SignatureMethod': 'HmacSHA256',
|
||||
}
|
||||
params.update(extra_data)
|
||||
quote = urllib.quote if six.PY2 else urllib.parse.quote
|
||||
request_description = '&'.join(['%s=%s' % (k, quote(params[k], safe='-_.~')) for k in sorted(params)])
|
||||
signature = self.calc_signature(method, request_description)
|
||||
url = '%s%s?%s&Signature=%s' % (self.domain, self.uri, request_description, quote(signature))
|
||||
|
||||
@@ -183,11 +183,11 @@ def new_bank_transaction(transaction):
|
||||
bank_account = frappe.db.get_value("Bank Account", dict(integration_id=transaction["account_id"]))
|
||||
|
||||
if float(transaction["amount"]) >= 0:
|
||||
debit = float(transaction["amount"])
|
||||
credit = 0
|
||||
else:
|
||||
debit = 0
|
||||
credit = abs(float(transaction["amount"]))
|
||||
credit = float(transaction["amount"])
|
||||
else:
|
||||
debit = abs(float(transaction["amount"]))
|
||||
credit = 0
|
||||
|
||||
status = "Pending" if transaction["pending"] == "True" else "Settled"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user