Unsuccessful registration thruogh SMS should send feedback

Any communication concerning the SMS module

Moderators: hugo, alexandre, rmvanarkel

ken4ward
Posts: 94
Joined: Tue Sep 18, 2012 3:29 pm

Unsuccessful registration thruogh SMS should send feedback

Post by ken4ward » Wed Jul 24, 2013 11:44 am

Please, I have been on this for a while. All I want to do is that when a person tries to register through SMS, if he sends as part of the parameter a username or phone that is already in the database a feedback should be sent to him that the username or phone is already in use.
After many trials, I imported the Cyclos SMS code into Eclipse Juno and found out the command class for registration - (RegistrationCommand.java). I got to understand that instead of sending a feedback to the person who wants to register anew using SMS channel it logs it. How do I pass this log to the class (HttpGatewayEngine.java ) that sends sends it back to the person (originating mobile number) who wants to register so that he can know that the registration is not successful, and try another option.

I have tried this options:
1. In the cyclosInstance.properties file, within where registration commands are declared I created this as an addition:

Code: Select all

 ------- command.registration.fail=Kindly try again the username or phone number is already in use.
2. In the RegistrationCommand class I added this so that when the registration fails it will still send it to the originating mobile number:

Code: Select all

-------   protected void executeCommand(...., ....., ....){
                ----------------------------------------------------
               if (registrationResult.isAwaitingEmailValidation()) {
                 ----------------------------------------------------
                  throw new CommandException(...., ...., ...., ....);
                
                 //This is the code I added------ from here---
                  String messages =  "command." + name + ".fail";
                  new RegistrationCommand().getRequiredI18NKeys().toString().equals(messages);
                 //This is the code I added-----to here-----
                  }
               }
...when i did this and try to run the SMS module, I washed the monitor to see the logs, send a registration command to register an existing username, but it does not log more than the command class. What should I do?

To buttress what I am trying to communicate I have attached two images, please view. The "Cyclos SMS failed registration log.png" shows the log file when registration fails due to an already existing username being used. The "Cyclos SMS registration flow.png" shows the classes that are invoked during both failed registration and successful registration.
When this message is logged when the registration is unsuccessful, how do I get it to be sent back to the originating mobile number that the registration failed due to a parameter that already exist.
Attachments
Cyclos SMS registration flow.png
The "Cyclos SMS registration flow.png" shows the classes that are invoked during both failed registration and successful registration.
Cyclos SMS registration flow.png (14.82 KiB) Viewed 7704 times
Cyclos SMS failed registration log.png
The "Cyclos SMS failed registration log.png" shows the log file when registration fails due to an already existing username being used.
Cyclos SMS failed registration log.png (34.58 KiB) Viewed 7704 times

alexandre
Posts: 833
Joined: Wed Sep 06, 2006 9:06 am

Re: Unsuccessful registration thruogh SMS should send feedba

Post by alexandre » Wed Jul 24, 2013 2:48 pm

HI,

I think these is what you need:

When the class RegistrationCommand tries to register a member in cyclos and cyclos generate an exception
This exception is capturedin the lines

} catch (final Exception e) {
throw new CommandException(
CodeSupportedError.CAN_NOT_REGISTER,
getErrorCode(CodeSupportedError.CAN_NOT_REGISTER),
"Error on member registration: " + e.getCause().getMessage(),
e);
}

and threated on teh method:

RegistrationErrorHandler.doHandleException(
final CommandException e,
final CyclosInstanceConfig cyclosInstance)

