Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-41531

PayPal enrolment - irregular characters in course name derail PayPal registration into course

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Prerequisites:

      1. You'll need a Moodle installation that is visible on the internet. See https://ngrok.com/.
      2. You'll also need to have a PayPal developer account and set up Sandbox accounts (at least 1 facilitator/business and 1 buyer account). For more information, see https://developer.paypal.com/developer/accounts/
      3. Optional: Set up Moodle SMTP settings.

      Procedure

      1. Add $CFG->usepaypalsandbox = 1; in config.php.
      2. Go to Site administration ► Plugins ► Enrolments ► Manage enrol plugins and enable PayPal.
      3. After enabling PayPal, click on the Settings link.
      4. Set the PayPal business email text input to the PayPal facilitator sandbox account.
      5. Under Enrolment instance defaults, set Allow PayPal enrolments to Yes. Set up the desired Enrol cost, then click Save changes.
      6. Create a course with a course name that has non-ASCII characters (like Les élèves).
      7. Navigate to the course and under Users ► Enrolment methods, confirm that PayPal is enabled.
      8. Login as a student with the PayPal buyer sandbox account and pay for the course.
        • Confirm that the payment is accepted and the student gets enrolled in the course.
      9. Check Apache's error log.
        • Confirm that an error similar to

          enrol_paypal IPN exception handler: ...
          ...
          Error code: dmlwriteexception
          ...

          is not being displayed.
      Show
      Prerequisites: You'll need a Moodle installation that is visible on the internet. See https://ngrok.com/ . You'll also need to have a PayPal developer account and set up Sandbox accounts (at least 1 facilitator/business and 1 buyer account). For more information, see https://developer.paypal.com/developer/accounts/ Optional: Set up Moodle SMTP settings. Procedure Add $CFG->usepaypalsandbox = 1; in config.php. Go to Site administration ► Plugins ► Enrolments ► Manage enrol plugins and enable PayPal. After enabling PayPal, click on the Settings link. Set the PayPal business email text input to the PayPal facilitator sandbox account. Under Enrolment instance defaults , set Allow PayPal enrolments to Yes . Set up the desired Enrol cost, then click Save changes . Create a course with a course name that has non-ASCII characters (like Les élèves). Navigate to the course and under Users ► Enrolment methods, confirm that PayPal is enabled. Login as a student with the PayPal buyer sandbox account and pay for the course. Confirm that the payment is accepted and the student gets enrolled in the course. Check Apache's error log. Confirm that an error similar to enrol_paypal IPN exception handler: ... ... Error code: dmlwriteexception ... is not being displayed.
    • Workaround:
      Hide

      enrol/paypal/ipn.php
      foreach ($_POST as $key => $value)

      { $req .= "&$key=".urlencode($value); - $data->$key = $value; + $data->$key = fix_utf8($value); }
      Show
      enrol/paypal/ipn.php foreach ($_POST as $key => $value) { $req .= "&$key=".urlencode($value); - $data->$key = $value; + $data->$key = fix_utf8($value); }
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Pull Master Branch:
      MDL-41531-master

      Description

      It appears that irregular characters in a course name - in this case, the œ dipthong - interfere with course enrolment following PayPal payment. The transaction goes thru OK, but the student is not subsequently automatically enroled on the course page. Replacing the œ dipthong, in this case with a simple o, resolved the problem.

        Attachments

          Activity

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Mar/16