@mamindom/contracts 1.0.123 → 1.0.125
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/gen/bonus_settings.d.ts +35 -0
- package/dist/gen/bonus_settings.js +28 -0
- package/dist/gen/delivery_settings.d.ts +33 -0
- package/dist/gen/delivery_settings.js +28 -0
- package/dist/gen/product.d.ts +23 -0
- package/dist/gen/product.js +1 -0
- package/dist/proto/bonus_settings.proto +35 -0
- package/dist/proto/delivery_settings.proto +35 -0
- package/dist/proto/product.proto +31 -0
- package/dist/src/proto/paths.d.ts +2 -0
- package/dist/src/proto/paths.js +3 -1
- package/gen/bonus_settings.ts +71 -0
- package/gen/delivery_settings.ts +69 -0
- package/gen/product.ts +31 -0
- package/package.json +1 -1
- package/proto/bonus_settings.proto +35 -0
- package/proto/delivery_settings.proto +35 -0
- package/proto/product.proto +31 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export declare const protobufPackage = "promo.v1";
|
|
3
|
+
export interface BonusSettingsResponse {
|
|
4
|
+
/** Курс нарахування бонусів від суми замовлення (0.02 = 2%). */
|
|
5
|
+
earnRate: number;
|
|
6
|
+
/** Курс списання бонусів (1 бонус = N грн, default 1.0). */
|
|
7
|
+
redeemRate: number;
|
|
8
|
+
/** Мінімальна сума замовлення для нарахування бонусів (0 = без обмеження). */
|
|
9
|
+
minOrderForEarn: number;
|
|
10
|
+
/**
|
|
11
|
+
* Максимальний відсоток від суми замовлення, який можна оплатити бонусами
|
|
12
|
+
* (1.0 = до 100%, 0.5 = до 50%; 0 — без обмеження).
|
|
13
|
+
*/
|
|
14
|
+
maxRedeemShare: number;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
}
|
|
17
|
+
export interface GetBonusSettingsRequest {
|
|
18
|
+
}
|
|
19
|
+
export interface UpdateBonusSettingsRequest {
|
|
20
|
+
earnRate?: number | undefined;
|
|
21
|
+
redeemRate?: number | undefined;
|
|
22
|
+
minOrderForEarn?: number | undefined;
|
|
23
|
+
maxRedeemShare?: number | undefined;
|
|
24
|
+
}
|
|
25
|
+
export declare const PROMO_V1_PACKAGE_NAME = "promo.v1";
|
|
26
|
+
export interface BonusSettingsServiceClient {
|
|
27
|
+
getBonusSettings(request: GetBonusSettingsRequest): Observable<BonusSettingsResponse>;
|
|
28
|
+
updateBonusSettings(request: UpdateBonusSettingsRequest): Observable<BonusSettingsResponse>;
|
|
29
|
+
}
|
|
30
|
+
export interface BonusSettingsServiceController {
|
|
31
|
+
getBonusSettings(request: GetBonusSettingsRequest): Promise<BonusSettingsResponse> | Observable<BonusSettingsResponse> | BonusSettingsResponse;
|
|
32
|
+
updateBonusSettings(request: UpdateBonusSettingsRequest): Promise<BonusSettingsResponse> | Observable<BonusSettingsResponse> | BonusSettingsResponse;
|
|
33
|
+
}
|
|
34
|
+
export declare function BonusSettingsServiceControllerMethods(): (constructor: Function) => void;
|
|
35
|
+
export declare const BONUS_SETTINGS_SERVICE_NAME = "BonusSettingsService";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.11.4
|
|
5
|
+
// protoc v3.21.12
|
|
6
|
+
// source: bonus_settings.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.BONUS_SETTINGS_SERVICE_NAME = exports.PROMO_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
|
|
9
|
+
exports.BonusSettingsServiceControllerMethods = BonusSettingsServiceControllerMethods;
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
12
|
+
exports.protobufPackage = "promo.v1";
|
|
13
|
+
exports.PROMO_V1_PACKAGE_NAME = "promo.v1";
|
|
14
|
+
function BonusSettingsServiceControllerMethods() {
|
|
15
|
+
return function (constructor) {
|
|
16
|
+
const grpcMethods = ["getBonusSettings", "updateBonusSettings"];
|
|
17
|
+
for (const method of grpcMethods) {
|
|
18
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
19
|
+
(0, microservices_1.GrpcMethod)("BonusSettingsService", method)(constructor.prototype[method], method, descriptor);
|
|
20
|
+
}
|
|
21
|
+
const grpcStreamMethods = [];
|
|
22
|
+
for (const method of grpcStreamMethods) {
|
|
23
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
24
|
+
(0, microservices_1.GrpcStreamMethod)("BonusSettingsService", method)(constructor.prototype[method], method, descriptor);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.BONUS_SETTINGS_SERVICE_NAME = "BonusSettingsService";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export declare const protobufPackage = "delivery.v1";
|
|
3
|
+
export interface DeliverySettingsResponse {
|
|
4
|
+
/** Дефолтна вага позиції у кг — fallback коли catalog не повертає weight. */
|
|
5
|
+
defaultItemWeightKg: number;
|
|
6
|
+
/** Поріг безкоштовної доставки в грн (0 = вимкнено). */
|
|
7
|
+
freeShippingThreshold: number;
|
|
8
|
+
/** Дефолтна оголошена вартість на одиницю товару у грн (для страхування НП). */
|
|
9
|
+
defaultDeclaredValue: number;
|
|
10
|
+
/** Reference відправника у НП (вибране warehouse адміністратором у settings). */
|
|
11
|
+
npSenderWarehouseRef?: string | undefined;
|
|
12
|
+
updatedAt: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GetDeliverySettingsRequest {
|
|
15
|
+
}
|
|
16
|
+
export interface UpdateDeliverySettingsRequest {
|
|
17
|
+
defaultItemWeightKg?: number | undefined;
|
|
18
|
+
freeShippingThreshold?: number | undefined;
|
|
19
|
+
defaultDeclaredValue?: number | undefined;
|
|
20
|
+
npSenderWarehouseRef?: string | undefined;
|
|
21
|
+
clearNpSenderWarehouseRef: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const DELIVERY_V1_PACKAGE_NAME = "delivery.v1";
|
|
24
|
+
export interface DeliverySettingsServiceClient {
|
|
25
|
+
getDeliverySettings(request: GetDeliverySettingsRequest): Observable<DeliverySettingsResponse>;
|
|
26
|
+
updateDeliverySettings(request: UpdateDeliverySettingsRequest): Observable<DeliverySettingsResponse>;
|
|
27
|
+
}
|
|
28
|
+
export interface DeliverySettingsServiceController {
|
|
29
|
+
getDeliverySettings(request: GetDeliverySettingsRequest): Promise<DeliverySettingsResponse> | Observable<DeliverySettingsResponse> | DeliverySettingsResponse;
|
|
30
|
+
updateDeliverySettings(request: UpdateDeliverySettingsRequest): Promise<DeliverySettingsResponse> | Observable<DeliverySettingsResponse> | DeliverySettingsResponse;
|
|
31
|
+
}
|
|
32
|
+
export declare function DeliverySettingsServiceControllerMethods(): (constructor: Function) => void;
|
|
33
|
+
export declare const DELIVERY_SETTINGS_SERVICE_NAME = "DeliverySettingsService";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.11.4
|
|
5
|
+
// protoc v3.21.12
|
|
6
|
+
// source: delivery_settings.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.DELIVERY_SETTINGS_SERVICE_NAME = exports.DELIVERY_V1_PACKAGE_NAME = exports.protobufPackage = void 0;
|
|
9
|
+
exports.DeliverySettingsServiceControllerMethods = DeliverySettingsServiceControllerMethods;
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
12
|
+
exports.protobufPackage = "delivery.v1";
|
|
13
|
+
exports.DELIVERY_V1_PACKAGE_NAME = "delivery.v1";
|
|
14
|
+
function DeliverySettingsServiceControllerMethods() {
|
|
15
|
+
return function (constructor) {
|
|
16
|
+
const grpcMethods = ["getDeliverySettings", "updateDeliverySettings"];
|
|
17
|
+
for (const method of grpcMethods) {
|
|
18
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
19
|
+
(0, microservices_1.GrpcMethod)("DeliverySettingsService", method)(constructor.prototype[method], method, descriptor);
|
|
20
|
+
}
|
|
21
|
+
const grpcStreamMethods = [];
|
|
22
|
+
for (const method of grpcStreamMethods) {
|
|
23
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
24
|
+
(0, microservices_1.GrpcStreamMethod)("DeliverySettingsService", method)(constructor.prototype[method], method, descriptor);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.DELIVERY_SETTINGS_SERVICE_NAME = "DeliverySettingsService";
|
package/dist/gen/product.d.ts
CHANGED
|
@@ -868,6 +868,27 @@ export interface BulkLookupProductsRequest {
|
|
|
868
868
|
export interface BulkLookupProductsResponse {
|
|
869
869
|
results: ProductLookupResult[];
|
|
870
870
|
}
|
|
871
|
+
export interface VariantLookupResult {
|
|
872
|
+
variantId: string;
|
|
873
|
+
productId: string;
|
|
874
|
+
sku: string;
|
|
875
|
+
found: boolean;
|
|
876
|
+
/** Резолвлена з урахуванням variant override. */
|
|
877
|
+
price: number;
|
|
878
|
+
oldPrice?: number | undefined;
|
|
879
|
+
stock: number;
|
|
880
|
+
hasOwnPrice: boolean;
|
|
881
|
+
/** Локалізована назва (uk → ru → перше) для зручності клієнта. */
|
|
882
|
+
nameUk: string;
|
|
883
|
+
mainImage: string;
|
|
884
|
+
colorId?: string | undefined;
|
|
885
|
+
}
|
|
886
|
+
export interface BulkLookupVariantsRequest {
|
|
887
|
+
variantIds: string[];
|
|
888
|
+
}
|
|
889
|
+
export interface BulkLookupVariantsResponse {
|
|
890
|
+
results: VariantLookupResult[];
|
|
891
|
+
}
|
|
871
892
|
export interface ProductColorImagePayload {
|
|
872
893
|
url: string;
|
|
873
894
|
mediaId: string;
|
|
@@ -1004,6 +1025,7 @@ export interface ProductServiceClient {
|
|
|
1004
1025
|
bulkUpdateSortOrder(request: BulkUpdateSortOrderRequest): Observable<SuccessResponse>;
|
|
1005
1026
|
bulkSetPopular(request: BulkSetPopularRequest): Observable<SuccessResponse>;
|
|
1006
1027
|
bulkLookupProducts(request: BulkLookupProductsRequest): Observable<BulkLookupProductsResponse>;
|
|
1028
|
+
bulkLookupVariants(request: BulkLookupVariantsRequest): Observable<BulkLookupVariantsResponse>;
|
|
1007
1029
|
createProductGroup(request: CreateProductGroupRequest): Observable<ProductGroupResponse>;
|
|
1008
1030
|
updateProductGroup(request: UpdateProductGroupRequest): Observable<ProductGroupResponse>;
|
|
1009
1031
|
deleteProductGroup(request: DeleteProductGroupRequest): Observable<SuccessResponse>;
|
|
@@ -1050,6 +1072,7 @@ export interface ProductServiceController {
|
|
|
1050
1072
|
bulkUpdateSortOrder(request: BulkUpdateSortOrderRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
|
|
1051
1073
|
bulkSetPopular(request: BulkSetPopularRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
|
|
1052
1074
|
bulkLookupProducts(request: BulkLookupProductsRequest): Promise<BulkLookupProductsResponse> | Observable<BulkLookupProductsResponse> | BulkLookupProductsResponse;
|
|
1075
|
+
bulkLookupVariants(request: BulkLookupVariantsRequest): Promise<BulkLookupVariantsResponse> | Observable<BulkLookupVariantsResponse> | BulkLookupVariantsResponse;
|
|
1053
1076
|
createProductGroup(request: CreateProductGroupRequest): Promise<ProductGroupResponse> | Observable<ProductGroupResponse> | ProductGroupResponse;
|
|
1054
1077
|
updateProductGroup(request: UpdateProductGroupRequest): Promise<ProductGroupResponse> | Observable<ProductGroupResponse> | ProductGroupResponse;
|
|
1055
1078
|
deleteProductGroup(request: DeleteProductGroupRequest): Promise<SuccessResponse> | Observable<SuccessResponse> | SuccessResponse;
|
package/dist/gen/product.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package promo.v1;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
service BonusSettingsService {
|
|
7
|
+
rpc GetBonusSettings (GetBonusSettingsRequest) returns (BonusSettingsResponse);
|
|
8
|
+
rpc UpdateBonusSettings (UpdateBonusSettingsRequest) returns (BonusSettingsResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
message BonusSettingsResponse {
|
|
13
|
+
// Курс нарахування бонусів від суми замовлення (0.02 = 2%).
|
|
14
|
+
double earn_rate = 1;
|
|
15
|
+
// Курс списання бонусів (1 бонус = N грн, default 1.0).
|
|
16
|
+
double redeem_rate = 2;
|
|
17
|
+
// Мінімальна сума замовлення для нарахування бонусів (0 = без обмеження).
|
|
18
|
+
double min_order_for_earn = 3;
|
|
19
|
+
// Максимальний відсоток від суми замовлення, який можна оплатити бонусами
|
|
20
|
+
// (1.0 = до 100%, 0.5 = до 50%; 0 — без обмеження).
|
|
21
|
+
double max_redeem_share = 4;
|
|
22
|
+
|
|
23
|
+
string updated_at = 5;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
message GetBonusSettingsRequest {}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
message UpdateBonusSettingsRequest {
|
|
31
|
+
optional double earn_rate = 1;
|
|
32
|
+
optional double redeem_rate = 2;
|
|
33
|
+
optional double min_order_for_earn = 3;
|
|
34
|
+
optional double max_redeem_share = 4;
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package delivery.v1;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
service DeliverySettingsService {
|
|
7
|
+
rpc GetDeliverySettings (GetDeliverySettingsRequest) returns (DeliverySettingsResponse);
|
|
8
|
+
rpc UpdateDeliverySettings (UpdateDeliverySettingsRequest) returns (DeliverySettingsResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
message DeliverySettingsResponse {
|
|
13
|
+
// Дефолтна вага позиції у кг — fallback коли catalog не повертає weight.
|
|
14
|
+
double default_item_weight_kg = 1;
|
|
15
|
+
// Поріг безкоштовної доставки в грн (0 = вимкнено).
|
|
16
|
+
double free_shipping_threshold = 2;
|
|
17
|
+
// Дефолтна оголошена вартість на одиницю товару у грн (для страхування НП).
|
|
18
|
+
double default_declared_value = 3;
|
|
19
|
+
// Reference відправника у НП (вибране warehouse адміністратором у settings).
|
|
20
|
+
optional string np_sender_warehouse_ref = 4;
|
|
21
|
+
|
|
22
|
+
string updated_at = 5;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
message GetDeliverySettingsRequest {}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
message UpdateDeliverySettingsRequest {
|
|
30
|
+
optional double default_item_weight_kg = 1;
|
|
31
|
+
optional double free_shipping_threshold = 2;
|
|
32
|
+
optional double default_declared_value = 3;
|
|
33
|
+
optional string np_sender_warehouse_ref = 4;
|
|
34
|
+
bool clear_np_sender_warehouse_ref = 5;
|
|
35
|
+
}
|
package/dist/proto/product.proto
CHANGED
|
@@ -52,6 +52,7 @@ service ProductService {
|
|
|
52
52
|
rpc BulkSetPopular (BulkSetPopularRequest) returns (SuccessResponse);
|
|
53
53
|
|
|
54
54
|
rpc BulkLookupProducts (BulkLookupProductsRequest) returns (BulkLookupProductsResponse);
|
|
55
|
+
rpc BulkLookupVariants (BulkLookupVariantsRequest) returns (BulkLookupVariantsResponse);
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
rpc CreateProductGroup (CreateProductGroupRequest) returns (ProductGroupResponse);
|
|
@@ -752,6 +753,36 @@ message BulkLookupProductsResponse {
|
|
|
752
753
|
repeated ProductLookupResult results = 1;
|
|
753
754
|
}
|
|
754
755
|
|
|
756
|
+
// ─── Bulk lookup variants by ID (for cart price snapshot) ────────────────────
|
|
757
|
+
//
|
|
758
|
+
// Використовується cart-service для отримання актуальної ціни саме за варіантом
|
|
759
|
+
// (variant.price якщо has_own_price, інакше product.price). Повертає достатньо
|
|
760
|
+
// для побудови line snapshot: ціна/стара ціна/назва/sku/stock/main_image.
|
|
761
|
+
|
|
762
|
+
message VariantLookupResult {
|
|
763
|
+
string variant_id = 1;
|
|
764
|
+
string product_id = 2;
|
|
765
|
+
string sku = 3;
|
|
766
|
+
bool found = 4;
|
|
767
|
+
// Резолвлена з урахуванням variant override.
|
|
768
|
+
double price = 5;
|
|
769
|
+
optional double old_price = 6;
|
|
770
|
+
int32 stock = 7;
|
|
771
|
+
bool has_own_price = 8;
|
|
772
|
+
// Локалізована назва (uk → ru → перше) для зручності клієнта.
|
|
773
|
+
string name_uk = 9;
|
|
774
|
+
string main_image = 10;
|
|
775
|
+
optional string color_id = 11;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
message BulkLookupVariantsRequest {
|
|
779
|
+
repeated string variant_ids = 1;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
message BulkLookupVariantsResponse {
|
|
783
|
+
repeated VariantLookupResult results = 1;
|
|
784
|
+
}
|
|
785
|
+
|
|
755
786
|
|
|
756
787
|
// ─── Product colors ──────────────────────────────────────────────────────────
|
|
757
788
|
|
|
@@ -19,6 +19,7 @@ export declare const PROTO_PATHS: {
|
|
|
19
19
|
readonly CALCULATION: string;
|
|
20
20
|
readonly COUPON: string;
|
|
21
21
|
readonly PROMOTION: string;
|
|
22
|
+
readonly BONUS_SETTINGS: string;
|
|
22
23
|
readonly COMMON_POST: string;
|
|
23
24
|
readonly POST: string;
|
|
24
25
|
readonly POST_CATEGORY: string;
|
|
@@ -33,4 +34,5 @@ export declare const PROTO_PATHS: {
|
|
|
33
34
|
readonly ORDER: string;
|
|
34
35
|
readonly PAYMENT: string;
|
|
35
36
|
readonly DELIVERY: string;
|
|
37
|
+
readonly DELIVERY_SETTINGS: string;
|
|
36
38
|
};
|
package/dist/src/proto/paths.js
CHANGED
|
@@ -23,6 +23,7 @@ exports.PROTO_PATHS = {
|
|
|
23
23
|
CALCULATION: (0, node_path_1.join)(__dirname, '../../proto/calculation.proto'),
|
|
24
24
|
COUPON: (0, node_path_1.join)(__dirname, '../../proto/coupon.proto'),
|
|
25
25
|
PROMOTION: (0, node_path_1.join)(__dirname, '../../proto/promotion.proto'),
|
|
26
|
+
BONUS_SETTINGS: (0, node_path_1.join)(__dirname, '../../proto/bonus_settings.proto'),
|
|
26
27
|
COMMON_POST: (0, node_path_1.join)(__dirname, '../../proto/common_post.proto'),
|
|
27
28
|
POST: (0, node_path_1.join)(__dirname, '../../proto/post.proto'),
|
|
28
29
|
POST_CATEGORY: (0, node_path_1.join)(__dirname, '../../proto/post_category.proto'),
|
|
@@ -36,5 +37,6 @@ exports.PROTO_PATHS = {
|
|
|
36
37
|
CART: (0, node_path_1.join)(__dirname, '../../proto/cart.proto'),
|
|
37
38
|
ORDER: (0, node_path_1.join)(__dirname, '../../proto/order.proto'),
|
|
38
39
|
PAYMENT: (0, node_path_1.join)(__dirname, '../../proto/payment.proto'),
|
|
39
|
-
DELIVERY: (0, node_path_1.join)(__dirname, '../../proto/delivery.proto')
|
|
40
|
+
DELIVERY: (0, node_path_1.join)(__dirname, '../../proto/delivery.proto'),
|
|
41
|
+
DELIVERY_SETTINGS: (0, node_path_1.join)(__dirname, '../../proto/delivery_settings.proto')
|
|
40
42
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.4
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: bonus_settings.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "promo.v1";
|
|
12
|
+
|
|
13
|
+
export interface BonusSettingsResponse {
|
|
14
|
+
/** Курс нарахування бонусів від суми замовлення (0.02 = 2%). */
|
|
15
|
+
earnRate: number;
|
|
16
|
+
/** Курс списання бонусів (1 бонус = N грн, default 1.0). */
|
|
17
|
+
redeemRate: number;
|
|
18
|
+
/** Мінімальна сума замовлення для нарахування бонусів (0 = без обмеження). */
|
|
19
|
+
minOrderForEarn: number;
|
|
20
|
+
/**
|
|
21
|
+
* Максимальний відсоток від суми замовлення, який можна оплатити бонусами
|
|
22
|
+
* (1.0 = до 100%, 0.5 = до 50%; 0 — без обмеження).
|
|
23
|
+
*/
|
|
24
|
+
maxRedeemShare: number;
|
|
25
|
+
updatedAt: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface GetBonusSettingsRequest {
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface UpdateBonusSettingsRequest {
|
|
32
|
+
earnRate?: number | undefined;
|
|
33
|
+
redeemRate?: number | undefined;
|
|
34
|
+
minOrderForEarn?: number | undefined;
|
|
35
|
+
maxRedeemShare?: number | undefined;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const PROMO_V1_PACKAGE_NAME = "promo.v1";
|
|
39
|
+
|
|
40
|
+
export interface BonusSettingsServiceClient {
|
|
41
|
+
getBonusSettings(request: GetBonusSettingsRequest): Observable<BonusSettingsResponse>;
|
|
42
|
+
|
|
43
|
+
updateBonusSettings(request: UpdateBonusSettingsRequest): Observable<BonusSettingsResponse>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface BonusSettingsServiceController {
|
|
47
|
+
getBonusSettings(
|
|
48
|
+
request: GetBonusSettingsRequest,
|
|
49
|
+
): Promise<BonusSettingsResponse> | Observable<BonusSettingsResponse> | BonusSettingsResponse;
|
|
50
|
+
|
|
51
|
+
updateBonusSettings(
|
|
52
|
+
request: UpdateBonusSettingsRequest,
|
|
53
|
+
): Promise<BonusSettingsResponse> | Observable<BonusSettingsResponse> | BonusSettingsResponse;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function BonusSettingsServiceControllerMethods() {
|
|
57
|
+
return function (constructor: Function) {
|
|
58
|
+
const grpcMethods: string[] = ["getBonusSettings", "updateBonusSettings"];
|
|
59
|
+
for (const method of grpcMethods) {
|
|
60
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
61
|
+
GrpcMethod("BonusSettingsService", method)(constructor.prototype[method], method, descriptor);
|
|
62
|
+
}
|
|
63
|
+
const grpcStreamMethods: string[] = [];
|
|
64
|
+
for (const method of grpcStreamMethods) {
|
|
65
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
66
|
+
GrpcStreamMethod("BonusSettingsService", method)(constructor.prototype[method], method, descriptor);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const BONUS_SETTINGS_SERVICE_NAME = "BonusSettingsService";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.4
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: delivery_settings.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "delivery.v1";
|
|
12
|
+
|
|
13
|
+
export interface DeliverySettingsResponse {
|
|
14
|
+
/** Дефолтна вага позиції у кг — fallback коли catalog не повертає weight. */
|
|
15
|
+
defaultItemWeightKg: number;
|
|
16
|
+
/** Поріг безкоштовної доставки в грн (0 = вимкнено). */
|
|
17
|
+
freeShippingThreshold: number;
|
|
18
|
+
/** Дефолтна оголошена вартість на одиницю товару у грн (для страхування НП). */
|
|
19
|
+
defaultDeclaredValue: number;
|
|
20
|
+
/** Reference відправника у НП (вибране warehouse адміністратором у settings). */
|
|
21
|
+
npSenderWarehouseRef?: string | undefined;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface GetDeliverySettingsRequest {
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface UpdateDeliverySettingsRequest {
|
|
29
|
+
defaultItemWeightKg?: number | undefined;
|
|
30
|
+
freeShippingThreshold?: number | undefined;
|
|
31
|
+
defaultDeclaredValue?: number | undefined;
|
|
32
|
+
npSenderWarehouseRef?: string | undefined;
|
|
33
|
+
clearNpSenderWarehouseRef: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const DELIVERY_V1_PACKAGE_NAME = "delivery.v1";
|
|
37
|
+
|
|
38
|
+
export interface DeliverySettingsServiceClient {
|
|
39
|
+
getDeliverySettings(request: GetDeliverySettingsRequest): Observable<DeliverySettingsResponse>;
|
|
40
|
+
|
|
41
|
+
updateDeliverySettings(request: UpdateDeliverySettingsRequest): Observable<DeliverySettingsResponse>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface DeliverySettingsServiceController {
|
|
45
|
+
getDeliverySettings(
|
|
46
|
+
request: GetDeliverySettingsRequest,
|
|
47
|
+
): Promise<DeliverySettingsResponse> | Observable<DeliverySettingsResponse> | DeliverySettingsResponse;
|
|
48
|
+
|
|
49
|
+
updateDeliverySettings(
|
|
50
|
+
request: UpdateDeliverySettingsRequest,
|
|
51
|
+
): Promise<DeliverySettingsResponse> | Observable<DeliverySettingsResponse> | DeliverySettingsResponse;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function DeliverySettingsServiceControllerMethods() {
|
|
55
|
+
return function (constructor: Function) {
|
|
56
|
+
const grpcMethods: string[] = ["getDeliverySettings", "updateDeliverySettings"];
|
|
57
|
+
for (const method of grpcMethods) {
|
|
58
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
59
|
+
GrpcMethod("DeliverySettingsService", method)(constructor.prototype[method], method, descriptor);
|
|
60
|
+
}
|
|
61
|
+
const grpcStreamMethods: string[] = [];
|
|
62
|
+
for (const method of grpcStreamMethods) {
|
|
63
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
64
|
+
GrpcStreamMethod("DeliverySettingsService", method)(constructor.prototype[method], method, descriptor);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const DELIVERY_SETTINGS_SERVICE_NAME = "DeliverySettingsService";
|
package/gen/product.ts
CHANGED
|
@@ -889,6 +889,30 @@ export interface BulkLookupProductsResponse {
|
|
|
889
889
|
results: ProductLookupResult[];
|
|
890
890
|
}
|
|
891
891
|
|
|
892
|
+
export interface VariantLookupResult {
|
|
893
|
+
variantId: string;
|
|
894
|
+
productId: string;
|
|
895
|
+
sku: string;
|
|
896
|
+
found: boolean;
|
|
897
|
+
/** Резолвлена з урахуванням variant override. */
|
|
898
|
+
price: number;
|
|
899
|
+
oldPrice?: number | undefined;
|
|
900
|
+
stock: number;
|
|
901
|
+
hasOwnPrice: boolean;
|
|
902
|
+
/** Локалізована назва (uk → ru → перше) для зручності клієнта. */
|
|
903
|
+
nameUk: string;
|
|
904
|
+
mainImage: string;
|
|
905
|
+
colorId?: string | undefined;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
export interface BulkLookupVariantsRequest {
|
|
909
|
+
variantIds: string[];
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
export interface BulkLookupVariantsResponse {
|
|
913
|
+
results: VariantLookupResult[];
|
|
914
|
+
}
|
|
915
|
+
|
|
892
916
|
export interface ProductColorImagePayload {
|
|
893
917
|
url: string;
|
|
894
918
|
mediaId: string;
|
|
@@ -1054,6 +1078,8 @@ export interface ProductServiceClient {
|
|
|
1054
1078
|
|
|
1055
1079
|
bulkLookupProducts(request: BulkLookupProductsRequest): Observable<BulkLookupProductsResponse>;
|
|
1056
1080
|
|
|
1081
|
+
bulkLookupVariants(request: BulkLookupVariantsRequest): Observable<BulkLookupVariantsResponse>;
|
|
1082
|
+
|
|
1057
1083
|
createProductGroup(request: CreateProductGroupRequest): Observable<ProductGroupResponse>;
|
|
1058
1084
|
|
|
1059
1085
|
updateProductGroup(request: UpdateProductGroupRequest): Observable<ProductGroupResponse>;
|
|
@@ -1192,6 +1218,10 @@ export interface ProductServiceController {
|
|
|
1192
1218
|
request: BulkLookupProductsRequest,
|
|
1193
1219
|
): Promise<BulkLookupProductsResponse> | Observable<BulkLookupProductsResponse> | BulkLookupProductsResponse;
|
|
1194
1220
|
|
|
1221
|
+
bulkLookupVariants(
|
|
1222
|
+
request: BulkLookupVariantsRequest,
|
|
1223
|
+
): Promise<BulkLookupVariantsResponse> | Observable<BulkLookupVariantsResponse> | BulkLookupVariantsResponse;
|
|
1224
|
+
|
|
1195
1225
|
createProductGroup(
|
|
1196
1226
|
request: CreateProductGroupRequest,
|
|
1197
1227
|
): Promise<ProductGroupResponse> | Observable<ProductGroupResponse> | ProductGroupResponse;
|
|
@@ -1295,6 +1325,7 @@ export function ProductServiceControllerMethods() {
|
|
|
1295
1325
|
"bulkUpdateSortOrder",
|
|
1296
1326
|
"bulkSetPopular",
|
|
1297
1327
|
"bulkLookupProducts",
|
|
1328
|
+
"bulkLookupVariants",
|
|
1298
1329
|
"createProductGroup",
|
|
1299
1330
|
"updateProductGroup",
|
|
1300
1331
|
"deleteProductGroup",
|
package/package.json
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package promo.v1;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
service BonusSettingsService {
|
|
7
|
+
rpc GetBonusSettings (GetBonusSettingsRequest) returns (BonusSettingsResponse);
|
|
8
|
+
rpc UpdateBonusSettings (UpdateBonusSettingsRequest) returns (BonusSettingsResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
message BonusSettingsResponse {
|
|
13
|
+
// Курс нарахування бонусів від суми замовлення (0.02 = 2%).
|
|
14
|
+
double earn_rate = 1;
|
|
15
|
+
// Курс списання бонусів (1 бонус = N грн, default 1.0).
|
|
16
|
+
double redeem_rate = 2;
|
|
17
|
+
// Мінімальна сума замовлення для нарахування бонусів (0 = без обмеження).
|
|
18
|
+
double min_order_for_earn = 3;
|
|
19
|
+
// Максимальний відсоток від суми замовлення, який можна оплатити бонусами
|
|
20
|
+
// (1.0 = до 100%, 0.5 = до 50%; 0 — без обмеження).
|
|
21
|
+
double max_redeem_share = 4;
|
|
22
|
+
|
|
23
|
+
string updated_at = 5;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
message GetBonusSettingsRequest {}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
message UpdateBonusSettingsRequest {
|
|
31
|
+
optional double earn_rate = 1;
|
|
32
|
+
optional double redeem_rate = 2;
|
|
33
|
+
optional double min_order_for_earn = 3;
|
|
34
|
+
optional double max_redeem_share = 4;
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package delivery.v1;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
service DeliverySettingsService {
|
|
7
|
+
rpc GetDeliverySettings (GetDeliverySettingsRequest) returns (DeliverySettingsResponse);
|
|
8
|
+
rpc UpdateDeliverySettings (UpdateDeliverySettingsRequest) returns (DeliverySettingsResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
message DeliverySettingsResponse {
|
|
13
|
+
// Дефолтна вага позиції у кг — fallback коли catalog не повертає weight.
|
|
14
|
+
double default_item_weight_kg = 1;
|
|
15
|
+
// Поріг безкоштовної доставки в грн (0 = вимкнено).
|
|
16
|
+
double free_shipping_threshold = 2;
|
|
17
|
+
// Дефолтна оголошена вартість на одиницю товару у грн (для страхування НП).
|
|
18
|
+
double default_declared_value = 3;
|
|
19
|
+
// Reference відправника у НП (вибране warehouse адміністратором у settings).
|
|
20
|
+
optional string np_sender_warehouse_ref = 4;
|
|
21
|
+
|
|
22
|
+
string updated_at = 5;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
message GetDeliverySettingsRequest {}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
message UpdateDeliverySettingsRequest {
|
|
30
|
+
optional double default_item_weight_kg = 1;
|
|
31
|
+
optional double free_shipping_threshold = 2;
|
|
32
|
+
optional double default_declared_value = 3;
|
|
33
|
+
optional string np_sender_warehouse_ref = 4;
|
|
34
|
+
bool clear_np_sender_warehouse_ref = 5;
|
|
35
|
+
}
|
package/proto/product.proto
CHANGED
|
@@ -52,6 +52,7 @@ service ProductService {
|
|
|
52
52
|
rpc BulkSetPopular (BulkSetPopularRequest) returns (SuccessResponse);
|
|
53
53
|
|
|
54
54
|
rpc BulkLookupProducts (BulkLookupProductsRequest) returns (BulkLookupProductsResponse);
|
|
55
|
+
rpc BulkLookupVariants (BulkLookupVariantsRequest) returns (BulkLookupVariantsResponse);
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
rpc CreateProductGroup (CreateProductGroupRequest) returns (ProductGroupResponse);
|
|
@@ -752,6 +753,36 @@ message BulkLookupProductsResponse {
|
|
|
752
753
|
repeated ProductLookupResult results = 1;
|
|
753
754
|
}
|
|
754
755
|
|
|
756
|
+
// ─── Bulk lookup variants by ID (for cart price snapshot) ────────────────────
|
|
757
|
+
//
|
|
758
|
+
// Використовується cart-service для отримання актуальної ціни саме за варіантом
|
|
759
|
+
// (variant.price якщо has_own_price, інакше product.price). Повертає достатньо
|
|
760
|
+
// для побудови line snapshot: ціна/стара ціна/назва/sku/stock/main_image.
|
|
761
|
+
|
|
762
|
+
message VariantLookupResult {
|
|
763
|
+
string variant_id = 1;
|
|
764
|
+
string product_id = 2;
|
|
765
|
+
string sku = 3;
|
|
766
|
+
bool found = 4;
|
|
767
|
+
// Резолвлена з урахуванням variant override.
|
|
768
|
+
double price = 5;
|
|
769
|
+
optional double old_price = 6;
|
|
770
|
+
int32 stock = 7;
|
|
771
|
+
bool has_own_price = 8;
|
|
772
|
+
// Локалізована назва (uk → ru → перше) для зручності клієнта.
|
|
773
|
+
string name_uk = 9;
|
|
774
|
+
string main_image = 10;
|
|
775
|
+
optional string color_id = 11;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
message BulkLookupVariantsRequest {
|
|
779
|
+
repeated string variant_ids = 1;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
message BulkLookupVariantsResponse {
|
|
783
|
+
repeated VariantLookupResult results = 1;
|
|
784
|
+
}
|
|
785
|
+
|
|
755
786
|
|
|
756
787
|
// ─── Product colors ──────────────────────────────────────────────────────────
|
|
757
788
|
|