Skip to content

Commit 03644a2

Browse files
author
Christian König
authored
Merge pull request #8 from figo-connect/development
Re-added macOS support
2 parents ed868fa + 09aba0d commit 03644a2

24 files changed

+675
-279
lines changed

Figo.xcodeproj/project.pbxproj

Lines changed: 477 additions & 130 deletions
Large diffs are not rendered by default.

Figo.xcodeproj/xcshareddata/xcschemes/Figo iOS Tests.xcscheme

Lines changed: 0 additions & 56 deletions
This file was deleted.

Figo.xcodeproj/xcshareddata/xcschemes/Figo iOS.xcscheme

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
skipped = "NO">
3333
<BuildableReference
3434
BuildableIdentifier = "primary"
35-
BlueprintIdentifier = "83D3A6E91BFF5BA4003EDE45"
36-
BuildableName = "Figo iOS Tests.xctest"
35+
BlueprintIdentifier = "833C01391E2AAB4200AA5E7C"
36+
BuildableName = "Figo-iOS-Tests.xctest"
3737
BlueprintName = "Figo iOS Tests"
3838
ReferencedContainer = "container:Figo.xcodeproj">
3939
</BuildableReference>
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0820"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "833C00EE1E2AA6A100AA5E7C"
18+
BuildableName = "Figo.framework"
19+
BlueprintName = "Figo macOS"
20+
ReferencedContainer = "container:Figo.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "833C00FA1E2AA72A00AA5E7C"
36+
BuildableName = "Figo-macOS-Tests.xctest"
37+
BlueprintName = "Figo macOS Tests"
38+
ReferencedContainer = "container:Figo.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
<MacroExpansion>
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "833C00EE1E2AA6A100AA5E7C"
46+
BuildableName = "Figo.framework"
47+
BlueprintName = "Figo macOS"
48+
ReferencedContainer = "container:Figo.xcodeproj">
49+
</BuildableReference>
50+
</MacroExpansion>
51+
<AdditionalOptions>
52+
</AdditionalOptions>
53+
</TestAction>
54+
<LaunchAction
55+
buildConfiguration = "Debug"
56+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
57+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58+
launchStyle = "0"
59+
useCustomWorkingDirectory = "NO"
60+
ignoresPersistentStateOnLaunch = "NO"
61+
debugDocumentVersioning = "YES"
62+
debugServiceExtension = "internal"
63+
allowLocationSimulation = "YES">
64+
<MacroExpansion>
65+
<BuildableReference
66+
BuildableIdentifier = "primary"
67+
BlueprintIdentifier = "833C00EE1E2AA6A100AA5E7C"
68+
BuildableName = "Figo.framework"
69+
BlueprintName = "Figo macOS"
70+
ReferencedContainer = "container:Figo.xcodeproj">
71+
</BuildableReference>
72+
</MacroExpansion>
73+
<AdditionalOptions>
74+
</AdditionalOptions>
75+
</LaunchAction>
76+
<ProfileAction
77+
buildConfiguration = "Release"
78+
shouldUseLaunchSchemeArgsEnv = "YES"
79+
savedToolIdentifier = ""
80+
useCustomWorkingDirectory = "NO"
81+
debugDocumentVersioning = "YES">
82+
<MacroExpansion>
83+
<BuildableReference
84+
BuildableIdentifier = "primary"
85+
BlueprintIdentifier = "833C00EE1E2AA6A100AA5E7C"
86+
BuildableName = "Figo.framework"
87+
BlueprintName = "Figo macOS"
88+
ReferencedContainer = "container:Figo.xcodeproj">
89+
</BuildableReference>
90+
</MacroExpansion>
91+
</ProfileAction>
92+
<AnalyzeAction
93+
buildConfiguration = "Debug">
94+
</AnalyzeAction>
95+
<ArchiveAction
96+
buildConfiguration = "Release"
97+
revealArchiveInOrganizer = "YES">
98+
</ArchiveAction>
99+
</Scheme>

README.md

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
This Framework wraps the figo Connect API endpoints in nicely typed Swift functions and types for your conveniece.
55

66
- We don't support Swift versions older than 3.0
7-
- We are working on support for other platforms than iOS
7+
- Supports iOS and macOS
88

99

