SatSale

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 7454a03a33e6ddfddf351493c4b666b6019d943a
parent e07819b7857b148b3a9d6f9187155bff7b3e1e8a
Author: nickfarrow <nicholas.w.farrow@gmail.com>
Date:   Wed, 11 Aug 2021 07:14:13 +1000

Code formatting via black

Diffstat:
Mgateways/tor.py | 2+-
Mgateways/woo_webhook.py | 10++--------
Mpayments/database.py | 1+
Msatsale.py | 4++--
4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/gateways/tor.py b/gateways/tor.py @@ -14,7 +14,7 @@ print("Using tor proxies {}".format(config.tor_proxy)) session = requests.session() session.proxies = { "http": "socks5h://{}".format(config.tor_proxy), - "https": "socks5h://{}".format(config.tor_proxy) + "https": "socks5h://{}".format(config.tor_proxy), } print( diff --git a/gateways/woo_webhook.py b/gateways/woo_webhook.py @@ -11,20 +11,14 @@ def hook(satsale_secret, invoice, order_id): # Calculate a secret that is required to send back to the # woocommerce gateway, proving we did not modify id nor amount. - secret_seed = str(int(100 * float(invoice["dollar_value"]))).encode( - "utf-8" - ) + secret_seed = str(int(100 * float(invoice["dollar_value"]))).encode("utf-8") print("Secret seed: {}".format(secret_seed)) secret = hmac.new(key, secret_seed, hashlib.sha256).hexdigest() # The main signature which proves we have paid, and very recently! paid_time = int(time.time()) - params = { - "wc-api": "wc_satsale_gateway", - "time": str(paid_time), - "id": order_id - } + params = {"wc-api": "wc_satsale_gateway", "time": str(paid_time), "id": order_id} message = (str(paid_time) + "." + json.dumps(params, separators=(",", ":"))).encode( "utf-8" ) diff --git a/payments/database.py b/payments/database.py @@ -1,5 +1,6 @@ import sqlite3 + def create_database(name="database.db"): with sqlite3.connect("database.db") as conn: print("Creating new database.db...") diff --git a/satsale.py b/satsale.py @@ -183,12 +183,12 @@ class check_payment(Resource): response.update(status) # Return whether paid or unpaid - if response['payment_complete'] == 1: + if response["payment_complete"] == 1: code = 200 else: code = 201 - return {'status': response}, code + return {"status": response}, code @api.doc(params={"uuid": "A payment uuid. Received from /createpayment."})