@be-link/ecommerce-promotion-service-node-sdk 0.0.24 → 0.0.26
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/enum.d.ts +2 -2
- package/enum.js +2 -2
- package/modules/pricingCalculation/service.d.ts +1 -1
- package/modules/pricingCalculation/types.d.ts +11 -25
- package/package.json +1 -1
- package/utils/http.d.ts +3 -0
- package/utils/http.js +9 -1
package/enum.d.ts
CHANGED
|
@@ -129,8 +129,8 @@ export declare namespace ENUM {
|
|
|
129
129
|
}
|
|
130
130
|
/** 券状态中文 */
|
|
131
131
|
enum COUPON_STATUS_CHINESE {
|
|
132
|
-
AVAILABLE = "\
|
|
133
|
-
ABANDONED = "\u4F5C\u5E9F"
|
|
132
|
+
AVAILABLE = "\u751F\u6548\u4E2D",
|
|
133
|
+
ABANDONED = "\u5DF2\u4F5C\u5E9F"
|
|
134
134
|
}
|
|
135
135
|
/** 领取限制类型 */
|
|
136
136
|
enum RECEIVE_LIMIT_TYPE {
|
package/enum.js
CHANGED
|
@@ -150,8 +150,8 @@ var ENUM;
|
|
|
150
150
|
/** 券状态中文 */
|
|
151
151
|
let COUPON_STATUS_CHINESE;
|
|
152
152
|
(function (COUPON_STATUS_CHINESE) {
|
|
153
|
-
COUPON_STATUS_CHINESE["AVAILABLE"] = "\
|
|
154
|
-
COUPON_STATUS_CHINESE["ABANDONED"] = "\u4F5C\u5E9F";
|
|
153
|
+
COUPON_STATUS_CHINESE["AVAILABLE"] = "\u751F\u6548\u4E2D";
|
|
154
|
+
COUPON_STATUS_CHINESE["ABANDONED"] = "\u5DF2\u4F5C\u5E9F";
|
|
155
155
|
})(COUPON_STATUS_CHINESE = COUPON_ENUM.COUPON_STATUS_CHINESE || (COUPON_ENUM.COUPON_STATUS_CHINESE = {}));
|
|
156
156
|
/** 领取限制类型 */
|
|
157
157
|
let RECEIVE_LIMIT_TYPE;
|
|
@@ -3,7 +3,7 @@ import BaseService from '../BaseService';
|
|
|
3
3
|
declare class PricingCalculationService extends BaseService implements Service.PricingCalculationController {
|
|
4
4
|
protected prefixUrl: string;
|
|
5
5
|
calculateOrderPrice(request: Service.Request.calculateOrderPrice): Promise<Service.Response.calculateOrderPrice>;
|
|
6
|
-
calculateWithSelectedDiscounts(request: Service.Request.calculateWithSelectedDiscounts): Promise<Service.Response.
|
|
6
|
+
calculateWithSelectedDiscounts(request: Service.Request.calculateWithSelectedDiscounts): Promise<Service.Response.calculateOrderPrice>;
|
|
7
7
|
calculatePointsMallOrder(request: Service.Request.calculatePointsMallOrder): Promise<Service.Response.calculatePointsMallOrder>;
|
|
8
8
|
recalculatePointsMallOrder(request: Service.Request.recalculatePointsMallOrder): Promise<Service.Response.recalculatePointsMallOrder>;
|
|
9
9
|
}
|
|
@@ -121,28 +121,6 @@ export declare namespace Service {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
namespace Response {
|
|
124
|
-
/** 提单页算价响应 */
|
|
125
|
-
interface calculateOrderPrice {
|
|
126
|
-
/** 商品原价总计(分) */
|
|
127
|
-
originalAmount: number;
|
|
128
|
-
/** 总优惠金额(分) */
|
|
129
|
-
totalDiscountAmount: number;
|
|
130
|
-
/** 优惠后金额(分) */
|
|
131
|
-
discountedAmount: number;
|
|
132
|
-
/** 最高抵扣金额(分) */
|
|
133
|
-
pointsMaxDeductionAmount: number;
|
|
134
|
-
/** 剩余待支付金额(分) */
|
|
135
|
-
remainingAmount: number;
|
|
136
|
-
/** 最优优惠券组合 */
|
|
137
|
-
optimalCoupons: {
|
|
138
|
-
couponCode: string;
|
|
139
|
-
discountAmount: number;
|
|
140
|
-
}[];
|
|
141
|
-
/** 可用优惠券模版 */
|
|
142
|
-
availableCouponTemplates?: string[];
|
|
143
|
-
/** 积分抵扣规则 */
|
|
144
|
-
pointsDeductionRule?: Entity.PointsDeductionRule;
|
|
145
|
-
}
|
|
146
124
|
/** 优惠明细项 */
|
|
147
125
|
interface DiscountDetailItem {
|
|
148
126
|
/** 优惠类型(coupon-优惠券、points-积分) */
|
|
@@ -164,7 +142,7 @@ export declare namespace Service {
|
|
|
164
142
|
invalidCoupons?: string[];
|
|
165
143
|
}
|
|
166
144
|
/** 用户手动选择优惠后算价响应 */
|
|
167
|
-
interface
|
|
145
|
+
interface calculateOrderPrice {
|
|
168
146
|
/** 本单最多可用积分 */
|
|
169
147
|
maxUsablePoints: number;
|
|
170
148
|
/** 价格计算结果 */
|
|
@@ -180,7 +158,15 @@ export declare namespace Service {
|
|
|
180
158
|
/** 剩余待支付金额(分) */
|
|
181
159
|
remainingAmount: number;
|
|
182
160
|
};
|
|
183
|
-
|
|
161
|
+
/** 优惠券组合 */
|
|
162
|
+
selectedCoupons: {
|
|
163
|
+
couponCode: string;
|
|
164
|
+
discountAmount: number;
|
|
165
|
+
}[];
|
|
166
|
+
/** 可用优惠券模版 */
|
|
167
|
+
availableCouponTemplates: string[];
|
|
168
|
+
/** 校验结果 */
|
|
169
|
+
validation?: ValidateSelectedCouponResult;
|
|
184
170
|
}
|
|
185
171
|
/** 积分商城提单算价响应 */
|
|
186
172
|
interface calculatePointsMallOrder {
|
|
@@ -229,7 +215,7 @@ export declare namespace Service {
|
|
|
229
215
|
/** 提单页算价 */
|
|
230
216
|
calculateOrderPrice(request: Service.Request.calculateOrderPrice, req: any): Promise<Service.Response.calculateOrderPrice>;
|
|
231
217
|
/** 用户手动选择优惠后算价 */
|
|
232
|
-
calculateWithSelectedDiscounts(request: Service.Request.calculateWithSelectedDiscounts, req: any): Promise<Service.Response.
|
|
218
|
+
calculateWithSelectedDiscounts(request: Service.Request.calculateWithSelectedDiscounts, req: any): Promise<Service.Response.calculateOrderPrice>;
|
|
233
219
|
/** 积分商城提单算价 */
|
|
234
220
|
calculatePointsMallOrder(request: Service.Request.calculatePointsMallOrder, req: any): Promise<Service.Response.calculatePointsMallOrder>;
|
|
235
221
|
/** 积分商城用户选择后再次算价 */
|
package/package.json
CHANGED
package/utils/http.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ declare module '@fastify/request-context' {
|
|
|
2
2
|
interface RequestContextData {
|
|
3
3
|
requestId?: string;
|
|
4
4
|
traceMessageId?: string;
|
|
5
|
+
pandoraUserId?: string;
|
|
6
|
+
beLinkUserId?: string;
|
|
7
|
+
pandoraRoleId?: string;
|
|
5
8
|
}
|
|
6
9
|
}
|
|
7
10
|
export declare function callApi<T extends (...args: any[]) => Promise<any>>(url: string, request?: Parameters<T>[0]): Promise<Awaited<ReturnType<T>>>;
|
package/utils/http.js
CHANGED
|
@@ -56,10 +56,18 @@ const request_context_1 = require("@fastify/request-context");
|
|
|
56
56
|
});
|
|
57
57
|
async function callApi(url, request) {
|
|
58
58
|
const requestId = request_context_1.requestContext.get('requestId') || request_context_1.requestContext.get('traceMessageId') || (0, uuid_1.v4)();
|
|
59
|
+
const pandoraUserId = request_context_1.requestContext.get('pandoraUserId') || '';
|
|
60
|
+
const beLinkUserId = request_context_1.requestContext.get('beLinkUserId') || '';
|
|
61
|
+
const pandoraRoleId = request_context_1.requestContext.get('pandoraRoleId') || '';
|
|
59
62
|
try {
|
|
60
63
|
console.info(`准备发起ecommerce-promotion-service请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
|
|
61
64
|
const response = await axios_1.default.post(url, request || {}, {
|
|
62
|
-
headers: {
|
|
65
|
+
headers: {
|
|
66
|
+
'x-request-id': requestId,
|
|
67
|
+
'x-belink-pandora-userid': pandoraUserId,
|
|
68
|
+
'x-belink-userid': beLinkUserId,
|
|
69
|
+
'x-belink-pandora-roleid': pandoraRoleId,
|
|
70
|
+
},
|
|
63
71
|
});
|
|
64
72
|
const responseData = response.data;
|
|
65
73
|
return responseData.data;
|