@mydoormot/app-types 1.7.42 → 1.8.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/.turbo/turbo-build.log +18 -18
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +17 -7
- package/dist/index.d.cts +22 -28
- package/dist/index.d.ts +22 -28
- package/dist/index.js +15 -6
- package/package.json +1 -1
- package/src/errand.ts +44 -10
- package/src/index.ts +0 -1
- package/src/rider.ts +8 -8
- package/src/coupon.ts +0 -14
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
> @mydoormot/app-types@1.7.42 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
|
|
3
|
-
> tsup src/index.ts --format esm,cjs --dts
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
|
|
2
|
+
> @mydoormot/app-types@1.7.42 build /Users/chuksben/Desktop/projects/microservices/mydoormot/packages/app-types
|
|
3
|
+
> tsup src/index.ts --format esm,cjs --dts
|
|
4
|
+
|
|
5
|
+
CLI Building entry: src/index.ts
|
|
6
|
+
CLI Using tsconfig: tsconfig.json
|
|
7
|
+
CLI tsup v7.3.0
|
|
8
|
+
CLI Target: es2021
|
|
9
|
+
ESM Build start
|
|
10
|
+
CJS Build start
|
|
11
|
+
ESM dist/index.js 11.40 KB
|
|
12
|
+
ESM ⚡️ Build success in 56ms
|
|
13
|
+
CJS dist/index.cjs 13.82 KB
|
|
14
|
+
CJS ⚡️ Build success in 56ms
|
|
15
|
+
DTS Build start
|
|
16
|
+
DTS ⚡️ Build success in 669ms
|
|
17
|
+
DTS dist/index.d.ts 34.23 KB
|
|
18
|
+
DTS dist/index.d.cts 34.23 KB
|
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,8 @@ __export(src_exports, {
|
|
|
32
32
|
DraftErrandStatus: () => DraftErrandStatus,
|
|
33
33
|
EnterpriseType: () => EnterpriseType,
|
|
34
34
|
ErrandStatus: () => ErrandStatus,
|
|
35
|
+
FeePaymentStatus: () => FeePaymentStatus,
|
|
36
|
+
FeeSettlement: () => FeeSettlement,
|
|
35
37
|
GlobalRoles: () => GlobalRoles,
|
|
36
38
|
InvoiceGenerationType: () => InvoiceGenerationType,
|
|
37
39
|
InvoiceItemType: () => InvoiceItemType,
|
|
@@ -43,7 +45,6 @@ __export(src_exports, {
|
|
|
43
45
|
PaymentOptions: () => PaymentOptions,
|
|
44
46
|
RemittanceStatus: () => RemittanceStatus,
|
|
45
47
|
RoleType: () => RoleType,
|
|
46
|
-
SettlementType: () => SettlementType,
|
|
47
48
|
VehicleLogType: () => VehicleLogType,
|
|
48
49
|
VehicleType: () => VehicleType,
|
|
49
50
|
WhatsappButtonType: () => WhatsappButtonType,
|
|
@@ -123,6 +124,19 @@ var errandTimeline = [
|
|
|
123
124
|
description: "Your package has been delivered and the errand closed, please leave a review and a rating for the rider"
|
|
124
125
|
}
|
|
125
126
|
];
|
|
127
|
+
var FeePaymentStatus = /* @__PURE__ */ ((FeePaymentStatus2) => {
|
|
128
|
+
FeePaymentStatus2["Unpaid"] = "unpaid";
|
|
129
|
+
FeePaymentStatus2["Partial"] = "partial";
|
|
130
|
+
FeePaymentStatus2["Paid"] = "paid";
|
|
131
|
+
return FeePaymentStatus2;
|
|
132
|
+
})(FeePaymentStatus || {});
|
|
133
|
+
var FeeSettlement = /* @__PURE__ */ ((FeeSettlement2) => {
|
|
134
|
+
FeeSettlement2["CashOnDelivery"] = "cash_on_delivery";
|
|
135
|
+
FeeSettlement2["Prepaid"] = "prepaid";
|
|
136
|
+
FeeSettlement2["Invoice"] = "invoice";
|
|
137
|
+
FeeSettlement2["Owed"] = "owed";
|
|
138
|
+
return FeeSettlement2;
|
|
139
|
+
})(FeeSettlement || {});
|
|
126
140
|
var AddressTypes = /* @__PURE__ */ ((AddressTypes2) => {
|
|
127
141
|
AddressTypes2["DeliveryAddress"] = "deliveryAddress";
|
|
128
142
|
AddressTypes2["PickupAddress"] = "pickupAddress";
|
|
@@ -202,11 +216,6 @@ var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
|
|
|
202
216
|
RemittanceStatus2["Cancelled"] = "cancelled";
|
|
203
217
|
return RemittanceStatus2;
|
|
204
218
|
})(RemittanceStatus || {});
|
|
205
|
-
var SettlementType = /* @__PURE__ */ ((SettlementType2) => {
|
|
206
|
-
SettlementType2["DeliveryFee"] = "delivery_fee";
|
|
207
|
-
SettlementType2["Additional"] = "additional";
|
|
208
|
-
return SettlementType2;
|
|
209
|
-
})(SettlementType || {});
|
|
210
219
|
|
|
211
220
|
// src/enterprise.ts
|
|
212
221
|
var EnterpriseType = /* @__PURE__ */ ((EnterpriseType2) => {
|
|
@@ -348,6 +357,8 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
348
357
|
DraftErrandStatus,
|
|
349
358
|
EnterpriseType,
|
|
350
359
|
ErrandStatus,
|
|
360
|
+
FeePaymentStatus,
|
|
361
|
+
FeeSettlement,
|
|
351
362
|
GlobalRoles,
|
|
352
363
|
InvoiceGenerationType,
|
|
353
364
|
InvoiceItemType,
|
|
@@ -359,7 +370,6 @@ var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
|
359
370
|
PaymentOptions,
|
|
360
371
|
RemittanceStatus,
|
|
361
372
|
RoleType,
|
|
362
|
-
SettlementType,
|
|
363
373
|
VehicleLogType,
|
|
364
374
|
VehicleType,
|
|
365
375
|
WhatsappButtonType,
|
package/dist/index.d.cts
CHANGED
|
@@ -93,21 +93,6 @@ type UserAddress = {
|
|
|
93
93
|
direction?: string;
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
interface Coupon {
|
|
97
|
-
id: string;
|
|
98
|
-
phoneNumber: string;
|
|
99
|
-
couponType: 'errand';
|
|
100
|
-
isUsed: boolean;
|
|
101
|
-
expiresAt: Date;
|
|
102
|
-
couponCode: string;
|
|
103
|
-
updatedAt: Date;
|
|
104
|
-
createdAt: Date;
|
|
105
|
-
hasExpired: boolean;
|
|
106
|
-
couponValue: number;
|
|
107
|
-
ref?: string;
|
|
108
|
-
fullName?: string;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
96
|
interface CustomerTransactionStats {
|
|
112
97
|
totalSaleCount: number;
|
|
113
98
|
totalSaleAmount: number;
|
|
@@ -477,10 +462,10 @@ interface RiderSettlement {
|
|
|
477
462
|
draftErrandId?: string;
|
|
478
463
|
riderId: string;
|
|
479
464
|
businessId: string;
|
|
480
|
-
deliveryFee: number;
|
|
481
|
-
additionalAmount: number;
|
|
482
465
|
totalCollectionAmount: number;
|
|
483
|
-
|
|
466
|
+
deliveryFee?: number;
|
|
467
|
+
additionalAmount?: number;
|
|
468
|
+
remittedAmount?: number;
|
|
484
469
|
remittanceStatus: RemittanceStatus | `${RemittanceStatus}`;
|
|
485
470
|
remittedAt?: Date;
|
|
486
471
|
remittedBy?: string;
|
|
@@ -511,10 +496,6 @@ interface RiderPerformanceStats {
|
|
|
511
496
|
riders: RiderPerformanceItem[];
|
|
512
497
|
timeSeries?: RiderPerformanceTimeSeries[];
|
|
513
498
|
}
|
|
514
|
-
declare enum SettlementType {
|
|
515
|
-
DeliveryFee = "delivery_fee",
|
|
516
|
-
Additional = "additional"
|
|
517
|
-
}
|
|
518
499
|
|
|
519
500
|
declare enum ErrandStatus {
|
|
520
501
|
Pending = "pending",
|
|
@@ -582,6 +563,18 @@ interface PendingErrand {
|
|
|
582
563
|
id: string;
|
|
583
564
|
ownerMobileNumber?: string;
|
|
584
565
|
}
|
|
566
|
+
declare enum FeePaymentStatus {
|
|
567
|
+
Unpaid = "unpaid",
|
|
568
|
+
Partial = "partial",
|
|
569
|
+
Paid = "paid"
|
|
570
|
+
}
|
|
571
|
+
declare enum FeeSettlement {
|
|
572
|
+
CashOnDelivery = "cash_on_delivery",
|
|
573
|
+
Prepaid = "prepaid",
|
|
574
|
+
Invoice = "invoice",
|
|
575
|
+
Owed = "owed"
|
|
576
|
+
}
|
|
577
|
+
type ExpensePaidBy = 'rider' | 'company' | 'customer';
|
|
585
578
|
interface Errand {
|
|
586
579
|
id: string;
|
|
587
580
|
nameOfItem: string;
|
|
@@ -600,13 +593,10 @@ interface Errand {
|
|
|
600
593
|
updatedAt: Date;
|
|
601
594
|
createdAt: Date;
|
|
602
595
|
errandRating?: string | ErrandRating;
|
|
603
|
-
payOnDeliveryAmount?: string;
|
|
604
596
|
additionalData?: string;
|
|
605
597
|
deliveryDate?: Date;
|
|
606
598
|
cityId?: City;
|
|
607
|
-
couponPrice?: number;
|
|
608
599
|
price: number;
|
|
609
|
-
coupon?: string | Coupon;
|
|
610
600
|
ownerMobileNumber?: string;
|
|
611
601
|
errandTimeline?: string | ErrandTimeline;
|
|
612
602
|
queuePosition?: number;
|
|
@@ -635,7 +625,6 @@ interface Errand {
|
|
|
635
625
|
isDelayed?: boolean;
|
|
636
626
|
delayedAt?: Date;
|
|
637
627
|
wasDeliveredBy?: 'rider' | 'admin' | 'system' | 'business';
|
|
638
|
-
paymentMethod?: 'cash_on_delivery' | 'prepaid_online' | 'prepaid_transfer' | 'business_invoice';
|
|
639
628
|
additionalFees?: Array<{
|
|
640
629
|
description: string;
|
|
641
630
|
amount: number;
|
|
@@ -644,6 +633,12 @@ interface Errand {
|
|
|
644
633
|
}>;
|
|
645
634
|
riderDetails?: Rider;
|
|
646
635
|
vehicleDetails?: Vehicle;
|
|
636
|
+
amountPaid?: number;
|
|
637
|
+
collections?: number;
|
|
638
|
+
feeSettlement?: `${FeeSettlement}`;
|
|
639
|
+
expenseAmount?: number;
|
|
640
|
+
expensePaidBy?: ExpensePaidBy;
|
|
641
|
+
feePaymentStatus?: `${FeePaymentStatus}`;
|
|
647
642
|
}
|
|
648
643
|
interface AggregatedErrand extends Errand {
|
|
649
644
|
parcelSize: `${ParcelSize}`;
|
|
@@ -763,7 +758,6 @@ interface DraftErrand {
|
|
|
763
758
|
deliveryDetails?: AddressDetails;
|
|
764
759
|
additionalData?: string;
|
|
765
760
|
parcelSize?: `${ParcelSize}`;
|
|
766
|
-
payOnDeliveryAmount?: number;
|
|
767
761
|
status: DraftErrandStatus;
|
|
768
762
|
convertedErrandId?: string;
|
|
769
763
|
settlementId?: string;
|
|
@@ -1281,4 +1275,4 @@ declare enum LinkDestination {
|
|
|
1281
1275
|
}
|
|
1282
1276
|
type NullOrUndefined = null | undefined;
|
|
1283
1277
|
|
|
1284
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessMember, type BusinessModules, type BusinessPg, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type
|
|
1278
|
+
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessMember, type BusinessModules, type BusinessPg, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerTransactionStats, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type GeoPoint, GlobalRoles, type Invoice, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult, ParcelSize, PaymentOptions, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, type TrackerPosition, type Transaction, type TransactionCategory, type TransactionItem, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, WhatsappButtonType, WhatsappComponentType, WhatsappEvent, WhatsappRecipient, type WhatsappSendLog, type WhatsappTemplate, type WhatsappTemplateButton, type WhatsappTemplateComponent, WhatsappTemplateMetaStatus, WhatsappTemplateParamSource, type WhatsappTemplateSource, errandTimeline };
|
package/dist/index.d.ts
CHANGED
|
@@ -93,21 +93,6 @@ type UserAddress = {
|
|
|
93
93
|
direction?: string;
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
interface Coupon {
|
|
97
|
-
id: string;
|
|
98
|
-
phoneNumber: string;
|
|
99
|
-
couponType: 'errand';
|
|
100
|
-
isUsed: boolean;
|
|
101
|
-
expiresAt: Date;
|
|
102
|
-
couponCode: string;
|
|
103
|
-
updatedAt: Date;
|
|
104
|
-
createdAt: Date;
|
|
105
|
-
hasExpired: boolean;
|
|
106
|
-
couponValue: number;
|
|
107
|
-
ref?: string;
|
|
108
|
-
fullName?: string;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
96
|
interface CustomerTransactionStats {
|
|
112
97
|
totalSaleCount: number;
|
|
113
98
|
totalSaleAmount: number;
|
|
@@ -477,10 +462,10 @@ interface RiderSettlement {
|
|
|
477
462
|
draftErrandId?: string;
|
|
478
463
|
riderId: string;
|
|
479
464
|
businessId: string;
|
|
480
|
-
deliveryFee: number;
|
|
481
|
-
additionalAmount: number;
|
|
482
465
|
totalCollectionAmount: number;
|
|
483
|
-
|
|
466
|
+
deliveryFee?: number;
|
|
467
|
+
additionalAmount?: number;
|
|
468
|
+
remittedAmount?: number;
|
|
484
469
|
remittanceStatus: RemittanceStatus | `${RemittanceStatus}`;
|
|
485
470
|
remittedAt?: Date;
|
|
486
471
|
remittedBy?: string;
|
|
@@ -511,10 +496,6 @@ interface RiderPerformanceStats {
|
|
|
511
496
|
riders: RiderPerformanceItem[];
|
|
512
497
|
timeSeries?: RiderPerformanceTimeSeries[];
|
|
513
498
|
}
|
|
514
|
-
declare enum SettlementType {
|
|
515
|
-
DeliveryFee = "delivery_fee",
|
|
516
|
-
Additional = "additional"
|
|
517
|
-
}
|
|
518
499
|
|
|
519
500
|
declare enum ErrandStatus {
|
|
520
501
|
Pending = "pending",
|
|
@@ -582,6 +563,18 @@ interface PendingErrand {
|
|
|
582
563
|
id: string;
|
|
583
564
|
ownerMobileNumber?: string;
|
|
584
565
|
}
|
|
566
|
+
declare enum FeePaymentStatus {
|
|
567
|
+
Unpaid = "unpaid",
|
|
568
|
+
Partial = "partial",
|
|
569
|
+
Paid = "paid"
|
|
570
|
+
}
|
|
571
|
+
declare enum FeeSettlement {
|
|
572
|
+
CashOnDelivery = "cash_on_delivery",
|
|
573
|
+
Prepaid = "prepaid",
|
|
574
|
+
Invoice = "invoice",
|
|
575
|
+
Owed = "owed"
|
|
576
|
+
}
|
|
577
|
+
type ExpensePaidBy = 'rider' | 'company' | 'customer';
|
|
585
578
|
interface Errand {
|
|
586
579
|
id: string;
|
|
587
580
|
nameOfItem: string;
|
|
@@ -600,13 +593,10 @@ interface Errand {
|
|
|
600
593
|
updatedAt: Date;
|
|
601
594
|
createdAt: Date;
|
|
602
595
|
errandRating?: string | ErrandRating;
|
|
603
|
-
payOnDeliveryAmount?: string;
|
|
604
596
|
additionalData?: string;
|
|
605
597
|
deliveryDate?: Date;
|
|
606
598
|
cityId?: City;
|
|
607
|
-
couponPrice?: number;
|
|
608
599
|
price: number;
|
|
609
|
-
coupon?: string | Coupon;
|
|
610
600
|
ownerMobileNumber?: string;
|
|
611
601
|
errandTimeline?: string | ErrandTimeline;
|
|
612
602
|
queuePosition?: number;
|
|
@@ -635,7 +625,6 @@ interface Errand {
|
|
|
635
625
|
isDelayed?: boolean;
|
|
636
626
|
delayedAt?: Date;
|
|
637
627
|
wasDeliveredBy?: 'rider' | 'admin' | 'system' | 'business';
|
|
638
|
-
paymentMethod?: 'cash_on_delivery' | 'prepaid_online' | 'prepaid_transfer' | 'business_invoice';
|
|
639
628
|
additionalFees?: Array<{
|
|
640
629
|
description: string;
|
|
641
630
|
amount: number;
|
|
@@ -644,6 +633,12 @@ interface Errand {
|
|
|
644
633
|
}>;
|
|
645
634
|
riderDetails?: Rider;
|
|
646
635
|
vehicleDetails?: Vehicle;
|
|
636
|
+
amountPaid?: number;
|
|
637
|
+
collections?: number;
|
|
638
|
+
feeSettlement?: `${FeeSettlement}`;
|
|
639
|
+
expenseAmount?: number;
|
|
640
|
+
expensePaidBy?: ExpensePaidBy;
|
|
641
|
+
feePaymentStatus?: `${FeePaymentStatus}`;
|
|
647
642
|
}
|
|
648
643
|
interface AggregatedErrand extends Errand {
|
|
649
644
|
parcelSize: `${ParcelSize}`;
|
|
@@ -763,7 +758,6 @@ interface DraftErrand {
|
|
|
763
758
|
deliveryDetails?: AddressDetails;
|
|
764
759
|
additionalData?: string;
|
|
765
760
|
parcelSize?: `${ParcelSize}`;
|
|
766
|
-
payOnDeliveryAmount?: number;
|
|
767
761
|
status: DraftErrandStatus;
|
|
768
762
|
convertedErrandId?: string;
|
|
769
763
|
settlementId?: string;
|
|
@@ -1281,4 +1275,4 @@ declare enum LinkDestination {
|
|
|
1281
1275
|
}
|
|
1282
1276
|
type NullOrUndefined = null | undefined;
|
|
1283
1277
|
|
|
1284
|
-
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessMember, type BusinessModules, type BusinessPg, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type
|
|
1278
|
+
export { type AddonGroup, type AddonGroupItem, type AddressDetails, AddressTypes, type AggregatedErrand, AuthType, type Business, BusinessCapability, type BusinessCategory, type BusinessCourierLink, BusinessCourierLinkStatus, type BusinessMember, type BusinessModules, type BusinessPg, BusinessRole, type BusinessSettings, BusinessStatus, type BusinessWhatsappConfig, type City, type Collection, type Customer, type CustomerTransactionStats, DEFAULT_BUSINESS_MODULES, DEFAULT_BUSINESS_SETTINGS, DeliveryStatus, type DraftErrand, DraftErrandStatus, type Enterprise, type EnterpriseCategoryDoc, type EnterpriseSubCategoryDoc, EnterpriseType, type Errand, type ErrandDeliveryTiming, type ErrandPackagingQuality, type ErrandRating, type ErrandReview, type ErrandReviewLink, type ErrandRiderBehavior, ErrandStatus, type ErrandTimeline, type ExpensePaidBy, FeePaymentStatus, FeeSettlement, type GeoPoint, GlobalRoles, type Invoice, InvoiceGenerationType, type InvoiceItem, InvoiceItemType, InvoiceStatus, type LatLng, LinkDestination, type MaintenanceItem, type MaintenancePartUsage, type MaintenanceRecord, type MaintenanceStats, type MaintenanceStatsSummary, type MaintenanceTopItem, MembershipStatus, type Notification, type NotificationData, NotificationType, type NullOrUndefined, type OpeningHours, type PaginateResult, ParcelSize, PaymentOptions, type PendingErrand, type Product, type ProductCategory, type ProductImage, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductTag, type ProductVariant, type ProductVariantPrice, RemittanceStatus, type Rider, type RiderPerformanceItem, type RiderPerformanceStats, type RiderPerformanceSummary, type RiderPerformanceTimeSeries, type RiderSettlement, type RiderWithUserDetails, RoleType, type State, type TrackerPosition, type Transaction, type TransactionCategory, type TransactionItem, type TransactionType, type TransactionWithCategory, type TransactionWithJoin, type User, type UserAddress, type Vehicle, type VehicleErrandStats, type VehicleFuelStats, type VehicleLog, type VehicleLogStatsSummary, VehicleLogType, type VehicleLogWithErrands, type VehicleMaintenanceStats, type VehiclePerformanceData, type VehiclePerformanceFilters, type VehiclePerformanceItem, type VehiclePerformanceTotals, VehicleType, type VehicleWithRider, type Vendor, WhatsappButtonType, WhatsappComponentType, WhatsappEvent, WhatsappRecipient, type WhatsappSendLog, type WhatsappTemplate, type WhatsappTemplateButton, type WhatsappTemplateComponent, WhatsappTemplateMetaStatus, WhatsappTemplateParamSource, type WhatsappTemplateSource, errandTimeline };
|
package/dist/index.js
CHANGED
|
@@ -65,6 +65,19 @@ var errandTimeline = [
|
|
|
65
65
|
description: "Your package has been delivered and the errand closed, please leave a review and a rating for the rider"
|
|
66
66
|
}
|
|
67
67
|
];
|
|
68
|
+
var FeePaymentStatus = /* @__PURE__ */ ((FeePaymentStatus2) => {
|
|
69
|
+
FeePaymentStatus2["Unpaid"] = "unpaid";
|
|
70
|
+
FeePaymentStatus2["Partial"] = "partial";
|
|
71
|
+
FeePaymentStatus2["Paid"] = "paid";
|
|
72
|
+
return FeePaymentStatus2;
|
|
73
|
+
})(FeePaymentStatus || {});
|
|
74
|
+
var FeeSettlement = /* @__PURE__ */ ((FeeSettlement2) => {
|
|
75
|
+
FeeSettlement2["CashOnDelivery"] = "cash_on_delivery";
|
|
76
|
+
FeeSettlement2["Prepaid"] = "prepaid";
|
|
77
|
+
FeeSettlement2["Invoice"] = "invoice";
|
|
78
|
+
FeeSettlement2["Owed"] = "owed";
|
|
79
|
+
return FeeSettlement2;
|
|
80
|
+
})(FeeSettlement || {});
|
|
68
81
|
var AddressTypes = /* @__PURE__ */ ((AddressTypes2) => {
|
|
69
82
|
AddressTypes2["DeliveryAddress"] = "deliveryAddress";
|
|
70
83
|
AddressTypes2["PickupAddress"] = "pickupAddress";
|
|
@@ -144,11 +157,6 @@ var RemittanceStatus = /* @__PURE__ */ ((RemittanceStatus2) => {
|
|
|
144
157
|
RemittanceStatus2["Cancelled"] = "cancelled";
|
|
145
158
|
return RemittanceStatus2;
|
|
146
159
|
})(RemittanceStatus || {});
|
|
147
|
-
var SettlementType = /* @__PURE__ */ ((SettlementType2) => {
|
|
148
|
-
SettlementType2["DeliveryFee"] = "delivery_fee";
|
|
149
|
-
SettlementType2["Additional"] = "additional";
|
|
150
|
-
return SettlementType2;
|
|
151
|
-
})(SettlementType || {});
|
|
152
160
|
|
|
153
161
|
// src/enterprise.ts
|
|
154
162
|
var EnterpriseType = /* @__PURE__ */ ((EnterpriseType2) => {
|
|
@@ -289,6 +297,8 @@ export {
|
|
|
289
297
|
DraftErrandStatus,
|
|
290
298
|
EnterpriseType,
|
|
291
299
|
ErrandStatus,
|
|
300
|
+
FeePaymentStatus,
|
|
301
|
+
FeeSettlement,
|
|
292
302
|
GlobalRoles,
|
|
293
303
|
InvoiceGenerationType,
|
|
294
304
|
InvoiceItemType,
|
|
@@ -300,7 +310,6 @@ export {
|
|
|
300
310
|
PaymentOptions,
|
|
301
311
|
RemittanceStatus,
|
|
302
312
|
RoleType,
|
|
303
|
-
SettlementType,
|
|
304
313
|
VehicleLogType,
|
|
305
314
|
VehicleType,
|
|
306
315
|
WhatsappButtonType,
|
package/package.json
CHANGED
package/src/errand.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Business } from '.';
|
|
2
|
-
import { Coupon } from './coupon';
|
|
3
2
|
import { Invoice, InvoiceStatus } from './invoice';
|
|
4
3
|
import { City } from './location';
|
|
5
4
|
import { Rider } from './rider';
|
|
@@ -112,6 +111,34 @@ export interface PendingErrand {
|
|
|
112
111
|
ownerMobileNumber?: string;
|
|
113
112
|
}
|
|
114
113
|
|
|
114
|
+
// --- money model redesign (see docs/errand-money-model-redesign.md) ---
|
|
115
|
+
// Customer-facing form of "customer owes us": derived from `price - amountPaid`,
|
|
116
|
+
// never hand-set. Distinct from the legacy 5-value `paymentStatus` (InvoiceStatus).
|
|
117
|
+
export enum FeePaymentStatus {
|
|
118
|
+
Unpaid = 'unpaid',
|
|
119
|
+
Partial = 'partial',
|
|
120
|
+
Paid = 'paid',
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// How our fee gets settled — the single business fact behind three behaviours:
|
|
124
|
+
// what `amountPaid` starts at, whether the errand is invoiced, and whether the
|
|
125
|
+
// rider is carrying our fee. Replaces the `payOnDelivery` boolean, which could
|
|
126
|
+
// not tell `prepaid` / `invoice` / `owed` apart. See docs §2.9.
|
|
127
|
+
export enum FeeSettlement {
|
|
128
|
+
// Rider collects the fee at the door. Paid on arrival; rider owes it to us.
|
|
129
|
+
CashOnDelivery = 'cash_on_delivery',
|
|
130
|
+
// Already paid before dispatch. Paid; nobody is carrying it.
|
|
131
|
+
Prepaid = 'prepaid',
|
|
132
|
+
// Goes on the customer's statement. Unpaid until the invoice is paid.
|
|
133
|
+
Invoice = 'invoice',
|
|
134
|
+
// Owed by the customer with no settlement arranged yet. Unpaid, NOT invoiced.
|
|
135
|
+
Owed = 'owed',
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Who fronted an errand expense. `customer` covers "paid on call" and
|
|
139
|
+
// "handed to the rider directly" — only `company`-fronted expenses are billed.
|
|
140
|
+
export type ExpensePaidBy = 'rider' | 'company' | 'customer';
|
|
141
|
+
|
|
115
142
|
export interface Errand {
|
|
116
143
|
// NOTE: Deprecated fields
|
|
117
144
|
// rider: string | Rider;
|
|
@@ -143,13 +170,10 @@ export interface Errand {
|
|
|
143
170
|
updatedAt: Date;
|
|
144
171
|
createdAt: Date;
|
|
145
172
|
errandRating?: string | ErrandRating;
|
|
146
|
-
payOnDeliveryAmount?: string;
|
|
147
173
|
additionalData?: string;
|
|
148
174
|
deliveryDate?: Date;
|
|
149
175
|
cityId?: City;
|
|
150
|
-
couponPrice?: number;
|
|
151
176
|
price: number;
|
|
152
|
-
coupon?: string | Coupon;
|
|
153
177
|
ownerMobileNumber?: string;
|
|
154
178
|
errandTimeline?: string | ErrandTimeline;
|
|
155
179
|
queuePosition?: number;
|
|
@@ -173,11 +197,6 @@ export interface Errand {
|
|
|
173
197
|
isDelayed?: boolean;
|
|
174
198
|
delayedAt?: Date;
|
|
175
199
|
wasDeliveredBy?: 'rider' | 'admin' | 'system' | 'business';
|
|
176
|
-
paymentMethod?:
|
|
177
|
-
| 'cash_on_delivery'
|
|
178
|
-
| 'prepaid_online'
|
|
179
|
-
| 'prepaid_transfer'
|
|
180
|
-
| 'business_invoice';
|
|
181
200
|
additionalFees?: Array<{
|
|
182
201
|
description: string;
|
|
183
202
|
amount: number;
|
|
@@ -188,6 +207,22 @@ export interface Errand {
|
|
|
188
207
|
// new fields
|
|
189
208
|
riderDetails?: Rider;
|
|
190
209
|
vehicleDetails?: Vehicle;
|
|
210
|
+
|
|
211
|
+
// --- money model redesign (Phase 1: additive; see docs/errand-money-model-redesign.md) ---
|
|
212
|
+
// How much of `price` has been paid, by any route. Drives `feePaymentStatus`.
|
|
213
|
+
amountPaid?: number;
|
|
214
|
+
// Goods money the rider collects for the customer — NEVER our fee.
|
|
215
|
+
// This IS "we owe the customer".
|
|
216
|
+
collections?: number;
|
|
217
|
+
// How our fee is settled (§2.9). Drives `amountPaid` at creation, invoice
|
|
218
|
+
// eligibility, and whether the rider carries our fee. Orthogonal to
|
|
219
|
+
// `collections`, which is always goods money for the customer.
|
|
220
|
+
feeSettlement?: `${FeeSettlement}`;
|
|
221
|
+
// Out-of-pocket cost during the errand (e.g. waybill).
|
|
222
|
+
expenseAmount?: number;
|
|
223
|
+
expensePaidBy?: ExpensePaidBy;
|
|
224
|
+
// Derived from `price - amountPaid` (never hand-set). Stored so Mongo can filter on it.
|
|
225
|
+
feePaymentStatus?: `${FeePaymentStatus}`;
|
|
191
226
|
}
|
|
192
227
|
|
|
193
228
|
export interface AggregatedErrand extends Errand {
|
|
@@ -322,7 +357,6 @@ export interface DraftErrand {
|
|
|
322
357
|
deliveryDetails?: AddressDetails;
|
|
323
358
|
additionalData?: string;
|
|
324
359
|
parcelSize?: `${ParcelSize}`;
|
|
325
|
-
payOnDeliveryAmount?: number;
|
|
326
360
|
|
|
327
361
|
// Lifecycle
|
|
328
362
|
status: DraftErrandStatus;
|
package/src/index.ts
CHANGED
package/src/rider.ts
CHANGED
|
@@ -55,11 +55,15 @@ export interface RiderSettlement {
|
|
|
55
55
|
riderId: string;
|
|
56
56
|
businessId: string;
|
|
57
57
|
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
additionalAmount: number;
|
|
58
|
+
// The cash the rider collected and owes us. Remittance is all-or-nothing
|
|
59
|
+
// (see `remittanceStatus`) — no partial remittance, no fee/additional split.
|
|
61
60
|
totalCollectionAmount: number;
|
|
62
|
-
|
|
61
|
+
|
|
62
|
+
// DEPRECATED (read-only, transitional; see docs §7.5). Historical records
|
|
63
|
+
// store money here; kept for the balance fallback until the Phase 5 drop.
|
|
64
|
+
deliveryFee?: number;
|
|
65
|
+
additionalAmount?: number;
|
|
66
|
+
remittedAmount?: number;
|
|
63
67
|
|
|
64
68
|
// Status
|
|
65
69
|
remittanceStatus: RemittanceStatus | `${RemittanceStatus}`;
|
|
@@ -101,7 +105,3 @@ export interface RiderPerformanceStats {
|
|
|
101
105
|
timeSeries?: RiderPerformanceTimeSeries[];
|
|
102
106
|
}
|
|
103
107
|
|
|
104
|
-
export enum SettlementType {
|
|
105
|
-
DeliveryFee = 'delivery_fee',
|
|
106
|
-
Additional = 'additional',
|
|
107
|
-
}
|
package/src/coupon.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface Coupon {
|
|
2
|
-
id: string;
|
|
3
|
-
phoneNumber: string;
|
|
4
|
-
couponType: 'errand';
|
|
5
|
-
isUsed: boolean;
|
|
6
|
-
expiresAt: Date;
|
|
7
|
-
couponCode: string;
|
|
8
|
-
updatedAt: Date;
|
|
9
|
-
createdAt: Date;
|
|
10
|
-
hasExpired: boolean;
|
|
11
|
-
couponValue: number;
|
|
12
|
-
ref?: string;
|
|
13
|
-
fullName?: string;
|
|
14
|
-
}
|