-
- All Implemented Interfaces:
-
android.os.Parcelable
,com.meniga.sdk.models.feed.MenigaFeedItem
,java.io.Serializable
,java.lang.Cloneable
public class MenigaTransaction implements Serializable, MenigaFeedItem, Cloneable, Parcelable
Represents a transaction in the Meniga system. Transactions belong to accounts.
Copyright 2017 Meniga Iceland Inc.
-
-
Field Summary
-
Method Summary
Modifier and Type Method Description static void
setOperator(MenigaTransactionOperations operator)
Sets the api operator for doing api calls void
setIsReadAndUpdate()
boolean
getIsSplitParent()
void
setIsSplitParent(boolean splitParent)
boolean
getIsSplit()
int
describeContents()
void
writeToParcel(Parcel dest, int flags)
boolean
equals(Object o)
int
hashCode()
MenigaTransaction
clone()
String
toString()
Result<MenigaTransactionUpdate>
update()
Updates the user created transaction Result<Void>
delete()
Deletes a user created transaction Result<List<MenigaTransaction>>
fetchSplitChildren()
Gets all the splitTransaction children of this transaction. Result<List<MenigaTransaction>>
fetchSplitParent()
Return the parent of this splitTransaction child transaction. Result<List<MenigaTransaction>>
fetchSplitAndParent()
Returns all split children and parent regardless of who is calling (a split transaction or the parent transaction) Result<List<MenigaTransaction>>
split(MenigaDecimal amount, String text, long categoryId, boolean isFlagged)
Splits a transaction, creating a new connected, splitTransaction transaction, deducting the amount from this (parent) transaction Result<List<MenigaTransaction>>
updateSplits(List<UpdateSplits> update)
Updates split transactions for a particular parent transaction by deleting current split child transactions and creating new splits. Result<MenigaTransaction>
refresh()
Fetches the server version of this object and updates all fields in this object with the server values, essentially syncing it with the server static Result<MenigaTransactionUpdate>
update(List<Long> transToUpdate, MenigaDecimal amount, Long categoryId, boolean hasUncertainCategorization, Boolean useSubTextInRecat, String text, DateTime date, Boolean isRead, Boolean isFlagged, String userData)
Updates a list of transactions. static Result<MenigaTransactionPage>
fetch(List<TransactionsFilter> filters)
Combines multiple calls to the transactions endpoint with multiple filters static Result<MenigaTransactionPage>
fetch(TransactionsFilter transFilter)
Returns all transactions that meet the filter criteria in transFilter static Result<MenigaTransaction>
fetch(long transactionId)
Retrieves a specific transaction with a specific transaction id static Result<MenigaTransaction>
create(DateTime date, String text, MenigaDecimal amount, long categoryId)
Creates a transaction in the user wallet and returns the new transaction. static Result<Void>
deleteTransactions(List<Long> transactionIds)
Deletes a list of user created transactions static Result<Void>
recategorize(List<String> transactionTexts, Boolean recategorizeUnreadOnly, Boolean useSubTextInRecat, Boolean markAsRead)
Recategorize transactions by text(s). static Result<List<MenigaComment>>
addComments(List<Long> transactionIds, String comment)
Create a comment for a list of transaction ids. String
getParentIdentifier()
long
getId()
MenigaDecimal
getAmount()
MenigaDecimal
getBookedAmount()
List<String>
getTags()
List<MenigaComment>
getComments()
Long
getCategoryId()
DateTime
getDate()
String
getText()
DateTime
getOriginalDate()
String
getOriginalText()
MenigaDecimal
getOriginalAmount()
Boolean
getIsRead()
Boolean
getIsFlagged()
boolean
getHasUncertainCategorization()
Long
getAccountId()
MenigaAccount
getAccount()
Integer
getMcc()
List<MenigaCategoryScore>
getDetectedCategories()
String
getCurrency()
MenigaDecimal
getAmountInCurrency()
Integer
getDataFormat()
Long
getMerchantId()
MenigaMerchant
getMerchant()
List<MenigaMerchant>
getMerchants()
String
getBankId()
DateTime
getInsertTime()
Boolean
getHasUserClearedCategoryUncertainty()
Boolean
getIsUncleared()
MenigaDecimal
getBalance()
DateTime
getCategoryChangedTime()
Long
getChangedByRule()
DateTime
getChangedByRuleTime()
String
getCounterpartyAccountIdentifier()
DateTime
getDueDate()
DateTime
getLastModifiedTime()
List<ParsedData>
getParsedData()
String
getData()
MenigaDecimal
getRedeemed()
MenigaDecimal
getToRedeem()
MenigaDecimal
getRemainingToSpend()
Boolean
getBelongsToExpiredOffer()
String
getReason()
long
getTimeStamp()
String
getUserData()
String
getEventTypeIdentifier()
String
getTopicName()
void
setAmount(MenigaDecimal amount)
void
setCategoryId(long categoryId)
void
setDate(DateTime date)
void
setIsRead(boolean isRead)
void
setIsFlagged(boolean isFlagged)
void
setHasUncertainCategorization(boolean uncertain)
void
setUserData(String data)
-
-
Method Detail
-
setOperator
static void setOperator(MenigaTransactionOperations operator)
Sets the api operator for doing api calls
- Parameters:
operator
- An object that implements the MenigaTransactionOperations interface for carrying out api operations on this class.
-
setIsReadAndUpdate
void setIsReadAndUpdate()
-
getIsSplitParent
boolean getIsSplitParent()
-
setIsSplitParent
void setIsSplitParent(boolean splitParent)
- Parameters:
splitParent
- Sets a flag that indicates that this transaction is a split parent and contains split children
-
getIsSplit
boolean getIsSplit()
-
describeContents
int describeContents()
-
writeToParcel
void writeToParcel(Parcel dest, int flags)
-
hashCode
int hashCode()
-
clone
MenigaTransaction clone()
-
update
Result<MenigaTransactionUpdate> update()
Updates the user created transaction
-
fetchSplitChildren
Result<List<MenigaTransaction>> fetchSplitChildren()
Gets all the splitTransaction children of this transaction. If this transaction is a splitTransaction child, this function will returnan empty list. If this transaction is not splitTransaction, it will also return an empty list.
-
fetchSplitParent
Result<List<MenigaTransaction>> fetchSplitParent()
Return the parent of this splitTransaction child transaction. If this is not a splitTransaction child, then the result will be null.
-
fetchSplitAndParent
Result<List<MenigaTransaction>> fetchSplitAndParent()
Returns all split children and parent regardless of who is calling (a split transaction or the parent transaction)
-
split
Result<List<MenigaTransaction>> split(MenigaDecimal amount, String text, long categoryId, boolean isFlagged)
Splits a transaction, creating a new connected, splitTransaction transaction, deducting the amount from this (parent) transaction
- Parameters:
amount
- The amount that the splitTransaction transaction should have, this amount will be deducted from this (parent) transactiontext
- The text for the split transactioncategoryId
- The category id of the new transactionisFlagged
- Setwether the split transaction should be flagged or not
-
updateSplits
Result<List<MenigaTransaction>> updateSplits(List<UpdateSplits> update)
Updates split transactions for a particular parent transaction by deleting current split child transactions and creating new splits.
- Parameters:
update
- The new data for all the transaction's split children
-
refresh
Result<MenigaTransaction> refresh()
Fetches the server version of this object and updates all fields in this object with the server values, essentially syncing it with the server
-
update
static Result<MenigaTransactionUpdate> update(List<Long> transToUpdate, MenigaDecimal amount, Long categoryId, boolean hasUncertainCategorization, Boolean useSubTextInRecat, String text, DateTime date, Boolean isRead, Boolean isFlagged, String userData)
Updates a list of transactions.
- Parameters:
transToUpdate
- The IDs of the transactions that should be updated.amount
- The updated amount of the transactions.categoryId
- The updated category ID for the transactions.hasUncertainCategorization
- Whether or not the transaction has uncertain categorization.useSubTextInRecat
- True if automatic categorization should be matched against subtext otherwise it will by default be matched against text.text
- The updated text of the transaction.date
- The updated date of the transactions.isRead
- Set whether a transaction has been read or not.isFlagged
- Set whether a transaction should be flagged or not.userData
- Holds extra custom data that is not parsed or read via the transaction data format parser
-
fetch
static Result<MenigaTransactionPage> fetch(List<TransactionsFilter> filters)
Combines multiple calls to the transactions endpoint with multiple filters
- Parameters:
filters
- A list containing all the filters.
-
fetch
static Result<MenigaTransactionPage> fetch(TransactionsFilter transFilter)
Returns all transactions that meet the filter criteria in transFilter
- Parameters:
transFilter
- A filter object for selecting the transactions
-
fetch
static Result<MenigaTransaction> fetch(long transactionId)
Retrieves a specific transaction with a specific transaction id
- Parameters:
transactionId
- The id of the transaction to retrieve
-
create
static Result<MenigaTransaction> create(DateTime date, String text, MenigaDecimal amount, long categoryId)
Creates a transaction in the user wallet and returns the new transaction.
- Parameters:
date
- Date of the transaction.text
- The title of the transactionamount
- The amount of the transactioncategoryId
- The category of the new transaction
-
deleteTransactions
static Result<Void> deleteTransactions(List<Long> transactionIds)
Deletes a list of user created transactions
- Parameters:
transactionIds
- The ids of the user transactions to delete
-
recategorize
static Result<Void> recategorize(List<String> transactionTexts, Boolean recategorizeUnreadOnly, Boolean useSubTextInRecat, Boolean markAsRead)
Recategorize transactions by text(s). If categoryId is set, the matching transactions will be recategorized as the category specified by categoryId.
- Parameters:
transactionTexts
- The texts used to find transactions to recategorizerecategorizeUnreadOnly
- Recategorize only unread transactions if true, otherwise recategorize unread or read transactionsuseSubTextInRecat
- Whether to include the subText field when searching for transactions to recategorizemarkAsRead
- Mark recategorized transactions as read or not
-
addComments
static Result<List<MenigaComment>> addComments(List<Long> transactionIds, String comment)
Create a comment for a list of transaction ids. If the comment contains any tags (words starting with '#') they are automaticallycreated and associated with these transaction if they do not already exist.
- Parameters:
transactionIds
- The ids of the user transactions to add the commentcomment
- The new comment to add to transactions
-
getParentIdentifier
String getParentIdentifier()
-
getId
long getId()
-
getAmount
MenigaDecimal getAmount()
-
getBookedAmount
MenigaDecimal getBookedAmount()
-
getComments
List<MenigaComment> getComments()
-
getCategoryId
Long getCategoryId()
-
getDate
DateTime getDate()
-
getOriginalDate
DateTime getOriginalDate()
-
getOriginalText
String getOriginalText()
-
getOriginalAmount
MenigaDecimal getOriginalAmount()
-
getIsFlagged
Boolean getIsFlagged()
-
getHasUncertainCategorization
boolean getHasUncertainCategorization()
-
getAccountId
Long getAccountId()
-
getAccount
MenigaAccount getAccount()
-
getDetectedCategories
List<MenigaCategoryScore> getDetectedCategories()
-
getCurrency
String getCurrency()
-
getAmountInCurrency
MenigaDecimal getAmountInCurrency()
-
getDataFormat
Integer getDataFormat()
-
getMerchantId
Long getMerchantId()
-
getMerchant
MenigaMerchant getMerchant()
-
getMerchants
List<MenigaMerchant> getMerchants()
-
getInsertTime
DateTime getInsertTime()
-
getHasUserClearedCategoryUncertainty
Boolean getHasUserClearedCategoryUncertainty()
-
getIsUncleared
Boolean getIsUncleared()
-
getBalance
MenigaDecimal getBalance()
-
getCategoryChangedTime
DateTime getCategoryChangedTime()
-
getChangedByRule
Long getChangedByRule()
-
getChangedByRuleTime
DateTime getChangedByRuleTime()
-
getCounterpartyAccountIdentifier
String getCounterpartyAccountIdentifier()
-
getDueDate
DateTime getDueDate()
-
getLastModifiedTime
DateTime getLastModifiedTime()
-
getParsedData
List<ParsedData> getParsedData()
-
getRedeemed
MenigaDecimal getRedeemed()
-
getToRedeem
MenigaDecimal getToRedeem()
-
getRemainingToSpend
MenigaDecimal getRemainingToSpend()
-
getBelongsToExpiredOffer
Boolean getBelongsToExpiredOffer()
-
getTimeStamp
long getTimeStamp()
-
getUserData
String getUserData()
-
getEventTypeIdentifier
String getEventTypeIdentifier()
-
getTopicName
String getTopicName()
-
setAmount
void setAmount(MenigaDecimal amount)
- Parameters:
amount
- The amount of the transaction.
-
setCategoryId
void setCategoryId(long categoryId)
- Parameters:
categoryId
- Sets a new category for the transaction.
-
setDate
void setDate(DateTime date)
- Parameters:
date
- The new date for the transaction.
-
setIsRead
void setIsRead(boolean isRead)
- Parameters:
isRead
- Sets the transaction to be read or not.
-
setIsFlagged
void setIsFlagged(boolean isFlagged)
- Parameters:
isFlagged
- If you want the transaction to be flagged or not.
-
setHasUncertainCategorization
void setHasUncertainCategorization(boolean uncertain)
- Parameters:
uncertain
- Sets the transaction to have uncertain categorization or not.
-
setUserData
void setUserData(String data)
-
-
-
-