I assume what you want is to enrol them when they have paid.
What I think you really want is a custom enrolment plugin. Although, I'm less than clear from your description.
The critical thing is what you want to happen after they've paid.
I assume what you want is to enrol them when they have paid.
What I think you really want is a custom enrolment plugin. Although, I'm less than clear from your description.
The critical thing is what you want to happen after they've paid.
Sorry about that,
Mainly it will be accessible to anyone who accesses Moodle.
The idea behind it is that were charging students for reassessment fee, once they have paid we check on the payment gateway, to see if they have paid, if so then they are allowed to take a reassessment.
What is the reassessment? A course? Or, an activity within a course where they already took the course and then took the assessment, but there is a fee to take the assessment again?
If it were me, I would create a course with one activity, just the reassessment. (Maybe the assessment is in a course with other activities as well, but there doesn't need to be a gateway for that one.)
You'll have to share more. But, the idea of a separate course would separate the users who need reassessment from those who did not, and you could make the gateway for just that course, specific to the reassessment. Like
Howard was saying, if you want the payment to go with enrollment into that course.
But you are describing a manual process of "seeing if they paid" through the mechanism of somehow what your "gateway" produces to you, and then you "let them in" or enroll them, or whatever.
Key question: are you trying to automate enrollment with a payment, or simply figure out how to get yourself a usable response from your gateway code and then manually go from there? Because custom code may be needed for either option. However, if you are automating there is more involved though it could be started with existing code for automatic enrollment through existing plugins, etc. If you're going manual in the enrollment process, it is simpler and you may just need to work out how you want the PayTabs response to get to the user who reviews student payments, etc.
Please share your decision regarding which direction you are trying to go.
(Edited by Howard Miller to remove quoted text- original submission Tuesday, 22 January 2019, 11:50 PM)
Yeh - we need to find a way to "translate this into Moodle". Moodle doesn't have a thing called "reassessment", so what will that actually be.
Ok yes,
So I am looking for nothing spectacular, no automation or any kind of enrollment on to the course or anything like that. All I am looking for is means to paste the code mentioned above in this thread into a block, and that is it. So then all that is showed is the payment gateway button and some text to say what it is for.
Regarding reassessment, I am not particularly sure myself as to what students need to be reassessed on. But for what I am planning to do, it is irrelevant. Students just need to see the pay button somewhere in Moodle, like in a block. So that they can then pay for one and that's is all there is to it.
Ok, so other than following the blocks guide in the link above and reporting back if you are stuck on any steps, then I would make a jump and assume the following two things:
With the things mentioned in the script like the return URL, I would not worry too much about that as that is adjusted by quite easily by specifying a URL.
But however, I think this is being overcomplicated, than what it needs to be. As I mentioned before I can get it to work if I paste the script I showed earlier in the custom JS&css section in my chosen theme for Moodle. However, the problem with that is where it is positioned in Moodle, in this case, it was being displayed at the bottom of the page. But the button shows and works as expected, just not in the right place.
So the only reason why I mentioned a block, is so that I could add this script within there so I can actually control where it is displayed and positioned on the site. But however, it does not work at all if I just paste the code in an HTML block.
Well at least we now know what you are trying to do.
Were you pasting the code while the text editor was in code "mode" or html-rendered mode?
This is true and I apologise if I did not explain properly.
So within the "HTML Block" I used the code option but does not appear to work.
However, it works if I add the code to the following section in Moodle.
Appearance > Themes > "My choosen theme" > Custom CSS & JS
Then paste the code in the Javascript section and only show on dashboard option checked.
But the issue, as I mentioned before adds the checkout button to the very bottom of the page, which looks very unprofessional.
What if you put the basic html button code in the html block and put the js in the custom settings? Maybe that will work.
If that doesn't work, we might need to figure out where you want the button, and "relocate" it after it loads with some custom javascript.
For example, maybe we use the HTML block to create a <div> section that we relocate to...
Ok, so I kept the first line of the code in the HTML block.
And the rest in the custom JS section in the theme.
However, the site becomes unusable, such as the site administrator option never expands.
You should consider building a new block from scratch. I know it's a pain for a little button, but it will load it the way you want.
https://moodle.org/mod/forum/discuss.php?d=312859
This is to a discussion that walks through pros/cons of custom needs. They conclude create a custom plugin "block". Look for Tim Hunt's post that starts with "implement your plugin as a block plugin."