public class ServiceHelper
extends java.lang.Object
| Constructor and Description |
|---|
ServiceHelper() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
addAppkeyValueToJson(java.lang.String appKey,
java.lang.String jsonString)
Add appKey value to the json string.
|
static java.lang.String |
getContentForBase64EncodedMessage(java.lang.String apiResponse)
Get Base64 encoded content from the API message containing bas64 encoding indicator and base64 encoded content
Mambu API returns encoded files in the following format: "data:image/jpg;base64,/9j...." The encoded string is
base64 encoded with CRLFs, E.g.
|
static java.lang.Class<?> |
getFullDetailsClass(MambuEntityType entityType)
Get class corresponding to the "full details" class for a Mambu Entity.
|
static java.lang.String |
getKeyForAccount(com.mambu.accounts.shared.model.Account account)
Gets the encodedKey or the ID from the account passed as parameter in a call to this method.
|
static java.lang.String |
getUndoCloserTransactionType(com.mambu.loans.shared.model.LoanAccount account)
Helper to determine the type of the Undo Closer Transaction for a closed loan account.
|
static java.lang.String |
getUndoCloserTransactionType(com.mambu.savings.shared.model.SavingsAccount account)
Helper to determine the type of the Undo Closer Transaction for a closed savings account.
|
static <T> java.lang.String |
makeApiJson(T object)
Generate a JSON string for an object using Mambu's default date time format ("yyyy-MM-dd'T'HH:mm:ssZ")
|
static <T> java.lang.String |
makeApiJson(T object,
ApiDefinition apiDefinition)
Generate a JSON string for an object and with the specified ApiDefinition
|
static <T> java.lang.String |
makeApiJson(T object,
java.lang.String dateTimeFormat)
Generate a JSON string for an object and with the specified format for date fields
|
static <T> com.google.gson.JsonElement |
makeApiJsonElement(T object,
ApiDefinition apiDefinition)
Generate a JsonElement for an object and with the specified ApiDefinition
|
static com.mambu.api.server.handler.loan.model.JSONApplyManualFee |
makeJSONApplyManualFeeRequest(java.util.List<com.mambu.loans.shared.model.CustomPredefinedFee> transactionFees,
java.lang.Integer repaymentNumber,
java.lang.String notes)
Create JSON Transaction request for submitting applying predefined fee and specifying repayment number
Available since Mambu 4.1.
|
static com.mambu.api.server.handler.loan.model.JSONTransactionRequest |
makeJSONTransactionRequest(com.mambu.core.shared.model.Money amount,
java.util.Date backDate,
java.util.Date firstRepaymentDate,
com.mambu.accounts.shared.model.TransactionDetails transactionDetails,
java.util.List<com.mambu.loans.shared.model.CustomPredefinedFee> transactionFees,
java.util.List<com.mambu.core.shared.model.CustomFieldValue> customInformation,
java.lang.String notes)
Create JSONTransactionRequest for submitting JSON transaction API requests
|
static com.mambu.api.server.handler.loan.model.JSONTransactionRequest |
makeJSONTransactionRequest(com.mambu.core.shared.model.Money amount,
com.mambu.loans.shared.model.DisbursementDetails disbursementDetails,
java.util.List<com.mambu.core.shared.model.CustomFieldValue> customInformation,
java.lang.String notes)
Convenience method to create JSONTransactionRequest specifying disbursement details
|
static ParamsMap |
makePaginationParams(java.lang.String offset,
java.lang.String limit)
Convenience helper to make parameters map which contains only pagination parameters: offset and limit
|
static ParamsMap |
makeParamsForDocumentJson(com.mambu.api.server.handler.documents.model.JSONDocument document)
Create ParamsMap with a JSON string for the JSONDocument object
|
static ParamsMap |
makeParamsForLoanSchedule(com.mambu.loans.shared.model.LoanAccount account,
ApiDefinition apiDefinition)
Create ParamsMap with a map of fields for the GET loan schedule for the product API.
|
static ParamsMap |
makeParamsForTransactionRequest(java.lang.String transactionType,
com.mambu.api.server.handler.loan.model.JSONTransactionRequest transactionRequest)
Create params map with as JSON request message for a transaction type
|
public static com.mambu.api.server.handler.loan.model.JSONTransactionRequest makeJSONTransactionRequest(com.mambu.core.shared.model.Money amount,
java.util.Date backDate,
java.util.Date firstRepaymentDate,
com.mambu.accounts.shared.model.TransactionDetails transactionDetails,
java.util.List<com.mambu.loans.shared.model.CustomPredefinedFee> transactionFees,
java.util.List<com.mambu.core.shared.model.CustomFieldValue> customInformation,
java.lang.String notes)
amount - transaction amountbackDate - transaction back datefirstRepaymentDate - first repayment datetransactionDetails - transaction detailstransactionFees - transaction feescustomInformation - transaction custom fieldsnotes - transaction notespublic static com.mambu.api.server.handler.loan.model.JSONTransactionRequest makeJSONTransactionRequest(com.mambu.core.shared.model.Money amount,
com.mambu.loans.shared.model.DisbursementDetails disbursementDetails,
java.util.List<com.mambu.core.shared.model.CustomFieldValue> customInformation,
java.lang.String notes)
amount - transaction amountdisbursementDetails - disbursement detailscustomInformation - transaction custom fieldsnotes - transaction notespublic static com.mambu.api.server.handler.loan.model.JSONApplyManualFee makeJSONApplyManualFeeRequest(java.util.List<com.mambu.loans.shared.model.CustomPredefinedFee> transactionFees,
java.lang.Integer repaymentNumber,
java.lang.String notes)
transactionFees - transaction feesrepaymentNumber - repayment number. Applicable only for loan transactions. Must be set to null for savings apply fee
transactionnotes - transaction notespublic static ParamsMap makeParamsForTransactionRequest(java.lang.String transactionType, com.mambu.api.server.handler.loan.model.JSONTransactionRequest transactionRequest)
transactionType - transaction type string. Example: "DISBURSEMENT"transactionRequest - jSON transaction request. If null then the JSON string with only the transactionType is returned.public static ParamsMap makeParamsForDocumentJson(com.mambu.api.server.handler.documents.model.JSONDocument document)
document - JSONDocument document containing Document object and documentContent stringpublic static java.lang.String getContentForBase64EncodedMessage(java.lang.String apiResponse)
apiResponse - api response message containing base64 indicator and base64 encoded stringpublic static ParamsMap makeParamsForLoanSchedule(com.mambu.loans.shared.model.LoanAccount account, ApiDefinition apiDefinition)
account - input loan accountapiDefinition - api definition containing custom serializer for loan account to support generating request only with
those fields required by the GET schedule APIpublic static <T> java.lang.String makeApiJson(T object)
object - objectpublic static <T> java.lang.String makeApiJson(T object,
java.lang.String dateTimeFormat)
object - objectdateTimeFormat - date time format string. Example: "yyyy-MM-dd". If null then the default date time format is used
("yyyy-MM-dd'T'HH:mm:ssZ")public static <T> java.lang.String makeApiJson(T object,
ApiDefinition apiDefinition)
object - objectapiDefinition - API definitionpublic static <T> com.google.gson.JsonElement makeApiJsonElement(T object,
ApiDefinition apiDefinition)
object - objectapiDefinition - API definitionpublic static ParamsMap makePaginationParams(java.lang.String offset, java.lang.String limit)
offset - pagination offset. If not null it must be an integer greater or equal to zerolimit - pagination limit. If not null the must be an integer greater than zeropublic static java.lang.String addAppkeyValueToJson(java.lang.String appKey,
java.lang.String jsonString)
appKey - app key value. Can be nulljsonString - json string.public static java.lang.Class<?> getFullDetailsClass(MambuEntityType entityType)
entityType - entity type. Must not be nullpublic static java.lang.String getUndoCloserTransactionType(com.mambu.loans.shared.model.LoanAccount account)
account - loan account. Must not be null and its state must not be null.public static java.lang.String getUndoCloserTransactionType(com.mambu.savings.shared.model.SavingsAccount account)
account - savings account. Must not be null and its state must not be null.public static java.lang.String getKeyForAccount(com.mambu.accounts.shared.model.Account account)
account - The account used to obtain the ID or the encoded key from.