dualcube / moodle-enrol_stripepayment

Moodle Stripe Payment Collector
16 stars 27 forks source link

Missing Click event on "Pay now" button #110

Closed lucas-fath closed 1 year ago

lucas-fath commented 1 year ago

We sometimes encounter the problem that upon readding a stripe payment instance the "Pay now" button doesn't receive the click event that is needed to open the stripe payment page.

I have already debugged a bit. After calling the enrol page hook of the enrol_stripepayment instance, everything get's executed just fine. So

include($CFG->dirroot.'/enrol/stripepayment/enrol.php'); (line 307, lib.php)

is beeing executed sucessfully which leads to

<?php $PAGE->requires->js_call_amd('enrol_stripepayment/stripe_payment', 'stripe_payment', array($publishablekey, $plugin->get_config('secretkey'), $course->id, $amount, $instance->currency, $coursefullname, $couponid, $USER->id, $instance->id, get_string("please_wait", "enrol_stripepayment"), get_string("buy_now", "enrol_stripepayment"), $plugin->get_config('cost'), $cost, $USER->email, get_string("invalidcouponcode", "enrol_stripepayment"))); ?> (line 86, enrol.php)

beeing executed as well. This should execute the stripe_payment function of the stripe_payment.js file. For testing purposes i have included an initial alert() call in line 7 of stripe_payment.js (The first line that should be executed). This alert is beeing executed on the inital rendering of the plugin. However, after calling enrol page hook another time, it isn't beeing executed anymore. Therefore I think that the js file is not beeing executed at all, even tho we clearly call the method (I have already check if the js_call_amd method is actually called and if all the passed paremeters are right)

Has anybody else encountered that issue? Unfornutaley this causes the pay button to loose it's function which ultimately leads to the user not beeing able to pay for the course.

moumitahalder commented 1 year ago

Hi @lucas-fath, we have tested the flow on our end with the latest version of Moodle. As you can see this is working fine https://jhn4wdmbd4.vmaker.com/record/bag9J0caVVz6CSQS

Can you please check again with other plugins deactivated and check.