1010
## figo Connect API
@@ -39,13 +39,10 @@ Integrate the framework into your project:
3939
* Select the Figo.xcodeproj in the Project Navigator and verify the deployment target matches that of your application target.
4040
* Add the Figo.framework to your target(s) in the "Embedded Binaries" sections
4141

42-
### Carthage
43-
44-
We are working on bringing back Carthage support
4542

4643
## Usage
4744

48-
After creating an instance of `FigoClient` you can call functions on it representing the API endpoints. These functions will always return a `Result<T>`, where `T` will a corresponding type like `Account`, `[Account]` or `[Transaction]`.
45+
After creating an instance of `FigoClient` you can call functions on it representing the API endpoints. These functions will always return a `FigoResult<T>`, where `T` will a corresponding type like `Account`, `[Account]` or `[Transaction]`.
4946

5047
import Figo
5148
let figo = FigoClient()
@@ -88,11 +85,20 @@ To be able to login and use the figo API a user is required.
8885
}
8986
}
9087

91-
### Enable logging
88+
### Logging
89+
90+
For now we have a very simple logging solution. By default logging is disabled. If you want to enable logging, you can pass a logger instance to the `FigoClient`.
91+
92+
let figo = FigoClient(logger: ConsoleLogger())
93+
94+
If you want control of what is logged or how, you can provide your own instance that conforms to the `Logger` protocol.
9295

93-
Since the `FigoClient` by default uses the default instance of `XCGLogger`, you can control logging from wherever you like. You can also provide your own `XCGLogger` instance in the initializer.
96+
public protocol Logger {
97+
var debug: (String) -> Void { get }
98+
var verbose: (String) -> Void { get }
99+
var error: (String) -> Void { get }
100+
}
94101

95-
XCGLogger.default.setup(level: .verbose, showFunctionName: false, showThreadName: false, showLevel: false, showFileNames: false, showLineNumbers: false, showDate: false, writeToFile: nil, fileLevel: .none)
96102

97103
## Endpoints
98104

@@ -101,16 +107,16 @@ Since the `FigoClient` by default uses the default instance of `XCGLogger`, you
101107

102108
The central element of this API is the figo user, who owns bank accounts and grants selective access to them to other applications. This account can either be a free or a premium account. While both support the same set of features, the free account can only be used with the application through it got created, while a premium account can be used in all applications integrating figo.
103109

104-
createNewFigoUser(user: CreateUserParameters, clientID: String, clientSecret: String, _ completionHandler: (Result<String>) -> Void)
105-
retrieveCurrentUser(completionHandler: (Result<User>) -> Void)
110+
createNewFigoUser(user: CreateUserParameters, clientID: String, clientSecret: String, _ completionHandler: (FigoResult<String>) -> Void)
111+
retrieveCurrentUser(completionHandler: (FigoResult<User>) -> Void)
106112
deleteCurrentUser(completionHandler: VoidCompletionHandler)
107113

108114

109115
### Authorization
110116

111117
The figo API uses OAuth 2 for authentication purposes and you need a user to login.
112118

113-
loginWithUsername(username: String, password: String, clientID: String, clientSecret: String, _ completionHandler: (Result<String>) -> Void)
119+
loginWithUsername(username: String, password: String, clientID: String, clientSecret: String, _ completionHandler: (FigoResult<String>) -> Void)
114120
loginWithRefreshToken(refreshToken: String, clientID: String, clientSecret: String, _ completionHandler: VoidCompletionHandler)
115121
revokeAccessToken(completionHandler: VoidCompletionHandler)
116122
revokeRefreshToken(refreshToken: String, _ completionHandler: VoidCompletionHandler)
@@ -120,18 +126,18 @@ The figo API uses OAuth 2 for authentication purposes and you need a user to log
120126

121127
Bank accounts are the central domain object of this API and the main anchor point for many of the other resources. This API does not only consider classical bank accounts as account, but also alternative banking services, e.g. credit cards or Paypal. The API does not distinguish between these two in most points.
122128

123-
retrieveAccounts(completionHandler: (Result<[Account]>) -> Void)
124-
retrieveAccount(accountID: String, _ completionHandler: (Result<Account>) -> Void)
129+
retrieveAccounts(completionHandler: (FigoResult<[Account]>) -> Void)
130+
retrieveAccount(accountID: String, _ completionHandler: (FigoResult<Account>) -> Void)
125131
removeStoredPinFromBankContact(bankID: String, _ completionHandler: VoidCompletionHandler)
126132
setupNewBankAccount(parameters: CreateAccountParameters, progressHandler: ProgressUpdate? = nil, _ completionHandler: VoidCompletionHandler)
127133
128134
### Transactions
129135

