@be-link/ecommerce-trade-service-node-sdk 0.0.67 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/consts.d.ts CHANGED
@@ -14,3 +14,4 @@ export declare const ReverseRefundWayMap: Record<ENUM.ReverseRefundWay, string>;
14
14
  export declare const PayChannelMap: Record<ENUM.PayChannel, string>;
15
15
  export declare const PayPlatformMap: Record<ENUM.PayPlatform, string>;
16
16
  export declare const PayWayMap: Record<ENUM.PayWay, string>;
17
+ export declare const TradeTopicName = "trade-topic";
package/consts.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PayWayMap = exports.PayPlatformMap = exports.PayChannelMap = exports.ReverseRefundWayMap = exports.ReverseRefundTypeMap = exports.ReverseArrivalStatusMap = exports.ReverseOrderStatusMap = exports.ReverseResourceTypeMap = exports.OrderVerificationStatusMap = exports.OrderRefundStatusMap = exports.OrderPayStatusMap = exports.OrderStatusMap = exports.OrderOsTypeMap = exports.OrderPlatformMap = exports.OrderSourceMap = void 0;
3
+ exports.TradeTopicName = exports.PayWayMap = exports.PayPlatformMap = exports.PayChannelMap = exports.ReverseRefundWayMap = exports.ReverseRefundTypeMap = exports.ReverseArrivalStatusMap = exports.ReverseOrderStatusMap = exports.ReverseResourceTypeMap = exports.OrderVerificationStatusMap = exports.OrderRefundStatusMap = exports.OrderPayStatusMap = exports.OrderStatusMap = exports.OrderOsTypeMap = exports.OrderPlatformMap = exports.OrderSourceMap = void 0;
4
4
  const enums_1 = require("./enums");
5
5
  exports.OrderSourceMap = {
6
6
  [enums_1.ENUM.OrderSource.LIVE]: '直播订单',
@@ -94,3 +94,5 @@ exports.PayWayMap = {
94
94
  [enums_1.ENUM.PayWay.POINTS]: '积分',
95
95
  [enums_1.ENUM.PayWay.VOUCHER]: '核销券',
96
96
  };
97
+ // 交易TOPIC
98
+ exports.TradeTopicName = 'trade-topic';
package/enums.d.ts CHANGED
@@ -204,3 +204,38 @@ export declare namespace ENUM {
204
204
  FULL_GIFT = "FULL_GIFT"
205
205
  }
206
206
  }
207
+ /** RabbitMQ 交换机路由枚举 */
208
+ export declare namespace EXCHANGE_ENUM {
209
+ /** 正向订单交换机路由 */
210
+ enum PosRoutingKeyEnum {
211
+ /** 待付款 */
212
+ WAIT_PAY = "trade.order.positive.wait_pay",
213
+ /** 支付成功 */
214
+ PAY_SUCCESS = "trade.order.positive.pay_success",
215
+ /** 待发货 */
216
+ WAIT_SHIP = "trade.order.positive.wait_ship",
217
+ /** 待收货 */
218
+ WAIT_RECEIVE = "trade.order.positive.wait_receive",
219
+ /** 已完成 */
220
+ COMPLETED = "trade.order.positive.completed",
221
+ /** 取消交易 */
222
+ CANCELED = "trade.order.positive.canceled",
223
+ /** 已关闭 */
224
+ CLOSED = "trade.order.positive.closed"
225
+ }
226
+ /** 逆向订单交换机路由 */
227
+ enum RosRoutingKeyEnum {
228
+ /** 待审核 */
229
+ PENDING = "trade.order.reverse.pending",
230
+ /** 审核通过 */
231
+ APPROVED = "trade.order.reverse.approved",
232
+ /** 审核拒绝 */
233
+ REJECTED = "trade.order.reverse.rejected",
234
+ /** 用户主动取消 */
235
+ CANCELED = "trade.order.reverse.canceled",
236
+ /** 已退款 */
237
+ REFUNDED = "trade.order.reverse.refunded",
238
+ /** 退款关闭 */
239
+ CLOSED = "trade.order.reverse.closed"
240
+ }
241
+ }
package/enums.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ENUM = void 0;
3
+ exports.EXCHANGE_ENUM = exports.ENUM = void 0;
4
4
  var ENUM;
5
5
  (function (ENUM) {
6
6
  /** 订单来源 */
@@ -227,3 +227,41 @@ var ENUM;
227
227
  ActivityType["FULL_GIFT"] = "FULL_GIFT";
228
228
  })(ActivityType = ENUM.ActivityType || (ENUM.ActivityType = {}));
229
229
  })(ENUM || (exports.ENUM = ENUM = {}));
