Moodle
  1. Moodle
  2. MDL-31424

Mismatched Capitalization in Paypal Email Addresses Causes IPN to Fail

    Details

    • Testing Instructions:
      Hide

      see MDL-35456 for detailed info how to test PayPal

      Set up the Paypal plugin with a business email address that is different only in capitalization from your email address used with Paypal.
      Attempt to enrol into a course via Paypal.
      The IPN should not fail and you should be enrolled successfully into the course.

      Show
      see MDL-35456 for detailed info how to test PayPal — Set up the Paypal plugin with a business email address that is different only in capitalization from your email address used with Paypal. Attempt to enrol into a course via Paypal. The IPN should not fail and you should be enrolled successfully into the course.
    • Workaround:
      Hide

      Change the capitalization of the email address in the Paypal settings to match the email address as reported by Paypal in the IPN.

      Show
      Change the capitalization of the email address in the Paypal settings to match the email address as reported by Paypal in the IPN.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull 2.4 Branch:
      w49_MDL-31424_m24_paypalcase
    • Pull Master Branch:
      w49_MDL-31424_m25_paypalcase
    • Rank:
      37949

      Description

      This code in enrol/paypal/ipn.php:

      if ($data->business != $plugin->get_config('paypalbusiness')) {   // Check that the email is the one we want it to be
        message_paypal_error_to_admin("Business email is {$data->business} (not ".
                         $plugin->get_config('paypalbusiness').")", $data);
        die;
      }
      

      causes the IPN to fail and Paypal reports a 404 when the email addresses are the same except for capitalization. For example, one in camelcase and one in lowercase. Since a difference merely of capitalization does not cause a problem with the IPN, both strings should be forced to the same case before comparing them. This will prevent IPNs from failing unnecessarily.

        Issue Links

          Activity

          Hide
          Chris Follin added a comment -

          Attaching patch that converts both strings to lowercase.

          Show
          Chris Follin added a comment - Attaching patch that converts both strings to lowercase.
          Hide
          Petr Škoda added a comment -

          Thanks a lot for the report and patch!

          Show
          Petr Škoda added a comment - Thanks a lot for the report and patch!
          Hide
          Dan Poltawski added a comment -

          Integrated to master, 24, 23 & cherry picked to 22.

          thanks.

          Show
          Dan Poltawski added a comment - Integrated to master, 24, 23 & cherry picked to 22. thanks.
          Hide
          Damyon Wiese added a comment -

          Test passed - works as expected.

          Thanks!

          Show
          Damyon Wiese added a comment - Test passed - works as expected. Thanks!
          Hide
          Damyon Wiese added a comment -

          (Tested on 22, 23 and master).

          Show
          Damyon Wiese added a comment - (Tested on 22, 23 and master).
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now!

          Closing, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now! Closing, ciao

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: