dualcube / moodle-enrol_stripepayment

Moodle Stripe Payment Collector
16 stars 26 forks source link

Discount code is not applied upon payment #57

Closed peterhuppertz closed 3 years ago

peterhuppertz commented 3 years ago

The deducted amount is displayed fine once I input the coupon code, but the full price is taken by Stripe upon payment.

image
peterhuppertz commented 3 years ago

I found the problem in enrol.php. $_SESSION['amount'] = get_stripe_amount($cost, $_SESSION['currency'], false); is set in the top. The new amount taking the coupon into account is calculated further down and therefore the new amount is not taking into account. I fixed this simply by moving above code down and set the amount value once the costs are calculated correctly.

ZealJared commented 3 years ago

Cost is saved to session on line 40, then modified on line 126. You can move line 40 to the blank line 129 after the closing curly brace. Refactor should separate logic and presentation. All logic should occur before any presentation.

carlosmhpl commented 3 years ago

The modifications suggested at https://github.com/dualcube/moodle-enrol_stripepayment/issues/57 are already included in version 3.2.1 of the module and still not working. The problem is that making the call to validate-coupon.php is as if it did not receive the coupon and returned a 404 error. image image

rituparnagithub commented 3 years ago

Hello @carlosmhpl, We have checked the plugin for the error you mentioned but we couldn't find any such issue. Below we have attached a video for your reference.

Thank you

https://www.loom.com/share/8c2c75787d67453fabf7963bad6a5d59

cirojr commented 3 years ago

@carlosmhpl, have you fixed the problem? I'm having the same message.

janeaerlandson commented 3 years ago

I can't determine if the coupon function is going to work for Moodle 3.10. Does anyone know?