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

Flexible pricing UI #1310

Merged
merged 14 commits into from
Jun 25, 2020
Merged

Flexible pricing UI #1310

merged 14 commits into from
Jun 25, 2020

Conversation

kpuputti
Copy link
Contributor

@kpuputti kpuputti commented Jun 15, 2020

(This PR combines #1305 and #1309 as well as new changes.)

This PR adds opt-in support for flexible pricing and privileged transitions. Privileged transitions are transaction process transitions that need to be run from a secure context, i.e. the backend.

The opt-in UI support for privileged transitions adds integration to the FTW API endpoints added in #1301 .

Transaction line items

The line items that define the pricing of a transaction are now defined securely in the backend. This means that privileged transitions can safely define the line items in the backend based on the booking data, and the pricing can be fully customized in FTW. This means changing commissions, adding extra line items for discounts, etc.

Important note

The EstimatedBreakdownMaybe component that is used in the ListingPage will no longer internally define the pricing line items. Instead, the /api/transaction-line-items endpoint will be used to fetch the line items.

This means that the same place that defines the line items for privileged transitions is also used for the price estimation. This also means that any pricing customizations will need to be migrated to the transactionLineItems function in server/api-util/lineItems.js that will become the main customization point for describing pricing when privileged transitions are the default.

Using privileged transitions

If you want to opt-in to marking some of the transitions as privileged, you can edit the isPrivileged function in src/util/transaction.js and add the transitions there. After that, those transitions will automatically go through the backend.

Note that we will provide more specific documentation for this when the privileged transitions become the default. Also note that using privileged transitions requires a process change with Flex CLI.

Customizing pricing

As mentioned earlier, the transactionLineItems function in server/api-util/lineItems.js will become the main customization point to describe the pricing in a transaction.

TODO

  • Call the local privileged transition endpoint
  • Make sure all booking breakdowns use the new line items
  • Call speculate transition (not initiate) when moving from enquiry
  • Make privileged endpoints optional based on tx config
  • Ensure correct tx process name in config
  • Make sure server side works
  • Update changelog

@kpuputti kpuputti force-pushed the flexible-pricing-ui branch 3 times, most recently from 0c5d2ed to 77a1c09 Compare June 16, 2020 11:40
Copy link
Contributor

@ovan ovan left a comment

Choose a reason for hiding this comment

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

Looks good to me. Some minor comments/questions about the code. Let's discuss the process name if we haven't yet committed to that.

src/config.js Outdated Show resolved Hide resolved
src/containers/CheckoutPage/CheckoutPage.duck.js Outdated Show resolved Hide resolved
src/containers/CheckoutPage/CheckoutPage.duck.js Outdated Show resolved Hide resolved
@kpuputti kpuputti force-pushed the flexible-pricing-ui branch 2 times, most recently from 7b61eb0 to a407d9f Compare June 18, 2020 12:55
@kpuputti kpuputti temporarily deployed to sharetribe-starter-app June 18, 2020 14:12 Inactive
and remove unnecessary copy-pasted code.
…ne-item-price-calculation

Add rounding to privilate-line-item price estimations
@lyyder lyyder mentioned this pull request Jun 25, 2020
@lyyder lyyder merged commit 31f1524 into master Jun 25, 2020
@Gnito Gnito deleted the flexible-pricing-ui branch June 29, 2020 19:47
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.

6 participants