diff --git a/.buildinfo b/.buildinfo new file mode 100644 index 0000000000..463544297d --- /dev/null +++ b/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: eefc28623cc2ab55f0b2d2f32ee9aa3a +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/.doctrees/authentication.doctree b/.doctrees/authentication.doctree new file mode 100644 index 0000000000..c425972400 Binary files /dev/null and b/.doctrees/authentication.doctree differ diff --git a/.doctrees/commands/check_program_requirements.doctree b/.doctrees/commands/check_program_requirements.doctree new file mode 100644 index 0000000000..4293e0b2e4 Binary files /dev/null and b/.doctrees/commands/check_program_requirements.doctree differ diff --git a/.doctrees/commands/configure_instance.doctree b/.doctrees/commands/configure_instance.doctree new file mode 100644 index 0000000000..ed6a454916 Binary files /dev/null and b/.doctrees/commands/configure_instance.doctree differ diff --git a/.doctrees/commands/configure_tiers.doctree b/.doctrees/commands/configure_tiers.doctree new file mode 100644 index 0000000000..2977c1487b Binary files /dev/null and b/.doctrees/commands/configure_tiers.doctree differ diff --git a/.doctrees/commands/create_courseware.doctree b/.doctrees/commands/create_courseware.doctree new file mode 100644 index 0000000000..7cf8ea8330 Binary files /dev/null and b/.doctrees/commands/create_courseware.doctree differ diff --git a/.doctrees/commands/create_courseware_page.doctree b/.doctrees/commands/create_courseware_page.doctree new file mode 100644 index 0000000000..40e76026b7 Binary files /dev/null and b/.doctrees/commands/create_courseware_page.doctree differ diff --git a/.doctrees/commands/create_product.doctree b/.doctrees/commands/create_product.doctree new file mode 100644 index 0000000000..2d6512ebf1 Binary files /dev/null and b/.doctrees/commands/create_product.doctree differ diff --git a/.doctrees/commands/create_user.doctree b/.doctrees/commands/create_user.doctree new file mode 100644 index 0000000000..d781eaa1c4 Binary files /dev/null and b/.doctrees/commands/create_user.doctree differ diff --git a/.doctrees/commands/generate_discount_code.doctree b/.doctrees/commands/generate_discount_code.doctree new file mode 100644 index 0000000000..1725684ab2 Binary files /dev/null and b/.doctrees/commands/generate_discount_code.doctree differ diff --git a/.doctrees/commands/import_courserun.doctree b/.doctrees/commands/import_courserun.doctree new file mode 100644 index 0000000000..5cc30dd21a Binary files /dev/null and b/.doctrees/commands/import_courserun.doctree differ diff --git a/.doctrees/commands/index.doctree b/.doctrees/commands/index.doctree new file mode 100644 index 0000000000..ecf8c342dc Binary files /dev/null and b/.doctrees/commands/index.doctree differ diff --git a/.doctrees/commands/refund_fulfilled_order.doctree b/.doctrees/commands/refund_fulfilled_order.doctree new file mode 100644 index 0000000000..9a7537bc2c Binary files /dev/null and b/.doctrees/commands/refund_fulfilled_order.doctree differ diff --git a/.doctrees/commands/regenerate_edx_auth_tokens.doctree b/.doctrees/commands/regenerate_edx_auth_tokens.doctree new file mode 100644 index 0000000000..34b7a41b77 Binary files /dev/null and b/.doctrees/commands/regenerate_edx_auth_tokens.doctree differ diff --git a/.doctrees/commands/resolve_pending_order.doctree b/.doctrees/commands/resolve_pending_order.doctree new file mode 100644 index 0000000000..300487ae6e Binary files /dev/null and b/.doctrees/commands/resolve_pending_order.doctree differ diff --git a/.doctrees/configuration/ecommerce.doctree b/.doctrees/configuration/ecommerce.doctree new file mode 100644 index 0000000000..3c3053b9eb Binary files /dev/null and b/.doctrees/configuration/ecommerce.doctree differ diff --git a/.doctrees/configuration/hubspot.doctree b/.doctrees/configuration/hubspot.doctree new file mode 100644 index 0000000000..9555020857 Binary files /dev/null and b/.doctrees/configuration/hubspot.doctree differ diff --git a/.doctrees/configuration/index.doctree b/.doctrees/configuration/index.doctree new file mode 100644 index 0000000000..1140c5e9b3 Binary files /dev/null and b/.doctrees/configuration/index.doctree differ diff --git a/.doctrees/configuration/open_edx.doctree b/.doctrees/configuration/open_edx.doctree new file mode 100644 index 0000000000..a63059359e Binary files /dev/null and b/.doctrees/configuration/open_edx.doctree differ diff --git a/.doctrees/configuration/quickstart.doctree b/.doctrees/configuration/quickstart.doctree new file mode 100644 index 0000000000..27619f5e90 Binary files /dev/null and b/.doctrees/configuration/quickstart.doctree differ diff --git a/.doctrees/configuration/tutor.doctree b/.doctrees/configuration/tutor.doctree new file mode 100644 index 0000000000..d0c72ee31b Binary files /dev/null and b/.doctrees/configuration/tutor.doctree differ diff --git a/.doctrees/configuration/uwsgi_tuning.doctree b/.doctrees/configuration/uwsgi_tuning.doctree new file mode 100644 index 0000000000..90b14cf849 Binary files /dev/null and b/.doctrees/configuration/uwsgi_tuning.doctree differ diff --git a/.doctrees/ecommerce/flexible_pricing.doctree b/.doctrees/ecommerce/flexible_pricing.doctree new file mode 100644 index 0000000000..2c4c7add1c Binary files /dev/null and b/.doctrees/ecommerce/flexible_pricing.doctree differ diff --git a/.doctrees/ecommerce/index.doctree b/.doctrees/ecommerce/index.doctree new file mode 100644 index 0000000000..23c4df918d Binary files /dev/null and b/.doctrees/ecommerce/index.doctree differ diff --git a/.doctrees/ecommerce/overview.doctree b/.doctrees/ecommerce/overview.doctree new file mode 100644 index 0000000000..c374a28b04 Binary files /dev/null and b/.doctrees/ecommerce/overview.doctree differ diff --git a/.doctrees/ecommerce/subsystems/basket.doctree b/.doctrees/ecommerce/subsystems/basket.doctree new file mode 100644 index 0000000000..fbdefddb5a Binary files /dev/null and b/.doctrees/ecommerce/subsystems/basket.doctree differ diff --git a/.doctrees/ecommerce/subsystems/discount.doctree b/.doctrees/ecommerce/subsystems/discount.doctree new file mode 100644 index 0000000000..fdf2fe56c6 Binary files /dev/null and b/.doctrees/ecommerce/subsystems/discount.doctree differ diff --git a/.doctrees/ecommerce/subsystems/index.doctree b/.doctrees/ecommerce/subsystems/index.doctree new file mode 100644 index 0000000000..edaa899a46 Binary files /dev/null and b/.doctrees/ecommerce/subsystems/index.doctree differ diff --git a/.doctrees/ecommerce/subsystems/order.doctree b/.doctrees/ecommerce/subsystems/order.doctree new file mode 100644 index 0000000000..168ee03115 Binary files /dev/null and b/.doctrees/ecommerce/subsystems/order.doctree differ diff --git a/.doctrees/ecommerce/subsystems/payment.doctree b/.doctrees/ecommerce/subsystems/payment.doctree new file mode 100644 index 0000000000..5ad926bc05 Binary files /dev/null and b/.doctrees/ecommerce/subsystems/payment.doctree differ diff --git a/.doctrees/ecommerce/subsystems/product.doctree b/.doctrees/ecommerce/subsystems/product.doctree new file mode 100644 index 0000000000..97d69ca91b Binary files /dev/null and b/.doctrees/ecommerce/subsystems/product.doctree differ diff --git a/.doctrees/ecommerce/subsystems/reporting.doctree b/.doctrees/ecommerce/subsystems/reporting.doctree new file mode 100644 index 0000000000..7b9892a270 Binary files /dev/null and b/.doctrees/ecommerce/subsystems/reporting.doctree differ diff --git a/.doctrees/environment.pickle b/.doctrees/environment.pickle new file mode 100644 index 0000000000..4f1187552a Binary files /dev/null and b/.doctrees/environment.pickle differ diff --git a/.doctrees/index.doctree b/.doctrees/index.doctree new file mode 100644 index 0000000000..5e19613970 Binary files /dev/null and b/.doctrees/index.doctree differ diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000000..e69de29bb2 diff --git a/_sources/authentication.rst.txt b/_sources/authentication.rst.txt new file mode 100644 index 0000000000..d312f39f23 --- /dev/null +++ b/_sources/authentication.rst.txt @@ -0,0 +1,4 @@ +Authentication +============== + +.. mermaid:: assets/authentication-flow.mm diff --git a/_sources/commands/check_program_requirements.rst.txt b/_sources/commands/check_program_requirements.rst.txt new file mode 100644 index 0000000000..90405f4014 --- /dev/null +++ b/_sources/commands/check_program_requirements.rst.txt @@ -0,0 +1,22 @@ +``check_program_requirements`` +============================== + +Checks programs for a valid requirements tree. A program has a valid requirements tree if it: + +1. Exists +2. Has nodes for all courses assigned to the program + +If the tree does not fit this criteria, an error message is printed to the screen. (This uses the ``check_program_for_orphans`` API call, but it suppresses its error logging so it won't clog up the error log.) + +By default, this will check all programs in the system. Specify individual programs to check with ``--program`` (multiple times if needed) or check only live programs with ``--live``. Note that if you specify both of these together they will be combined: if you specify a check for a specific program that isn't live and then also specify ``--live``, it won't return anything for that program. + +Syntax +------ + +``check_program_requirements [--program ] [--live]`` + +Options +------- + +* ``--program `` - Check this specific program. Can be either the readable ID of the program (e.g. ``program-v1:MITx+DEDP``) or the numeric ID, and can be specified multiple times to check multiple programs. +* ``--live`` - Check only live programs. diff --git a/_sources/commands/configure_instance.rst.txt b/_sources/commands/configure_instance.rst.txt new file mode 100644 index 0000000000..03d308182a --- /dev/null +++ b/_sources/commands/configure_instance.rst.txt @@ -0,0 +1,23 @@ +``configure_instance`` +====================== + +Configures a fresh MITx Online instance. For more information, see :doc:`MITx Online Quick Start<../configuration/quickstart>` and :doc:`Local Open edX Tutor and MITx Online Deployment<../configuration/tutor>`. + +For Tutor deployments, this will use ``local.edly.io`` for URLs for the edX platform. If you're running a dev deployment, or are using Tutor Nightly, ``--tutor-dev`` will additionally add the proper ports (as Caddy is disabled in these cases). In either case, the two demo courses will still be created but only the Demonstration Course (``course-v1:edX+DemoX+Demo_Course``) will exist in edX, and then only if you import the demo course using the relevant Tutor command. + +Syntax +------ + +``configure_instance [--dont-enroll|-D] [--dont-create-superuser|-S] [--edx-oauth-client ] [--edx-oauth-secret ] [--gateway ] [--tutor|-T] [--tutor-dev]`` + +Options +------- + +* ```` - One of ``macos``, ``linux``, or ``none``. Specifying ``none`` will additionaly stop creation of the OAuth2 application record for edX. Defaults to ``none``. +* ``--dont-enroll|-D`` - Don't enroll the test learner account in any courses. (Defaults to enrolling the account in ``course-v1:edX+DemoX+Demo_Course``.) +* ``--dont-create-superuser|-S`` - Don't create a superuser account. +* ``--gateway `` - The Docker gateway IP. Required on Linux. See :doc:`Configure Open edX<../configuration/open_edx>` for more info. +* ``--edx-oauth-client `` - Use the specified client ID for the edX OAuth2 client. (Useful if you're redoing your MITx Online instance and you've already created the corresponding record in edX, since you're not allowed to edit it there.) +* ``--edx-oauth-secret `` - Use the specified client secret for the edX OAuth2 client. (Useful if you're redoing your MITx Online instance and you've already created the corresponding record in edX, since you're not allowed to edit it there.) +* ``--tutor|-T`` - Configure the instance for use with a Tutor edX deployment. +* ``--tutor-dev`` - Configure the instnace for use with Tutor dev or nightly. diff --git a/_sources/commands/configure_tiers.rst.txt b/_sources/commands/configure_tiers.rst.txt new file mode 100644 index 0000000000..4c852f3406 --- /dev/null +++ b/_sources/commands/configure_tiers.rst.txt @@ -0,0 +1,86 @@ +``configure_tiers`` +=================== + +Creates financial assistance tiers and discounts for a course or program. + +This operates in two modes: creating tiers for a program and creating tiers for a course. + +*In the tables below, represents the current year.* + +**Configuring tiers for a course** + +The command will use the readable ID of the course as part of the financial aid discounts. They will default to this: + +=========================== ============= ====== +Code Type Amount +=========================== ============= ====== +-fa-tier1- percent-off .75 +-fa-tier2- percent-off .50 +-fa-tier3- percent-off .25 +-fa-tier4- percent-off 0 +=========================== ============= ====== + +Note that configuring course tiers requires the course to exist. Use ``create_courseware`` (or any of the other methods) to create the course before you run this command. + +**Configuring tiers for a program** + +The default discounts will be: + +==================== =========== ====== +Code Type Amount +==================== =========== ====== +DEDP-fa-tier1- dollars-off 750 +DEDP-fa-tier2- dollars-off 650 +DEDP-fa-tier3- dollars-off 500 +DEDP-fa-tier4- percent-off 0 +==================== =========== ====== + +Specify changes using ``--program`` and/or ``--program-abbrev``. + +**Tiers** + +The actual tiers that will be created are: + +========= ======================== +Threshold Discount +========= ======================== +$0 -fa-tier1- +$25,000 -fa-tier2- +$50,000 -fa-tier3- +$75,000 -fa-tier4- +========= ======================== + +These can be overridden by providing a CSV file. The CSV file should have the following fields and should not have a header row:: + + threshold amount,discount type,discount amount + +If you specify tier information, you must provide all the tiers you want to create - the specified information will override the default. In addition, you must supply a zero income tier. This is a requirement and the command will quit if you don't have one set up, as that tier is used as the starting point for financial assistance. (In other words, learners will see errors if there's not a zero-income threshold tier set up.) + +**Reuse** + +The command will try to reuse any discounts and tiers that match ones the command would have created, so you can safely run this for a course or program that may have already had financial assistance tiers set up. + +Syntax +------ + +Configuring tiers for a program: +``configure_tiers [--program ] [--program-abbrev ] [--tier-info ]`` + +Configuring tiers for a course: +``configure_tiers [--course ] [--tier-info ]`` + +Options +------- + +Program options: + +* ``--program `` - Program ID to use or create. +* ``--program-abbrev `` - Abbreviation to use for tiers and discounts. + +Course options: + +* ``--course `` - Course ID to use. This won't create a course; use ``create_courseware`` for that. + +Common options: + +* ``--tier-info `` - Tier info in CSV format. diff --git a/_sources/commands/create_courseware.rst.txt b/_sources/commands/create_courseware.rst.txt new file mode 100644 index 0000000000..feb9d525dd --- /dev/null +++ b/_sources/commands/create_courseware.rst.txt @@ -0,0 +1,60 @@ +``create_courseware`` +===================== + +Creates a new courseware object. + +**For programs**, this creates the basic program record. +**For courses**, this creates the course, and then optionally adds it to the specified program (and can add it as an elective or required course). It will also optionally create an initial course run for the course. Finally, it will also add the course to the program's requirements or electives list. +**For courseruns**, this creates the course run and associates it with the specified course. + +This will not run ``sync_course_run`` for you, so for best results, ensure the course run is set up on the edX side, use this command, then run ``sync_course_run`` to pull dates and other information from edX. + +Syntax +------ + +``create_courseware [--live] [--self-paced] [--create-run [create_run]] [--run-url [RUN_URL]] [--program [PROGRAM]] [--run-tag [run-tag]] [--required] [--elective] [--force] [--start <date>] [--end <date>] [--enrollment-start <date>] [--enrollment-end <date>] [--upgrade <date>] [--dept <department_name>] [--create-depts]`` + +Checks +------ + +The command performs the following checks: +* It checks to see if ``readable_id`` contains ``course`` or ``program`` at the front - if it doesn't, it will assume you've swapped the title and readable ID mistakenly and stop. +* It checks to see if the course will be live before adding it to the requirements tree. If ``--live`` isn't specified, it will ignore your request. This only applies to course creation. +* If creating a course or program, ``--depts`` must be specified and the department names must exist. + +Both of these checks can be overridden with the ``--force`` flag. + +Options +------- + +* ``object`` - One of ``program``, ``course``, or ``courserun`` +* ``readable id`` - The readable ID of the object. Note: do not specify the run tag for course runs. +* ``title`` - The title of the object. +* ``--live`` - Makes the object live (default is not). +* ``--force|-f`` - Force the creation of the object. (See "Checks" section for details.) +* ``--create-depts`` - If specified, any departments specified that do not currently exist will be created. + +Programs can take the following options: +* ``--depts`` - The departments to associate the program with. + +Courses can take the following options: + +* ``--program <PROGRAM>`` - The program to assign the course to. +* ``--create-run <run tag>`` - Create a course run for this course with the specified run tag. +* ``--run-url <url>`` - The courseware URL for the course run. (Only if ``--create-run`` is specified.) +* ``--self-paced`` - The course run is self-paced. (Only if ``--create-run`` is specified.) +* ``--required`` - The course is a requirement for the program. +* ``--elective`` - The course is an elective for the program. +* ``--depts`` - The departments to associate the course with. + +Course runs can take the following options: + +* ``--program <PROGRAM>`` - The program to assign the course to. **Required.** +* ``--run-tag <run tag>`` - The run tag to use. **Required.** +* ``--run-url <url>`` - The courseware URL for the course run. +* ``--self-paced`` - The course run is self-paced. +* ``--start <date>`` - The date the course run should start. +* ``--end <date>`` - The date the course run should end. +* ``--enrollment-start <date>`` - The date the course run enrollment should start. +* ``--enrollment-end <date>`` - The date the course run enrollment should end. +* ``--upgrade <date>`` - The date after which course run enrollments should not be possible. diff --git a/_sources/commands/create_courseware_page.rst.txt b/_sources/commands/create_courseware_page.rst.txt new file mode 100644 index 0000000000..54170f58f9 --- /dev/null +++ b/_sources/commands/create_courseware_page.rst.txt @@ -0,0 +1,17 @@ +``create_courseware_page`` +========================== + +Creates a very basic About page in the CMS for the given courseware object. + +The about page will only have the handful of fields that are required to be there, and will be linked to the specified courseware object. If the courseware object is a course, it will also be added to the Featured Products section on the homepage. By default, the CMS page will be saved in a draft state. + +Syntax +------ + +``create_courseware_page <courseware id> [--live]`` + +Options +------- + +* ``courseware id`` - The courseware object to make a CMS page for. +* ``--live`` - Makes the resulting page live. diff --git a/_sources/commands/create_product.rst.txt b/_sources/commands/create_product.rst.txt new file mode 100644 index 0000000000..d4bd44ffff --- /dev/null +++ b/_sources/commands/create_product.rst.txt @@ -0,0 +1,19 @@ +``create_product`` +================== + +Creates a product for the given courseware ID. (For now, this only works with course runs.) + +By default, the product description will be the courseware ID. This is the recommended setting for this to make it easy to determine which products are for what courseware objects. + +Syntax +------ + +``create_product <courserun> <price> [--description|-d <description>] [--inactive]`` + +Options +------- + +* ``courserun`` - The course run to use. +* ``price`` - The price (numbers only) of the product. +* ``--description <description>`` (or ``-d``) - Optionally specify the product description. (Defaults to the courseware ID.) +* ``--inactive`` - Makes the product inactive. (Defaults to active.) diff --git a/_sources/commands/create_user.rst.txt b/_sources/commands/create_user.rst.txt new file mode 100644 index 0000000000..72e37e8f6d --- /dev/null +++ b/_sources/commands/create_user.rst.txt @@ -0,0 +1,20 @@ +``create_user`` +=============== + +Creates a learner account in the system. You will be prompted for the account password. + +Syntax +------ + +``create_user username email firstname lastname displayname countrycode [--enroll <courseid>]`` + +Options +------- + +* ``username`` - Username for the learner to create. +* ``email`` - Email address of the learner to create. +* ``firstname`` - The learner's first name. +* ``lastname`` - The learner's last name. +* ``displayname`` - The learner's display name. +* ``countrycode`` - The country code to use. (Default US) +* ``--enroll <courseid>`` - Optionally enroll the user in the specified course run. The enrollment will be an audit enrollment. diff --git a/_sources/commands/generate_discount_code.rst.txt b/_sources/commands/generate_discount_code.rst.txt new file mode 100644 index 0000000000..345246b16e --- /dev/null +++ b/_sources/commands/generate_discount_code.rst.txt @@ -0,0 +1,51 @@ +``generate_discount_code`` +========================== + +Creates discount code(s). + +This can create a single code, a batch of explicitly defined codes, or a batch of automatically generated codes (with an optional prefix). + +Syntax +------ + +``generate_discount_code <code> [<code>...] --amount <amount> [-activates <date>] [--expires <date>] [--discount-type <discount type>] [--one-time] [--once-per-user] [--count <count>] [--prefix <prefix>]`` + +Batch Generating Codes +---------------------- + +You can create a batch of explicitly named codes by simply passing multiple discount codes to the command. All of the codes will be created (assuming they don't already exist) with the options you've specified. + +Alternatively, you can created a number of codes using the ``--count`` and ``-prefix`` option. Using these options will generate the number of codes specified by ``--count`` and will prefix the code with ``-prefix`` if it is specified. The code will be generated using a UUID - if you've supplied a prefix, the code will be in the format ``<prefix><uuid>``. Note that the command won't insert any punctuation between the prefix and the UUID, so you will need to add that yourself if you want, for example, a dash separating the two. UUIDs are 37 characters in length so prefixes need to be a total of 13 characters or less. + +Output +------ + +Generated codes will be written to a ``generated-codes.csv`` file, with the following information: + +* Discount code +* Code type +* Amount +* Expiration date + +The file is overwritten if it exists. + +Options +------- + +General options: + +* ``--amount <amount>`` - The discount's amount. For percent off discounts, this should be on a scale of 0-100. This is required. +* ``--discount-type <discount type>`` - One of ``percent-off``, ``dollars-off``, or ``fixed-price``; the type of discount code to make. Defaults to ``percent-off``. +* ``--activates <date>`` - The date the code should become active (in ISO-8601 format). +* ``--expires <date>`` - The date the code should stop being active (in ISO-8601 format). +* ``--one-time`` - Set the discount to be redeemable only once. +* ``--once-per-user`` - Set the discount to be redeemable only once per learner. + +For explicitly named codes: + +* ``code`` - The code to generate. (You can specify any number of these.) Max length 50 characters. + +For automatically generated codes: + +* ``--count <count>`` - The number of codes to create. +* ``--prefix <prefix>`` - The prefix to append to the code. Max length 13 characters. diff --git a/_sources/commands/import_courserun.rst.txt b/_sources/commands/import_courserun.rst.txt new file mode 100644 index 0000000000..b145dd4a79 --- /dev/null +++ b/_sources/commands/import_courserun.rst.txt @@ -0,0 +1,56 @@ +``import_courserun`` +==================== + +Creates courserun(s) in the system based on edX course data. + +You can specify either a specific courserun to create, or you can specify a run tag (e.g. ``1T2023``) and a program (e.g. ``program-v1:MITx+DEDP``), and the command will create courseruns for the courses that it finds in edX. + +You can also optionally have it create a CMS page for the course, if one doesn't already exist. + +Furthermore, you can specify a price, and it will create (or update) product(s) for the courserun(s) with the specified price. Created products will use the readable ID for the courserun as the product description and will be made active depending on the courserun. This command will not update existing courseruns; only new ones that it creates will get products. + +If the course does not exist, it will be created with the same data as the edX course. Any specified courserun that doesn't exist in edX will be skipped - it won't make empty course runs for you (use Django Admin or ``create_courseware`` if you want to do that, since you'll need to specify a few things that you can't here.) Similarly, any courserun that already exists will be skipped - ``sync_courserun``, which runs on a regular basis, will handle syncing the pertinent data for it. + +New courseruns will be created with the following data synced from the edX course_details API call: +* Start and end dates +* Enrollment start and end dates +* Title +* Pacing (self-paced or instructor-led) +* Courseware URL (depends on the ``OPENEDX_API_BASE_URL`` configuration setting) + +You may want to adjust these after they're created. + +Syntax +------ + +To create an individual courserun: + +``import_courserun [--courserun <courserun>] [--program <program>] [--live] [--create-cms-page] [--price <price>]`` + +To walk a program: + +``import_courserun [--program <program>] [--run-tag <run tag>] [--live] [--create-cms-page] [--price <price>]`` + +Options +------- + +* ``--courserun <courserun>`` - The courserun to check for. Takes precedence over ``--program``. +* ``--program <program>`` + * _If walking a program:_ The program to walk through. Requires ``--run_tag``. Specify either the numeric database ID or the readable ID for the program. + * _If creating a single courserun:_ The program the course should belong to, if any. +* ``--run-tag <run tag>`` - The run tag to use for the new courseruns. Required for ``--program``; don't use otherwise. +* ``--live`` - Make the course live. (Default is to set the flag to false.) +* ``--create-cms-page`` - Attempt to create a basic CMS page for the course, in a similar fashion to ``create_courseware_page``. If this fails (for instance, if the course already has a CMS page), this step will be skipped. +* ``--price <price>`` - Create (or update) a product for the courserun with the specified price. If the command creates multiple courseruns, this will create a product for each. +* ``--dept <department_name>`` - Specify department(s) assigned to the course object. If program is specified, all courses associated with the program and imported will have the same department. + +Example +------- + +The use case for this was creating a batch of course runs for an upcoming semester of DEDP courses; these courses existed in edX but not in MITx Online. Since in that case the semester was 1T2023, this command would have created all the applicable courseruns all at once: + +``manage.py import_courserun --program program-v1:MITx+DEDP --run-tag 1T2023 --live --dept Economics`` + +Or, the same but with the standard DEDP pricing applied: + +``manage.py import_courserun --program program-v1:MITx+DEDP --run-tag 1T2023 --live --price 1000`` diff --git a/_sources/commands/index.rst.txt b/_sources/commands/index.rst.txt new file mode 100644 index 0000000000..3ba2d4299d --- /dev/null +++ b/_sources/commands/index.rst.txt @@ -0,0 +1,22 @@ +MITx Online Commands +==================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + check_program_requirements + configure_instance + configure_tiers + create_courseware + create_courseware_page + create_product + create_user + generate_discount_code + import_courserun + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`search` diff --git a/_sources/commands/refund_fulfilled_order.rst.txt b/_sources/commands/refund_fulfilled_order.rst.txt new file mode 100644 index 0000000000..b88313c685 --- /dev/null +++ b/_sources/commands/refund_fulfilled_order.rst.txt @@ -0,0 +1,21 @@ +``refund_fulfilled_order`` +========================== + +Looks up a fulfilled order in the system, sets it to Refunded, and then adjusts the enrollments accordingly. + +- If --unenroll is specified, the learner will be unenrolled from the course run associated with the order. +- If --audit is specified, the learner will keep their unenrollments, but they will be set to "audit" instead of "verified". + +This does not make any sort of call to CyberSource or any other payment gateway to perform a refund - you're expected to have refunded the learner's money manually already. (At time of writing, PayPal transactions can't be refunded using the normal means, so they get refunded manually via CyberSource and then this command comes in to clean up afterwards.) + +Syntax +------ + +``refund_fulfilled_order <reference number> [--audit] [--unenroll]`` + +Options +------- + +* ``<reference number>`` - The reference number for the order to refund. +* ``--audit`` - Change the learner's enrollment status to ``audit``. +* ``--unenroll`` - Unenroll the learner. diff --git a/_sources/commands/regenerate_edx_auth_tokens.rst.txt b/_sources/commands/regenerate_edx_auth_tokens.rst.txt new file mode 100644 index 0000000000..c5b7632de3 --- /dev/null +++ b/_sources/commands/regenerate_edx_auth_tokens.rst.txt @@ -0,0 +1,16 @@ +``regenerate_edx_auth_tokens`` +============================== + +Regenerates the authentication tokens for a specified learner. In essence, deletes the ``OpenEdxApiAuth`` record and then makes a call to edX to generate a new refresh and access token. + +If the user doesn't have an ``OpenEdxUser`` record either, then this command is not appropriate. Use ``repair_missing_courseware_records`` instead. This will also not do anything with enrollments or grades. The main usecase is if the learner's ``OpenEdxApiAuth`` record gets deleted for some reason, or if their refresh tokens on the edX side are revoked. + +Syntax +------ + +``regenerate_edx_auth_tokens <username>`` + +Options +------- + +* ``username`` - the learner's ID, username, or email address. diff --git a/_sources/commands/resolve_pending_order.rst.txt b/_sources/commands/resolve_pending_order.rst.txt new file mode 100644 index 0000000000..e0d5c549c3 --- /dev/null +++ b/_sources/commands/resolve_pending_order.rst.txt @@ -0,0 +1,17 @@ +``resolve_pending_order`` +========================= + +Looks up the specified pending order in CyberSource and resolves it. This can mean either fulfilling the order or cancelling it, depending on the status of the payment in CyberSource: if the order is found and the result code is 100, it will be fulfilled; otherwise, it will be cancelled. + +This only works on pending orders and won't accept a reference number for an order that's not in the Pending state. + +Syntax +------ + +``resolve_pending_order [--all] [--order <reference number>]`` + +Options +------- + +* ``--all`` - Process all pending orders. +* ``--order <reference number>`` - Process a specific order specified by reference number (e.g. ``mitxonline-prod-1``). diff --git a/_sources/configuration/ecommerce.rst.txt b/_sources/configuration/ecommerce.rst.txt new file mode 100644 index 0000000000..3aa6743e3f --- /dev/null +++ b/_sources/configuration/ecommerce.rst.txt @@ -0,0 +1,77 @@ +Configure eCommerce +=================== + +To use the eCommerce subsystem, some configuration is required. These instructions will also set up a course in your MITx Online environment that you can use for enrollment. + +You'll need a working MITx Online setup and a working devstack setup to begin, and superuser accounts for each. + +Set Up MITx Online eCommerce Config +################################### + +The CyberSource configuration for the app can be lifted out of Heroku. **Make sure you use values from RC - otherwise, you will actually be charged for purchases (and test credit card numbers will fail).** For best results, you should also have an account for the test Enterprise Business Center (``https://ebc2test.cybersource.com/ebc2/``). + +The ``.env`` settings you need to copy over are: + +- ``MITOL_PAYMENT_GATEWAY_CYBERSOURCE_ACCESS_KEY`` +- ``MITOL_PAYMENT_GATEWAY_CYBERSOURCE_PROFILE_ID`` +- ``MITOL_PAYMENT_GATEWAY_CYBERSOURCE_SECURITY_KEY`` +- ``MITOL_PAYMENT_GATEWAY_CYBERSOURCE_SECURE_ACCEPTANCE_URL`` + +Alternatively, you can set up your own CyberSource developer account and generate a set of API keys there: `Evaluation Account Setup <https://ebc2.cybersource.com/ebc2/registration/external>`_ If you set up your own developer account, you will need to properly configure it for Secure Acceptance with the credit card types you wish to test, and you will need to generate your own API keys and supply them in the ``.env`` file. + +You may also set ``ECOMMERCE_DEFAULT_PAYMENT_GATEWAY`` to ``CyberSource`` - this sets it to the default value, but setting it now will prevent issues if the Payment Gateway ol-django library adds in new payment gateways. + +Set Up a Course +############### + +The devstack environment comes with a couple of test courses set up. If you want a different course, you will need to set that up in Open edX before starting here. Bootstrapping a course in edX is beyond the scope of this document. + +In Open edX +----------- + +1. Log in to the Django Admin interface. +2. Find a course from the `Course Overviews <http://edx.odl.local:18000/admin/course_overviews/courseoverview/>`_ page. +3. Note the *Display name* and *Id* fields. + +In MITx Online +-------------- + +1. Log into the Django Admin interface. +2. Under Courses, open Programs and add a Program. (The specifics here aren't important - there just needs to be a Program.) +3. Under Courses, open Courses and add a Course. The *Title* and *Readable Id* fields should be set to the *Display name* and *Id* fields from the edX course you plan to use. Make sure Live is set and the Program is set to the program you created in step 2. +4. Under Course Runs, add a Course Run. The *Title* and *Courseware Id* fields should be set to the Id and Display Name fields from the edX course. The Courseware url path should be set to the URL where the course lives in edX (ex. ``https://courses-qa.mitxonline.mit.edu/learn/course/course-v1:MITx+14.750x+3T2022/home``). The dates will be overwritten when the system is synced with Open edX, but for testing it's good to put Start Date, End Date, Enrollment Start, and Enrollment End. A good starting point for these is today plus/minus one year for each. +5. You now need to add the course to the CMS. Navigate to the Wagtail CMS admin, at /cms. +6. Open the Courses folder under Home Page. +7. Select Add Child Page. +8. Fill out the form. The course you added in steps 1-4 should appear. (If not, double-check your settings in Django Admin.) Publish the page when ready. +9. Open the Home Page, and select Edit. +10. Under the Featured Products section, select Add. You will be given a button to choose a page, and the page chooser there should list the page you created. +11. Publish the Home Page when ready. + +You should now be able to see the course under the hero image on the MITx Online homepage, and navigating into the course should give you the option to Enroll. (At this point, you won't have a Product set up, so enrolling now should just enroll you in the course.) + +Setting Up a Product +#################### + +1. Log into MITx Online Django Admin. +2. Under Ecommerce, open Products and create a new Product. Set *Content type* to Course Run and *Object Id* to the ID of the course run you created earlier (it's probably 1 if you're working from a new install). Price should ideally be set to a non-zero value, that is less than $999, in RC/Sandbox environments. Description needs to be filled in but can be anything - for clarity, it's recommended to use the course name. Make sure Is active is checked. + +You should now be able to enroll in the upgraded course. + +* If you've enrolled in the course already, you should now see the upsell card on the course listing page. +* If you haven't enrolled, enrolling should pop the upgrade modal. +* In either case, enrolling in the paid version of the course should bring you to the cart, and you should then be able to check out. + +Testing Checkout +---------------- + +The test CyberSource credentials won't actually process a charge that has been run through the system. However, you should avoid using a valid credit card number when testing. Any card number that is both invalid but passes the checks should work. Here are some examples: + +- Visa: 4111111111111111 +- Visa: 4242424242424242 +- MasterCard: 5555555555554444 +- MasterCard: 5105105105105100 +- American Express: 378282246310005 +- Discover: 6011111111111117 + +Supply any expiration date in the future. The CVN code should be any three-digit (not AmEx) or 4 digit (AmEx) number that is fairly unique (not like 123, 111). What card types are allowed and whether or not the CVN code is required depends on the settings in the CyberSource account - currently, the MIT test account does require an expiration date and CVN code and supports the four card types listed above. Transactions are logged and can be found in the test EBC. You can additionally adjust the settings in the EBC to email the payment data to you while you're testing - but you should ask around before doing this in case someone else is testing eCommerce elsewhere. diff --git a/_sources/configuration/hubspot.rst.txt b/_sources/configuration/hubspot.rst.txt new file mode 100644 index 0000000000..6672c1de51 --- /dev/null +++ b/_sources/configuration/hubspot.rst.txt @@ -0,0 +1,9 @@ +Configure HubSpot +=================== +In order to connect your local instance of MITx Online with HubSpot, you will need to define the following envrionment variables in your `.env` file. + +``` +MITOL_HUBSPOT_API_PRIVATE_TOKEN=<ask a developer to add you to the hubspot account> +MITOL_HUBSPOT_API_ID_PREFIX=<your_initials>-mitxonline-dev +HUBSPOT_PIPELINE_ID=19817792 +``` diff --git a/_sources/configuration/index.rst.txt b/_sources/configuration/index.rst.txt new file mode 100644 index 0000000000..f5024eaaf2 --- /dev/null +++ b/_sources/configuration/index.rst.txt @@ -0,0 +1,10 @@ +Configuration +============= + +.. toctree:: + :maxdepth: 2 + + open_edx + tutor + ecommerce + quickstart diff --git a/_sources/configuration/open_edx.rst.txt b/_sources/configuration/open_edx.rst.txt new file mode 100644 index 0000000000..3627f1efe7 --- /dev/null +++ b/_sources/configuration/open_edx.rst.txt @@ -0,0 +1,213 @@ +Configure Open edX +================== + +In order to create user accounts in Open edX and permit authentication from MITx Online to Open edX, you need to configure MITx Online as an OAuth2 provider for Open edX. + +Setup Open edX Devstack +####################### + +Following steps are inspired by `edx-devstack <https://github.com/edx/devstack>`_. + +Add ``/etc/hosts`` alias for Open edX +------------------------------------- + +If one doesn't already exist, add an alias to ``/etc/hosts`` for Open edX. We have standardized this alias +to ``edx.odl.local``. Your ``/etc/hosts`` entry should look like this:: + + 127.0.0.1 edx.odl.local + +Clone edx/devstack +------------------ + +.. code-block:: shell + + git clone https://github.com/edx/devstack + cd devstack + make requirements + make dev.clone + +Pull latest images and run provision +------------------------------------ + +.. code-block:: shell + + make pull + make dev.provision + + +Start your servers +------------------ + +.. code-block:: shell + + make dev.up + +Stop your servers +----------------- + +.. code-block:: shell + + make stop + +Setup social auth +################# + +Install ``social-auth-mitxpro`` in LMS +-------------------------------------- + +There are two options for this: + +Install via pip +^^^^^^^^^^^^^^^ + +.. code-block:: shell + + pip install social-auth-mitxpro + +Install from local Build +^^^^^^^^^^^^^^^^^^^^^^^^ + +* Checkout the `social-auth-mitxpro <https://github.com/mitodl/social-auth-mitxpro>`_ project and build the package per the project instructions +* Copy the ``social-auth-mitxpro-$VERSION.tar.gz`` file into devstack's ``edx-platform`` directory +* In devstack, run ``make lms-shell`` and within that shell ``pip install social-auth-mitxpro-$VERSION.tar.gz`` + + * To update to a new development version without having to actually bump the package version, simply ``pip uninstall social-auth-mitxpro``, then install again + +Install ``openedx-companion-auth`` in LMS +--------------------------------------------- + +There are two options for this: + +Install via pip +^^^^^^^^^^^^^^^ + +.. code-block:: shell + + pip install openedx-companion-auth + +Install from local Build +^^^^^^^^^^^^^^^^^^^^^^^^ + +* Checkout the `openedx-companion-auth <https://github.com/mitodl/open-edx-plugins/tree/main/src/openedx_companion_auth>`_ project and build the package per the project instructions +* Copy the ``openedx-companion-auth-$VERSION.tar.gz`` file from the ``dist`` folder into devstack's ``edx-platform`` directory +* In devstack, run ``make lms-shell`` and within that shell ``pip install openedx-companion-auth-$VERSION.tar.gz`` + + * To update to a new development version without having to actually bump the package version, simply ``pip uninstall -y openedx-companion-auth``, then install again + +Configure MITx Online as a OAuth provider for Open edX +###################################################### + +In MITx Online: + +* go to ``/admin/oauth2_provider/application/`` and create a new application with these settings selected: + + * ``Redirect uris``: ``http://<EDX_HOSTNAME>:18000/auth/complete/mitxpro-oauth2/`` + + * **[macOS users]** You will need redirect uris for both the local edX host alias and for ``host.docker.internal``. This value should be:: + + http://edx.odl.local:18000/auth/complete/mitxpro-oauth2/ + http://host.docker.internal:18000/auth/complete/mitxpro-oauth2/ + + * **[Linux users]** You will need redirect uris for both the local edX host alias and for the gateway IP of the docker-compose networking setup for MITx Online as found via ``docker network inspect mitx-online_default``:: + + http://edx.odl.local:18000/auth/complete/mitxpro-oauth2/ + http://<GATEWAY_IP>:18000/auth/complete/mitxpro-oauth2/ + + * **[WSL 2 users]**: Use the URLs for macOS. You will also have to set ``OPENEDX_IP`` to ``host-gateway`` in your ``.env`` file to make this work. (Networking with WSL 2 works very differently, and the defaults won't work.) + + NOTE: ``GATEWAY_IP`` should be something like ``172.19.0.1``. + + * ``Client type``: "Confidential" + * ``Authorization grant type``: "Authorization code" + * ``Skip authorization``: checked + * Other values are arbitrary but be sure to fill them all out. Save the client id and secret for later + +In Open edX (derived from instructions `here <https://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/latest/configuration/tpa/tpa_integrate_open/tpa_oauth.html#additional-oauth2-providers-advanced>`_): + +* ``make lms-shell`` into the LMS container and ensure the following settings are set in ``/edx/etc/lms.yml`` if you are using Juniper or a more recent Open edX release, otherwise they should be in ``/edx/app/edxapp/cms.env.json``: + .. code-block:: yaml + + FEATURES: + ALLOW_PUBLIC_ACCOUNT_CREATION: true + ENABLE_COMBINED_LOGIN_REGISTRATION: true + ENABLE_THIRD_PARTY_AUTH: true + ENABLE_OAUTH2_PROVIDER: true + SKIP_EMAIL_VALIDATION: true + REGISTRATION_EXTRA_FIELDS: + country: hidden + THIRD_PARTY_AUTH_BACKENDS: + - social_auth_mitxpro.backends.MITxProOAuth2 + +* ``make lms-restart`` to pick up the configuration changes +* Login to django-admin (default username and password can be found `here <https://github.com/openedx/devstack#usernames-and-passwords>`_), go to ``http://<EDX_HOSTNAME>:18000/admin/third_party_auth/oauth2providerconfig/``, and create a new config: + + * Select the default example site + * The slug field **MUST** match the the backend's name, which for us is ``mitxpro-oauth2`` + * Client Id should be the client id from the MITx Online Django Oauth Toolkit Application + * Check the following checkboxes: + + * Enabled + * Skip hinted login dialog + * Skip registration form + * Sync learner profile data + * Enable SSO id verification + * Set Backend name to: ``mitxpro-oauth2`` + + * In "Other settings", put: + + .. code-block:: json + + { + "AUTHORIZATION_URL": "http://<LOCAL_MITX_ONLINE_ALIAS>:8013/oauth2/authorize/", + "ACCESS_TOKEN_URL": "http://<EXTERNAL_MITX_ONLINE_HOST>:8013/oauth2/token/", + "API_ROOT": "http://<EXTERNAL_MITX_ONLINE_HOST>:8013/" + } + + * ``LOCAL_MITX_ONLINE_ALIAS`` should be your ``/etc/hosts`` alias for the mitxonline app + * ``EXTERNAL_MITX_ONLINE_HOST`` will depend on your OS, but it needs to be resolvable within the edx container + + * Linux users: The gateway IP of the docker-compose networking setup for mitxonline as found via ``docker network inspect mitx-online_default`` + * OSX users: Use ``host.docker.internal`` + + * Save the configuration. + + + +Configure Open edX to support OAuth2 authentication from MITx Online +#################################################################### + +* In Open edX: + + * go to ``/admin/oauth2_provider/application/`` and verify that an application named 'edx-oauth-app' exists with these settings: + + * ``Redirect uris``: ``http://mitxonline.odl.local:8013/login/_private/complete`` + * ``Client type``: "Confidential" + * ``Authorization grant type``: "Authorization code" + * ``Skip authorization``: checked + * Other values are arbitrary but be sure to fill them all out. Save the client id and secret for later + +* In MITx Online: + + * Set ``OPENEDX_API_CLIENT_ID`` to the client id + * Set ``OPENEDX_API_CLIENT_SECRET`` to the client secret + * Set ``OPENEDX_API_BASE_URL`` to ``http://host.docker.internal:18000`` when running ``devstack`` and ``mitxonline`` locally through Docker + +Configure Logout +################ + +* In Open edX, configure ``settings.IDA_LOGOUT_URI_LIST`` to be a list including the full url to ``<protocol>://<hostname>[:<port>]/logout`` in MITx Online + + * For devstack, this means modifying the value in ``edx-platform/lms/envs/devstack.py`` to include ``http://mitxonline.odl.local:8013/logout`` + * For production, this setting can go in ``lms.env.json`` under the key ``IDA_LOGOUT_URI_LIST`` as a JSON array of with that string in it + +* MITx Online: + + * Set ``LOGOUT_REDIRECT_URL`` to the full path to the edx ``/logout`` view. + +For local development this will be ``http://<EDX_HOSTNAME>:18000/logout`` + + +Configure Open edX user and token for use with MITx Online management commands +############################################################################## + +* In Open edX, create a staff user and then under ``/admin/oauth2_provider/accesstoken/`` add access token. The value of said token needs to match the value set for the ``OPENEDX_SERVICE_WORKER_API_TOKEN`` key in the MITx Online app. diff --git a/_sources/configuration/quickstart.rst.txt b/_sources/configuration/quickstart.rst.txt new file mode 100644 index 0000000000..e261019b1b --- /dev/null +++ b/_sources/configuration/quickstart.rst.txt @@ -0,0 +1,81 @@ +MITx Online Quick Start +======================= + +You can use the ``configure_instance`` management command to perform a quick-start of a fresh MITx Online instance. This command takes care of a lot of the boilerplate required to set up an instance. It: + +* Creates a superuser account (if you want) +* Creates the OAuth2 application record for edX (if you want, and optionally with an existing secret) +* Creates a set of courseware objects, including a DEDP program and courses with runs that match what ships with a standard devstack instance +* Creates a set of CMS pages for the courseware objects that it creates +* Sets up financial assistance appropriately +* Adds a couple of products in for the courses it creates +* Creates a learner account for the system + +It does not: + +* Run migrations +* Completely set up integration with devstack + +In addition, there are a handful of tasks that you'll need to perform afterwards: + +* The CMS pages (course about pages and the financial assistance form) need to be reviewed for content. +* The financial assistance form will need to be published, and linked into the appropriate course. +* You may want to adjust the products that are created. + +The ``configure_instance`` command has a few flags you can use to customize how it works. For more details on this, either run it with ``--help`` or read the :doc:`configure_instance<../commands/configure_instance>` command documentation. (Do this especially if you're using the command to **reset** your MITx Online instance - you can provide an existing OAuth client ID and secret.) + +Performing a Quick Start +------------------------ + +To quick-start your MITx Online instance: + +1. Run the ``migrate`` command. +2. Run the ``createsuperuser`` command. +3. Follow the steps in the :doc:`Configure Open edX<open_edx>` documentation +4. Run ``configure_instance <platform>``, where ``platform`` is ``macos``, ``linux``, or ``none``. (If you don't want it to create OAuth2 records, set this to ``none`` or leave it blank. The default is ``none``.) + +``configure_instance`` will prompt you to enter a password for the test learner account and will prompt you to enter account information for the superuser account. At the end, you'll see your edX OAuth2 application credentials, which can then be plugged into Open edX (if you haven't specified ``none`` for your platform). + +Results +------- + +Running ``configure_instance`` will peform these tasks in order: + +1. Runs ``createsuperuser`` to create the superuser account (unless disabled with ``--dont-create-superuser``). +2. Creates the OAuth2 application record. (This is the one part of this that doesn't rely on an existing management command.) +3. Runs ``configure_wagtail`` to set up the CMS. +4. Runs ``configure_tiers`` to add the DEDP program and configure financial assistance tiers and discounts. +5. Runs ``create_courseware_page`` to add a basic about page for the DEDP program (required for the financial assistance form). +6. Runs ``create_finaid_form`` to create a financial assistance form for the DEDP program. +7. Runs ``create_courseware`` twice to create two courses, each with a course run, that correspond to the demo courses in devstack. (Details below.) +8. Runs ``sync_course_run`` to sync the courses with the devstack instance. +9. Runs ``create_product`` twice to create two products for the courses. +10. Runs ``create_courseware_page`` twice to add course pages for the two courses. (These are marked as live.) +11. Runs ``create_user`` to create the learner account. + +The courses that are created are: + ++----------------------+-----------------------+-------------+-------------+ +| Course | Readable ID | Run Tag | Price | ++======================+=======================+=============+=============+ +| Demonstration Course | course-v1:edX+DemoX | Demo_Course | $999 | ++----------------------+-----------------------+-------------+-------------+ +| E2E Test Course | course-v1:edX+E2E-101 | course | $999 | ++----------------------+-----------------------+-------------+-------------+ + +The learner account that is created is: + +* Username: testlearner +* Email: testlearner@mitxonline.odl.local +* Display Name (split in half for first/last names): Test learner +* Country Code: US +* Enrollments: ``course-v1:edX+DemoX+Demo_Course`` + +The program that gets created is the standard DEDP program (``program-v1:MITx+DEDP``). The *Demonstration Course* is added to the DEDP program; *E2E Test Course* is not. + +Notes +----- + +The steps that involve communication with edX may not work if your environment isn't set up properly. In these cases, the attempts will be queued to be run later. + +If you've set your platform to ``macos`` or ``linux``, the command will do the first part of the *Configure MITx Online as an OAuth provider for Open edX* section in the :doc:`Configure Open edX<open_edx>` documentation. diff --git a/_sources/configuration/tutor.rst.txt b/_sources/configuration/tutor.rst.txt new file mode 100644 index 0000000000..1b52b87674 --- /dev/null +++ b/_sources/configuration/tutor.rst.txt @@ -0,0 +1,219 @@ + +Local Open edX Tutor and MITx Online Deployment +=============================================== + +These instructions describe setting up MITx Online and Tutor from scratch on Linux. These instructions should largely apply to macOS users, and they should also apply to users converting from a devstack-based deployment to Tutor. + +.. + + These instructions should work for a Tutor Dev or Tutor Nightly deployment as well. Specify ``--tutor-dev`` instead of ``--tutor`` when running ``configure_instance`` so the URLs have a port on them. + + +At the end of this guide, you should have: + + +* A fully working MITx Online deployment. +* A working Tutor deployment of edX. +* SSO should work from edX to MITx Online. +* MITx Online should have a service worker set up and should be able to perform tasks using the edX api. +* Tutor's included AuthN MFE should be disabled in favor of the MITx Online authentication system. + +Preliminary Steps +----------------- + +``pyenv`` (and ``pyenv-virtualenv``\ ) are highly recommended for managing local Python versions. `Use the instructions on their GitHub page to install if you haven't already installed it. <https://github.com/pyenv/pyenv>`_ + +You'll want to create at least a virtualenv for Tutor. As of this writing, Tutor uses Python 3.8.12 (in the LMS container at least); I have also successfully used 3.9.16. 3.11 has *not* worked for me. You can optionally create a virtualenv for MITx Online too but that's not strictly necessary. (I have one so I can run black/isort/etc. without having to jump into a container to do it.) + +Tutor Setup, Part One +--------------------- + +.. + + Note that no hosts file changes are needed if you use the default ``local.edly.io`` domain - that's a real domain with a wildcard subdomain cname that points to 127.0.0.1. + + +To begin, you need to follow the `One-Click Installer <https://docs.tutor.overhang.io/quickstart.html>`_ instructions provided by Tutor. Do this with your Tutor virtualenv activated. + +.. + + Mac/Arm users should instead follow these instructions: `Running Tutor on ARM-based systems <https://docs.tutor.overhang.io/tutorials/arm64.html>`_ It's mostly the same steps that the quickstart does internally, with some changes to rebuild some of the images and flip some dependencies to use compatible images for Arm. + + +Once Tutor has bootstrapped itself and is available, create a superuser account: + +.. code-block:: + + tutor local do createuser --staff --superuser edx edx@example.org + +Supply a password (the one used by devstack is ``edx`` so use that if you want to be consistent with it). Then, create a service worker account for MITx Online: + +.. code-block:: + + tutor local do createuser --staff mitx_online_serviceworker service@mitxonline.odl.local + +Supply a password (this one doesn't matter for a local deployment, you won't ever actually use the account). + +For best results, create two new courses within edX. The MITx Online ``configure_instance`` command expects a couple of courses to exist in edX (because they come with the devstack package): + +.. list-table:: + :header-rows: 1 + + * - Course ID + - Course Title + * - course-v1:edX+DemoX+Demo_Course + - Demonstration Course + * - course-v1:edX+E2E-101+course + - E2E Test Course + + +If you have a devstack instance handy, you can export these and import them into Tutor. Otherwise, just create them and make sure to set dates for the courses (they default to 2030 otherwise). + +Finally, go here to create an access token for the service worker user: https://local.edly.io/admin/oauth2_provider/accesstoken/add/ The token can be anything, and the expiration date should just be today plus 10 years. + +MITx Online Setup +----------------- + +To set up MITx Online: + + +#. Get the gateway IP for the ``tutor_local_default`` network: ``docker network inspect tutor_local_default | grep Gateway`` + + * Mac users should instead use the host.docker.internal IP. Specify this by setting ``OPENEDX_IP=host-gateway`` in your MITx Online ``.env`` file. + +#. Set up your ``/etc/hosts`` file to point ``mitxonline.odl.local`` to localhost. +#. Clone the repository somewhere. +#. Set up your ``.env`` file. These settings need particular attention: + + * ``OPENEDX_IP``\ : set to the gateway IP from the first step + * ``OPENEDX_API_BASE_URL``\ : set to http://local.edly.io + * ``OPENEDX_SERVICE_WORKER_USERNAME``\ : set to ``mitx_online_serviceworker`` (unless you changed this) + * ``OPENEDX_SERVICE_WORKER_API_TOKEN``\ : set to the token you generated + +#. Build the app: ``docker compose build`` +#. Run migrations and configure Wagtail:: + + docker compose run --rm web ./manage.py migrate + docker compose run --rm web ./manage.py configure_wagtail + +#. Run the ``configure_instance`` command:: + + docker compose run --rm web ./manage.py configure_instance linux --gateway <ip> --tutor + + where ``<ip>`` is the IP from the first step. (On macOS, specify ``macos`` instead of ``linux``. You can also skip ``--gateway``.) You will need to supply passwords for the MITx Online superuser and test learner accounts. Make a note of the client ID and secret that it will print out at the end. + + +Tutor Setup, Part Two +--------------------- + +Note that some of these steps require editing the main configuration files for the production instance (which is also used for a local deployment). Most of the settings that need to be adjusted to get integration working are overridden by the default Tutor configuration, so you can't update them by setting ``config.yml``. If you're using the development Tutor build, you'll likely need to edit ``development.py`` rather than ``production.py`` as necessary. + +These steps will also disable the AuthN SSO MFE, so from here on you'll get normal edX authentication screens (if you're not being bounced to MITx Online). + + +#. Get the gateway IP of the ``mitxonline_default`` Docker network:: + + docker network inspect mitxonline_default | grep Gateway + +#. Log into to edX using your superuser account, and make sure your session stays open. Sessions are pretty long-lived so this just means not closing the browser that you started the session in. (Part of this process will involve mostly breaking authentication so it's important that you are able to get into the admin.) +#. Stop Tutor: ``tutor local stop`` +#. Change into the configuration root for Tutor:: + + cd "$(tutor config printroot)" + +#. Create a ``env/build/openedx/requirements/private.txt`` with the required extensions:: + + social-auth-mitxpro + openedx-companion-auth + +#. Edit the ``env/apps/openedx/config/lms.env.yml`` file and add:: + + FEATURES: + SKIP_EMAIL_VALIDATION: true + + to the ``FEATURES`` block (should be at the top). +#. Edit the ``env/apps/openedx/settings/lms/production.py`` and/or ``env/apps/openedx/settings/lms/development.py`` settings file. (The former is used by a local instance, where the latter is used by both dev and nightly instances.) + + * Add to the end of the file: + + * ``THIRD_PARTY_AUTH_BACKENDS = ['social_auth_mitxpro.backends.MITxProOAuth2']`` + * ``AUTHENTICATION_BACKENDS.append('social_auth_mitxpro.backends.MITxProOAuth2')`` + * ``IDA_LOGOUT_URI_LIST.append('http://mitxonline.odl.local:8013/logout/')`` - there's an existing one of these around like 300 in production.py too. + + * Find and update: + + * ``FEATURES['ENABLE_AUTHN_MICROFRONTEND'] = False`` (defaults to True) + * ``REGISTRATION_EXTRA_FIELDS["terms_of_service"] = "hidden"`` (defaults to required) + +#. Build a new ``openedx`` image: ``tutor images build openedx`` (this will take a long time) +#. Run a Docker Compse rebuild: ``tutor local dc build`` (this should be pretty quick - it's likely not required, just doing it here for safety) +#. Restart Tutor: ``tutor local start -d`` (omit ``-d`` if you want to watch the logs) +#. Check your settings. There's a ``print_setting`` command that you can use to verify everything is set properly: + + * ``tutor local run lms ./manage.py lms print_setting REGISTRATION_EXTRA_FIELDS`` + * ``tutor local run lms ./manage.py lms print_setting AUTHENTICATION_BACKENDS`` + * ``tutor local run lms ./manage.py lms print_setting FEATURES`` - will print a lot of stuff + * ``tutor local run lms ./manage.py lms print_setting THIRD_PARTY_AUTH_BACKENDS`` + * If you do have weird errors or settings not showing properly, make sure you edited the right yaml files *and* that they're using the right whitespace (i.e. don't use tabs). + +#. In a separate browser session of some kind (incognito/private browsing/other browser entirely), try to navigate to http://local.edly.io . It should load but it should give you an error message. In the LMS logs, you should see an error message for "Can't fetch settings for disabled provider." This is proper operation - the OAuth2 settings aren't in place yet. +#. In the superuser session you have open, go to http://local.edly.io/admin . This should work. If you've been logged out, you should still be able to get in. If you can't (for instance, if you're getting 500 errors), you will need to turn off ``ENABLE_THIRD_PARTY_AUTH`` in ``FEATURES``\ , restart Tutor using ``tutor local stop`` and ``start``\ , not using ``reboot``\ , then try again. +#. Go to http://local.edly.io/admin/third_party_auth/oauth2providerconfig/add/ and add a provider configuration: + + * Enabled is checked. + * Name: ``mitxonline`` + * Slug: ``mitxpro-oauth2`` + * Site: ``local.edly.io`` + * Skip hinted login dialog is checked. + * Skip registration form is checked. + * Skip email verification is checked. + * Sync learner profile data is checked. + * Enable sso id verification is checked. + * Backend name: ``mitxpro-oauth2`` + * Client ID and Client Secret: from record created by ``configure_instance`` when you set up MITx Online. + * Other settings: + + { + "AUTHORIZATION_URL": "\http://mitxonline.odl.local:8013/oauth2/authorize/", + "ACCESS_TOKEN_URL": "\http://<MITXONLINE_GATEWAY_IP>:8013/oauth2/token/", + "API_ROOT": "\http://<MITXONLINE_GATEWAY_IP>:8013/" + } + + where MITXONLINE_GATEWAY_IP is the IP from the ``mitxonline_default`` network from the first step. **Mac users**, use ``host.docker.internal`` for MITXONLINE_GATEWAY_IP. + +#. Configure Tutor for OAuth2 authentication from MITx Online. + + * Go to http://local.edly.io/admin/oauth2_provider/application/ and either add or edit the ``edx-oauth-app`` entry. + * Ensure these settings are set: + + * Name: ``edx-oauth-app`` + * Redirect uris: ``http://mitxonline.odl.local:8013/login/_private/complete`` + * Client type: ``Confidential`` + * Authorization grant type: ``Authorization code`` + * Skip authorization is checked. + + * Save ``Client id`` and ``Client secret``. + +#. Update your MITx Online ``.env`` file. Set ``OPENEDX_API_CLIENT_ID`` and ``OPENEDX_API_CLIENT_SECRET`` to the values from the record you created or updated in the last step. +#. You should now be able to run some MITx Online management commands to ensure the service worker is set up properly: + + * ``sync_courserun --all ALL`` should sync the two test courses (if you made them). + * ``repair_missing_courseware_records`` should also work. + +#. In the separate browser session from step 12, attempt to log in again. This time, you should be able to log in through MITx Online, and you should be able to get to the edX LMS dashboard. If not, then double-check your provider configuration settings and try again. + + * Unlike devstack, the Tutor instance has an Update button for the provider configuration, so you can just update the record you put in. + * If you are still getting "Can't fetch settings" errors, *make sure* your Site is set properly - there are three options by default and only one works. (This was typically the problem I had.) + +#. Optionally, log into the LMS Django Admin and make your MITx Online superuser account a superuser there too. + +Other Notes +----------- + +**Trying to set configuration settings via ``tutor config`` will undo the specialty configuration above.** If you need to make changes to the configuration, either manually edit the ``env/apps/openedx/config/lms.env.yml`` file or the ``env/apps/openedx/settings/lms/production.py`` file and restart your Tutor instance. + +**Make sure your service worker account is active.** It's an easy checkbox to miss. + +**Restarting** If you want to rebuild from scratch, make sure you ``docker image prune``. It's also recommended to remove the Tutor project root folder - ``tutor config printroot`` will tell you where that is. + +**Running Multiple Tutor Instances** If you want to run more than one Tutor instance, it's pretty important to specify the project root explicitly or you may end up with one instance trying to use config files from another and things getting confused from there. `See the Tutor documentation for this. <https://docs.tutor.overhang.io/local.html#tutor-root>`_ (A suggestion: configure aliases to the ``tutor`` command that run ``tutor --root=<whatever>`` so you don't have to rely on environment variables, especially if you keep multiple terminal sessions going.) diff --git a/_sources/configuration/uwsgi_tuning.rst.txt b/_sources/configuration/uwsgi_tuning.rst.txt new file mode 100644 index 0000000000..605e1fff52 --- /dev/null +++ b/_sources/configuration/uwsgi_tuning.rst.txt @@ -0,0 +1,68 @@ +======================================= +Setting up uWsgi tuning for MITx Online +======================================= + +This setup satisfies the testing to help with tuning as mentioned in this `Discusssion Post <https://github.com/mitodl/hq/discussions/393>`_ + +Largely borrowed from work on OCW studio: + +| `Adding uWSGI stats <https://github.com/mitodl/ocw-studio/pull/1898/>`_ +| `Tuning the App <https://github.com/mitodl/ocw-studio/pull/1886/>`_ + + +****************** +To set up locally: +****************** + +Set up uwsgitop +--------------- +1. Install uwsgitop: ``docker compose run --rm web poetry add uwsgitop`` +2. Set UWSGI_RELOAD_ON_RSS in your .env to a high value (e.g. 500) +3. Set UWSGI_MAX_REQUESTS in your .env to a high value (e.g. 10000) +4. ``docker compose build`` +5. ``docker compose up`` +6. In a new terminal window/tab, ``docker compose exec web uwsgitop /tmp/uwsgi-stats.sock`` +7. You should see your application's memory usage without usage. Ready to go. + + +Set up Locust +------------- +1. Install Locust: ``docker compose run --rm web poetry add locust`` +2. Add locust to your docker-compose.yml locally, under services: + +.. code-block:: shell + + locust: + image: locustio/locust + ports: + - "8089:8089" + volumes: + - ./:/src + command: > + -f /src/locustfile.py + +3. Add the following to the web block, at the level of, and directly after, ``build``: + +.. code-block:: shell + + deploy: + resources: + limits: + cpus: "2" + memory: "1g" + +4. Add locustfile.py. There is an example file at ``locustfile.py.example`` in the root of the repo. ``cp locustfile.py.example locustfile.py`` will copy it over as is. Change variables and/or add tests as needed. + +Put it all together +------------------- + +1. Run ``docker-compose build`` +2. Run ``docker-compose up`` +3. You can use locust from ``http://0.0.0.0:8089/`` in a browser +4. You can use uwsgitop in a terminal with ``docker compose exec web uwsgitop /tmp/uwsgi-stats.sock`` + +****************** +To test: +****************** + +Coming soon! diff --git a/_sources/ecommerce/flexible_pricing.rst.txt b/_sources/ecommerce/flexible_pricing.rst.txt new file mode 100644 index 0000000000..3721af188b --- /dev/null +++ b/_sources/ecommerce/flexible_pricing.rst.txt @@ -0,0 +1,52 @@ +Flexible Pricing +================ + +The Flexible Pricing system allows learners to request alternative pricing for MITx Online courses based on their location and annual income. These requests can be made through a customizable form in the Wagtail CMS system. + +When the learner accesses the Flexible Pricing request form, they will see one of the following: + +* If they aren't logged in, they'll see a message saying so. Learners must be logged in to request flexibile pricing. +* If they haven't submitted a request, they'll see the flexible pricing form and will be able to submit a request. On submission, the learner will see a message saying their request has been approved (if it can be approved automatically), or will see a request for more information to be submitted via DocuSign. +* If they have submitted a request, they'll be presented with a status page for their request. The text for approved, denied, and in progress states can be customized. + +Form Creation +************* + +*To manually create a Flexible Pricing request form,* follow these steps: + +1. Navigate to the course page for the course. (Do not click the pencil button to edit, simply select the page itself.) +2. Click the Add Child Page button in the header. +3. You will be presented with the New Flexible Pricing Request Form page. Fill out the form. + + 1. The Intro field text is displayed on the form regardless of the state of the request. + 2. The Guest text is displayed if the learner isn't logged in yet. + 3. The Application Processing text is displayed if the learner navigates to the form again and their application is still being processed. + 4. The Application Approved text is displayed if the learner navigates to the form and their application has been approved. + 5. The Application Approved No Discount text is displayed if the learner navigates to the form and their application has been approved, but they've been approved for a zero-value tier. (In other words, the learner has exceeded the upper limit of flexible pricing.) + 6. The Application Denied text is displayed if the learner navigates to the form and their application has been denied. + 7. The Form Fields are the data that the learner must provide to be considered for flexible pricing. Leave this alone - the system will automatically add the proper fields when the form is published. + +4. Publish the form when you are ready. +5. Navigate back to the course page for the course, and edit the page. Add a link to the flexible pricing form you created in the page content. +6. Publish the course page when you are ready. + +To add the Flexible Pricing form to the Price card on a course page, first get the link to the live form. This can be done on the edit page for the flexible pricing form (as well as in a few other locations within the CMS). Then, add that link to the Link field in the Price card for the course. + +*To generate a Flexible Pricing request form with some reasonable defaults for your courseware object,* use the ``create_finaid_form`` management command: + +.. code-block:: bash + + $ manage.py create_finaid_form [--force] [--slug <slug name here>] [--title <title here>] courseware-readable-id + +This command will create an appropriate flexible pricing form for the courseware object: + +* If you've specified a Program, the form will be located under the program's page in the CMS. +* If you've specified a standalone Course, the form will be located under the course's page in the CMS. +* If you've specified a Course that is in a Program, the form will be located under the program's page in the CMS, *unless* the ``--force`` option is specified. In that case, the form will be under the course page. + +You can customize the title and slug using their respective options. By default, the system will use the object's title to generate a form title and slug. + +Processing Submitted Request +**************************** + +TBD diff --git a/_sources/ecommerce/index.rst.txt b/_sources/ecommerce/index.rst.txt new file mode 100644 index 0000000000..fb0009238e --- /dev/null +++ b/_sources/ecommerce/index.rst.txt @@ -0,0 +1,9 @@ +Ecommerce +========= + +.. toctree:: + :maxdepth: 2 + + overview + flexible_pricing + subsystems/index diff --git a/_sources/ecommerce/overview.rst.txt b/_sources/ecommerce/overview.rst.txt new file mode 100644 index 0000000000..916ec66478 --- /dev/null +++ b/_sources/ecommerce/overview.rst.txt @@ -0,0 +1,31 @@ +Overview +========= + +Goals +***** + +We will be creating a robust ecommerce implementation, incorporating learnings from the last several years to implement it in a scalable and reusable way. A good reference point is this guide on Pythonic SOLID Principle. We should also strongly strive towards keeping coupling between the subsystems proposed here to a minimum or at least limited in surface area. +Core + +The core of the ecommerce system should be simple enough to configure and operate but support enough functionality to serve a majority of our use cases. Users should be able to see programs or course runs, select them for purchase, and make a payment. + +Prior Art +********* + +We have a few implementations of ecommerce we’ve created over the years: + +MicroMasters +^^^^^^^^^^^^ +The MicroMasters implementation is highly specialized, particularly around financial aid programs where each learner gets custom pricing. Incorporating this level of complexity into the core of the ecommerce system is not something we want to do, but we should carve out some options to extend the system in the future without implementing it in the core system. + +xPro +^^^^ + +xPro ecommerce was implemented based on our experiences implementing ecommerce in MicroMasters. A good amount of planning went into this implementation, although it also has some specializations we wouldn’t be using in MITx Online such as a vouchers system. We will probably borrow heavily from the core designs that were proved out here. + +Core Systems +************ + +Ecommerce is actually a combination of 3 discernable subsystems that often get muddled together: products, orders, and payment. See the high-level diagram below to understand the pieces of data and operations that happen. + +.. mermaid:: assets/ecommerce-architecture.mm diff --git a/_sources/ecommerce/subsystems/basket.rst.txt b/_sources/ecommerce/subsystems/basket.rst.txt new file mode 100644 index 0000000000..a63398f79b --- /dev/null +++ b/_sources/ecommerce/subsystems/basket.rst.txt @@ -0,0 +1,30 @@ +Basket Subsystem +================ + +This tracks products intended to be purchased, often providing some additional state such as which runs under a program a user is purchasing. + +A simple schema for this would be: + +.. code-block:: python + + class Basket(TimestampedModel): + """Represents a User's basket.""" + + user = models.OneToOneField(settings.AUTH_USER_MODEL) + + class BasketItem(TimestampedModel): + """Represents one or more products in a user's basket.""" + + product = models.ForeignKey(Product) + basket = models.ForeignKey(Basket) + quantity = models.PositiveIntegerField() + +APIs +^^^^ + +- ``GET /api/v0/basket/`` -> get the current basket state +- ``POST /api/v0/basket/`` -> update the basket state + +Notes +^^^^^ +The implementation of this would use the discount subsystem to calculate the discounted prices, those values would be returned in the API for the frontend to use for display purposes. diff --git a/_sources/ecommerce/subsystems/discount.rst.txt b/_sources/ecommerce/subsystems/discount.rst.txt new file mode 100644 index 0000000000..3b0f8b09e8 --- /dev/null +++ b/_sources/ecommerce/subsystems/discount.rst.txt @@ -0,0 +1,101 @@ +Discount Subsystem +================== + +Discounts will need to be provided on occasion, these give the user a reduced price for some or all products. Treating this as a discount system and not necessarily a coupon system (e.g. a coupon is a kind of discount) is a good way to frame this approach. + +The discount system would support discounts of multiple types. We’ve done discounts a lot of different ways before so we need to balance out flexibility against keeping complexity down. Each discount would be associated with a certain Product. + +A discount may optionally be pre-associated with a User so that it can be automatically applied on checkout. + +Discounts should only be computed on the backend, some of our ecommerce implementations have computed the discount on the frontend and we want to avoid this going forward. + +Discount Types +^^^^^^^^^^^^^^ +Discount types would track how the discounted price is computed, some examples/ideas: +``percent-off``: a percentage off the original price +``dollars-off``: a fixed dollar reduction in price (e.g. $30 off) +``fixed-price``: the price is discounted to the fixed price (e.g. a product would cost $100 regardless of what the original price was) + +Redemption Types +^^^^^^^^^^^^^^^^ +There may be a few different ways we want to track discount usage, for example: + +``one-time``: the discount can only be used once by anyone +``one-time-per-user``: the discount can be used once per user +``unlimited``: the discount can be used any number of times + +Data Models +^^^^^^^^^^^ +.. code-block:: python + + class Discount(TimestampedModel): + """Discount model""" + amount = models.DecimalField( + decimal_places=5, + max_digits=20, + ) + automatic = models.BooleanField(default=False) + discount_type = models.CharField( + choices=DISCOUNT_TYPES, max_length=30 + ) + redemption_type = models.CharField( + choices=REDEMPTION_TYPES, max_length=30 + ) + max_redemptions = models.PositiveIntegerField(null=True) + + class UserDiscount(TimestampedModel): + """pre-assignment for a discount to a user""" + discount = models.ForeignKey(Discount) + user = models.ForeignKey(User) + +Implementation Proposal +^^^^^^^^^^^^^^^^^^^^^^^ + +Rather than codifying the discount logic in a complicated computation function, discount types can be implemented by abstracting the logic around discounts into a registry-driven discount factory like this: + +.. code-block:: python + + import abc + from dataclasses import dataclass + + + @dataclass + class DiscountType(abc.ABC): + _CLASSES = {} + + discount: Discount + + # see https://www.python.org/dev/peps/pep-0487/ + def __init_subclass__(cls, *, discount_type, **kwargs): + super().__init_subclass__(**kwargs) + + if discount_type in _CLASSES: + raise TypeError(f"{discount_type} already defined for DiscountType") + + cls.discount_type = discount_type + cls._CLASSES[discount_type] = cls + + @classmethod + def for_discount(cls, discount: Discount): + DiscountTypeCls = cls._CLASSES[discount.discount_type] + + return DiscountTypeCls(discount) + + def get_product_price(self, product: Product): + return self.get_product_version_price(product.latest_version) + + @abc.abstractmethod + def get_product_version_price(self, product_version: ProductVersion): + ... + + class PercentDiscount(DiscountType, discount_type=Discount.PERCENT_DISCOUNT): + + def get_product_version_price(self, product_version: ProductVersion): + return product_version.price * self.discount.amount + + class FixedPriceDiscount(DiscountType, discount_type=Discount.PERCENT_DISCOUNT): + + def get_product_version_price(self, product_version: ProductVersion): + return self.discount.amount # the amount here is the fixed price + +With this implementation, prices before ordering would use get_product_price, whereas the receipt service would use get_product_version_price on the purchased versions. This makes it far more scalable to introduce new discount types without having to refactor existing code. diff --git a/_sources/ecommerce/subsystems/index.rst.txt b/_sources/ecommerce/subsystems/index.rst.txt new file mode 100644 index 0000000000..fd4f0d3a3f --- /dev/null +++ b/_sources/ecommerce/subsystems/index.rst.txt @@ -0,0 +1,12 @@ +Subsystems +========== + +.. toctree:: + :maxdepth: 2 + + product + basket + order + discount + payment + reporting diff --git a/_sources/ecommerce/subsystems/order.rst.txt b/_sources/ecommerce/subsystems/order.rst.txt new file mode 100644 index 0000000000..0e8690df64 --- /dev/null +++ b/_sources/ecommerce/subsystems/order.rst.txt @@ -0,0 +1,30 @@ +Order Subsystem +=============== + +Orders represent a payment for some kind of product(s), these products will typically be either Programs or Course Runs. An order is marked as unfulfilled initially and then marked as fulfilled once a payment is completed. An order can fail or be refunded. + +Data Model +^^^^^^^^^^ +.. code-block:: python + + class Order(TimestampedModel): + """An order containing information for a purchase.""" + status = models.CharField() + purchaser = models.ForeignKey(settings.AUTH_USER_MODEL) + total_price_paid = models.DecimalField() + + class Line(TimestampedModel): + """A line in an Order.""" + + order = models.ForeignKey(Order) + product_version = models.ForeignKey(ProductVersion) + quantity = models.PositiveIntegerField() + + class Transaction(TimestampedModel): + """A transaction on an order, generally a payment but can also cover refunds""" + order = models.ForeignKey(Order) + amount = models.DecimalField( + decimal_places=5, + max_digits=20, + ) + data = models.JSONField() diff --git a/_sources/ecommerce/subsystems/payment.rst.txt b/_sources/ecommerce/subsystems/payment.rst.txt new file mode 100644 index 0000000000..ef6b97a9fc --- /dev/null +++ b/_sources/ecommerce/subsystems/payment.rst.txt @@ -0,0 +1,4 @@ +Payment Subsystem +================= + +The payment subsystem takes unfulfilled orders, takes the user through payment completion, and finally marks the order as fulfilled. We historically and for the foreseeable future use CyberSource, but this should be strongly decoupled from the rest of the ecommerce system and made pluggable for future flexibility. This system would also be responsible for any webhooks/callbacks that the payment processor makes to us. diff --git a/_sources/ecommerce/subsystems/product.rst.txt b/_sources/ecommerce/subsystems/product.rst.txt new file mode 100644 index 0000000000..5f4b7d157b --- /dev/null +++ b/_sources/ecommerce/subsystems/product.rst.txt @@ -0,0 +1,28 @@ +Product Subsystem +================= + +The product subsystem is responsible for tracking all product-related data. Purchasable products are typically Programs and Course Runs. Pricing information is tracked as immutable data for the sake of historically accurate pricing for orders. + +Data Models +^^^^^^^^^^^ + +.. code-block:: python + + @reversion.register(exclude=("content_type", "object_id", "created_on", "updated_on")) + class Product(TimestampedModel): + """ + Representation of a purchasable product. There is a GenericForeignKey to a Course or Program. + """ + content_type = models.ForeignKey(ContentType) + object_id = models.PositiveIntegerField() + content_object = GenericForeignKey("content_type", "object_id") + +This will utilize `django-reversion` to version product data. + +APIs +^^^^ + +The API that would be primarily needed would be one to read back product data. It is presumed that data entry is done through django-admin: + +- ``GET /api/v0/products/`` -> returns a paginated list of products +- ``GET /api/v0/products/1/`` -> returns a single product diff --git a/_sources/ecommerce/subsystems/reporting.rst.txt b/_sources/ecommerce/subsystems/reporting.rst.txt new file mode 100644 index 0000000000..9aa05dc621 --- /dev/null +++ b/_sources/ecommerce/subsystems/reporting.rst.txt @@ -0,0 +1,17 @@ +Reporting Subsystem +=================== + +OL marketing and finance team need to include financial data in their reporting, so they can evaluate and plan campaigns, reconcile accounts, and payout royalties. As a guiding principle, we want to be able to report on any data that is collected by the ecommerce system, but avoid supplementing the data with external considerations (such as marketing costs, or payout rates). + +Use Cases +********* + +MicroMasters +^^^^^^^^^^^^ + +Most of MicroMasters programs and courses function the same as any other MITx course, they wouldn’t otherwise be treated any differently except for marketing purposes, which are out of scope for this document if not MITx Online altogether. + +DEDP +^^^^ + +The DEDP program as it is implemented currently is a special case when it comes to ecommerce - DEDP currently supports financial aid. This essentially amounts to a discount to a lower fixed rate. There are a few tiers of financial aid discounts available, but this is easily handled with a couple of preconfigured discounts. We’d need a UI somewhere that enables staff to assign a discount to a particular learner. That discount would then automatically apply to courses within that program, the same as any other program-scoped discount. diff --git a/_sources/index.rst.txt b/_sources/index.rst.txt new file mode 100644 index 0000000000..a7fd8f7d37 --- /dev/null +++ b/_sources/index.rst.txt @@ -0,0 +1,22 @@ +.. MITx Online Documentation documentation master file, created by + sphinx-quickstart on Tue Dec 7 10:41:39 2021. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to MITx Online Documentation's documentation! +===================================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + authentication + configuration/index + ecommerce/index + commands/index + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`search` diff --git a/_static/basic.css b/_static/basic.css new file mode 100644 index 0000000000..59043d5577 --- /dev/null +++ b/_static/basic.css @@ -0,0 +1,925 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +div.section::after { + display: block; + content: ''; + clear: left; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 19rem; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox form.search { + overflow: hidden; +} + +div.sphinxsidebar #searchbox input[type="text"] { + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; +} + + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li p.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: unset; + max-width: 45rem; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +a:visited { + color: #551A8B; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, figure.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, figure.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, figure.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +img.align-default, figure.align-default, .figure.align-default { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-default { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar, +aside.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px; + background-color: #ffe; + width: 40%; + float: right; + clear: right; + overflow-x: auto; +} + +p.sidebar-title { + font-weight: bold; +} + +nav.contents, +aside.topic, +div.admonition, div.topic, blockquote { + clear: left; +} + +/* -- topics ---------------------------------------------------------------- */ + +nav.contents, +aside.topic, +div.topic { + border: 1px solid #ccc; + padding: 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- content of sidebars/topics/admonitions -------------------------------- */ + +div.sidebar > :last-child, +aside.sidebar > :last-child, +nav.contents > :last-child, +aside.topic > :last-child, +div.topic > :last-child, +div.admonition > :last-child { + margin-bottom: 0; +} + +div.sidebar::after, +aside.sidebar::after, +nav.contents::after, +aside.topic::after, +div.topic::after, +div.admonition::after, +blockquote::after { + display: block; + content: ''; + clear: both; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + margin-top: 10px; + margin-bottom: 10px; + border: 0; + border-collapse: collapse; +} + +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table.align-default { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +th > :first-child, +td > :first-child { + margin-top: 0px; +} + +th > :last-child, +td > :last-child { + margin-bottom: 0px; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure, figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption, figcaption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number, +figcaption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text, +figcaption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- hlist styles ---------------------------------------------------------- */ + +table.hlist { + margin: 1em 0; +} + +table.hlist td { + vertical-align: top; +} + +/* -- object description styles --------------------------------------------- */ + +.sig { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; +} + +.sig-name, code.descname { + background-color: transparent; + font-weight: bold; +} + +.sig-name { + font-size: 1.1em; +} + +code.descname { + font-size: 1.2em; +} + +.sig-prename, code.descclassname { + background-color: transparent; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.sig-param.n { + font-style: italic; +} + +/* C++ specific styling */ + +.sig-inline.c-texpr, +.sig-inline.cpp-texpr { + font-family: unset; +} + +.sig.c .k, .sig.c .kt, +.sig.cpp .k, .sig.cpp .kt { + color: #0033B3; +} + +.sig.c .m, +.sig.cpp .m { + color: #1750EB; +} + +.sig.c .s, .sig.c .sc, +.sig.cpp .s, .sig.cpp .sc { + color: #067D17; +} + + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +:not(li) > ol > li:first-child > :first-child, +:not(li) > ul > li:first-child > :first-child { + margin-top: 0px; +} + +:not(li) > ol > li:last-child > :last-child, +:not(li) > ul > li:last-child > :last-child { + margin-bottom: 0px; +} + +ol.simple ol p, +ol.simple ul p, +ul.simple ol p, +ul.simple ul p { + margin-top: 0; +} + +ol.simple > li:not(:first-child) > p, +ul.simple > li:not(:first-child) > p { + margin-top: 0; +} + +ol.simple p, +ul.simple p { + margin-bottom: 0; +} + +aside.footnote > span, +div.citation > span { + float: left; +} +aside.footnote > span:last-of-type, +div.citation > span:last-of-type { + padding-right: 0.5em; +} +aside.footnote > p { + margin-left: 2em; +} +div.citation > p { + margin-left: 4em; +} +aside.footnote > p:last-of-type, +div.citation > p:last-of-type { + margin-bottom: 0em; +} +aside.footnote > p:last-of-type:after, +div.citation > p:last-of-type:after { + content: ""; + clear: both; +} + +dl.field-list { + display: grid; + grid-template-columns: fit-content(30%) auto; +} + +dl.field-list > dt { + font-weight: bold; + word-break: break-word; + padding-left: 0.5em; + padding-right: 5px; +} + +dl.field-list > dd { + padding-left: 0.5em; + margin-top: 0em; + margin-left: 0em; + margin-bottom: 0em; +} + +dl { + margin-bottom: 15px; +} + +dd > :first-child { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +.sig dd { + margin-top: 0px; + margin-bottom: 0px; +} + +.sig dl { + margin-top: 0px; + margin-bottom: 0px; +} + +dl > dd:last-child, +dl > dd:last-child > :last-child { + margin-bottom: 0; +} + +dt:target, span.highlighted { + background-color: #fbe54e; +} + +rect.highlighted { + fill: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +.classifier:before { + font-style: normal; + margin: 0 0.5em; + content: ":"; + display: inline-block; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +.translated { + background-color: rgba(207, 255, 207, 0.2) +} + +.untranslated { + background-color: rgba(255, 207, 207, 0.2) +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +pre, div[class*="highlight-"] { + clear: both; +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; + white-space: nowrap; +} + +div[class*="highlight-"] { + margin: 1em 0; +} + +td.linenos pre { + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + display: block; +} + +table.highlighttable tbody { + display: block; +} + +table.highlighttable tr { + display: flex; +} + +table.highlighttable td { + margin: 0; + padding: 0; +} + +table.highlighttable td.linenos { + padding-right: 0.5em; +} + +table.highlighttable td.code { + flex: 1; + overflow: hidden; +} + +.highlight .hll { + display: block; +} + +div.highlight pre, +table.highlighttable pre { + margin: 0; +} + +div.code-block-caption + div { + margin-top: 0; +} + +div.code-block-caption { + margin-top: 1em; + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +table.highlighttable td.linenos, +span.linenos, +div.highlight span.gp { /* gp: Generic.Prompt */ + user-select: none; + -webkit-user-select: text; /* Safari fallback only */ + -webkit-user-select: none; /* Chrome/Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE10+ */ +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + margin: 1em 0; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: absolute; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/_static/doctools.js b/_static/doctools.js new file mode 100644 index 0000000000..4d67807d17 --- /dev/null +++ b/_static/doctools.js @@ -0,0 +1,156 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Base JavaScript utilities for all Sphinx HTML documentation. + * + * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ +"use strict"; + +const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ + "TEXTAREA", + "INPUT", + "SELECT", + "BUTTON", +]); + +const _ready = (callback) => { + if (document.readyState !== "loading") { + callback(); + } else { + document.addEventListener("DOMContentLoaded", callback); + } +}; + +/** + * Small JavaScript module for the documentation. + */ +const Documentation = { + init: () => { + Documentation.initDomainIndexTable(); + Documentation.initOnKeyListeners(); + }, + + /** + * i18n support + */ + TRANSLATIONS: {}, + PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), + LOCALE: "unknown", + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext: (string) => { + const translated = Documentation.TRANSLATIONS[string]; + switch (typeof translated) { + case "undefined": + return string; // no translation + case "string": + return translated; // translation exists + default: + return translated[0]; // (singular, plural) translation tuple exists + } + }, + + ngettext: (singular, plural, n) => { + const translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated !== "undefined") + return translated[Documentation.PLURAL_EXPR(n)]; + return n === 1 ? singular : plural; + }, + + addTranslations: (catalog) => { + Object.assign(Documentation.TRANSLATIONS, catalog.messages); + Documentation.PLURAL_EXPR = new Function( + "n", + `return (${catalog.plural_expr})` + ); + Documentation.LOCALE = catalog.locale; + }, + + /** + * helper function to focus on search bar + */ + focusSearchBar: () => { + document.querySelectorAll("input[name=q]")[0]?.focus(); + }, + + /** + * Initialise the domain index toggle buttons + */ + initDomainIndexTable: () => { + const toggler = (el) => { + const idNumber = el.id.substr(7); + const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); + if (el.src.substr(-9) === "minus.png") { + el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; + toggledRows.forEach((el) => (el.style.display = "none")); + } else { + el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; + toggledRows.forEach((el) => (el.style.display = "")); + } + }; + + const togglerElements = document.querySelectorAll("img.toggler"); + togglerElements.forEach((el) => + el.addEventListener("click", (event) => toggler(event.currentTarget)) + ); + togglerElements.forEach((el) => (el.style.display = "")); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); + }, + + initOnKeyListeners: () => { + // only install a listener if it is really needed + if ( + !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && + !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS + ) + return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.altKey || event.ctrlKey || event.metaKey) return; + + if (!event.shiftKey) { + switch (event.key) { + case "ArrowLeft": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const prevLink = document.querySelector('link[rel="prev"]'); + if (prevLink && prevLink.href) { + window.location.href = prevLink.href; + event.preventDefault(); + } + break; + case "ArrowRight": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const nextLink = document.querySelector('link[rel="next"]'); + if (nextLink && nextLink.href) { + window.location.href = nextLink.href; + event.preventDefault(); + } + break; + } + } + + // some keyboard layouts may need Shift to get / + switch (event.key) { + case "/": + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; + Documentation.focusSearchBar(); + event.preventDefault(); + } + }); + }, +}; + +// quick alias for translations +const _ = Documentation.gettext; + +_ready(Documentation.init); diff --git a/_static/documentation_options.js b/_static/documentation_options.js new file mode 100644 index 0000000000..f38abe9a89 --- /dev/null +++ b/_static/documentation_options.js @@ -0,0 +1,13 @@ +const DOCUMENTATION_OPTIONS = { + VERSION: '', + LANGUAGE: 'en', + COLLAPSE_INDEX: false, + BUILDER: 'html', + FILE_SUFFIX: '.html', + LINK_SUFFIX: '.html', + HAS_SOURCE: true, + SOURCELINK_SUFFIX: '.txt', + NAVIGATION_WITH_KEYS: true, + SHOW_SEARCH_SUMMARY: true, + ENABLE_SEARCH_SHORTCUTS: true, +}; \ No newline at end of file diff --git a/_static/file.png b/_static/file.png new file mode 100644 index 0000000000..a858a410e4 Binary files /dev/null and b/_static/file.png differ diff --git a/_static/insipid-sidebar-readthedocs.css b/_static/insipid-sidebar-readthedocs.css new file mode 100644 index 0000000000..ad79916e64 --- /dev/null +++ b/_static/insipid-sidebar-readthedocs.css @@ -0,0 +1,66 @@ + + +#ethical-ad-placement { + margin-top: auto; + padding-top: 3em; + min-height: 200px; +} + +#readthedocs-embed-flyout, #duplicated-readthedocs-versions { + margin-left: -10px; + margin-right: -10px; +} + +#duplicated-readthedocs-versions { + margin-bottom: -10px; +} + +#duplicated-readthedocs-versions { + position: sticky; + width: auto; +} + +#readthedocs-embed-flyout .rst-versions.rst-badge { + position: static; + max-width: none; +} + + +#readthedocs-embed-flyout .rst-versions.shift-up { + max-height: none; +} + +/* We have duplicated this section, so we don't need the second instance: */ +#readthedocs-embed-flyout .rst-versions.rst-badge .rst-current-version { + display: none; +} + +#duplicated-readthedocs-versions .rst-current-version { + font-size: 0.9rem; +} + +#readthedocs-embed-flyout .rst-versions .rst-other-versions { + display: block; + font-size: 0.9rem; +} + +#flyout-search-form input { + width: 100%; +} + +#sidebar-checkbox:not(:checked) ~ .ethical-fixedfooter { + left: 0; + right: 0; + width: unset; +} + +#sidebar-checkbox:checked ~ .ethical-fixedfooter { + left: var(--sidebar-width); + right: 0; + width: unset; +} + +body:not(.sidebar-resizing) .ethical-fixedfooter { + transition: left 0.3s ease-out; +} + diff --git a/_static/insipid-sidebar.js b/_static/insipid-sidebar.js new file mode 100644 index 0000000000..4ec001690a --- /dev/null +++ b/_static/insipid-sidebar.js @@ -0,0 +1,308 @@ +(dom_loaded => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', dom_loaded); + } else { + dom_loaded(); + } +})(() => { + 'use strict'; + + const sidebar = document.querySelector('.sphinxsidebar'); + const sidebar_tabbable = sidebar.querySelectorAll('input, textarea, select, button, a[href], area[href], iframe'); + const sidebar_button = document.getElementById('sidebar-button'); + const sidebar_checkbox = document.getElementById('sidebar-checkbox'); + const topbar = document.getElementById('topbar'); + const overlay = document.getElementById('overlay'); + const root = document.documentElement; + + sidebar.setAttribute('id', 'sphinxsidebar'); // for aria-controls + + Element.prototype.css = function (name, ...value) { + if (value.length) { + this.style.setProperty(name, ...value); + } else { + return window.getComputedStyle(this).getPropertyValue(name); + } + } + + function updateSidebarAttributesVisible() { + sidebar_button.setAttribute('title', "Collapse sidebar"); + sidebar_button.setAttribute('aria-label', "Collapse sidebar"); + sidebar_button.setAttribute('aria-expanded', true); + sidebar.setAttribute('aria-hidden', false); + sidebar_tabbable.forEach(el => el.setAttribute('tabindex', 0)); + } + + function updateSidebarAttributesHidden() { + sidebar_button.setAttribute('title', "Expand sidebar"); + sidebar_button.setAttribute('aria-label', "Expand sidebar"); + sidebar_button.setAttribute('aria-expanded', false); + sidebar.setAttribute('aria-hidden', true); + sidebar_tabbable.forEach(el => el.setAttribute('tabindex', -1)); + } + + sidebar.setAttribute('tabindex', -1); + + function store(key, value) { + try { + localStorage.setItem(key, value); + } catch (e) { + } + } + + sidebar_checkbox.addEventListener('change', event => { + if (event.target.checked) { + updateSidebarAttributesVisible(); + store('sphinx-sidebar', 'visible'); + document.body.classList.remove('topbar-folded'); + sidebar.focus({preventScroll: true}); + sidebar.blur(); + } else { + updateSidebarAttributesHidden(); + store('sphinx-sidebar', 'hidden'); + if (document.scrollingElement.scrollTop < topbar.offsetHeight) { + document.body.classList.remove('topbar-folded'); + } else { + document.body.classList.add('topbar-folded'); + } + document.scrollingElement.focus({preventScroll: true}); + document.scrollingElement.blur(); + } + }); + + if (sidebar_checkbox.checked) { + updateSidebarAttributesVisible(); + } else { + updateSidebarAttributesHidden(); + } + + function show() { + sidebar_checkbox.checked = true; + sidebar_checkbox.dispatchEvent(new Event('change')); + } + + function hide() { + sidebar_checkbox.checked = false; + sidebar_checkbox.dispatchEvent(new Event('change')); + } + + sidebar_button.addEventListener('keydown', event => { + if (event.code === 'Enter' || event.code === 'Space') { + sidebar_button.click(); + event.preventDefault(); + } + }); + + let touchstart; + + document.addEventListener('touchstart', event => { + if (event.touches.length > 1) { return; } + const touch = event.touches[0]; + if (sidebar_checkbox.checked) { + if (touch.clientX > sidebar.offsetWidth) { + return; + } + } else { + if (touch.clientX > 20) { + return; + } + } + touchstart = { + x: touch.clientX, + y: touch.clientY, + t: Date.now(), + }; + }); + + document.addEventListener('touchend', event => { + if (!touchstart) { return; } + if (event.touches.length > 0 || event.changedTouches.length > 1) { + touchstart = null; + return; + } + const touch = event.changedTouches[0]; + const x = touch.clientX; + const y = touch.clientY; + const x_diff = x - touchstart.x; + const y_diff = y - touchstart.y; + const t_diff = Date.now() - touchstart.t; + if (t_diff < 400 && Math.abs(x_diff) > Math.max(100, Math.abs(y_diff))) { + if (x_diff > 0) { + if (!sidebar_checkbox.checked) { + show(); + } + } else { + if (sidebar_checkbox.checked) { + hide(); + } + } + } + touchstart = null; + }); + + const sidebar_resize_handles = document.querySelectorAll('.sidebar-resize-handle'); + sidebar_resize_handles.forEach(el => { + el.addEventListener('mousedown', event => { + window.addEventListener('mousemove', resize_mouse); + window.addEventListener('mouseup', stop_resize_mouse); + document.body.classList.add('sidebar-resizing'); + event.preventDefault(); // Prevent unwanted text selection while resizing + }); + el.addEventListener('touchstart', event => { + if (event.touches.length > 1) { return; } + window.addEventListener('touchmove', resize_touch); + window.addEventListener('touchend', stop_resize_touch); + document.body.classList.add('sidebar-resizing'); + event.preventDefault(); // Prevent unwanted text selection while resizing + }); + }); + + let ignore_resize = false; + + function resize_base(event) { + if (ignore_resize) { return; } + const window_width = window.innerWidth; + const width = event.clientX; + if (width > window_width) { + root.css('--sidebar-width', window_width + 'px'); + } else if (width > 10) { + root.css('--sidebar-width', width + 'px'); + } else { + ignore_resize = true; + hide(); + } + } + + function resize_mouse(event) { + resize_base(event); + } + + function resize_touch(event) { + if (event.touches.length > 1) { return; } + resize_base(event.touches[0]); + } + + function stop_resize_base() { + if (ignore_resize) { + root.css('--sidebar-width', '19rem'); + ignore_resize = false; + } + store('sphinx-sidebar-width', root.css('--sidebar-width')); + document.body.classList.remove('sidebar-resizing'); + } + + function stop_resize_mouse(event) { + window.removeEventListener('mousemove', resize_mouse); + window.removeEventListener('mouseup', stop_resize_mouse); + stop_resize_base(); + } + + function stop_resize_touch(event) { + if (event.touches.length > 0 || event.changedTouches.length > 1) { + return; + } + window.removeEventListener('touchmove', resize_touch); + window.removeEventListener('touchend', stop_resize_touch); + stop_resize_base(); + } + + window.addEventListener('resize', event => { + const window_width = window.innerWidth; + if (window_width < sidebar.offsetWidth) { + root.css('--sidebar-width', window_width + 'px'); + } + }); + + // This is part of the sidebar code because it only affects the sidebar + if (window.ResizeObserver) { + const resizeObserver = new ResizeObserver(entries => { + for (let entry of entries) { + let height; + if (entry.borderBoxSize && entry.borderBoxSize.length > 0) { + height = entry.borderBoxSize[0].blockSize; + } else { + height = entry.contentRect.height; + } + root.css('--topbar-height', height + 'px'); + } + }); + resizeObserver.observe(topbar); + } + + let current = []; + let links = []; + + document.querySelectorAll('.sphinxsidebar *').forEach(el => { + let link = el.querySelector(':scope > a[href^="#"]'); + if (link) { + el.classList.add('current-page'); + current.push(el); + links.push(link); + } + }); + const small_screen = window.matchMedia('(max-width: 39rem)'); + + if (current.length === 1 && current[0].childElementCount === 1 && small_screen.matches) { + hide(); + } + const bottom_space = 0; + + if (current.length) { + const top = current[0].getBoundingClientRect().top; + const bottom = current[current.length - 1].getBoundingClientRect().bottom; + if (top < topbar.offsetHeight || bottom > (sidebar.offsetHeight - bottom_space)) { + current[0].scrollIntoView(true); + } + } + + let sections = new Map(); + + const intersection_callback = (entries, observer) => { + entries.forEach(entry => { + let link = sections.get(entry.target); + if (entry.isIntersecting) { + link.classList.add('in-view'); + } else { + link.classList.remove('in-view'); + } + }); + }; + + const intersection_observer = new IntersectionObserver(intersection_callback, { + root: null, + // NB: This uses the initial topbar height, later changes are ignored: + rootMargin: -topbar.offsetHeight + 'px 0px 0px 0px', + threshold: 0.0, + }); + + links.forEach(link => { + let section; + let id = link.hash; + if (id) { + id = id.slice(1); + section = document.getElementById(decodeURI(id)); + // Detect API doc headers: + let single_definition_term = ( + section.nodeName == 'DT' && + section.nextElementSibling.nodeName == 'DD' && + !section.nextElementSibling.nextElementSibling && + section.parentElement.nodeName == 'DL'); + if (single_definition_term) { + // The <dl> contains only a single <dt> + <dd>, + // therefore we can observe the whole <dl>. + section = section.parentElement; + } + } else { + // NB: The first section has no hash, so we don't know its ID: + section = document.querySelector('div.body .section, div.body section'); + } + sections.set(section, link); + intersection_observer.observe(section); + link.addEventListener('click', event => { + if (small_screen.matches) { + hide(); + } + }); + }); +}); + diff --git a/_static/insipid.css b/_static/insipid.css new file mode 100644 index 0000000000..7834022d3c --- /dev/null +++ b/_static/insipid.css @@ -0,0 +1,1223 @@ +/* -- variables ------------------------------------------------------------- */ + +:root { + --sidebar-width: 19rem; + --topbar-height: 3rem; +} + +/* -- page layout ----------------------------------------------------------- */ + +body { + position: relative; /* reference for sidebar-resize-handle */ + margin: 0; + font-family: 'Open Sans', sans-serif; + min-width: unset; + color: #000; + background-color: #fff; + text-size-adjust: none; + -webkit-text-size-adjust: none; +} + +/* keep the footer at the bottom (on very short pages) */ +html { height: 100%; } +body { min-height: 100%; display: flex; flex-direction: column; } +div.document { flex-grow: 1; } + +div.body { + padding: 0 20px; + min-width: unset; /* body_min_width is applied to <body> */ + overflow-x: auto; + + margin-left: auto; + margin-right: auto; + + line-height: 1.618; +} + +* { + scroll-margin-top: var(--topbar-height); + scroll-snap-margin-top: var(--topbar-height); /* Safari */ +} + +/* -- scrollbars ------------------------------------------------------------ */ + +html::-webkit-scrollbar, div.sphinxsidebar::-webkit-scrollbar { + width: 12px; + background-color: #fff; +} + +html::-webkit-scrollbar-thumb, div.sphinxsidebar::-webkit-scrollbar-thumb { + background-color: #ccc; + border-radius: 6px; +} + +html, div.sphinxsidebar { + scrollbar-color: #ccc transparent; +} + +body { + scrollbar-color: initial; +} + +div.sphinxsidebar::-webkit-scrollbar { + width: 7px; +} + +div.sphinxsidebar::-webkit-scrollbar-thumb { + border-radius: 3.5px; +} + +div.sphinxsidebar { + scrollbar-width: thin; +} + +/* -- body styles ----------------------------------------------------------- */ + +strong { + font-weight: 600; +} + +div.body h1, +div.body h2, +div.body h3, +div.body h4, +div.body h5, +div.body h6, +.toctree-wrapper .caption, +p.rubric { + margin-top: 1.3em; + margin-bottom: 1rem; + font-weight: 600; + line-height: 1.35; + overflow-wrap: break-word; +} + +div.body h5, +div.body h6 { + font-weight: bold; +} + +div.body h1 strong, +div.body h2 strong, +div.body h3 strong, +div.body h4 strong, +div.body h5 strong, +div.body h6 strong { + font-weight: 800; +} + +div.body h1 { font-size: 2em; } +div.body h2 { font-size: 1.7em; } +div.body h3 { font-size: 1.4em; } +div.body h4 { font-size: 1.2em; } +div.body h5 { font-size: 1em; } +div.body h6 { font-size: 0.9em } + +.toctree-wrapper .caption, +p.rubric { + font-size: 1.1em; + font-weight: bold; +} + +a.headerlink { + padding: 0 4px; + font-size: 1rem; + font-weight: normal; +} + +blockquote { + clear: inline-start; + margin: 10px 0; + border: 1px solid #0002; + border-left-width: 7px; + padding: 0 1em; +} + +.section > blockquote, +section > blockquote { + margin: 10px -7px; +} + +blockquote.pull-quote p:not(.attribution), +blockquote.epigraph p:not(.attribution) { + font-size: 130%; + font-style: italic; + color: #666; +} + +blockquote:not(.pull-quote):not(.epigraph) p.attribution { + font-style: italic; +} + +blockquote p.attribution { + text-align: end; +} + +div.body a:target, +strong:target { + padding: 3px; + margin: -3px; +} + +div.body dl > dt:target, +div.body div.admonition dl > dt:target, +div.body .topic dl > dt:target, +div.body .sidebar dl > dt:target, +div.body .sidebar .sidebar-title a:target, +div.body a:target, +strong:target { + background-color: #fbe54e; +} + +.footnote:target { + background-color: unset; +} + +.footnote:target .label { + padding: 3px; + margin: -3px; + background-color: #fbe54e; +} + +.citation:target .label { + padding: 3px; + margin-left: -3px; + margin-top: -3px; + margin-bottom: -3px; + margin-right: 5px; + background-color: #fbe54e; +} + +.citation:target .backrefs { + margin-left: -8px; +} + +hr.docutils { + border: 0; + border-top: solid 1px #ccc; +} + +.section > hr.docutils, +section > hr.docutils { + margin-left: -7px; + margin-right: -7px; +} + +.compound:not(.toctree-wrapper) { + margin-top: 1em; + margin-bottom: 1em; +} + +.compound:not(.toctree-wrapper) > * { + margin-top: 0.2em; + margin-bottom: 0.2em; +} + +.compound:not(.toctree-wrapper) > *:first-child { + margin-top: 0; + margin-bottom: 0.2em; +} + +.compound:not(.toctree-wrapper) > *:last-child { + margin-top: 0.2em; + margin-bottom: 0; +} + +section, .section { + clear: inline-start; +} + +/* -- hyperlink styles ------------------------------------------------------ */ + +a { + color: #1863b5; + text-decoration: none; + overflow-wrap: break-word; +} + +a:hover { + text-decoration: underline; +} + +a:visited { + color: #004188; +} + +a.external { + text-decoration: underline; +} + +a.external:hover { + text-decoration: none; +} + +a.external:visited { + text-decoration: none; +} + +/* -- code formatting ------------------------------------------------------- */ + +code, pre, kbd, samp { + font-family: 'DejaVu Sans Mono', Menlo, monospace; +} + +pre { + padding: 7px; + line-height: normal; + font-size: 0.875em; +} + +.section > div > div.highlight, +.section > .compound > div > div.highlight, +.section > .literal-block-wrapper > div > div.highlight, +.section > pre.literal-block, +.section > .compound > pre.literal-block, +section > div > div.highlight, +section > .compound > div > div.highlight, +section > .literal-block-wrapper > div > div.highlight, +section > pre.literal-block, +section > .compound > pre.literal-block { + margin-left: -7px; + margin-right: -7px; +} + +code, +code.xref, +a code, +div.body div.admonition dl > dt code, +div.body .topic dl > dt code, +div.body .sidebar dl > dt code, +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code, +div.code-block-caption code { + background-color: rgba(27,31,35,.05); + padding: 0.1em 0.2em; + font-weight: normal; +} + +div.body dl > dt code { + background-color: unset; + padding: unset; +} + +code.xref, +a code { + font-weight: unset; +} + +code.descname { + font-size: unset; +} + +.sig-name { + font-size: unset; +} + +.sig-paren, +.optional { + line-height: 0; +} + +div.code-block-caption { + text-align: center; + font-size: unset; +} + +div.literal-block-wrapper { + clear: both; +} + +td.linenos .linenodiv pre { + color: #666; + background-color: transparent; + padding: 7px 0px; +} + +table.highlighttable td.linenos { + padding-right: 0.5em; +} + +span.linenos { + margin-right: 0.7em; +} + +/* highlighted line (:emphasize-lines:) */ +.highlight .hll { + padding: 0 0.5em; + margin: 0 -0.5em; +} + +kbd.docutils:not(.compound) { + padding: 0.15em; + border-radius: 3px; + border: 1px solid #333; +} + +span.pre { + white-space: pre-wrap; + overflow-wrap: anywhere; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.topic, aside.topic, +div.sidebar, aside.sidebar, +nav.contents { + border: none; + padding: 7px; +} + +.section > div.admonition, +section > div.admonition, +div.body > div.admonition, +.section > .topic, +section > .topic, +div.body > .topic, +.section > nav.contents, +section > nav.contents, +div.body > nav.contents { + margin: 10px -7px; +} + +div.sidebar, +aside.sidebar { + margin-right: -7px; +} + +div.admonition > p.admonition-title, +.topic > p.topic-title, +nav.contents > p.topic-title, +.sidebar > p.sidebar-title { + margin: -7px -7px 7px -7px; + padding: 4px 7px; + font-weight: normal; + font-size: unset; + color: #333; +} + +.first.admonition-title, +.first.topic-title, +.first.sidebar-title { + /* override basic.css, which uses !important */ + margin-top: -7px !important; +} + +div.admonition > p.admonition-title + *, +.topic > p.topic-title + *, +nav.contents > p.topic-title + *, +.sidebar > p.sidebar-title + * { + margin-top: 0; +} + +div.admonition > :first-child:not(.admonition-title), +div.topic > :first-child:not(.topic-title), +aside.topic > :first-child:not(.topic-title), +nav.contents > :first-child:not(.topic-title) { + margin-top: 0; +} + +nav.contents > :last-child { + margin-bottom: 0; +} + +div.admonition { + background-color: #e4ebf2; +} + +div.admonition > p.admonition-title { + background-color: #cadcea; +} + +div.admonition.attention, +div.admonition.caution, +div.admonition.danger, +div.admonition.error, +div.admonition.warning { + background-color: #fbe7d4; +} + +div.admonition.attention > p.admonition-title, +div.admonition.caution > p.admonition-title, +div.admonition.danger > p.admonition-title, +div.admonition.error > p.admonition-title, +div.admonition.warning > p.admonition-title { + background-color: #f0d5b8; +} + +div.topic, nav.contents, aside.topic { + background-color: #fff0eb; +} + +.topic > p.topic-title, +nav.contents > p.topic-title { + background-color: #f0dbd4; +} + +div.sidebar, +aside.sidebar, +div.admonition.seealso { + background-color: #f4f4f4; +} + +.sidebar > p.sidebar-title, +div.admonition.seealso > p.admonition-title { + background-color: #e4e4e4; +} + +div.admonition.seealso { + clear: both; +} + +p.sidebar-subtitle { + font-style: italic; +} + +/* More specific selectors to override previous defintions */ +div.body div.admonition dl > dt, +div.body .topic dl > dt, +div.body .sidebar dl > dt { + padding: unset; + background-color: unset; +} + +div.body div.admonition dl:not(.glossary) > dt, +div.body .topic dl:not(.glossary) > dt, +div.body .sidebar dl:not(.glossary) > dt { + font-weight: unset; +} + +/* -- tables and lists ------------------------------------------------------ */ + +table.docutils { + overflow-x: auto; + display: block; + border-collapse: separate; + border-spacing: 4px 4px; + margin-top: 1em; + margin-bottom: 1em; +} + +table.docutils th { + font-weight: normal; + background-color: rgba(27,31,35,.05); + border-bottom: 2px solid #333; +} + +table.docutils td { + overflow-wrap: break-word; +} + + + +ol, ul { + padding-left: 1.2em; +} + +ol.simple p, ul.simple p { + margin-bottom: 0.3em; +} + +.toctree-wrapper ul, +.contents ul { + list-style: none; + margin-top: 0.5em; + padding-left: 2em; +} + +.toctree-wrapper li:not(:first-child), +.contents li:not(:first-child) { + margin-top: 0.5em; +} + +.toctree-wrapper > ul, +.contents > ul { + padding-left: unset; +} + +dl.citation > dt { + font-weight: 600; +} + +div.body dl { + margin: 1em 0; +} + +div.body dl > dt, +dl.field-list > dt { + display: table; +} + +div.body dt:not(.label), +dl.field-list > dt { + margin-top: 1em; + padding: 1px 7px; + background-color: #f5f5f5; +} + +.section > dl > dt:not(.label), +.section > dl.field-list > dt, +section > dl > dt:not(.label), +section > dl.field-list > dt { + margin: 1em -7px 0; +} + +div.body dl > dt:first-child { + margin-top: 0; +} + +div.body dl > dt.label:target, +div.body div.admonition dl > dt:target, +div.body .topic dl > dt:target, +div.body .sidebar dl > dt:target { + padding: 3px 7px; + margin-top: -3px; + margin-bottom: -3px; + margin-left: -7px; +} + +dl.glossary > dt { + font-size: unset; + font-weight: 600; +} + +dl.glossary > dt strong { + font-weight: bold; +} + +dl.field-list { + display: unset; +} + +dl.field-list > dt { + font-weight: unset; +} + +dl.field-list > dt::after { + content: unset; +} + +dd, +dl.field-list > dd { + padding-left: 0; + margin-top: 3px; + margin-left: 2em; +} + +dd:not(:last-child), +dl.field-list > dd:not(:last-child) { + margin-bottom: 1em; +} + +div.body dl.class > dt:not(:target), +div.body dl.type > dt:not(:target), +div.body dl.concept > dt:not(:target), +div.body dl.enum > dt:not(:target), +div.body dl.enum-class > dt:not(:target), +div.body dl.union > dt:not(:target) { + background-color: #e4ebf2; +} + +div.body dl.exception > dt:not(:target) { + background-color: #fbe7d4; +} + +/* -- relbar ---------------------------------------------------------------- */ + +.relbar { + padding: 10px 10px 0; +} + +.relbar > a { + box-sizing: border-box; + width: 50%; + padding: 10px; + display: flex; + align-items: center; + color: inherit; + text-decoration: none; + user-select: none; +} + +.relbar > a.previous { + float: left; +} + +.relbar > a.next { + float: right; + text-align: right; +} + +.relbar .icon { + color: #888; +} + +.relbar .previous .icon { + margin-right: 1em; +} + +.relbar .next .icon { + margin-left: 1em; +} + +.relbar .title { + position: relative; + flex: 1; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + font-size: 1.4em; + font-weight: 200; +} + +.relbar .title .text { + line-height: 2.1em; +} + +.relbar .title .text .direction { + position: absolute; + right: 0; + left: 0; + top: 0; + font-size: 60%; + line-height: 0.5em; +} + +.relbar .pre { + white-space: pre; +} + +/* -- breadcrumbs ----------------------------------------------------------- */ + +nav.crumbs { + color: #888; + font-size: 90%; +} + +nav.crumbs ul { + padding: 0; + list-style: none; +} + +nav.crumbs ul li { + display: inline; +} + +nav.crumbs a:visited { + color: #1565c0; +} + +/* -- footer ---------------------------------------------------------------- */ + +footer { + padding: 9px 0 9px 0; + text-align: center; + font-size: 75%; + color: #333; +} + +footer, div.articleComments { + border-top: #ccc solid 1px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebar { + position: fixed; + width: var(--sidebar-width); + left: 0; + top: 0; + bottom: 0; + overflow-y: auto; + float: unset; + margin-left: unset; /* override basic.css */ + padding-top: var(--topbar-height); + z-index: 390; + color: #333; + background-color: #f5f5f5; + overscroll-behavior: contain; +} + +#sidebar-checkbox:checked ~ div.document, +#sidebar-checkbox:checked ~ .relbar, +#sidebar-checkbox:checked ~ .articleComments, +#sidebar-checkbox:checked ~ footer { + margin-left: var(--sidebar-width); +} + +body:not(.sidebar-resizing) div.document, +body:not(.sidebar-resizing) .relbar, +body:not(.sidebar-resizing) .articleComments, +body:not(.sidebar-resizing) footer { + transition: margin-left 0.3s ease-out; +} + +body:not(.sidebar-resizing) .sphinxsidebar { + transition: left 0.3s ease-out; +} + +div.sphinxsidebarwrapper { + position: relative; /* reference for sidebar-resize-handle */ + box-sizing: border-box; + padding: 10px; + display: flex; + flex-direction: column; + min-height: 100%; +} + +div.sphinxsidebarwrapper > :first-child { + margin-top: 0; +} + +div.sphinxsidebarwrapper > :last-child { + margin-bottom: 0; +} + +.sidebar-resize-handle { + display: none; + position: absolute; + width: 0; + top: 0; + bottom: 0; +} + +body.js #sidebar-checkbox:checked ~ .sidebar-resize-handle, +body.js #sidebar-checkbox:checked ~ div.document .sidebar-resize-handle { + display: block; + cursor: col-resize; + width: 10px; +} + +.sphinxsidebar .sidebar-resize-handle { + right: 0; +} + +body.js #sidebar-checkbox:checked ~ .sidebar-resize-handle { + z-index: 390; + left: var(--sidebar-width); +} + +#sidebar-checkbox:not(:checked) ~ div.document .sphinxsidebar { + left: calc(0px - var(--sidebar-width)); +} + +div.sphinxsidebar h3 { + font-size: 1.4em; + font-weight: normal; + margin-top: 10px; + margin-bottom: 5px; +} + +div.sphinxsidebar h4 { + font-size: 1.3em; + font-weight: normal; + margin-top: 10px; + margin-bottom: 5px; +} + +div.sphinxsidebar p.caption { + text-transform: uppercase; + margin-top: 10px; + margin-bottom: 5px; +} + +div.sphinxsidebar p.caption + ul { + margin-top: 0; +} + +div.sphinxsidebar p.topless { + margin: 10px; +} + +div.sphinxsidebar p.topless { + margin-top: 0; +} + +div.sphinxsidebar ul { + padding-left: 0; + margin-left: 10px; +} + +div.sphinxsidebar h3 + ul, +div.sphinxsidebar h4 + ul { + margin-top: -5px; +} + +div.sphinxsidebar li { + padding-top: 0.4em; + padding-bottom: 0.4em; +} + +div.sphinxsidebar li li:first-child { + margin-top: 0.4em; +} + +div.sphinxsidebar li li:last-child { + margin-bottom: -0.4em; +} + +div.sphinxsidebar ul ul { + list-style: unset; +} + +.sphinxsidebar a { + color: #004188; +} + +div.sphinxsidebar a.in-view { + font-weight: 600; + letter-spacing: -0.013em; +} + +div.sphinxsidebar code { + background-color: unset; + padding: 0; +} + +div.sphinxsidebar h3, +div.sphinxsidebar h4, +div.sphinxsidebar p, +div.sphinxsidebar li { + margin-right: -10px; + padding-right: 10px; +} + +div.sphinxsidebar h3, +div.sphinxsidebar h4, +div.sphinxsidebar p, +div.sphinxsidebar li { + margin-left: -20px; + padding-left: 20px; +} + +div.sphinxsidebar li.toctree-l2 { + margin-left: -40px; + padding-left: 40px; +} + +div.sphinxsidebar li.toctree-l3 { + margin-left: -60px; + padding-left: 60px; +} + +div.sphinxsidebar li.toctree-l4 { + margin-left: -80px; + padding-left: 80px; +} + +div.sphinxsidebar li.toctree-l5 { + margin-left: -100px; + padding-left: 100px; +} + +div.sphinxsidebar li.toctree-l6 { + margin-left: -120px; + padding-left: 120px; +} + +div.sphinxsidebar li.toctree-l7 { + margin-left: -140px; + padding-left: 140px; +} + +div.sphinxsidebar li.toctree-l8 { + margin-left: -160px; + padding-left: 160px; +} + +div.sphinxsidebar li.toctree-l9 { + margin-left: -180px; + padding-left: 180px; +} + +div.sphinxsidebar li.toctree-l10 { + margin-left: -200px; + padding-left: 200px; +} + +body:not(.js) div.sphinxsidebar li.current, +div.sphinxsidebar .current-page:not(.logo) { + background-color: #fff; +} + +div.sphinxsidebar .current-page li:not(.current-page) { + background-color: #f5f5f5; +} + +div.sphinxsidebar .current-page { + transition: background-color 0.3s ease-out; +} + +div.sphinxsidebar input { + border-color: #ccc; + font-family: unset; +} + +/* -- topbar ---------------------------------------------------------------- */ + +#topbar-placeholder { + z-index: 500; + position: -webkit-sticky; + position: sticky; + top: 0; +} + +#topbar { + border-bottom: #ccc solid 1px; + background-color: #fff; +} + +#topbar, +#titlebar a, +#titlebar a:visited { + color: #888; +} + +.relbar, +.relbar > a:hover .direction { + color: #ccc; +} + +#topbar button:hover, +#titlebar .buttons > *:hover, +#titlebar a:hover, +.relbar a:hover, +.relbar a:hover .icon { + color: #333; +} + +#titlebar { + display: flex; + align-items: center; + flex-wrap: wrap; + min-height: 3rem; +} + +#titlebar .buttons { + display: flex; + align-items: baseline; + margin: 0 5px; +} + +#titlebar .buttons > *, +#topbar button { + margin: 0; + border: none; + padding: 8px; + color: inherit; + background: none; + font: inherit; + cursor: pointer; +} + +#titlebar .title button { + padding: 0; +} + +#titlebar svg, +.insipid-icon svg, +.relbar svg, +.related svg, +.crumbs svg { + width: 1em; + height: 1em; + vertical-align: middle; + fill: currentColor; +} + +#topbar a { + text-decoration: none; +} + +body.js.topbar-folded #topbar-placeholder:not(.fake-hover) #topbar { + transform: translateY(-100%); +} + +body.js #topbar { + transition: transform 0.3s ease-out; +} + +body:not(.js) #search-button { + display: none; +} + +#titlebar .title { + font-weight: 200; + font-size: 1.7rem; + text-align: center; + margin: 0; + flex: 1; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +#titlebar .top, +body.scrolled #titlebar .parent { + display: none; +} + +body.scrolled #titlebar .top { + display: inline-block; +} + +/* -- search field in topbar ------------------------------------------------ */ + +#topbar #searchbox form { + display: flex; + align-items: stretch; + margin: 5px; +} + +#topbar #searchbox input { + flex-grow: 1; + border: 1px solid #ccc; + padding: 7px; + color: #333; +} + +#topbar #searchbox p.highlight-link { + text-align: center; + margin: 8px; +} + +#searchbox p.highlight-link a { + padding: 0 4px; + background-color: #fbe54e; +} + + + +/* -- navigation icons ------------------------------------------------------ */ + +/* cover nav-icon */ +div.body, .relbar, footer, div.articleComments { + position: relative; + background-color: #fff; +} + +.nav-icon svg { + position: absolute; + top: 50%; + left: 50%; + margin: -1.25em; + width: 2.5em; + height: 2.5em; + fill: currentColor; +} + +.nav-icon { + position: fixed; + right: 0; + margin: -2em 1em; + width: 4em; + height: 4em; + color: #f5f5f5; +} + +.nav-icon:visited { + color: #f5f5f5; +} + +.nav-icon:hover { + color: #fff; + background-color: #f5f5f5; +} + +.nav-icon.previous { + bottom: 50vh; + left: 0; + right: unset; +} + +.nav-icon.next { + top: 50vh; +} +#sidebar-checkbox:checked ~ nav .nav-icon.previous { + left: var(--sidebar-width); +} + +body:not(.sidebar-resizing) .nav-icon.previous { + transition: left 0.3s ease-out; +} + +/* -- sphinx.ext.viewcode --------------------------------------------------- */ + +.viewcode-link { + font-size: 90%; + margin-left: 1em; +} + +div.viewcode-block:target { + margin: -0.5em; + padding: 0.5em; + background-color: #ffffcc; +} + +/* -- media queries --------------------------------------------------------- */ +@media only screen and (max-width: 39rem) { + #sidebar-checkbox:checked ~ div.document, + #sidebar-checkbox:checked ~ .relbar, + #sidebar-checkbox:checked ~ .articleComments, + #sidebar-checkbox:checked ~ footer { + margin-left: 0; + } + + #sidebar-checkbox:checked ~ #topbar-placeholder { + margin-left: 0; + } + + #overlay { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + visibility: hidden; + opacity: 0; + background-color: rgba(100%, 100%, 100%, 80%); + transition: opacity 0.3s ease-out, visibility 0s 0.3s ease-out; + z-index: 380; + } + + #sidebar-checkbox:checked ~ #overlay { + visibility: visible; + opacity: 1; + transition: opacity 0.3s ease-out; + } + + #sidebar-checkbox:checked ~ #topbar-placeholder #titlebar .parent { + display: unset; + } + + #sidebar-checkbox:checked ~ #topbar-placeholder #titlebar #titlebar .top { + display: none; + } +} + +body:not(.js) #fullscreen-button { + display: none; +} + +body.js #fullscreen-button .disable { + display: none; +} + +@media all and (display-mode: fullscreen) { + body.js #fullscreen-button .enable { + display: none; + } + + body.js #fullscreen-button .disable { + display: unset; + } +} + +/* -- fix Firefox buttons --------------------------------------------------- */ + +button::-moz-focus-inner { + border-style: none; + padding: 0; +} + +button:-moz-focusring { + outline: 1px dotted; +} \ No newline at end of file diff --git a/_static/insipid.js b/_static/insipid.js new file mode 100644 index 0000000000..0b71b94157 --- /dev/null +++ b/_static/insipid.js @@ -0,0 +1,149 @@ +(dom_loaded => { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', dom_loaded); + } else { + dom_loaded(); + } +})(() => { + 'use strict'; + + // make sure all scripts are re-executed when navigating to cached page + window.onunload = () => {}; + + const topbar = document.getElementById('topbar'); + const topbar_placeholder = document.getElementById('topbar-placeholder'); + + const threshold = 10; + + // auto-hide topbar + function scroll_callback(scroller) { + let ignore_scroll = true; + let initial; + let scroll_timeout; + return event => { + window.clearTimeout(scroll_timeout); + const current = scroller.scrollTop; + if (current <= topbar.offsetHeight || (scroller.scrollHeight - current - scroller.clientHeight) < (scroller.clientHeight / 3)) { + document.body.classList.remove('topbar-folded'); + ignore_scroll = true; + return; + } else if (ignore_scroll) { + // We ignore single jumps + ignore_scroll = false; + initial = current; + } else if (current - initial > threshold) { + document.body.classList.add('topbar-folded'); + ignore_scroll = true; + return; + } else if (current - initial < -threshold) { + document.body.classList.remove('topbar-folded'); + ignore_scroll = true; + return; + } + scroll_timeout = setTimeout(() => { ignore_scroll = true; }, 66); + }; + } + + document.addEventListener('scroll', scroll_callback(document.scrollingElement)); + + const sidebar_scroller = document.querySelector('.sphinxsidebar'); + if (sidebar_scroller) { + sidebar_scroller.addEventListener('scroll', scroll_callback(sidebar_scroller)); + } + + const div_body = document.querySelector('div.body'); + const first_section = document.querySelector('div.body .section, div.body section'); + if (first_section) { + document.addEventListener('scroll', event => { + if (window.pageYOffset >= div_body.offsetTop + first_section.offsetTop) { + document.body.classList.add('scrolled'); + } else { + document.body.classList.remove('scrolled'); + } + }); + document.dispatchEvent(new Event('scroll')); + } + + topbar.querySelector('.top').addEventListener('click', event => { + window.scroll({ top: 0, behavior: 'smooth' }); + event.preventDefault(); + }); + + const search_button = document.getElementById('search-button'); + if (search_button) { + const search_form = document.getElementById('search-form'); + const search_field = search_form.querySelector('input'); + + function show_search() { + try { + // https://readthedocs-sphinx-search.readthedocs.io/ + showSearchModal(); + return; + } catch(e) {} + search_form.style.display = 'flex'; + search_button.setAttribute('aria-expanded', 'true'); + search_field.focus(); + document.body.classList.remove('topbar-folded'); + } + + function hide_search() { + search_form.style.display = 'none'; + search_button.setAttribute('aria-expanded', 'false'); + search_button.blur(); + } + + function toggle_search() { + if (window.getComputedStyle(search_form).display === 'none') { + show_search(); + } else { + hide_search(); + } + } + + search_button.addEventListener('click', toggle_search); + if (Documentation.focusSearchBar) { + // Monkey-patch function provided by Sphinx: + Documentation.focusSearchBar = show_search; + } + + search_field.addEventListener('keydown', event => { + if (event.code === 'Escape') { + hide_search(); + search_field.blur(); + } + }); + } + + const fullscreen_button = document.getElementById('fullscreen-button'); + if (document.fullscreenEnabled) { + fullscreen_button.addEventListener('click', event => { + if (!document.fullscreenElement) { + document.documentElement.requestFullscreen(); + } else { + document.exitFullscreen(); + } + fullscreen_button.blur(); + topbar_placeholder.classList.remove('fake-hover'); + }); + } else { + fullscreen_button.remove(); + } + + topbar_placeholder.addEventListener('mouseenter', event => { + topbar_placeholder.classList.add('fake-hover'); + }); + + topbar_placeholder.addEventListener('mouseleave', event => { + topbar_placeholder.classList.remove('fake-hover'); + }); + + document.addEventListener('touchend', event => { + if (event.touches.length > 1) { return; } + const touch = event.touches[0]; + if (touch.clientY < topbar.offsetHeight) { + topbar_placeholder.classList.add('fake-hover'); + } else { + topbar_placeholder.classList.remove('fake-hover'); + } + }); +}); diff --git a/_static/language_data.js b/_static/language_data.js new file mode 100644 index 0000000000..367b8ed81b --- /dev/null +++ b/_static/language_data.js @@ -0,0 +1,199 @@ +/* + * language_data.js + * ~~~~~~~~~~~~~~~~ + * + * This script contains the language-specific data used by searchtools.js, + * namely the list of stopwords, stemmer, scorer and splitter. + * + * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"]; + + +/* Non-minified version is copied as a separate JS file, if available */ + +/** + * Porter Stemmer + */ +var Stemmer = function() { + + var step2list = { + ational: 'ate', + tional: 'tion', + enci: 'ence', + anci: 'ance', + izer: 'ize', + bli: 'ble', + alli: 'al', + entli: 'ent', + eli: 'e', + ousli: 'ous', + ization: 'ize', + ation: 'ate', + ator: 'ate', + alism: 'al', + iveness: 'ive', + fulness: 'ful', + ousness: 'ous', + aliti: 'al', + iviti: 'ive', + biliti: 'ble', + logi: 'log' + }; + + var step3list = { + icate: 'ic', + ative: '', + alize: 'al', + iciti: 'ic', + ical: 'ic', + ful: '', + ness: '' + }; + + var c = "[^aeiou]"; // consonant + var v = "[aeiouy]"; // vowel + var C = c + "[^aeiouy]*"; // consonant sequence + var V = v + "[aeiou]*"; // vowel sequence + + var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 + var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 + var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 + var s_v = "^(" + C + ")?" + v; // vowel in stem + + this.stemWord = function (w) { + var stem; + var suffix; + var firstch; + var origword = w; + + if (w.length < 3) + return w; + + var re; + var re2; + var re3; + var re4; + + firstch = w.substr(0,1); + if (firstch == "y") + w = firstch.toUpperCase() + w.substr(1); + + // Step 1a + re = /^(.+?)(ss|i)es$/; + re2 = /^(.+?)([^s])s$/; + + if (re.test(w)) + w = w.replace(re,"$1$2"); + else if (re2.test(w)) + w = w.replace(re2,"$1$2"); + + // Step 1b + re = /^(.+?)eed$/; + re2 = /^(.+?)(ed|ing)$/; + if (re.test(w)) { + var fp = re.exec(w); + re = new RegExp(mgr0); + if (re.test(fp[1])) { + re = /.$/; + w = w.replace(re,""); + } + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1]; + re2 = new RegExp(s_v); + if (re2.test(stem)) { + w = stem; + re2 = /(at|bl|iz)$/; + re3 = new RegExp("([^aeiouylsz])\\1$"); + re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re2.test(w)) + w = w + "e"; + else if (re3.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + else if (re4.test(w)) + w = w + "e"; + } + } + + // Step 1c + re = /^(.+?)y$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(s_v); + if (re.test(stem)) + w = stem + "i"; + } + + // Step 2 + re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step2list[suffix]; + } + + // Step 3 + re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + suffix = fp[2]; + re = new RegExp(mgr0); + if (re.test(stem)) + w = stem + step3list[suffix]; + } + + // Step 4 + re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; + re2 = /^(.+?)(s|t)(ion)$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + if (re.test(stem)) + w = stem; + } + else if (re2.test(w)) { + var fp = re2.exec(w); + stem = fp[1] + fp[2]; + re2 = new RegExp(mgr1); + if (re2.test(stem)) + w = stem; + } + + // Step 5 + re = /^(.+?)e$/; + if (re.test(w)) { + var fp = re.exec(w); + stem = fp[1]; + re = new RegExp(mgr1); + re2 = new RegExp(meq1); + re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); + if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) + w = stem; + } + re = /ll$/; + re2 = new RegExp(mgr1); + if (re.test(w) && re2.test(w)) { + re = /.$/; + w = w.replace(re,""); + } + + // and turn initial Y back to y + if (firstch == "y") + w = firstch.toLowerCase() + w.substr(1); + return w; + } +} + diff --git a/_static/minus.png b/_static/minus.png new file mode 100644 index 0000000000..d96755fdaf Binary files /dev/null and b/_static/minus.png differ diff --git a/_static/plus.png b/_static/plus.png new file mode 100644 index 0000000000..7107cec93a Binary files /dev/null and b/_static/plus.png differ diff --git a/_static/pygments.css b/_static/pygments.css new file mode 100644 index 0000000000..8054382b53 --- /dev/null +++ b/_static/pygments.css @@ -0,0 +1,75 @@ +pre { line-height: 125%; } +td.linenos .normal { color: #666666; background-color: transparent; padding-left: 5px; padding-right: 5px; } +span.linenos { color: #666666; background-color: transparent; padding-left: 5px; padding-right: 5px; } +td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } +.highlight .hll { background-color: #ffffcc } +.highlight { background: #f0f0f0; } +.highlight .c { color: #60a0b0; font-style: italic } /* Comment */ +.highlight .err { border: 1px solid #FF0000 } /* Error */ +.highlight .k { color: #007020; font-weight: bold } /* Keyword */ +.highlight .o { color: #666666 } /* Operator */ +.highlight .ch { color: #60a0b0; font-style: italic } /* Comment.Hashbang */ +.highlight .cm { color: #60a0b0; font-style: italic } /* Comment.Multiline */ +.highlight .cp { color: #007020 } /* Comment.Preproc */ +.highlight .cpf { color: #60a0b0; font-style: italic } /* Comment.PreprocFile */ +.highlight .c1 { color: #60a0b0; font-style: italic } /* Comment.Single */ +.highlight .cs { color: #60a0b0; background-color: #fff0f0 } /* Comment.Special */ +.highlight .gd { color: #A00000 } /* Generic.Deleted */ +.highlight .ge { font-style: italic } /* Generic.Emph */ +.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ +.highlight .gr { color: #FF0000 } /* Generic.Error */ +.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.highlight .gi { color: #00A000 } /* Generic.Inserted */ +.highlight .go { color: #888888 } /* Generic.Output */ +.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ +.highlight .gs { font-weight: bold } /* Generic.Strong */ +.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.highlight .gt { color: #0044DD } /* Generic.Traceback */ +.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ +.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ +.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ +.highlight .kp { color: #007020 } /* Keyword.Pseudo */ +.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ +.highlight .kt { color: #902000 } /* Keyword.Type */ +.highlight .m { color: #40a070 } /* Literal.Number */ +.highlight .s { color: #4070a0 } /* Literal.String */ +.highlight .na { color: #4070a0 } /* Name.Attribute */ +.highlight .nb { color: #007020 } /* Name.Builtin */ +.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ +.highlight .no { color: #60add5 } /* Name.Constant */ +.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ +.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ +.highlight .ne { color: #007020 } /* Name.Exception */ +.highlight .nf { color: #06287e } /* Name.Function */ +.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ +.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ +.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ +.highlight .nv { color: #bb60d5 } /* Name.Variable */ +.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ +.highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.highlight .mb { color: #40a070 } /* Literal.Number.Bin */ +.highlight .mf { color: #40a070 } /* Literal.Number.Float */ +.highlight .mh { color: #40a070 } /* Literal.Number.Hex */ +.highlight .mi { color: #40a070 } /* Literal.Number.Integer */ +.highlight .mo { color: #40a070 } /* Literal.Number.Oct */ +.highlight .sa { color: #4070a0 } /* Literal.String.Affix */ +.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ +.highlight .sc { color: #4070a0 } /* Literal.String.Char */ +.highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */ +.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ +.highlight .s2 { color: #4070a0 } /* Literal.String.Double */ +.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ +.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ +.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ +.highlight .sx { color: #c65d09 } /* Literal.String.Other */ +.highlight .sr { color: #235388 } /* Literal.String.Regex */ +.highlight .s1 { color: #4070a0 } /* Literal.String.Single */ +.highlight .ss { color: #517918 } /* Literal.String.Symbol */ +.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #06287e } /* Name.Function.Magic */ +.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ +.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ +.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ +.highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */ +.highlight .il { color: #40a070 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/_static/searchtools.js b/_static/searchtools.js new file mode 100644 index 0000000000..b08d58c9b9 --- /dev/null +++ b/_static/searchtools.js @@ -0,0 +1,620 @@ +/* + * searchtools.js + * ~~~~~~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for the full-text search. + * + * :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ +"use strict"; + +/** + * Simple result scoring code. + */ +if (typeof Scorer === "undefined") { + var Scorer = { + // Implement the following function to further tweak the score for each result + // The function takes a result array [docname, title, anchor, descr, score, filename] + // and returns the new score. + /* + score: result => { + const [docname, title, anchor, descr, score, filename] = result + return score + }, + */ + + // query matches the full name of an object + objNameMatch: 11, + // or matches in the last dotted part of the object name + objPartialMatch: 6, + // Additive scores depending on the priority of the object + objPrio: { + 0: 15, // used to be importantResults + 1: 5, // used to be objectResults + 2: -5, // used to be unimportantResults + }, + // Used when the priority is not in the mapping. + objPrioDefault: 0, + + // query found in title + title: 15, + partialTitle: 7, + // query found in terms + term: 5, + partialTerm: 2, + }; +} + +const _removeChildren = (element) => { + while (element && element.lastChild) element.removeChild(element.lastChild); +}; + +/** + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping + */ +const _escapeRegExp = (string) => + string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string + +const _displayItem = (item, searchTerms, highlightTerms) => { + const docBuilder = DOCUMENTATION_OPTIONS.BUILDER; + const docFileSuffix = DOCUMENTATION_OPTIONS.FILE_SUFFIX; + const docLinkSuffix = DOCUMENTATION_OPTIONS.LINK_SUFFIX; + const showSearchSummary = DOCUMENTATION_OPTIONS.SHOW_SEARCH_SUMMARY; + const contentRoot = document.documentElement.dataset.content_root; + + const [docName, title, anchor, descr, score, _filename] = item; + + let listItem = document.createElement("li"); + let requestUrl; + let linkUrl; + if (docBuilder === "dirhtml") { + // dirhtml builder + let dirname = docName + "/"; + if (dirname.match(/\/index\/$/)) + dirname = dirname.substring(0, dirname.length - 6); + else if (dirname === "index/") dirname = ""; + requestUrl = contentRoot + dirname; + linkUrl = requestUrl; + } else { + // normal html builders + requestUrl = contentRoot + docName + docFileSuffix; + linkUrl = docName + docLinkSuffix; + } + let linkEl = listItem.appendChild(document.createElement("a")); + linkEl.href = linkUrl + anchor; + linkEl.dataset.score = score; + linkEl.innerHTML = title; + if (descr) { + listItem.appendChild(document.createElement("span")).innerHTML = + " (" + descr + ")"; + // highlight search terms in the description + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + } + else if (showSearchSummary) + fetch(requestUrl) + .then((responseData) => responseData.text()) + .then((data) => { + if (data) + listItem.appendChild( + Search.makeSearchSummary(data, searchTerms, anchor) + ); + // highlight search terms in the summary + if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js + highlightTerms.forEach((term) => _highlightText(listItem, term, "highlighted")); + }); + Search.output.appendChild(listItem); +}; +const _finishSearch = (resultCount) => { + Search.stopPulse(); + Search.title.innerText = _("Search Results"); + if (!resultCount) + Search.status.innerText = Documentation.gettext( + "Your search did not match any documents. Please make sure that all words are spelled correctly and that you've selected enough categories." + ); + else + Search.status.innerText = _( + "Search finished, found ${resultCount} page(s) matching the search query." + ).replace('${resultCount}', resultCount); +}; +const _displayNextItem = ( + results, + resultCount, + searchTerms, + highlightTerms, +) => { + // results left, load the summary and display it + // this is intended to be dynamic (don't sub resultsCount) + if (results.length) { + _displayItem(results.pop(), searchTerms, highlightTerms); + setTimeout( + () => _displayNextItem(results, resultCount, searchTerms, highlightTerms), + 5 + ); + } + // search finished, update title and status message + else _finishSearch(resultCount); +}; +// Helper function used by query() to order search results. +// Each input is an array of [docname, title, anchor, descr, score, filename]. +// Order the results by score (in opposite order of appearance, since the +// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically. +const _orderResultsByScoreThenName = (a, b) => { + const leftScore = a[4]; + const rightScore = b[4]; + if (leftScore === rightScore) { + // same score: sort alphabetically + const leftTitle = a[1].toLowerCase(); + const rightTitle = b[1].toLowerCase(); + if (leftTitle === rightTitle) return 0; + return leftTitle > rightTitle ? -1 : 1; // inverted is intentional + } + return leftScore > rightScore ? 1 : -1; +}; + +/** + * Default splitQuery function. Can be overridden in ``sphinx.search`` with a + * custom function per language. + * + * The regular expression works by splitting the string on consecutive characters + * that are not Unicode letters, numbers, underscores, or emoji characters. + * This is the same as ``\W+`` in Python, preserving the surrogate pair area. + */ +if (typeof splitQuery === "undefined") { + var splitQuery = (query) => query + .split(/[^\p{Letter}\p{Number}_\p{Emoji_Presentation}]+/gu) + .filter(term => term) // remove remaining empty strings +} + +/** + * Search Module + */ +const Search = { + _index: null, + _queued_query: null, + _pulse_status: -1, + + htmlToText: (htmlString, anchor) => { + const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html'); + for (const removalQuery of [".headerlink", "script", "style"]) { + htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() }); + } + if (anchor) { + const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`); + if (anchorContent) return anchorContent.textContent; + + console.warn( + `Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.` + ); + } + + // if anchor not specified or not found, fall back to main content + const docContent = htmlElement.querySelector('[role="main"]'); + if (docContent) return docContent.textContent; + + console.warn( + "Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template." + ); + return ""; + }, + + init: () => { + const query = new URLSearchParams(window.location.search).get("q"); + document + .querySelectorAll('input[name="q"]') + .forEach((el) => (el.value = query)); + if (query) Search.performSearch(query); + }, + + loadIndex: (url) => + (document.body.appendChild(document.createElement("script")).src = url), + + setIndex: (index) => { + Search._index = index; + if (Search._queued_query !== null) { + const query = Search._queued_query; + Search._queued_query = null; + Search.query(query); + } + }, + + hasIndex: () => Search._index !== null, + + deferQuery: (query) => (Search._queued_query = query), + + stopPulse: () => (Search._pulse_status = -1), + + startPulse: () => { + if (Search._pulse_status >= 0) return; + + const pulse = () => { + Search._pulse_status = (Search._pulse_status + 1) % 4; + Search.dots.innerText = ".".repeat(Search._pulse_status); + if (Search._pulse_status >= 0) window.setTimeout(pulse, 500); + }; + pulse(); + }, + + /** + * perform a search for something (or wait until index is loaded) + */ + performSearch: (query) => { + // create the required interface elements + const searchText = document.createElement("h2"); + searchText.textContent = _("Searching"); + const searchSummary = document.createElement("p"); + searchSummary.classList.add("search-summary"); + searchSummary.innerText = ""; + const searchList = document.createElement("ul"); + searchList.classList.add("search"); + + const out = document.getElementById("search-results"); + Search.title = out.appendChild(searchText); + Search.dots = Search.title.appendChild(document.createElement("span")); + Search.status = out.appendChild(searchSummary); + Search.output = out.appendChild(searchList); + + const searchProgress = document.getElementById("search-progress"); + // Some themes don't use the search progress node + if (searchProgress) { + searchProgress.innerText = _("Preparing search..."); + } + Search.startPulse(); + + // index already loaded, the browser was quick! + if (Search.hasIndex()) Search.query(query); + else Search.deferQuery(query); + }, + + _parseQuery: (query) => { + // stem the search terms and add them to the correct list + const stemmer = new Stemmer(); + const searchTerms = new Set(); + const excludedTerms = new Set(); + const highlightTerms = new Set(); + const objectTerms = new Set(splitQuery(query.toLowerCase().trim())); + splitQuery(query.trim()).forEach((queryTerm) => { + const queryTermLower = queryTerm.toLowerCase(); + + // maybe skip this "word" + // stopwords array is from language_data.js + if ( + stopwords.indexOf(queryTermLower) !== -1 || + queryTerm.match(/^\d+$/) + ) + return; + + // stem the word + let word = stemmer.stemWord(queryTermLower); + // select the correct list + if (word[0] === "-") excludedTerms.add(word.substr(1)); + else { + searchTerms.add(word); + highlightTerms.add(queryTermLower); + } + }); + + if (SPHINX_HIGHLIGHT_ENABLED) { // set in sphinx_highlight.js + localStorage.setItem("sphinx_highlight_terms", [...highlightTerms].join(" ")) + } + + // console.debug("SEARCH: searching for:"); + // console.info("required: ", [...searchTerms]); + // console.info("excluded: ", [...excludedTerms]); + + return [query, searchTerms, excludedTerms, highlightTerms, objectTerms]; + }, + + /** + * execute search (requires search index to be loaded) + */ + _performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + const allTitles = Search._index.alltitles; + const indexEntries = Search._index.indexentries; + + // Collect multiple result groups to be sorted separately and then ordered. + // Each is an array of [docname, title, anchor, descr, score, filename]. + const normalResults = []; + const nonMainIndexResults = []; + + _removeChildren(document.getElementById("search-progress")); + + const queryLower = query.toLowerCase().trim(); + for (const [title, foundTitles] of Object.entries(allTitles)) { + if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) { + for (const [file, id] of foundTitles) { + const score = Math.round(Scorer.title * queryLower.length / title.length); + const boost = titles[file] === title ? 1 : 0; // add a boost for document titles + normalResults.push([ + docNames[file], + titles[file] !== title ? `${titles[file]} > ${title}` : title, + id !== null ? "#" + id : "", + null, + score + boost, + filenames[file], + ]); + } + } + } + + // search for explicit entries in index directives + for (const [entry, foundEntries] of Object.entries(indexEntries)) { + if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) { + for (const [file, id, isMain] of foundEntries) { + const score = Math.round(100 * queryLower.length / entry.length); + const result = [ + docNames[file], + titles[file], + id ? "#" + id : "", + null, + score, + filenames[file], + ]; + if (isMain) { + normalResults.push(result); + } else { + nonMainIndexResults.push(result); + } + } + } + } + + // lookup as object + objectTerms.forEach((term) => + normalResults.push(...Search.performObjectSearch(term, objectTerms)) + ); + + // lookup as search terms in fulltext + normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms)); + + // let the scorer override scores with a custom scoring function + if (Scorer.score) { + normalResults.forEach((item) => (item[4] = Scorer.score(item))); + nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item))); + } + + // Sort each group of results by score and then alphabetically by name. + normalResults.sort(_orderResultsByScoreThenName); + nonMainIndexResults.sort(_orderResultsByScoreThenName); + + // Combine the result groups in (reverse) order. + // Non-main index entries are typically arbitrary cross-references, + // so display them after other results. + let results = [...nonMainIndexResults, ...normalResults]; + + // remove duplicate search results + // note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept + let seen = new Set(); + results = results.reverse().reduce((acc, result) => { + let resultStr = result.slice(0, 4).concat([result[5]]).map(v => String(v)).join(','); + if (!seen.has(resultStr)) { + acc.push(result); + seen.add(resultStr); + } + return acc; + }, []); + + return results.reverse(); + }, + + query: (query) => { + const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query); + const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms); + + // for debugging + //Search.lastresults = results.slice(); // a copy + // console.info("search results:", Search.lastresults); + + // print the results + _displayNextItem(results, results.length, searchTerms, highlightTerms); + }, + + /** + * search for object names + */ + performObjectSearch: (object, objectTerms) => { + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const objects = Search._index.objects; + const objNames = Search._index.objnames; + const titles = Search._index.titles; + + const results = []; + + const objectSearchCallback = (prefix, match) => { + const name = match[4] + const fullname = (prefix ? prefix + "." : "") + name; + const fullnameLower = fullname.toLowerCase(); + if (fullnameLower.indexOf(object) < 0) return; + + let score = 0; + const parts = fullnameLower.split("."); + + // check for different match types: exact matches of full name or + // "last name" (i.e. last dotted part) + if (fullnameLower === object || parts.slice(-1)[0] === object) + score += Scorer.objNameMatch; + else if (parts.slice(-1)[0].indexOf(object) > -1) + score += Scorer.objPartialMatch; // matches in last name + + const objName = objNames[match[1]][2]; + const title = titles[match[0]]; + + // If more than one term searched for, we require other words to be + // found in the name/title/description + const otherTerms = new Set(objectTerms); + otherTerms.delete(object); + if (otherTerms.size > 0) { + const haystack = `${prefix} ${name} ${objName} ${title}`.toLowerCase(); + if ( + [...otherTerms].some((otherTerm) => haystack.indexOf(otherTerm) < 0) + ) + return; + } + + let anchor = match[3]; + if (anchor === "") anchor = fullname; + else if (anchor === "-") anchor = objNames[match[1]][1] + "-" + fullname; + + const descr = objName + _(", in ") + title; + + // add custom score for some objects according to scorer + if (Scorer.objPrio.hasOwnProperty(match[2])) + score += Scorer.objPrio[match[2]]; + else score += Scorer.objPrioDefault; + + results.push([ + docNames[match[0]], + fullname, + "#" + anchor, + descr, + score, + filenames[match[0]], + ]); + }; + Object.keys(objects).forEach((prefix) => + objects[prefix].forEach((array) => + objectSearchCallback(prefix, array) + ) + ); + return results; + }, + + /** + * search for full-text terms in the index + */ + performTermsSearch: (searchTerms, excludedTerms) => { + // prepare search + const terms = Search._index.terms; + const titleTerms = Search._index.titleterms; + const filenames = Search._index.filenames; + const docNames = Search._index.docnames; + const titles = Search._index.titles; + + const scoreMap = new Map(); + const fileMap = new Map(); + + // perform the search on the required terms + searchTerms.forEach((word) => { + const files = []; + const arr = [ + { files: terms[word], score: Scorer.term }, + { files: titleTerms[word], score: Scorer.title }, + ]; + // add support for partial matches + if (word.length > 2) { + const escapedWord = _escapeRegExp(word); + if (!terms.hasOwnProperty(word)) { + Object.keys(terms).forEach((term) => { + if (term.match(escapedWord)) + arr.push({ files: terms[term], score: Scorer.partialTerm }); + }); + } + if (!titleTerms.hasOwnProperty(word)) { + Object.keys(titleTerms).forEach((term) => { + if (term.match(escapedWord)) + arr.push({ files: titleTerms[term], score: Scorer.partialTitle }); + }); + } + } + + // no match but word was a required one + if (arr.every((record) => record.files === undefined)) return; + + // found search word in contents + arr.forEach((record) => { + if (record.files === undefined) return; + + let recordFiles = record.files; + if (recordFiles.length === undefined) recordFiles = [recordFiles]; + files.push(...recordFiles); + + // set score for the word in each file + recordFiles.forEach((file) => { + if (!scoreMap.has(file)) scoreMap.set(file, {}); + scoreMap.get(file)[word] = record.score; + }); + }); + + // create the mapping + files.forEach((file) => { + if (!fileMap.has(file)) fileMap.set(file, [word]); + else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word); + }); + }); + + // now check if the files don't contain excluded terms + const results = []; + for (const [file, wordList] of fileMap) { + // check if all requirements are matched + + // as search terms with length < 3 are discarded + const filteredTermCount = [...searchTerms].filter( + (term) => term.length > 2 + ).length; + if ( + wordList.length !== searchTerms.size && + wordList.length !== filteredTermCount + ) + continue; + + // ensure that none of the excluded terms is in the search result + if ( + [...excludedTerms].some( + (term) => + terms[term] === file || + titleTerms[term] === file || + (terms[term] || []).includes(file) || + (titleTerms[term] || []).includes(file) + ) + ) + break; + + // select one (max) score for the file. + const score = Math.max(...wordList.map((w) => scoreMap.get(file)[w])); + // add result to the result list + results.push([ + docNames[file], + titles[file], + "", + null, + score, + filenames[file], + ]); + } + return results; + }, + + /** + * helper function to return a node containing the + * search summary for a given text. keywords is a list + * of stemmed words. + */ + makeSearchSummary: (htmlText, keywords, anchor) => { + const text = Search.htmlToText(htmlText, anchor); + if (text === "") return null; + + const textLower = text.toLowerCase(); + const actualStartPosition = [...keywords] + .map((k) => textLower.indexOf(k.toLowerCase())) + .filter((i) => i > -1) + .slice(-1)[0]; + const startWithContext = Math.max(actualStartPosition - 120, 0); + + const top = startWithContext === 0 ? "" : "..."; + const tail = startWithContext + 240 < text.length ? "..." : ""; + + let summary = document.createElement("p"); + summary.classList.add("context"); + summary.textContent = top + text.substr(startWithContext, 240).trim() + tail; + + return summary; + }, +}; + +_ready(Search.init); diff --git a/_static/sphinx_highlight.js b/_static/sphinx_highlight.js new file mode 100644 index 0000000000..8a96c69a19 --- /dev/null +++ b/_static/sphinx_highlight.js @@ -0,0 +1,154 @@ +/* Highlighting utilities for Sphinx HTML documentation. */ +"use strict"; + +const SPHINX_HIGHLIGHT_ENABLED = true + +/** + * highlight a given string on a node by wrapping it in + * span elements with the given class name. + */ +const _highlight = (node, addItems, text, className) => { + if (node.nodeType === Node.TEXT_NODE) { + const val = node.nodeValue; + const parent = node.parentNode; + const pos = val.toLowerCase().indexOf(text); + if ( + pos >= 0 && + !parent.classList.contains(className) && + !parent.classList.contains("nohighlight") + ) { + let span; + + const closestNode = parent.closest("body, svg, foreignObject"); + const isInSVG = closestNode && closestNode.matches("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.classList.add(className); + } + + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + const rest = document.createTextNode(val.substr(pos + text.length)); + parent.insertBefore( + span, + parent.insertBefore( + rest, + node.nextSibling + ) + ); + node.nodeValue = val.substr(0, pos); + /* There may be more occurrences of search term in this node. So call this + * function recursively on the remaining fragment. + */ + _highlight(rest, addItems, text, className); + + if (isInSVG) { + const rect = document.createElementNS( + "http://www.w3.org/2000/svg", + "rect" + ); + const bbox = parent.getBBox(); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute("class", className); + addItems.push({ parent: parent, target: rect }); + } + } + } else if (node.matches && !node.matches("button, select, textarea")) { + node.childNodes.forEach((el) => _highlight(el, addItems, text, className)); + } +}; +const _highlightText = (thisNode, text, className) => { + let addItems = []; + _highlight(thisNode, addItems, text, className); + addItems.forEach((obj) => + obj.parent.insertAdjacentElement("beforebegin", obj.target) + ); +}; + +/** + * Small JavaScript module for the documentation. + */ +const SphinxHighlight = { + + /** + * highlight the search words provided in localstorage in the text + */ + highlightSearchWords: () => { + if (!SPHINX_HIGHLIGHT_ENABLED) return; // bail if no highlight + + // get and clear terms from localstorage + const url = new URL(window.location); + const highlight = + localStorage.getItem("sphinx_highlight_terms") + || url.searchParams.get("highlight") + || ""; + localStorage.removeItem("sphinx_highlight_terms") + url.searchParams.delete("highlight"); + window.history.replaceState({}, "", url); + + // get individual terms from highlight string + const terms = highlight.toLowerCase().split(/\s+/).filter(x => x); + if (terms.length === 0) return; // nothing to do + + // There should never be more than one element matching "div.body" + const divBody = document.querySelectorAll("div.body"); + const body = divBody.length ? divBody[0] : document.querySelector("body"); + window.setTimeout(() => { + terms.forEach((term) => _highlightText(body, term, "highlighted")); + }, 10); + + const searchBox = document.getElementById("searchbox"); + if (searchBox === null) return; + searchBox.appendChild( + document + .createRange() + .createContextualFragment( + '<p class="highlight-link">' + + '<a href="javascript:SphinxHighlight.hideSearchWords()">' + + _("Hide Search Matches") + + "</a></p>" + ) + ); + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords: () => { + document + .querySelectorAll("#searchbox .highlight-link") + .forEach((el) => el.remove()); + document + .querySelectorAll("span.highlighted") + .forEach((el) => el.classList.remove("highlighted")); + localStorage.removeItem("sphinx_highlight_terms") + }, + + initEscapeListener: () => { + // only install a listener if it is really needed + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; + if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { + SphinxHighlight.hideSearchWords(); + event.preventDefault(); + } + }); + }, +}; + +_ready(() => { + /* Do not call highlightSearchWords() when we are on the search page. + * It will highlight words from the *previous* search query. + */ + if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords(); + SphinxHighlight.initEscapeListener(); +}); diff --git a/authentication.html b/authentication.html new file mode 100644 index 0000000000..9e81a21a3e --- /dev/null +++ b/authentication.html @@ -0,0 +1,217 @@ +<!DOCTYPE html> + +<html lang="en" data-content_root="./"> + <head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" /> + + <title>Authentication — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Authentication§

+
+ sequenceDiagram + participant MO as MITx Online + participant OE as Open edX + + par Create Account in Open edx + MO->>OE: POST /user_api/v1/account/registration/ + OE-->>MO: Success + end + + par Create Open edX Access Token + Note right of MO: Create in-memory requests session + par Establish an Open edX session + MO->>OE: GET /auth/login/mitxpro-oauth2/?auth_entry=login + OE->>MO: Redirect to GET /oauth2/authorize + MO->>OE: Redirect to GET /auth/complete/mitxpro-oauth2/ + end + + par Link MITx Online account to Open edX Account + MO->>OE: GET /oauth2/authorize + OE-->>MO: Redirect to GET /login/_private/complete + MO->>OE: POST /oauth2/access_token + OE-->>MO: OAuth access and refresh tokens + end + + end + +
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/commands/check_program_requirements.html b/commands/check_program_requirements.html new file mode 100644 index 0000000000..ffe32c32d4 --- /dev/null +++ b/commands/check_program_requirements.html @@ -0,0 +1,217 @@ + + + + + + + + check_program_requirements — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

check_program_requirements§

+

Checks programs for a valid requirements tree. A program has a valid requirements tree if it:

+
    +
  1. Exists

  2. +
  3. Has nodes for all courses assigned to the program

  4. +
+

If the tree does not fit this criteria, an error message is printed to the screen. (This uses the check_program_for_orphans API call, but it suppresses its error logging so it won’t clog up the error log.)

+

By default, this will check all programs in the system. Specify individual programs to check with --program (multiple times if needed) or check only live programs with --live. Note that if you specify both of these together they will be combined: if you specify a check for a specific program that isn’t live and then also specify --live, it won’t return anything for that program.

+
+

Syntax§

+

check_program_requirements [--program <readable or numeric id>] [--live]

+
+
+

Options§

+
    +
  • --program <readable or numeric id> - Check this specific program. Can be either the readable ID of the program (e.g. program-v1:MITx+DEDP) or the numeric ID, and can be specified multiple times to check multiple programs.

  • +
  • --live - Check only live programs.

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/commands/configure_instance.html b/commands/configure_instance.html new file mode 100644 index 0000000000..88aac4e9b3 --- /dev/null +++ b/commands/configure_instance.html @@ -0,0 +1,218 @@ + + + + + + + + configure_instance — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

configure_instance§

+

Configures a fresh MITx Online instance. For more information, see MITx Online Quick Start and Local Open edX Tutor and MITx Online Deployment.

+

For Tutor deployments, this will use local.edly.io for URLs for the edX platform. If you’re running a dev deployment, or are using Tutor Nightly, --tutor-dev will additionally add the proper ports (as Caddy is disabled in these cases). In either case, the two demo courses will still be created but only the Demonstration Course (course-v1:edX+DemoX+Demo_Course) will exist in edX, and then only if you import the demo course using the relevant Tutor command.

+
+

Syntax§

+

configure_instance <platform> [--dont-enroll|-D] [--dont-create-superuser|-S] [--edx-oauth-client <client id>] [--edx-oauth-secret <client secret>] [--gateway <ip>] [--tutor|-T] [--tutor-dev]

+
+
+

Options§

+
    +
  • <platform> - One of macos, linux, or none. Specifying none will additionaly stop creation of the OAuth2 application record for edX. Defaults to none.

  • +
  • --dont-enroll|-D - Don’t enroll the test learner account in any courses. (Defaults to enrolling the account in course-v1:edX+DemoX+Demo_Course.)

  • +
  • --dont-create-superuser|-S - Don’t create a superuser account.

  • +
  • --gateway <ip> - The Docker gateway IP. Required on Linux. See Configure Open edX for more info.

  • +
  • --edx-oauth-client <client id> - Use the specified client ID for the edX OAuth2 client. (Useful if you’re redoing your MITx Online instance and you’ve already created the corresponding record in edX, since you’re not allowed to edit it there.)

  • +
  • --edx-oauth-secret <client secret> - Use the specified client secret for the edX OAuth2 client. (Useful if you’re redoing your MITx Online instance and you’ve already created the corresponding record in edX, since you’re not allowed to edit it there.)

  • +
  • --tutor|-T - Configure the instance for use with a Tutor edX deployment.

  • +
  • --tutor-dev - Configure the instnace for use with Tutor dev or nightly.

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/commands/configure_tiers.html b/commands/configure_tiers.html new file mode 100644 index 0000000000..cc26b48889 --- /dev/null +++ b/commands/configure_tiers.html @@ -0,0 +1,313 @@ + + + + + + + + configure_tiers — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

configure_tiers§

+

Creates financial assistance tiers and discounts for a course or program.

+

This operates in two modes: creating tiers for a program and creating tiers for a course.

+

In the tables below, <year> represents the current year.

+

Configuring tiers for a course

+

The command will use the readable ID of the course as part of the financial aid discounts. They will default to this:

+ + + + + + + + + + + + + + + + + + + + + + + + + +

Code

Type

Amount

<course id>-fa-tier1-<year>

percent-off

.75

<course id>-fa-tier2-<year>

percent-off

.50

<course id>-fa-tier3-<year>

percent-off

.25

<course id>-fa-tier4-<year>

percent-off

0

+

Note that configuring course tiers requires the course to exist. Use create_courseware (or any of the other methods) to create the course before you run this command.

+

Configuring tiers for a program

+

The default discounts will be:

+ + + + + + + + + + + + + + + + + + + + + + + + + +

Code

Type

Amount

DEDP-fa-tier1-<year>

dollars-off

750

DEDP-fa-tier2-<year>

dollars-off

650

DEDP-fa-tier3-<year>

dollars-off

500

DEDP-fa-tier4-<year>

percent-off

0

+

Specify changes using --program and/or --program-abbrev.

+

Tiers

+

The actual tiers that will be created are:

+ + + + + + + + + + + + + + + + + + + + +

Threshold

Discount

$0

<abbrev>-fa-tier1-<year>

$25,000

<abbrev>-fa-tier2-<year>

$50,000

<abbrev>-fa-tier3-<year>

$75,000

<abbrev>-fa-tier4-<year>

+

These can be overridden by providing a CSV file. The CSV file should have the following fields and should not have a header row:

+
threshold amount,discount type,discount amount
+
+
+

If you specify tier information, you must provide all the tiers you want to create - the specified information will override the default. In addition, you must supply a zero income tier. This is a requirement and the command will quit if you don’t have one set up, as that tier is used as the starting point for financial assistance. (In other words, learners will see errors if there’s not a zero-income threshold tier set up.)

+

Reuse

+

The command will try to reuse any discounts and tiers that match ones the command would have created, so you can safely run this for a course or program that may have already had financial assistance tiers set up.

+
+

Syntax§

+

Configuring tiers for a program: +configure_tiers [--program <readable id>] [--program-abbrev <program abbreviation>] [--tier-info <tier info CSV>]

+

Configuring tiers for a course: +configure_tiers [--course <readable id>] [--tier-info <tier info CSV>]

+
+
+

Options§

+

Program options:

+
    +
  • --program <readable id> - Program ID to use or create.

  • +
  • --program-abbrev <abbreviation> - Abbreviation to use for tiers and discounts.

  • +
+

Course options:

+
    +
  • --course <readable id> - Course ID to use. This won’t create a course; use create_courseware for that.

  • +
+

Common options:

+
    +
  • --tier-info <csv file> - Tier info in CSV format.

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/commands/create_courseware.html b/commands/create_courseware.html new file mode 100644 index 0000000000..de936d7970 --- /dev/null +++ b/commands/create_courseware.html @@ -0,0 +1,251 @@ + + + + + + + + create_courseware — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

create_courseware§

+

Creates a new courseware object.

+

For programs, this creates the basic program record. +For courses, this creates the course, and then optionally adds it to the specified program (and can add it as an elective or required course). It will also optionally create an initial course run for the course. Finally, it will also add the course to the program’s requirements or electives list. +For courseruns, this creates the course run and associates it with the specified course.

+

This will not run sync_course_run for you, so for best results, ensure the course run is set up on the edX side, use this command, then run sync_course_run to pull dates and other information from edX.

+
+

Syntax§

+

create_courseware <object> <readable id> <title> [--live] [--self-paced] [--create-run [create_run]] [--run-url [RUN_URL]] [--program [PROGRAM]] [--run-tag [run-tag]] [--required] [--elective] [--force] [--start <date>] [--end <date>] [--enrollment-start <date>] [--enrollment-end <date>] [--upgrade <date>] [--dept <department_name>] [--create-depts]

+
+
+

Checks§

+

The command performs the following checks: +* It checks to see if readable_id contains course or program at the front - if it doesn’t, it will assume you’ve swapped the title and readable ID mistakenly and stop. +* It checks to see if the course will be live before adding it to the requirements tree. If --live isn’t specified, it will ignore your request. This only applies to course creation. +* If creating a course or program, --depts must be specified and the department names must exist.

+

Both of these checks can be overridden with the --force flag.

+
+
+

Options§

+
    +
  • object - One of program, course, or courserun

  • +
  • readable id - The readable ID of the object. Note: do not specify the run tag for course runs.

  • +
  • title - The title of the object.

  • +
  • --live - Makes the object live (default is not).

  • +
  • --force|-f - Force the creation of the object. (See “Checks” section for details.)

  • +
  • --create-depts - If specified, any departments specified that do not currently exist will be created.

  • +
+

Programs can take the following options: +* --depts - The departments to associate the program with.

+

Courses can take the following options:

+
    +
  • --program <PROGRAM> - The program to assign the course to.

  • +
  • --create-run <run tag> - Create a course run for this course with the specified run tag.

  • +
  • --run-url <url> - The courseware URL for the course run. (Only if --create-run is specified.)

  • +
  • --self-paced - The course run is self-paced. (Only if --create-run is specified.)

  • +
  • --required - The course is a requirement for the program.

  • +
  • --elective - The course is an elective for the program.

  • +
  • --depts - The departments to associate the course with.

  • +
+

Course runs can take the following options:

+
    +
  • --program <PROGRAM> - The program to assign the course to. Required.

  • +
  • --run-tag <run tag> - The run tag to use. Required.

  • +
  • --run-url <url> - The courseware URL for the course run.

  • +
  • --self-paced - The course run is self-paced.

  • +
  • --start <date> - The date the course run should start.

  • +
  • --end <date> - The date the course run should end.

  • +
  • --enrollment-start <date> - The date the course run enrollment should start.

  • +
  • --enrollment-end <date> - The date the course run enrollment should end.

  • +
  • --upgrade <date> - The date after which course run enrollments should not be possible.

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/commands/create_courseware_page.html b/commands/create_courseware_page.html new file mode 100644 index 0000000000..dc24ec2b54 --- /dev/null +++ b/commands/create_courseware_page.html @@ -0,0 +1,212 @@ + + + + + + + + create_courseware_page — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

create_courseware_page§

+

Creates a very basic About page in the CMS for the given courseware object.

+

The about page will only have the handful of fields that are required to be there, and will be linked to the specified courseware object. If the courseware object is a course, it will also be added to the Featured Products section on the homepage. By default, the CMS page will be saved in a draft state.

+
+

Syntax§

+

create_courseware_page <courseware id> [--live]

+
+
+

Options§

+
    +
  • courseware id - The courseware object to make a CMS page for.

  • +
  • --live - Makes the resulting page live.

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/commands/create_product.html b/commands/create_product.html new file mode 100644 index 0000000000..81d1e0327c --- /dev/null +++ b/commands/create_product.html @@ -0,0 +1,214 @@ + + + + + + + + create_product — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

create_product§

+

Creates a product for the given courseware ID. (For now, this only works with course runs.)

+

By default, the product description will be the courseware ID. This is the recommended setting for this to make it easy to determine which products are for what courseware objects.

+
+

Syntax§

+

create_product <courserun> <price> [--description|-d <description>] [--inactive]

+
+
+

Options§

+
    +
  • courserun - The course run to use.

  • +
  • price - The price (numbers only) of the product.

  • +
  • --description <description> (or -d) - Optionally specify the product description. (Defaults to the courseware ID.)

  • +
  • --inactive - Makes the product inactive. (Defaults to active.)

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/commands/create_user.html b/commands/create_user.html new file mode 100644 index 0000000000..52a3e7f7b6 --- /dev/null +++ b/commands/create_user.html @@ -0,0 +1,216 @@ + + + + + + + + create_user — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

create_user§

+

Creates a learner account in the system. You will be prompted for the account password.

+
+

Syntax§

+

create_user username email firstname lastname displayname countrycode [--enroll <courseid>]

+
+
+

Options§

+
    +
  • username - Username for the learner to create.

  • +
  • email - Email address of the learner to create.

  • +
  • firstname - The learner’s first name.

  • +
  • lastname - The learner’s last name.

  • +
  • displayname - The learner’s display name.

  • +
  • countrycode - The country code to use. (Default US)

  • +
  • --enroll <courseid> - Optionally enroll the user in the specified course run. The enrollment will be an audit enrollment.

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/commands/generate_discount_code.html b/commands/generate_discount_code.html new file mode 100644 index 0000000000..879c405899 --- /dev/null +++ b/commands/generate_discount_code.html @@ -0,0 +1,242 @@ + + + + + + + + generate_discount_code — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

generate_discount_code§

+

Creates discount code(s).

+

This can create a single code, a batch of explicitly defined codes, or a batch of automatically generated codes (with an optional prefix).

+
+

Syntax§

+

generate_discount_code <code> [<code>...] --amount <amount> [-activates <date>] [--expires <date>] [--discount-type <discount type>] [--one-time] [--once-per-user] [--count <count>] [--prefix <prefix>]

+
+
+

Batch Generating Codes§

+

You can create a batch of explicitly named codes by simply passing multiple discount codes to the command. All of the codes will be created (assuming they don’t already exist) with the options you’ve specified.

+

Alternatively, you can created a number of codes using the --count and -prefix option. Using these options will generate the number of codes specified by --count and will prefix the code with -prefix if it is specified. The code will be generated using a UUID - if you’ve supplied a prefix, the code will be in the format <prefix><uuid>. Note that the command won’t insert any punctuation between the prefix and the UUID, so you will need to add that yourself if you want, for example, a dash separating the two. UUIDs are 37 characters in length so prefixes need to be a total of 13 characters or less.

+
+
+

Output§

+

Generated codes will be written to a generated-codes.csv file, with the following information:

+
    +
  • Discount code

  • +
  • Code type

  • +
  • Amount

  • +
  • Expiration date

  • +
+

The file is overwritten if it exists.

+
+
+

Options§

+

General options:

+
    +
  • --amount <amount> - The discount’s amount. For percent off discounts, this should be on a scale of 0-100. This is required.

  • +
  • --discount-type <discount type> - One of percent-off, dollars-off, or fixed-price; the type of discount code to make. Defaults to percent-off.

  • +
  • --activates <date> - The date the code should become active (in ISO-8601 format).

  • +
  • --expires <date> - The date the code should stop being active (in ISO-8601 format).

  • +
  • --one-time - Set the discount to be redeemable only once.

  • +
  • --once-per-user - Set the discount to be redeemable only once per learner.

  • +
+

For explicitly named codes:

+
    +
  • code - The code to generate. (You can specify any number of these.) Max length 50 characters.

  • +
+

For automatically generated codes:

+
    +
  • --count <count> - The number of codes to create.

  • +
  • --prefix <prefix> - The prefix to append to the code. Max length 13 characters.

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/commands/import_courserun.html b/commands/import_courserun.html new file mode 100644 index 0000000000..e87cd960f6 --- /dev/null +++ b/commands/import_courserun.html @@ -0,0 +1,218 @@ + + + + + + + + import_courserun — MITx Online documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

import_courserun§

+

Creates courserun(s) in the system based on edX course data.

+

You can specify either a specific courserun to create, or you can specify a run tag (e.g. 1T2023) and a program (e.g. program-v1:MITx+DEDP), and the command will create courseruns for the courses that it finds in edX.

+

You can also optionally have it create a CMS page for the course, if one doesn’t already exist.

+

Furthermore, you can specify a price, and it will create (or update) product(s) for the courserun(s) with the specified price. Created products will use the readable ID for the courserun as the product description and will be made active depending on the courserun. This command will not update existing courseruns; only new ones that it creates will get products.

+

If the course does not exist, it will be created with the same data as the edX course. Any specified courserun that doesn’t exist in edX will be skipped - it won’t make empty course runs for you (use Django Admin or create_courseware if you want to do that, since you’ll need to specify a few things that you can’t here.) Similarly, any courserun that already exists will be skipped - sync_courserun, which runs on a regular basis, will handle syncing the pertinent data for it.

+

New courseruns will be created with the following data synced from the edX course_details API call: +* Start and end dates +* Enrollment start and end dates +* Title +* Pacing (self-paced or instructor-led) +* Courseware URL (depends on the OPENEDX_API_BASE_URL configuration setting)

+

You may want to adjust these after they’re created.

+
+

Syntax§

+

To create an individual courserun:

+

import_courserun [--courserun <courserun>] [--program <program>] [--live] [--create-cms-page] [--price <price>]

+

To walk a program:

+

import_courserun [--program <program>] [--run-tag <run tag>] [--live] [--create-cms-page] [--price <price>]

+
+
+

Options§

+
    +
  • --courserun <courserun> - The courserun to check for. Takes precedence over --program.

  • +
  • +
    --program <program>
      +
    • _If walking a program:_ The program to walk through. Requires --run_tag. Specify either the numeric database ID or the readable ID for the program.

    • +
    • _If creating a single courserun:_ The program the course should belong to, if any.

    • +
    +
    +
    +
  • +
  • --run-tag <run tag> - The run tag to use for the new courseruns. Required for --program; don’t use otherwise.

  • +
  • --live - Make the course live. (Default is to set the flag to false.)

  • +
  • --create-cms-page - Attempt to create a basic CMS page for the course, in a similar fashion to create_courseware_page. If this fails (for instance, if the course already has a CMS page), this step will be skipped.

  • +
  • --price <price> - Create (or update) a product for the courserun with the specified price. If the command creates multiple courseruns, this will create a product for each.

  • +
  • --dept <department_name> - Specify department(s) assigned to the course object. If program is specified, all courses associated with the program and imported will have the same department.

  • +
+
+
+

Example§

+

The use case for this was creating a batch of course runs for an upcoming semester of DEDP courses; these courses existed in edX but not in MITx Online. Since in that case the semester was 1T2023, this command would have created all the applicable courseruns all at once:

+

manage.py import_courserun --program program-v1:MITx+DEDP --run-tag 1T2023 --live --dept Economics

+

Or, the same but with the standard DEDP pricing applied:

+

manage.py import_courserun --program program-v1:MITx+DEDP --run-tag 1T2023 --live --price 1000

+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/commands/index.html b/commands/index.html new file mode 100644 index 0000000000..3152ba6df6 --- /dev/null +++ b/commands/index.html @@ -0,0 +1,260 @@ + + + + + + + + MITx Online Commands — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/commands/refund_fulfilled_order.html b/commands/refund_fulfilled_order.html new file mode 100644 index 0000000000..9bc9538d0d --- /dev/null +++ b/commands/refund_fulfilled_order.html @@ -0,0 +1,154 @@ + + + + + + + + refund_fulfilled_order — MITx Online documentation + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

refund_fulfilled_order§

+

Looks up a fulfilled order in the system, sets it to Refunded, and then adjusts the enrollments accordingly.

+
    +
  • If –unenroll is specified, the learner will be unenrolled from the course run associated with the order.

  • +
  • If –audit is specified, the learner will keep their unenrollments, but they will be set to “audit” instead of “verified”.

  • +
+

This does not make any sort of call to CyberSource or any other payment gateway to perform a refund - you’re expected to have refunded the learner’s money manually already. (At time of writing, PayPal transactions can’t be refunded using the normal means, so they get refunded manually via CyberSource and then this command comes in to clean up afterwards.)

+
+

Syntax§

+

refund_fulfilled_order <reference number> [--audit] [--unenroll]

+
+
+

Options§

+
    +
  • <reference number> - The reference number for the order to refund.

  • +
  • --audit - Change the learner’s enrollment status to audit.

  • +
  • --unenroll - Unenroll the learner.

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/commands/regenerate_edx_auth_tokens.html b/commands/regenerate_edx_auth_tokens.html new file mode 100644 index 0000000000..e452aa1e00 --- /dev/null +++ b/commands/regenerate_edx_auth_tokens.html @@ -0,0 +1,148 @@ + + + + + + + + regenerate_edx_auth_tokens — MITx Online documentation + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

regenerate_edx_auth_tokens§

+

Regenerates the authentication tokens for a specified learner. In essence, deletes the OpenEdxApiAuth record and then makes a call to edX to generate a new refresh and access token.

+

If the user doesn’t have an OpenEdxUser record either, then this command is not appropriate. Use repair_missing_courseware_records instead. This will also not do anything with enrollments or grades. The main usecase is if the learner’s OpenEdxApiAuth record gets deleted for some reason, or if their refresh tokens on the edX side are revoked.

+
+

Syntax§

+

regenerate_edx_auth_tokens <username>

+
+
+

Options§

+
    +
  • username - the learner’s ID, username, or email address.

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/commands/resolve_pending_order.html b/commands/resolve_pending_order.html new file mode 100644 index 0000000000..e85a25f20f --- /dev/null +++ b/commands/resolve_pending_order.html @@ -0,0 +1,149 @@ + + + + + + + + resolve_pending_order — MITx Online documentation + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

resolve_pending_order§

+

Looks up the specified pending order in CyberSource and resolves it. This can mean either fulfilling the order or cancelling it, depending on the status of the payment in CyberSource: if the order is found and the result code is 100, it will be fulfilled; otherwise, it will be cancelled.

+

This only works on pending orders and won’t accept a reference number for an order that’s not in the Pending state.

+
+

Syntax§

+

resolve_pending_order [--all] [--order <reference number>]

+
+
+

Options§

+
    +
  • --all - Process all pending orders.

  • +
  • --order <reference number> - Process a specific order specified by reference number (e.g. mitxonline-prod-1).

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/configuration/ecommerce.html b/configuration/ecommerce.html new file mode 100644 index 0000000000..d815911004 --- /dev/null +++ b/configuration/ecommerce.html @@ -0,0 +1,264 @@ + + + + + + + + Configure eCommerce — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Configure eCommerce§

+

To use the eCommerce subsystem, some configuration is required. These instructions will also set up a course in your MITx Online environment that you can use for enrollment.

+

You’ll need a working MITx Online setup and a working devstack setup to begin, and superuser accounts for each.

+
+

Set Up MITx Online eCommerce Config§

+

The CyberSource configuration for the app can be lifted out of Heroku. Make sure you use values from RC - otherwise, you will actually be charged for purchases (and test credit card numbers will fail). For best results, you should also have an account for the test Enterprise Business Center (https://ebc2test.cybersource.com/ebc2/).

+

The .env settings you need to copy over are:

+
    +
  • MITOL_PAYMENT_GATEWAY_CYBERSOURCE_ACCESS_KEY

  • +
  • MITOL_PAYMENT_GATEWAY_CYBERSOURCE_PROFILE_ID

  • +
  • MITOL_PAYMENT_GATEWAY_CYBERSOURCE_SECURITY_KEY

  • +
  • MITOL_PAYMENT_GATEWAY_CYBERSOURCE_SECURE_ACCEPTANCE_URL

  • +
+

Alternatively, you can set up your own CyberSource developer account and generate a set of API keys there: Evaluation Account Setup If you set up your own developer account, you will need to properly configure it for Secure Acceptance with the credit card types you wish to test, and you will need to generate your own API keys and supply them in the .env file.

+

You may also set ECOMMERCE_DEFAULT_PAYMENT_GATEWAY to CyberSource - this sets it to the default value, but setting it now will prevent issues if the Payment Gateway ol-django library adds in new payment gateways.

+
+
+

Set Up a Course§

+

The devstack environment comes with a couple of test courses set up. If you want a different course, you will need to set that up in Open edX before starting here. Bootstrapping a course in edX is beyond the scope of this document.

+
+

In Open edX§

+
    +
  1. Log in to the Django Admin interface.

  2. +
  3. Find a course from the Course Overviews page.

  4. +
  5. Note the Display name and Id fields.

  6. +
+
+
+

In MITx Online§

+
    +
  1. Log into the Django Admin interface.

  2. +
  3. Under Courses, open Programs and add a Program. (The specifics here aren’t important - there just needs to be a Program.)

  4. +
  5. Under Courses, open Courses and add a Course. The Title and Readable Id fields should be set to the Display name and Id fields from the edX course you plan to use. Make sure Live is set and the Program is set to the program you created in step 2.

  6. +
  7. Under Course Runs, add a Course Run. The Title and Courseware Id fields should be set to the Id and Display Name fields from the edX course. The Courseware url path should be set to the URL where the course lives in edX (ex. https://courses-qa.mitxonline.mit.edu/learn/course/course-v1:MITx+14.750x+3T2022/home). The dates will be overwritten when the system is synced with Open edX, but for testing it’s good to put Start Date, End Date, Enrollment Start, and Enrollment End. A good starting point for these is today plus/minus one year for each.

  8. +
  9. You now need to add the course to the CMS. Navigate to the Wagtail CMS admin, at /cms.

  10. +
  11. Open the Courses folder under Home Page.

  12. +
  13. Select Add Child Page.

  14. +
  15. Fill out the form. The course you added in steps 1-4 should appear. (If not, double-check your settings in Django Admin.) Publish the page when ready.

  16. +
  17. Open the Home Page, and select Edit.

  18. +
  19. Under the Featured Products section, select Add. You will be given a button to choose a page, and the page chooser there should list the page you created.

  20. +
  21. Publish the Home Page when ready.

  22. +
+

You should now be able to see the course under the hero image on the MITx Online homepage, and navigating into the course should give you the option to Enroll. (At this point, you won’t have a Product set up, so enrolling now should just enroll you in the course.)

+
+
+
+

Setting Up a Product§

+
    +
  1. Log into MITx Online Django Admin.

  2. +
  3. Under Ecommerce, open Products and create a new Product. Set Content type to Course Run and Object Id to the ID of the course run you created earlier (it’s probably 1 if you’re working from a new install). Price should ideally be set to a non-zero value, that is less than $999, in RC/Sandbox environments. Description needs to be filled in but can be anything - for clarity, it’s recommended to use the course name. Make sure Is active is checked.

  4. +
+

You should now be able to enroll in the upgraded course.

+
    +
  • If you’ve enrolled in the course already, you should now see the upsell card on the course listing page.

  • +
  • If you haven’t enrolled, enrolling should pop the upgrade modal.

  • +
  • In either case, enrolling in the paid version of the course should bring you to the cart, and you should then be able to check out.

  • +
+
+

Testing Checkout§

+

The test CyberSource credentials won’t actually process a charge that has been run through the system. However, you should avoid using a valid credit card number when testing. Any card number that is both invalid but passes the checks should work. Here are some examples:

+
    +
  • Visa: 4111111111111111

  • +
  • Visa: 4242424242424242

  • +
  • MasterCard: 5555555555554444

  • +
  • MasterCard: 5105105105105100

  • +
  • American Express: 378282246310005

  • +
  • Discover: 6011111111111117

  • +
+

Supply any expiration date in the future. The CVN code should be any three-digit (not AmEx) or 4 digit (AmEx) number that is fairly unique (not like 123, 111). What card types are allowed and whether or not the CVN code is required depends on the settings in the CyberSource account - currently, the MIT test account does require an expiration date and CVN code and supports the four card types listed above. Transactions are logged and can be found in the test EBC. You can additionally adjust the settings in the EBC to email the payment data to you while you’re testing - but you should ask around before doing this in case someone else is testing eCommerce elsewhere.

+
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/configuration/hubspot.html b/configuration/hubspot.html new file mode 100644 index 0000000000..085b7b2fcd --- /dev/null +++ b/configuration/hubspot.html @@ -0,0 +1,142 @@ + + + + + + + + Configure HubSpot — MITx Online documentation + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Configure HubSpot§

+

In order to connect your local instance of MITx Online with HubSpot, you will need to define the following envrionment variables in your .env file.

+

` +MITOL_HUBSPOT_API_PRIVATE_TOKEN=<ask a developer to add you to the hubspot account> +MITOL_HUBSPOT_API_ID_PREFIX=<your_initials>-mitxonline-dev +HUBSPOT_PIPELINE_ID=19817792 +`

+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/configuration/index.html b/configuration/index.html new file mode 100644 index 0000000000..782da10495 --- /dev/null +++ b/configuration/index.html @@ -0,0 +1,227 @@ + + + + + + + + Configuration — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/configuration/open_edx.html b/configuration/open_edx.html new file mode 100644 index 0000000000..a719abca2d --- /dev/null +++ b/configuration/open_edx.html @@ -0,0 +1,416 @@ + + + + + + + + Configure Open edX — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Configure Open edX§

+

In order to create user accounts in Open edX and permit authentication from MITx Online to Open edX, you need to configure MITx Online as an OAuth2 provider for Open edX.

+
+

Setup Open edX Devstack§

+

Following steps are inspired by edx-devstack.

+
+

Add /etc/hosts alias for Open edX§

+

If one doesn’t already exist, add an alias to /etc/hosts for Open edX. We have standardized this alias +to edx.odl.local. Your /etc/hosts entry should look like this:

+
127.0.0.1       edx.odl.local
+
+
+
+
+

Clone edx/devstack§

+
git clone https://github.com/edx/devstack
+cd devstack
+make requirements
+make dev.clone
+
+
+
+
+

Pull latest images and run provision§

+
make pull
+make dev.provision
+
+
+
+
+

Start your servers§

+
make dev.up
+
+
+
+
+

Stop your servers§

+
make stop
+
+
+
+
+
+

Setup social auth§

+
+

Install social-auth-mitxpro in LMS§

+

There are two options for this:

+
+

Install via pip§

+
pip install social-auth-mitxpro
+
+
+
+
+

Install from local Build§

+
    +
  • Checkout the social-auth-mitxpro project and build the package per the project instructions

  • +
  • Copy the social-auth-mitxpro-$VERSION.tar.gz file into devstack’s edx-platform directory

  • +
  • In devstack, run make lms-shell and within that shell pip install social-auth-mitxpro-$VERSION.tar.gz

    +
      +
    • To update to a new development version without having to actually bump the package version, simply pip uninstall social-auth-mitxpro, then install again

    • +
    +
  • +
+
+
+
+

Install openedx-companion-auth in LMS§

+

There are two options for this:

+
+

Install via pip§

+
pip install openedx-companion-auth
+
+
+
+
+

Install from local Build§

+
    +
  • Checkout the openedx-companion-auth project and build the package per the project instructions

  • +
  • Copy the openedx-companion-auth-$VERSION.tar.gz file from the dist folder into devstack’s edx-platform directory

  • +
  • In devstack, run make lms-shell and within that shell pip install openedx-companion-auth-$VERSION.tar.gz

    +
      +
    • To update to a new development version without having to actually bump the package version, simply pip uninstall -y openedx-companion-auth, then install again

    • +
    +
  • +
+
+
+
+
+

Configure MITx Online as a OAuth provider for Open edX§

+

In MITx Online:

+
    +
  • go to /admin/oauth2_provider/application/ and create a new application with these settings selected:

    +
      +
    • Redirect uris: http://<EDX_HOSTNAME>:18000/auth/complete/mitxpro-oauth2/

      +
        +
      • [macOS users] You will need redirect uris for both the local edX host alias and for host.docker.internal. This value should be:

        +
        http://edx.odl.local:18000/auth/complete/mitxpro-oauth2/
        +http://host.docker.internal:18000/auth/complete/mitxpro-oauth2/
        +
        +
        +
      • +
      • [Linux users] You will need redirect uris for both the local edX host alias and for the gateway IP of the docker-compose networking setup for MITx Online as found via docker network inspect mitx-online_default:

        +
        http://edx.odl.local:18000/auth/complete/mitxpro-oauth2/
        +http://<GATEWAY_IP>:18000/auth/complete/mitxpro-oauth2/
        +
        +
        +
      • +
      • [WSL 2 users]: Use the URLs for macOS. You will also have to set OPENEDX_IP to host-gateway in your .env file to make this work. (Networking with WSL 2 works very differently, and the defaults won’t work.)

      • +
      +

      NOTE: GATEWAY_IP should be something like 172.19.0.1.

      +
    • +
    • Client type: “Confidential”

    • +
    • Authorization grant type: “Authorization code”

    • +
    • Skip authorization: checked

    • +
    • Other values are arbitrary but be sure to fill them all out. Save the client id and secret for later

    • +
    +
  • +
+

In Open edX (derived from instructions here):

+
    +
  • +
    make lms-shell into the LMS container and ensure the following settings are set in /edx/etc/lms.yml if you are using Juniper or a more recent Open edX release, otherwise they should be in /edx/app/edxapp/cms.env.json:
    FEATURES:
    +  ALLOW_PUBLIC_ACCOUNT_CREATION: true
    +  ENABLE_COMBINED_LOGIN_REGISTRATION: true
    +  ENABLE_THIRD_PARTY_AUTH: true
    +  ENABLE_OAUTH2_PROVIDER: true
    +  SKIP_EMAIL_VALIDATION: true
    +REGISTRATION_EXTRA_FIELDS:
    +  country: hidden
    +THIRD_PARTY_AUTH_BACKENDS:
    + - social_auth_mitxpro.backends.MITxProOAuth2
    +
    +
    +
    +
    +
  • +
  • make lms-restart to pick up the configuration changes

  • +
  • Login to django-admin (default username and password can be found here), go to http://<EDX_HOSTNAME>:18000/admin/third_party_auth/oauth2providerconfig/, and create a new config:

    +
      +
    • Select the default example site

    • +
    • The slug field MUST match the the backend’s name, which for us is mitxpro-oauth2

    • +
    • Client Id should be the client id from the MITx Online Django Oauth Toolkit Application

    • +
    • Check the following checkboxes:

      +
        +
      • Enabled

      • +
      • Skip hinted login dialog

      • +
      • Skip registration form

      • +
      • Sync learner profile data

      • +
      • Enable SSO id verification

      • +
      +
    • +
    • Set Backend name to: mitxpro-oauth2

    • +
    • In “Other settings”, put:

      +
      {
      +  "AUTHORIZATION_URL": "http://<LOCAL_MITX_ONLINE_ALIAS>:8013/oauth2/authorize/",
      +  "ACCESS_TOKEN_URL": "http://<EXTERNAL_MITX_ONLINE_HOST>:8013/oauth2/token/",
      +  "API_ROOT": "http://<EXTERNAL_MITX_ONLINE_HOST>:8013/"
      +}
      +
      +
      +
    • +
    • LOCAL_MITX_ONLINE_ALIAS should be your /etc/hosts alias for the mitxonline app

    • +
    • EXTERNAL_MITX_ONLINE_HOST will depend on your OS, but it needs to be resolvable within the edx container

      +
        +
      • Linux users: The gateway IP of the docker-compose networking setup for mitxonline as found via docker network inspect mitx-online_default

      • +
      • OSX users: Use host.docker.internal

      • +
      +
    • +
    • Save the configuration.

    • +
    +
  • +
+
+
+

Configure Open edX to support OAuth2 authentication from MITx Online§

+
    +
  • In Open edX:

    +
      +
    • go to /admin/oauth2_provider/application/ and verify that an application named ‘edx-oauth-app’ exists with these settings:

      +
        +
      • Redirect uris: http://mitxonline.odl.local:8013/login/_private/complete

      • +
      • Client type: “Confidential”

      • +
      • Authorization grant type: “Authorization code”

      • +
      • Skip authorization: checked

      • +
      • Other values are arbitrary but be sure to fill them all out. Save the client id and secret for later

      • +
      +
    • +
    +
  • +
  • In MITx Online:

    +
      +
    • Set OPENEDX_API_CLIENT_ID to the client id

    • +
    • Set OPENEDX_API_CLIENT_SECRET to the client secret

    • +
    • Set OPENEDX_API_BASE_URL to http://host.docker.internal:18000 when running devstack and mitxonline locally through Docker

    • +
    +
  • +
+
+
+

Configure Logout§

+
    +
  • In Open edX, configure settings.IDA_LOGOUT_URI_LIST to be a list including the full url to <protocol>://<hostname>[:<port>]/logout in MITx Online

    +
      +
    • For devstack, this means modifying the value in edx-platform/lms/envs/devstack.py to include http://mitxonline.odl.local:8013/logout

    • +
    • For production, this setting can go in lms.env.json under the key IDA_LOGOUT_URI_LIST as a JSON array of with that string in it

    • +
    +
  • +
  • MITx Online:

    +
      +
    • Set LOGOUT_REDIRECT_URL to the full path to the edx /logout view.

    • +
    +
  • +
+

For local development this will be http://<EDX_HOSTNAME>:18000/logout

+
+
+

Configure Open edX user and token for use with MITx Online management commands§

+
    +
  • In Open edX, create a staff user and then under /admin/oauth2_provider/accesstoken/ add access token. The value of said token needs to match the value set for the OPENEDX_SERVICE_WORKER_API_TOKEN key in the MITx Online app.

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/configuration/quickstart.html b/configuration/quickstart.html new file mode 100644 index 0000000000..bae134fc43 --- /dev/null +++ b/configuration/quickstart.html @@ -0,0 +1,280 @@ + + + + + + + + MITx Online Quick Start — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

MITx Online Quick Start§

+

You can use the configure_instance management command to perform a quick-start of a fresh MITx Online instance. This command takes care of a lot of the boilerplate required to set up an instance. It:

+
    +
  • Creates a superuser account (if you want)

  • +
  • Creates the OAuth2 application record for edX (if you want, and optionally with an existing secret)

  • +
  • Creates a set of courseware objects, including a DEDP program and courses with runs that match what ships with a standard devstack instance

  • +
  • Creates a set of CMS pages for the courseware objects that it creates

  • +
  • Sets up financial assistance appropriately

  • +
  • Adds a couple of products in for the courses it creates

  • +
  • Creates a learner account for the system

  • +
+

It does not:

+
    +
  • Run migrations

  • +
  • Completely set up integration with devstack

  • +
+

In addition, there are a handful of tasks that you’ll need to perform afterwards:

+
    +
  • The CMS pages (course about pages and the financial assistance form) need to be reviewed for content.

  • +
  • The financial assistance form will need to be published, and linked into the appropriate course.

  • +
  • You may want to adjust the products that are created.

  • +
+

The configure_instance command has a few flags you can use to customize how it works. For more details on this, either run it with --help or read the configure_instance command documentation. (Do this especially if you’re using the command to reset your MITx Online instance - you can provide an existing OAuth client ID and secret.)

+
+

Performing a Quick Start§

+

To quick-start your MITx Online instance:

+
    +
  1. Run the migrate command.

  2. +
  3. Run the createsuperuser command.

  4. +
  5. Follow the steps in the Configure Open edX documentation

  6. +
  7. Run configure_instance <platform>, where platform is macos, linux, or none. (If you don’t want it to create OAuth2 records, set this to none or leave it blank. The default is none.)

  8. +
+

configure_instance will prompt you to enter a password for the test learner account and will prompt you to enter account information for the superuser account. At the end, you’ll see your edX OAuth2 application credentials, which can then be plugged into Open edX (if you haven’t specified none for your platform).

+
+
+

Results§

+

Running configure_instance will peform these tasks in order:

+
    +
  1. Runs createsuperuser to create the superuser account (unless disabled with --dont-create-superuser).

  2. +
  3. Creates the OAuth2 application record. (This is the one part of this that doesn’t rely on an existing management command.)

  4. +
  5. Runs configure_wagtail to set up the CMS.

  6. +
  7. Runs configure_tiers to add the DEDP program and configure financial assistance tiers and discounts.

  8. +
  9. Runs create_courseware_page to add a basic about page for the DEDP program (required for the financial assistance form).

  10. +
  11. Runs create_finaid_form to create a financial assistance form for the DEDP program.

  12. +
  13. Runs create_courseware twice to create two courses, each with a course run, that correspond to the demo courses in devstack. (Details below.)

  14. +
  15. Runs sync_course_run to sync the courses with the devstack instance.

  16. +
  17. Runs create_product twice to create two products for the courses.

  18. +
  19. Runs create_courseware_page twice to add course pages for the two courses. (These are marked as live.)

  20. +
  21. Runs create_user to create the learner account.

  22. +
+

The courses that are created are:

+ + + + + + + + + + + + + + + + + + + + +

Course

Readable ID

Run Tag

Price

Demonstration Course

course-v1:edX+DemoX

Demo_Course

$999

E2E Test Course

course-v1:edX+E2E-101

course

$999

+

The learner account that is created is:

+
    +
  • Username: testlearner

  • +
  • Email: testlearner@mitxonline.odl.local

  • +
  • Display Name (split in half for first/last names): Test learner

  • +
  • Country Code: US

  • +
  • Enrollments: course-v1:edX+DemoX+Demo_Course

  • +
+

The program that gets created is the standard DEDP program (program-v1:MITx+DEDP). The Demonstration Course is added to the DEDP program; E2E Test Course is not.

+
+
+

Notes§

+

The steps that involve communication with edX may not work if your environment isn’t set up properly. In these cases, the attempts will be queued to be run later.

+

If you’ve set your platform to macos or linux, the command will do the first part of the Configure MITx Online as an OAuth provider for Open edX section in the Configure Open edX documentation.

+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/configuration/tutor.html b/configuration/tutor.html new file mode 100644 index 0000000000..51b3aa23f8 --- /dev/null +++ b/configuration/tutor.html @@ -0,0 +1,412 @@ + + + + + + + + Local Open edX Tutor and MITx Online Deployment — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Local Open edX Tutor and MITx Online Deployment§

+

These instructions describe setting up MITx Online and Tutor from scratch on Linux. These instructions should largely apply to macOS users, and they should also apply to users converting from a devstack-based deployment to Tutor.

+
+

These instructions should work for a Tutor Dev or Tutor Nightly deployment as well. Specify --tutor-dev instead of --tutor when running configure_instance so the URLs have a port on them.

+
+

At the end of this guide, you should have:

+
    +
  • A fully working MITx Online deployment.

  • +
  • A working Tutor deployment of edX.

  • +
  • SSO should work from edX to MITx Online.

  • +
  • MITx Online should have a service worker set up and should be able to perform tasks using the edX api.

  • +
  • Tutor’s included AuthN MFE should be disabled in favor of the MITx Online authentication system.

  • +
+
+

Preliminary Steps§

+

pyenv (and pyenv-virtualenv) are highly recommended for managing local Python versions. Use the instructions on their GitHub page to install if you haven’t already installed it.

+

You’ll want to create at least a virtualenv for Tutor. As of this writing, Tutor uses Python 3.8.12 (in the LMS container at least); I have also successfully used 3.9.16. 3.11 has not worked for me. You can optionally create a virtualenv for MITx Online too but that’s not strictly necessary. (I have one so I can run black/isort/etc. without having to jump into a container to do it.)

+
+
+

Tutor Setup, Part One§

+
+

Note that no hosts file changes are needed if you use the default local.edly.io domain - that’s a real domain with a wildcard subdomain cname that points to 127.0.0.1.

+
+

To begin, you need to follow the One-Click Installer instructions provided by Tutor. Do this with your Tutor virtualenv activated.

+
+

Mac/Arm users should instead follow these instructions: Running Tutor on ARM-based systems It’s mostly the same steps that the quickstart does internally, with some changes to rebuild some of the images and flip some dependencies to use compatible images for Arm.

+
+

Once Tutor has bootstrapped itself and is available, create a superuser account:

+
tutor local do createuser --staff --superuser edx edx@example.org
+
+
+

Supply a password (the one used by devstack is edx so use that if you want to be consistent with it). Then, create a service worker account for MITx Online:

+
tutor local do createuser --staff mitx_online_serviceworker service@mitxonline.odl.local
+
+
+

Supply a password (this one doesn’t matter for a local deployment, you won’t ever actually use the account).

+

For best results, create two new courses within edX. The MITx Online configure_instance command expects a couple of courses to exist in edX (because they come with the devstack package):

+ + + + + + + + + + + + + + +

Course ID

Course Title

course-v1:edX+DemoX+Demo_Course

Demonstration Course

course-v1:edX+E2E-101+course

E2E Test Course

+

If you have a devstack instance handy, you can export these and import them into Tutor. Otherwise, just create them and make sure to set dates for the courses (they default to 2030 otherwise).

+

Finally, go here to create an access token for the service worker user: https://local.edly.io/admin/oauth2_provider/accesstoken/add/ The token can be anything, and the expiration date should just be today plus 10 years.

+
+
+

MITx Online Setup§

+

To set up MITx Online:

+
    +
  1. Get the gateway IP for the tutor_local_default network: docker network inspect tutor_local_default | grep Gateway

    +
      +
    • Mac users should instead use the host.docker.internal IP. Specify this by setting OPENEDX_IP=host-gateway in your MITx Online .env file.

    • +
    +
  2. +
  3. Set up your /etc/hosts file to point mitxonline.odl.local to localhost.

  4. +
  5. Clone the repository somewhere.

  6. +
  7. Set up your .env file. These settings need particular attention:

    +
      +
    • OPENEDX_IP: set to the gateway IP from the first step

    • +
    • OPENEDX_API_BASE_URL: set to http://local.edly.io

    • +
    • OPENEDX_SERVICE_WORKER_USERNAME: set to mitx_online_serviceworker (unless you changed this)

    • +
    • OPENEDX_SERVICE_WORKER_API_TOKEN: set to the token you generated

    • +
    +
  8. +
  9. Build the app: docker compose build

  10. +
  11. Run migrations and configure Wagtail:

    +
    docker compose run --rm web ./manage.py migrate
    +docker compose run --rm web ./manage.py configure_wagtail
    +
    +
    +
  12. +
  13. Run the configure_instance command:

    +
    docker compose run --rm web ./manage.py configure_instance linux --gateway <ip> --tutor
    +
    +
    +

    where <ip> is the IP from the first step. (On macOS, specify macos instead of linux. You can also skip --gateway.) You will need to supply passwords for the MITx Online superuser and test learner accounts. Make a note of the client ID and secret that it will print out at the end.

    +
  14. +
+
+
+

Tutor Setup, Part Two§

+

Note that some of these steps require editing the main configuration files for the production instance (which is also used for a local deployment). Most of the settings that need to be adjusted to get integration working are overridden by the default Tutor configuration, so you can’t update them by setting config.yml. If you’re using the development Tutor build, you’ll likely need to edit development.py rather than production.py as necessary.

+

These steps will also disable the AuthN SSO MFE, so from here on you’ll get normal edX authentication screens (if you’re not being bounced to MITx Online).

+
    +
  1. Get the gateway IP of the mitxonline_default Docker network:

    +
    docker network inspect mitxonline_default | grep Gateway
    +
    +
    +
  2. +
  3. Log into to edX using your superuser account, and make sure your session stays open. Sessions are pretty long-lived so this just means not closing the browser that you started the session in. (Part of this process will involve mostly breaking authentication so it’s important that you are able to get into the admin.)

  4. +
  5. Stop Tutor: tutor local stop

  6. +
  7. Change into the configuration root for Tutor:

    +
    cd "$(tutor config printroot)"
    +
    +
    +
  8. +
  9. Create a env/build/openedx/requirements/private.txt with the required extensions:

    +
    social-auth-mitxpro
    +openedx-companion-auth
    +
    +
    +
  10. +
  11. Edit the env/apps/openedx/config/lms.env.yml file and add:

    +
    FEATURES:
    +  SKIP_EMAIL_VALIDATION: true
    +
    +
    +

    to the FEATURES block (should be at the top).

    +
  12. +
  13. Edit the env/apps/openedx/settings/lms/production.py and/or env/apps/openedx/settings/lms/development.py settings file. (The former is used by a local instance, where the latter is used by both dev and nightly instances.)

    +
      +
    • Add to the end of the file:

      +
      +
        +
      • THIRD_PARTY_AUTH_BACKENDS = ['social_auth_mitxpro.backends.MITxProOAuth2']

      • +
      • AUTHENTICATION_BACKENDS.append('social_auth_mitxpro.backends.MITxProOAuth2')

      • +
      • IDA_LOGOUT_URI_LIST.append('http://mitxonline.odl.local:8013/logout/') - there’s an existing one of these around like 300 in production.py too.

      • +
      +
      +
    • +
    • Find and update:

      +
        +
      • FEATURES['ENABLE_AUTHN_MICROFRONTEND'] = False (defaults to True)

      • +
      • REGISTRATION_EXTRA_FIELDS["terms_of_service"] = "hidden" (defaults to required)

      • +
      +
    • +
    +
  14. +
  15. Build a new openedx image: tutor images build openedx (this will take a long time)

  16. +
  17. Run a Docker Compse rebuild: tutor local dc build (this should be pretty quick - it’s likely not required, just doing it here for safety)

  18. +
  19. Restart Tutor: tutor local start -d (omit -d if you want to watch the logs)

  20. +
  21. Check your settings. There’s a print_setting command that you can use to verify everything is set properly:

    +
      +
    • tutor local run lms ./manage.py lms print_setting REGISTRATION_EXTRA_FIELDS

    • +
    • tutor local run lms ./manage.py lms print_setting AUTHENTICATION_BACKENDS

    • +
    • tutor local run lms ./manage.py lms print_setting FEATURES - will print a lot of stuff

    • +
    • tutor local run lms ./manage.py lms print_setting THIRD_PARTY_AUTH_BACKENDS

    • +
    • If you do have weird errors or settings not showing properly, make sure you edited the right yaml files and that they’re using the right whitespace (i.e. don’t use tabs).

    • +
    +
  22. +
  23. In a separate browser session of some kind (incognito/private browsing/other browser entirely), try to navigate to http://local.edly.io . It should load but it should give you an error message. In the LMS logs, you should see an error message for “Can’t fetch settings for disabled provider.” This is proper operation - the OAuth2 settings aren’t in place yet.

  24. +
  25. In the superuser session you have open, go to http://local.edly.io/admin . This should work. If you’ve been logged out, you should still be able to get in. If you can’t (for instance, if you’re getting 500 errors), you will need to turn off ENABLE_THIRD_PARTY_AUTH in FEATURES, restart Tutor using tutor local stop and start, not using reboot, then try again.

  26. +
  27. Go to http://local.edly.io/admin/third_party_auth/oauth2providerconfig/add/ and add a provider configuration:

    +
      +
    • Enabled is checked.

    • +
    • Name: mitxonline

    • +
    • Slug: mitxpro-oauth2

    • +
    • Site: local.edly.io

    • +
    • Skip hinted login dialog is checked.

    • +
    • Skip registration form is checked.

    • +
    • Skip email verification is checked.

    • +
    • Sync learner profile data is checked.

    • +
    • Enable sso id verification is checked.

    • +
    • Backend name: mitxpro-oauth2

    • +
    • Client ID and Client Secret: from record created by configure_instance when you set up MITx Online.

    • +
    • Other settings:

      +
      +
      +
      {

      “AUTHORIZATION_URL”: “http://mitxonline.odl.local:8013/oauth2/authorize/”, +“ACCESS_TOKEN_URL”: “http://<MITXONLINE_GATEWAY_IP>:8013/oauth2/token/”, +“API_ROOT”: “http://<MITXONLINE_GATEWAY_IP>:8013/”

      +
      +
      +

      }

      +
      +

      where MITXONLINE_GATEWAY_IP is the IP from the mitxonline_default network from the first step. Mac users, use host.docker.internal for MITXONLINE_GATEWAY_IP.

      +
    • +
    +
  28. +
  29. Configure Tutor for OAuth2 authentication from MITx Online.

    +
      +
    • Go to http://local.edly.io/admin/oauth2_provider/application/ and either add or edit the edx-oauth-app entry.

    • +
    • Ensure these settings are set:

      +
      +
        +
      • Name: edx-oauth-app

      • +
      • Redirect uris: http://mitxonline.odl.local:8013/login/_private/complete

      • +
      • Client type: Confidential

      • +
      • Authorization grant type: Authorization code

      • +
      • Skip authorization is checked.

      • +
      +
      +
    • +
    • Save Client id and Client secret.

    • +
    +
  30. +
  31. Update your MITx Online .env file. Set OPENEDX_API_CLIENT_ID and OPENEDX_API_CLIENT_SECRET to the values from the record you created or updated in the last step.

  32. +
  33. You should now be able to run some MITx Online management commands to ensure the service worker is set up properly:

    +
      +
    • sync_courserun --all ALL should sync the two test courses (if you made them).

    • +
    • repair_missing_courseware_records should also work.

    • +
    +
  34. +
  35. In the separate browser session from step 12, attempt to log in again. This time, you should be able to log in through MITx Online, and you should be able to get to the edX LMS dashboard. If not, then double-check your provider configuration settings and try again.

    +
      +
    • Unlike devstack, the Tutor instance has an Update button for the provider configuration, so you can just update the record you put in.

    • +
    • If you are still getting “Can’t fetch settings” errors, make sure your Site is set properly - there are three options by default and only one works. (This was typically the problem I had.)

    • +
    +
  36. +
  37. Optionally, log into the LMS Django Admin and make your MITx Online superuser account a superuser there too.

  38. +
+
+
+

Other Notes§

+

Trying to set configuration settings via ``tutor config`` will undo the specialty configuration above. If you need to make changes to the configuration, either manually edit the env/apps/openedx/config/lms.env.yml file or the env/apps/openedx/settings/lms/production.py file and restart your Tutor instance.

+

Make sure your service worker account is active. It’s an easy checkbox to miss.

+

Restarting If you want to rebuild from scratch, make sure you docker image prune. It’s also recommended to remove the Tutor project root folder - tutor config printroot will tell you where that is.

+

Running Multiple Tutor Instances If you want to run more than one Tutor instance, it’s pretty important to specify the project root explicitly or you may end up with one instance trying to use config files from another and things getting confused from there. See the Tutor documentation for this. (A suggestion: configure aliases to the tutor command that run tutor --root=<whatever> so you don’t have to rely on environment variables, especially if you keep multiple terminal sessions going.)

+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/configuration/uwsgi_tuning.html b/configuration/uwsgi_tuning.html new file mode 100644 index 0000000000..263cbc1cda --- /dev/null +++ b/configuration/uwsgi_tuning.html @@ -0,0 +1,200 @@ + + + + + + + + Setting up uWsgi tuning for MITx Online — MITx Online documentation + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Setting up uWsgi tuning for MITx Online§

+

This setup satisfies the testing to help with tuning as mentioned in this Discusssion Post

+

Largely borrowed from work on OCW studio:

+ +
+

To set up locally:§

+
+

Set up uwsgitop§

+
    +
  1. Install uwsgitop: docker compose run --rm web poetry add uwsgitop

  2. +
  3. Set UWSGI_RELOAD_ON_RSS in your .env to a high value (e.g. 500)

  4. +
  5. Set UWSGI_MAX_REQUESTS in your .env to a high value (e.g. 10000)

  6. +
  7. docker compose build

  8. +
  9. docker compose up

  10. +
  11. In a new terminal window/tab, docker compose exec web uwsgitop /tmp/uwsgi-stats.sock

  12. +
  13. You should see your application’s memory usage without usage. Ready to go.

  14. +
+
+
+

Set up Locust§

+
    +
  1. Install Locust: docker compose run --rm web poetry add locust

  2. +
  3. Add locust to your docker-compose.yml locally, under services:

  4. +
+
locust:
+  image: locustio/locust
+  ports:
+    - "8089:8089"
+  volumes:
+    - ./:/src
+  command: >
+    -f /src/locustfile.py
+
+
+
    +
  1. Add the following to the web block, at the level of, and directly after, build:

  2. +
+
deploy:
+  resources:
+    limits:
+      cpus: "2"
+      memory: "1g"
+
+
+
    +
  1. Add locustfile.py. There is an example file at locustfile.py.example in the root of the repo. cp locustfile.py.example locustfile.py will copy it over as is. Change variables and/or add tests as needed.

  2. +
+
+
+

Put it all together§

+
    +
  1. Run docker-compose build

  2. +
  3. Run docker-compose up

  4. +
  5. You can use locust from http://0.0.0.0:8089/ in a browser

  6. +
  7. You can use uwsgitop in a terminal with docker compose exec web uwsgitop /tmp/uwsgi-stats.sock

  8. +
+
+
+
+

To test:§

+

Coming soon!

+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/ecommerce/flexible_pricing.html b/ecommerce/flexible_pricing.html new file mode 100644 index 0000000000..c886fa28e3 --- /dev/null +++ b/ecommerce/flexible_pricing.html @@ -0,0 +1,238 @@ + + + + + + + + Flexible Pricing — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Flexible Pricing§

+

The Flexible Pricing system allows learners to request alternative pricing for MITx Online courses based on their location and annual income. These requests can be made through a customizable form in the Wagtail CMS system.

+

When the learner accesses the Flexible Pricing request form, they will see one of the following:

+
    +
  • If they aren’t logged in, they’ll see a message saying so. Learners must be logged in to request flexibile pricing.

  • +
  • If they haven’t submitted a request, they’ll see the flexible pricing form and will be able to submit a request. On submission, the learner will see a message saying their request has been approved (if it can be approved automatically), or will see a request for more information to be submitted via DocuSign.

  • +
  • If they have submitted a request, they’ll be presented with a status page for their request. The text for approved, denied, and in progress states can be customized.

  • +
+
+

Form Creation§

+

To manually create a Flexible Pricing request form, follow these steps:

+
    +
  1. Navigate to the course page for the course. (Do not click the pencil button to edit, simply select the page itself.)

  2. +
  3. Click the Add Child Page button in the header.

  4. +
  5. You will be presented with the New Flexible Pricing Request Form page. Fill out the form.

    +
      +
    1. The Intro field text is displayed on the form regardless of the state of the request.

    2. +
    3. The Guest text is displayed if the learner isn’t logged in yet.

    4. +
    5. The Application Processing text is displayed if the learner navigates to the form again and their application is still being processed.

    6. +
    7. The Application Approved text is displayed if the learner navigates to the form and their application has been approved.

    8. +
    9. The Application Approved No Discount text is displayed if the learner navigates to the form and their application has been approved, but they’ve been approved for a zero-value tier. (In other words, the learner has exceeded the upper limit of flexible pricing.)

    10. +
    11. The Application Denied text is displayed if the learner navigates to the form and their application has been denied.

    12. +
    13. The Form Fields are the data that the learner must provide to be considered for flexible pricing. Leave this alone - the system will automatically add the proper fields when the form is published.

    14. +
    +
  6. +
  7. Publish the form when you are ready.

  8. +
  9. Navigate back to the course page for the course, and edit the page. Add a link to the flexible pricing form you created in the page content.

  10. +
  11. Publish the course page when you are ready.

  12. +
+

To add the Flexible Pricing form to the Price card on a course page, first get the link to the live form. This can be done on the edit page for the flexible pricing form (as well as in a few other locations within the CMS). Then, add that link to the Link field in the Price card for the course.

+

To generate a Flexible Pricing request form with some reasonable defaults for your courseware object, use the create_finaid_form management command:

+
$ manage.py create_finaid_form [--force] [--slug <slug name here>] [--title <title here>] courseware-readable-id
+
+
+

This command will create an appropriate flexible pricing form for the courseware object:

+
    +
  • If you’ve specified a Program, the form will be located under the program’s page in the CMS.

  • +
  • If you’ve specified a standalone Course, the form will be located under the course’s page in the CMS.

  • +
  • If you’ve specified a Course that is in a Program, the form will be located under the program’s page in the CMS, unless the --force option is specified. In that case, the form will be under the course page.

  • +
+

You can customize the title and slug using their respective options. By default, the system will use the object’s title to generate a form title and slug.

+
+
+

Processing Submitted Request§

+

TBD

+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/ecommerce/index.html b/ecommerce/index.html new file mode 100644 index 0000000000..25589d4bff --- /dev/null +++ b/ecommerce/index.html @@ -0,0 +1,217 @@ + + + + + + + + Ecommerce — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/ecommerce/overview.html b/ecommerce/overview.html new file mode 100644 index 0000000000..1f55294698 --- /dev/null +++ b/ecommerce/overview.html @@ -0,0 +1,233 @@ + + + + + + + + Overview — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Overview§

+
+

Goals§

+

We will be creating a robust ecommerce implementation, incorporating learnings from the last several years to implement it in a scalable and reusable way. A good reference point is this guide on Pythonic SOLID Principle. We should also strongly strive towards keeping coupling between the subsystems proposed here to a minimum or at least limited in surface area. +Core

+

The core of the ecommerce system should be simple enough to configure and operate but support enough functionality to serve a majority of our use cases. Users should be able to see programs or course runs, select them for purchase, and make a payment.

+
+
+

Prior Art§

+

We have a few implementations of ecommerce we’ve created over the years:

+
+

MicroMasters§

+

The MicroMasters implementation is highly specialized, particularly around financial aid programs where each learner gets custom pricing. Incorporating this level of complexity into the core of the ecommerce system is not something we want to do, but we should carve out some options to extend the system in the future without implementing it in the core system.

+
+
+

xPro§

+

xPro ecommerce was implemented based on our experiences implementing ecommerce in MicroMasters. A good amount of planning went into this implementation, although it also has some specializations we wouldn’t be using in MITx Online such as a vouchers system. We will probably borrow heavily from the core designs that were proved out here.

+
+
+
+

Core Systems§

+

Ecommerce is actually a combination of 3 discernable subsystems that often get muddled together: products, orders, and payment. See the high-level diagram below to understand the pieces of data and operations that happen.

+
+ flowchart TB + product_subsystem(Product Subsystem) + basket_subsystem(Basket Subsystem) + order_subsystem(Order Subsystem) + discount_subsystem(Discount Subsystem) + payment_subsystem(Payment Subsystem) + + cybersource(CyberSource) + + basket_subsystem --> order_subsystem + discount_subsystem --> order_subsystem + order_subsystem & basket_subsystem & discount_subsystem --> product_subsystem + order_subsystem <--> payment_subsystem + payment_subsystem <--> cybersource + +
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/ecommerce/subsystems/basket.html b/ecommerce/subsystems/basket.html new file mode 100644 index 0000000000..0761d854cf --- /dev/null +++ b/ecommerce/subsystems/basket.html @@ -0,0 +1,219 @@ + + + + + + + + Basket Subsystem — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Basket Subsystem§

+

This tracks products intended to be purchased, often providing some additional state such as which runs under a program a user is purchasing.

+

A simple schema for this would be:

+
class Basket(TimestampedModel):
+    """Represents a User's basket."""
+
+    user = models.OneToOneField(settings.AUTH_USER_MODEL)
+
+class BasketItem(TimestampedModel):
+    """Represents one or more products in a user's basket."""
+
+    product = models.ForeignKey(Product)
+    basket = models.ForeignKey(Basket)
+    quantity = models.PositiveIntegerField()
+
+
+
+

APIs§

+
    +
  • GET  /api/v0/basket/ -> get the current basket state

  • +
  • POST /api/v0/basket/ -> update the basket state

  • +
+
+
+

Notes§

+

The implementation of this would use the discount subsystem to calculate the discounted prices, those values would be returned in the API for the frontend to use for display purposes.

+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/ecommerce/subsystems/discount.html b/ecommerce/subsystems/discount.html new file mode 100644 index 0000000000..6811b32fa3 --- /dev/null +++ b/ecommerce/subsystems/discount.html @@ -0,0 +1,284 @@ + + + + + + + + Discount Subsystem — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Discount Subsystem§

+

Discounts will need to be provided on occasion, these give the user a reduced price for some or all products. Treating this as a discount system and not necessarily a coupon system (e.g. a coupon is a kind of discount) is a good way to frame this approach.

+

The discount system would support discounts of multiple types. We’ve done discounts a lot of different ways before so we need to balance out flexibility against keeping complexity down. Each discount would be associated with a certain Product.

+

A discount may optionally be pre-associated with a User so that it can be automatically applied on checkout.

+

Discounts should only be computed on the backend, some of our ecommerce implementations have computed the discount on the frontend and we want to avoid this going forward.

+
+

Discount Types§

+

Discount types would track how the discounted price is computed, some examples/ideas: +percent-off: a percentage off the original price +dollars-off: a fixed dollar reduction in price (e.g. $30 off) +fixed-price: the price is discounted to the fixed price (e.g. a product would cost $100 regardless of what the original price was)

+
+
+

Redemption Types§

+

There may be a few different ways we want to track discount usage, for example:

+

one-time: the discount can only be used once by anyone +one-time-per-user: the discount can be used once per user +unlimited: the discount can be used any number of times

+
+
+

Data Models§

+
class Discount(TimestampedModel):
+    """Discount model"""
+    amount = models.DecimalField(
+        decimal_places=5,
+        max_digits=20,
+    )
+    automatic = models.BooleanField(default=False)
+    discount_type = models.CharField(
+        choices=DISCOUNT_TYPES, max_length=30
+    )
+    redemption_type = models.CharField(
+        choices=REDEMPTION_TYPES, max_length=30
+    )
+    max_redemptions = models.PositiveIntegerField(null=True)
+
+class UserDiscount(TimestampedModel):
+    """pre-assignment for a discount to a user"""
+    discount = models.ForeignKey(Discount)
+    user = models.ForeignKey(User)
+
+
+
+
+

Implementation Proposal§

+

Rather than codifying the discount logic in a complicated computation function, discount types can be implemented by abstracting the logic around discounts into a registry-driven discount factory like this:

+
import abc
+from dataclasses import dataclass
+
+
+@dataclass
+class DiscountType(abc.ABC):
+    _CLASSES = {}
+
+    discount: Discount
+
+    # see https://www.python.org/dev/peps/pep-0487/
+    def __init_subclass__(cls, *, discount_type, **kwargs):
+        super().__init_subclass__(**kwargs)
+
+        if discount_type in _CLASSES:
+            raise TypeError(f"{discount_type} already defined for DiscountType")
+
+        cls.discount_type = discount_type
+        cls._CLASSES[discount_type] = cls
+
+    @classmethod
+    def for_discount(cls, discount: Discount):
+        DiscountTypeCls = cls._CLASSES[discount.discount_type]
+
+        return DiscountTypeCls(discount)
+
+    def get_product_price(self, product: Product):
+        return self.get_product_version_price(product.latest_version)
+
+    @abc.abstractmethod
+    def get_product_version_price(self, product_version: ProductVersion):
+        ...
+
+class PercentDiscount(DiscountType, discount_type=Discount.PERCENT_DISCOUNT):
+
+    def get_product_version_price(self, product_version: ProductVersion):
+        return product_version.price * self.discount.amount
+
+class FixedPriceDiscount(DiscountType, discount_type=Discount.PERCENT_DISCOUNT):
+
+    def get_product_version_price(self, product_version: ProductVersion):
+        return self.discount.amount  # the amount here is the fixed price
+
+
+

With this implementation, prices before ordering would use get_product_price, whereas the receipt service would use get_product_version_price on the purchased versions. This makes it far more scalable to introduce new discount types without having to refactor existing code.

+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/ecommerce/subsystems/index.html b/ecommerce/subsystems/index.html new file mode 100644 index 0000000000..6e37ee38f6 --- /dev/null +++ b/ecommerce/subsystems/index.html @@ -0,0 +1,223 @@ + + + + + + + + Subsystems — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/ecommerce/subsystems/order.html b/ecommerce/subsystems/order.html new file mode 100644 index 0000000000..06b669d2aa --- /dev/null +++ b/ecommerce/subsystems/order.html @@ -0,0 +1,220 @@ + + + + + + + + Order Subsystem — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Order Subsystem§

+

Orders represent a payment for some kind of product(s), these products will typically be either Programs or Course Runs. An order is marked as unfulfilled initially and then marked as fulfilled once a payment is completed. An order can fail or be refunded.

+
+

Data Model§

+
class Order(TimestampedModel):
+    """An order containing information for a purchase."""
+    status = models.CharField()
+    purchaser = models.ForeignKey(settings.AUTH_USER_MODEL)
+    total_price_paid = models.DecimalField()
+
+class Line(TimestampedModel):
+    """A line in an Order."""
+
+    order = models.ForeignKey(Order)
+    product_version = models.ForeignKey(ProductVersion)
+    quantity = models.PositiveIntegerField()
+
+class Transaction(TimestampedModel):
+    """A transaction on an order, generally a payment but can also cover refunds"""
+    order = models.ForeignKey(Order)
+    amount = models.DecimalField(
+        decimal_places=5,
+        max_digits=20,
+    )
+    data = models.JSONField()
+
+
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/ecommerce/subsystems/payment.html b/ecommerce/subsystems/payment.html new file mode 100644 index 0000000000..936e854d29 --- /dev/null +++ b/ecommerce/subsystems/payment.html @@ -0,0 +1,194 @@ + + + + + + + + Payment Subsystem — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Payment Subsystem§

+

The payment subsystem takes unfulfilled orders, takes the user through payment completion, and finally marks the order as fulfilled. We historically and for the foreseeable future use CyberSource, but this should be strongly decoupled from the rest of the ecommerce system and made pluggable for future flexibility. This system would also be responsible for any webhooks/callbacks that the payment processor makes to us.

+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/ecommerce/subsystems/product.html b/ecommerce/subsystems/product.html new file mode 100644 index 0000000000..996eec56aa --- /dev/null +++ b/ecommerce/subsystems/product.html @@ -0,0 +1,216 @@ + + + + + + + + Product Subsystem — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Product Subsystem§

+

The product subsystem is responsible for tracking all product-related data. Purchasable products are typically Programs and Course Runs. Pricing information is tracked as immutable data for the sake of historically accurate pricing for orders.

+
+

Data Models§

+
@reversion.register(exclude=("content_type", "object_id", "created_on", "updated_on"))
+class Product(TimestampedModel):
+    """
+    Representation of a purchasable product. There is a GenericForeignKey to a Course or Program.
+    """
+    content_type = models.ForeignKey(ContentType)
+    object_id = models.PositiveIntegerField()
+    content_object = GenericForeignKey("content_type", "object_id")
+
+
+

This will utilize django-reversion to version product data.

+
+
+

APIs§

+

The API that would be primarily needed would be one to read back product data. It is presumed that data entry is done through django-admin:

+
    +
  • GET /api/v0/products/ -> returns a paginated list of products

  • +
  • GET /api/v0/products/1/ -> returns a single product

  • +
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/ecommerce/subsystems/reporting.html b/ecommerce/subsystems/reporting.html new file mode 100644 index 0000000000..796da28b26 --- /dev/null +++ b/ecommerce/subsystems/reporting.html @@ -0,0 +1,205 @@ + + + + + + + + Reporting Subsystem — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ +
+

Reporting Subsystem§

+

OL marketing and finance team need to include financial data in their reporting, so they can evaluate and plan campaigns, reconcile accounts, and payout royalties. As a guiding principle, we want to be able to report on any data that is collected by the ecommerce system, but avoid supplementing the data with external considerations (such as marketing costs, or payout rates).

+
+

Use Cases§

+
+

MicroMasters§

+

Most of MicroMasters programs and courses function the same as any other MITx course, they wouldn’t otherwise be treated any differently except for marketing purposes, which are out of scope for this document if not MITx Online altogether.

+
+
+

DEDP§

+

The DEDP program as it is implemented currently is a special case when it comes to ecommerce - DEDP currently supports financial aid. This essentially amounts to a discount to a lower fixed rate. There are a few tiers of financial aid discounts available, but this is easily handled with a couple of preconfigured discounts. We’d need a UI somewhere that enables staff to assign a discount to a particular learner. That discount would then automatically apply to courses within that program, the same as any other program-scoped discount.

+
+
+
+ +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/genindex.html b/genindex.html new file mode 100644 index 0000000000..2a4f2ad543 --- /dev/null +++ b/genindex.html @@ -0,0 +1,140 @@ + + + + + + + Index — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + +
+
+
+
+ + +

Index

+ +
+ +
+ + +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000000..c7288a3193 --- /dev/null +++ b/index.html @@ -0,0 +1,201 @@ + + + + + + + + Welcome to MITx Online Documentation’s documentation! — MITx Online documentation + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ +
+ +
+
+ +
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/objects.inv b/objects.inv new file mode 100644 index 0000000000..2012f17cd6 Binary files /dev/null and b/objects.inv differ diff --git a/search.html b/search.html new file mode 100644 index 0000000000..82bc66e895 --- /dev/null +++ b/search.html @@ -0,0 +1,163 @@ + + + + + + + Search — MITx Online documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ +
+ +
+ +
+
+
+
+ + + + +
+
+
+
+ +

Search

+ + + + +

+ Searching for multiple words only shows matches that contain + all words. +

+ + +
+ + + +
+ + +
+ + +
+
+
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/searchindex.js b/searchindex.js new file mode 100644 index 0000000000..bcd2e246f4 --- /dev/null +++ b/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({"alltitles": {"APIs": [[24, "apis"], [29, "apis"]], "Add /etc/hosts alias for Open edX": [[17, "add-etc-hosts-alias-for-open-edx"]], "Authentication": [[0, null]], "Basket Subsystem": [[24, null]], "Batch Generating Codes": [[8, "batch-generating-codes"]], "Checks": [[4, "checks"]], "Clone edx/devstack": [[17, "clone-edx-devstack"]], "Configuration": [[16, null]], "Configure HubSpot": [[15, null]], "Configure Logout": [[17, "configure-logout"]], "Configure MITx Online as a OAuth provider for Open edX": [[17, "configure-mitx-online-as-a-oauth-provider-for-open-edx"]], "Configure Open edX": [[17, null]], "Configure Open edX to support OAuth2 authentication from MITx Online": [[17, "configure-open-edx-to-support-oauth2-authentication-from-mitx-online"]], "Configure Open edX user and token for use with MITx Online management commands": [[17, "configure-open-edx-user-and-token-for-use-with-mitx-online-management-commands"]], "Configure eCommerce": [[14, null]], "Contents:": [[10, null], [31, null]], "Core Systems": [[23, "core-systems"]], "DEDP": [[30, "dedp"]], "Data Model": [[27, "data-model"]], "Data Models": [[25, "data-models"], [29, "data-models"]], "Discount Subsystem": [[25, null]], "Discount Types": [[25, "discount-types"]], "Ecommerce": [[22, null]], "Example": [[9, "example"]], "Flexible Pricing": [[21, null]], "Form Creation": [[21, "form-creation"]], "Goals": [[23, "goals"]], "Implementation Proposal": [[25, "implementation-proposal"]], "In MITx Online": [[14, "in-mitx-online"]], "In Open edX": [[14, "in-open-edx"]], "Indices and tables": [[10, "indices-and-tables"], [31, "indices-and-tables"]], "Install from local Build": [[17, "install-from-local-build"], [17, "id2"]], "Install openedx-companion-auth in LMS": [[17, "install-openedx-companion-auth-in-lms"]], "Install social-auth-mitxpro in LMS": [[17, "install-social-auth-mitxpro-in-lms"]], "Install via pip": [[17, "install-via-pip"], [17, "id1"]], "Local Open edX Tutor and MITx Online Deployment": [[19, null]], "MITx Online Commands": [[10, null]], "MITx Online Quick Start": [[18, null]], "MITx Online Setup": [[19, "mitx-online-setup"]], "MicroMasters": [[23, "micromasters"], [30, "micromasters"]], "Notes": [[18, "notes"], [24, "notes"]], "Options": [[1, "options"], [2, "options"], [3, "options"], [4, "options"], [5, "options"], [6, "options"], [7, "options"], [8, "options"], [9, "options"], [11, "options"], [12, "options"], [13, "options"]], "Order Subsystem": [[27, null]], "Other Notes": [[19, "other-notes"]], "Output": [[8, "output"]], "Overview": [[23, null]], "Payment Subsystem": [[28, null]], "Performing a Quick Start": [[18, "performing-a-quick-start"]], "Preliminary Steps": [[19, "preliminary-steps"]], "Prior Art": [[23, "prior-art"]], "Processing Submitted Request": [[21, "processing-submitted-request"]], "Product Subsystem": [[29, null]], "Pull latest images and run provision": [[17, "pull-latest-images-and-run-provision"]], "Put it all together": [[20, "put-it-all-together"]], "Redemption Types": [[25, "redemption-types"]], "Reporting Subsystem": [[30, null]], "Results": [[18, "results"]], "Set Up MITx Online eCommerce Config": [[14, "set-up-mitx-online-ecommerce-config"]], "Set Up a Course": [[14, "set-up-a-course"]], "Set up Locust": [[20, "set-up-locust"]], "Set up uwsgitop": [[20, "set-up-uwsgitop"]], "Setting Up a Product": [[14, "setting-up-a-product"]], "Setting up uWsgi tuning for MITx Online": [[20, null]], "Setup Open edX Devstack": [[17, "setup-open-edx-devstack"]], "Setup social auth": [[17, "setup-social-auth"]], "Start your servers": [[17, "start-your-servers"]], "Stop your servers": [[17, "stop-your-servers"]], "Subsystems": [[26, null]], "Syntax": [[1, "syntax"], [2, "syntax"], [3, "syntax"], [4, "syntax"], [5, "syntax"], [6, "syntax"], [7, "syntax"], [8, "syntax"], [9, "syntax"], [11, "syntax"], [12, "syntax"], [13, "syntax"]], "Testing Checkout": [[14, "testing-checkout"]], "To set up locally:": [[20, "to-set-up-locally"]], "To test:": [[20, "to-test"]], "Tutor Setup, Part One": [[19, "tutor-setup-part-one"]], "Tutor Setup, Part Two": [[19, "tutor-setup-part-two"]], "Use Cases": [[30, "use-cases"]], "Welcome to MITx Online Documentation\u2019s documentation!": [[31, null]], "check_program_requirements": [[1, null]], "configure_instance": [[2, null]], "configure_tiers": [[3, null]], "create_courseware": [[4, null]], "create_courseware_page": [[5, null]], "create_product": [[6, null]], "create_user": [[7, null]], "generate_discount_code": [[8, null]], "import_courserun": [[9, null]], "refund_fulfilled_order": [[11, null]], "regenerate_edx_auth_tokens": [[12, null]], "resolve_pending_order": [[13, null]], "xPro": [[23, "xpro"]]}, "docnames": ["authentication", "commands/check_program_requirements", "commands/configure_instance", "commands/configure_tiers", "commands/create_courseware", "commands/create_courseware_page", "commands/create_product", "commands/create_user", "commands/generate_discount_code", "commands/import_courserun", "commands/index", "commands/refund_fulfilled_order", "commands/regenerate_edx_auth_tokens", "commands/resolve_pending_order", "configuration/ecommerce", "configuration/hubspot", "configuration/index", "configuration/open_edx", "configuration/quickstart", "configuration/tutor", "configuration/uwsgi_tuning", "ecommerce/flexible_pricing", "ecommerce/index", "ecommerce/overview", "ecommerce/subsystems/basket", "ecommerce/subsystems/discount", "ecommerce/subsystems/index", "ecommerce/subsystems/order", "ecommerce/subsystems/payment", "ecommerce/subsystems/product", "ecommerce/subsystems/reporting", "index"], "envversion": {"sphinx": 62, "sphinx.domains.c": 3, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 9, "sphinx.domains.index": 1, "sphinx.domains.javascript": 3, "sphinx.domains.math": 2, "sphinx.domains.python": 4, "sphinx.domains.rst": 2, "sphinx.domains.std": 2}, "filenames": ["authentication.rst", "commands/check_program_requirements.rst", "commands/configure_instance.rst", "commands/configure_tiers.rst", "commands/create_courseware.rst", "commands/create_courseware_page.rst", "commands/create_product.rst", "commands/create_user.rst", "commands/generate_discount_code.rst", "commands/import_courserun.rst", "commands/index.rst", "commands/refund_fulfilled_order.rst", "commands/regenerate_edx_auth_tokens.rst", "commands/resolve_pending_order.rst", "configuration/ecommerce.rst", "configuration/hubspot.rst", "configuration/index.rst", "configuration/open_edx.rst", "configuration/quickstart.rst", "configuration/tutor.rst", "configuration/uwsgi_tuning.rst", "ecommerce/flexible_pricing.rst", "ecommerce/index.rst", "ecommerce/overview.rst", "ecommerce/subsystems/basket.rst", "ecommerce/subsystems/discount.rst", "ecommerce/subsystems/index.rst", "ecommerce/subsystems/order.rst", "ecommerce/subsystems/payment.rst", "ecommerce/subsystems/product.rst", "ecommerce/subsystems/reporting.rst", "index.rst"], "indexentries": {}, "objects": {}, "objnames": {}, "objtypes": {}, "terms": {"": [2, 3, 4, 7, 8, 9, 11, 12, 13, 14, 17, 19, 20, 21, 24, 27], "0": [3, 8, 17, 19, 20], "000": 3, "0487": 25, "1": [13, 14, 17, 19, 29], "10": 19, "100": [8, 13, 25], "1000": 9, "10000": 20, "101": [18, 19], "11": 19, "111": 14, "12": 19, "123": 14, "127": [17, 19], "13": 8, "14": 14, "16": 19, "172": 17, "18000": 17, "19": 17, "19817792": 15, "1g": 20, "1t2023": 9, "2": [14, 17, 20], "20": [25, 27], "2030": 19, "25": 3, "3": [19, 23], "30": 25, "300": 19, "37": 8, "378282246310005": 14, "3t2022": 14, "4": 14, "4111111111111111": 14, "4242424242424242": 14, "5": [25, 27], "50": [3, 8], "500": [3, 19, 20], "5105105105105100": 14, "5555555555554444": 14, "6011111111111117": 14, "650": 3, "75": 3, "750": 3, "750x": 14, "8": 19, "8013": [17, 19], "8089": 20, "8601": 8, "9": 19, "999": [14, 18], "A": [1, 14, 19, 23, 24, 25, 27], "As": [19, 30], "At": [11, 14, 18, 19], "By": [1, 5, 6, 21], "For": [2, 4, 6, 8, 14, 17, 18, 19], "If": [1, 2, 3, 4, 5, 9, 11, 12, 14, 17, 18, 19, 21], "In": [2, 3, 12, 15, 17, 18, 19, 20, 21], "It": [4, 18, 19, 29], "No": 21, "On": [19, 21], "One": [2, 4, 8, 16], "Or": 9, "That": 30, "The": [2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 17, 18, 19, 21, 23, 24, 25, 28, 29, 30], "Then": [19, 21], "There": [17, 19, 20, 25, 29, 30], "These": [3, 14, 18, 19, 21], "To": [9, 14, 17, 18, 19, 21], "With": 25, "_": 9, "__init_subclass__": 25, "_class": 25, "_if": 9, "_privat": [17, 19], "abbrev": 3, "abbrevi": 3, "abc": 25, "abl": [14, 19, 21, 23, 30], "about": [5, 18], "abov": [14, 19], "abstract": 25, "abstractmethod": 25, "accept": [13, 14], "access": [12, 17, 19, 21], "access_token_url": [17, 19], "accesstoken": [17, 19], "accordingli": 11, "account": [2, 7, 14, 15, 17, 18, 19, 30], "accur": 29, "activ": [6, 8, 9, 14, 19], "actual": [3, 14, 17, 19, 23], "ad": [4, 5, 14, 18, 20], "add": [2, 4, 8, 14, 15, 18, 19, 20, 21], "addit": [3, 18, 24], "addition": [2, 14], "additionali": 2, "address": [7, 12], "adjust": [9, 11, 14, 18, 19], "admin": [9, 14, 17, 19, 29], "after": [4, 9, 20], "afterward": [11, 18], "again": [17, 19, 21], "against": 25, "aid": [3, 23, 30], "alias": 19, "all": [1, 3, 8, 9, 13, 17, 19, 25, 29], "allow": [2, 14, 21], "allow_public_account_cr": 17, "alon": 21, "alreadi": [2, 3, 8, 9, 11, 14, 17, 19, 25], "also": [1, 4, 5, 9, 12, 14, 17, 19, 23, 27, 28], "altern": [8, 14, 21], "although": 23, "altogeth": 30, "american": 14, "amex": 14, "amount": [3, 8, 23, 25, 27, 30], "an": [1, 4, 7, 8, 9, 12, 13, 14, 17, 18, 19, 20, 21, 27], "ani": [2, 3, 4, 8, 9, 11, 14, 25, 28, 30], "annual": 21, "anoth": 19, "anyon": 25, "anyth": [1, 12, 14, 19], "api": [1, 9, 14, 19, 26], "api_root": [17, 19], "app": [14, 17, 19, 20], "appear": 14, "append": [8, 19], "appli": [4, 9, 19, 25, 30], "applic": [2, 9, 17, 18, 19, 20, 21], "approach": 25, "appropri": [12, 18, 21], "approv": 21, "ar": [2, 3, 5, 6, 8, 12, 14, 17, 18, 19, 21, 29, 30], "arbitrari": 17, "area": 23, "aren": [14, 19, 21], "arm": 19, "around": [14, 19, 23, 25], "arrai": 17, "art": 22, "ask": [14, 15], "assign": [1, 4, 9, 25, 30], "assist": [3, 18], "associ": [4, 9, 11, 25], "assum": [4, 8], "attempt": [9, 18, 19], "attent": 19, "audit": [7, 11], "auth": [16, 19], "auth_user_model": [24, 27], "authent": [12, 16, 19, 31], "authentication_backend": 19, "authn": 19, "author": [17, 19], "authorization_url": [17, 19], "automat": [8, 21, 25, 30], "avail": [19, 30], "avoid": [14, 25, 30], "back": [21, 29], "backend": [17, 19, 25], "balanc": 25, "base": [9, 19, 21, 23], "basi": 9, "basic": [4, 5, 9, 18], "basket": [22, 26], "basketitem": 24, "batch": [9, 10], "becaus": 19, "becom": 8, "been": [14, 19, 21], "befor": [3, 4, 14, 25], "begin": [14, 19], "being": [8, 19, 21], "belong": 9, "below": [3, 18, 23], "best": [4, 14, 19], "between": [8, 23], "beyond": 14, "black": 19, "blank": 18, "block": [19, 20], "boilerpl": 18, "booleanfield": 25, "bootstrap": [14, 19], "borrow": [20, 23], "both": [1, 4, 14, 17, 19], "bounc": 19, "break": 19, "bring": 14, "brows": 19, "browser": [19, 20], "build": [19, 20], "bump": 17, "busi": 14, "button": [14, 19, 21], "caddi": 2, "calcul": 24, "call": [1, 9, 11, 12], "callback": 28, "campaign": 30, "can": [1, 3, 4, 8, 9, 11, 13, 14, 17, 18, 19, 20, 21, 25, 27, 30], "cancel": 13, "card": [14, 21], "care": 18, "cart": 14, "carv": 23, "case": [2, 9, 14, 18, 21, 23, 26], "cd": [17, 19], "center": 14, "certain": 25, "chang": [3, 11, 17, 19, 20], "charact": 8, "charfield": [25, 27], "charg": 14, "check": [1, 9, 10, 14, 17, 19], "check_program_for_orphan": 1, "check_program_requir": [10, 31], "checkbox": [17, 19], "checkout": [17, 25], "child": [14, 21], "choic": 25, "choos": 14, "chooser": 14, "cl": 25, "clariti": 14, "class": [24, 25, 27, 29], "classmethod": 25, "clean": 11, "click": [19, 21], "client": [2, 17, 18, 19], "clog": 1, "clone": 19, "close": 19, "cm": [5, 9, 14, 17, 18, 21], "cname": 19, "code": [3, 7, 10, 13, 14, 17, 18, 19, 25], "codifi": 25, "collect": 30, "com": [14, 17], "combin": [1, 23], "come": [11, 14, 19, 20, 30], "command": [2, 3, 4, 8, 9, 11, 12, 16, 18, 19, 20, 21, 31], "common": 3, "commun": 18, "companion": 19, "compat": 19, "complet": [17, 18, 19, 27, 28], "complex": [23, 25], "complic": 25, "compos": [17, 19, 20], "comps": 19, "comput": 25, "confidenti": [17, 19], "config": [16, 17, 19], "configur": [2, 3, 9, 18, 19, 23, 31], "configure_inst": [10, 18, 19, 31], "configure_ti": [10, 18, 31], "configure_wagtail": [18, 19], "confus": 19, "connect": 15, "consid": 21, "consider": 30, "consist": 19, "contain": [4, 17, 19, 27], "content": [14, 18, 21], "content_object": 29, "content_typ": 29, "contenttyp": 29, "convert": 19, "copi": [14, 17, 20], "core": 22, "correspond": [2, 18], "cost": [25, 30], "count": 8, "countri": [7, 17, 18], "countrycod": 7, "coupl": [14, 18, 19, 23, 30], "coupon": 25, "cours": [1, 2, 3, 4, 5, 6, 7, 9, 11, 16, 18, 19, 21, 23, 27, 29, 30], "course_detail": 9, "courseid": 7, "courserun": [4, 6, 9], "coursewar": [4, 5, 6, 9, 14, 18, 21], "cover": 27, "cp": 20, "cpu": 20, "creat": [2, 3, 4, 5, 6, 7, 8, 9, 14, 17, 18, 19, 21, 23], "create_coursewar": [3, 9, 10, 18, 31], "create_courseware_pag": [9, 10, 18, 31], "create_finaid_form": [18, 21], "create_product": [10, 18, 31], "create_run": 4, "create_us": [10, 18, 31], "created_on": 29, "createsuperus": 18, "createus": 19, "creation": [2, 4, 22], "credenti": [14, 18], "credit": 14, "criteria": 1, "csv": [3, 8], "current": [3, 4, 14, 24, 30], "custom": [18, 21, 23], "customiz": 21, "cvn": 14, "cybersourc": [11, 13, 14, 28], "d": [2, 6, 19, 30], "dash": 8, "dashboard": 19, "data": [9, 14, 17, 19, 21, 23, 26, 30], "databas": 9, "dataclass": 25, "date": [4, 8, 9, 14, 19], "dc": 19, "decimal_plac": [25, 27], "decimalfield": [25, 27], "decoupl": 28, "dedp": [1, 3, 9, 18], "def": 25, "default": [1, 2, 3, 4, 5, 6, 7, 8, 9, 14, 17, 18, 19, 21, 25], "defin": [8, 15, 25], "delet": 12, "demo": [2, 18], "demo_cours": [2, 18, 19], "demonstr": [2, 18, 19], "demox": [2, 18, 19], "deni": 21, "depart": [4, 9], "department_nam": [4, 9], "depend": [9, 13, 14, 17, 19], "deploi": 20, "deploy": [2, 16, 31], "dept": [4, 9], "deriv": 17, "describ": 19, "descript": [6, 9, 14], "design": 23, "detail": [4, 18], "determin": 6, "dev": [2, 15, 17, 19, 25], "develop": [14, 15, 17, 19], "devstack": [14, 16, 18, 19], "diagram": 23, "dialog": [17, 19], "differ": [14, 17, 25, 30], "digit": 14, "directli": 20, "directori": 17, "disabl": [2, 18, 19], "discern": 23, "discount": [3, 8, 18, 21, 22, 24, 26, 30], "discount_typ": 25, "discounttyp": 25, "discounttypecl": 25, "discov": 14, "discusss": 20, "displai": [7, 14, 18, 21, 24], "displaynam": 7, "dist": 17, "django": [9, 14, 17, 19, 29], "do": [4, 9, 12, 14, 18, 19, 21, 23], "docker": [2, 17, 19, 20], "document": [14, 18, 19, 30], "docusign": 21, "doe": [1, 9, 11, 14, 18, 19], "doesn": [4, 9, 12, 17, 18, 19], "dollar": [3, 8, 25], "domain": 19, "don": [2, 3, 8, 9, 18, 19], "done": [21, 25, 29], "dont": [2, 18], "doubl": [14, 19], "down": 25, "draft": 5, "driven": 25, "e": [1, 9, 13, 19, 20, 25], "e2": [18, 19], "each": [9, 14, 18, 23, 25], "earlier": 14, "easi": [6, 19], "easili": 30, "ebc": 14, "ebc2": 14, "ebc2test": 14, "ecommerc": [16, 23, 25, 28, 30, 31], "ecommerce_default_payment_gatewai": 14, "econom": 9, "edit": [2, 14, 19, 21], "edli": [2, 19], "edu": 14, "edx": [2, 4, 9, 12, 16, 18, 31], "edx_hostnam": 17, "edxapp": 17, "either": [1, 2, 9, 12, 13, 14, 18, 19, 27], "elect": 4, "els": 14, "elsewher": 14, "email": [7, 12, 14, 18, 19], "empti": 9, "enabl": [17, 19, 30], "enable_authn_microfrontend": 19, "enable_combined_login_registr": 17, "enable_oauth2_provid": 17, "enable_third_party_auth": [17, 19], "end": [4, 9, 14, 18, 19], "enough": 23, "enrol": [2, 4, 7, 9, 11, 12, 14, 18], "ensur": [4, 17, 19], "enter": 18, "enterpris": 14, "entir": 19, "entri": [17, 19, 29], "env": [14, 15, 17, 19, 20], "environ": [14, 18, 19], "envrion": 15, "error": [1, 3, 19], "especi": [18, 19], "essenc": 12, "essenti": 30, "etc": 19, "evalu": [14, 30], "ever": 19, "everyth": 19, "ex": 14, "exampl": [8, 10, 14, 17, 19, 20, 25], "exceed": 21, "except": 30, "exclud": 29, "exec": 20, "exist": [1, 2, 3, 4, 8, 9, 17, 18, 19, 25], "expect": [11, 19], "experi": 23, "expir": [8, 14, 19], "explicitli": [8, 19], "export": 19, "express": 14, "extend": 23, "extens": 19, "extern": 30, "external_mitx_online_host": 17, "f": [4, 20, 25], "fa": 3, "factori": 25, "fail": [9, 14, 27], "fairli": 14, "fals": [9, 19, 25], "far": 25, "fashion": 9, "favor": 19, "featur": [5, 14, 17, 19], "fetch": 19, "few": [9, 18, 21, 23, 25, 30], "field": [3, 5, 14, 17, 21], "file": [3, 8, 14, 15, 17, 19, 20], "fill": [14, 17, 21], "final": [4, 19, 28], "financ": 30, "financi": [3, 18, 23, 30], "find": [9, 14, 19], "first": [7, 18, 19, 21], "firstnam": 7, "fit": 1, "fix": [8, 25, 30], "fixedpricediscount": 25, "flag": [4, 9, 18], "flexibil": 21, "flexibl": [22, 25, 28, 31], "flip": 19, "folder": [14, 17, 19], "follow": [3, 4, 8, 9, 15, 17, 18, 19, 20, 21], "for_discount": 25, "forc": [4, 21], "foreignkei": [24, 25, 27, 29], "forese": 28, "form": [14, 17, 18, 19, 22], "format": [3, 8], "former": 19, "forward": 25, "found": [13, 14, 17], "four": 14, "frame": 25, "fresh": [2, 18], "from": [4, 9, 11, 14, 16, 19, 20, 23, 25, 28], "front": 4, "frontend": [24, 25], "fulfil": [11, 13, 27, 28], "full": 17, "fulli": 19, "function": [23, 25, 30], "furthermor": 9, "futur": [14, 23, 28], "g": [1, 9, 13, 20, 25], "gatewai": [2, 11, 14, 17, 19], "gateway_ip": 17, "gener": [10, 12, 14, 19, 21, 27], "generate_discount_cod": [10, 31], "genericforeignkei": 29, "get": [9, 11, 12, 18, 19, 21, 23, 24, 29], "get_product_pric": 25, "get_product_version_pric": 25, "git": 17, "github": [17, 19], "give": [14, 19, 25], "given": [5, 6, 14], "go": [17, 19, 20, 25], "goal": 22, "good": [14, 23, 25], "grade": 12, "grant": [17, 19], "grep": 19, "guest": 21, "guid": [19, 23, 30], "gz": 17, "ha": [1, 9, 14, 18, 19, 21, 23], "had": [3, 19], "half": 18, "hand": [5, 18], "handi": 19, "handl": [9, 30], "happen": 23, "have": [3, 5, 9, 11, 12, 14, 17, 19, 21, 23, 25], "haven": [14, 18, 19, 21], "header": [3, 21], "heavili": 23, "help": [18, 20], "here": [9, 14, 17, 19, 21, 23, 25], "hero": 14, "heroku": 14, "hidden": [17, 19], "high": [20, 23], "highli": [19, 23], "hint": [17, 19], "histor": [28, 29], "home": 14, "homepag": [5, 14], "host": 19, "hostnam": 17, "how": [18, 25], "howev": 14, "http": [14, 17, 19, 20, 25], "hubspot_pipeline_id": 15, "i": [1, 2, 3, 4, 5, 6, 8, 9, 11, 12, 13, 14, 17, 18, 19, 20, 21, 23, 24, 25, 27, 29, 30], "id": [1, 2, 3, 4, 5, 6, 9, 12, 14, 17, 18, 19, 21], "ida_logout_uri_list": [17, 19], "idea": 25, "ideal": 14, "ignor": 4, "imag": [14, 19, 20], "immut": 29, "implement": [23, 24, 26, 30], "import": [2, 9, 14, 19, 25], "import_courserun": [10, 31], "inact": 6, "includ": [17, 18, 19, 30], "incognito": 19, "incom": [3, 21], "incorpor": 23, "index": [10, 31], "individu": [1, 9], "info": [2, 3], "inform": [2, 3, 4, 8, 18, 21, 27, 29], "initi": [4, 27], "insert": 8, "inspect": [17, 19], "inspir": 17, "instal": [14, 19, 20], "instanc": [2, 9, 15, 18, 19], "instead": [11, 12, 19], "instnac": 2, "instruct": [14, 17, 19], "instructor": 9, "integr": [18, 19], "intend": 24, "interfac": 14, "intern": [17, 19], "intro": 21, "introduc": 25, "invalid": 14, "involv": [18, 19], "io": [2, 19], "ip": [2, 17, 19], "isn": [1, 4, 18, 21], "iso": 8, "isort": 19, "issu": 14, "its": 1, "itself": [19, 21], "json": 17, "jsonfield": 27, "jump": 19, "junip": 17, "just": [14, 19], "keep": [11, 19, 23, 25], "kei": [14, 17], "kind": [19, 25, 27], "kwarg": 25, "larg": [19, 20], "last": [7, 18, 19, 23], "lastnam": 7, "later": [17, 18], "latest_vers": 25, "latter": 19, "learn": [14, 23], "learner": [2, 3, 7, 8, 11, 12, 17, 18, 19, 21, 23, 30], "least": [19, 23], "leav": [18, 21], "led": 9, "length": 8, "less": [8, 14], "level": [20, 23], "librari": 14, "lift": 14, "like": [14, 17, 19, 25], "limit": [20, 21, 23], "line": 27, "link": [5, 18, 21], "linux": [2, 17, 18, 19], "list": [4, 14, 17, 29], "live": [1, 4, 5, 9, 14, 18, 19, 21], "ll": [9, 14, 18, 19, 21], "lm": 19, "load": 19, "local": [2, 15, 16, 18, 31], "local_mitx_online_alia": 17, "localhost": 19, "locat": 21, "locustfil": 20, "locustio": 20, "log": [1, 14, 19, 21], "logic": 25, "login": [17, 19], "logout": [16, 19], "logout_redirect_url": 17, "long": 19, "look": [11, 13, 17], "lot": [18, 19, 25], "lower": 30, "mac": 19, "maco": [2, 17, 18, 19], "made": [9, 19, 21, 28], "mai": [3, 9, 14, 18, 19, 25], "main": [12, 19], "major": 23, "make": [4, 5, 6, 8, 9, 11, 12, 14, 17, 19, 23, 25, 28], "manag": [9, 16, 18, 19, 21], "manual": [11, 19, 21], "mark": [18, 27, 28], "market": 30, "mastercard": 14, "match": [3, 17, 18], "matter": 19, "max": 8, "max_digit": [25, 27], "max_length": 25, "max_redempt": 25, "me": 19, "mean": [11, 13, 17, 19], "memori": 20, "mention": 20, "messag": [1, 19, 21], "method": 3, "mfe": 19, "migrat": [18, 19], "minimum": 23, "minu": 14, "miss": 19, "mistakenli": 4, "mit": 14, "mitol_hubspot_api_id_prefix": 15, "mitol_hubspot_api_private_token": 15, "mitol_payment_gateway_cybersource_access_kei": 14, "mitol_payment_gateway_cybersource_profile_id": 14, "mitol_payment_gateway_cybersource_secure_acceptance_url": 14, "mitol_payment_gateway_cybersource_security_kei": 14, "mitx": [1, 2, 9, 15, 16, 21, 23, 30], "mitx_online_servicework": 19, "mitxonlin": [13, 14, 15, 17, 18, 19], "mitxonline_default": 19, "mitxonline_gateway_ip": 19, "mitxpro": 19, "mitxprooauth2": [17, 19], "modal": 14, "mode": 3, "model": [24, 26], "modifi": 17, "monei": 11, "more": [2, 17, 18, 19, 21, 24, 25], "most": [19, 30], "mostli": 19, "muddl": 23, "multipl": [1, 8, 9, 19, 25], "must": [3, 4, 17, 21], "name": [4, 7, 8, 14, 17, 18, 19, 21], "navig": [14, 19, 21], "necessari": 19, "necessarili": 25, "need": [1, 8, 9, 14, 15, 17, 18, 19, 20, 25, 29, 30], "network": [17, 19], "new": [4, 9, 12, 14, 17, 19, 20, 21, 25], "nightli": [2, 19], "node": 1, "non": 14, "none": [2, 18], "normal": [11, 19], "note": [1, 3, 4, 8, 14, 16, 17, 26], "now": [6, 14, 19], "null": 25, "number": [6, 8, 11, 13, 14, 25], "numer": [1, 9], "o": 17, "oauth": [2, 16, 18, 19], "oauth2": [2, 16, 18, 19], "oauth2_provid": [17, 19], "oauth2providerconfig": [17, 19], "object": [4, 5, 6, 9, 14, 18, 21], "object_id": 29, "occas": 25, "ocw": 20, "odl": [17, 18, 19], "off": [3, 8, 19, 25], "often": [23, 24], "ol": [14, 30], "omit": 19, "onc": [8, 9, 19, 25, 27], "one": [3, 8, 9, 14, 17, 18, 19, 21, 24, 25, 29], "ones": [3, 9], "onetoonefield": 24, "onli": [1, 2, 4, 5, 6, 8, 9, 13, 19, 25], "onlin": [2, 9, 15, 16, 21, 23, 30], "online_default": 17, "open": [2, 16, 18, 31], "openedx": 19, "openedx_api_base_url": [9, 17, 19], "openedx_api_client_id": [17, 19], "openedx_api_client_secret": [17, 19], "openedx_ip": [17, 19], "openedx_service_worker_api_token": [17, 19], "openedx_service_worker_usernam": 19, "openedxapiauth": 12, "openedxus": 12, "oper": [3, 19, 23], "option": [10, 14, 17, 18, 19, 21, 23, 25], "order": [11, 13, 15, 17, 18, 22, 23, 25, 26, 28, 29], "org": [19, 25], "origin": 25, "osx": 17, "other": [3, 4, 11, 16, 17, 21, 30], "otherwis": [9, 13, 14, 17, 19, 30], "our": [23, 25], "out": [14, 17, 19, 21, 23, 25, 30], "output": 10, "over": [9, 14, 20, 23], "overrid": 3, "overridden": [3, 4, 19], "overview": [14, 22, 31], "overwritten": [8, 14], "own": 14, "pace": [4, 9], "packag": [17, 19], "page": [5, 9, 10, 14, 18, 19, 21, 31], "pagin": 29, "paid": 14, "part": [3, 16, 18], "particular": [19, 30], "particularli": 23, "pass": [8, 14], "password": [7, 17, 18, 19], "path": [14, 17], "payment": [11, 13, 14, 22, 23, 26, 27], "payout": 30, "paypal": 11, "peform": 18, "pencil": 21, "pend": 13, "pep": 25, "per": [8, 17, 25], "percent": [3, 8, 25], "percent_discount": 25, "percentag": 25, "percentdiscount": 25, "perform": [4, 11, 16, 19], "permit": 17, "pertin": 9, "pick": 17, "piec": 23, "place": 19, "plan": [14, 23, 30], "platform": [2, 17, 18], "plu": [14, 19], "plug": 18, "pluggabl": 28, "poetri": 20, "point": [3, 14, 19, 23], "pop": 14, "port": [2, 17, 19, 20], "positiveintegerfield": [24, 25, 27, 29], "possibl": 4, "post": [20, 24], "pre": 25, "preced": 9, "preconfigur": 30, "prefix": 8, "preliminari": 16, "present": 21, "presum": 29, "pretti": 19, "prevent": 14, "price": [6, 8, 9, 14, 18, 22, 23, 24, 25, 29, 31], "primarili": 29, "principl": [23, 30], "print": [1, 19], "print_set": 19, "printroot": 19, "prior": 22, "privat": 19, "probabl": [14, 23], "problem": 19, "process": [13, 14, 19, 22], "processor": 28, "prod": 13, "product": [5, 6, 9, 16, 17, 18, 19, 22, 23, 24, 25, 26, 27], "product_vers": [25, 27], "productvers": [25, 27], "profil": [17, 19], "program": [1, 3, 4, 9, 14, 18, 21, 23, 24, 27, 29, 30], "progress": 21, "project": [17, 19], "prompt": [7, 18], "proper": [2, 19, 21], "properli": [14, 18, 19], "propos": [23, 26], "protocol": 17, "prove": 23, "provid": [3, 16, 18, 19, 21, 24, 25], "prune": 19, "publish": [14, 18, 21], "pull": 4, "punctuat": 8, "purchas": [14, 23, 24, 25, 27, 29], "purpos": [24, 30], "put": [14, 17, 19], "py": [9, 17, 19, 20, 21], "pyenv": 19, "python": [19, 23, 25], "qa": 14, "quantiti": [24, 27], "queu": 18, "quick": [2, 16, 19, 31], "quickstart": 19, "quit": 3, "rais": 25, "rate": 30, "rather": [19, 25], "rc": 14, "re": [2, 9, 11, 14, 18, 19], "read": [18, 29], "readabl": [1, 3, 4, 9, 14, 18, 21], "readable_id": 4, "readi": [14, 20, 21], "real": 19, "reason": [12, 21], "reboot": 19, "rebuild": 19, "receipt": 25, "recent": 17, "recommend": [6, 14, 19], "reconcil": 30, "record": [2, 4, 12, 18, 19], "redeem": 8, "redempt": 26, "redemption_typ": 25, "redirect": [17, 19], "redo": 2, "reduc": 25, "reduct": 25, "refactor": 25, "refer": [11, 13, 23], "refresh": 12, "refund": [11, 27], "regardless": [21, 25], "regener": 12, "regist": 29, "registr": [17, 19], "registration_extra_field": [17, 19], "registri": 25, "regular": 9, "relat": 29, "releas": 17, "relev": 2, "reli": [18, 19], "remov": 19, "repair_missing_courseware_record": [12, 19], "repo": 20, "report": [22, 26], "repositori": 19, "repres": [3, 24, 27], "represent": 29, "request": [4, 22], "requir": [1, 2, 3, 4, 5, 8, 9, 14, 17, 18, 19], "reset": 18, "resolv": [13, 17], "resourc": 20, "respect": 21, "respons": [28, 29], "rest": 28, "restart": [17, 19], "result": [4, 5, 13, 14, 16, 19], "return": [1, 24, 25, 29], "reus": 3, "reusabl": 23, "revers": 29, "review": 18, "revok": 12, "right": 19, "rm": [19, 20], "robust": 23, "root": [19, 20], "row": 3, "royalti": 30, "run": [2, 3, 4, 6, 7, 9, 11, 14, 18, 19, 20, 23, 24, 27, 29], "run_tag": 9, "run_url": 4, "safe": 3, "safeti": 19, "sai": 21, "said": 17, "sake": 29, "same": [9, 19, 30], "sandbox": 14, "satisfi": 20, "save": [5, 17, 19], "scalabl": [23, 25], "scale": 8, "schema": 24, "scope": [14, 30], "scratch": 19, "screen": [1, 19], "search": [10, 31], "secret": [2, 17, 18, 19], "section": [4, 5, 14, 18], "secur": 14, "see": [2, 3, 4, 14, 18, 19, 20, 21, 23, 25], "select": [14, 17, 21, 23], "self": [4, 9, 25], "semest": 9, "separ": [8, 19], "serv": 23, "servic": [19, 20, 25], "session": 19, "set": [3, 4, 6, 8, 9, 11, 16, 17, 18, 19, 24, 27], "setup": [14, 16, 20], "sever": 23, "shell": 17, "ship": 18, "should": [3, 4, 8, 9, 14, 17, 19, 20, 23, 25, 28], "show": 19, "side": [4, 12], "similar": 9, "similarli": 9, "simpl": [23, 24], "simpli": [8, 17, 21], "sinc": [2, 9], "singl": [8, 9, 29], "site": [17, 19], "skip": [9, 17, 19], "skip_email_valid": [17, 19], "slug": [17, 19, 21], "so": [1, 3, 4, 8, 11, 14, 19, 21, 25, 30], "social": [16, 19], "social_auth_mitxpro": [17, 19], "sock": 20, "solid": 23, "some": [12, 14, 19, 21, 23, 24, 25, 27], "someon": 14, "someth": [17, 23], "somewher": [19, 30], "soon": 20, "sort": 11, "special": [23, 30], "specialti": 19, "specif": [1, 9, 13, 14], "specifi": [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 18, 19, 21], "split": 18, "src": 20, "sso": [17, 19], "staff": [17, 19, 30], "stai": 19, "standalon": 21, "standard": [9, 17, 18], "start": [2, 3, 4, 9, 14, 16, 19, 31], "stat": 20, "state": [5, 13, 21, 24], "statu": [11, 13, 21, 27], "step": [9, 14, 16, 17, 18, 21], "still": [2, 19, 21], "stop": [2, 4, 8, 19], "strictli": 19, "string": 17, "strive": 23, "strongli": [23, 28], "studio": 20, "stuff": 19, "subdomain": 19, "submiss": 21, "submit": 22, "subsystem": [14, 22, 23, 31], "successfulli": 19, "suggest": 19, "super": 25, "superus": [2, 14, 18, 19], "supplement": 30, "suppli": [3, 8, 14, 19], "support": [14, 16, 23, 25, 30], "suppress": 1, "sure": [14, 17, 19], "surfac": 23, "swap": 4, "sync": [9, 14, 17, 18, 19], "sync_course_run": [4, 18], "sync_courserun": [9, 19], "syntax": 10, "system": [1, 7, 9, 11, 14, 18, 19, 21, 22, 25, 28, 30], "t": [1, 2, 3, 4, 8, 9, 11, 12, 13, 14, 17, 18, 19, 21, 23, 30], "tab": [19, 20], "tabl": 3, "tag": [4, 9, 18], "take": [4, 9, 18, 19, 28], "tar": 17, "task": [18, 19], "tbd": 21, "team": 30, "tell": 19, "termin": [19, 20], "terms_of_servic": 19, "test": [2, 18, 19], "testlearn": 18, "text": 21, "than": [14, 19, 25], "thei": [1, 3, 8, 9, 11, 17, 19, 21, 30], "them": [14, 17, 19, 23], "thi": [1, 2, 3, 4, 6, 8, 9, 11, 12, 13, 14, 17, 18, 19, 20, 21, 23, 24, 25, 28, 29, 30], "thing": [9, 19], "third_party_auth": [17, 19], "third_party_auth_backend": [17, 19], "those": 24, "three": [14, 19], "threshold": 3, "through": [9, 14, 17, 19, 21, 28, 29], "tier": [3, 18, 21, 30], "tier1": 3, "tier2": 3, "tier3": 3, "tier4": 3, "time": [1, 8, 11, 19, 25], "timestampedmodel": [24, 25, 27, 29], "titl": [4, 9, 14, 19, 21], "tmp": 20, "todai": [14, 19], "togeth": [1, 23], "token": [12, 16, 19], "too": 19, "toolkit": 17, "top": 19, "total": 8, "total_price_paid": 27, "toward": 23, "track": [24, 25, 29], "transact": [11, 14, 27], "treat": [25, 30], "tree": [1, 4], "true": [17, 19, 25], "try": [3, 19], "turn": 19, "tutor": [2, 16, 31], "tutor_local_default": 19, "twice": 18, "two": [2, 3, 8, 16, 17, 18], "txt": 19, "type": [3, 8, 14, 17, 19, 26], "typeerror": 25, "typic": [19, 27, 29], "u": [7, 17, 18, 28], "ui": 30, "under": [14, 17, 20, 21, 24], "understand": 23, "undo": 19, "unenrol": 11, "unfulfil": [27, 28], "uninstal": 17, "uniqu": 14, "unless": [18, 19, 21], "unlik": 19, "unlimit": 25, "up": [1, 3, 4, 11, 13, 16, 17, 18, 19], "upcom": 9, "updat": [9, 17, 19, 24], "updated_on": 29, "upgrad": [4, 14], "upper": 21, "upsel": 14, "uri": [17, 19], "url": [2, 4, 9, 14, 17, 19], "us": [1, 2, 3, 4, 6, 7, 8, 9, 11, 12, 14, 16, 18, 19, 20, 21, 23, 24, 25, 26, 28], "usag": [20, 25], "usecas": 12, "user": [7, 8, 12, 16, 19, 23, 24, 25, 28], "userdiscount": 25, "usernam": [7, 12, 17, 18], "util": 29, "uuid": 8, "uwsgi_max_request": 20, "uwsgi_reload_on_rss": 20, "v0": [24, 29], "v1": [1, 2, 9, 14, 18, 19], "valid": [1, 14], "valu": [14, 17, 19, 20, 21, 24], "variabl": [15, 19, 20], "ve": [2, 4, 8, 14, 18, 19, 21, 23, 25], "veri": [5, 17], "verif": [17, 19], "verifi": [11, 17, 19], "version": [14, 17, 19, 25, 29], "via": [11, 19, 21], "view": 17, "virtualenv": 19, "visa": 14, "volum": 20, "voucher": 23, "wa": [9, 19, 23, 25], "wagtail": [14, 19, 21], "wai": [23, 25], "walk": 9, "want": [3, 8, 9, 14, 18, 19, 23, 25, 30], "watch": 19, "we": [17, 23, 25, 28, 30], "web": [19, 20], "webhook": 28, "weird": 19, "well": [19, 21], "went": 23, "were": 23, "what": [6, 14, 18, 25], "whatev": 19, "when": [14, 17, 19, 21, 30], "where": [14, 18, 19, 23], "wherea": 25, "whether": 14, "which": [4, 6, 9, 17, 18, 19, 24, 30], "while": 14, "whitespac": 19, "wildcard": 19, "window": 20, "wish": 14, "within": [17, 19, 21, 30], "without": [17, 19, 20, 23, 25], "won": [1, 3, 8, 9, 13, 14, 17, 19], "word": [3, 21], "work": [6, 13, 14, 17, 18, 19, 20], "worker": 19, "would": [3, 9, 24, 25, 28, 29, 30], "wouldn": [23, 30], "write": [11, 19], "written": 8, "wsl": 17, "www": 25, "y": 17, "yaml": 19, "year": [3, 14, 19, 23], "yet": [19, 21], "yml": [17, 19, 20], "you": [1, 2, 3, 4, 7, 8, 9, 11, 14, 15, 17, 18, 19, 20, 21], "your": [2, 4, 14, 15, 18, 19, 20, 21], "your_initi": 15, "yourself": 8, "zero": [3, 14, 21]}, "titles": ["Authentication", "check_program_requirements", "configure_instance", "configure_tiers", "create_courseware", "create_courseware_page", "create_product", "create_user", "generate_discount_code", "import_courserun", "MITx Online Commands", "refund_fulfilled_order", "regenerate_edx_auth_tokens", "resolve_pending_order", "Configure eCommerce", "Configure HubSpot", "Configuration", "Configure Open edX", "MITx Online Quick Start", "Local Open edX Tutor and MITx Online Deployment", "Setting up uWsgi tuning for MITx Online", "Flexible Pricing", "Ecommerce", "Overview", "Basket Subsystem", "Discount Subsystem", "Subsystems", "Order Subsystem", "Payment Subsystem", "Product Subsystem", "Reporting Subsystem", "Welcome to MITx Online Documentation\u2019s documentation!"], "titleterms": {"": 31, "In": 14, "One": 19, "To": 20, "add": 17, "alia": 17, "all": 20, "api": [24, 29], "art": 23, "auth": 17, "authent": [0, 17], "basket": 24, "batch": 8, "build": 17, "case": 30, "check": 4, "check_program_requir": 1, "checkout": 14, "clone": 17, "code": 8, "command": [10, 17], "companion": 17, "config": 14, "configur": [14, 15, 16, 17], "configure_inst": 2, "configure_ti": 3, "content": [10, 31], "core": 23, "cours": 14, "create_coursewar": 4, "create_courseware_pag": 5, "create_product": 6, "create_us": 7, "creation": 21, "data": [25, 27, 29], "dedp": 30, "deploy": 19, "devstack": 17, "discount": 25, "document": 31, "ecommerc": [14, 22], "edx": [14, 17, 19], "etc": 17, "exampl": 9, "flexibl": 21, "form": 21, "from": 17, "gener": 8, "generate_discount_cod": 8, "goal": 23, "host": 17, "hubspot": 15, "imag": 17, "implement": 25, "import_courserun": 9, "indic": [10, 31], "instal": 17, "latest": 17, "lm": 17, "local": [17, 19, 20], "locust": 20, "logout": 17, "manag": 17, "micromast": [23, 30], "mitx": [10, 14, 17, 18, 19, 20, 31], "mitxpro": 17, "model": [25, 27, 29], "note": [18, 19, 24], "oauth": 17, "oauth2": 17, "onlin": [10, 14, 17, 18, 19, 20, 31], "open": [14, 17, 19], "openedx": 17, "option": [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13], "order": 27, "other": 19, "output": 8, "overview": 23, "part": 19, "payment": 28, "perform": 18, "pip": 17, "preliminari": 19, "price": 21, "prior": 23, "process": 21, "product": [14, 29], "propos": 25, "provid": 17, "provis": 17, "pull": 17, "put": 20, "quick": 18, "redempt": 25, "refund_fulfilled_ord": 11, "regenerate_edx_auth_token": 12, "report": 30, "request": 21, "resolve_pending_ord": 13, "result": 18, "run": 17, "server": 17, "set": [14, 20], "setup": [17, 19], "social": 17, "start": [17, 18], "step": 19, "stop": 17, "submit": 21, "subsystem": [24, 25, 26, 27, 28, 29, 30], "support": 17, "syntax": [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13], "system": 23, "tabl": [10, 31], "test": [14, 20], "togeth": 20, "token": 17, "tune": 20, "tutor": 19, "two": 19, "type": 25, "up": [14, 20], "us": [17, 30], "user": 17, "uwsgi": 20, "uwsgitop": 20, "via": 17, "welcom": 31, "xpro": 23, "your": 17}}) \ No newline at end of file