mitodl / mitxpro

BSD 3-Clause "New" or "Revised" License
12 stars 2 forks source link

feat: add coupons deactivate form #3160

Closed Anas12091101 closed 7 hours ago

Anas12091101 commented 3 weeks ago

What are the relevant tickets?

Closes https://github.com/mitodl/hq/issues/5435

Description (What does it do?)

This PR adds the functionality to deactivate the coupons from ecommerce/admin UI

Screenshots (if appropriate):

Screenshot 2024-09-26 at 2 55 22 PM Screenshot 2024-10-10 at 1 13 31 PM Screenshot 2024-10-01 at 6 00 44 PM

While submitting the button is disabled

Screenshot 2024-10-04 at 3 51 32 PM Screenshot 2024-10-04 at 3 46 55 PM

If all the codes and names entered are invalid

Screenshot 2024-10-04 at 3 47 20 PM

How can this be tested?

Additional Context

arslanashraf7 commented 1 week ago

I haven't taken a detailed look at the PR but here is what I think we should be doing if not already:

  1. We should reuse as much code as possible here and invalidate_payment_coupons
  2. I think the PR is still missing a lot of screenshots, e.g. error, and success states. We also need to check which color those messages are.
  3. Think about what to do if a coupon being requested to be deactivated is already past its expiry date.
  4. Do we need to show the skipped coupons? If a person is requesting coupon A & B to be deactivated why would we tell him that coupon C is skipped? This could get confusing for them.
  5. Do we want to log the user deactivating the coupon for audit trail?
pdpinch commented 1 week ago

Sorry I'm arriving late to this, but I wanted to ask how access control will work?

arslanashraf7 commented 1 week ago

Sorry I'm arriving late to this, but I wanted to ask how access control will work?

@pdpinch Anyone who had access to the coupons admin page would have access to this. @Anas12091101 Correct me If I'm wrong.