Ejemplo n.º 1
0
 def __init__(self, event_dto: EventDTO):
     try:
         self.destination = AccountRepository.find_by_id(
             event_dto.destination)
     except AccountNotFound:
         self.destination = AccountRepository.create(event_dto.destination)
     self.amount = event_dto.amount
Ejemplo n.º 2
0
 def execute():
     AccountRepository.reset()
Ejemplo n.º 3
0
 def execute(self):
     self.origin.balance = self.origin.balance - self.amount
     self.destination.balance = self.destination.balance + self.amount
     AccountRepository.save(self.origin)
     AccountRepository.save(self.destination)
     return self.respond(origin=self.origin, destination=self.destination)
Ejemplo n.º 4
0
 def execute(self):
     self.origin.balance = self.origin.balance - self.amount
     AccountRepository.save(self.origin)
     return self.respond(origin=self.origin)
Ejemplo n.º 5
0
 def __init__(self, event_dto: EventDTO):
     self.origin = AccountRepository.find_by_id(event_dto.origin)
     self.amount = event_dto.amount
Ejemplo n.º 6
0
 def execute(self):
     self.destination.balance = self.destination.balance + self.amount
     AccountRepository.save(self.destination)
     return self.respond(destination=self.destination)
Ejemplo n.º 7
0
 def get(account_id: str):
     account = AccountRepository.find_by_id(account_id)
     return account.balance