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

Add support for arbitrary line item codes #1062

Merged
merged 8 commits into from
Apr 5, 2019
Merged

Conversation

lyyder
Copy link
Contributor

@lyyder lyyder commented Apr 3, 2019

Update 2019-04-05: The booking breakdown layout has been improved for a more visible sub total row, see updated screenshots

With custom pricing line items can have any sort of code as long as it begins with line-item/.

This PR loosens the line item code validation and changes booking breakdown so that all unknown line items are rendered too.

About rendering unknown line items, initial plan was to render quantity based line items on top of subtotal and the percentage based items below it:

Car wash        $20
Car cleaning    $10
Sub total       $30
Discount       -$5
Commission     $4
---
Total           $29

However, this design got a bit tricky with refunds. Previously the refund has been right after sub total and commissions have their own refund line. If percentage based unknown line items where below the sub total, should they have their own refund line in the breakdown. The simplest solution was to add everything except commissions above the sub total, refund matching those lines below sub total and commissions as they are. The main upside of this design is that the refund always matches the sub total which makes it clear to read.

So current the current design is:

Screenshot 2019-04-05 at 14 40 11

And with refund:

Screenshot 2019-04-05 at 14 40 17

The downside of the design is that unknown line items only present the human readable code and line total. If a line item has quantity other than one for example, it would be nice to be able to read from the breakdown. Maybe one way to show it would be:

2 x Car wash ($20)      $40

@lyyder lyyder force-pushed the custom-pricing-support branch 7 times, most recently from 09ab57e to 97eb274 Compare April 4, 2019 11:54
@lyyder lyyder requested a review from Gnito April 4, 2019 12:11
src/util/types.js Outdated Show resolved Hide resolved
src/util/data.js Show resolved Hide resolved
Copy link
Contributor

@Gnito Gnito left a comment

Choose a reason for hiding this comment

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

I added a couple of small comments.
Have you tested this on staging against Joe Dunphy's transactions? (I wonder if they change with this PR.)

@lyyder lyyder force-pushed the custom-pricing-support branch 2 times, most recently from 74ee237 to dbf901a Compare April 5, 2019 08:22
Remove the requirement that a certain kind of line item is found from a transaction.
Update line items in test to match those returned from the API.
Add examples with arbitrary line items.
Make the subtotal line stick out a bit more.
@lyyder lyyder merged commit b929493 into master Apr 5, 2019
@lyyder lyyder deleted the custom-pricing-support branch April 5, 2019 11:44
@Gnito Gnito mentioned this pull request Apr 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants