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

Opt-out flexible pricing #1314

Merged
merged 4 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ way to update this template, but currently, we follow a pattern:

## Upcoming version 2020-XX-XX

- [change] Use privileged transitions for price calculation by default and
update the process alias.
[#1314](https://github.com/sharetribe/ftw-daily/pull/1314)
- [add] Add client secret enquiry to 'yarn run config' script
[#1313](https://github.com/sharetribe/ftw-daily/pull/1313)
- [change] Add UI support for flexible pricing and privileged
Expand Down
11 changes: 5 additions & 6 deletions ext/transaction-process/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ This is the transaction process that the Flex Template for Web is designed to wo
The `process.edn` file describes the process flow while the `templates` folder contains notification
messages that are used by the process.

The process uses day-based booking and night-based pricing i.e. the quantity of booked units is
defined by the number of nights in the booking. The process has preauthorization and it relies on
the provider to accept booking requests.

For different process descriptions for varying booking and pricing models, see the
[Flex example processes repository](https://github.com/sharetribe/flex-example-processes)
Bookings in the process are day-based. Pricing uses privileged transitions and
the
[privileged-set-line-items](https://www.sharetribe.com/docs/references/transaction-process-actions/#actionprivileged-set-line-items)
action. The process has preauthorization and it relies on the provider to accept
booking requests.
14 changes: 6 additions & 8 deletions ext/transaction-process/process.edn
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@
:actions
[{:name :action/create-booking,
:config {:observe-availability? true}}
{:name :action/calculate-tx-nightly-total-price}
{:name :action/calculate-tx-provider-commission,
:config {:commission 0.1M}}
{:name :action/privileged-set-line-items}
{:name :action/stripe-create-payment-intent}],
:to :state/pending-payment}
:to :state/pending-payment
:privileged? true}
{:name :transition/request-payment-after-enquiry,
:actor :actor.role/customer,
:actions
[{:name :action/create-booking,
:config {:observe-availability? true}}
{:name :action/calculate-tx-nightly-total-price}
{:name :action/calculate-tx-provider-commission,
:config {:commission 0.1M}}
{:name :action/privileged-set-line-items}
{:name :action/stripe-create-payment-intent}],
:from :state/enquiry,
:to :state/pending-payment}
:to :state/pending-payment
:privileged? true}
{:name :transition/expire-payment,
:at
{:fn/plus
Expand Down
2 changes: 1 addition & 1 deletion src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const sortSearchByDistance = false;
//
// In a way, 'processAlias' defines which transaction process (or processes)
// this particular web application is able to handle.
const bookingProcessAlias = 'preauth-nightly-booking/release-1';
const bookingProcessAlias = 'flex-default-process/release-1';

// The transaction line item code for the main unit type in bookings.
//
Expand Down
6 changes: 3 additions & 3 deletions src/util/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export const txRoleIsCustomer = userRole => userRole === TX_TRANSITION_ACTOR_CUS
// should go through the local API endpoints, or if using JS SDK is
// enough.
export const isPrivileged = transition => {
return [
// list privileged transitions here
].includes(transition);
return [TRANSITION_REQUEST_PAYMENT, TRANSITION_REQUEST_PAYMENT_AFTER_ENQUIRY].includes(
transition
);
};