@driveflux/api-functions 1.0.76 → 1.0.77-next.1
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/reservation/display-vehicle.d.ts +39 -39
- package/dist/reservation/display-vehicle.d.ts.map +1 -1
- package/dist/reservation/display-vehicle.js +8 -5
- package/dist/reservation/display-vehicle.js.map +1 -1
- package/dist/reservation/fetch-or-create.js +50 -38
- package/dist/reservation/invoice.js +48 -10
- package/dist/reservation/reserve.js +1 -0
- package/package.json +12 -11
|
@@ -1,21 +1,21 @@
|
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
type: VehicleType;
|
|
6
|
+
brandId: string;
|
|
7
|
+
defaultHostId: string;
|
|
8
|
+
vehicleSlug: string;
|
|
9
|
+
brandSlug: string;
|
|
9
10
|
make: string;
|
|
10
11
|
vehicleModel: string;
|
|
11
12
|
variant: string;
|
|
12
13
|
year: number;
|
|
13
|
-
|
|
14
|
-
brandId: string;
|
|
15
|
-
defaultHostId: string;
|
|
16
|
-
vehicleSlug: string;
|
|
14
|
+
fullBooking: boolean | null;
|
|
17
15
|
availableStock: number | null;
|
|
18
16
|
saveValue: number | null;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
19
|
details: ({
|
|
20
20
|
features: string[];
|
|
21
21
|
range: number | null;
|
|
@@ -70,7 +70,7 @@ export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | stri
|
|
|
70
70
|
} | null;
|
|
71
71
|
};
|
|
72
72
|
highlights: ({
|
|
73
|
-
url: string;
|
|
73
|
+
url: string | null;
|
|
74
74
|
} & {
|
|
75
75
|
title: {
|
|
76
76
|
en: string | null;
|
|
@@ -82,7 +82,7 @@ export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | stri
|
|
|
82
82
|
};
|
|
83
83
|
})[];
|
|
84
84
|
exterior: ({
|
|
85
|
-
url: string;
|
|
85
|
+
url: string | null;
|
|
86
86
|
} & {
|
|
87
87
|
title: {
|
|
88
88
|
en: string | null;
|
|
@@ -94,7 +94,7 @@ export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | stri
|
|
|
94
94
|
};
|
|
95
95
|
})[];
|
|
96
96
|
interior: ({
|
|
97
|
-
url: string;
|
|
97
|
+
url: string | null;
|
|
98
98
|
} & {
|
|
99
99
|
title: {
|
|
100
100
|
en: string | null;
|
|
@@ -196,26 +196,26 @@ export declare const fetchDisplayVehicle: (displayVehicle: DisplayVehicle | stri
|
|
|
196
196
|
export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVehicle | string, selectedColor?: string) => Promise<({
|
|
197
197
|
host: {
|
|
198
198
|
object: import("@driveflux/db").HostObject;
|
|
199
|
-
phoneNumber: string | null;
|
|
200
|
-
type: import("@driveflux/db").HostType | null;
|
|
201
|
-
id: string;
|
|
202
|
-
metadata: PrismaJson.AnyMetadata | null;
|
|
203
199
|
name: string;
|
|
200
|
+
id: string;
|
|
201
|
+
type: import("@driveflux/db").HostType | null;
|
|
204
202
|
createdAt: Date;
|
|
205
203
|
updatedAt: Date;
|
|
204
|
+
registrationNumber: string | null;
|
|
205
|
+
metadata: PrismaJson.AnyMetadata | null;
|
|
206
|
+
active: boolean;
|
|
207
|
+
commencementDate: Date | null;
|
|
206
208
|
email: string | null;
|
|
207
|
-
|
|
209
|
+
phoneNumber: string | null;
|
|
208
210
|
emergencyContactName: string | null;
|
|
209
211
|
emergencyPhoneNumber: string | null;
|
|
210
|
-
active: boolean;
|
|
211
|
-
commencementDate: Date | null;
|
|
212
|
-
registrationNumber: string | null;
|
|
213
212
|
stripeAccountId: string | null;
|
|
214
213
|
isStripeConnected: boolean;
|
|
215
214
|
serviceCenterIds: string[];
|
|
216
215
|
enablePrepayments: boolean;
|
|
217
216
|
prepaymentRatio: number | null;
|
|
218
217
|
accountManagerId: string | null;
|
|
218
|
+
race: import("@driveflux/db").Race | null;
|
|
219
219
|
isInternal: boolean | null;
|
|
220
220
|
address: ({
|
|
221
221
|
name: string | null;
|
|
@@ -267,24 +267,20 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
267
267
|
};
|
|
268
268
|
} & {
|
|
269
269
|
object: import("@driveflux/db").VehicleObject;
|
|
270
|
-
type: VehicleType;
|
|
271
270
|
id: string;
|
|
272
|
-
|
|
273
|
-
createdAt: Date;
|
|
274
|
-
updatedAt: Date;
|
|
275
|
-
status: import("@driveflux/db").VehicleStatus;
|
|
276
|
-
temporary: boolean;
|
|
277
|
-
registrationNumber: string | null;
|
|
278
|
-
hostId: string;
|
|
271
|
+
type: VehicleType;
|
|
279
272
|
make: string;
|
|
280
273
|
vehicleModel: string;
|
|
281
274
|
variant: string;
|
|
282
275
|
year: number;
|
|
276
|
+
createdAt: Date;
|
|
277
|
+
updatedAt: Date;
|
|
283
278
|
featured: boolean;
|
|
284
279
|
searchRankScore: number;
|
|
285
280
|
compositeSearchScore: number;
|
|
286
281
|
registrationDate: Date | null;
|
|
287
282
|
mileage: number | null;
|
|
283
|
+
registrationNumber: string | null;
|
|
288
284
|
vin: string | null;
|
|
289
285
|
engineNumber: string | null;
|
|
290
286
|
availability: import("@driveflux/db").VehicleAvailablity | null;
|
|
@@ -295,12 +291,11 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
295
291
|
basePricePlan24: number;
|
|
296
292
|
basePricePlan36: number;
|
|
297
293
|
basePricePlan60: number;
|
|
294
|
+
status: import("@driveflux/db").VehicleStatus;
|
|
298
295
|
listedAt: Date | null;
|
|
299
296
|
delistedAt: Date | null;
|
|
300
297
|
imagesNotActual: boolean;
|
|
301
298
|
imagesNotActualMessage: string | null;
|
|
302
|
-
allowedServiceCenterIds: string[];
|
|
303
|
-
displayVehicleId: string | null;
|
|
304
299
|
isHostConfirmed: boolean | null;
|
|
305
300
|
niceName: string;
|
|
306
301
|
niceNameShort: string;
|
|
@@ -311,7 +306,12 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
311
306
|
featureOnLandingPage: boolean;
|
|
312
307
|
lastMileageRecordedAt: Date | null;
|
|
313
308
|
locationAvailability: string[];
|
|
309
|
+
temporary: boolean;
|
|
314
310
|
hotDeal: boolean | null;
|
|
311
|
+
metadata: PrismaJson.AnyMetadata | null;
|
|
312
|
+
hostId: string;
|
|
313
|
+
allowedServiceCenterIds: string[];
|
|
314
|
+
displayVehicleId: string | null;
|
|
315
315
|
activeSubscriptionId: string | null;
|
|
316
316
|
addresses: {
|
|
317
317
|
return: {
|
|
@@ -694,24 +694,20 @@ export declare const createVehicleFromDisplayVehicle: (displayVehicle: DisplayVe
|
|
|
694
694
|
}) | undefined>;
|
|
695
695
|
export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayVehicle | string, selectedColor: string) => Promise<({
|
|
696
696
|
object: import("@driveflux/db").VehicleObject;
|
|
697
|
-
type: VehicleType;
|
|
698
697
|
id: string;
|
|
699
|
-
|
|
700
|
-
createdAt: Date;
|
|
701
|
-
updatedAt: Date;
|
|
702
|
-
status: import("@driveflux/db").VehicleStatus;
|
|
703
|
-
temporary: boolean;
|
|
704
|
-
registrationNumber: string | null;
|
|
705
|
-
hostId: string;
|
|
698
|
+
type: VehicleType;
|
|
706
699
|
make: string;
|
|
707
700
|
vehicleModel: string;
|
|
708
701
|
variant: string;
|
|
709
702
|
year: number;
|
|
703
|
+
createdAt: Date;
|
|
704
|
+
updatedAt: Date;
|
|
710
705
|
featured: boolean;
|
|
711
706
|
searchRankScore: number;
|
|
712
707
|
compositeSearchScore: number;
|
|
713
708
|
registrationDate: Date | null;
|
|
714
709
|
mileage: number | null;
|
|
710
|
+
registrationNumber: string | null;
|
|
715
711
|
vin: string | null;
|
|
716
712
|
engineNumber: string | null;
|
|
717
713
|
availability: import("@driveflux/db").VehicleAvailablity | null;
|
|
@@ -722,12 +718,11 @@ export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayV
|
|
|
722
718
|
basePricePlan24: number;
|
|
723
719
|
basePricePlan36: number;
|
|
724
720
|
basePricePlan60: number;
|
|
721
|
+
status: import("@driveflux/db").VehicleStatus;
|
|
725
722
|
listedAt: Date | null;
|
|
726
723
|
delistedAt: Date | null;
|
|
727
724
|
imagesNotActual: boolean;
|
|
728
725
|
imagesNotActualMessage: string | null;
|
|
729
|
-
allowedServiceCenterIds: string[];
|
|
730
|
-
displayVehicleId: string | null;
|
|
731
726
|
isHostConfirmed: boolean | null;
|
|
732
727
|
niceName: string;
|
|
733
728
|
niceNameShort: string;
|
|
@@ -738,7 +733,12 @@ export declare const transfromVehicleDisplayToVehicle: (displayVehicle: DisplayV
|
|
|
738
733
|
featureOnLandingPage: boolean;
|
|
739
734
|
lastMileageRecordedAt: Date | null;
|
|
740
735
|
locationAvailability: string[];
|
|
736
|
+
temporary: boolean;
|
|
741
737
|
hotDeal: boolean | null;
|
|
738
|
+
metadata: PrismaJson.AnyMetadata | null;
|
|
739
|
+
hostId: string;
|
|
740
|
+
allowedServiceCenterIds: string[];
|
|
741
|
+
displayVehicleId: string | null;
|
|
742
742
|
activeSubscriptionId: string | null;
|
|
743
743
|
addresses: {
|
|
744
744
|
return: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display-vehicle.d.ts","sourceRoot":"","sources":["../../src/reservation/display-vehicle.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,cAAc,EAEnB,KAAK,cAAc,EACnB,KAAK,QAAQ,EAGb,KAAK,SAAS,EACd,KAAK,OAAO,EAGZ,KAAK,WAAW,EAChB,MAAM,eAAe,CAAA;AAYt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AE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE;eACrD,CAAA;AAED,eAAO,MAAM,yBAAyB,GAAI,IAAI,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoB3D,CAAA;AAED,eAAO,MAAM,eAAe,GAC3B,QAAQ,cAAc,CAAC,QAAQ,CAAC,KAC9B,OAAO,CAAC,QAAQ,CAWlB,CAAA"}
|
|
@@ -91,11 +91,14 @@ export const transformBasicVehicleData = (dv)=>{
|
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
93
|
export const transformImages = (images)=>{
|
|
94
|
+
const exterior = images.exterior[0]?.url ? transfromSingleImage(images.exterior[0].url, 'exterior') : null;
|
|
95
|
+
const interior = images.interior[0]?.url ? transfromSingleImage(images.interior[0].url, 'interior') : null;
|
|
96
|
+
const gallery = images.gallery.map((i)=>i.url ? transfromSingleImage(i.url) : null).filter(Boolean);
|
|
94
97
|
return [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
...
|
|
98
|
-
];
|
|
98
|
+
exterior,
|
|
99
|
+
interior,
|
|
100
|
+
...gallery
|
|
101
|
+
].filter(Boolean);
|
|
99
102
|
};
|
|
100
103
|
const transfromSingleImage = (imageUrl, inspectionType)=>{
|
|
101
104
|
return {
|
|
@@ -139,7 +142,7 @@ const transformPriceMatrix = (vehicleType, pricing)=>{
|
|
|
139
142
|
const startFeeMatrix = excludeServiceFeesFrom(getStartFeeMatrix(pricingController, baseline, flatPricing));
|
|
140
143
|
const hostMatrix = excludeServiceFeesFrom(getHostsMatrix(pricingController, baseline, ultraTier, flatPricing));
|
|
141
144
|
const hostExcessMileage = getHostExcessMileage(pricingController, baseline);
|
|
142
|
-
const fluxPriceMatrix = excludeServiceFeesFrom(getFluxPiceMatrix(pricingController, vehicleType, baseline, hostMatrix, ultraTier, flatPricing));
|
|
145
|
+
const fluxPriceMatrix = pricing.keepPricingIntact ? priceMatrix : excludeServiceFeesFrom(getFluxPiceMatrix(pricingController, vehicleType, baseline, hostMatrix, ultraTier, flatPricing));
|
|
143
146
|
const fluxExcessMileage = getFluxExcessMileage(pricingController, baseline);
|
|
144
147
|
const recommendedDeposit = pricing.refundableDeposit || vehicleType === 'motorcycle' ? getRecommendedMotorcycleDeposit(baseline) : null;
|
|
145
148
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display-vehicle.js","sourceRoot":"","sources":["../../src/reservation/display-vehicle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAMN,MAAM,GAMN,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EACN,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,+BAA+B,EAC/B,iBAAiB,GACjB,MAAM,qCAAqC,CAAA;AAE5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACvC,cAAuC,EACtC,EAAE;IACH,OAAO,OAAO,cAAc,KAAK,QAAQ;QACxC,CAAC,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,CAAC;QAC1E,CAAC,CAAC,cAAc,CAAA;AAClB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAG,KAAK,EACnD,cAAuC,EACvC,aAAsB,EACrB,EAAE;IACH,MAAM,EAAE,GAAG,MAAM,mBAAmB,CAAC,cAAc,CAAC,CAAA;IAEpD,IAAI,CAAC,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ;QAAE,OAAM;IAEzC,IAAI,CAAC,EAAE,CAAC,OAAO;QAAE,OAAM;IAEvB,MAAM,SAAS,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CA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AAC,CAAC,UAA4B,CAAC;oBACxD,KAAK,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;YAC9B,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,MAAM,CAAA;AACd,CAAC,CAAA"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { prisma } from '@driveflux/db';
|
|
2
2
|
import { generateId } from '@driveflux/db/id';
|
|
3
|
+
import { makeProblem, PROBLEM_UNKNOWN } from '@driveflux/problem';
|
|
3
4
|
import { reportError } from '@driveflux/reporter';
|
|
4
|
-
import { Ok } from '@driveflux/result';
|
|
5
|
+
import { Err, Ok } from '@driveflux/result';
|
|
5
6
|
import { slackLater } from '../slack.js';
|
|
6
7
|
import { createReservationInvoice, updateReservationInvoiceIfNeeded } from './invoice.js';
|
|
7
8
|
export const fetchOrCreateReservation = async ({ vehicle, payer, body })=>{
|
|
8
|
-
const { subscribingUser, plan, mileagePackage, couponCode, referralCode, asBusiness, source, deliveryAddresses, deliveryDate, analytics, paymentIntentId, freeReservation, freeReservationReason } = body;
|
|
9
|
+
const { subscribingUser, plan, mileagePackage, couponCode, referralCode, asBusiness, source, deliveryAddresses, deliveryDate, analytics, paymentIntentId, freeReservation, freeReservationReason, fullBooking } = body;
|
|
9
10
|
try {
|
|
10
11
|
const previousReservation = await prisma.subscriptionReservation.findFirst({
|
|
11
12
|
where: {
|
|
@@ -28,6 +29,8 @@ export const fetchOrCreateReservation = async ({ vehicle, payer, body })=>{
|
|
|
28
29
|
invoice: true
|
|
29
30
|
}
|
|
30
31
|
});
|
|
32
|
+
console.log('Previous reservation', previousReservation);
|
|
33
|
+
console.log('Previous reservation amount', previousReservation?.invoice.total);
|
|
31
34
|
if (previousReservation) {
|
|
32
35
|
if (previousReservation.invoice.voided) {
|
|
33
36
|
return recreateReservationInvoiceAndUpdateReservation(previousReservation, body, vehicle, payer);
|
|
@@ -77,43 +80,52 @@ export const fetchOrCreateReservation = async ({ vehicle, payer, body })=>{
|
|
|
77
80
|
// We couldn't fetch the reservation, so we create a new one and just log this
|
|
78
81
|
await reportError(error);
|
|
79
82
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
83
|
+
try {
|
|
84
|
+
const reservationId = generateId('SubscriptionReservation');
|
|
85
|
+
// Create the reservation invoice
|
|
86
|
+
const invoiceResult = await createReservationInvoice({
|
|
87
|
+
invoiceId: generateId('Invoice'),
|
|
88
|
+
couponCode,
|
|
89
|
+
plan,
|
|
90
|
+
mileagePackage,
|
|
91
|
+
referralCode,
|
|
92
|
+
reservationId,
|
|
93
|
+
paymentIntentId,
|
|
94
|
+
freeReservation,
|
|
95
|
+
freeReservationReason,
|
|
96
|
+
analytics,
|
|
97
|
+
vehicle,
|
|
98
|
+
payer,
|
|
99
|
+
subscribingUser,
|
|
100
|
+
fullBooking
|
|
101
|
+
});
|
|
102
|
+
if (invoiceResult.err) {
|
|
103
|
+
return invoiceResult;
|
|
104
|
+
}
|
|
105
|
+
const reservation = await createReservation({
|
|
106
|
+
reservationId,
|
|
107
|
+
invoiceId: invoiceResult.val.id,
|
|
108
|
+
subscribingUserId: subscribingUser.id,
|
|
109
|
+
vehicleId: vehicle.id,
|
|
110
|
+
businessId: payer.object === 'business' ? payer.id : undefined,
|
|
111
|
+
plan,
|
|
112
|
+
mileagePackage,
|
|
113
|
+
couponCode,
|
|
114
|
+
referralCode,
|
|
115
|
+
analytics,
|
|
116
|
+
deliveryAddresses,
|
|
117
|
+
deliveryDate,
|
|
118
|
+
asBusiness,
|
|
119
|
+
source
|
|
120
|
+
});
|
|
121
|
+
return new Ok(reservation);
|
|
122
|
+
} catch (e) {
|
|
123
|
+
await reportError(e);
|
|
124
|
+
if (typeof e === 'object' && e && 'message' in e && e.message) {
|
|
125
|
+
return new Err(makeProblem(PROBLEM_UNKNOWN, e.message));
|
|
126
|
+
}
|
|
127
|
+
return new Err(makeProblem(PROBLEM_UNKNOWN, 'Unknown error'));
|
|
99
128
|
}
|
|
100
|
-
const reservation = await createReservation({
|
|
101
|
-
reservationId,
|
|
102
|
-
invoiceId: invoiceResult.val.id,
|
|
103
|
-
subscribingUserId: subscribingUser.id,
|
|
104
|
-
vehicleId: vehicle.id,
|
|
105
|
-
businessId: payer.object === 'business' ? payer.id : undefined,
|
|
106
|
-
plan,
|
|
107
|
-
mileagePackage,
|
|
108
|
-
couponCode,
|
|
109
|
-
referralCode,
|
|
110
|
-
analytics,
|
|
111
|
-
deliveryAddresses,
|
|
112
|
-
deliveryDate,
|
|
113
|
-
asBusiness,
|
|
114
|
-
source
|
|
115
|
-
});
|
|
116
|
-
return new Ok(reservation);
|
|
117
129
|
};
|
|
118
130
|
const createReservation = async ({ reservationId, invoiceId, subscribingUserId, vehicleId, businessId, plan, mileagePackage, couponCode, referralCode, analytics, deliveryAddresses, deliveryDate, asBusiness, source })=>{
|
|
119
131
|
return await prisma.subscriptionReservation.create({
|
|
@@ -3,13 +3,15 @@ import { loadCoupon, PROBLEM_APPLICABLE_NOT_FOUND } from '@driveflux/coupon';
|
|
|
3
3
|
import { prisma } from '@driveflux/db';
|
|
4
4
|
import { generateId } from '@driveflux/db/id';
|
|
5
5
|
import { EMPTY_BILLING_ADDRESS } from '@driveflux/db/models/other';
|
|
6
|
-
import { PURPOSE_RESERVATION } from '@driveflux/db/models/subscription';
|
|
6
|
+
import { INVOICE_LINE_CYCLE, INVOICE_LINE_DEPOSIT, INVOICE_LINE_OTHER, INVOICE_LINE_RESERVATION_FEE, PURPOSE_FULL_BOOKING, PURPOSE_RESERVATION } from '@driveflux/db/models/subscription';
|
|
7
7
|
import { userName } from '@driveflux/db/models/user';
|
|
8
8
|
import { vehicleName } from '@driveflux/db/models/vehicle';
|
|
9
9
|
import { biller, coupons } from '@driveflux/engine';
|
|
10
10
|
import { wrapInResult } from '@driveflux/engine/utils';
|
|
11
|
-
import {
|
|
11
|
+
import { makeProblem, PROBLEM_EXTERNAL } from '@driveflux/problem';
|
|
12
|
+
import { Err, Ok } from '@driveflux/result';
|
|
12
13
|
import { format } from '@driveflux/time';
|
|
14
|
+
import currency from 'currency.js';
|
|
13
15
|
import { isAfter } from 'date-fns/isAfter';
|
|
14
16
|
import { subMinutes } from 'date-fns/subMinutes';
|
|
15
17
|
import { createScopedLogger } from '../create-logger.js';
|
|
@@ -88,8 +90,8 @@ export const updateReservationInvoiceIfNeeded = async (oldReservationInvoice, ne
|
|
|
88
90
|
}
|
|
89
91
|
return new Ok(updated.val);
|
|
90
92
|
};
|
|
91
|
-
export const createReservationInvoice = async ({ invoiceId, couponCode, plan, mileagePackage, referralCode, reservationId, paymentIntentId, freeReservation, freeReservationReason, analytics, vehicle, payer, subscribingUser })=>{
|
|
92
|
-
if (freeReservation) {
|
|
93
|
+
export const createReservationInvoice = async ({ invoiceId, couponCode, plan, mileagePackage, referralCode, reservationId, paymentIntentId, freeReservation, freeReservationReason, analytics, vehicle, payer, subscribingUser, fullBooking })=>{
|
|
94
|
+
if (freeReservation && !fullBooking) {
|
|
93
95
|
// It's a free reservation, so we don't need to add a coupon code
|
|
94
96
|
return await wrapInResult(biller.createInvoice(getInvoiceCreateDetails({
|
|
95
97
|
invoiceId,
|
|
@@ -97,7 +99,6 @@ export const createReservationInvoice = async ({ invoiceId, couponCode, plan, mi
|
|
|
97
99
|
vehicle,
|
|
98
100
|
plan,
|
|
99
101
|
mileagePackage,
|
|
100
|
-
paymentIntentId,
|
|
101
102
|
freeReservation,
|
|
102
103
|
freeReservationReason,
|
|
103
104
|
analytics,
|
|
@@ -131,15 +132,40 @@ export const createReservationInvoice = async ({ invoiceId, couponCode, plan, mi
|
|
|
131
132
|
freeReservationReason,
|
|
132
133
|
analytics,
|
|
133
134
|
reservationId
|
|
134
|
-
})
|
|
135
|
-
|
|
135
|
+
})
|
|
136
|
+
};
|
|
137
|
+
if (fullBooking) {
|
|
138
|
+
invoiceCreateDetails.subscriptionPurpose = PURPOSE_FULL_BOOKING;
|
|
139
|
+
const vehiclePrice = vehicle.pricing?.fluxPrice.matrix[plan][mileagePackage];
|
|
140
|
+
if (!vehiclePrice) {
|
|
141
|
+
throw new Error('Vehicle price not found');
|
|
142
|
+
}
|
|
143
|
+
invoiceCreateDetails.lines = [
|
|
144
|
+
{
|
|
145
|
+
amount: vehiclePrice,
|
|
146
|
+
chargingFor: INVOICE_LINE_CYCLE,
|
|
147
|
+
description: `First payment for ${vehicleName(vehicle)}`
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
amount: vehiclePrice * config.taxRate,
|
|
151
|
+
chargingFor: INVOICE_LINE_OTHER,
|
|
152
|
+
description: `Processing fee for ${vehicleName(vehicle)}`
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
amount: vehiclePrice,
|
|
156
|
+
description: `Deposit for ${vehicleName(vehicle)}`,
|
|
157
|
+
chargingFor: INVOICE_LINE_DEPOSIT
|
|
158
|
+
}
|
|
159
|
+
];
|
|
160
|
+
} else {
|
|
161
|
+
invoiceCreateDetails.lines = [
|
|
136
162
|
{
|
|
137
163
|
amount: reservationAmount,
|
|
138
164
|
description: `Reservation fee for ${vehicleName(vehicle)}`,
|
|
139
|
-
chargingFor:
|
|
165
|
+
chargingFor: INVOICE_LINE_RESERVATION_FEE
|
|
140
166
|
}
|
|
141
|
-
]
|
|
142
|
-
}
|
|
167
|
+
];
|
|
168
|
+
}
|
|
143
169
|
if (finalCouponCode) {
|
|
144
170
|
log.debug({
|
|
145
171
|
finalCouponCode
|
|
@@ -173,6 +199,18 @@ export const createReservationInvoice = async ({ invoiceId, couponCode, plan, mi
|
|
|
173
199
|
};
|
|
174
200
|
}
|
|
175
201
|
}
|
|
202
|
+
// Validate the payment intent amount
|
|
203
|
+
if (paymentIntentId) {
|
|
204
|
+
const stripe = biller.getPaymentProvider('stripe').getStripe();
|
|
205
|
+
// Validate the payment intent
|
|
206
|
+
const paymentIntentResult = await wrapInResult(stripe.paymentIntents.retrieve(paymentIntentId));
|
|
207
|
+
if (paymentIntentResult.err) {
|
|
208
|
+
return new Err(makeProblem(PROBLEM_EXTERNAL, 'Payment intent not found'));
|
|
209
|
+
}
|
|
210
|
+
if (paymentIntentResult.val.amount !== currency(biller.getCorrectedInvoiceData(invoiceCreateDetails).total).intValue) {
|
|
211
|
+
return new Err(makeProblem(PROBLEM_EXTERNAL, 'Payment intent amount does not match invoice amount'));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
176
214
|
const result = await wrapInResult(biller.createInvoice({
|
|
177
215
|
...invoiceCreateDetails,
|
|
178
216
|
providerMetadata: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@driveflux/api-functions",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.77-next.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./notion": {
|
|
@@ -73,27 +73,28 @@
|
|
|
73
73
|
],
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@casl/ability": "^6.7.3",
|
|
76
|
-
"@driveflux/auth": "4.0.
|
|
76
|
+
"@driveflux/auth": "4.0.46-next.1",
|
|
77
77
|
"@driveflux/billing": "8.0.8",
|
|
78
|
-
"@driveflux/config": "3.0.
|
|
79
|
-
"@driveflux/coupon": "9.0.
|
|
80
|
-
"@driveflux/db": "4.0.
|
|
81
|
-
"@driveflux/email": "7.0.
|
|
82
|
-
"@driveflux/email-templates": "1.0.
|
|
83
|
-
"@driveflux/engine": "1.0.
|
|
78
|
+
"@driveflux/config": "3.0.7-next.0",
|
|
79
|
+
"@driveflux/coupon": "9.0.22-feature-microlino.1",
|
|
80
|
+
"@driveflux/db": "4.0.17-feature-microlino.1",
|
|
81
|
+
"@driveflux/email": "7.0.17-feature-microlino.1",
|
|
82
|
+
"@driveflux/email-templates": "1.0.18-feature-microlino.1",
|
|
83
|
+
"@driveflux/engine": "1.0.55-feature-microlino.1",
|
|
84
84
|
"@driveflux/fetch": "8.0.0",
|
|
85
85
|
"@driveflux/format-money": "7.0.0",
|
|
86
|
+
"@driveflux/logger": "1.0.0",
|
|
86
87
|
"@driveflux/problem": "6.0.0",
|
|
87
88
|
"@driveflux/reporter": "7.0.1",
|
|
88
89
|
"@driveflux/result": "6.0.0",
|
|
89
|
-
"@driveflux/scheduler": "8.0.
|
|
90
|
+
"@driveflux/scheduler": "8.0.22-feature-microlino.1",
|
|
90
91
|
"@driveflux/singleton": "3.0.0",
|
|
91
|
-
"@driveflux/subscription": "9.0.
|
|
92
|
-
"@driveflux/logger": "1.0.0",
|
|
92
|
+
"@driveflux/subscription": "9.0.11-feature-microlino.0",
|
|
93
93
|
"@driveflux/time": "6.0.0",
|
|
94
94
|
"@driveflux/utils": "6.0.0",
|
|
95
95
|
"@notionhq/client": "^5.3.0",
|
|
96
96
|
"bcryptjs": "^3.0.2",
|
|
97
|
+
"currency.js": "^2.0.4",
|
|
97
98
|
"date-fns": "^4.1.0",
|
|
98
99
|
"lodash": "^4.17.21",
|
|
99
100
|
"nanoid": "^5.1.6",
|