130136
Each bank account has a list of transactions associated with it. The length of this list depends on the bank and time this account has been setup. In general the information provided for each transaction should be roughly similar to the contents of the printed or online transaction statement available from the respective bank. Please note that not all banks provide the same level of detail.
131137

132-
retrieveTransactions(parameters: RetrieveTransactionsParameters = RetrieveTransactionsParameters(), _ completionHandler: (Result<TransactionListEnvelope>) -> Void)
133-
retrieveTransactionsForAccount(accountID: String, parameters: RetrieveTransactionsParameters = RetrieveTransactionsParameters(), _ completionHandler: (Result<TransactionListEnvelope>) -> Void)
134-
retrieveTransaction(transactionID: String, _ completionHandler: (Result<Transaction>) -> Void)
138+
retrieveTransactions(parameters: RetrieveTransactionsParameters = RetrieveTransactionsParameters(), _ completionHandler: (FigoResult<TransactionListEnvelope>) -> Void)
139+
retrieveTransactionsForAccount(accountID: String, parameters: RetrieveTransactionsParameters = RetrieveTransactionsParameters(), _ completionHandler: (FigoResult<TransactionListEnvelope>) -> Void)
140+
retrieveTransaction(transactionID: String, _ completionHandler: (FigoResult<Transaction>) -> Void)
135141

136142

137143
### Synchronization
@@ -147,9 +153,9 @@ Usually the bank accounts are synchronized on a daily basis. However, the synchr
147153

148154
To set up a new bank account in figo, you need to provide the right kind of credentials for each bank. These settings can be retrieved from the API aswell as a list of all supported banks and bank-like services.
149155

150-
retrieveSupportedBanks(countryCode: String = "de", _ completionHandler: (Result<[SupportedBank]>) -> Void)
151-
retrieveSupportedServices(countryCode: String = "de", _ completionHandler: (Result<[SupportedService]>) -> Void)
152-
retrieveLoginSettings(countryCode: String = "de", bankCode: String, _ completionHandler: (Result<LoginSettings>) -> Void)
156+
retrieveSupportedBanks(countryCode: String = "de", _ completionHandler: (FigoResult<[SupportedBank]>) -> Void)
157+
retrieveSupportedServices(countryCode: String = "de", _ completionHandler: (FigoResult<[SupportedService]>) -> Void)
158+
retrieveLoginSettings(countryCode: String = "de", bankCode: String, _ completionHandler: (FigoResult<LoginSettings>) -> Void)
153159
154160
### Payments
155161

@@ -159,29 +165,29 @@ Submitting a new payment generally is a two-phased process: 1. compile all infor
159165

160166
While the first part is normal live interaction with this API, the second one uses the task processing system to allow for more time as bank servers are sometimes slow to respond. In addition you will need a TAN (Transaktionsnummer) from your bank to authenticate the submission.
161167

162-
retrievePaymentProposals(completionHandler: Result<[PaymentProposal]> -> Void)
163-
retrievePayments(completionHandler: Result<[Payment]> -> Void)
164-
retrievePaymentsForAccount(accountID: String, _ completionHandler: Result<[Payment]> -> Void)
165-
retrievePayment(paymentID: String, accountID: String, _ completionHandler: Result<Payment> -> Void)
166-
createPayment(parameters: CreatePaymentParameters, _ completionHandler: Result<Payment> -> Void)
167-
modifyPayment(payment: Payment, _ completionHandler: Result<Payment> -> Void)
168+
retrievePaymentProposals(completionHandler: FigoResult<[PaymentProposal]> -> Void)
169+
retrievePayments(completionHandler: FigoResult<[Payment]> -> Void)
170+
retrievePaymentsForAccount(accountID: String, _ completionHandler: FigoResult<[Payment]> -> Void)
171+
retrievePayment(paymentID: String, accountID: String, _ completionHandler: FigoResult<Payment> -> Void)
172+
createPayment(parameters: CreatePaymentParameters, _ completionHandler: FigoResult<Payment> -> Void)
173+
modifyPayment(payment: Payment, _ completionHandler: FigoResult<Payment> -> Void)
168174
submitPayment(payment: Payment, tanSchemeID: String, pinHandler: PinResponder, challengeHandler: ChallengeResponder, _ completionHandler: VoidCompletionHandler)
169175
170176
### Securities
171177

