-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from tink-sdk-build/release-changes-2.1.0-527
BANKX-527: Tink Core 2.1.0 release
- Loading branch information
Showing
45 changed files
with
4,413 additions
and
2,516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
Sources/TinkCore/PFM/Models/Mapping/RecommendedBudget+REST.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Foundation | ||
|
||
extension RecommendedBudget { | ||
init(restRecommendedBudget: RESTRecommendedBudget) { | ||
self.amount = CurrencyDenominatedAmount(restCurrencyDenominatedAmount: restRecommendedBudget.amount) | ||
self.filter = Budget.Filter.makeFilters(restFilter: restRecommendedBudget.filter) | ||
self.name = restRecommendedBudget.name | ||
self.recurringPeriodicity = Budget.RecurringPeriodicity(restRecurringPeriodicity: restRecommendedBudget.recurringPeriodicity) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Foundation | ||
|
||
public struct RecommendedBudget { | ||
/// The target amount for the budget. The currency will match the user profile currency setting. | ||
public let amount: CurrencyDenominatedAmount? | ||
/// The filter defines the budget and which transactions that are included in it. The configured fields of the filter are applied as logical and operator (intersection). | ||
public let filter: [Budget.Filter] | ||
/// The name of the recommended Budget. | ||
public let name: String | ||
/// Periodicity configuration for the recurring budget. | ||
public let recurringPeriodicity: Budget.RecurringPeriodicity? | ||
} |
12 changes: 12 additions & 0 deletions
12
Sources/TinkCore/PFM/REST/Models/RESTRecommendedBudget.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Foundation | ||
|
||
struct RESTRecommendedBudget: Decodable { | ||
let amount: RESTCurrencyDenominatedAmount | ||
let filter: RESTBudget.Filter | ||
let name: String | ||
let recurringPeriodicity: RESTBudget.RecurringPeriodicity | ||
} | ||
|
||
struct RESTRecommendedBudgetResponse: Decodable { | ||
let recommendedBudgets: [RESTRecommendedBudget] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import XCTest | ||
@testable import TinkCore | ||
import XCTest | ||
|
||
final class CodeTests: XCTestCase { | ||
func testInit() { | ||
|
21 changes: 21 additions & 0 deletions
21
Tests/TinkCoreTests/PFM/Models/RecommendedBudgetTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@testable import TinkCore | ||
import XCTest | ||
|
||
final class RecommendedBudgetTests: XCTestCase { | ||
func testMapping() throws { | ||
let sut = try RecommendedBudget(restRecommendedBudget: RESTRecommendedBudget.instanceFromJson()) | ||
|
||
XCTAssertTrue(sut.amount == CurrencyDenominatedAmount(10.5, currencyCode: "EUR")) | ||
if case Budget.Filter.category(let cat) = sut.filter[0] { | ||
XCTAssertTrue(cat == "expenses:food.coffee") | ||
} else { | ||
XCTFail() | ||
} | ||
XCTAssertTrue(sut.name == "Coffee budget") | ||
XCTAssertTrue(sut.recurringPeriodicity?.periodUnit == Budget.RecurringPeriodicity.PeriodUnit.week) | ||
} | ||
} | ||
|
||
extension RecommendedBudget { | ||
static func dummyInstance() throws -> Self { try RecommendedBudget(restRecommendedBudget: RESTRecommendedBudget.instanceFromJson()) } | ||
} |
2 changes: 1 addition & 1 deletion
2
Tests/TinkCoreTests/REST/ActionableInsightsRESTDecodingTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
Tests/TinkCoreTests/REST/RESTRecommendedBudgetResponseTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@testable import TinkCore | ||
import XCTest | ||
|
||
final class RESTRecommendedBudgetResponseTests: XCTestCase { | ||
func testDecodable() throws { | ||
let data = RESTRecommendedBudgetResponse.json.data(using: String.Encoding.utf8) | ||
let decoder = JSONDecoder() | ||
let sut = try decoder.decode(RESTRecommendedBudgetResponse.self, from: data!) | ||
|
||
XCTAssertTrue(sut.recommendedBudgets.count == 1) | ||
} | ||
} | ||
|
||
extension RESTRecommendedBudgetResponse { | ||
static let json: String = | ||
""" | ||
{ | ||
"recommendedBudgets": [ | ||
{ | ||
"amount": { | ||
"currencyCode": "EUR", | ||
"scale": 2, | ||
"unscaledValue": 1050 | ||
}, | ||
"filter": { | ||
"categories": [ | ||
{ | ||
"code": "expenses:food.coffee" | ||
} | ||
] | ||
}, | ||
"name": "Coffee budget", | ||
"recurringPeriodicity": { | ||
"periodUnit": "WEEK" | ||
} | ||
} | ||
] | ||
} | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
@testable import TinkCore | ||
import XCTest | ||
|
||
final class RESTRecommendedBudgetTests: XCTestCase { | ||
func testDecodable() throws { | ||
let sut0 = try RESTRecommendedBudget.instanceFromJson() | ||
|
||
XCTAssertEqual(sut0.amount.currencyCode, "EUR") | ||
XCTAssertEqual(sut0.amount.scale, 2) | ||
XCTAssertEqual(sut0.amount.unscaledValue, 1050) | ||
|
||
XCTAssertNil(sut0.filter.tags) | ||
XCTAssertNil(sut0.filter.freeTextQuery) | ||
XCTAssertNil(sut0.filter.accounts) | ||
XCTAssertEqual(sut0.filter.categories?.count, 1) | ||
XCTAssertEqual(sut0.filter.categories?[0].code, "expenses:food.coffee") | ||
|
||
XCTAssertEqual(sut0.name, "Coffee budget") | ||
|
||
XCTAssertEqual(sut0.recurringPeriodicity.periodUnit.rawValue, "WEEK") | ||
} | ||
} | ||
|
||
extension RESTRecommendedBudget { | ||
static let json: String = | ||
""" | ||
{ | ||
"amount": { | ||
"currencyCode": "EUR", | ||
"scale": 2, | ||
"unscaledValue": 1050 | ||
}, | ||
"filter": { | ||
"categories": [ | ||
{ | ||
"code": "expenses:food.coffee" | ||
} | ||
] | ||
}, | ||
"name": "Coffee budget", | ||
"recurringPeriodicity": { | ||
"periodUnit": "WEEK" | ||
} | ||
} | ||
""" | ||
|
||
static func instanceFromJson() throws -> Self { | ||
try JSONDecoder().decode(Self.self, from: json.data(using: String.Encoding.utf8)!) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+0 Bytes
(100%)
TinkCore.xcframework/ios-arm64/TinkCore.framework/Info.plist
Binary file not shown.
Oops, something went wrong.