Example #1
0
 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}
Example #2
0
 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}
Example #3
0
 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}
Example #4
0
 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}
Example #5
0
 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}
Example #6
0
 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}
Example #7
0
 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)
Example #8
0
 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)
Example #9
0
 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}
Example #10
0
 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}