Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Custom Textarea Box and Authorize.net payment Issue

Custom Textarea Box and Authorize.net payment Issue 15 years 1 month ago #5236

  • mrcctv
  • mrcctv's Avatar Topic Author
  • Visitor
  • Visitor
I’ve found an issue with using Textarea Custom Field and Authorize.net, specifically if there are any Carriage Returns or Line Feeds. Everything works fine up until the Payment Information page;
/index.php?option=com_dtregister&task=payment&type=authorizenet&eventId=6

I’ve narrowed it down to the sendPayment function. Seems while you are building the confirmText variable when you get to the Textarea Custom Field that has a carriage return the confirmText line spans 2 different lines instead of 1 line. In the example the Special Requests field has a carriage return after “This is a test”
/// confirmText = confirmText+"Special Requests: this is a test

Another Test\n";

This causes an error in Java as the single line is now split between 2 lines which will not confirm the payment information, therefore causing the payment process not to continue.

Well I figured out a solution, not sure if it’s the correct way of doing it but it works for now. I would like to know from the experts if this is OK, or will it impact anything. I found the sendPayment function in dtregister.php and found the following.
foreach ($_SESSION['register']['billingInfo'] as $key=>$value){

  if (array_search($key,$arrCustomFields)!= FALSE){$key = array_search($key,$arrCustomFields);}

?>

  /// confirmText = confirmText+"<?php echo $key . ": \t" . $value; ?>\n";

<?php } ?>

I added this line.
$value = trim( preg_replace( '/\s+/', ' ', $value ) );

After this line
if (array_search($key,$arrCustomFields)!= FALSE){$key = array_search($key,$arrCustomFields);}

So it looks like this now.
foreach ($_SESSION['register']['billingInfo'] as $key=>$value){

  if (array_search($key,$arrCustomFields)!= FALSE){$key = array_search($key,$arrCustomFields);}

  $value = trim( preg_replace( '/\s+/', ' ', $value ) );

?>

  /// confirmText = confirmText+"<?php echo $key . ": \t" . $value; ?>\n";

<?php } ?>

All this is doing, well as far as I believe as I’m not good with PHP, is removing any extra Line Feeds, Carriage Returns, and White Spaces.

Please Log in or Create an account to join the conversation.

Custom Textarea Box and Authorize.net payment Issue 15 years 1 month ago #5238

  • dthadmin
  • dthadmin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 5470
  • Thank you received: 3
mrcctv - yes, you found a bug and your fix is fine. We will correct this and update the package today. Sorry for the inconvenience.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.488 seconds