sebsoftnl / moodle-enrol_gwpayments

Other
2 stars 3 forks source link

100% discount usage count #11

Closed ajasnz closed 2 years ago

ajasnz commented 3 years ago

Hi, Thanks for putting in the bypass for the 100% discount, one problem I have found is that the coupons that use the bypass don't update the usage counter, is there any way to enable this?

rogiervandongen commented 3 years ago

Hi @xelast418 Scanning through the source code again I did notice it seems to indeed bypass the usage counter as well. I'll get this fixed in the next release (please do note the usage counter is not fool proof at all in all other cases: a payment can take literally days to finally come through as paid. Due to the mechanism in use, which is session storage, those payments that are not "instant", might end up having used a discount code for which the counter is not incremented. Having said that, most gateway implementations and payments, under normal circumstances, should lead to an almost instant status as "PAID" or at least something to that extent. Because the discount code is only known in the user session (because there was no other way to facilitate this), it can only be "processed" as part of the user session. Hence, if a payment status change request comes in through any other mechanism than as part of the user's session, usage cannot be incremented. For the time being, there is no solid solution to make coverage 100%).