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

[13.x] Multiple discounts on receipts #1147

Merged
merged 4 commits into from
May 17, 2021
Merged

Conversation

driesvints
Copy link
Member

@driesvints driesvints commented May 13, 2021

This PR implements multiple discount support for receipts. With these changes, all discounts on a receipt are properly displayed with their name set up through Stripe as well as their percentage or amount off.

Here's an example of multiple discounts:

Screenshot 2021-05-14 at 18 49 09

The general amount of is calculated first. Afterwards, individual discounts are applied per specific product they apply for.

Here's the equivalent Stripe receipt:

Screenshot 2021-05-14 at 18 51 01

Some other changes in this PR:

  • I've refactored the way extra parameters on the Stripe Invoice object are expanded. They are now only expanded when called upon and the data is cached internally on the object.
  • A new Discount and Coupon object were introduced to wrap the related Stripe objects.
  • Cleaned up some inconsistencies with collection class instantiation and is_null calls.

Closes #1145

@@ -41,7 +41,7 @@

.table td {
padding: 8px;
line-height: 20px;
line-height: 14px;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decreased the line-height here slightly to account for the extra items on the invoice.

@driesvints driesvints marked this pull request as ready for review May 15, 2021 17:49
@driesvints driesvints requested a review from taylorotwell May 15, 2021 17:49
@taylorotwell taylorotwell merged commit 2457494 into master May 17, 2021
@taylorotwell taylorotwell deleted the multiple-discounts branch May 17, 2021 13:32
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

Successfully merging this pull request may close these issues.

2 participants