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

Add payment as subsystem supporting payment gateways

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      You need a PayPal account to test this

      Setup

      1. Log in to https://developer.paypal.com/developer/accounts/ and create one personal and one business accounts if you don't already have them (you change their password if you have some accounts there but you can't remember their passwords).
      2. Go to  https://developer.paypal.com/developer/applications
      3. Set the environment to Sandbox (using the toggle at the top)
      4. Click on the "create app" button from the "REST API apps" section
      5. Name your app "Moodle test" or whatever you like
      6. Choose a sandbox business account and then click on the "create app" button.
      7. At the next page, make note of the "Client ID" and "Secret"
      8. Log in to Moodle as admin
      9. Visit "Site administration > Plugins > Payment gateways > Manage payment gateways" and enable the PayPal gateway
      10. Visit "Site administration > Plugins > Payment gateways > PayPal" and enter PayPal's "Client ID" and "Secret" there
      11. Set the environment to 'Sandbox'
      12. Visit "Site administration > Plugins > Enrolments > Manage enrol plugins" and enable the "Fee" plugin
      13. Create a course
      14. Add the "Fee" enrolment method to the course and set a cost and currency for the enrolment

      Test

      1. Log in as a non-admin user
      2. Try accessing the course
      3. At the enrolment page, verify that you see the "Pay enrol fee" button
      4. Click on the pay button
      5. Verify that a modal opens with an option to pay the course fee by PayPal
      6. Verify that the PayPal option is already selected
      7. Click on the proceed button
      8. Verify that a new modal opens with some options. The number of options you see here depends on your PayPal account's country, but a simple "PayPal" button should be in the options
      9. Chose to pay by PayPal account
      10. Use a sandbox account to pay the course's fee (Read steps 11 and 12 now because you only have a limited time to follow them)
      11. Verify that after you finish the payment on the PayPal website, you see "Authorising the payment. Please wait..." message on Moodle
      12. Verify that clicking outside of the modal or the Escape key does not close the modal while it is authorising. The modal will be closed itself when the authorisation is finished.
      13. Verify that you are enrolled in the course 
      Show
      You need a PayPal account to test this Setup Log in to https://developer.paypal.com/developer/accounts/  and create one personal and one business accounts if you don't already have them (you change their password if you have some accounts there but you can't remember their passwords). Go to   https://developer.paypal.com/developer/applications Set the environment to Sandbox (using the toggle at the top) Click on the "create app" button from the "REST API apps" section Name your app "Moodle test" or whatever you like Choose a sandbox business account and then click on the "create app" button. At the next page, make note of the "Client ID" and "Secret" Log in to Moodle as admin Visit "Site administration > Plugins > Payment gateways > Manage payment gateways" and enable the PayPal gateway Visit "Site administration > Plugins > Payment gateways > PayPal" and enter PayPal's "Client ID" and "Secret" there Set the environment to 'Sandbox' Visit "Site administration > Plugins > Enrolments > Manage enrol plugins" and enable the "Fee" plugin Create a course Add the "Fee" enrolment method to the course and set a cost and currency for the enrolment Test Log in as a non-admin user Try accessing the course At the enrolment page, verify that you see the "Pay enrol fee" button Click on the pay button Verify that a modal opens with an option to pay the course fee by PayPal Verify that the PayPal option is already selected Click on the proceed button Verify that a new modal opens with some options. The number of options you see here depends on your PayPal account's country, but a simple "PayPal" button should be in the options Chose to pay by PayPal account Use a sandbox account to pay the course's fee (Read steps 11 and 12 now because you only have a limited time to follow them) Verify that after you finish the payment on the PayPal website, you see "Authorising the payment. Please wait..." message on Moodle Verify that clicking outside of the modal or the Escape key does not close the modal while it is authorising. The modal will be closed itself when the authorisation is finished. Verify that you are enrolled in the course 
    • Affected Branches:
      MOODLE_310_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE
    • Pull from Repository:
    • Pull 3.10 Branch:
      MDL-69166-310-4
    • Pull Master Branch:
      MDL-69166-master-4
    • Story Points:
      4
    • Sprint:
      International 4.0 - Sprint 7

      Description

      We have enrol_paypal in Moodle and many developers used that as a base code to make a new enrolment plugin just to support a different payment gateway. That led to a code duplication which could be avoided if we had payment as a subsystem.

      Having a centralised subsystem also allows other plugin types to benefit from it.

        Attachments

        1. student1.png
          student1.png
          39 kB
        2. admin1.png
          admin1.png
          69 kB
        3. admin2.png
          admin2.png
          63 kB
        4. admin3.png
          admin3.png
          30 kB
        5. student2.png
          student2.png
          82 kB
        6. student3.png
          student3.png
          69 kB
        7. teacher1.png
          teacher1.png
          55 kB
        8. behat_currency_failure.png
          behat_currency_failure.png
          39 kB

          Issue Links

            Activity

              People

              Assignee:
              rezaie9 Shamim Rezaie
              Reporter:
              rezaie9 Shamim Rezaie
              Peer reviewer:
              Marina Glancy
              Integrator:
              Andrew Nicols
              Tester:
              Andrew Nicols
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              1 Vote for this issue
              Watchers:
              14 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Nov/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 weeks, 1 day, 5 hours, 53 minutes
                  3w 1d 5h 53m