[Solved] How to get user account number in Cyclos version 4.15.x?

Any issue about Cyclos 4 scripting and Webservices

Moderators: alexandre, hugo, rmvanarkel

Post Reply
rajesh
Posts: 22
Joined: Thu Jan 20, 2022 8:35 am

[Solved] How to get user account number in Cyclos version 4.15.x?

Post by rajesh »

Hello Team,

This may be very basic question. We recently upgraded our cyclos from version 4.14.17 to 4.15.5. The code below is working fine for the users that signed before the upgrade; the same script is not working for the users' signed-up after the upgrade. Where to check the changelog about these changes? Can someone help with script to get account details of users signed-up before / after the upgrade.

Code: Select all

import org.cyclos.impl.users.UserServiceImpl

def userService = binding.variables.userService as UserServiceImpl
def user = userService.find(1169)
user.accounts.each { println it.currency }
Thanks for your response in advance.
Last edited by rajesh on Tue Aug 09, 2022 2:23 am, edited 1 time in total.
EdwinMor
Posts: 22
Joined: Tue Sep 15, 2020 10:31 am
Location: El Salvador
Contact:

Re: How to get user account number in Cyclos version 4.15.x?

Post by EdwinMor »

Hi,

It looks like the class User (https://documentation.cyclos.org/4.15.5 ... /User.html) no longer has the user's accounts as an attribute.

You can try searching for the accounts on a separate service call.

Code: Select all

import org.cyclos.impl.users.UserServiceImpl

def userService = binding.variables.userService as UserServiceImpl
def user = userService.find(1169)
def accounts = accountService.getAccountsSummary(user,null)
accounts.each { println it.currency }
Let me know if that helps.
rajesh
Posts: 22
Joined: Thu Jan 20, 2022 8:35 am

Re: How to get user account number in Cyclos version 4.15.x?

Post by rajesh »

Thanks Edwin,

Took a similar approach of using accountService, but consume `listAll` from it. Below is the snippet for the same.

Code: Select all

import org.cyclos.impl.banking.AccountServiceImpl
import org.cyclos.impl.users.UserServiceImpl
import org.cyclos.model.users.users.UserLocatorVO

def userService = binding.userService as UserServiceImpl
def accountService = binding.accountService as AccountServiceImpl

def id = 1234
def userVO = userService.locate(new UserLocatorVO(id))

def accountUSD = accountService.listAll(userVO).find {it -> it.currency.internalName == 'ABC'}
def accountNumber = accountUSD.principal
Post Reply