learning-unlimited / ESP-Website

A website to help manage the logistics of large, short-term educational programs
82 stars 57 forks source link

credit card module assumes sibling discount line item exists #3628

Closed willgearty closed 1 year ago

willgearty commented 1 year ago

It looks like the stripe credit card module assumes that the sibling discount line item exists: https://github.com/learning-unlimited/ESP-Website/blob/5e7715948d4cf3bc7f91e8562f3aae93ecca13fb/esp/esp/program/modules/handlers/creditcardmodule_stripe.py#L169 https://github.com/learning-unlimited/ESP-Website/blob/5e7715948d4cf3bc7f91e8562f3aae93ecca13fb/esp/esp/accounting/controllers.py#L167-L168

However, when we make a program, if the sibling discount is 0, no line item is created: https://github.com/learning-unlimited/ESP-Website/blob/5e7715948d4cf3bc7f91e8562f3aae93ecca13fb/esp/esp/program/models/__init__.py#L1282-L1291

We should either pull the sibling discount from the program object or fix the controller to return $0 if no line item exists.

I haven't seen this issue before, which makes we wonder whether there's some other bug going on here where there should always be the sibling discount line item, even when it's zero?

Reported by Berkeley.

willgearty commented 1 year ago

I was able to reproduce the problem on my dev server when I left the sibling discount program setting blank.