def credit(self, money, identification, options=None): from samurai.transaction import Transaction trans = Transaction.find(identification) if not trans.errors: new_trans = trans.credit(money) return{'status': "SUCCESS", "response": new_trans} else: return{"status": "FAILURE", "response": trans.errors}
def credit(self, money, identification, options=None): from samurai.transaction import Transaction trans = Transaction.find(identification) if not trans.errors: new_trans = trans.credit(money) return {'status': "SUCCESS", "response": new_trans} else: return {"status": "FAILURE", "response": trans.errors}
def credit(self, money, identification, options=None): trans = Transaction.find(identification) if not trans.errors: new_trans = trans.reverse(money) transaction_was_successful.send(sender=self, type="credit", response=trans) return{'status': "SUCCESS", "response": new_trans} transaction_was_unsuccessful.send(sender=self, type="credit", response=trans) return{"status": "FAILURE", "response": trans}
def void(self, identification, options=None): trans = Transaction.find(identification) if not trans.errors: new_trans = trans.void() transaction_was_successful.send(sender=self, type="void", response=trans) return{'status': "SUCCESS", "response": new_trans} transaction_was_unsuccessful.send(sender=self, type="void", response=trans) return{"status": "FAILURE", "response": trans}
def credit(self, money, identification, options=None): trans = Transaction.find(identification) if not trans.errors: new_trans = trans.reverse(money) transaction_was_successful.send(sender=self, type="credit", response=trans) return {'status': "SUCCESS", "response": new_trans} transaction_was_unsuccessful.send(sender=self, type="credit", response=trans) return {"status": "FAILURE", "response": trans}
def void(self, identification, options=None): trans = Transaction.find(identification) if not trans.errors: new_trans = trans.void() transaction_was_successful.send(sender=self, type="void", response=trans) return {'status': "SUCCESS", "response": new_trans} transaction_was_unsuccessful.send(sender=self, type="void", response=trans) return {"status": "FAILURE", "response": trans}
def credit(self, amount, trans_id): txn = Transaction.find(trans_id) if txn.errors: raise GatewayError('Problem fetching transaction: %s' % txn.errors[txn.error_messages[0]['context']][0]) else: # start the timer start = time.time() response = txn.reverse(amount) # measure time end = time.time() # done timing it response_time = '%0.2f' % (end-start) # return parsed response return self.parse(response, response_time)
def credit(self, money, identification, options=None): trans = Transaction.find(identification) if not trans.errors: new_trans = trans.reverse(money) return{'status': "SUCCESS", "response": new_trans} return{"status": "FAILURE", "response": trans}
def void(self, identification, options=None): trans = Transaction.find(identification) if not trans.errors: new_trans = trans.void() return{'status': "SUCCESS", "response": new_trans} return{"status": "FAILURE", "response": trans}