ICardSubscriptionSer vice swift protocol ICardSubscriptionSer vice cla

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// ICardSubscriptionService.swift
protocol ICardSubscriptionService: class {
func getSubscriptionPlans() -> [SubscriptionPlan]
func orderCard(
planUID: UUID,
addressLine1: String,
addressLine2: String?,
countryCode: String,
city: String,
postCode: String,
cardPin: String,
personalisedIban: String?) -> Bool
func activateCard(lastDigits: String) -> Bool
func getCards() -> Observable<[MoneybaseCard]>
func reportCard() -> Bool
func unfreezeCard() -> Bool
func deleteCard() -> Bool
func getPinCard(cardUID: UUID) -> String
func linkCard(cardNumber: String) -> Bool
}
// MainAssembly.swift
...
container.register(ICardSubscriptionService.self) { r in
return CardSubscriptionServiceStub()
}.inObjectScope(.container)
...
// CardSecurityViewController.swift
override func viewDidLoad() {
super.viewDidLoad()
cardService = self.assembler?.resolver.resolve(ICardSubscriptionService.self)
cardService?.getCards().subscribe { [weak self] event in
switch event {
case .next(let value):
print("====NEXT")
self?.cardSecurities = value[0].cardSecurities
self?.collectionView.reloadData()
case .error(let error):
print("====Error")
print(error)
case .completed:
print("====Compltede")
print("completed")
}
}.disposed(by: _disposeBag)
}