Main Broker in Generated payment type

Any issue about Cyclos 4 scripting and Webservices

Moderators: alexandre, hugo, rmvanarkel

Post Reply
ah_barry
Posts: 4
Joined: Fri Apr 30, 2021 4:18 pm

Main Broker in Generated payment type

Post by ah_barry »

Hello,
We have a script that returns the monthly fees charged to those users who hold a chequing account. That script is called by a Generated Payment Type and runs on the 1st of the month on all chequing accounts.
The question we have for you is, how do we retrieve the main broker of the user in the script while the " Generated Payment Type" is running on chequing accounts ?

I have attached a few screenshots to help you understand the context.

Thank you for your help.
Attachments
image(1).png
image(1).png (23.76 KiB) Viewed 58292 times
image(2).png
image(2).png (52.19 KiB) Viewed 58292 times
luis
Posts: 265
Joined: Fri Feb 17, 2006 11:01 am

Re: Main Broker in Generated payment type

Post by luis »

The question we have for you is, how do we retrieve the main broker of the user in the script while the " Generated Payment Type" is running on chequing accounts ?
I didn't understand the question, as you're already retrieving the main broker with fromUser.mainBroker.
Please, share some additional details.
Luis Fernando Planella Gonzalez
Cyclos development team
ah_barry
Posts: 4
Joined: Fri Apr 30, 2021 4:18 pm

Re: Main Broker in Generated payment type

Post by ah_barry »

Okay let me try again, It is not easy to explain this.
We have a generated payment type which charge X amount to all chequing accounts. X amount is returned by a script. The thing is we want to share (half of the amount charged: X/2) with the mainbroker of the chequing account holder. Therefore we need to retrieve the mainBroker in the script before returning the amount to be charged. I know it is a bit twisted, another alternative would be to have a loop to retrieve all chequing accounts; something like this:
foreach chequing account
balance = balance - 1200
if (user has mainBroker)
mainBroker.Balance = mainBroker.Balance + 1200/2
endif
endforeach

Thanks.
luis
Posts: 265
Joined: Fri Feb 17, 2006 11:01 am

Re: Main Broker in Generated payment type

Post by luis »

Ok, so if I understand correctly, all you need is to have a transfer fee in the transfer type "Automated Monthly Account Fees".
It would be configured as follows:
  • Will be charged: System
  • Will receive: Destination broker
  • Amount: 50%
When you set the broker as one of the transfer fee ends, it is always the main broker.
Would that be enough?
Luis Fernando Planella Gonzalez
Cyclos development team
Post Reply