@be-link/pos-cli-nodejs 1.0.219 → 1.0.220
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/errors/BizError.d.ts +3 -2
- package/errors/BizError.js +3 -2
- package/index.d.ts +2 -1
- package/index.js +5 -3
- package/package.json +1 -1
- package/pos/http.js +4 -1
- package/pos/http.test.d.ts +1 -0
- package/pos/http.test.js +71 -0
- package/pos/modules/orderRoomShare/service.d.ts +21 -0
- package/pos/modules/orderRoomShare/service.js +57 -0
- package/pos/modules/orderRoomShare/service.test.d.ts +1 -0
- package/pos/modules/orderRoomShare/service.test.js +101 -0
- package/pos/modules/orderRoomShare/types.d.ts +140 -0
- package/pos/modules/orderRoomShare/types.js +2 -0
- package/pos/modules/tongcheng/service.d.ts +1 -0
- package/pos/modules/tongcheng/service.js +3 -0
- package/pos/modules/tongcheng/types.d.ts +15 -0
package/errors/BizError.d.ts
CHANGED
package/errors/BizError.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
class BizError extends Error {
|
|
4
|
-
constructor(message,
|
|
4
|
+
constructor(message, statusCode = 400, businessCode) {
|
|
5
5
|
super(message);
|
|
6
|
-
this.code =
|
|
6
|
+
this.code = businessCode || statusCode;
|
|
7
|
+
this.statusCode = statusCode;
|
|
7
8
|
this.name = 'BizError';
|
|
8
9
|
}
|
|
9
10
|
}
|
package/index.d.ts
CHANGED
|
@@ -19,10 +19,11 @@ import { SkuInfoProxy } from './utils/posProxy/skuInfoProxy';
|
|
|
19
19
|
import { VenueInfoProxy } from './utils/posProxy/venueInfoProxy';
|
|
20
20
|
import orderTouristMaterialService from './pos/modules/orderTourMaterial/service';
|
|
21
21
|
import orderAbnormalFollowService from './pos/modules/orderAbnormalFollow/service';
|
|
22
|
+
import orderRoomShareService from './pos/modules/orderRoomShare/service';
|
|
22
23
|
import tongchengService from './pos/modules/tongcheng/service';
|
|
23
24
|
export {
|
|
24
25
|
/** 业务模块 */
|
|
25
|
-
orderCoreService, orderFulfillService, queryByCommodityService, queryByStoreService, queryByUserService, queryByWebService, queryBySupplierService, queryByPandoraService, orderNoteService, orderJobService, dataMigrateService, orderTouristMaterialService, orderAbnormalFollowService, tongchengService,
|
|
26
|
+
orderCoreService, orderFulfillService, queryByCommodityService, queryByStoreService, queryByUserService, queryByWebService, queryBySupplierService, queryByPandoraService, orderNoteService, orderJobService, dataMigrateService, orderTouristMaterialService, orderAbnormalFollowService, orderRoomShareService, tongchengService,
|
|
26
27
|
/** 枚举类 */
|
|
27
28
|
PosConstants, PosDto,
|
|
28
29
|
/** 错误类 */
|
package/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.VenueInfoProxy = exports.ComboInfoProxy = exports.SkuInfoProxy = exports.ItemInfoProxy = exports.PosProxyFactory = exports.BizError = exports.PosDto = exports.PosConstants = exports.tongchengService = exports.orderAbnormalFollowService = exports.orderTouristMaterialService = exports.dataMigrateService = exports.orderJobService = exports.orderNoteService = exports.queryByPandoraService = exports.queryBySupplierService = exports.queryByWebService = exports.queryByUserService = exports.queryByStoreService = exports.queryByCommodityService = exports.orderFulfillService = exports.orderCoreService = void 0;
|
|
29
|
+
exports.VenueInfoProxy = exports.ComboInfoProxy = exports.SkuInfoProxy = exports.ItemInfoProxy = exports.PosProxyFactory = exports.BizError = exports.PosDto = exports.PosConstants = exports.tongchengService = exports.orderRoomShareService = exports.orderAbnormalFollowService = exports.orderTouristMaterialService = exports.dataMigrateService = exports.orderJobService = exports.orderNoteService = exports.queryByPandoraService = exports.queryBySupplierService = exports.queryByWebService = exports.queryByUserService = exports.queryByStoreService = exports.queryByCommodityService = exports.orderFulfillService = exports.orderCoreService = void 0;
|
|
30
30
|
const PosConstants = __importStar(require("vitality-meta/enums/pos"));
|
|
31
31
|
exports.PosConstants = PosConstants;
|
|
32
32
|
const PosDto = __importStar(require("./types"));
|
|
@@ -69,5 +69,7 @@ const service_6 = __importDefault(require("./pos/modules/orderTourMaterial/servi
|
|
|
69
69
|
exports.orderTouristMaterialService = service_6.default;
|
|
70
70
|
const service_7 = __importDefault(require("./pos/modules/orderAbnormalFollow/service"));
|
|
71
71
|
exports.orderAbnormalFollowService = service_7.default;
|
|
72
|
-
const service_8 = __importDefault(require("./pos/modules/
|
|
73
|
-
exports.
|
|
72
|
+
const service_8 = __importDefault(require("./pos/modules/orderRoomShare/service"));
|
|
73
|
+
exports.orderRoomShareService = service_8.default;
|
|
74
|
+
const service_9 = __importDefault(require("./pos/modules/tongcheng/service"));
|
|
75
|
+
exports.tongchengService = service_9.default;
|
package/package.json
CHANGED
package/pos/http.js
CHANGED
|
@@ -62,7 +62,10 @@ function callApi(url, ...request) {
|
|
|
62
62
|
const data = response.data;
|
|
63
63
|
console.error(`POS 异常[${requestId}]: ${axiosError.message}`);
|
|
64
64
|
console.error('异常堆栈', JSON.stringify(error.stack));
|
|
65
|
-
|
|
65
|
+
if (ErrorClass === BizError_1.default) {
|
|
66
|
+
throw new BizError_1.default(data.message || 'Pos Error', response.status, data.code);
|
|
67
|
+
}
|
|
68
|
+
throw new SystemError_1.default(data.message || 'Pos Error', response.status);
|
|
66
69
|
}
|
|
67
70
|
console.error(`POS 未知异常[${requestId}]: ${axiosError.message}`, error.stack);
|
|
68
71
|
throw error;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/pos/http.test.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const mockPost = jest.fn();
|
|
16
|
+
jest.mock('axios', () => ({
|
|
17
|
+
__esModule: true,
|
|
18
|
+
default: {
|
|
19
|
+
create: jest.fn(() => ({ post: mockPost })),
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
jest.mock('axios-retry', () => ({ __esModule: true, default: jest.fn() }));
|
|
23
|
+
jest.mock('uuid', () => ({ v4: jest.fn(() => 'request-id') }));
|
|
24
|
+
const BizError_1 = __importDefault(require("../errors/BizError"));
|
|
25
|
+
const SystemError_1 = __importDefault(require("../errors/SystemError"));
|
|
26
|
+
const http_1 = require("./http");
|
|
27
|
+
describe('callApi error envelope', () => {
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
mockPost.mockReset();
|
|
30
|
+
jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
31
|
+
});
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
jest.restoreAllMocks();
|
|
34
|
+
});
|
|
35
|
+
it('HTTP 400 透传稳定业务 code,同时保留 statusCode', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
mockPost.mockRejectedValue({
|
|
37
|
+
message: 'Request failed',
|
|
38
|
+
stack: 'stack',
|
|
39
|
+
response: {
|
|
40
|
+
status: 400,
|
|
41
|
+
data: { data: null, message: '拼房功能未开启', code: 'ROOM_SHARE_DISABLED' },
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
const error = yield (0, http_1.callApi)('https://pos.test/room-share/save', {}).catch((caught) => caught);
|
|
45
|
+
expect(error).toBeInstanceOf(BizError_1.default);
|
|
46
|
+
expect(error).toMatchObject({ code: 'ROOM_SHARE_DISABLED', statusCode: 400 });
|
|
47
|
+
}));
|
|
48
|
+
it('旧 400 envelope 无业务 code 时保持数字 code=400', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
+
mockPost.mockRejectedValue({
|
|
50
|
+
message: 'Request failed',
|
|
51
|
+
stack: 'stack',
|
|
52
|
+
response: { status: 400, data: { data: null, message: 'legacy error' } },
|
|
53
|
+
});
|
|
54
|
+
const error = yield (0, http_1.callApi)('https://pos.test/core/legacy', {}).catch((caught) => caught);
|
|
55
|
+
expect(error).toBeInstanceOf(BizError_1.default);
|
|
56
|
+
expect(error).toMatchObject({ code: 400, statusCode: 400 });
|
|
57
|
+
}));
|
|
58
|
+
it('非 400 响应仍返回 SystemError 和原 HTTP code', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
mockPost.mockRejectedValue({
|
|
60
|
+
message: 'Request failed',
|
|
61
|
+
stack: 'stack',
|
|
62
|
+
response: {
|
|
63
|
+
status: 503,
|
|
64
|
+
data: { data: null, message: 'unavailable', code: 'IGNORED_CODE' },
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
const error = yield (0, http_1.callApi)('https://pos.test/core/query', {}).catch((caught) => caught);
|
|
68
|
+
expect(error).toBeInstanceOf(SystemError_1.default);
|
|
69
|
+
expect(error).toMatchObject({ code: 503 });
|
|
70
|
+
}));
|
|
71
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import BaseService from '../service';
|
|
2
|
+
import { Service } from './types';
|
|
3
|
+
declare class OrderRoomShareService extends BaseService implements Service.OrderRoomShareController {
|
|
4
|
+
protected prefixUrl: string;
|
|
5
|
+
queryFeatureState(request: Service.Request.queryFeatureState): Promise<Service.Response.queryFeatureState>;
|
|
6
|
+
query(request: Service.Request.query): Promise<Service.Response.query>;
|
|
7
|
+
batchQuery(request: Service.Request.batchQuery): Promise<Service.Response.batchQuery>;
|
|
8
|
+
save(request: Service.Request.save): Promise<Service.Response.save>;
|
|
9
|
+
queryT1Candidates(request?: Service.Request.queryT1Candidates): Promise<Service.Response.queryT1Candidates>;
|
|
10
|
+
queryT2Candidates(request?: Service.Request.queryT2Candidates): Promise<Service.Response.queryT2Candidates>;
|
|
11
|
+
getPendingFollowSnapshotMaxId(request?: Service.Request.getPendingFollowSnapshotMaxId): Promise<Service.Response.getPendingFollowSnapshotMaxId>;
|
|
12
|
+
getLifecycleFollowSnapshotMaxId(request?: Service.Request.getLifecycleFollowSnapshotMaxId): Promise<Service.Response.getLifecycleFollowSnapshotMaxId>;
|
|
13
|
+
pagePendingFollowsRaw(request: Service.Request.pageFollowsRaw): Promise<Service.Response.pageFollowsRaw>;
|
|
14
|
+
pageLifecycleFollowsRaw(request: Service.Request.pageFollowsRaw): Promise<Service.Response.pageFollowsRaw>;
|
|
15
|
+
batchQueryLifecycleEligibility(request: Service.Request.batchQueryLifecycleEligibility): Promise<Service.Response.batchQueryLifecycleEligibility>;
|
|
16
|
+
reconcile(request: Service.Request.reconcile): Promise<Service.Response.reconcile>;
|
|
17
|
+
cleanup(request: Service.Request.cleanup): Promise<Service.Response.cleanup>;
|
|
18
|
+
markReminded(request: Service.Request.markReminded): Promise<Service.Response.markReminded>;
|
|
19
|
+
}
|
|
20
|
+
declare const orderRoomShareService: OrderRoomShareService;
|
|
21
|
+
export default orderRoomShareService;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const service_1 = __importDefault(require("../service"));
|
|
7
|
+
const http_1 = require("../../http");
|
|
8
|
+
class OrderRoomShareService extends service_1.default {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.prefixUrl = '/room-share';
|
|
12
|
+
}
|
|
13
|
+
queryFeatureState(request) {
|
|
14
|
+
return (0, http_1.callApi)(this.getApiUrl(this.queryFeatureState), request);
|
|
15
|
+
}
|
|
16
|
+
query(request) {
|
|
17
|
+
return (0, http_1.callApi)(this.getApiUrl(this.query), request);
|
|
18
|
+
}
|
|
19
|
+
batchQuery(request) {
|
|
20
|
+
return (0, http_1.callApi)(this.getApiUrl(this.batchQuery), request);
|
|
21
|
+
}
|
|
22
|
+
save(request) {
|
|
23
|
+
return (0, http_1.callApi)(this.getApiUrl(this.save), request);
|
|
24
|
+
}
|
|
25
|
+
queryT1Candidates(request = {}) {
|
|
26
|
+
return (0, http_1.callApi)(this.getApiUrl(this.queryT1Candidates), request);
|
|
27
|
+
}
|
|
28
|
+
queryT2Candidates(request = {}) {
|
|
29
|
+
return (0, http_1.callApi)(this.getApiUrl(this.queryT2Candidates), request);
|
|
30
|
+
}
|
|
31
|
+
getPendingFollowSnapshotMaxId(request = {}) {
|
|
32
|
+
return (0, http_1.callApi)(this.getApiUrl(this.getPendingFollowSnapshotMaxId), request);
|
|
33
|
+
}
|
|
34
|
+
getLifecycleFollowSnapshotMaxId(request = {}) {
|
|
35
|
+
return (0, http_1.callApi)(this.getApiUrl(this.getLifecycleFollowSnapshotMaxId), request);
|
|
36
|
+
}
|
|
37
|
+
pagePendingFollowsRaw(request) {
|
|
38
|
+
return (0, http_1.callApi)(this.getApiUrl(this.pagePendingFollowsRaw), request);
|
|
39
|
+
}
|
|
40
|
+
pageLifecycleFollowsRaw(request) {
|
|
41
|
+
return (0, http_1.callApi)(this.getApiUrl(this.pageLifecycleFollowsRaw), request);
|
|
42
|
+
}
|
|
43
|
+
batchQueryLifecycleEligibility(request) {
|
|
44
|
+
return (0, http_1.callApi)(this.getApiUrl(this.batchQueryLifecycleEligibility), request);
|
|
45
|
+
}
|
|
46
|
+
reconcile(request) {
|
|
47
|
+
return (0, http_1.callApi)(this.getApiUrl(this.reconcile), request);
|
|
48
|
+
}
|
|
49
|
+
cleanup(request) {
|
|
50
|
+
return (0, http_1.callApi)(this.getApiUrl(this.cleanup), request);
|
|
51
|
+
}
|
|
52
|
+
markReminded(request) {
|
|
53
|
+
return (0, http_1.callApi)(this.getApiUrl(this.markReminded), request);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const orderRoomShareService = new OrderRoomShareService();
|
|
57
|
+
exports.default = orderRoomShareService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
jest.mock('../../http', () => ({
|
|
16
|
+
callApi: jest.fn(),
|
|
17
|
+
}));
|
|
18
|
+
const http_1 = require("../../http");
|
|
19
|
+
const service_1 = __importDefault(require("./service"));
|
|
20
|
+
const mockedCallApi = http_1.callApi;
|
|
21
|
+
describe('OrderRoomShareService', () => {
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
mockedCallApi.mockReset();
|
|
24
|
+
mockedCallApi.mockResolvedValue(undefined);
|
|
25
|
+
});
|
|
26
|
+
it.each([
|
|
27
|
+
['queryFeatureState', {}, 'query-feature-state'],
|
|
28
|
+
['query', { orderId: 'order-1' }, 'query'],
|
|
29
|
+
['batchQuery', { orderIds: ['order-1'] }, 'batch-query'],
|
|
30
|
+
[
|
|
31
|
+
'save',
|
|
32
|
+
{
|
|
33
|
+
orderId: 'order-1',
|
|
34
|
+
roomShareRequired: true,
|
|
35
|
+
remark: '需要双床',
|
|
36
|
+
operatorUnionId: 'operator-1',
|
|
37
|
+
},
|
|
38
|
+
'save',
|
|
39
|
+
],
|
|
40
|
+
['queryT1Candidates', {}, 'query-t1-candidates'],
|
|
41
|
+
['queryT2Candidates', {}, 'query-t2-candidates'],
|
|
42
|
+
['getPendingFollowSnapshotMaxId', {}, 'get-pending-follow-snapshot-max-id'],
|
|
43
|
+
['getLifecycleFollowSnapshotMaxId', {}, 'get-lifecycle-follow-snapshot-max-id'],
|
|
44
|
+
[
|
|
45
|
+
'pagePendingFollowsRaw',
|
|
46
|
+
{ snapshotMaxId: 'ffffffffffffffffffffffff', cursor: null, limit: 100 },
|
|
47
|
+
'page-pending-follows-raw',
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
'pageLifecycleFollowsRaw',
|
|
51
|
+
{
|
|
52
|
+
snapshotMaxId: 'ffffffffffffffffffffffff',
|
|
53
|
+
cursor: '00000000000000000000000f',
|
|
54
|
+
limit: 100,
|
|
55
|
+
},
|
|
56
|
+
'page-lifecycle-follows-raw',
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
'batchQueryLifecycleEligibility',
|
|
60
|
+
{ orderIds: ['order-1'] },
|
|
61
|
+
'batch-query-lifecycle-eligibility',
|
|
62
|
+
],
|
|
63
|
+
['reconcile', { orderId: 'order-1', expectedDeadline: 100 }, 'reconcile'],
|
|
64
|
+
['cleanup', { orderId: 'order-1', expectedDeadline: 100 }, 'cleanup'],
|
|
65
|
+
['markReminded', { orderId: 'order-1', expectedDeadline: 100 }, 'mark-reminded'],
|
|
66
|
+
])('%s 映射到 room-share kebab URL 并原样序列化请求', (method, request, path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
+
yield service_1.default[method](request);
|
|
68
|
+
expect(mockedCallApi).toHaveBeenCalledWith(expect.stringMatching(new RegExp(`/room-share/${path}$`)), request);
|
|
69
|
+
}));
|
|
70
|
+
it('默认空请求和 ObjectId 字符串 cursor 不发生数值转换', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
|
+
yield service_1.default.queryT1Candidates();
|
|
72
|
+
expect(mockedCallApi).toHaveBeenLastCalledWith(expect.any(String), {});
|
|
73
|
+
const cursor = '00000000000000000000000f';
|
|
74
|
+
yield service_1.default.pagePendingFollowsRaw({
|
|
75
|
+
snapshotMaxId: 'ffffffffffffffffffffffff',
|
|
76
|
+
cursor,
|
|
77
|
+
limit: 200,
|
|
78
|
+
});
|
|
79
|
+
expect(mockedCallApi.mock.calls[1][1]).toMatchObject({ cursor });
|
|
80
|
+
expect(typeof mockedCallApi.mock.calls[1][1].cursor).toBe('string');
|
|
81
|
+
}));
|
|
82
|
+
it('二态配置和 nullable cursor 响应不做三态包装', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
|
+
mockedCallApi
|
|
84
|
+
.mockResolvedValueOnce({ orderId: 'order-1', roomShareRequired: false, remark: '' })
|
|
85
|
+
.mockResolvedValueOnce({
|
|
86
|
+
snapshotMaxId: null,
|
|
87
|
+
nextCursor: null,
|
|
88
|
+
items: [],
|
|
89
|
+
});
|
|
90
|
+
yield expect(service_1.default.query({ orderId: 'order-1' })).resolves.toEqual({
|
|
91
|
+
orderId: 'order-1',
|
|
92
|
+
roomShareRequired: false,
|
|
93
|
+
remark: '',
|
|
94
|
+
});
|
|
95
|
+
yield expect(service_1.default.pageLifecycleFollowsRaw({
|
|
96
|
+
snapshotMaxId: 'ffffffffffffffffffffffff',
|
|
97
|
+
cursor: null,
|
|
98
|
+
limit: 10,
|
|
99
|
+
})).resolves.toEqual({ snapshotMaxId: null, nextCursor: null, items: [] });
|
|
100
|
+
}));
|
|
101
|
+
});
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
export type RoomShareFollowStatus = 'PENDING' | 'REMINDED';
|
|
2
|
+
export declare namespace Service {
|
|
3
|
+
namespace Request {
|
|
4
|
+
interface queryFeatureState {
|
|
5
|
+
fresh?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface query {
|
|
8
|
+
orderId: string;
|
|
9
|
+
}
|
|
10
|
+
interface batchQuery {
|
|
11
|
+
orderIds: string[];
|
|
12
|
+
}
|
|
13
|
+
interface save {
|
|
14
|
+
orderId: string;
|
|
15
|
+
roomShareRequired: boolean;
|
|
16
|
+
remark?: string;
|
|
17
|
+
operatorUnionId: string;
|
|
18
|
+
}
|
|
19
|
+
type queryT1Candidates = Record<string, never>;
|
|
20
|
+
type queryT2Candidates = Record<string, never>;
|
|
21
|
+
type getPendingFollowSnapshotMaxId = Record<string, never>;
|
|
22
|
+
type getLifecycleFollowSnapshotMaxId = Record<string, never>;
|
|
23
|
+
interface pageFollowsRaw {
|
|
24
|
+
snapshotMaxId: string;
|
|
25
|
+
cursor: string | null;
|
|
26
|
+
limit: number;
|
|
27
|
+
}
|
|
28
|
+
interface batchQueryLifecycleEligibility {
|
|
29
|
+
orderIds: string[];
|
|
30
|
+
}
|
|
31
|
+
interface reconcile {
|
|
32
|
+
orderId: string;
|
|
33
|
+
expectedDeadline: number;
|
|
34
|
+
}
|
|
35
|
+
interface cleanup {
|
|
36
|
+
orderId: string;
|
|
37
|
+
expectedDeadline: number;
|
|
38
|
+
}
|
|
39
|
+
interface markReminded {
|
|
40
|
+
orderId: string;
|
|
41
|
+
expectedDeadline: number;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
namespace Response {
|
|
45
|
+
interface queryFeatureState {
|
|
46
|
+
enabled: boolean;
|
|
47
|
+
checkedAt: number;
|
|
48
|
+
}
|
|
49
|
+
interface configuration {
|
|
50
|
+
orderId: string;
|
|
51
|
+
roomShareRequired: boolean;
|
|
52
|
+
remark: string;
|
|
53
|
+
}
|
|
54
|
+
type query = configuration;
|
|
55
|
+
type batchQuery = configuration[];
|
|
56
|
+
type save = configuration;
|
|
57
|
+
interface t1Candidate {
|
|
58
|
+
orderId: string;
|
|
59
|
+
expectedDeadline: number;
|
|
60
|
+
}
|
|
61
|
+
interface queryT1Candidates {
|
|
62
|
+
enabled: boolean;
|
|
63
|
+
candidates: t1Candidate[];
|
|
64
|
+
}
|
|
65
|
+
interface t2Candidate {
|
|
66
|
+
orderId: string;
|
|
67
|
+
itemId: string;
|
|
68
|
+
itemName: string;
|
|
69
|
+
fulfillAt: number;
|
|
70
|
+
routeType: string;
|
|
71
|
+
freeRefundDeadlineAt: number;
|
|
72
|
+
categoryTwo: string;
|
|
73
|
+
}
|
|
74
|
+
interface queryT2Candidates {
|
|
75
|
+
enabled: boolean;
|
|
76
|
+
candidates: t2Candidate[];
|
|
77
|
+
}
|
|
78
|
+
interface followSnapshot {
|
|
79
|
+
snapshotMaxId: string | null;
|
|
80
|
+
}
|
|
81
|
+
type getPendingFollowSnapshotMaxId = followSnapshot;
|
|
82
|
+
type getLifecycleFollowSnapshotMaxId = followSnapshot;
|
|
83
|
+
interface rawFollow {
|
|
84
|
+
id: string;
|
|
85
|
+
orderId: string;
|
|
86
|
+
status: RoomShareFollowStatus;
|
|
87
|
+
followUnionId: string;
|
|
88
|
+
remindedAt: number;
|
|
89
|
+
freeRefundDeadlineAt: number;
|
|
90
|
+
}
|
|
91
|
+
interface pageFollowsRaw {
|
|
92
|
+
snapshotMaxId: string | null;
|
|
93
|
+
nextCursor: string | null;
|
|
94
|
+
items: rawFollow[];
|
|
95
|
+
}
|
|
96
|
+
interface lifecycleEligibility {
|
|
97
|
+
orderId: string;
|
|
98
|
+
eligible: boolean;
|
|
99
|
+
expectedDeadline: number | null;
|
|
100
|
+
}
|
|
101
|
+
type batchQueryLifecycleEligibility = lifecycleEligibility[];
|
|
102
|
+
interface follow {
|
|
103
|
+
orderId: string;
|
|
104
|
+
status: RoomShareFollowStatus;
|
|
105
|
+
followUnionId: string;
|
|
106
|
+
remindedAt: number;
|
|
107
|
+
freeRefundDeadlineAt: number;
|
|
108
|
+
}
|
|
109
|
+
interface reconcile {
|
|
110
|
+
outcome: 'ACTIVE_PENDING' | 'PRESERVED_REMINDED' | 'INELIGIBLE' | 'STALE_DEADLINE';
|
|
111
|
+
shouldNotify: boolean;
|
|
112
|
+
follow: follow | null;
|
|
113
|
+
}
|
|
114
|
+
interface cleanup {
|
|
115
|
+
outcome: 'CLEANED' | 'NOOP_VALID_AGAIN' | 'NOOP_STALE_DEADLINE' | 'NOOP_MISSING';
|
|
116
|
+
affected: boolean;
|
|
117
|
+
}
|
|
118
|
+
interface markReminded {
|
|
119
|
+
outcome: 'MARKED' | 'NOOP_ALREADY_HANDLED' | 'NOOP_STALE_DEADLINE' | 'NOOP_INELIGIBLE';
|
|
120
|
+
marked: boolean;
|
|
121
|
+
remindedAt: number | null;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
interface OrderRoomShareController {
|
|
125
|
+
queryFeatureState(request: Request.queryFeatureState): Promise<Response.queryFeatureState>;
|
|
126
|
+
query(request: Request.query): Promise<Response.query>;
|
|
127
|
+
batchQuery(request: Request.batchQuery): Promise<Response.batchQuery>;
|
|
128
|
+
save(request: Request.save): Promise<Response.save>;
|
|
129
|
+
queryT1Candidates(request: Request.queryT1Candidates): Promise<Response.queryT1Candidates>;
|
|
130
|
+
queryT2Candidates(request: Request.queryT2Candidates): Promise<Response.queryT2Candidates>;
|
|
131
|
+
getPendingFollowSnapshotMaxId(request: Request.getPendingFollowSnapshotMaxId): Promise<Response.getPendingFollowSnapshotMaxId>;
|
|
132
|
+
getLifecycleFollowSnapshotMaxId(request: Request.getLifecycleFollowSnapshotMaxId): Promise<Response.getLifecycleFollowSnapshotMaxId>;
|
|
133
|
+
pagePendingFollowsRaw(request: Request.pageFollowsRaw): Promise<Response.pageFollowsRaw>;
|
|
134
|
+
pageLifecycleFollowsRaw(request: Request.pageFollowsRaw): Promise<Response.pageFollowsRaw>;
|
|
135
|
+
batchQueryLifecycleEligibility(request: Request.batchQueryLifecycleEligibility): Promise<Response.batchQueryLifecycleEligibility>;
|
|
136
|
+
reconcile(request: Request.reconcile): Promise<Response.reconcile>;
|
|
137
|
+
cleanup(request: Request.cleanup): Promise<Response.cleanup>;
|
|
138
|
+
markReminded(request: Request.markReminded): Promise<Response.markReminded>;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -6,6 +6,7 @@ declare class TongchengService extends BaseService implements Service.TongchengC
|
|
|
6
6
|
getBindingOrderDetail(request: Service.Request.GetBindingOrderDetail): Promise<Service.Response.GetBindingOrderDetail>;
|
|
7
7
|
getPositiveOrderRelation(request: Service.Request.GetPositiveOrderRelation): Promise<Service.Response.GetPositiveOrderRelation>;
|
|
8
8
|
confirmBindOrder(request: Service.Request.ConfirmBindOrder): Promise<Service.Response.ConfirmBindOrder>;
|
|
9
|
+
createBindingToken(request: Service.Request.CreateBindingToken): Promise<Service.Response.CreateBindingToken>;
|
|
9
10
|
}
|
|
10
11
|
declare const tongchengService: TongchengService;
|
|
11
12
|
export default tongchengService;
|
|
@@ -22,6 +22,9 @@ class TongchengService extends service_1.default {
|
|
|
22
22
|
confirmBindOrder(request) {
|
|
23
23
|
return (0, http_1.callApi)(this.getApiUrl(this.confirmBindOrder), request);
|
|
24
24
|
}
|
|
25
|
+
createBindingToken(request) {
|
|
26
|
+
return (0, http_1.callApi)(this.getApiUrl(this.createBindingToken), request);
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
29
|
const tongchengService = new TongchengService();
|
|
27
30
|
exports.default = tongchengService;
|
|
@@ -23,6 +23,9 @@ export declare namespace Service {
|
|
|
23
23
|
positiveOrderId: string;
|
|
24
24
|
boundAt: number;
|
|
25
25
|
};
|
|
26
|
+
type CreateBindingTokenResult = {
|
|
27
|
+
token: string;
|
|
28
|
+
};
|
|
26
29
|
namespace Request {
|
|
27
30
|
type SearchBindingOrders = {
|
|
28
31
|
guestName: string;
|
|
@@ -46,10 +49,18 @@ export declare namespace Service {
|
|
|
46
49
|
openId: string;
|
|
47
50
|
token: string;
|
|
48
51
|
};
|
|
52
|
+
type CreateBindingToken = {
|
|
53
|
+
tongchengOrderId: string;
|
|
54
|
+
positiveOrderId: string;
|
|
55
|
+
unionId: string;
|
|
56
|
+
fromUnionId: string;
|
|
57
|
+
fromUserRole: string;
|
|
58
|
+
};
|
|
49
59
|
type searchBindingOrders = SearchBindingOrders;
|
|
50
60
|
type getBindingOrderDetail = GetBindingOrderDetail;
|
|
51
61
|
type getPositiveOrderRelation = GetPositiveOrderRelation;
|
|
52
62
|
type confirmBindOrder = ConfirmBindOrder;
|
|
63
|
+
type createBindingToken = CreateBindingToken;
|
|
53
64
|
}
|
|
54
65
|
namespace Response {
|
|
55
66
|
interface TongchengRelationExtraInfo {
|
|
@@ -116,10 +127,12 @@ export declare namespace Service {
|
|
|
116
127
|
type GetBindingOrderDetail = BindingOrderDetail;
|
|
117
128
|
type GetPositiveOrderRelation = TongchengPositiveOrderRelation | null;
|
|
118
129
|
type ConfirmBindOrder = ConfirmBindOrderResult;
|
|
130
|
+
type CreateBindingToken = CreateBindingTokenResult;
|
|
119
131
|
type searchBindingOrders = SearchBindingOrders;
|
|
120
132
|
type getBindingOrderDetail = GetBindingOrderDetail;
|
|
121
133
|
type getPositiveOrderRelation = GetPositiveOrderRelation;
|
|
122
134
|
type confirmBindOrder = ConfirmBindOrder;
|
|
135
|
+
type createBindingToken = CreateBindingToken;
|
|
123
136
|
}
|
|
124
137
|
interface TongchengController {
|
|
125
138
|
/** @path /tongcheng/search-binding-orders */
|
|
@@ -134,5 +147,7 @@ export declare namespace Service {
|
|
|
134
147
|
getPositiveOrderRelation(request: Request.GetPositiveOrderRelation): Promise<Response.GetPositiveOrderRelation>;
|
|
135
148
|
/** @path /tongcheng/confirm-bind-order */
|
|
136
149
|
confirmBindOrder(request: Request.ConfirmBindOrder): Promise<Response.ConfirmBindOrder>;
|
|
150
|
+
/** @path /tongcheng/create-binding-token */
|
|
151
|
+
createBindingToken(request: Request.CreateBindingToken): Promise<Response.CreateBindingToken>;
|
|
137
152
|
}
|
|
138
153
|
}
|