172178
Each depot account has a list of securities associated with it. In general the information provided for each security should be roughly similar to the contents of the printed or online depot listings available from the respective bank. Please note that not all banks provide the same level of detail.
173179

174-
retrieveSecurities(parameters: RetrieveSecuritiesParameters = RetrieveSecuritiesParameters(), _ completionHandler: (Result<SecurityListEnvelope>) -> Void)
175-
retrieveSecuritiesForAccount(accountID: String, parameters: RetrieveSecuritiesParameters = RetrieveSecuritiesParameters(), _ completionHandler: (Result<SecurityListEnvelope>) -> Void)
176-
retrieveSecurity(securityID: String, accountID: String, _ completionHandler: (Result<Security>) -> Void)
180+
retrieveSecurities(parameters: RetrieveSecuritiesParameters = RetrieveSecuritiesParameters(), _ completionHandler: (FigoResult<SecurityListEnvelope>) -> Void)
181+
retrieveSecuritiesForAccount(accountID: String, parameters: RetrieveSecuritiesParameters = RetrieveSecuritiesParameters(), _ completionHandler: (FigoResult<SecurityListEnvelope>) -> Void)
182+
retrieveSecurity(securityID: String, accountID: String, _ completionHandler: (FigoResult<Security>) -> Void)
177183
178184
### Standing orders
179185

180186
Bank accounts can have standing orders associated with it if supported by the respective bank. In general the information provided for each standing order should be roughly similar to the content of the printed or online standing order statement available from the respective bank. Please note that not all banks provide the same level of detail.
181187

182-
retrieveStandingOrders(completionHandler: (Result<[StandingOrder]>) -> Void)
183-
retrieveStandingOrdersForAccount(accountID: String, _ completionHandler: (Result<[StandingOrder]>) -> Void)
184-
retrieveStandingOrder(standingOrderID: String, _ completionHandler: (Result<StandingOrder>) -> Void)
188+
retrieveStandingOrders(completionHandler: (FigoResult<[StandingOrder]>) -> Void)
189+
retrieveStandingOrdersForAccount(accountID: String, _ completionHandler: (FigoResult<[StandingOrder]>) -> Void)
190+
retrieveStandingOrder(standingOrderID: String, _ completionHandler: (FigoResult<StandingOrder>) -> Void)
185191
186192

187193

Source/Alias.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
A closure which is used for API calls that return nothing
1212
*/
13-
public typealias VoidCompletionHandler = (Result<Void>) -> Void
13+
public typealias VoidCompletionHandler = (FigoResult<Void>) -> Void
1414

1515
/**
1616
A closure which is called periodically during task state polling with a status message from the server

Source/Core/Response.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010

1111

12-
internal func decodeVoidResponse(_ response: Result<Data>) -> Result<Void> {
12+
internal func decodeVoidResponse(_ response: FigoResult<Data>) -> FigoResult<Void> {
1313
switch response {
1414
case .failure(let error):
1515
return .failure(error)
@@ -18,7 +18,7 @@ internal func decodeVoidResponse(_ response: Result<Data>) -> Result<Void> {
1818
}
1919
}
2020

21-
internal func decodeUnboxableResponse<T: Unboxable>(_ data: Result<Data>, context: Any? = nil) -> Result<T> {
21+
internal func decodeUnboxableResponse<T: Unboxable>(_ data: FigoResult<Data>, context: Any? = nil) -> FigoResult<T> {
2222
switch data {
2323
case .success(let data):
2424
do {
@@ -34,7 +34,7 @@ internal func decodeUnboxableResponse<T: Unboxable>(_ data: Result<Data>, contex
3434
}
3535
}
3636

37-
internal func decodeUnboxableResponse<T: Unboxable>(_ data: Result<Data>, context: Any? = nil) -> Result<[T]> {
37+
internal func decodeUnboxableResponse<T: Unboxable>(_ data: FigoResult<Data>, context: Any? = nil) -> FigoResult<[T]> {
3838
switch data {
3939
case .success(let data):
4040
do {

0 commit comments

Comments
 (0)