Skip to content

Commit

Permalink
Merge pull request #36 from tink-ab/release-changes-1.8.0
Browse files Browse the repository at this point in the history
Tink Core 1.8.0 release
  • Loading branch information
lilSwifty committed May 18, 2022
2 parents 3da8d40 + 5dd4e6b commit 6859b1a
Show file tree
Hide file tree
Showing 35 changed files with 529 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let package = Package(
targets: [
.binaryTarget(
name: "TinkCore",
url: "https://github.com/tink-ab/tink-core-ios/releases/download/1.7.0/TinkCore.xcframework.zip", checksum: "773d2f445c9a23c6bfa73cd85a5e5ac36a01284eb0a8f378903ad8bb93226604"
url: "https://github.com/tink-ab/tink-core-ios/releases/download/1.8.0/TinkCore.xcframework.zip", checksum: "6e8656c217e9c06fbc1432d304f6dd32ae4481069f73ab9d9fcd728be973d83c"
),
]
)
49 changes: 49 additions & 0 deletions Sources/TinkCore/AIS/REST/Models/RESTProductName.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import Foundation

/// The REST representation of the `Product` model which also contains the `.unknown` case used when the list of the products is empty.
enum RESTProductName: String, Codable {
case unknown = "PRODUCT_UNKNOWN"
case realTimeBalance = "PRODUCT_REAL_TIME_BALANCE"
case paymentInitiation = "PRODUCT_PAYMENT_INITIATION"
case accountAggregation = "PRODUCT_ACCOUNT_AGGREGATION"
case accountCheck = "PRODUCT_ACCOUNT_CHECK"
case incomeCheck = "PRODUCT_INCOME_CHECK"
case moneyManager = "PRODUCT_MONEY_MANAGER"
case transactions = "PRODUCT_TRANSACTIONS"
case businessTransactions = "PRODUCT_BUSINESS_TRANSACTIONS"
case riskInsights = "PRODUCT_RISK_INSIGHTS"
}

extension Array where Element == Product {
var productNames: [RESTProductName] {
// In case if the list of the products is empty we are using `.unknown` case to represent it.
if isEmpty { return [.unknown] }
return map(\.productName)
}
}

/// One-to-one mapping between `Product` and `RESTProductName` cases.
extension Product {
fileprivate var productName: RESTProductName {
switch self {
case .realTimeBalance:
return .realTimeBalance
case .paymentInitiation:
return .paymentInitiation
case .accountAggregation:
return .accountAggregation
case .accountCheck:
return .accountCheck
case .incomeCheck:
return .incomeCheck
case .moneyManager:
return .moneyManager
case .transactions:
return .transactions
case .businessTransactions:
return .businessTransactions
case .riskInsights:
return .riskInsights
}
}
}
40 changes: 40 additions & 0 deletions Sources/TinkCore/PFM/Models/Mapping/Transaction+REST.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ extension Transaction {
self.originalDate = restTransaction.originalDate
self.originalDescription = restTransaction.originalDescription
self.notes = restTransaction.notes
self.isPending = restTransaction.pending
self.categoryType = .init(from: restTransaction.categoryType)
self.dispensableAmount = restTransaction.dispensableAmount
self.lastModified = restTransaction.lastModified
self.type = .init(from: restTransaction.type)
self.userId = restTransaction.userId

let now = Date()
if let endOfDay = Calendar.current.endOfDay(for: now) {
Expand All @@ -22,3 +28,37 @@ extension Transaction {
}
}
}

extension TransactionType {
init(from restTransactionType: RESTTransactionType) {
switch restTransactionType {
case .default:
self = .default
case .creditCard:
self = .creditCard
case .transfer:
self = .transfer
case .payment:
self = .payment
case .withdrawal:
self = .withdrawal
case .unknown:
self = .unknown
}
}
}

