Skip to content

Commit 101957f

Browse files
authored
New Components - limoexpress (#16933)
* limoexpress init * [Components] limoexpress #16907 Sources - New Booking Actions - Create Booking - Create Client - Mark Invoice As Paid * pnpm update * pnpm update * some adjusts * pnpm update * pnpm update
1 parent 22c0e45 commit 101957f

File tree

14 files changed

+846
-12
lines changed

14 files changed

+846
-12
lines changed

components/action1/action1.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

components/buddy/buddy.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

components/guardrails/guardrails.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};
Lines changed: 294 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
import { PRICE_TYPE_OPTIONS } from "../../common/constants.mjs";
2+
import { throwError } from "../../common/utils.mjs";
3+
import limoexpress from "../../limoexpress.app.mjs";
4+
5+
export default {
6+
key: "limoexpress-create-booking",
7+
name: "Create Limo Booking",
8+
description: "Creates a new limo booking with specified details. [See the documentation](https://api.limoexpress.me/api/docs/v1#/Bookings/createBooking)",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
limoexpress,
13+
bookingTypeId: {
14+
propDefinition: [
15+
limoexpress,
16+
"bookingTypeId",
17+
],
18+
},
19+
bookingStatusId: {
20+
propDefinition: [
21+
limoexpress,
22+
"bookingStatusId",
23+
],
24+
optional: true,
25+
},
26+
fromLocationName: {
27+
type: "string",
28+
label: "From Location Name",
29+
description: "The pickup location name.",
30+
},
31+
fromLocationFullAddress: {
32+
type: "string",
33+
label: "From Location Full Address",
34+
description: "The pickup location full address.",
35+
},
36+
fromLocationLatitude: {
37+
type: "string",
38+
label: "From Location Latitude",
39+
description: "The pickup location latitude.",
40+
optional: true,
41+
},
42+
fromLocationLongitude: {
43+
type: "string",
44+
label: "From Location Longitude",
45+
description: "The pickup location longitude.",
46+
optional: true,
47+
},
48+
toLocationName: {
49+
type: "string",
50+
label: "To Location Name",
51+
description: "The dropoff location name.",
52+
},
53+
toLocationFullAddress: {
54+
type: "string",
55+
label: "To Location Full Address",
56+
description: "The dropoff location full address.",
57+
},
58+
toLocationLatitude: {
59+
type: "string",
60+
label: "To Location Latitude",
61+
description: "The dropoff location latitude.",
62+
optional: true,
63+
},
64+
toLocationLongitude: {
65+
type: "string",
66+
label: "To Location Longitude",
67+
description: "The dropoff location longitude.",
68+
optional: true,
69+
},
70+
pickupTime: {
71+
type: "string",
72+
label: "Pickup Time",
73+
description: "The time scheduled for pickup. **Format: YYYY-MM-DD HH:MM:SS**",
74+
},
75+
expectedDropOffTime: {
76+
type: "string",
77+
label: "Expected Drop Off Time",
78+
description: "The expected drop off time. **Format: YYYY-MM-DD HH:MM:SS**",
79+
optional: true,
80+
},
81+
expectedComebackTime: {
82+
type: "string",
83+
label: "Expected Comeback Time",
84+
description: "The expected comeback time. **Format: YYYY-MM-DD HH:MM:SS**",
85+
optional: true,
86+
},
87+
vehicleClassId: {
88+
propDefinition: [
89+
limoexpress,
90+
"vehicleClassId",
91+
],
92+
withLabel: true,
93+
optional: true,
94+
},
95+
vehicleId: {
96+
propDefinition: [
97+
limoexpress,
98+
"vehicleId",
99+
({ vehicleClassId }) => ({
100+
vehicleClassId: vehicleClassId.label,
101+
}),
102+
],
103+
optional: true,
104+
},
105+
price: {
106+
type: "string",
107+
label: "Price",
108+
description: "The price of the booking.",
109+
optional: true,
110+
},
111+
priceType: {
112+
type: "string",
113+
label: "Price Type",
114+
description: "The type of price for the booking.",
115+
options: PRICE_TYPE_OPTIONS,
116+
optional: true,
117+
},
118+
commissionAmount: {
119+
type: "string",
120+
label: "Commission Amount",
121+
description: "The commission amount for the booking.",
122+
optional: true,
123+
},
124+
currencyId: {
125+
propDefinition: [
126+
limoexpress,
127+
"currencyId",
128+
],
129+
optional: true,
130+
},
131+
vatPercentage: {
132+
type: "string",
133+
label: "VAT Percentage",
134+
description: "The VAT percentage for the booking.",
135+
optional: true,
136+
},
137+
paymentMethodId: {
138+
propDefinition: [
139+
limoexpress,
140+
"paymentMethodId",
141+
],
142+
optional: true,
143+
},
144+
distance: {
145+
type: "integer",
146+
label: "Distance",
147+
description: "Number of kilometers/miles that booking will take.",
148+
optional: true,
149+
},
150+
duration: {
151+
type: "string",
152+
label: "Duration",
153+
description: "Number of hours and minutes that booking will take. **Format: HH:MM**",
154+
optional: true,
155+
},
156+
paid: {
157+
type: "boolean",
158+
label: "Paid",
159+
description: "Flag that says is the booking paid or not.",
160+
optional: true,
161+
},
162+
confirmed: {
163+
type: "boolean",
164+
label: "Confirmed",
165+
description: "Flag that says is the booking confirmed or not.",
166+
optional: true,
167+
},
168+
roundTrip: {
169+
type: "boolean",
170+
label: "Round Trip",
171+
description: "Flag that says is the booking a round trip or not.",
172+
optional: true,
173+
},
174+
note: {
175+
type: "string",
176+
label: "Note",
177+
description: "Note for the dispatcher.",
178+
optional: true,
179+
},
180+
noteForDriver: {
181+
type: "string",
182+
label: "Note for Driver",
183+
description: "Note for the driver.",
184+
optional: true,
185+
},
186+
flightNumber: {
187+
type: "string",
188+
label: "Flight Number",
189+
description: "Flight number for the booking.",
190+
optional: true,
191+
},
192+
numOfWaitingHours: {
193+
type: "integer",
194+
label: "Number of Waiting Hours",
195+
description: "Number of waiting hours.",
196+
optional: true,
197+
},
198+
clientId: {
199+
propDefinition: [
200+
limoexpress,
201+
"clientId",
202+
],
203+
optional: true,
204+
},
205+
waitingBoardText: {
206+
type: "string",
207+
label: "Waiting Board Text",
208+
description: "Text that will be places on the waiting board.",
209+
optional: true,
210+
},
211+
babySeatCount: {
212+
type: "integer",
213+
label: "Baby Seat Count",
214+
description: "Number of baby seats that will be used for the booking.",
215+
optional: true,
216+
},
217+
suitcaseCount: {
218+
type: "integer",
219+
label: "Suitcase Count",
220+
description: "Number of suitcases that will be used for the booking.",
221+
optional: true,
222+
},
223+
checkpoints: {
224+
type: "string[]",
225+
label: "Checkpoints",
226+
description: "List of objects of checkpoints location and time. **Format: [{\"location\": { \"name\": string, \"full_address\": string, \"coordinates\": { \"lat\": number, \"lng\": number } }, \"time\": \"01:14\"}]**",
227+
optional: true,
228+
},
229+
passengers: {
230+
type: "string[]",
231+
label: "Passengers",
232+
description: "List of objects of passengers. **Format: [{\"first_name\": string, \"last_name\": string, \"phone\": string, \"email\": string, \"nationality\": string, \"passport\": string, \"country_id\": UUID }]",
233+
optional: true,
234+
},
235+
},
236+
async run({ $ }) {
237+
try {
238+
const response = await this.limoexpress.createBooking({
239+
$,
240+
data: {
241+
booking_type_id: this.bookingTypeId,
242+
booking_status_id: this.bookingStatusId,
243+
from_location: {
244+
name: this.fromLocationName,
245+
full_address: this.fromLocationFullAddress,
246+
coordinates: {
247+
lat: this.fromLocationLatitude,
248+
lng: this.fromLocationLongitude,
249+
},
250+
},
251+
to_location: {
252+
name: this.toLocationName,
253+
full_address: this.toLocationFullAddress,
254+
coordinates: {
255+
lat: this.toLocationLatitude,
256+
lng: this.toLocationLongitude,
257+
},
258+
},
259+
pickup_time: this.pickupTime,
260+
expected_drop_off_time: this.expectedDropOffTime,
261+
expected_comeback_time: this.expectedComebackTime,
262+
vehicle_class_id: this.vehicleClassId.value,
263+
vehicle_id: this.vehicleId,
264+
price: this.price && parseFloat(this.price),
265+
price_type: this.priceType,
266+
commission_amount: this.commissionAmount && parseFloat(this.commissionAmount),
267+
currency_id: this.currencyId,
268+
vat_percentage: this.vatPercentage && parseFloat(this.vatPercentage),
269+
payment_method_id: this.paymentMethodId,
270+
distance: this.distance,
271+
duration: this.duration,
272+
paid: this.paid,
273+
confirmed: this.confirmed,
274+
round_trip: this.roundTrip,
275+
note: this.note,
276+
note_for_driver: this.noteForDriver,
277+
flight_number: this.flightNumber,
278+
num_of_waiting_hours: this.numOfWaitingHours,
279+
client_id: this.clientId,
280+
waiting_board_text: this.waitingBoardText,
281+
baby_seat_count: this.babySeatCount,
282+
suitcase_count: this.suitcaseCount,
283+
checkpoints: this.checkpoints,
284+
passengers: this.passengers,
285+
},
286+
});
287+
288+
$.export("$summary", `Successfully created booking with ID ${response.data.id}`);
289+
return response;
290+
} catch ({ response }) {
291+
throwError(response);
292+
}
293+
},
294+
};
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { TYPE_OPTIONS } from "../../common/constants.mjs";
2+
import { throwError } from "../../common/utils.mjs";
3+
import limoexpress from "../../limoexpress.app.mjs";
4+
5+
export default {
6+
key: "limoexpress-create-client",
7+
name: "Create Client",
8+
description: "Creates a new client with specified details. [See the documentation](https://api.limoexpress.me/api/docs/v1#/Clients/createAOrganisationClient)",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
limoexpress,
13+
name: {
14+
type: "string",
15+
label: "Name",
16+
description: "Name of the client.",
17+
},
18+
address: {
19+
type: "string",
20+
label: "Address",
21+
description: "Address of the client.",
22+
optional: true,
23+
},
24+
phone: {
25+
type: "string",
26+
label: "Phone",
27+
description: "Phone of the client.",
28+
optional: true,
29+
},
30+
email: {
31+
type: "string",
32+
label: "Email",
33+
description: "Email of the client.",
34+
optional: true,
35+
},
36+
type: {
37+
type: "string",
38+
label: "Type",
39+
description: "Type of the client.",
40+
options: TYPE_OPTIONS,
41+
},
42+
active: {
43+
type: "boolean",
44+
label: "Active",
45+
description: "Active flag is the class active or not.",
46+
},
47+
},
48+
async run({ $ }) {
49+
try {
50+
const response = await this.limoexpress.createClient({
51+
$,
52+
data: {
53+
name: this.name,
54+
address: this.address,
55+
phone: this.phone,
56+
email: this.email,
57+
type: this.type,
58+
active: this.active,
59+
},
60+
});
61+
62+
$.export("$summary", `Successfully created client with ID ${response.data.id}`);
63+
return response;
64+
} catch ({ response }) {
65+
throwError(response);
66+
}
67+
},
68+
};

0 commit comments

Comments
 (0)