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

Price summary updates #1857

Merged
merged 5 commits into from
Jun 10, 2019
Merged

Price summary updates #1857

merged 5 commits into from
Jun 10, 2019

Conversation

rupertbates
Copy link
Member

Why are you doing this?

We have previously had two types which describe subs product prices; Price which had the price and the currency and ProductPrice which had the price and any promotions which were applied.
This led to a lot of code mapping between the two and made things complicated when trying to unify the pricing code across components. I have now merged the two types into ProductPrice which contains all the fields and used this throughout the subs components.

This has also improved the summary component which didn't really cope with 6 for 6 properly before.

Trello Card

@@ -81,7 +78,12 @@ const hasDiscount = (promotion: ?Promotion): boolean %checks =>
promotion !== undefined &&
isNumeric(promotion.discountedPrice);

function applyDiscount(price: Price, promotion: ?Promotion) {
const hasIntroductoryPrice = (promotion: ?Promotion): boolean %checks =>
Copy link
Contributor

Choose a reason for hiding this comment

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

What does the % do in this line? I haven't seen this before.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is to tell Flow that this is a check, some details (though not many) here: facebook/flow#4723

@prout-bot
Copy link

Seen on PROD (merged by @rupertbates 13 minutes and 37 seconds ago)

Sentry Release: support-client-side, support

@prout-bot
Copy link

✅ Testing in PROD passed! Details

@rupertbates rupertbates deleted the price-summary-updates branch June 10, 2019 13:49
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.

None yet

3 participants