extension CategoryType {
init(from restCategoryType: RESTCategoryType) {
switch restCategoryType {
case .expenses:
self = .expenses
case .income:
self = .income
case .transfers:
self = .transfers
case .unknown:
self = .unknown
}
}
}
52 changes: 46 additions & 6 deletions Sources/TinkCore/PFM/Models/Transaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,20 @@ public struct Transaction {
public let originalDate: Date
/// The orginal amount of the transaction. This will not change even if the owner of the transaction has changed the amount.
public let originalAmount: CurrencyDenominatedAmount
/// The flag indicates if the original transaction is in pending state or not.
public let isPending: Bool
/// The category type of the transaction. Values: `expenses`, `income`, `transfers` and `unknown` in case the type is not specified.
public let categoryType: CategoryType
/// The dispensable amount of the transaction.
public let dispensableAmount: Double?
/// The date the transaction was last modified by the user.
public let lastModified: Date
/// The type of the transaction. Values: `default`, `creditCard`, `transfer`, `payment`, `withdrawal` and `unknown` in case the type is not specified.
public let type: TransactionType
/// The internal identifier of the user that the transaction belongs to.
public let userId: String

@available(*, deprecated)
public init(id: ID, accountID: Account.ID, amount: CurrencyDenominatedAmount, categoryID: Category.ID, description: String, date: Date, inserted: Date, isUpcomingOrInFuture: Bool) {
public init(id: ID, accountID: Account.ID, amount: CurrencyDenominatedAmount, categoryID: Category.ID, description: String, date: Date, inserted: Date, isUpcomingOrInFuture: Bool, notes: String?, originalDescription: String, originalDate: Date, originalAmount: CurrencyDenominatedAmount, isPending: Bool, categoryType: CategoryType, dispensableAmount: Double?, lastModified: Date, type: TransactionType, userId: String) {
self.id = id
self.accountID = accountID
self.amount = amount
Expand All @@ -40,11 +51,40 @@ public struct Transaction {
self.date = date
self.inserted = inserted
self.isUpcomingOrInFuture = isUpcomingOrInFuture
self.originalDescription = description
self.originalDate = date
self.originalAmount = amount
self.notes = nil
self.originalDescription = originalDescription
self.originalDate = originalDate
self.originalAmount = originalAmount
self.notes = notes
self.isPending = isPending
self.categoryType = categoryType
self.dispensableAmount = dispensableAmount
self.lastModified = lastModified
self.type = type
self.userId = userId
}

@available(*, deprecated)
public init(id: ID, accountID: Account.ID, amount: CurrencyDenominatedAmount, categoryID: Category.ID, description: String, date: Date, inserted: Date, isUpcomingOrInFuture: Bool) {
self.init(id: id, accountID: accountID, amount: amount, categoryID: categoryID, description: description, date: date, inserted: inserted, isUpcomingOrInFuture: isUpcomingOrInFuture, notes: nil, originalDescription: description, originalDate: date, originalAmount: amount, isPending: false, categoryType: .unknown, dispensableAmount: nil, lastModified: date, type: .unknown, userId: "")
}
}

extension Transaction: Hashable {}

/// The `TransactionType` is just a PFM's representation of the `RESTTransactionType` model.
public enum TransactionType {
case `default`
case creditCard
case transfer
case payment
case withdrawal
case unknown
}

/// The `CategoryType` is just a PFM's representation of the `RESTCategoryType` model.
public enum CategoryType {
case expenses
case income
case transfers
case unknown
}
14 changes: 14 additions & 0 deletions Sources/TinkCore/Shared/Model/Product.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Foundation

/// The kind of the used product.
public enum Product {
case realTimeBalance
case paymentInitiation
case accountAggregation
case accountCheck
case incomeCheck
case moneyManager
case transactions
case businessTransactions
case riskInsights
}
2 changes: 1 addition & 1 deletion Sources/TinkCore/Shared/Tink/Tink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foundation
#endif

/// Current TinkCore version.
public let version = "1.7.0"
public let version = "1.8.0"

/// The `Tink` class encapsulates a connection to the Tink API.
///
Expand Down
2 changes: 1 addition & 1 deletion TinkCore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Pod::Spec.new do |spec|
spec.description = <<-DESC
Core library for Tink SDKs.
DESC
spec.version = "1.7.0"
spec.version = "1.8.0"
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.authors = { "Tink AB" => "mobile@tink.se" }
spec.homepage = "https://tink.com"
Expand Down
Binary file modified TinkCore.xcframework/ios-arm64/TinkCore.framework/Info.plist
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,13 @@ public struct Transaction {
public let originalDescription: Swift.String
public let originalDate: Foundation.Date
public let originalAmount: TinkCore.CurrencyDenominatedAmount
public let isPending: Swift.Bool
public let categoryType: TinkCore.CategoryType
public let dispensableAmount: Swift.Double?
public let lastModified: Foundation.Date
public let type: TinkCore.TransactionType
public let userId: Swift.String
public init(id: TinkCore.Transaction.ID, accountID: TinkCore.Account.ID, amount: TinkCore.CurrencyDenominatedAmount, categoryID: TinkCore.Category.ID, description: Swift.String, date: Foundation.Date, inserted: Foundation.Date, isUpcomingOrInFuture: Swift.Bool, notes: Swift.String?, originalDescription: Swift.String, originalDate: Foundation.Date, originalAmount: TinkCore.CurrencyDenominatedAmount, isPending: Swift.Bool, categoryType: TinkCore.CategoryType, dispensableAmount: Swift.Double?, lastModified: Foundation.Date, type: TinkCore.TransactionType, userId: Swift.String)
@available(*, deprecated)
public init(id: TinkCore.Transaction.ID, accountID: TinkCore.Account.ID, amount: TinkCore.CurrencyDenominatedAmount, categoryID: TinkCore.Category.ID, description: Swift.String, date: Foundation.Date, inserted: Foundation.Date, isUpcomingOrInFuture: Swift.Bool)
}
Expand All @@ -1415,6 +1422,30 @@ extension TinkCore.Transaction : Swift.Hashable {
get
}
}
public enum TransactionType {
case `default`
case creditCard
case transfer
case payment
case withdrawal
case unknown
public static func == (a: TinkCore.TransactionType, b: TinkCore.TransactionType) -> Swift.Bool
public func hash(into hasher: inout Swift.Hasher)
public var hashValue: Swift.Int {
get
}
}
public enum CategoryType {
case expenses
case income
case transfers
case unknown
public static func == (a: TinkCore.CategoryType, b: TinkCore.CategoryType) -> Swift.Bool
public func hash(into hasher: inout Swift.Hasher)
public var hashValue: Swift.Int {
get
}
}
public struct TransactionCluster {
public let categorizationImprovement: Swift.Double
public let description: Swift.String
Expand Down Expand Up @@ -1550,6 +1581,10 @@ extension TinkCore.Statistic.Kind : Swift.Equatable {}
extension TinkCore.Statistic.Kind : Swift.Hashable {}
extension TinkCore.Statistic.Resolution : Swift.Equatable {}
extension TinkCore.Statistic.Resolution : Swift.Hashable {}
extension TinkCore.TransactionType : Swift.Equatable {}
extension TinkCore.TransactionType : Swift.Hashable {}
extension TinkCore.CategoryType : Swift.Equatable {}
extension TinkCore.CategoryType : Swift.Hashable {}
extension TinkCore.TransactionsQuery.Sort : Swift.Equatable {}
extension TinkCore.TransactionsQuery.Sort : Swift.Hashable {}
extension TinkCore.TransactionsQuery.Sort : Swift.RawRepresentable {}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,13 @@ public struct Transaction {
public let originalDescription: Swift.String
public let originalDate: Foundation.Date
public let originalAmount: TinkCore.CurrencyDenominatedAmount
public let isPending: Swift.Bool
public let categoryType: TinkCore.CategoryType
public let dispensableAmount: Swift.Double?
public let lastModified: Foundation.Date
public let type: TinkCore.TransactionType
public let userId: Swift.String
public init(id: TinkCore.Transaction.ID, accountID: TinkCore.Account.ID, amount: TinkCore.CurrencyDenominatedAmount, categoryID: TinkCore.Category.ID, description: Swift.String, date: Foundation.Date, inserted: Foundation.Date, isUpcomingOrInFuture: Swift.Bool, notes: Swift.String?, originalDescription: Swift.String, originalDate: Foundation.Date, originalAmount: TinkCore.CurrencyDenominatedAmount, isPending: Swift.Bool, categoryType: TinkCore.CategoryType, dispensableAmount: Swift.Double?, lastModified: Foundation.Date, type: TinkCore.TransactionType, userId: Swift.String)
@available(*, deprecated)
public init(id: TinkCore.Transaction.ID, accountID: TinkCore.Account.ID, amount: TinkCore.CurrencyDenominatedAmount, categoryID: TinkCore.Category.ID, description: Swift.String, date: Foundation.Date, inserted: Foundation.Date, isUpcomingOrInFuture: Swift.Bool)
}
Expand All @@ -1415,6 +1422,30 @@ extension TinkCore.Transaction : Swift.Hashable {
get
}
}
public enum TransactionType {
case `default`
case creditCard
case transfer
case payment
case withdrawal
case unknown
public static func == (a: TinkCore.TransactionType, b: TinkCore.TransactionType) -> Swift.Bool
public func hash(into hasher: inout Swift.Hasher)
public var hashValue: Swift.Int {
get
}
}
public enum CategoryType {
case expenses
case income
case transfers
case unknown
public static func == (a: TinkCore.CategoryType, b: TinkCore.CategoryType) -> Swift.Bool
public func hash(into hasher: inout Swift.Hasher)
public var hashValue: Swift.Int {
get
}
}
public struct TransactionCluster {
public let categorizationImprovement: Swift.Double
public let description: Swift.String
Expand Down Expand Up @@ -1550,6 +1581,10 @@ extension TinkCore.Statistic.Kind : Swift.Equatable {}
extension TinkCore.Statistic.Kind : Swift.Hashable {}
extension TinkCore.Statistic.Resolution : Swift.Equatable {}
extension TinkCore.Statistic.Resolution : Swift.Hashable {}
extension TinkCore.TransactionType : Swift.Equatable {}
extension TinkCore.TransactionType : Swift.Hashable {}
extension TinkCore.CategoryType : Swift.Equatable {}
extension TinkCore.CategoryType : Swift.Hashable {}
extension TinkCore.TransactionsQuery.Sort : Swift.Equatable {}
extension TinkCore.TransactionsQuery.Sort : Swift.Hashable {}
extension TinkCore.TransactionsQuery.Sort : Swift.RawRepresentable {}
Expand Down
Binary file modified TinkCore.xcframework/ios-arm64/TinkCore.framework/TinkCore
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1405,6 +1405,13 @@ public struct Transaction {
public let originalDescription: Swift.String
public let originalDate: Foundation.Date
public let originalAmount: TinkCore.CurrencyDenominatedAmount
public let isPending: Swift.Bool
public let categoryType: TinkCore.CategoryType
public let dispensableAmount: Swift.Double?
public let lastModified: Foundation.Date
public let type: TinkCore.TransactionType
public let userId: Swift.String
public init(id: TinkCore.Transaction.ID, accountID: TinkCore.Account.ID, amount: TinkCore.CurrencyDenominatedAmount, categoryID: TinkCore.Category.ID, description: Swift.String, date: Foundation.Date, inserted: Foundation.Date, isUpcomingOrInFuture: Swift.Bool, notes: Swift.String?, originalDescription: Swift.String, originalDate: Foundation.Date, originalAmount: TinkCore.CurrencyDenominatedAmount, isPending: Swift.Bool, categoryType: TinkCore.CategoryType, dispensableAmount: Swift.Double?, lastModified: Foundation.Date, type: TinkCore.TransactionType, userId: Swift.String)
@available(*, deprecated)
public init(id: TinkCore.Transaction.ID, accountID: TinkCore.Account.ID, amount: TinkCore.CurrencyDenominatedAmount, categoryID: TinkCore.Category.ID, description: Swift.String, date: Foundation.Date, inserted: Foundation.Date, isUpcomingOrInFuture: Swift.Bool)
}
Expand All @@ -1415,6 +1422,30 @@ extension TinkCore.Transaction : Swift.Hashable {
get
}
}
public enum TransactionType {
case `default`
case creditCard
case transfer
case payment
case withdrawal
case unknown
public static func == (a: TinkCore.TransactionType, b: TinkCore.TransactionType) -> Swift.Bool
public func hash(into hasher: inout Swift.Hasher)
public var hashValue: Swift.Int {
get
}
}
public enum CategoryType {
case expenses
case income
case transfers
case unknown
public static func == (a: TinkCore.CategoryType, b: TinkCore.CategoryType) -> Swift.Bool
public func hash(into hasher: inout Swift.Hasher)
public var hashValue: Swift.Int {
get
}
}
public struct TransactionCluster {
public let categorizationImprovement: Swift.Double
public let description: Swift.String
Expand Down Expand Up @@ -1550,6 +1581,10 @@ extension TinkCore.Statistic.Kind : Swift.Equatable {}
extension TinkCore.Statistic.Kind : Swift.Hashable {}
extension TinkCore.Statistic.Resolution : Swift.Equatable {}
extension TinkCore.Statistic.Resolution : Swift.Hashable {}
extension TinkCore.TransactionType : Swift.Equatable {}
extension TinkCore.TransactionType : Swift.Hashable {}
extension TinkCore.CategoryType : Swift.Equatable {}
extension TinkCore.CategoryType : Swift.Hashable {}
extension TinkCore.TransactionsQuery.Sort : Swift.Equatable {}
extension TinkCore.TransactionsQuery.Sort : Swift.Hashable {}
extension TinkCore.TransactionsQuery.Sort : Swift.RawRepresentable {}
Expand Down
Binary file not shown.

0 comments on commit 6859b1a

Please sign in to comment.