feeef 0.6.0 → 0.6.2
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/build/index.js +1198 -42
- package/build/index.js.map +1 -1
- package/build/src/core/entities/category.d.ts +21 -0
- package/build/src/core/entities/feedback.d.ts +100 -0
- package/build/src/core/entities/order.d.ts +93 -0
- package/build/src/core/entities/product.d.ts +76 -0
- package/build/src/core/entities/shipping_method.d.ts +28 -0
- package/build/src/core/entities/shipping_price.d.ts +19 -0
- package/build/src/core/entities/store.d.ts +105 -0
- package/build/src/feeef/feeef.d.ts +28 -1
- package/build/src/feeef/repositories/categories.d.ts +43 -3
- package/build/src/feeef/repositories/deposits.d.ts +67 -4
- package/build/src/feeef/repositories/feedbacks.d.ts +43 -0
- package/build/src/feeef/repositories/orders.d.ts +69 -13
- package/build/src/feeef/repositories/products.d.ts +43 -5
- package/build/src/feeef/repositories/shipping_methods.d.ts +38 -0
- package/build/src/feeef/repositories/shipping_prices.d.ts +19 -8
- package/build/src/feeef/repositories/stores.d.ts +90 -7
- package/build/src/feeef/repositories/transfers.d.ts +61 -4
- package/build/src/feeef/services/integrations.d.ts +330 -0
- package/build/src/feeef/services/notifications.d.ts +68 -0
- package/build/src/feeef/services/storage.d.ts +134 -0
- package/build/src/index.d.ts +17 -2
- package/package.json +1 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { ModelRepository } from './repository.js';
|
|
2
|
+
import { ModelRepository, ListResponse } from './repository.js';
|
|
3
|
+
/**
|
|
4
|
+
* Deposit status enum
|
|
5
|
+
*/
|
|
6
|
+
export type DepositStatus = 'pending' | 'completed' | 'failed' | 'cancelled';
|
|
3
7
|
/**
|
|
4
8
|
* Represents a deposit entity for wallet transactions
|
|
5
9
|
*/
|
|
@@ -11,7 +15,7 @@ export interface DepositEntity {
|
|
|
11
15
|
currency: string;
|
|
12
16
|
paymentMethod?: string | null;
|
|
13
17
|
attachment?: string | null;
|
|
14
|
-
status:
|
|
18
|
+
status: DepositStatus;
|
|
15
19
|
note?: string | null;
|
|
16
20
|
metadata: Record<string, any>;
|
|
17
21
|
history: Array<{
|
|
@@ -28,13 +32,45 @@ export interface DepositEntity {
|
|
|
28
32
|
export interface DepositCreateInput {
|
|
29
33
|
id?: string;
|
|
30
34
|
externalId?: string;
|
|
35
|
+
userId?: string;
|
|
31
36
|
amount: number;
|
|
32
37
|
currency?: string;
|
|
33
38
|
paymentMethod?: string;
|
|
34
39
|
attachment?: string;
|
|
40
|
+
status?: DepositStatus;
|
|
41
|
+
note?: string;
|
|
42
|
+
metadata?: Record<string, any>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Input data for updating an existing deposit
|
|
46
|
+
*/
|
|
47
|
+
export interface DepositUpdateInput {
|
|
48
|
+
externalId?: string;
|
|
49
|
+
amount?: number;
|
|
50
|
+
currency?: string;
|
|
51
|
+
paymentMethod?: string;
|
|
52
|
+
attachment?: string;
|
|
53
|
+
status?: DepositStatus;
|
|
35
54
|
note?: string;
|
|
36
55
|
metadata?: Record<string, any>;
|
|
37
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Options for listing deposits
|
|
59
|
+
*/
|
|
60
|
+
export interface DepositListOptions {
|
|
61
|
+
page?: number;
|
|
62
|
+
offset?: number;
|
|
63
|
+
limit?: number;
|
|
64
|
+
userId?: string;
|
|
65
|
+
status?: DepositStatus | DepositStatus[];
|
|
66
|
+
paymentMethod?: string;
|
|
67
|
+
createdAfter?: Date | string;
|
|
68
|
+
createdBefore?: Date | string;
|
|
69
|
+
minAmount?: number;
|
|
70
|
+
maxAmount?: number;
|
|
71
|
+
q?: string;
|
|
72
|
+
params?: Record<string, any>;
|
|
73
|
+
}
|
|
38
74
|
/**
|
|
39
75
|
* PayPal order creation response
|
|
40
76
|
*/
|
|
@@ -61,14 +97,20 @@ export interface PayPalCaptureResponse {
|
|
|
61
97
|
/**
|
|
62
98
|
* Repository for managing deposit data and PayPal integration
|
|
63
99
|
*/
|
|
64
|
-
export declare class DepositRepository extends ModelRepository<DepositEntity, DepositCreateInput,
|
|
100
|
+
export declare class DepositRepository extends ModelRepository<DepositEntity, DepositCreateInput, DepositUpdateInput> {
|
|
65
101
|
/**
|
|
66
102
|
* Constructs a new DepositRepository instance
|
|
67
103
|
* @param client - The AxiosInstance used for making HTTP requests
|
|
68
104
|
*/
|
|
69
105
|
constructor(client: AxiosInstance);
|
|
70
106
|
/**
|
|
71
|
-
*
|
|
107
|
+
* Lists deposits with optional filtering.
|
|
108
|
+
* @param options - The options for listing deposits.
|
|
109
|
+
* @returns A Promise that resolves to a list of Deposit entities.
|
|
110
|
+
*/
|
|
111
|
+
list(options?: DepositListOptions): Promise<ListResponse<DepositEntity>>;
|
|
112
|
+
/**
|
|
113
|
+
* Create a new deposit request (for anonymous/guest users)
|
|
72
114
|
* @param data - The deposit data
|
|
73
115
|
* @returns Promise that resolves to the created deposit
|
|
74
116
|
*/
|
|
@@ -102,4 +144,25 @@ export declare class DepositRepository extends ModelRepository<DepositEntity, De
|
|
|
102
144
|
amount?: number;
|
|
103
145
|
currency?: string;
|
|
104
146
|
}>;
|
|
147
|
+
/**
|
|
148
|
+
* Accept a pending deposit (admin only)
|
|
149
|
+
* @param depositId - The deposit ID to accept
|
|
150
|
+
* @param note - Optional note for the status change
|
|
151
|
+
* @returns Promise that resolves to the updated deposit
|
|
152
|
+
*/
|
|
153
|
+
accept(depositId: string, note?: string): Promise<DepositEntity>;
|
|
154
|
+
/**
|
|
155
|
+
* Reject a pending deposit (admin only)
|
|
156
|
+
* @param depositId - The deposit ID to reject
|
|
157
|
+
* @param note - Optional note for the rejection reason
|
|
158
|
+
* @returns Promise that resolves to the updated deposit
|
|
159
|
+
*/
|
|
160
|
+
reject(depositId: string, note?: string): Promise<DepositEntity>;
|
|
161
|
+
/**
|
|
162
|
+
* Cancel a pending deposit
|
|
163
|
+
* @param depositId - The deposit ID to cancel
|
|
164
|
+
* @param note - Optional note for the cancellation reason
|
|
165
|
+
* @returns Promise that resolves to the updated deposit
|
|
166
|
+
*/
|
|
167
|
+
cancel(depositId: string, note?: string): Promise<DepositEntity>;
|
|
105
168
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { ModelRepository, ListResponse } from './repository.js';
|
|
3
|
+
import { FeedbackEntity, FeedbackCreateInput, FeedbackUpdateInput, FeedbackListOptions } from '../../core/entities/feedback.js';
|
|
4
|
+
/**
|
|
5
|
+
* Repository for managing Feedback entities.
|
|
6
|
+
*/
|
|
7
|
+
export declare class FeedbackRepository extends ModelRepository<FeedbackEntity, FeedbackCreateInput, FeedbackUpdateInput> {
|
|
8
|
+
/**
|
|
9
|
+
* Constructs a new FeedbackRepository instance.
|
|
10
|
+
* @param client The AxiosInstance used for making HTTP requests.
|
|
11
|
+
*/
|
|
12
|
+
constructor(client: AxiosInstance);
|
|
13
|
+
/**
|
|
14
|
+
* Lists feedbacks with optional filtering.
|
|
15
|
+
* @param options - The options for listing feedbacks.
|
|
16
|
+
* @returns A Promise that resolves to a list of Feedback entities.
|
|
17
|
+
*/
|
|
18
|
+
list(options?: FeedbackListOptions): Promise<ListResponse<FeedbackEntity>>;
|
|
19
|
+
/**
|
|
20
|
+
* Adds a comment to existing feedback.
|
|
21
|
+
* @param id - The feedback ID.
|
|
22
|
+
* @param comment - The comment to add.
|
|
23
|
+
* @returns A Promise that resolves to the updated Feedback entity.
|
|
24
|
+
*/
|
|
25
|
+
addComment(id: string, comment: string): Promise<FeedbackEntity>;
|
|
26
|
+
/**
|
|
27
|
+
* Creates feedback with file attachments.
|
|
28
|
+
* @param data - The feedback data.
|
|
29
|
+
* @param files - Optional array of files to attach.
|
|
30
|
+
* @param params - Optional query parameters.
|
|
31
|
+
* @returns A Promise that resolves to the created Feedback entity.
|
|
32
|
+
*/
|
|
33
|
+
createWithFiles(data: FeedbackCreateInput, files?: File[], params?: Record<string, any>): Promise<FeedbackEntity>;
|
|
34
|
+
/**
|
|
35
|
+
* Updates feedback with additional files.
|
|
36
|
+
* @param id - The feedback ID.
|
|
37
|
+
* @param data - The update data.
|
|
38
|
+
* @param files - Optional array of files to attach.
|
|
39
|
+
* @param params - Optional query parameters.
|
|
40
|
+
* @returns A Promise that resolves to the updated Feedback entity.
|
|
41
|
+
*/
|
|
42
|
+
updateWithFiles(id: string, data: FeedbackUpdateInput, files?: File[], params?: Record<string, any>): Promise<FeedbackEntity>;
|
|
43
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { ModelRepository } from './repository.js';
|
|
3
|
-
import { OrderEntity, OrderTrackEntity, ShippingType } from '../../core/entities/order.js';
|
|
2
|
+
import { ModelRepository, ListResponse } from './repository.js';
|
|
3
|
+
import { OrderEntity, OrderTrackEntity, OrderStatus, DeliveryStatus, PaymentStatus, ShippingType, OrderCreateInput, OrderUpdateInput, OrderPricing, CalculateOrderPricingOptions } from '../../core/entities/order.js';
|
|
4
4
|
/**
|
|
5
5
|
* Represents the options for tracking an order.
|
|
6
6
|
*/
|
|
@@ -8,6 +8,9 @@ export interface OrderModelTrackOptions {
|
|
|
8
8
|
id: string;
|
|
9
9
|
params?: Record<string, any>;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Schema for sending an order from an anonymous user
|
|
13
|
+
*/
|
|
11
14
|
export interface SendOrderSchema {
|
|
12
15
|
id?: string;
|
|
13
16
|
customerName?: string;
|
|
@@ -18,6 +21,7 @@ export interface SendOrderSchema {
|
|
|
18
21
|
shippingAddress?: string;
|
|
19
22
|
shippingCity?: string;
|
|
20
23
|
shippingState?: string;
|
|
24
|
+
shippingCountry?: string;
|
|
21
25
|
shippingType: ShippingType;
|
|
22
26
|
shippingMethodId?: string;
|
|
23
27
|
shippingNote?: string;
|
|
@@ -26,8 +30,12 @@ export interface SendOrderSchema {
|
|
|
26
30
|
coupon?: string;
|
|
27
31
|
status: 'pending' | 'draft';
|
|
28
32
|
storeId: string;
|
|
33
|
+
customFields?: Record<string, any>;
|
|
29
34
|
metadata?: any;
|
|
30
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Schema for guest order items
|
|
38
|
+
*/
|
|
31
39
|
export interface GuestOrderItemSchema {
|
|
32
40
|
productId: string;
|
|
33
41
|
offerCode?: string;
|
|
@@ -51,15 +59,57 @@ export interface AssignManyOrdersSchema {
|
|
|
51
59
|
memberId: string;
|
|
52
60
|
storeId: string;
|
|
53
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Delivery service filter enum
|
|
64
|
+
*/
|
|
65
|
+
export declare enum DeliveryServiceFilter {
|
|
66
|
+
yalidine = "yalidine",
|
|
67
|
+
ecotrack = "ecotrack",
|
|
68
|
+
procolis = "procolis",
|
|
69
|
+
noest = "noest",
|
|
70
|
+
zimou = "zimou",
|
|
71
|
+
maystro = "maystro",
|
|
72
|
+
ecomanager = "ecomanager"
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Options for listing orders
|
|
76
|
+
*/
|
|
77
|
+
export interface OrderListOptions {
|
|
78
|
+
page?: number;
|
|
79
|
+
offset?: number;
|
|
80
|
+
limit?: number;
|
|
81
|
+
storeId?: string;
|
|
82
|
+
status?: OrderStatus | OrderStatus[];
|
|
83
|
+
deliveryStatus?: DeliveryStatus;
|
|
84
|
+
paymentStatus?: PaymentStatus;
|
|
85
|
+
customStatus?: string | string[];
|
|
86
|
+
source?: string | string[];
|
|
87
|
+
tags?: string[];
|
|
88
|
+
createdBefore?: Date | string;
|
|
89
|
+
createdAfter?: Date | string;
|
|
90
|
+
q?: string;
|
|
91
|
+
confirmer?: string;
|
|
92
|
+
products?: string[];
|
|
93
|
+
shippingState?: string;
|
|
94
|
+
shippingCity?: string;
|
|
95
|
+
deliveryService?: DeliveryServiceFilter;
|
|
96
|
+
params?: Record<string, any>;
|
|
97
|
+
}
|
|
54
98
|
/**
|
|
55
99
|
* Represents a repository for managing orders.
|
|
56
100
|
*/
|
|
57
|
-
export declare class OrderRepository extends ModelRepository<OrderEntity,
|
|
101
|
+
export declare class OrderRepository extends ModelRepository<OrderEntity, OrderCreateInput, OrderUpdateInput> {
|
|
58
102
|
/**
|
|
59
103
|
* Constructs a new OrderRepository instance.
|
|
60
104
|
* @param client - The AxiosInstance used for making HTTP requests.
|
|
61
105
|
*/
|
|
62
106
|
constructor(client: AxiosInstance);
|
|
107
|
+
/**
|
|
108
|
+
* Lists orders with optional filtering.
|
|
109
|
+
* @param options - The options for listing orders.
|
|
110
|
+
* @returns A Promise that resolves to a list of Order entities.
|
|
111
|
+
*/
|
|
112
|
+
list(options?: OrderListOptions): Promise<ListResponse<OrderEntity>>;
|
|
63
113
|
/**
|
|
64
114
|
* Sends an order from an anonymous user.
|
|
65
115
|
* @param data - The data representing the order to be sent.
|
|
@@ -67,22 +117,28 @@ export declare class OrderRepository extends ModelRepository<OrderEntity, any, a
|
|
|
67
117
|
*/
|
|
68
118
|
send(data: SendOrderSchema): Promise<OrderEntity>;
|
|
69
119
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* @param options - The options for
|
|
73
|
-
* @returns A promise that resolves to the
|
|
120
|
+
* Tracks the order by the order ID.
|
|
121
|
+
* Returns the order status and history.
|
|
122
|
+
* @param options - The options for tracking the order.
|
|
123
|
+
* @returns A promise that resolves to the order track entity.
|
|
74
124
|
*/
|
|
75
125
|
track(options: OrderModelTrackOptions): Promise<OrderTrackEntity>;
|
|
76
126
|
/**
|
|
77
|
-
*
|
|
78
|
-
* @param
|
|
79
|
-
* @returns A Promise that resolves to the
|
|
127
|
+
* Calculates order pricing based on items, shipping details, etc.
|
|
128
|
+
* @param options - The calculation options.
|
|
129
|
+
* @returns A Promise that resolves to the calculated pricing.
|
|
130
|
+
*/
|
|
131
|
+
calculate(options: CalculateOrderPricingOptions): Promise<OrderPricing>;
|
|
132
|
+
/**
|
|
133
|
+
* Assigns a single order to a member (as confirmer).
|
|
134
|
+
* @param data - The data containing orderId, memberId, and storeId.
|
|
135
|
+
* @returns A Promise that resolves to the updated OrderEntity.
|
|
80
136
|
*/
|
|
81
137
|
assign(data: AssignOrderSchema): Promise<OrderEntity>;
|
|
82
138
|
/**
|
|
83
|
-
* Assigns multiple orders to a member (as confirmer)
|
|
84
|
-
* @param data - The data containing orderIds, memberId, and storeId
|
|
85
|
-
* @returns A Promise that resolves to a success message
|
|
139
|
+
* Assigns multiple orders to a member (as confirmer).
|
|
140
|
+
* @param data - The data containing orderIds, memberId, and storeId.
|
|
141
|
+
* @returns A Promise that resolves to a success message.
|
|
86
142
|
*/
|
|
87
143
|
assignMany(data: AssignManyOrdersSchema): Promise<{
|
|
88
144
|
message: string;
|
|
@@ -1,19 +1,57 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { ModelRepository } from './repository.js';
|
|
3
|
-
import { ProductEntity } from '../../core/entities/product.js';
|
|
2
|
+
import { ModelRepository, ListResponse } from './repository.js';
|
|
3
|
+
import { ProductEntity, ProductCreateInput, ProductUpdateInput, ProductReport, ProductStatus } from '../../core/entities/product.js';
|
|
4
|
+
/**
|
|
5
|
+
* Options for listing products
|
|
6
|
+
*/
|
|
7
|
+
export interface ProductListOptions {
|
|
8
|
+
page?: number;
|
|
9
|
+
offset?: number;
|
|
10
|
+
limit?: number;
|
|
11
|
+
storeId?: string;
|
|
12
|
+
categoryId?: string;
|
|
13
|
+
status?: ProductStatus | ProductStatus[];
|
|
14
|
+
q?: string;
|
|
15
|
+
minPrice?: number;
|
|
16
|
+
maxPrice?: number;
|
|
17
|
+
inStock?: boolean;
|
|
18
|
+
sortBy?: 'price' | 'createdAt' | 'sold' | 'views';
|
|
19
|
+
sortOrder?: 'asc' | 'desc';
|
|
20
|
+
params?: Record<string, any>;
|
|
21
|
+
}
|
|
4
22
|
/**
|
|
5
23
|
* Represents a repository for managing products.
|
|
6
24
|
*/
|
|
7
|
-
export declare class ProductRepository extends ModelRepository<ProductEntity,
|
|
25
|
+
export declare class ProductRepository extends ModelRepository<ProductEntity, ProductCreateInput, ProductUpdateInput> {
|
|
8
26
|
/**
|
|
9
27
|
* Creates a new instance of the ProductRepository class.
|
|
10
28
|
* @param client - The AxiosInstance used for making HTTP requests.
|
|
11
29
|
*/
|
|
12
30
|
constructor(client: AxiosInstance);
|
|
13
31
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param
|
|
32
|
+
* Lists products with optional filtering.
|
|
33
|
+
* @param options - The options for listing products.
|
|
34
|
+
* @returns A Promise that resolves to a list of Product entities.
|
|
35
|
+
*/
|
|
36
|
+
list(options?: ProductListOptions): Promise<ListResponse<ProductEntity>>;
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves random products from the repository.
|
|
39
|
+
* @param limit - The number of random products to retrieve. Default is 12.
|
|
16
40
|
* @returns A promise that resolves to an array of random ProductEntity objects.
|
|
17
41
|
*/
|
|
18
42
|
random(limit?: number): Promise<ProductEntity[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the sells chart for a product (last 7 days).
|
|
45
|
+
* @param productId - The product ID.
|
|
46
|
+
* @param storeId - The store ID.
|
|
47
|
+
* @returns A Promise that resolves to a map of date to number of sells.
|
|
48
|
+
*/
|
|
49
|
+
sells(productId: string, storeId: string): Promise<Map<Date, number>>;
|
|
50
|
+
/**
|
|
51
|
+
* Gets the analytics/report for a product.
|
|
52
|
+
* @param productId - The product ID.
|
|
53
|
+
* @param storeId - The store ID.
|
|
54
|
+
* @returns A Promise that resolves to the product report.
|
|
55
|
+
*/
|
|
56
|
+
report(productId: string, storeId: string): Promise<ProductReport>;
|
|
19
57
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { ModelRepository, ListResponse } from './repository.js';
|
|
3
|
+
import { ShippingMethodEntity, ShippingMethodCreateInput, ShippingMethodUpdateInput, ShippingMethodStatus, ShippingMethodPolicy } from '../../core/entities/shipping_method.js';
|
|
4
|
+
/**
|
|
5
|
+
* Options for listing shipping methods
|
|
6
|
+
*/
|
|
7
|
+
export interface ShippingMethodListOptions {
|
|
8
|
+
page?: number;
|
|
9
|
+
offset?: number;
|
|
10
|
+
limit?: number;
|
|
11
|
+
storeId?: string;
|
|
12
|
+
status?: ShippingMethodStatus | ShippingMethodStatus[];
|
|
13
|
+
policy?: ShippingMethodPolicy;
|
|
14
|
+
params?: Record<string, any>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Repository for managing ShippingMethod entities.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ShippingMethodRepository extends ModelRepository<ShippingMethodEntity, ShippingMethodCreateInput, ShippingMethodUpdateInput> {
|
|
20
|
+
/**
|
|
21
|
+
* Constructs a new ShippingMethodRepository instance.
|
|
22
|
+
* @param client The AxiosInstance used for making HTTP requests.
|
|
23
|
+
*/
|
|
24
|
+
constructor(client: AxiosInstance);
|
|
25
|
+
/**
|
|
26
|
+
* Lists shipping methods with optional filtering.
|
|
27
|
+
* @param options - The options for listing shipping methods.
|
|
28
|
+
* @returns A Promise that resolves to a list of ShippingMethod entities.
|
|
29
|
+
*/
|
|
30
|
+
list(options?: ShippingMethodListOptions): Promise<ListResponse<ShippingMethodEntity>>;
|
|
31
|
+
/**
|
|
32
|
+
* Lists shipping methods for a specific store.
|
|
33
|
+
* @param storeId - The store ID.
|
|
34
|
+
* @param options - Optional list options.
|
|
35
|
+
* @returns A Promise that resolves to a list of ShippingMethod entities.
|
|
36
|
+
*/
|
|
37
|
+
listByStore(storeId: string, options?: Omit<ShippingMethodListOptions, 'storeId'>): Promise<ListResponse<ShippingMethodEntity>>;
|
|
38
|
+
}
|
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { ModelRepository,
|
|
3
|
-
import { ShippingPriceEntity } from '../../core/entities/shipping_price.js';
|
|
2
|
+
import { ModelRepository, ListResponse } from './repository.js';
|
|
3
|
+
import { ShippingPriceEntity, ShippingPriceCreateInput, ShippingPriceUpdateInput, ShippingPriceStatus } from '../../core/entities/shipping_price.js';
|
|
4
|
+
/**
|
|
5
|
+
* Options for listing shipping prices
|
|
6
|
+
*/
|
|
7
|
+
export interface ShippingPriceListOptions {
|
|
8
|
+
page?: number;
|
|
9
|
+
offset?: number;
|
|
10
|
+
limit?: number;
|
|
11
|
+
storeId?: string;
|
|
12
|
+
status?: ShippingPriceStatus | ShippingPriceStatus[];
|
|
13
|
+
params?: Record<string, any>;
|
|
14
|
+
}
|
|
4
15
|
/**
|
|
5
16
|
* Repository for managing ShippingPrice entities.
|
|
6
17
|
*
|
|
7
18
|
* ShippingPrice is the new geo-based shipping system that replaces
|
|
8
19
|
* the legacy array-based ShippingMethod rates.
|
|
9
20
|
*/
|
|
10
|
-
export declare class ShippingPriceRepository extends ModelRepository<ShippingPriceEntity,
|
|
21
|
+
export declare class ShippingPriceRepository extends ModelRepository<ShippingPriceEntity, ShippingPriceCreateInput, ShippingPriceUpdateInput> {
|
|
11
22
|
/**
|
|
12
23
|
* Constructs a new ShippingPriceRepository instance.
|
|
13
24
|
* @param client The AxiosInstance used for making HTTP requests.
|
|
14
25
|
*/
|
|
15
26
|
constructor(client: AxiosInstance);
|
|
16
27
|
/**
|
|
17
|
-
*
|
|
18
|
-
* @param options The options for
|
|
19
|
-
* @returns A Promise that resolves to
|
|
28
|
+
* Lists shipping prices with optional filtering.
|
|
29
|
+
* @param options - The options for listing shipping prices.
|
|
30
|
+
* @returns A Promise that resolves to a list of ShippingPrice entities.
|
|
20
31
|
*/
|
|
21
|
-
|
|
32
|
+
list(options?: ShippingPriceListOptions): Promise<ListResponse<ShippingPriceEntity>>;
|
|
22
33
|
/**
|
|
23
|
-
*
|
|
34
|
+
* Lists shipping prices for a specific store.
|
|
24
35
|
* @param storeId The store ID to search for.
|
|
25
36
|
* @returns A Promise that resolves to the ShippingPrice entities for the store.
|
|
26
37
|
*/
|
|
@@ -1,19 +1,102 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { ModelRepository,
|
|
3
|
-
import { StoreEntity } from '../../core/entities/store.js';
|
|
2
|
+
import { ModelRepository, ListResponse } from './repository.js';
|
|
3
|
+
import { StoreEntity, StoreSummary, StoreMember, StoreSubscriptionType, AddStoreMemberInput, UpdateStoreMemberInput, StoreCreateInput, StoreUpdateInput } from '../../core/entities/store.js';
|
|
4
|
+
/**
|
|
5
|
+
* Options for listing stores
|
|
6
|
+
*/
|
|
7
|
+
export interface StoreListOptions {
|
|
8
|
+
page?: number;
|
|
9
|
+
offset?: number;
|
|
10
|
+
limit?: number;
|
|
11
|
+
userId?: string;
|
|
12
|
+
params?: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Options for getting store summary
|
|
16
|
+
*/
|
|
17
|
+
export interface StoreSummaryOptions {
|
|
18
|
+
id: string;
|
|
19
|
+
from?: Date | string;
|
|
20
|
+
to?: Date | string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Result from paying store due
|
|
24
|
+
*/
|
|
25
|
+
export interface PayDueResult {
|
|
26
|
+
success: boolean;
|
|
27
|
+
paidAmount: number;
|
|
28
|
+
remainingDue: number;
|
|
29
|
+
cost: number;
|
|
30
|
+
}
|
|
4
31
|
/**
|
|
5
32
|
* Repository for managing Store entities.
|
|
6
33
|
*/
|
|
7
|
-
export declare class StoreRepository extends ModelRepository<StoreEntity,
|
|
34
|
+
export declare class StoreRepository extends ModelRepository<StoreEntity, StoreCreateInput, StoreUpdateInput> {
|
|
8
35
|
/**
|
|
9
36
|
* Constructs a new StoreRepository instance.
|
|
10
37
|
* @param client The AxiosInstance used for making HTTP requests.
|
|
11
38
|
*/
|
|
12
39
|
constructor(client: AxiosInstance);
|
|
13
40
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param options The options for
|
|
16
|
-
* @returns A Promise that resolves to
|
|
41
|
+
* Lists stores with optional filtering.
|
|
42
|
+
* @param options - The options for listing stores.
|
|
43
|
+
* @returns A Promise that resolves to a list of Store entities.
|
|
44
|
+
*/
|
|
45
|
+
list(options?: StoreListOptions): Promise<ListResponse<StoreEntity>>;
|
|
46
|
+
/**
|
|
47
|
+
* Gets the summary for a store.
|
|
48
|
+
* @param options - The summary options including store ID and date range.
|
|
49
|
+
* @returns A Promise that resolves to the store summary.
|
|
50
|
+
*/
|
|
51
|
+
summary(options: StoreSummaryOptions): Promise<StoreSummary>;
|
|
52
|
+
/**
|
|
53
|
+
* Gets the orders chart data for a store.
|
|
54
|
+
* @param id - The store ID.
|
|
55
|
+
* @returns A Promise that resolves to a map of date to order count.
|
|
56
|
+
*/
|
|
57
|
+
chart(id: string): Promise<Map<Date, number>>;
|
|
58
|
+
/**
|
|
59
|
+
* Adds a member to the store.
|
|
60
|
+
* @param storeId - The store ID.
|
|
61
|
+
* @param data - The member data.
|
|
62
|
+
* @returns A Promise that resolves to the added member.
|
|
63
|
+
*/
|
|
64
|
+
addMember(storeId: string, data: AddStoreMemberInput): Promise<StoreMember>;
|
|
65
|
+
/**
|
|
66
|
+
* Edits a store member.
|
|
67
|
+
* @param storeId - The store ID.
|
|
68
|
+
* @param memberId - The member ID.
|
|
69
|
+
* @param data - The update data.
|
|
70
|
+
* @returns A Promise that resolves to the updated member.
|
|
71
|
+
*/
|
|
72
|
+
editMember(storeId: string, memberId: string, data: UpdateStoreMemberInput): Promise<StoreMember>;
|
|
73
|
+
/**
|
|
74
|
+
* Removes a member from the store.
|
|
75
|
+
* @param storeId - The store ID.
|
|
76
|
+
* @param memberId - The member ID.
|
|
77
|
+
* @returns A Promise that resolves when the member is removed.
|
|
78
|
+
*/
|
|
79
|
+
removeMember(storeId: string, memberId: string): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Upgrades or renews a store's subscription plan.
|
|
82
|
+
* @param id - The store ID.
|
|
83
|
+
* @param plan - The plan type to upgrade to.
|
|
84
|
+
* @param months - The number of months (1-12).
|
|
85
|
+
* @returns A Promise that resolves when the upgrade is complete.
|
|
86
|
+
*/
|
|
87
|
+
upgrade(id: string, plan: StoreSubscriptionType, months: number): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Purchases additional points for a store's subscription.
|
|
90
|
+
* @param id - The store ID.
|
|
91
|
+
* @param points - The number of points to purchase.
|
|
92
|
+
* @returns A Promise that resolves when the charge is complete.
|
|
93
|
+
*/
|
|
94
|
+
charge(id: string, points: number): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Pays store due amount.
|
|
97
|
+
* @param storeId - The store ID.
|
|
98
|
+
* @param amount - The amount of due to pay (in points).
|
|
99
|
+
* @returns A Promise that resolves to the payment result.
|
|
17
100
|
*/
|
|
18
|
-
|
|
101
|
+
payDue(storeId: string, amount: number): Promise<PayDueResult>;
|
|
19
102
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import { ModelRepository } from './repository.js';
|
|
2
|
+
import { ModelRepository, ListResponse } from './repository.js';
|
|
3
|
+
/**
|
|
4
|
+
* Transfer type enum
|
|
5
|
+
*/
|
|
6
|
+
export type TransferType = 'deposit' | 'subscription' | 'points' | 'store_due' | 'user_transfer' | 'ai_generation' | 'refund' | 'adjustment';
|
|
3
7
|
/**
|
|
4
8
|
* Represents a transfer entity for double-entry accounting transactions
|
|
5
9
|
*/
|
|
@@ -8,7 +12,7 @@ export interface TransferEntity {
|
|
|
8
12
|
debitAccountId: string;
|
|
9
13
|
creditAccountId: string;
|
|
10
14
|
amount: number;
|
|
11
|
-
type:
|
|
15
|
+
type: TransferType;
|
|
12
16
|
referenceId?: string | null;
|
|
13
17
|
description?: string | null;
|
|
14
18
|
metadata: Record<string, any>;
|
|
@@ -21,18 +25,71 @@ export interface TransferCreateInput {
|
|
|
21
25
|
debitAccountId: string;
|
|
22
26
|
creditAccountId: string;
|
|
23
27
|
amount: number;
|
|
24
|
-
type:
|
|
28
|
+
type: TransferType;
|
|
25
29
|
referenceId?: string | null;
|
|
26
30
|
description?: string | null;
|
|
27
31
|
metadata?: Record<string, any>;
|
|
28
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Input data for updating an existing transfer
|
|
35
|
+
* Note: Transfers are typically immutable, but metadata/description may be updatable
|
|
36
|
+
*/
|
|
37
|
+
export interface TransferUpdateInput {
|
|
38
|
+
description?: string | null;
|
|
39
|
+
metadata?: Record<string, any>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Options for listing transfers
|
|
43
|
+
*/
|
|
44
|
+
export interface TransferListOptions {
|
|
45
|
+
page?: number;
|
|
46
|
+
offset?: number;
|
|
47
|
+
limit?: number;
|
|
48
|
+
debitAccountId?: string;
|
|
49
|
+
creditAccountId?: string;
|
|
50
|
+
accountId?: string;
|
|
51
|
+
type?: TransferType | TransferType[];
|
|
52
|
+
referenceId?: string;
|
|
53
|
+
createdAfter?: Date | string;
|
|
54
|
+
createdBefore?: Date | string;
|
|
55
|
+
minAmount?: number;
|
|
56
|
+
maxAmount?: number;
|
|
57
|
+
params?: Record<string, any>;
|
|
58
|
+
}
|
|
29
59
|
/**
|
|
30
60
|
* Repository for managing transfer data
|
|
31
61
|
*/
|
|
32
|
-
export declare class TransferRepository extends ModelRepository<TransferEntity, TransferCreateInput,
|
|
62
|
+
export declare class TransferRepository extends ModelRepository<TransferEntity, TransferCreateInput, TransferUpdateInput> {
|
|
33
63
|
/**
|
|
34
64
|
* Constructs a new TransferRepository instance
|
|
35
65
|
* @param client - The AxiosInstance used for making HTTP requests
|
|
36
66
|
*/
|
|
37
67
|
constructor(client: AxiosInstance);
|
|
68
|
+
/**
|
|
69
|
+
* Lists transfers with optional filtering.
|
|
70
|
+
* @param options - The options for listing transfers.
|
|
71
|
+
* @returns A Promise that resolves to a list of Transfer entities.
|
|
72
|
+
*/
|
|
73
|
+
list(options?: TransferListOptions): Promise<ListResponse<TransferEntity>>;
|
|
74
|
+
/**
|
|
75
|
+
* Lists transfers for a specific account (either as debit or credit).
|
|
76
|
+
* @param accountId - The account ID.
|
|
77
|
+
* @param options - Optional list options.
|
|
78
|
+
* @returns A Promise that resolves to a list of Transfer entities.
|
|
79
|
+
*/
|
|
80
|
+
listByAccount(accountId: string, options?: Omit<TransferListOptions, 'accountId'>): Promise<ListResponse<TransferEntity>>;
|
|
81
|
+
/**
|
|
82
|
+
* Lists transfers by type.
|
|
83
|
+
* @param type - The transfer type(s).
|
|
84
|
+
* @param options - Optional list options.
|
|
85
|
+
* @returns A Promise that resolves to a list of Transfer entities.
|
|
86
|
+
*/
|
|
87
|
+
listByType(type: TransferType | TransferType[], options?: Omit<TransferListOptions, 'type'>): Promise<ListResponse<TransferEntity>>;
|
|
88
|
+
/**
|
|
89
|
+
* Lists transfers by reference ID.
|
|
90
|
+
* @param referenceId - The reference ID.
|
|
91
|
+
* @param options - Optional list options.
|
|
92
|
+
* @returns A Promise that resolves to a list of Transfer entities.
|
|
93
|
+
*/
|
|
94
|
+
listByReferenceId(referenceId: string, options?: Omit<TransferListOptions, 'referenceId'>): Promise<ListResponse<TransferEntity>>;
|
|
38
95
|
}
|