Skip to content

Commit

Permalink
pay with cbebirr plus
Browse files Browse the repository at this point in the history
  • Loading branch information
eba-alemayehu authored Sep 15, 2023
1 parent 250a437 commit 4a584d8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions cbebirr/cbebirr.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,23 @@ def refund(thirdPartyID,

def parse_xml_to_dict(xml):
return json.dumps(xmltodict.parse(xml))["soapenv:Envelope"]["soapenv:Body"]["res:Body"]


def cbebirrplus_payment(tillCode, amount, transactionId, transactionTime, companyName, key, token, callBackURL):
payload = {
"tillCode", tillCode,
"amount", amount,
"transactionId", transactionId,
"transactionTime", transactionTime,
"companyName", companyName,
"key", key ,
"token", token,
"callBackURL", callBackURL
}
sorted_payload = dict(sorted(payload.items()))
signiture = sha256(urlencode(sorted_payload).encode('utf-8')).hexdigest()
del payload['key']
payload['signature'] = signiture
print(payload)
response = requests.post("https://cbebirrpaymentgateway.cbe.com.et:8888/auth/pay", json=payload)
return response

0 comments on commit 4a584d8

Please sign in to comment.