MNFTransaction
The MNFTransaction class encapsulates transaction json data from the server in an object.
A transaction should no be directly initialized but instead should be constructed with data from the server. The response from the server will be automatically converted to an MNFTransaction object.
-
@abstract The identifier of the account the transaction belongs to.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull accountId;
Swift
var accountId: NSNumber { get }
-
@abstract The account of the transaction. Parsed from the ‘includes’ field in the JSON.
Declaration
Objective-C
@property (nonatomic, strong, nullable) MNFAccount *account;
Swift
var account: MNFAccount? { get set }
-
@abstract The amount of the transaction
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull amount;
Swift
var amount: NSNumber { get }
-
@abstract The amount in currency for the transaction.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull amountInCurrency;
Swift
var amountInCurrency: NSNumber { get }
-
@abstract Balance of the account after this transaction.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull balance;
Swift
var balance: NSNumber { get }
-
@abstract The bank’s unique identifier for the transaction.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSString *_Nonnull bankId;
Swift
var bankId: String { get }
-
@abstract The time when the category was last changed, or null if the category has never been changed by the user.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSDate *_Nonnull categoryChangedTime;
Swift
var categoryChangedTime: Date { get }
-
@abstract Contains Id of a rule that changed this transaction, or null if this transaction has not been modified by a rule.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull changedByRule;
Swift
var changedByRule: NSNumber { get }
-
@abstract The time when the transaction was last changed by a rule, or null if the category has never been changed by a rule.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSDate *_Nonnull changedByRuleTime;
Swift
var changedByRuleTime: Date { get }
-
@abstract Identifier of a counterparty account in the same realm that was transferred from/to during this transaction.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSString *_Nonnull counterpartyAccountIdentifier;
Swift
var counterpartyAccountIdentifier: String { get }
-
@abstract The currency the transaction is in.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull currency;
Swift
var currency: String { get }
-
@abstract The raw data that comes with the transaction from the financial data realm.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull data;
Swift
var data: String { get }
-
@abstract Id of the data format parser used for this transaction.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull dataFormat;
Swift
var dataFormat: NSNumber { get }
-
@abstract A list of detected categories.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSArray *_Nonnull detectedCategories;
Swift
var detectedCategories: [Any] { get }
-
@abstract Whether the user has cleared category uncertainty.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull hasUserClearedCategoryUncertainty;
Swift
var hasUserClearedCategoryUncertainty: NSNumber { get }
-
@abstract The due date when the user needs to pay for this transaction, e.g. when the credit card bill has to be paid for credit card transactions.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSDate *_Nonnull dueDate;
Swift
var dueDate: Date { get }
-
@abstract The insert time of the transaction into the Meniga system.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSDate *_Nonnull insertTime;
Swift
var insertTime: Date { get }
-
@abstract Whether or not the transaction has been flagged.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull isFlagged;
Swift
var isFlagged: NSNumber { get }
-
@abstract Whether the transaction is associated with a merchant.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull isMerchant;
Swift
var isMerchant: NSNumber { get }
-
@abstract The merchant of the transaction. Parsed from the ‘includes’ field in the JSON.
Declaration
Objective-C
@property (nonatomic, strong, nullable) MNFMerchant *merchant;
Swift
var merchant: MNFMerchant? { get set }
-
@abstract Whether the transaction is an account transfer to own account.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull isOwnAccountTransfer;
Swift
var isOwnAccountTransfer: NSNumber { get }
-
@abstract Whether the transaction is the result of a split. False if the transaction is the parent of a split. Nil if the transaction has never been split.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull isSplitChild;
Swift
var isSplitChild: NSNumber { get }
-
@abstract Whether the transaction is uncleared.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull isUncleared;
Swift
var isUncleared: NSNumber { get }
-
@abstract Time when the transaction was last modified.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSDate *_Nonnull lastModifiedTime;
Swift
var lastModifiedTime: Date { get }
-
@abstract The merchant category code mapping used when detecting categories.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull mcc;
Swift
var mcc: NSNumber { get }
-
@abstract Id of a merchant if the transaction was linked to a merchant.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull merchantId;
Swift
var merchantId: NSNumber { get }
-
@abstract Metadatas for the transaction.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSArray *_Nonnull metaData;
Swift
var metaData: [Any] { get }
-
@abstract The original amount of the transaction. Sum of split transactions result in the original amount.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull originalAmount;
Swift
var originalAmount: NSNumber { get }
-
@abstract The original date if the transaction date is different.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSDate *_Nonnull originalDate;
Swift
var originalDate: Date { get }
-
@abstract The original text if the transaction text is different.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull originalText;
Swift
var originalText: String { get }
-
@abstract The Id of the parent transaction. Nil if transaction is not a split child.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull parentIdentifier;
Swift
var parentIdentifier: String { get }
-
@abstract Extra fields for this transaction having field names as keys.
@discussion The server supports parsed data both as a list of “key-value” pairs like ‘@[@{@“key”:@“testKey”,@“value”:@“testValue”}] and regular hashmap like ’@{@“testKey”:@“testValue”}. The sdk will transform list based objects to regular json objects.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSDictionary *_Nonnull parsedData;
Swift
var parsedData: [AnyHashable : Any] { get }
-
@abstract The transaction timestamp.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSDate *_Nonnull timestamp;
Swift
var timestamp: Date { get }
-
@abstract Holds etra custom data that is not parsed or read via the transaction data format parser.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull userData;
Swift
var userData: String { get }
-
The original amount of this transaction in account currency.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull bookedAmount;
Swift
var bookedAmount: NSNumber { get }
-
The split ratio of the transaction.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nonnull splitRatio;
Swift
var splitRatio: NSNumber { get }
-
The country code of the transaction.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSString *_Nonnull countryCode;
Swift
var countryCode: String { get }
-
@abstract The Id of the category of the transaction.
Declaration
Objective-C
@property (nonatomic, strong) NSNumber *_Nonnull categoryId;
Swift
var categoryId: NSNumber { get set }
-
@abstract The comment in the transaction.
Declaration
Objective-C
@property (nonatomic, copy) NSArray<MNFComment *> *_Nonnull comments;
Swift
var comments: [MNFComment] { get set }
-
@abstract The date of the transaction.
Declaration
Objective-C
@property (nonatomic, strong) NSDate *_Nonnull date;
Swift
var date: Date { get set }
-
@abstract Whether or not the transaction has uncertain categorization.
Declaration
Objective-C
@property (nonatomic, strong) NSNumber *_Nonnull hasUncertainCategorization;
Swift
var hasUncertainCategorization: NSNumber { get set }
-
@abstract The tags in the transaction.
Declaration
Objective-C
@property (nonatomic, copy) NSArray *_Nonnull tags;
Swift
var tags: [Any] { get set }
-
@abstract The text in the transaction.
Declaration
Objective-C
@property (nonatomic, copy) NSString *_Nonnull text;
Swift
var text: String { get set }
-
@abstract Whether the transaction has been read.
Declaration
Objective-C
@property (nonatomic, strong) NSNumber *_Nonnull isRead;
Swift
var isRead: NSNumber { get set }
-
@abstract Fetches a transaction with a given identifier.
Declaration
Objective-C
+ (nonnull MNFJob *)fetchWithId:(nonnull NSNumber *)identifier completion: (nullable MNFTransactionCompletionHandler)completion;
Swift
class func fetch(withId identifier: NSNumber, completion: MNFTransactionCompletionHandler? = nil) -> MNFJob
Parameters
identifier
The identifier of the transaction being fetched.
completion
A completion block returning an MNFTransaction instance and an NSError.
Return Value
An MNFJob containing an MNFTransaction and an error.
-
@abstract Fetches all split transactions relating to the transaction.
@discussion If the transaction is a parent the list will return the transaction and all it’s split children. If it is a child the list will return the parent transaction, the child itself and any other children of the parent.
Declaration
Objective-C
- (nonnull MNFJob *)fetchSplitWithCompletion: (nullable MNFMultipleTransactionsCompletionHandler)completion;
Swift
func fetchSplit(completion: MNFMultipleTransactionsCompletionHandler? = nil) -> MNFJob
Parameters
completion
A completion block returning a list of transactions and an error.
Return Value
An MNFJob containing a list of transactions and an error.
-
@abstract Fetches all split transactions relating to the transaction.
@discussion If the transaction is a parent the list will return the transaction and all it’s split children. If it is a child the list will return the parent transaction, the child itself and any other children of the parent.
Declaration
Objective-C
- (nonnull MNFJob *) fetchSplitWithInclude:(nullable NSArray *)include andCompletion: (nullable MNFMultipleTransactionsCompletionHandler)completion;
Swift
func fetchSplit(withInclude include: [Any]?, andCompletion completion: MNFMultipleTransactionsCompletionHandler? = nil) -> MNFJob
Parameters
include
A query parameter that tells which related resources should be included in the response as ‘included’ data. Supported resources are “Account” and “Merchant”, e.g. “Account,Merchant” to get both resources included
completion
A completion block returning a list of transactions and an error.
Return Value
An MNFJob containing a list of transactions and an error.
-
@abstract Fetches all transactions with applied filter.
Declaration
Objective-C
+ (nonnull MNFJob *) fetchWithTransactionFilter:(nonnull MNFTransactionFilter *)filter completion: (nonnull MNFMultipleTransactionsCompletionHandler) completion;
Swift
class func fetch(with filter: MNFTransactionFilter, completion: @escaping MNFMultipleTransactionsCompletionHandler) -> MNFJob
Parameters
filter
MNFTransactionFilter object.
completion
A completion block returning a list of transactions and an error.
Return Value
An MNFJob containing a list of transactions and an error.
-
@abstract Creates a new transaction on the server.
@discussion User created transactions are defined as wallet transactions. They will always have accountId = 5.
Declaration
Objective-C
+ (nonnull MNFJob *) createTransactionWithDate:(nonnull NSDate *)date text:(nonnull NSString *)text amount:(nonnull NSNumber *)amount categoryId:(nonnull NSNumber *)categoryId setAsRead:(nonnull NSNumber *)setAsRead completion: (nullable MNFTransactionCompletionHandler)completion;
Swift
class func createTransaction(with date: Date, text: String, amount: NSNumber, categoryId: NSNumber, setAsRead: NSNumber, completion: MNFTransactionCompletionHandler? = nil) -> MNFJob
Parameters
date
The date of the transaction.
text
The text of the transaction.
amount
The amount of the transaction.
categoryId
The categoryId of the transaction.
setAsRead
Whether the transaction should be set as read or not.
completion
A comletion block returning the transaction created and an error.
Return Value
An MNFJob containing the transaction created and an error.
-
@abstract Deletes the transaction from the server.
Warning
Remember to deallocate objects that have been deleted from the server.
Declaration
Objective-C
- (nonnull MNFJob *)deleteTransactionWithCompletion: (nullable MNFErrorOnlyCompletionHandler)completion;
Swift
func delete(completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
completion
A completion block returning an error.
Return Value
MNFJob A job containing an error.
-
@abstract Deletes comment from transaction and removes it from the comments array.
Warning
Remember to deallocate objects that have been deleted from the server.
Declaration
Objective-C
- (nonnull MNFJob *) deleteCommentAtIndex:(NSInteger)commentIndex withCompletion:(nullable MNFErrorOnlyCompletionHandler)completion;
Swift
func deleteComment(at commentIndex: Int, withCompletion completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
commentIndex
iIndex of the comment in the transaction comment array.
completion
A completion block returning an error.
Return Value
MNFJob A job containing an error.
-
@abstract Deletes a list of transactions.
Warning
Remember to deallocate objects that have been deleted from the server.
Warning
The list of transactions must not be empty.
Declaration
Objective-C
+ (nonnull MNFJob *) deleteTransactions:(nonnull NSArray<MNFTransaction *> *)transactions withCompletion:(nullable MNFErrorOnlyCompletionHandler)completion;
Swift
class func delete(_ transactions: [MNFTransaction], withCompletion completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
transactions
The transactions to be deleted.
completion
A completion block returning an error.
Return Value
An MNFJob containing an error.
-
@abstract Saves changes to the transaction to the server.
Declaration
Objective-C
- (nonnull MNFJob *)saveWithCompletion: (nullable MNFErrorOnlyCompletionHandler)completion;
Swift
func save(completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
completion
A completion block returning a result and an error.
Return Value
MNFJob A job containing a result and an error.
-
@abstract Refreshes the transaction with data from the server.
Declaration
Objective-C
- (nonnull MNFJob *)refreshWithCompletion: (nullable MNFErrorOnlyCompletionHandler)completion;
Swift
func refresh(completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
completion
A completion block returning an error.
Return Value
MNFJob A job containing an error.
-
@abstract Splits the transaction by a given amount. This creates a new transaction that is a split child of the transaction.
Declaration
Objective-C
- (nonnull MNFJob *) splitTransactionWithAmount:(nullable NSNumber *)amount categoryId:(nullable NSNumber *)categoryId text:(nullable NSString *)text isFlagged:(BOOL)flagged completion: (nullable MNFTransactionCompletionHandler)completion;
Parameters
amount
The amount to split by.
categoryId
The category Id of the new transaction.
text
The text in the new transaction.
flagged
Whether the new transaction is flagged.
completion
A completion block returning a transaction and an error.
Return Value
MNFJob A job containing an MNFTransaction and an error.
-
@abstract Updates transaction splits. This deletes existing split transactions and creates new transactions that are split children of the transaction.
Warning
Make sure the number of items in the arrays provided are equal.
Declaration
Objective-C
- (nonnull MNFJob *) updateSplitTransactionWithAmount:(nonnull NSArray<NSNumber *> *)amounts categoryId:(nonnull NSArray<NSNumber *> *)categoryIds text:(nonnull NSArray<NSString *> *)texts isFlagged:(nonnull NSArray<NSNumber *> *)flagged completion:(nullable MNFTransactionCompletionHandler) completion;
Swift
func updateSplitTransaction(withAmount amounts: [NSNumber], categoryId categoryIds: [NSNumber], text texts: [String], isFlagged flagged: [NSNumber], completion: MNFTransactionCompletionHandler? = nil) -> MNFJob
Parameters
amounts
The amounts to split by.
categoryIds
The category Ids of the new transactions.
texts
The texts in the new transactions.
flagged
Whether the new transaction is flagged.
completion
A completion block returning a list of transactions and an error.
Return Value
MNFJob A job containing an list of transactions and an error.
-
@abstract Posts a comment to the transaction. If the comment contains any tags (words starting with ‘#’) they are automatically created and associated with the transaction if they do not already exist.
Declaration
Objective-C
- (nonnull MNFJob *)postComment:(nonnull NSString *)comment withCompletion: (nullable MNFErrorOnlyCompletionHandler)completion;
Swift
func postComment(_ comment: String, withCompletion completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
comment
The comment to post.
completion
A completion block returning an NSError.
Return Value
An MNFJob containing an NSError.
-
@abstract Recategorizes transactions with matching texts.
Declaration
Objective-C
+ (nonnull MNFJob *) recategorizeWithTexts:(nonnull NSArray<NSString *> *)texts unreadOnly:(BOOL)unreadOnly useSubText:(BOOL)useSubText markAsRead:(BOOL)markAsRead categoryId:(nullable NSNumber *)categoryId completion:(nullable MNFErrorOnlyCompletionHandler)completion;
Swift
class func recategorize(withTexts texts: [String], unreadOnly: Bool, useSubText: Bool, markAsRead: Bool, categoryId: NSNumber?, completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
texts
The texts matching the transactions to recategorize.
unreadOnly
Whether only unread transactions should be recategorized.
useSubText
Whether subtext should be used to match transactions to texts.
markAsRead
Whether recategorized transactions should be marked as read.
categoryId
The categoryId to recategorize to. If not set the matching transactions will be recategorized according to existing categorization rules.
completion
A completion block returning an error.
Return Value
An MNFJob containing an error.
-
+updateTransactions:
withAmount: categoryId: uncertainCategorization: useSubtextInRecategorization: text: date: isRead: isFlagged: userData: completion: @abstract Updates a list of transactions with the specified parameters. The fields of the transactions passed in this method will be updated.
Declaration
Objective-C
+ (nonnull MNFJob *)updateTransactions: (nonnull NSArray<MNFTransaction *> *)transactions withAmount:(nullable NSNumber *)amount categoryId:(nullable NSNumber *)categoryId uncertainCategorization:(BOOL)uncertainCategorization useSubtextInRecategorization:(BOOL)useSubText text:(nullable NSString *)text date:(nullable NSDate *)date isRead:(BOOL)isRead isFlagged:(BOOL)isFlagged userData:(nullable NSString *)userData completion:(nonnull MNFErrorOnlyCompletionHandler) completion;
Swift
class func update(_ transactions: [MNFTransaction], withAmount amount: NSNumber?, categoryId: NSNumber?, uncertainCategorization: Bool, useSubtextInRecategorization useSubText: Bool, text: String?, date: Date?, isRead: Bool, isFlagged: Bool, userData: String?, completion: @escaping MNFErrorOnlyCompletionHandler) -> MNFJob
Parameters
amount
The amount to update to. If null, it will not be updated. Will only affect user created transactions.
categoryId
The categoryId to update to. If null, it will not be updated.
uncertainCategorization
The uncertainCategorization to update to.
useSubText
True if automatic categorization should be matched against subtext otherwise it will by default be matched against text
text
The text to update to. If null, it will not be updated.
date
The date to update to. If null, it will not be updated.
isRead
The isRead status to update to.
isFlagged
The flagged state to update to.
userData
The userData to update to. If null, it will not be updated.
completion
A completion block returning an error.
Return Value
An MNFJob containing an error.