Ejemplo n.º 1
0
 def setUp(self):
     self.user = G(User)
     self.source = G(Account, primary_user=None, credit_limit=None)
     self.destination = G(Account, primary_user=None)
     self.transfer = facade.transfer(self.source, self.destination,
                                     D('100'), self.user, "Give money to customer")
     self.reverse = facade.reverse(self.transfer, self.user,
                                   "Oops! Return money")
Ejemplo n.º 2
0
 def setUp(self):
     self.user = G(User)
     self.source = G(Account, primary_user=None, credit_limit=None)
     self.destination = G(Account, primary_user=None)
     self.transfer = facade.transfer(self.source, self.destination,
                                     D('100'), user=self.user,
                                     description="Give money to customer")
     self.reverse = facade.reverse(self.transfer, self.user,
                                   description="Oops! Return money")
Ejemplo n.º 3
0
 def valid_payload(self, payload):
     to_reverse = get_object_or_404(Transfer,
                                    reference=self.kwargs['reference'])
     if not to_reverse.source.is_active():
         raise ValidationError(errors.ACCOUNT_INACTIVE)
     merchant_reference = payload.get('merchant_reference', None)
     try:
         transfer = facade.reverse(to_reverse,
                                   merchant_reference=merchant_reference)
     except exceptions.AccountException, e:
         return self.forbidden(code=errors.CANNOT_CREATE_TRANSFER,
                               msg=e.message)
Ejemplo n.º 4
0
 def valid_payload(self, payload):
     to_reverse = get_object_or_404(Transfer,
                                    reference=self.kwargs['reference'])
     if not to_reverse.source.is_active():
         raise ValidationError(errors.ACCOUNT_INACTIVE)
     merchant_reference = payload.get('merchant_reference', None)
     try:
         transfer = facade.reverse(to_reverse,
                                   merchant_reference=merchant_reference)
     except exceptions.AccountException, e:
         return self.forbidden(
             code=errors.CANNOT_CREATE_TRANSFER,
             msg=e.message)