@driveflux/api-functions 0.0.7-next.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/confirm.js +24 -29
- package/dist/auth/emails.js +12 -13
- package/dist/auth/formatter.js +5 -5
- package/dist/auth/otp.js +66 -50
- package/dist/auth/register.d.ts +1 -1
- package/dist/auth/register.js +42 -34
- package/dist/auth/tokens.d.ts +3 -3
- package/dist/auth/tokens.js +58 -55
- package/dist/auth/verifications.js +53 -52
- package/dist/constants.js +0 -1
- package/dist/mailjet/calls/manage-contacts-in-list.js +5 -6
- package/dist/mailjet/calls/manage-subscription-status.js +4 -5
- package/dist/mailjet/calls/request-service.d.ts +1 -1
- package/dist/mailjet/calls/request-service.d.ts.map +1 -1
- package/dist/mailjet/calls/request-service.js +7 -6
- package/dist/mailjet/refresh-email-preferences.js +11 -12
- package/dist/mailjet/set-contact.js +11 -12
- package/dist/mailjet/types.js +1 -2
- package/dist/mailjet/utils/convert-to-array.js +8 -6
- package/dist/mailjet/utils/extract-email-preferences.js +14 -15
- package/dist/mailjet/utils/lists.js +7 -8
- package/dist/mailjet/utils/update-email-references.js +16 -15
- package/dist/notion/client.d.ts.map +1 -1
- package/dist/notion/client.js +24 -20
- package/dist/notion/client.js.map +1 -1
- package/dist/notion/helpful.js +6 -9
- package/dist/notion/schemas/block.js +42 -48
- package/dist/notion/schemas/common.js +9 -14
- package/dist/notion/schemas/database.d.ts +1 -1
- package/dist/notion/schemas/database.js +62 -60
- package/dist/notion/schemas/emoji.js +1 -2
- package/dist/notion/schemas/file.js +9 -9
- package/dist/notion/schemas/kb.js +5 -6
- package/dist/notion/schemas/page.d.ts +1 -1
- package/dist/notion/schemas/page.js +72 -61
- package/dist/notion/schemas/parent.js +4 -5
- package/dist/notion/schemas/user.js +18 -19
- package/dist/reservation/agree.js +6 -7
- package/dist/reservation/checks.js +3 -4
- package/dist/reservation/display-vehicle.d.ts +16 -16
- package/dist/reservation/display-vehicle.js +65 -71
- package/dist/reservation/fetch-or-create.d.ts +1 -1
- package/dist/reservation/fetch-or-create.d.ts.map +1 -1
- package/dist/reservation/fetch-or-create.js +50 -62
- package/dist/reservation/fetch-or-create.js.map +1 -1
- package/dist/reservation/invoice.d.ts +2 -1
- package/dist/reservation/invoice.d.ts.map +1 -1
- package/dist/reservation/invoice.js +62 -74
- package/dist/reservation/payer.js +5 -6
- package/dist/reservation/reserve.js +3 -4
- package/dist/reservation/types.d.ts +0 -1
- package/dist/reservation/types.d.ts.map +1 -1
- package/dist/reservation/types.js +1 -2
- package/dist/reservation/vehicle.js +13 -16
- package/dist/slack.d.ts +2 -2
- package/dist/slack.d.ts.map +1 -1
- package/dist/slack.js +24 -29
- package/dist/validation.d.ts +4 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +77 -71
- package/dist/validation.js.map +1 -1
- package/dist/vehicle/vehicle-pricing/constants.js +22 -19
- package/dist/vehicle/vehicle-pricing/index.js +28 -42
- package/dist/vehicle/vehicle-pricing/types.js +1 -2
- package/package.json +28 -28
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type DisplayVehicle, type MileagePackage, type PlanType, type UltraTier, type Vehicle, type VehicleType } from '@driveflux/db';
|
|
2
2
|
export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | string) => Promise<{
|
|
3
3
|
object: import("@driveflux/db").DisplayVehicleObject;
|
|
4
|
-
type: VehicleType;
|
|
5
4
|
id: string;
|
|
6
5
|
createdAt: Date;
|
|
7
6
|
updatedAt: Date;
|
|
@@ -9,6 +8,7 @@ export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | stri
|
|
|
9
8
|
vehicleModel: string;
|
|
10
9
|
variant: string;
|
|
11
10
|
year: number;
|
|
11
|
+
type: VehicleType;
|
|
12
12
|
brandSlug: string;
|
|
13
13
|
brandId: string;
|
|
14
14
|
defaultHostId: string;
|
|
@@ -191,20 +191,20 @@ export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | stri
|
|
|
191
191
|
export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVehicle | string, selectedColor?: string) => Promise<({
|
|
192
192
|
host: {
|
|
193
193
|
object: import("@driveflux/db").HostObject;
|
|
194
|
-
|
|
195
|
-
type: import("@driveflux/db").HostType | null;
|
|
194
|
+
name: string;
|
|
196
195
|
id: string;
|
|
197
196
|
metadata: PrismaJson.AnyMetadata | null;
|
|
198
|
-
name: string;
|
|
199
197
|
createdAt: Date;
|
|
200
198
|
updatedAt: Date;
|
|
199
|
+
registrationNumber: string | null;
|
|
200
|
+
type: import("@driveflux/db").HostType | null;
|
|
201
|
+
active: boolean;
|
|
201
202
|
email: string | null;
|
|
203
|
+
phoneNumber: string | null;
|
|
202
204
|
race: import("@driveflux/db").Race | null;
|
|
203
205
|
emergencyContactName: string | null;
|
|
204
206
|
emergencyPhoneNumber: string | null;
|
|
205
|
-
active: boolean;
|
|
206
207
|
commencementDate: Date | null;
|
|
207
|
-
registrationNumber: string | null;
|
|
208
208
|
stripeAccountId: string | null;
|
|
209
209
|
isStripeConnected: boolean;
|
|
210
210
|
serviceCenterIds: string[];
|
|
@@ -262,15 +262,11 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
262
262
|
};
|
|
263
263
|
} & {
|
|
264
264
|
object: import("@driveflux/db").VehicleObject;
|
|
265
|
-
type: VehicleType;
|
|
266
265
|
id: string;
|
|
266
|
+
status: import("@driveflux/db").VehicleStatus;
|
|
267
267
|
metadata: PrismaJson.AnyMetadata | null;
|
|
268
268
|
createdAt: Date;
|
|
269
269
|
updatedAt: Date;
|
|
270
|
-
status: import("@driveflux/db").VehicleStatus;
|
|
271
|
-
temporary: boolean;
|
|
272
|
-
registrationNumber: string | null;
|
|
273
|
-
hostId: string;
|
|
274
270
|
make: string;
|
|
275
271
|
vehicleModel: string;
|
|
276
272
|
variant: string;
|
|
@@ -280,6 +276,7 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
280
276
|
compositeSearchScore: number;
|
|
281
277
|
registrationDate: Date | null;
|
|
282
278
|
mileage: number | null;
|
|
279
|
+
registrationNumber: string | null;
|
|
283
280
|
vin: string | null;
|
|
284
281
|
engineNumber: string | null;
|
|
285
282
|
availability: import("@driveflux/db").VehicleAvailablity | null;
|
|
@@ -294,6 +291,8 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
294
291
|
delistedAt: Date | null;
|
|
295
292
|
imagesNotActual: boolean;
|
|
296
293
|
imagesNotActualMessage: string | null;
|
|
294
|
+
hostId: string;
|
|
295
|
+
type: VehicleType;
|
|
297
296
|
allowedServiceCenterIds: string[];
|
|
298
297
|
displayVehicleId: string | null;
|
|
299
298
|
isHostConfirmed: boolean | null;
|
|
@@ -306,6 +305,7 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
306
305
|
featureOnLandingPage: boolean;
|
|
307
306
|
lastMileageRecordedAt: Date | null;
|
|
308
307
|
locationAvailability: string[];
|
|
308
|
+
temporary: boolean;
|
|
309
309
|
hotDeal: boolean | null;
|
|
310
310
|
activeSubscriptionId: string | null;
|
|
311
311
|
addresses: {
|
|
@@ -689,15 +689,11 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
689
689
|
}) | undefined>;
|
|
690
690
|
export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayVehicle | string, selectedColor: string) => Promise<({
|
|
691
691
|
object: import("@driveflux/db").VehicleObject;
|
|
692
|
-
type: VehicleType;
|
|
693
692
|
id: string;
|
|
693
|
+
status: import("@driveflux/db").VehicleStatus;
|
|
694
694
|
metadata: PrismaJson.AnyMetadata | null;
|
|
695
695
|
createdAt: Date;
|
|
696
696
|
updatedAt: Date;
|
|
697
|
-
status: import("@driveflux/db").VehicleStatus;
|
|
698
|
-
temporary: boolean;
|
|
699
|
-
registrationNumber: string | null;
|
|
700
|
-
hostId: string;
|
|
701
697
|
make: string;
|
|
702
698
|
vehicleModel: string;
|
|
703
699
|
variant: string;
|
|
@@ -707,6 +703,7 @@ export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayV
|
|
|
707
703
|
compositeSearchScore: number;
|
|
708
704
|
registrationDate: Date | null;
|
|
709
705
|
mileage: number | null;
|
|
706
|
+
registrationNumber: string | null;
|
|
710
707
|
vin: string | null;
|
|
711
708
|
engineNumber: string | null;
|
|
712
709
|
availability: import("@driveflux/db").VehicleAvailablity | null;
|
|
@@ -721,6 +718,8 @@ export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayV
|
|
|
721
718
|
delistedAt: Date | null;
|
|
722
719
|
imagesNotActual: boolean;
|
|
723
720
|
imagesNotActualMessage: string | null;
|
|
721
|
+
hostId: string;
|
|
722
|
+
type: VehicleType;
|
|
724
723
|
allowedServiceCenterIds: string[];
|
|
725
724
|
displayVehicleId: string | null;
|
|
726
725
|
isHostConfirmed: boolean | null;
|
|
@@ -733,6 +732,7 @@ export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayV
|
|
|
733
732
|
featureOnLandingPage: boolean;
|
|
734
733
|
lastMileageRecordedAt: Date | null;
|
|
735
734
|
locationAvailability: string[];
|
|
735
|
+
temporary: boolean;
|
|
736
736
|
hotDeal: boolean | null;
|
|
737
737
|
activeSubscriptionId: string | null;
|
|
738
738
|
addresses: {
|
|
@@ -1,73 +1,75 @@
|
|
|
1
1
|
import { config } from '@driveflux/config/backend';
|
|
2
|
-
import { prisma
|
|
2
|
+
import { prisma } from '@driveflux/db';
|
|
3
3
|
import { generateId } from '@driveflux/db/id';
|
|
4
4
|
import { createPricingController } from '@driveflux/db/models/vehicle';
|
|
5
|
-
import { getFluxExcessMileage, getFluxPiceMatrix, getHostExcessMileage, getHostsMatrix, getRecommendedMotorcycleDeposit, getStartFeeMatrix
|
|
6
|
-
export const fetchDisplayVehicle = async (displayVehicle)
|
|
7
|
-
return typeof displayVehicle === 'string'
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { getFluxExcessMileage, getFluxPiceMatrix, getHostExcessMileage, getHostsMatrix, getRecommendedMotorcycleDeposit, getStartFeeMatrix } from '../vehicle/vehicle-pricing/index.js';
|
|
6
|
+
export const fetchDisplayVehicle = async (displayVehicle)=>{
|
|
7
|
+
return typeof displayVehicle === 'string' ? await prisma.displayVehicle.findFirst({
|
|
8
|
+
where: {
|
|
9
|
+
id: displayVehicle
|
|
10
|
+
}
|
|
11
|
+
}) : displayVehicle;
|
|
10
12
|
};
|
|
11
|
-
export const createVehicleFromDisplayVehicle = async (displayVehicle, selectedColor)
|
|
13
|
+
export const createVehicleFromDisplayVehicle = async (displayVehicle, selectedColor)=>{
|
|
12
14
|
const dv = await fetchDisplayVehicle(displayVehicle);
|
|
13
|
-
if (!dv || typeof dv !== 'object')
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return;
|
|
17
|
-
const mainImage = dv.images.main.find((m) => m.variant === selectedColor)?.url;
|
|
15
|
+
if (!dv || typeof dv !== 'object') return;
|
|
16
|
+
if (!dv.details) return;
|
|
17
|
+
const mainImage = dv.images.main.find((m)=>m.variant === selectedColor)?.url;
|
|
18
18
|
const vehicleData = {
|
|
19
19
|
id: generateId('Vehicle'),
|
|
20
20
|
...transformBasicVehicleData(dv),
|
|
21
21
|
images: [
|
|
22
|
-
...
|
|
23
|
-
|
|
22
|
+
...mainImage ? [
|
|
23
|
+
transfromSingleImage(mainImage)
|
|
24
|
+
] : [],
|
|
25
|
+
...transformImages(dv.images)
|
|
24
26
|
],
|
|
25
27
|
...transformBasePrices(dv.pricing),
|
|
26
28
|
pricing: transformPriceMatrix(dv.type, dv.pricing),
|
|
27
29
|
details: transformDetails(dv.details, selectedColor),
|
|
28
30
|
host: {
|
|
29
31
|
connect: {
|
|
30
|
-
id: dv.defaultHostId
|
|
31
|
-
}
|
|
32
|
+
id: dv.defaultHostId
|
|
33
|
+
}
|
|
32
34
|
},
|
|
33
35
|
displayVehicle: {
|
|
34
36
|
connect: {
|
|
35
|
-
id: dv.id
|
|
36
|
-
}
|
|
37
|
-
}
|
|
37
|
+
id: dv.id
|
|
38
|
+
}
|
|
39
|
+
}
|
|
38
40
|
};
|
|
39
41
|
return await prisma.vehicle.create({
|
|
40
42
|
data: vehicleData,
|
|
41
43
|
include: {
|
|
42
|
-
host: true
|
|
43
|
-
}
|
|
44
|
+
host: true
|
|
45
|
+
}
|
|
44
46
|
});
|
|
45
47
|
};
|
|
46
|
-
export const transfromVehicleDisplayToVehicle = async (displayVehicle, selectedColor)
|
|
48
|
+
export const transfromVehicleDisplayToVehicle = async (displayVehicle, selectedColor)=>{
|
|
47
49
|
const dv = await fetchDisplayVehicle(displayVehicle);
|
|
48
|
-
if (!dv || typeof dv !== 'object')
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return;
|
|
52
|
-
const mainImage = dv.images.main.find((m) => m.variant === selectedColor)?.url;
|
|
50
|
+
if (!dv || typeof dv !== 'object') return;
|
|
51
|
+
if (!dv.details) return;
|
|
52
|
+
const mainImage = dv.images.main.find((m)=>m.variant === selectedColor)?.url;
|
|
53
53
|
return {
|
|
54
54
|
id: dv.id,
|
|
55
55
|
...transformBasicVehicleData(dv),
|
|
56
56
|
images: [
|
|
57
|
-
...
|
|
58
|
-
|
|
57
|
+
...mainImage ? [
|
|
58
|
+
transfromSingleImage(mainImage)
|
|
59
|
+
] : [],
|
|
60
|
+
...transformImages(dv.images)
|
|
59
61
|
],
|
|
60
62
|
...transformBasePrices(dv.pricing),
|
|
61
63
|
pricing: transformPriceMatrix(dv.type, dv.pricing),
|
|
62
64
|
details: transformDetails(dv.details, selectedColor),
|
|
63
65
|
host: {
|
|
64
66
|
address: {
|
|
65
|
-
state: 'Kuala Lumpur'
|
|
66
|
-
}
|
|
67
|
-
}
|
|
67
|
+
state: 'Kuala Lumpur'
|
|
68
|
+
}
|
|
69
|
+
}
|
|
68
70
|
};
|
|
69
71
|
};
|
|
70
|
-
export const transformBasicVehicleData = (dv)
|
|
72
|
+
export const transformBasicVehicleData = (dv)=>{
|
|
71
73
|
return {
|
|
72
74
|
registrationNumber: null,
|
|
73
75
|
featured: false,
|
|
@@ -85,17 +87,17 @@ export const transformBasicVehicleData = (dv) => {
|
|
|
85
87
|
type: dv.type,
|
|
86
88
|
niceName: `${dv.make} ${dv.vehicleModel} ${dv.variant} ${dv.year}`,
|
|
87
89
|
niceNameShort: `${dv.make} ${dv.vehicleModel}`,
|
|
88
|
-
appliedCoupon: dv.appliedCoupon
|
|
90
|
+
appliedCoupon: dv.appliedCoupon
|
|
89
91
|
};
|
|
90
92
|
};
|
|
91
|
-
export const transformImages = (images)
|
|
93
|
+
export const transformImages = (images)=>{
|
|
92
94
|
return [
|
|
93
95
|
transfromSingleImage(images.exterior[0].url, 'exterior'),
|
|
94
96
|
transfromSingleImage(images.interior[0].url, 'interior'),
|
|
95
|
-
...images.gallery.map((i)
|
|
97
|
+
...images.gallery.map((i)=>transfromSingleImage(i.url))
|
|
96
98
|
];
|
|
97
99
|
};
|
|
98
|
-
const transfromSingleImage = (imageUrl, inspectionType)
|
|
100
|
+
const transfromSingleImage = (imageUrl, inspectionType)=>{
|
|
99
101
|
return {
|
|
100
102
|
default: imageUrl,
|
|
101
103
|
blurBase64: null,
|
|
@@ -106,20 +108,20 @@ const transfromSingleImage = (imageUrl, inspectionType) => {
|
|
|
106
108
|
description: null,
|
|
107
109
|
inspection: !!inspectionType,
|
|
108
110
|
inspectionType: inspectionType || null,
|
|
109
|
-
notActualPhoto: true
|
|
111
|
+
notActualPhoto: true
|
|
110
112
|
};
|
|
111
113
|
};
|
|
112
|
-
const transformBasePrices = (pricing)
|
|
114
|
+
const transformBasePrices = (pricing)=>{
|
|
113
115
|
return {
|
|
114
116
|
basePrice: pricing.matrix.plan36.lite,
|
|
115
117
|
basePricePlan1: pricing.matrix.plan1.lite,
|
|
116
118
|
basePricePlan12: pricing.matrix.plan12.lite,
|
|
117
119
|
basePricePlan24: pricing.matrix.plan24.lite,
|
|
118
120
|
basePricePlan36: pricing.matrix.plan36.lite,
|
|
119
|
-
basePricePlan60: pricing.matrix.plan60.lite
|
|
121
|
+
basePricePlan60: pricing.matrix.plan60.lite
|
|
120
122
|
};
|
|
121
123
|
};
|
|
122
|
-
const transformPriceMatrix = (vehicleType, pricing)
|
|
124
|
+
const transformPriceMatrix = (vehicleType, pricing)=>{
|
|
123
125
|
const baseline = pricing?.matrix.plan36.lite;
|
|
124
126
|
const ultraTier = 'tier1';
|
|
125
127
|
const fluxPriceCoefficient = 25;
|
|
@@ -132,16 +134,14 @@ const transformPriceMatrix = (vehicleType, pricing) => {
|
|
|
132
134
|
const { availablePlans, availableMileagePackages } = getNonZeroKeys(priceMatrix);
|
|
133
135
|
const pricingController = createPricingController({
|
|
134
136
|
coefficient: fluxPriceCoefficient,
|
|
135
|
-
vehicleType
|
|
137
|
+
vehicleType
|
|
136
138
|
});
|
|
137
139
|
const startFeeMatrix = excludeServiceFeesFrom(getStartFeeMatrix(pricingController, baseline, flatPricing));
|
|
138
140
|
const hostMatrix = excludeServiceFeesFrom(getHostsMatrix(pricingController, baseline, ultraTier, flatPricing));
|
|
139
141
|
const hostExcessMileage = getHostExcessMileage(pricingController, baseline);
|
|
140
142
|
const fluxPriceMatrix = excludeServiceFeesFrom(getFluxPiceMatrix(pricingController, vehicleType, baseline, hostMatrix, ultraTier, flatPricing));
|
|
141
143
|
const fluxExcessMileage = getFluxExcessMileage(pricingController, baseline);
|
|
142
|
-
const recommendedDeposit = pricing.refundableDeposit || vehicleType === 'motorcycle'
|
|
143
|
-
? getRecommendedMotorcycleDeposit(baseline)
|
|
144
|
-
: null;
|
|
144
|
+
const recommendedDeposit = pricing.refundableDeposit || vehicleType === 'motorcycle' ? getRecommendedMotorcycleDeposit(baseline) : null;
|
|
145
145
|
return {
|
|
146
146
|
tmv,
|
|
147
147
|
gfv,
|
|
@@ -160,31 +160,31 @@ const transformPriceMatrix = (vehicleType, pricing) => {
|
|
|
160
160
|
excessMileage: fluxExcessMileage,
|
|
161
161
|
originalExcessMileage: fluxExcessMileage,
|
|
162
162
|
matrixComments: null,
|
|
163
|
-
add: null
|
|
163
|
+
add: null
|
|
164
164
|
},
|
|
165
165
|
hostTake: {
|
|
166
166
|
matrix: hostMatrix,
|
|
167
167
|
originalMatrix: hostMatrix,
|
|
168
168
|
excessMileage: hostExcessMileage,
|
|
169
169
|
originalExcessMileage: hostExcessMileage,
|
|
170
|
-
matrixComments: null
|
|
170
|
+
matrixComments: null
|
|
171
171
|
},
|
|
172
172
|
startFee: {
|
|
173
173
|
matrix: startFeeMatrix,
|
|
174
174
|
originalMatrix: startFeeMatrix,
|
|
175
|
-
matrixComments: null
|
|
176
|
-
}
|
|
175
|
+
matrixComments: null
|
|
176
|
+
}
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
|
-
const getNonZeroKeys = (matrix)
|
|
179
|
+
const getNonZeroKeys = (matrix)=>{
|
|
180
180
|
const planKeys = new Set();
|
|
181
181
|
const mileageKeys = new Set();
|
|
182
|
-
for (const [plan, mileageMap] of Object.entries(matrix))
|
|
182
|
+
for (const [plan, mileageMap] of Object.entries(matrix)){
|
|
183
183
|
const entries = Object.entries(mileageMap ?? {});
|
|
184
|
-
const hasNonZero = entries.some(([_, value])
|
|
184
|
+
const hasNonZero = entries.some(([_, value])=>(value ?? 0) > 0);
|
|
185
185
|
if (hasNonZero) {
|
|
186
186
|
planKeys.add(plan);
|
|
187
|
-
for (const [mileage, value] of entries)
|
|
187
|
+
for (const [mileage, value] of entries){
|
|
188
188
|
if ((value ?? 0) > 0) {
|
|
189
189
|
mileageKeys.add(mileage);
|
|
190
190
|
}
|
|
@@ -193,20 +193,20 @@ const getNonZeroKeys = (matrix) => {
|
|
|
193
193
|
}
|
|
194
194
|
return {
|
|
195
195
|
availablePlans: Array.from(planKeys),
|
|
196
|
-
availableMileagePackages: Array.from(mileageKeys)
|
|
196
|
+
availableMileagePackages: Array.from(mileageKeys)
|
|
197
197
|
};
|
|
198
198
|
};
|
|
199
|
-
const _getInspection = ()
|
|
199
|
+
const _getInspection = ()=>{
|
|
200
200
|
return {
|
|
201
201
|
exterior: 5,
|
|
202
202
|
interior: 5,
|
|
203
203
|
engine: 5,
|
|
204
204
|
frame: 5,
|
|
205
205
|
total: 5,
|
|
206
|
-
comment: 'COMMENT HERE'
|
|
206
|
+
comment: 'COMMENT HERE'
|
|
207
207
|
};
|
|
208
208
|
};
|
|
209
|
-
const transformDetails = (details, selectColor)
|
|
209
|
+
const transformDetails = (details, selectColor)=>{
|
|
210
210
|
const color = selectColor || details.colors[0].name || '';
|
|
211
211
|
return {
|
|
212
212
|
numberOfSeats: details.numberOfSeats,
|
|
@@ -214,31 +214,25 @@ const transformDetails = (details, selectColor) => {
|
|
|
214
214
|
bodyType: details.bodyType,
|
|
215
215
|
transmission: details.transmission,
|
|
216
216
|
engineType: details.fuelType,
|
|
217
|
-
engineCapacity: details.fuelType === 'electric'
|
|
218
|
-
? details.batteryCapacity
|
|
219
|
-
: details.engineCapacity,
|
|
217
|
+
engineCapacity: details.fuelType === 'electric' ? details.batteryCapacity : details.engineCapacity,
|
|
220
218
|
drivetrain: details.drivetrain,
|
|
221
219
|
accelerationTo100km: details.accelerationTo100km,
|
|
222
220
|
fuelConsumptionLitersPer100Km: details.fuelConsumptionLitersPer100Km,
|
|
223
221
|
color,
|
|
224
222
|
features: details.features,
|
|
225
|
-
condition: 'new'
|
|
223
|
+
condition: 'new'
|
|
226
224
|
};
|
|
227
225
|
};
|
|
228
|
-
const excludeServiceFeesFrom = (originalMatrix)
|
|
226
|
+
const excludeServiceFeesFrom = (originalMatrix)=>{
|
|
229
227
|
const matrix = {};
|
|
230
|
-
for (const [planKey, planValue] of Object.entries(originalMatrix))
|
|
231
|
-
if (!planValue)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
matrix[planKey] = {};
|
|
235
|
-
for (const [mileageKey, price] of Object.entries(planValue)) {
|
|
228
|
+
for (const [planKey, planValue] of Object.entries(originalMatrix)){
|
|
229
|
+
if (!planValue) continue;
|
|
230
|
+
if (!matrix[planKey]) matrix[planKey] = {};
|
|
231
|
+
for (const [mileageKey, price] of Object.entries(planValue)){
|
|
236
232
|
if (typeof price === 'number') {
|
|
237
|
-
matrix[planKey][mileageKey] =
|
|
238
|
-
price / (1 + config.serviceRate);
|
|
233
|
+
matrix[planKey][mileageKey] = price / (1 + config.serviceRate);
|
|
239
234
|
}
|
|
240
235
|
}
|
|
241
236
|
}
|
|
242
237
|
return matrix;
|
|
243
238
|
};
|
|
244
|
-
//# sourceMappingURL=display-vehicle.js.map
|
|
@@ -4,7 +4,7 @@ import type { ReserveVehicleParams } from './types.js';
|
|
|
4
4
|
type FetchOrCreateReservationParams = {
|
|
5
5
|
vehicle: Pick<Vehicle, 'id' | 'make' | 'vehicleModel' | 'variant' | 'year' | 'type'>;
|
|
6
6
|
payer: User | Business;
|
|
7
|
-
body: Pick<ReserveVehicleParams, 'subscribingUser' | 'plan' | 'mileagePackage' | 'couponCode' | 'referralCode' | 'asBusiness' | 'source' | 'paymentIntentId' | 'analytics' | 'deliveryAddresses' | 'deliveryDate' | 'requestUser' | 'ipAddress' | 'freeReservation' | 'freeReservationReason'
|
|
7
|
+
body: Pick<ReserveVehicleParams, 'subscribingUser' | 'plan' | 'mileagePackage' | 'couponCode' | 'referralCode' | 'asBusiness' | 'source' | 'paymentIntentId' | 'analytics' | 'deliveryAddresses' | 'deliveryDate' | 'requestUser' | 'ipAddress' | 'freeReservation' | 'freeReservationReason'>;
|
|
8
8
|
};
|
|
9
9
|
export declare const fetchOrCreateReservation: ({ vehicle, payer, body, }: FetchOrCreateReservationParams) => PromisedResult<SubscriptionReservation>;
|
|
10
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-or-create.d.ts","sourceRoot":"","sources":["../../src/reservation/fetch-or-create.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,QAAQ,EAGb,KAAK,uBAAu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,iBAAiB,GACjB,WAAW,GACX,mBAAmB,GACnB,cAAc,GACd,aAAa,GACb,WAAW,GACX,iBAAiB,GACjB,uBAAuB,CACzB,CAAA;CACD,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAU,2BAI5C,8BAA8B,KAAG,cAAc,CAAC,uBAAuB,CAgKzE,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { prisma
|
|
1
|
+
import { prisma } from '@driveflux/db';
|
|
2
2
|
import { generateId } from '@driveflux/db/id';
|
|
3
3
|
import { reportError } from '@driveflux/reporter';
|
|
4
4
|
import { Ok } from '@driveflux/result';
|
|
5
5
|
import { slackLater } from '../slack.js';
|
|
6
|
-
import { createReservationInvoice, updateReservationInvoiceIfNeeded
|
|
7
|
-
export const fetchOrCreateReservation = async ({ vehicle, payer, body
|
|
8
|
-
const { subscribingUser, plan, mileagePackage, couponCode, referralCode, asBusiness, source, deliveryAddresses, deliveryDate, analytics, paymentIntentId, freeReservation, freeReservationReason
|
|
6
|
+
import { createReservationInvoice, updateReservationInvoiceIfNeeded } from './invoice.js';
|
|
7
|
+
export const fetchOrCreateReservation = async ({ vehicle, payer, body })=>{
|
|
8
|
+
const { subscribingUser, plan, mileagePackage, couponCode, referralCode, asBusiness, source, deliveryAddresses, deliveryDate, analytics, paymentIntentId, freeReservation, freeReservationReason } = body;
|
|
9
9
|
try {
|
|
10
10
|
const previousReservation = await prisma.subscriptionReservation.findFirst({
|
|
11
11
|
where: {
|
|
@@ -19,20 +19,13 @@ export const fetchOrCreateReservation = async ({ vehicle, payer, body, }) => {
|
|
|
19
19
|
source,
|
|
20
20
|
// If the subscription ID was populated, this means that this reservation was consumed into a subsription,
|
|
21
21
|
// so we shouldn't re-use it
|
|
22
|
-
subscription: null
|
|
22
|
+
subscription: null
|
|
23
23
|
},
|
|
24
24
|
orderBy: {
|
|
25
|
-
updatedAt: 'desc'
|
|
25
|
+
updatedAt: 'desc'
|
|
26
26
|
},
|
|
27
27
|
include: {
|
|
28
28
|
invoice: {
|
|
29
|
-
...(invoiceId
|
|
30
|
-
? {
|
|
31
|
-
where: {
|
|
32
|
-
id: invoiceId,
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
: {}),
|
|
36
29
|
select: {
|
|
37
30
|
id: true,
|
|
38
31
|
voided: true,
|
|
@@ -44,10 +37,10 @@ export const fetchOrCreateReservation = async ({ vehicle, payer, body, }) => {
|
|
|
44
37
|
status: true,
|
|
45
38
|
lockedAt: true,
|
|
46
39
|
unlockAt: true,
|
|
47
|
-
locked: true
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
40
|
+
locked: true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
51
44
|
});
|
|
52
45
|
if (previousReservation) {
|
|
53
46
|
if (previousReservation.invoice.voided) {
|
|
@@ -60,7 +53,7 @@ export const fetchOrCreateReservation = async ({ vehicle, payer, body, }) => {
|
|
|
60
53
|
'partiallyPaid',
|
|
61
54
|
'partiallyRefunded',
|
|
62
55
|
'refunded',
|
|
63
|
-
'pendingRefund'
|
|
56
|
+
'pendingRefund'
|
|
64
57
|
];
|
|
65
58
|
if (wrongStatuses.includes(previousReservation.invoice.status)) {
|
|
66
59
|
const updatedReservation = await recreateReservationInvoiceAndUpdateReservation(previousReservation, body, vehicle, payer);
|
|
@@ -73,16 +66,16 @@ export const fetchOrCreateReservation = async ({ vehicle, payer, body, }) => {
|
|
|
73
66
|
text: {
|
|
74
67
|
type: 'plain_text',
|
|
75
68
|
text: '‼️ Reservation invoice in wrong status',
|
|
76
|
-
emoji: true
|
|
77
|
-
}
|
|
69
|
+
emoji: true
|
|
70
|
+
}
|
|
78
71
|
},
|
|
79
72
|
{
|
|
80
73
|
type: 'section',
|
|
81
74
|
text: {
|
|
82
75
|
type: 'plain_text',
|
|
83
|
-
text: `The reservation invoice ${previousReservation.invoice.id} was in a wrong status (${previousReservation.invoice.status}), it was discarded and a new invoice (${updatedReservation.val.id}) was created, however, investigate the issue
|
|
84
|
-
}
|
|
85
|
-
}
|
|
76
|
+
text: `The reservation invoice ${previousReservation.invoice.id} was in a wrong status (${previousReservation.invoice.status}), it was discarded and a new invoice (${updatedReservation.val.id}) was created, however, investigate the issue.`
|
|
77
|
+
}
|
|
78
|
+
}
|
|
86
79
|
]);
|
|
87
80
|
return updatedReservation;
|
|
88
81
|
}
|
|
@@ -94,15 +87,14 @@ export const fetchOrCreateReservation = async ({ vehicle, payer, body, }) => {
|
|
|
94
87
|
// Otherwise, we need to create a new reservation
|
|
95
88
|
return new Ok(previousReservation);
|
|
96
89
|
}
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
90
|
+
} catch (error) {
|
|
99
91
|
// We couldn't fetch the reservation, so we create a new one and just log this
|
|
100
92
|
await reportError(error);
|
|
101
93
|
}
|
|
102
94
|
const reservationId = generateId('SubscriptionReservation');
|
|
103
95
|
// Create the reservation invoice
|
|
104
96
|
const invoiceResult = await createReservationInvoice({
|
|
105
|
-
invoiceId,
|
|
97
|
+
invoiceId: generateId('Invoice'),
|
|
106
98
|
couponCode,
|
|
107
99
|
plan,
|
|
108
100
|
mileagePackage,
|
|
@@ -114,7 +106,7 @@ export const fetchOrCreateReservation = async ({ vehicle, payer, body, }) => {
|
|
|
114
106
|
analytics,
|
|
115
107
|
vehicle,
|
|
116
108
|
payer,
|
|
117
|
-
subscribingUser
|
|
109
|
+
subscribingUser
|
|
118
110
|
});
|
|
119
111
|
if (invoiceResult.err) {
|
|
120
112
|
return invoiceResult;
|
|
@@ -133,66 +125,63 @@ export const fetchOrCreateReservation = async ({ vehicle, payer, body, }) => {
|
|
|
133
125
|
deliveryAddresses,
|
|
134
126
|
deliveryDate,
|
|
135
127
|
asBusiness,
|
|
136
|
-
source
|
|
128
|
+
source
|
|
137
129
|
});
|
|
138
130
|
return new Ok(reservation);
|
|
139
131
|
};
|
|
140
|
-
const createReservation = async ({ reservationId, invoiceId, subscribingUserId, vehicleId, businessId, plan, mileagePackage, couponCode, referralCode, analytics, deliveryAddresses, deliveryDate, asBusiness, source
|
|
132
|
+
const createReservation = async ({ reservationId, invoiceId, subscribingUserId, vehicleId, businessId, plan, mileagePackage, couponCode, referralCode, analytics, deliveryAddresses, deliveryDate, asBusiness, source })=>{
|
|
141
133
|
return await prisma.subscriptionReservation.create({
|
|
142
134
|
data: {
|
|
143
135
|
id: reservationId,
|
|
144
136
|
invoice: {
|
|
145
137
|
connect: {
|
|
146
|
-
id: invoiceId
|
|
147
|
-
}
|
|
138
|
+
id: invoiceId
|
|
139
|
+
}
|
|
148
140
|
},
|
|
149
141
|
user: {
|
|
150
142
|
connect: {
|
|
151
|
-
id: subscribingUserId
|
|
152
|
-
}
|
|
143
|
+
id: subscribingUserId
|
|
144
|
+
}
|
|
153
145
|
},
|
|
154
146
|
vehicle: {
|
|
155
147
|
connect: {
|
|
156
|
-
id: vehicleId
|
|
157
|
-
}
|
|
148
|
+
id: vehicleId
|
|
149
|
+
}
|
|
158
150
|
},
|
|
159
|
-
...
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
},
|
|
165
|
-
},
|
|
151
|
+
...businessId ? {
|
|
152
|
+
business: {
|
|
153
|
+
connect: {
|
|
154
|
+
id: businessId
|
|
155
|
+
}
|
|
166
156
|
}
|
|
167
|
-
|
|
157
|
+
} : undefined,
|
|
168
158
|
plan,
|
|
169
159
|
mileagePackage,
|
|
170
160
|
couponCode: couponCode,
|
|
171
161
|
deliveryAddresses: deliveryAddresses,
|
|
172
162
|
deliveryDate: deliveryDate,
|
|
173
|
-
...
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
},
|
|
179
|
-
},
|
|
163
|
+
...referralCode ? {
|
|
164
|
+
referral: {
|
|
165
|
+
connect: {
|
|
166
|
+
id: referralCode
|
|
167
|
+
}
|
|
180
168
|
}
|
|
181
|
-
|
|
169
|
+
} : undefined,
|
|
182
170
|
asBusiness: !!asBusiness,
|
|
183
171
|
source,
|
|
184
172
|
metadata: {
|
|
185
|
-
analytics
|
|
186
|
-
}
|
|
187
|
-
}
|
|
173
|
+
analytics
|
|
174
|
+
}
|
|
175
|
+
}
|
|
188
176
|
});
|
|
189
177
|
};
|
|
190
|
-
const recreateReservationInvoiceAndUpdateReservation = async (previousReservation,
|
|
178
|
+
const recreateReservationInvoiceAndUpdateReservation = async (previousReservation, body, vehicle, payer)=>{
|
|
191
179
|
const invoiceResult = await createReservationInvoice({
|
|
192
180
|
...body,
|
|
181
|
+
invoiceId: generateId('Invoice'),
|
|
193
182
|
reservationId: previousReservation.id,
|
|
194
183
|
vehicle,
|
|
195
|
-
payer
|
|
184
|
+
payer
|
|
196
185
|
});
|
|
197
186
|
if (!invoiceResult.ok) {
|
|
198
187
|
return invoiceResult;
|
|
@@ -200,16 +189,15 @@ const recreateReservationInvoiceAndUpdateReservation = async (previousReservatio
|
|
|
200
189
|
const invoice = invoiceResult.val;
|
|
201
190
|
const updatedReservation = await prisma.subscriptionReservation.update({
|
|
202
191
|
where: {
|
|
203
|
-
id: previousReservation.id
|
|
192
|
+
id: previousReservation.id
|
|
204
193
|
},
|
|
205
194
|
data: {
|
|
206
195
|
invoice: {
|
|
207
196
|
connect: {
|
|
208
|
-
id: invoice.id
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
197
|
+
id: invoice.id
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
212
201
|
});
|
|
213
202
|
return new Ok(updatedReservation);
|
|
214
203
|
};
|
|
215
|
-
//# sourceMappingURL=fetch-or-create.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-or-create.js","sourceRoot":"","sources":["../../src/reservation/fetch-or-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,MAAM,GAIN,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,WA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