diff --git a/README.md b/README.md index acd97d90a3b56519a83066d7ed7adf274a6c1ef6..40b932bccb339b4d4bde41122eb2df27c2b69a77 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,16 @@ Stuff to do - Automatic member account creation in Active Directory (after membership approved) - Validating student numbers in ID field (also via email) - Add dispense account balance online with Square paymentform +- Mailing list subscription management +- Change first name & last name to just "Real Name" + - then change display name to "Preferred name" + - delete sn & firstName attributes in AD +- Remove display name as editable field or make it only editable once it syncs with AD +- Actions to rightmost column +- Redirect to changelist +- Add reject membership button to admin actions +- Remove admin site banner / header & change colour scheme +- Pending memberships badge on admin index Workflow Design --------------- diff --git a/src/squarepay/dispense.py b/src/squarepay/dispense.py index 9cd4d089f73223583b637ccba4004e137ee5be2d..fbce946c21781aeb4ab90fd60527ed758afbf57e 100644 --- a/src/squarepay/dispense.py +++ b/src/squarepay/dispense.py @@ -15,6 +15,7 @@ if DISPENSE_BIN is None: log.warning("DISPENSE_BIN is not defined! Lookups for prices will fallback to weird numbers (for testing)!") def run_dispense(*args): +<<<<<<< HEAD if DISPENSE_BIN is None: return None @@ -63,3 +64,39 @@ def set_dispense_flag(user, flag, reason): log.warning("set_dispense_flag: user was not updated with error: " + out) return False; return True; +======= + if DISPENSE_BIN is None: + return None + + cmd = (DISPENSE_BIN, ) + args + log.info("run_dispense: " + str(cmd)) + try: + # get a string containing the output of the program + res = subprocess.check_output(cmd, timeout=4, universal_newlines=True) + except CalledProcessError as e: + log.warning("dispense returned error code %d, output: '%s'" % (e.returncode, e.output)) + return None + except TimeoutExpired as e: + log.error(e) + return None + return res + +def get_item_price(itemid): + """ gets the price of the given dispense item in cents """ + if (itemid is None or itemid == ""): + return None + if DISPENSE_BIN is None: + return 2223 + + out = run_dispense('iteminfo', itemid) + if out is None: + return None + + s = out.split() # get something like ['pseudo:7', '25.00', 'membership', '(non-student', 'and', 'non-guild)'] + if (s[0] != itemid): + log.warning("get_item_price: got result for incorrect item: %s" + s) + return None + else: + # return the price as a number of cents + return int(float(s[1]) * 100) +>>>>>>> origin/frekk-testing