-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
feat(): added percentage calculations for all cases #6300
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
const totalItemValue = method.unit_price * quantityMultiplier | ||
let promotionValue = parseFloat(applicationMethod!.value!) | ||
const applicableTotal = totalItemValue - appliedPromoValue | ||
|
||
if (applicationMethod?.type === ApplicationMethodType.PERCENTAGE) { | ||
promotionValue = (promotionValue / 100) * applicableTotal | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: would it make sense to move all this responsibility outside of the promotion module - instead the promotion module would expect subtotal
fields on the items it gets passed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: use method.subtotal / method.quantity
instead of method.unit_price
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit price fix and we should be good to go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
what: