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

BookingUnitType config.js variable needed more comments #1317

Merged
merged 4 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 5 additions & 3 deletions server/api-util/lineItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ const { calculateQuantityFromDates, calculateTotalFromLineItems } = require('./l
const { types } = require('sharetribe-flex-sdk');
const { Money } = types;

const unitType = 'line-item/night';
// This bookingUnitType needs to be one of the following:
// line-item/night, line-item/day or line-item/units
const bookingUnitType = 'line-item/night';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the name so that it's in sync with the config.js variable (in web app).

const PROVIDER_COMMISSION_PERCENTAGE = -10;

/** Returns collection of lineItems (max 50)
Expand Down Expand Up @@ -40,9 +42,9 @@ exports.transactionLineItems = (listing, bookingData) => {
* By default BookingBreakdown prints line items inside LineItemUnknownItemsMaybe if the lineItem code is not recognized. */

const booking = {
code: 'line-item/night',
code: bookingUnitType,
unitPrice,
quantity: calculateQuantityFromDates(startDate, endDate, unitType),
quantity: calculateQuantityFromDates(startDate, endDate, bookingUnitType),
includeFor: ['customer', 'provider'],
};

Expand Down
8 changes: 6 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ const bookingProcessAlias = 'flex-default-process/release-1';
//
// Possible values: ['line-item/night', 'line-item/day', 'line-item/units';]
//
// Note: translations will use different translation keys for night, day or unit
// depending on the value chosen.
// Note 1: This 'bookingUnitType' variable affects only web app.
// If you are using privileged transitions (which is used by the default process),
// you also need to configure unit type in API server: server/api-util/lineItems.js
//
// Note 2: Translations will use different translation keys for night, day or unit
// depending on the value chosen.
const bookingUnitType = 'line-item/night';

// Should the application fetch available time slots (currently defined as
Expand Down