File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
src/balance_service/interfaces Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ def authenticate(self,
12
12
certificate_path : str ):
13
13
pass
14
14
15
+ @abstractmethod
16
+ def has_certificate (self , certificate_path : str ):
17
+ pass
18
+
15
19
@abstractmethod
16
20
def get_balance (self ):
17
21
pass
@@ -25,8 +29,15 @@ def __init__(self,
25
29
self .token = token
26
30
self .certificate_path = certificate_path
27
31
self .bank_service = bank_service
28
- self .bank_service .authenticate ( self . token , self .certificate_path )
32
+ self .has_certificate = self . bank_service .has_certificate ( self .certificate_path )
29
33
30
- def get_balance (self ):
31
- return self .bank_service .get_balance ()
34
+ if self .has_certificate :
35
+ self .bank_service .authenticate (
36
+ self .token ,
37
+ self .certificate_path
38
+ )
32
39
40
+ def get_balance (self ):
41
+ if self .has_certificate :
42
+ return self .bank_service .get_balance ()
43
+ return 0
You can’t perform that action at this time.
0 commit comments