sebsoftnl / moodle-enrol_gwpayments

Other
2 stars 3 forks source link

Report of Coupon Users? #21

Open adjosh opened 3 weeks ago

adjosh commented 3 weeks ago

@sebsoftnl Hello, One more question, please. How can we see who used a coupon and the details of the coupon (the code, how much, when it expires, which course, etc)? I cannot find any database tables with this information. I need to pull together a Receipt and a general Report.

Thank you so much.

rogiervandongen commented 1 week ago

Hi @adjosh Could you enlighten me which payment gateways you're using (or planning to use)?

The downside of the general payment gateway implementation in Moodle is that it supports only the absolute bare basics about payments. The way it's implemented does not really allow for "extra information" in it's process, making it extremely hard to add certain information. Depending on the gateways or payment methods you'll be using, we may be able to add little bits of information. However, this mainly depends on whather or not the payment process can be considered "direct" or not.

For example: the applied discount code can only be tracked correctly (I should really say "at all") if the process of paying is considered instant. This means the payment can be considered completed immediately after returning to Moodle. If, for any reason, notifications about payments are delayed, or "not part of the round trip behaviour", we pretty much lose out on the applied discount code.

This makes it less than fool-proof to be able to have 100% coverage of the applied discount codes. In other words: they may not be tracked or known at the moment the payment is marked as completed. This, in effect, means the report you're in need of may not always hold correct information regarding the applied discount code.

You can always send an e-mail to helpdesk@sebsoft.nl if you wish to go into more details. If you choose to do so, please refer to this issue on github as well

adjosh commented 6 days ago

Hello @rogiervandongen ,

Thanks a lot for the response.

It is the PayPal gateway we are using and having this problem. But also use Stripe and Authorize.net. (Different clients have different payment mechanisms that their organizations use.)

When a buyer purchases with a discount code, the correct coupon amount is deducted immediately and they pay whatever balance remains with PayPal. The correct discounted amount is reported to PayPal and the user is enrolled in the course, as desired. But we don't see the record of the transaction in Moodle anywhere.

I hope this helps? It would be absolutely fabulous if you could add a little bit more information about who used the discount code, which code, how much was the discount, for which course, and paid how much in the end.

We are using it on Moodle Workplace 4.4.3+. Thanks for any help you can provide.

rogiervandongen commented 6 days ago

Hello @adjosh Thank you for the explanation. As explained, the primary "issue" here is Moodle's payment subsystem itself.

That being said, we've come up with a solution that should work in the majority of cases. A table has been added to the latest version (1.1.0) that allows us to track discount codes/coupons. Please do note that this can only work with so called "synchronous" payment flows. Paypal has always been Moodle's only default payment implementation and luckily, this payment flow can be considered synchronous. In fact, I take it the majority of payment flows these days can be considered synchronous. With this I mean that the user walks through the payment flow and, assuming actual payment, upon returning to Moodle the status can be verified and is considered paid/completed.

Of course bank transfers are typically asynchronous: there is no way the payment can be verified and marked completed because it involves extra steps that usually are not automated.

So as long as the user is returned to Moodle, not logged out in the meantime (why would they?) and we can verify the payment to be considered completed/paid, we can also take the right steps to track usage of the discount code.

Now, for the solution (please be aware that latest version 1.1.0 of this enrol_gwpayments plugin is a mandate): Have a look at the report we created: https://github.com/sebsoftnl/moodle-report_gwpayments

It's a simple matter of installing the report plugin. Then at various levels (system, coursecategory, course, user) reports are available and can even be hidden (the various reports work with capabilities). The report plugin is not yet available on Moodle.org, simply because it's brand new but also Moodle.org is behind on plugin checks and validation for months. So even when it's pushed to moodle.org it will take a while to get the plugin checked and accepted.

If any questions arise, don't hesitate to ask.

adjosh commented 6 days ago

OMG, this is great news! @rogiervandongen Thank you so so much! This is fantastic! I will let you know how it goes! You have MADE my day! 👍 💯 🥇

rogiervandongen commented 6 days ago

Hello @adjosh You're very very welcome.

Please remember the report is newly developed and as of yet, not 100% tested. I've tested and developed on a plain Moodle 4.2 and 4.3 version and as of yet, Moodle 4.4+ remains untested. However, I don't expect things to instantly break. That being said, I've already come across specific JS/babel transpilation issues for other Moodle projects, so if you encounter "ReferenceError: regeneratorRuntime is not defined" let me know ASAP. This should simply resolved by rebuilding the script modules (due to Moodle updating their babel version) and more specific releases of plugins per Moodle version.

It may well be that you'll encounter other issues here and there (of course we're hoping that doesn't happen at all, but it can always happen). In that case don't hesitate to file a issue in the tracker here (or in the other repository), or send us an email. I'll try to address issues ASAP especially if it's something small.

Cheers 🥳

adjosh commented 6 days ago

Sounds good! 👍 I am having our infrastructure person install it on the client's sandbox site first, to test. And I will let you know how it goes! Thank you.

adjosh commented 5 days ago

@rogiervandongen Hi there! I just wanted to report back that there is no issue for me! No errors! I even just tried with the full discount and that has been recorded! This report is EXACTLY what my client wanted and needed for their project to finally get off the ground.

Screenshot 2024-09-26 at 11 38 05 AM

Thank you so much for your speedy response and for this outstanding product! Deeply appreciated!