I am receiving an error in the error log when I try to change a membership plan using the CRE Secure module. I'm upgrading a $9/month plan to a $99/year plan. Here it is:
Unknown Error: Array ( [Warning:__explode()__function.explode]: Empty delimiter in /var/www/vhosts/cresecure.net/securepayments/includes/classes/authnetcim.php on line 472 code=E00003 [message] => The 'AnetApi/xml/v1/schema/AnetApiSchema.xsd:amount' element is invalid - The value '91.460184811828' is invalid according to its datatype 'Decimal' - The FractionDigits constraint failed. [error] => 1 [mPAN] => XXXXXXXXXXXX#### [type] => Visa [exp] => 0115 )Logged at ../modules/ms_core/gateways/ms_cres/ms_cres.module line 916
It appears that because the user has already been charged $9 for the month, your module is doing an automatic calculation on the $99/year to give him credit for his earlier payment and automatically charge the correct amount. However, it's passing a super-complex amount value which CRE Secure can't process: 91.460184811828. I believe CRE Secure can only accept 2 decimal places.
I don't know where in the code you feel would be best to round this value to two decimal places. Perhaps the best solution would be to round $credit in the ms_membership_change_membership_form_submit() function in ms_membership.module. For example, I fixed it by changing line 1825:
- $data['residual_credit'] = $credit;
to
Would you be able to implement this or a similar fix?








I checked the new MS Core 7.x-2.4 release and noticed the above rounding suggestion wasn't implemented in ms_membership.module. I was curious if you had taken a different approach to fix this or if you were just postponing this fix to a later release?