Loan Module help version 4.16

Any issue about Cyclos 4 scripting and Webservices

Moderators: alexandre, hugo, rmvanarkel

Post Reply
Eddomin
Posts: 9
Joined: Thu May 09, 2024 10:26 am

Loan Module help version 4.16

Post by Eddomin »

Hello!

I've been trying to implement the loan module in the Cyclos guide for the Cyclos 4.16 version.

https://documentation.cyclos.org/4.16/c ... ution-loan

I had no problems with it in a 4.15 instance but for the 4.16 version I have a problem with the loan library:

https://documentation.cyclos.org/4.16/c ... an-library

Specifically these 2 lines that I will point out:

ScheduledPayment createRepayment(Payment payment) {

....

def dtoBean = scriptHelper.wrap(dto)
dtoBean.installmentsCount = installments
dtoBean.firstInstallmentDate = firstDueDate

dtoBean[loanField.internalName] = payment //*************This one

......

ScheduledPaymentVO repaymentVO = scheduledPaymentService.perform(dto)
ScheduledPayment repayment = emh.find(ScheduledPayment, repaymentVO.id)

// Update the loan with the repayment link
loanBean[repaymentField.internalName] = repayment //***************This one too

In short, this is the moment where one sets the loan in the transaction custom field of the scheduled payment and visceversa, in order to give a link between the loan and its scheduled payments, and a link back from the scheduled payments to the loan, among other things.

It works fine in the 4.15 version, but the 4.16 version has changed this from using a transaction object to a transfer object. Which neither the payment or repayment objects are. This is the only problem I've been having. It works "fine" if I just don't put that information, but I miss on linking the loan with its scheduled payment, ruining the extension point that closes a loan automatically and possibly other functions.

The payment object has a transfer object within so I can set it as

dtoBean[loanField.internalName] = payment.transfer

But I am not sure this quite fixes it, specially since the repayment object does not have a transfer object, and its internal scheduled payment objects have their transfer as null.

Has anyone checked this? I am not sure if using payment.transfer would work the same, maybe I could make a similar transfer object with the "opposite" information but it might be buggy.

Any help or hint would be very appreciated.

Thank you for your help.
alexandre
Posts: 1122
Joined: Wed Sep 06, 2006 9:06 am

Re: Loan Module help version 4.16

Post by alexandre »

Hi,

Just use the updated documentation:
https://documentation.cyclos.org/4.16/c ... an-library

Regards
Alexandre Caurrinhos
Cyclos development team.
Eddomin
Posts: 9
Joined: Thu May 09, 2024 10:26 am

Re: Loan Module help version 4.16

Post by Eddomin »

Hello! I thank you for your answer! Unfortunately, it is the same code I've been using. Another person I know tried to implement this same module and had the same error.

The code between the 4.15 and the 4.16 versions is also identical, so maybe the code requires an update. I haven't tried yet to make a transfer object for both lines of code, but I will try these days. I will read some more too, but I'd really appreciate if someone could check on it to see. Also you can ask for any other info I can provide that might help.

Thank you very much.
Eddomin
Posts: 9
Joined: Thu May 09, 2024 10:26 am

Re: Loan Module help version 4.16

Post by Eddomin »

Hello! Turns out the guide tells you to still use a transaction object in the section "Create the payment custom fields", for the loan and repayment objects:

https://documentation.cyclos.org/4.16/c ... -tx-fields

But there's a linked entity of type "Payment" now that you can use. The 4.16 version of Cyclos that I am working on is in spanish and I overlooked that option and picked "transaction" while working on it. I assume it is the same in english.

Same thing in the Extension Point. You have to choose a "Payment" extension point now rather than a "Transaction" one:

https://documentation.cyclos.org/4.16/c ... extensions

This way it should work as it did before. I have done a quick test and it seems to work as expected.

Thanks! Have a nice day!
Attachments
4.16 create as transaction custom fields.jpg
4.16 create as transaction custom fields.jpg (99.63 KiB) Viewed 49773 times
4.16 payment option.jpg
4.16 payment option.jpg (43.54 KiB) Viewed 49786 times
4.16 create as transaction EP.jpg
4.16 create as transaction EP.jpg (122.99 KiB) Viewed 49786 times
Post Reply