Skip to content

New Components - limoexpress #16933

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion components/action1/action1.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/buddy/buddy.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
2 changes: 1 addition & 1 deletion components/guardrails/guardrails.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export default {
console.log(Object.keys(this.$auth));
},
},
};
};
294 changes: 294 additions & 0 deletions components/limoexpress/actions/create-booking/create-booking.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
import { PRICE_TYPE_OPTIONS } from "../../common/constants.mjs";
import { throwError } from "../../common/utils.mjs";
import limoexpress from "../../limoexpress.app.mjs";

export default {
key: "limoexpress-create-booking",
name: "Create Limo Booking",
description: "Creates a new limo booking with specified details. [See the documentation](https://api.limoexpress.me/api/docs/v1#/Bookings/createBooking)",
version: "0.0.1",
type: "action",
props: {
limoexpress,
bookingTypeId: {
propDefinition: [
limoexpress,
"bookingTypeId",
],
},
bookingStatusId: {
propDefinition: [
limoexpress,
"bookingStatusId",
],
optional: true,
},
fromLocationName: {
type: "string",
label: "From Location Name",
description: "The pickup location name.",
},
fromLocationFullAddress: {
type: "string",
label: "From Location Full Address",
description: "The pickup location full address.",
},
fromLocationLatitude: {
type: "string",
label: "From Location Latitude",
description: "The pickup location latitude.",
optional: true,
},
fromLocationLongitude: {
type: "string",
label: "From Location Longitude",
description: "The pickup location longitude.",
optional: true,
},
toLocationName: {
type: "string",
label: "To Location Name",
description: "The dropoff location name.",
},
toLocationFullAddress: {
type: "string",
label: "To Location Full Address",
description: "The dropoff location full address.",
},
toLocationLatitude: {
type: "string",
label: "To Location Latitude",
description: "The dropoff location latitude.",
optional: true,
},
toLocationLongitude: {
type: "string",
label: "To Location Longitude",
description: "The dropoff location longitude.",
optional: true,
},
pickupTime: {
type: "string",
label: "Pickup Time",
description: "The time scheduled for pickup. **Format: YYYY-MM-DD HH:MM:SS**",
},
expectedDropOffTime: {
type: "string",
label: "Expected Drop Off Time",
description: "The expected drop off time. **Format: YYYY-MM-DD HH:MM:SS**",
optional: true,
},
expectedComebackTime: {
type: "string",
label: "Expected Comeback Time",
description: "The expected comeback time. **Format: YYYY-MM-DD HH:MM:SS**",
optional: true,
},
vehicleClassId: {
propDefinition: [
limoexpress,
"vehicleClassId",
],
withLabel: true,
optional: true,
},
vehicleId: {
propDefinition: [
limoexpress,
"vehicleId",
({ vehicleClassId }) => ({
vehicleClassId: vehicleClassId.label,
}),
],
optional: true,
},
price: {
type: "string",
label: "Price",
description: "The price of the booking.",
optional: true,
},
priceType: {
type: "string",
label: "Price Type",
description: "The type of price for the booking.",
options: PRICE_TYPE_OPTIONS,
optional: true,
},
commissionAmount: {
type: "string",
label: "Commission Amount",
description: "The commission amount for the booking.",
optional: true,
},
currencyId: {
propDefinition: [
limoexpress,
"currencyId",
],
optional: true,
},
vatPercentage: {
type: "string",
label: "VAT Percentage",
description: "The VAT percentage for the booking.",
optional: true,
},
paymentMethodId: {
propDefinition: [
limoexpress,
"paymentMethodId",
],
optional: true,
},
distance: {
type: "integer",
label: "Distance",
description: "Number of kilometers/miles that booking will take.",
optional: true,
},
duration: {
type: "string",
label: "Duration",
description: "Number of hours and minutes that booking will take. **Format: HH:MM**",
optional: true,
},
paid: {
type: "boolean",
label: "Paid",
description: "Flag that says is the booking paid or not.",
optional: true,
},
confirmed: {
type: "boolean",
label: "Confirmed",
description: "Flag that says is the booking confirmed or not.",
optional: true,
},
roundTrip: {
type: "boolean",
label: "Round Trip",
description: "Flag that says is the booking a round trip or not.",
optional: true,
},
note: {
type: "string",
label: "Note",
description: "Note for the dispatcher.",
optional: true,
},
noteForDriver: {
type: "string",
label: "Note for Driver",
description: "Note for the driver.",
optional: true,
},
flightNumber: {
type: "string",
label: "Flight Number",
description: "Flight number for the booking.",
optional: true,
},
numOfWaitingHours: {
type: "integer",
label: "Number of Waiting Hours",
description: "Number of waiting hours.",
optional: true,
},
clientId: {
propDefinition: [
limoexpress,
"clientId",
],
optional: true,
},
waitingBoardText: {
type: "string",
label: "Waiting Board Text",
description: "Text that will be places on the waiting board.",
optional: true,
},
babySeatCount: {
type: "integer",
label: "Baby Seat Count",
description: "Number of baby seats that will be used for the booking.",
optional: true,
},
suitcaseCount: {
type: "integer",
label: "Suitcase Count",
description: "Number of suitcases that will be used for the booking.",
optional: true,
},
checkpoints: {
type: "string[]",
label: "Checkpoints",
description: "List of objects of checkpoints location and time. **Format: [{\"location\": { \"name\": string, \"full_address\": string, \"coordinates\": { \"lat\": number, \"lng\": number } }, \"time\": \"01:14\"}]**",
optional: true,
},
passengers: {
type: "string[]",
label: "Passengers",
description: "List of objects of passengers. **Format: [{\"first_name\": string, \"last_name\": string, \"phone\": string, \"email\": string, \"nationality\": string, \"passport\": string, \"country_id\": UUID }]",
optional: true,
},
},
async run({ $ }) {
try {
const response = await this.limoexpress.createBooking({
$,
data: {
booking_type_id: this.bookingTypeId,
booking_status_id: this.bookingStatusId,
from_location: {
name: this.fromLocationName,
full_address: this.fromLocationFullAddress,
coordinates: {
lat: this.fromLocationLatitude,
lng: this.fromLocationLongitude,
},
},
to_location: {
name: this.toLocationName,
full_address: this.toLocationFullAddress,
coordinates: {
lat: this.toLocationLatitude,
lng: this.toLocationLongitude,
},
},
pickup_time: this.pickupTime,
expected_drop_off_time: this.expectedDropOffTime,
expected_comeback_time: this.expectedComebackTime,
vehicle_class_id: this.vehicleClassId.value,
vehicle_id: this.vehicleId,
price: this.price && parseFloat(this.price),
price_type: this.priceType,
commission_amount: this.commissionAmount && parseFloat(this.commissionAmount),
currency_id: this.currencyId,
vat_percentage: this.vatPercentage && parseFloat(this.vatPercentage),
payment_method_id: this.paymentMethodId,
distance: this.distance,
duration: this.duration,
paid: this.paid,
confirmed: this.confirmed,
round_trip: this.roundTrip,
note: this.note,
note_for_driver: this.noteForDriver,
flight_number: this.flightNumber,
num_of_waiting_hours: this.numOfWaitingHours,
client_id: this.clientId,
waiting_board_text: this.waitingBoardText,
baby_seat_count: this.babySeatCount,
suitcase_count: this.suitcaseCount,
checkpoints: this.checkpoints,
passengers: this.passengers,
},
});

$.export("$summary", `Successfully created booking with ID ${response.data.id}`);
return response;
} catch ({ response }) {
throwError(response);
}
},
};
68 changes: 68 additions & 0 deletions components/limoexpress/actions/create-client/create-client.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { TYPE_OPTIONS } from "../../common/constants.mjs";
import { throwError } from "../../common/utils.mjs";
import limoexpress from "../../limoexpress.app.mjs";

export default {
key: "limoexpress-create-client",
name: "Create Client",
description: "Creates a new client with specified details. [See the documentation](https://api.limoexpress.me/api/docs/v1#/Clients/createAOrganisationClient)",
version: "0.0.1",
type: "action",
props: {
limoexpress,
name: {
type: "string",
label: "Name",
description: "Name of the client.",
},
address: {
type: "string",
label: "Address",
description: "Address of the client.",
optional: true,
},
phone: {
type: "string",
label: "Phone",
description: "Phone of the client.",
optional: true,
},
email: {
type: "string",
label: "Email",
description: "Email of the client.",
optional: true,
},
type: {
type: "string",
label: "Type",
description: "Type of the client.",
options: TYPE_OPTIONS,
},
active: {
type: "boolean",
label: "Active",
description: "Active flag is the class active or not.",
},
},
async run({ $ }) {
try {
const response = await this.limoexpress.createClient({
$,
data: {
name: this.name,
address: this.address,
phone: this.phone,
email: this.email,
type: this.type,
active: this.active,
},
});

$.export("$summary", `Successfully created client with ID ${response.data.id}`);
return response;
} catch ({ response }) {
throwError(response);
}
},
};
Loading
Loading