You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@fineract.apache.org by Niklas Uhrberg <Ni...@resurs.se> on 2019/10/25 14:29:37 UTC
Interation patterns for mutating operations in Fineract 1.x and
Fineract CN
Hi!
I have a question about the mode of interaction in Fineract 1.x and Fineract CN.
Let us take holdAmount in savingsacctounts (Fineract 1.x) as an example:
curl -H "Content-Type: application/json" -X POST --user mifos:password -k "https://localhost:8443/fineract-provider/api/v1/savingsaccounts/2/transactions?command=holdAmount&tenantIdentifier=default" --data "@holdamount0.json"
which will return e.g.
{"officeId":1,"clientId":2,"savingsId":2,"resourceId":6}
where resourceId is the id of the transaction in table m_savings_account_transaction holding the resulting data.
Question : Is the interaction pattern such that if I wish to have some additional information e.g. what is the resulting reservable amount in a separate request that only retrieves data?
What leads to this question is that I see the class CommandProcessingResult being used instead of a custom response object with attributes relevant for this particular request.
But, in CommandProcessingResult there is also the attribute
Map<String, Object> changes
which could be used to represent the additional reponse data.
This example is in fact good to illustrate the point that if I really want the new reservable (or holdable) amount after a successful holdAmount operation (say that there is $100 on the account and I hold $10, then the resulting reservable amount is $90) this is only possible using a return value, otherwise there is a race condition if e.g. another holdAmount operation is issued in between.
Over to Fineract CN where the mutating operations are executed asynchronously. Here my question is more basic: Using the same example, how will I be able to get e.g. the resulting resourceId if the operation is purely asynchronous?
I'm sure I just miss some basic information here.
Best regards Niklas
[cid:imageca9768.PNG@fb91fcef.498cd066]
Niklas Uhrberg
Konsult
IT Development | Loans & Credit
Resurs Bank AB
Växel: +46 42 38 20 00
E-post: Niklas.Uhrberg@resurs.se<ma...@resurs.se>
Webb: www.resursbank.se<http://www.resursbank.se>