If you want that an SMS are sent you need to activate the following config on teh config.xml file (documentation available in http://www.cyclos.org/wiki/index.php/Se ... n_settings):

<?xml version="1.0" encoding="UTF-8"?>
<controller ...>
<cyclosInstances>
<cyclosInstance ...>
...
<command name="registration" ...>
<parameter name="notifyErrorByDriver" value="true"/>

Regards
Alexandre Caurrinhos
Cyclos development team.

ken4ward
Posts: 94
Joined: Tue Sep 18, 2012 3:29 pm

Re: Unsuccessful registration thruogh SMS should send feedba

Post by ken4ward » Thu Jul 25, 2013 7:45 am

Thanks, Alex. The price for ignorance is high. I have been on this for days just mazing around in the code of the application not knowing that it's a simple step to get it done. With this simple professional advice it worked perfectly. Though a step further I'll want to take it to, when the feedback was sent, it sent it thus:
----- "Registration member failed. (501)".
Please can the code (501) be replaced with the cause of the failure? So that instead of feedback reading as above it should read thus:
------ "Registration member failed (The given login name 'ken4ward' is already in use)", or
------ "Registration member failed (The given login name is already in use)".
Thanks. It will be okay this way so that the person who wants to register will know the cause of the failure.
Thanks a lot!

alexandre
Posts: 833
Joined: Wed Sep 06, 2006 9:06 am

Re: Unsuccessful registration thruogh SMS should send feedba

Post by alexandre » Thu Jul 25, 2013 8:51 am

Hi,

Here you can see how to change the error keys
http://www.cyclos.org/wiki/index.php/Tr ... ation_keys

The 501 error are generated when the username or phone number are already in use, so you can just change the translation of the error to something like
"Registration member failed. The given login name or phone number are already in use"

Regards,
Alexandre Caurrinhos
Cyclos development team.

ken4ward
Posts: 94
Joined: Tue Sep 18, 2012 3:29 pm

Re: Unsuccessful registration thruogh SMS should send feedba

Post by ken4ward » Thu Jul 25, 2013 1:19 pm

Alexandra, thanks. Simple things like this could make one go weird when it takes a long time solving. Your professional advice saved a bunch! Please this could sound like a toddler's question, but bear with me. I have done it before, but Cyclos is a complex machine, one could easily forget the way he'd achieved a thing if not well documented. I have created the currency type to be used on the platform, the simple question is how do I set it as the default and stop using "units". Thank you.God bless in Jesus name.

alexandre
Posts: 833
Joined: Wed Sep 06, 2006 9:06 am

Re: Unsuccessful registration thruogh SMS should send feedba

Post by alexandre » Thu Jul 25, 2013 1:51 pm

HI,

On SMS you set on config.xml the currency with default="true"
<currency symbol="units" default="true">
So you don't need to inform teh currency at commands.

On cyclos you canonly remove the association of accounts on admin and member groups or remove the permissions of Transfer types. This way your members/admins you have only one currency.

Regards,
Alexandre Caurrinhos
Cyclos development team.

ken4ward
Posts: 94
Joined: Tue Sep 18, 2012 3:29 pm

Re: Unsuccessful registration thruogh SMS should send feedba

Post by ken4ward » Mon Jul 29, 2013 8:04 am

Thanks a lot, Alexandra. My appreciation goes beyond writing. My next quest is to enable or use the Card feature in Cyclos. I have created a card template as the admin, created a user to make use of this card, but could not find where on the user's menu on how to use the card feature. It's only the POS feature I found. Is there any further configuration to be done to make it accessible to the user? Thanks.

alexandre
Posts: 833
Joined: Wed Sep 06, 2006 9:06 am

Re: Unsuccessful registration thruogh SMS should send feedba

Post by alexandre » Mon Jul 29, 2013 9:14 am

HI,

You can use the card as an identification method, this can be used in POS, WebPOS, and any other channel including teh main web channel. For use the the card to login on main web you need to enable the card in the channel.

Regards,
Alexandre Caurrinhos
Cyclos development team.

ken4ward
Posts: 94
Joined: Tue Sep 18, 2012 3:29 pm

Re: Unsuccessful registration thruogh SMS should send feedba

Post by ken4ward » Mon Jul 29, 2013 9:43 am

Thanks very much. I appreciate.

ken4ward
Posts: 94
Joined: Tue Sep 18, 2012 3:29 pm

Re: Unsuccessful registration thruogh SMS should send feedba

Post by ken4ward » Thu Aug 01, 2013 4:35 am

Really appreciate your candid support. Leveraging on your shared skills in Cyclos have made me scale many hurdles that could have taken a long time to get around with. Taking a step further into familiarizing with Cyclos, though I know this ought not to be the right place to post this but since you have been a help to me on this thread I'd probably continue to get your attention here. I am breaking a new sphere of developing a module, or more or less, a plugin that calculates the exchange rate.

The reason for this is that we will be dealing with the real time currencies like Dollars ($), Pounds (£), Euro (£), Naira (N), etc on our platform, and all these currencies will have their daily exchange rate with our Cyclos default currency, which is not a conventional one. We may be getting our daily exchange rate of all of these conventional currencies from a reliable source like "www.xe.com", but we will be determining the exchange rate for ours. So, my new quest is how do I start? Where do I start from? I have imported Cyclos into Eclipse Juno as I followed the setup tutorial on the wiki. For a project like this, are there classes that I am to reference? Which I am very sure that it's yes. Please kindly put me through the step by step of how to create a plugin or module in Cyclos. Thanks.

alexandre
Posts: 833
Joined: Wed Sep 06, 2006 9:06 am

Re: Unsuccessful registration thruogh SMS should send feedba

Post by alexandre » Thu Aug 01, 2013 9:11 am

HI,

Maybe you can use the extension points for this.
See http://www.cyclos.org/wiki/index.php/Extension_points

Regards,
Alexandre Caurrinhos
Cyclos development team.

luis
Posts: 179
Joined: Fri Feb 17, 2006 11:01 am

Re: Unsuccessful registration thruogh SMS should send feedba

Post by luis » Thu Aug 01, 2013 11:03 am

Cyclos doesn't support payments between different currencies - the from and to accounts types of a transfer type must have the same currency.
In theory, to support exchange between currencies, you would need to have trade accounts, which are system accounts for each currency.
So, for an user to convert internal units to dollars, there should be an specific transfer type from the member units account to the system units trade account. That transfer type would contain a transaction fee which generates a payment from the system trade dollars account to the member's dollar account (the fee needs to be configured to charge system and pay to the original from member).
The issue are the charge percentages, which would need to be adjusted periodically. You could do that externally, changing the database directly (but then you need to disable the hibernate second level cache, or the data will be cached on memory, ignoring the db changes).
So, I'd suggest to first configure the application with all those account types, transfer types and fees. Once you have it, it's a matter of adjusting the charge amounts. Then, I think the easiest way to handle that is externally, directly on the DB.
Luis Fernando Planella Gonzalez
Cyclos development team

ken4ward
Posts: 94
Joined: Tue Sep 18, 2012 3:29 pm

Re: Unsuccessful registration thruogh SMS should send feedba

Post by ken4ward » Fri Aug 02, 2013 7:32 am

Luis and Alexandra, I so much appreciate your contributions. Definitely, what you noted I'll go by the way. To deviate a bit, I want to create a Cyclos instance with Nigeria local languages. At least we have 3 major local languages in Nigeria. According to my faint knowledge in Cyclos for now, I think the files I need to create are internationalization files and the error files; is that all I need to create? After that I'll go into Cyclos (settings -> local Settings [Internationalization]), and change the language to the newly created language. When I tried this out, a dialog displayed this message:

"Changing language will replace the translations file.
Any customized messages will be lost.
Do you want to continue?"


..then I got to understand that that I'll need to create translation files;am I right? how do I create this?. My last question is this: Does it mean that for every language I want I have to create a Cyclos instance for each?, because what I understand by a Cyclos instance is like saying: http://www.cycloshosted.com, http://cycloshostedhere.com. This simply shows 2 Cyclos instances. Am I right?. Bear with my ignorance. If I am totally off-track, please kindly redirect me. If it is to be a school course, just assume I am a year-one student taking Cyclos -101. Laugh! Thanks.
Last edited by ken4ward on Fri Aug 02, 2013 7:56 am, edited 3 times in total.

ken4ward
Posts: 94
Joined: Tue Sep 18, 2012 3:29 pm

Re: Unsuccessful registration thruogh SMS should send feedba

Post by ken4ward » Fri Aug 02, 2013 7:47 am

luis wrote:Cyclos doesn't support payments between different currencies - the from and to accounts types of a transfer type must have the same currency.
In theory, to support exchange between currencies, you would need to have trade accounts, which are system accounts for each currency.
So, for an user to convert internal units to dollars, there should be an specific transfer type from the member units account to the system units trade account. That transfer type would contain a transaction fee which generates a payment from the system trade dollars account to the member's dollar account (the fee needs to be configured to charge system and pay to the original from member).
The issue are the charge percentages, which would need to be adjusted periodically. You could do that externally, changing the database directly (but then you need to disable the hibernate second level cache, or the data will be cached on memory, ignoring the db changes).
So, I'd suggest to first configure the application with all those account types, transfer types and fees. Once you have it, it's a matter of adjusting the charge amounts. Then, I think the easiest way to handle that is externally, directly on the DB.
. Thanks. Please after doing these configurations, how do I connect it to a real time database of exchange rate website like http://www.xe.com/currencyconverter/? I want to be getting the auto exchange rate online real-time without having any daily hassle of manually changing the rates myself per day. Thanks. Your expertise shared is of great worth!

luis
Posts: 179
Joined: Fri Feb 17, 2006 11:01 am

Re: Unsuccessful registration thruogh SMS should send feedba

Post by luis » Fri Aug 02, 2013 8:53 am

ken4ward wrote:Luis and Alexandra, I so much appreciate your contributions. Definitely, what you noted I'll go by the way. To deviate a bit, I want to create a Cyclos instance with Nigeria local languages. At least we have 3 major local languages in Nigeria. According to my faint knowledge in Cyclos for now, I think the files I need to create are internationalization files and the error files; is that all I need to create? After that I'll go into Cyclos (settings -> local Settings [Internationalization]), and change the language to the newly created language. When I tried this out, a dialog displayed this message:

"Changing language will replace the translations file.
Any customized messages will be lost.
Do you want to continue?"


..then I got to understand that that I'll need to create translation files;am I right? how do I create this?. My last question is this: Does it mean that for every language I want I have to create a Cyclos instance for each?, because what I understand by a Cyclos instance is like saying: http://www.cycloshosted.com, http://cycloshostedhere.com. This simply shows 2 Cyclos instances. Am I right?. Bear with my ignorance. If I am totally off-track, please kindly redirect me. If it is to be a school course, just assume I am a year-one student taking Cyclos -101. Laugh! Thanks.
Each Cyclos instance only supports a single language. When changing the language on settings, any custom translation keys are lost.
Luis Fernando Planella Gonzalez
Cyclos development team

Post Reply