add skeleton
This commit is contained in:
21
services.py
Normal file
21
services.py
Normal file
@@ -0,0 +1,21 @@
|
||||
class InvoiceService:
|
||||
def create_invoice(self) -> str:
|
||||
return "invoice created by service"
|
||||
|
||||
|
||||
class EmailService:
|
||||
def send(self, receiver, invoice) -> None:
|
||||
print(f'e-mail service is sending "{invoice}" to "{receiver}"')
|
||||
|
||||
|
||||
class BusinessLogic:
|
||||
def __init__(self, invoice: InvoiceService, email: EmailService) -> None:
|
||||
self.email_service = email
|
||||
self.invoice_service = invoice
|
||||
|
||||
def send(self, email_address) -> None:
|
||||
print('create invoice')
|
||||
invoice = self.invoice_service.create_invoice()
|
||||
print(f'sending invoice "{invoice}" to "{email_address}"')
|
||||
self.email_service.send(email_address, invoice)
|
||||
print('wat fott is is fott')
|
||||
Reference in New Issue
Block a user