Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. """ Contains payment processors for executing payments """
  2.  
  3. from abc import ABCMeta, abstractmethod
  4.  
  5. class Banking(metaclass=ABCMeta):
  6. """ Payment processor that does nothing, just logs """
  7. def __init__(self):
  8. self._logger = logging.getLogger(__name__)
  9. self._logger.setLevel(logging.INFO)
  10.  
  11. @abstractmethod
  12. def process_payment(self, destination_address, amount):
  13. """ Execute a payment to one receiving single address
  14.  
  15. return the transaction id or None """
  16. pass
  17.  
  18.  
  19. class BankingBank1(Banking):
  20. """docstring for BankingBank1"""
  21. def __init__(self, arg):
  22. super(BankingBank1, self).__init__()
  23. self.arg = arg
  24.  
  25.  
  26. def process_payment(self, destination_address, amount):
  27. """ Execute a payment to one receiving single address
  28.  
  29. return the transaction id or None """
  30. print('process payment for bank 1')
  31.  
  32.  
  33. class BankingBank2(Banking):
  34. """docstring for BankingBank1"""
  35. def __init__(self, arg):
  36. super(BankingBank2, self).__init__()
  37. self.arg = arg
  38.  
  39. try:
  40. bb2 = BankingBank2(__name__)
  41. bb2.process_payment('destination_address', 100)
  42. except TypeError as e:
  43. print('Cannot process the payment.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement