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

PayPal IPN improvements

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.2
    • Component/s: Enrolments
    • Labels:
    • Testing Instructions:
      Hide

      ngrok is needed for this test. mailcatcher is desirable but not necessary (you could use gmail's SMTP server instead or something)

      1. Create a new user with a valid email that you can check the inbox of
      2. Make sure the admin user's email is also a valid email you can check the inbox of
      3. Edit config.php, adding the following line just before the require_once(...setup.php);

        $CFG->usepaypalsandbox = true;
        

      4. Now is probably also a good time to set up your ngrok tunnel and change $CFG->wwwroot to match
      5. It would also be a good idea to get email stuff working now
      6. Set up PayPal sandbox:
        1. Login to developer.paypal.com/ and go to the dashboard
        2. Under "Sandbox" click "Accounts"
        3. Create two accounts, one business account and one personal account. Make sure the personal one has lots of money (two accounts may already exist by default, I think you can edit them)
        4. Set the password for each account to something you can remember
        5. Log in to sandbox.paypal.com as the business account from before
        6. You should be on the "My Account" page, Click "Profile" in the menu bar (click the word profile, not something in the sub-menu)
        7. Under "My selling tools" click update for "Instant Payment Notification"
        8. Enter "http://[your_ngrok_id].ngrok.io/[moodle_path]/enrol/paypal/ipn.php" as the notification URL and turn on IPN notifcations
      7. Back on your moodle site, set up the PayPal enrolment plugin:
        1. Update config.php with your ngrok URL
        2. Login as admin and browse to "Site administration" > "Plugins" > "Enrolments" > "Manage enrol plugins"
        3. Enable PayPal and configure it:
          1. Business email: the business email you made earlier
          2. Notify students: yes (not strictly needed, but it's useful to make sure everything is working properly)
          3. Everything else can be default
        4. Create a new course (default settings are fine)
        5. Browse to "Course administration" > "Users" > "Enrolment methods"
        6. Add the PayPal enrolment method, make sure to add some dollar amount for "Enrol cost"
        7. Ensure there are no other enrolment methods like "Guest access" or "Self enrolment"
      8. Log in as the student account
      9. You should be able to see the PayPal course
      10. Click it and go through the process of payment on the PayPal site (use the personal account email that we set up before)
      11. Verify that the student is enrolled in the course
      12. Verify the student got an email (if they were enrolled without error, but you don't have the email, you'll need to sort that out before continuing)
      Show
      ngrok is needed for this test. mailcatcher is desirable but not necessary (you could use gmail's SMTP server instead or something) Create a new user with a valid email that you can check the inbox of Make sure the admin user's email is also a valid email you can check the inbox of Edit config.php, adding the following line just before the require_once(...setup.php); $CFG->usepaypalsandbox = true; Now is probably also a good time to set up your ngrok tunnel and change $CFG->wwwroot to match It would also be a good idea to get email stuff working now Set up PayPal sandbox: Login to developer.paypal.com/ and go to the dashboard Under "Sandbox" click "Accounts" Create two accounts, one business account and one personal account. Make sure the personal one has lots of money (two accounts may already exist by default, I think you can edit them) Set the password for each account to something you can remember Log in to sandbox.paypal.com as the business account from before You should be on the "My Account" page, Click "Profile" in the menu bar (click the word profile, not something in the sub-menu) Under "My selling tools" click update for "Instant Payment Notification" Enter "http://[your_ngrok_id].ngrok.io/[moodle_path]/enrol/paypal/ipn.php" as the notification URL and turn on IPN notifcations Back on your moodle site, set up the PayPal enrolment plugin: Update config.php with your ngrok URL Login as admin and browse to "Site administration" > "Plugins" > "Enrolments" > "Manage enrol plugins" Enable PayPal and configure it: Business email: the business email you made earlier Notify students: yes (not strictly needed, but it's useful to make sure everything is working properly) Everything else can be default Create a new course (default settings are fine) Browse to "Course administration" > "Users" > "Enrolment methods" Add the PayPal enrolment method, make sure to add some dollar amount for "Enrol cost" Ensure there are no other enrolment methods like "Guest access" or "Self enrolment" Log in as the student account You should be able to see the PayPal course Click it and go through the process of payment on the PayPal site (use the personal account email that we set up before) Verify that the student is enrolled in the course Verify the student got an email (if they were enrolled without error, but you don't have the email, you'll need to sort that out before continuing)
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull Master Branch:
      MDL-55405-master
    • Sprint:
      3.2 Sprint 5

      Description

      As part of my work on MDL-54770 I made some improvements to the PayPal IPN script. We since changed the approach slightly so I'm adding those improvements here so they don't go to waste.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/Dec/16