230
+ /** RabbitMQ 交换机路由枚举 */
231
+ var EXCHANGE_ENUM;
232
+ (function (EXCHANGE_ENUM) {
233
+ /** 正向订单交换机路由 */
234
+ let PosRoutingKeyEnum;
235
+ (function (PosRoutingKeyEnum) {
236
+ /** 待付款 */
237
+ PosRoutingKeyEnum["WAIT_PAY"] = "trade.order.positive.wait_pay";
238
+ /** 支付成功 */
239
+ PosRoutingKeyEnum["PAY_SUCCESS"] = "trade.order.positive.pay_success";
240
+ /** 待发货 */
241
+ PosRoutingKeyEnum["WAIT_SHIP"] = "trade.order.positive.wait_ship";
242
+ /** 待收货 */
243
+ PosRoutingKeyEnum["WAIT_RECEIVE"] = "trade.order.positive.wait_receive";
244
+ /** 已完成 */
245
+ PosRoutingKeyEnum["COMPLETED"] = "trade.order.positive.completed";
246
+ /** 取消交易 */
247
+ PosRoutingKeyEnum["CANCELED"] = "trade.order.positive.canceled";
248
+ /** 已关闭 */
249
+ PosRoutingKeyEnum["CLOSED"] = "trade.order.positive.closed";
250
+ })(PosRoutingKeyEnum = EXCHANGE_ENUM.PosRoutingKeyEnum || (EXCHANGE_ENUM.PosRoutingKeyEnum = {}));
251
+ /** 逆向订单交换机路由 */
252
+ let RosRoutingKeyEnum;
253
+ (function (RosRoutingKeyEnum) {
254
+ /** 待审核 */
255
+ RosRoutingKeyEnum["PENDING"] = "trade.order.reverse.pending";
256
+ /** 审核通过 */
257
+ RosRoutingKeyEnum["APPROVED"] = "trade.order.reverse.approved";
258
+ /** 审核拒绝 */
259
+ RosRoutingKeyEnum["REJECTED"] = "trade.order.reverse.rejected";
260
+ /** 用户主动取消 */
261
+ RosRoutingKeyEnum["CANCELED"] = "trade.order.reverse.canceled";
262
+ /** 已退款 */
263
+ RosRoutingKeyEnum["REFUNDED"] = "trade.order.reverse.refunded";
264
+ /** 退款关闭 */
265
+ RosRoutingKeyEnum["CLOSED"] = "trade.order.reverse.closed";
266
+ })(RosRoutingKeyEnum = EXCHANGE_ENUM.RosRoutingKeyEnum || (EXCHANGE_ENUM.RosRoutingKeyEnum = {}));
267
+ })(EXCHANGE_ENUM || (exports.EXCHANGE_ENUM = EXCHANGE_ENUM = {}));
@@ -3,11 +3,16 @@
3
3
  * 所有服务类都应该继承此类
4
4
  */
5
5
  export default abstract class BaseService {
6
+ private isPublicEnv;
6
7
  /** URL一级路径 */
7
8
  protected abstract prefixUrl: string;
8
9
  /** 子网域名 */
9
- protected readonly natDevHost = "https://trade-service-api-196345-5-1304510571.sh.run.tcloudbase.com";
10
- protected readonly natProdHost = "";
10
+ protected readonly natDevHost = "http://trade:8090/trade";
11
+ protected readonly natProdHost = "http://trade:8090/trade";
12
+ /** 公网域名 */
13
+ protected readonly publicDevHost = "https://ecommerce-dev.wejourney.top/trade";
14
+ protected readonly publicProdHost = "";
15
+ constructor();
11
16
  /** 获取API URL */
12
17
  protected getApiUrl(func: Function): string;
13
18
  }
@@ -12,13 +12,23 @@ const string_1 = require("../utils/string");
12
12
  class BaseService {
13
13
  constructor() {
14
14
  /** 子网域名 */
15
- // protected readonly natDevHost = 'http://yayvmsbg.trade-service-api.07vmo6rk.by26x7u9.com:8090'
16
- this.natDevHost = 'https://trade-service-api-196345-5-1304510571.sh.run.tcloudbase.com';
17
- this.natProdHost = '';
15
+ this.natDevHost = 'http://trade:8090/trade';
16
+ this.natProdHost = 'http://trade:8090/trade';
17
+ /** 公网域名 */
18
+ this.publicDevHost = 'https://ecommerce-dev.wejourney.top/trade';
19
+ this.publicProdHost = '';
20
+ /** 如果是云函数环境, 默认走公网访问 */
21
+ this.isPublicEnv = (process.env.CONTAINER_ENV || 'SCF') === 'SCF';
18
22
  }
19
23
  /** 获取API URL */
20
24
  getApiUrl(func) {
21
- const host = env_1.default.isProduction() ? this.natProdHost : this.natDevHost;
25
+ const host = this.isPublicEnv
26
+ ? env_1.default.isProduction()
27
+ ? this.publicProdHost
28
+ : this.publicDevHost
29
+ : env_1.default.isProduction()
30
+ ? this.natProdHost
31
+ : this.natDevHost;
22
32
  return `${host}${this.prefixUrl}/${(0, string_1.camelToKebabCase)(func.name)}`;
23
33
  }
24
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@be-link/ecommerce-trade-service-node-sdk",
3
- "version": "0.0.67",
3
+ "version": "0.1.1",
4
4
  "description": "EcommerceTradeService Node.js SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,9 +13,7 @@
13
13
  "@fastify/request-context": "6.2.1",
14
14
  "axios": "1.13.2",
15
15
  "axios-retry": "4.0.0",
16
- "uuid": "9.0.1"
17
- },
18
- "devDependencies": {
16
+ "uuid": "9.0.1",
19
17
  "tsoa": "^6.6.0"
20
18
  },
21
19
  "scripts": {