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

Display payment information on course/info.php

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.11.2, 4.0.1
    • 4.1
    • Payments
    • None
    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MOODLE_401_STABLE
    • Hide

      Test requirements

      Test setup (required for all tests):

      1. Log in as an administrator
      2. Make sure the guest login is shown in "Site administration > Plugins > Authentication > Manage Authentication > Guest login button"
      3. Make sure forcelogin is not set (default) under "Site administration > Security > Site security settings"
      4. Enable PayPal gateway in "Site administration > Plugins > Payment gateway > Manage payment gateways" (it is enabled by default).
      5. Create a Payment account via "Site administration > Payments > Payment accounts".
        1. Configure the PayPal gateway clicking "PayPal" under "Payment gateways column". Use the Client ID and Secret you have for your Sandbox App in PayPal. Make sure to set the environment to "Sandbox" and check "Enable".
      6. Visit "Site administration > Plugins > Enrolments > Manage enrol plugins" and enable the "Enrolment on payment" plugin
      7. Go to a course 'Enrolment methods' via the gear menu or the Administration block
      8. Add Enrolment on payment as an enrolment method and set "Enrolment fee" to $10

      Test 1

      1. Log in to the site as the guest user and attempt to access the course
      2. Verify that you can see the message "This course requires a payment for entry." with the link "Log in to the site" underneath.

      Test 2

      1. Log in with a real user account that is not enrolled in the course and attempt to enrol in the course
      2. Verify that you can see the message "This course requires a payment for entry." with the button "select payment type"

      Test 3

      1. Obtain the courseid value of the course that has payment enabled - eg if the course url is "moodle/course/view.php?id=50" the courseid is 50.
      2. While not logged into the site and not logged in as the guest user, directly enter the url for the the course/info.php page into your browser using the url: yourmoodlesite/course/info.php?id=XX using the courseid value of the course with payment set up.
      3. Verify that you can see the message "This course requires a payment for entry." with the link "Log in to the site" underneath.

      Test 4

      1. Login to the site as the guest user and directly enter the url for the the course/info.php page into your browser using the url: yourmoodlesite/course/info.php?id=XX using the courseid value of the course with payment set up.
      2. Verify that you can see the message "This course requires a payment for entry." with the link "Log in to the site" underneath.

      Test 5

      1. Log in with a real user account that is not enrolled in the course and directly enter the url for the the course/info.php page into your browser using the url: yourmoodlesite/course/info.php?id=XX using the courseid value of the course with payment set up.
      2. Verify that you can see the message "This course requires a payment for entry." with the button "select payment type"

       

      Show
      Test requirements A PayPal developer account and sandbox account. see  https://developer.paypal.com/developer/accounts/ A sandbox Merchant App (you can create Apps at  https://developer.paypal.com/developer/applications ). Click on your App name to get a Client ID and Secret. You will need them for the test. Test setup (required for all tests): Log in as an administrator Make sure the guest login is shown in "Site administration > Plugins > Authentication > Manage Authentication > Guest login button" Make sure forcelogin is not set (default) under "Site administration > Security > Site security settings" Enable PayPal gateway in "Site administration > Plugins > Payment gateway > Manage payment gateways" (it is enabled by default). Create a Payment account via "Site administration > Payments > Payment accounts". Configure the PayPal gateway clicking "PayPal" under "Payment gateways column". Use the Client ID and Secret you have for your Sandbox App in PayPal. Make sure to set the environment to "Sandbox" and check "Enable". Visit "Site administration > Plugins > Enrolments > Manage enrol plugins" and enable the "Enrolment on payment" plugin Go to a course 'Enrolment methods' via the gear menu or the Administration block Add Enrolment on payment as an enrolment method and set "Enrolment fee" to $10 Test 1 Log in to the site as the guest user and attempt to access the course Verify that you can see the message "This course requires a payment for entry." with the link "Log in to the site" underneath. Test 2 Log in with a real user account that is not enrolled in the course and attempt to enrol in the course Verify that you can see the message "This course requires a payment for entry." with the button "select payment type" Test 3 Obtain the courseid value of the course that has payment enabled - eg if the course url is "moodle/course/view.php?id=50" the courseid is 50. While not logged into the site and not logged in as the guest user, directly enter the url for the the course/info.php page into your browser using the url: yourmoodlesite/course/info.php?id=XX using the courseid value of the course with payment set up. Verify that you can see the message "This course requires a payment for entry." with the link "Log in to the site" underneath. Test 4 Login to the site as the guest user and directly enter the url for the the course/info.php page into your browser using the url: yourmoodlesite/course/info.php?id=XX using the courseid value of the course with payment set up. Verify that you can see the message "This course requires a payment for entry." with the link "Log in to the site" underneath. Test 5 Log in with a real user account that is not enrolled in the course and directly enter the url for the the course/info.php page into your browser using the url: yourmoodlesite/course/info.php?id=XX using the courseid value of the course with payment set up. Verify that you can see the message "This course requires a payment for entry." with the button "select payment type"  

    Description

      When using a Moodle site to sell courses, quite often we'll use the course/info.php page to market the course (it's accesible to google/accessible to users not logged in etc.) and we adjust the theme to link directly to that page instead of view.php

      The enrol_fee plugin should use the get_description_text hook to display the price/payment information on the page along with the "login to the site" link if not currently logged in.

      Attachments

        1. MDL-72256_Test 1.png
          MDL-72256_Test 1.png
          31 kB
        2. MDL-72256_Test 2.png
          MDL-72256_Test 2.png
          36 kB
        3. MDL-72256_Test 3.png
          MDL-72256_Test 3.png
          25 kB
        4. MDL-72256_Test 4.png
          MDL-72256_Test 4.png
          28 kB
        5. MDL-72256_Test 5.png
          MDL-72256_Test 5.png
          33 kB

        Activity

          People

            danmarsden Dan Marsden
            danmarsden Dan Marsden
            vernon spain vernon spain
            Ilya Tregubov Ilya Tregubov
            Angelia Dela Cruz Angelia Dela Cruz
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              28/Nov/22

              Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 35 minutes
                35m