Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receipt shows the wrong balance when learner is refunded using the refund management command #1293

Open
briangrossman opened this issue Aug 9, 2021 · 2 comments

Comments

@briangrossman
Copy link

Steps to Reproduce

  • Refund an order for a learner using the refund management command:
  • Unenroll the learner from the course (mark the Bootcamp run enrollment to refunded)
  • View the learner's receipt (from their dashboard)
  • Note: that the receipt seems to assume that the learner still owes the price for the Bootcamp

Here's an example of a $2000 purchased bootcamp followed by a $2000 refund:
image

Expected Behavior

  • If a learner purchases a Bootcamp and is fully refunded, their balance on the receipt should be $0

Actual Behavior

  • The receipt doesn't seem to take into account the fact that the user is no longer enrolled in the course and therefore doesn't owe the money for the course

Additional notes

  • Note that when the refund management command is run, it creates a new order record for the refund. The receipt should include both the purchase and refund in the receipt. They are for the same run.
  • Note that the receipt needs to know if the learner is still enrolled in the Bootcamp run to know if they owe the price of the run.

Related Issues

PR: #994

@pdpinch
Copy link
Member

pdpinch commented Aug 10, 2021

Can you write up / mock up what the receipt should look like in this case?

@briangrossman
Copy link
Author

@pdpinch Yes! Good suggestion.


Scenario 1 - User unenrolls and is refunded

  • User makes $1000 payment for $2000 Bootcamp - 5/8/2021
  • User makes $1000 payment for the Bootcamp - 5/10/2021
  • User un-enrolls from Bootcamp and is refunded $2000 - 8/8/2021

The current receipt shows each payment and refund listed out. In order to generate the receipt appropriately, you'll need to search for all records for the same user and Bootcamp run. Note that a new order is created when a user is fully refunded for a bootcamp.

The receipt should look like this:


Order Information

Payment Date:        May 8, 2021
Amount Paid:         $1000         <== the amount paid on 5/8/21
Balance:             -$1000        <== total amount due ($0) - payments to date ($1000) + refunds to date ($0)

-----------------------------------

Order Information

Payment Date:        May 10, 2021
Amount Paid:         $1000         <== the amount paid on 5/10/21
Balance:             -$2000        <== total amount due ($0) - payments to date ($2000) + refunds to date ($0)

-----------------------------------

Order Information

Refund Date:        Aug 8, 2021
Amount Refunded:    -$2000         <== the amount refunded on 8/8/21
Balance:            $0             <== total amount due ($0) - payments to date ($2000) + refunds to date ($2000)

-----------------------------------

Total Amount Paid:  $0             <== all payments ($2000) - all refunds ($2000)
Balance Due:        $0             <== total amount due ($0) - all payments ($2000) + all refunds ($2000)
Total Amount Due:   $0             <== total costs ($2000) - total unenrolled refunds ($2000)

Note that Total Amount Due and Balance figures are always calculated from the current amount due. Even though the user technically had a Total Amount Due of $2000 on May 8, 2021, the balance is calculated off of today's Total Amount Due of $0. Otherwise, the receipt would be too confusing.


Scenario 2- User does not unenroll, but is refunded

  • User makes $1000 payment for $2000 Bootcamp - 5/8/2021
  • User makes $1000 payment for the Bootcamp - 5/10/2021
  • Use is refunded $2000, but does not un-enroll - 8/8/2021

The receipt should look like this:


Order Information

Payment Date:        May 8, 2021
Amount Paid:         $1000         <== the amount paid on 5/8/21
Balance:             $1000         <== total amount due ($2000) - payments to date ($1000) + refunds to date ($0)

-----------------------------------

Order Information

Payment Date:        May 10, 2021
Amount Paid:         $1000         <== the amount paid on 5/10/21
Balance:             $0            <== total amount due ($2000) - payments to date ($2000) + refunds to date ($0)

-----------------------------------

Order Information

Refund Date:        Aug 8, 2021
Amount Refunded:    -$2000         <== the amount refunded on 8/8/21
Balance:            $2000          <== total amount due ($2000) - payments to date ($2000) + refunds to date ($2000)

-----------------------------------

Total Amount Paid:  $0             <== all payments ($2000) - all refunds ($2000)
Balance Due:        $2000          <== total amount due ($2000) - all payments ($2000) + all refunds ($2000)
Total Amount Due:   $2000          <== total costs ($2000) - total unenrolled refunds ($0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants