@be-link/flow-cli-nodejs 0.0.34 → 0.0.36
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/flow/modules/bizFlowCore/postTourSupplierApproval.d.ts +4 -0
- package/flow/modules/bizFlowCore/postTourSupplierApproval.js +26 -0
- package/flow/modules/bizFlowCore/service.d.ts +9 -0
- package/flow/modules/bizFlowCore/service.js +10 -0
- package/flow/modules/bizFlowCore/types.d.ts +32 -0
- package/flow/modules/bizFlowJob/service.d.ts +1 -0
- package/flow/modules/bizFlowJob/service.js +3 -0
- package/flow/modules/bizFlowJob/types.d.ts +9 -0
- package/package.json +11 -11
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
exports.postTourSupplierApproval = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
9
|
+
// No shared retry interceptor, HTTP redirect, or propagation of Axios errors containing credentials.
|
|
10
|
+
async function postTourSupplierApproval(url, changeId, merchantToken) {
|
|
11
|
+
const inside = process.env.authorizationTokenInside;
|
|
12
|
+
if (!url.startsWith('https://') || !inside?.trim() || !merchantToken || /\s/.test(merchantToken) ||
|
|
13
|
+
!changeId || changeId.trim() !== changeId || changeId.length > 32)
|
|
14
|
+
throw Error('改期同意请求无效');
|
|
15
|
+
try {
|
|
16
|
+
const { data } = await axios_1.default.post(url, { changeId }, { maxRedirects: 0, proxy: false, headers: {
|
|
17
|
+
'X-Request-Id': (0, uuid_1.v4)(), 'x-belink-accessType': 'authorizationTokenInside',
|
|
18
|
+
'x-belink-authorization': inside, Authorization: `Bearer ${merchantToken}`,
|
|
19
|
+
} });
|
|
20
|
+
if (data?.success === true && data.data?.changeId === changeId && data.data.decision === 'approved')
|
|
21
|
+
return { changeId, decision: 'approved' };
|
|
22
|
+
}
|
|
23
|
+
catch { /* Do not return the transport configuration or the response body. */ }
|
|
24
|
+
throw Error('未取得供应商同意回执');
|
|
25
|
+
}
|
|
26
|
+
exports.postTourSupplierApproval = postTourSupplierApproval;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { Service } from './types';
|
|
2
2
|
import BaseService from '../service';
|
|
3
3
|
declare class FlowCoreService extends BaseService implements Service.FlowCoreController {
|
|
4
|
+
approveTourSupplierDecision({ changeId }: {
|
|
5
|
+
changeId: string;
|
|
6
|
+
}, merchantToken: string): Promise<{
|
|
7
|
+
changeId: string;
|
|
8
|
+
decision: "approved";
|
|
9
|
+
}>;
|
|
10
|
+
getTourSupplierDecision({ changeId }: {
|
|
11
|
+
changeId: string;
|
|
12
|
+
}): Promise<Service.Response.TourSupplierDecision>;
|
|
4
13
|
findByReverseOrderId(param: Service.Request.FindByReverseOrderIdReq): Promise<Service.Entity.ChangeFlowEntity[]>;
|
|
5
14
|
queryOrderNumBySupplierIds(param: Service.Request.QueryFlowOrderIdsBySupplierIdsReq): Promise<Service.Response.IQueryOrderNumBySupplierIdsRsp[]>;
|
|
6
15
|
queryFlowOrderIdsBySupplierIds(param: Service.Request.QueryFlowOrderIdsBySupplierIdsReq): Promise<Service.Response.IQueryFlowOrderIdsBySupplierIdsRsp[]>;
|
|
@@ -4,12 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const http_1 = require("../../http");
|
|
7
|
+
const postTourSupplierApproval_1 = require("./postTourSupplierApproval");
|
|
7
8
|
const service_1 = __importDefault(require("../service"));
|
|
9
|
+
const env_1 = __importDefault(require("../../../utils/env"));
|
|
8
10
|
class FlowCoreService extends service_1.default {
|
|
9
11
|
constructor() {
|
|
10
12
|
super(...arguments);
|
|
11
13
|
this.prefixUrl = '/core';
|
|
12
14
|
}
|
|
15
|
+
approveTourSupplierDecision({ changeId }, merchantToken) {
|
|
16
|
+
// The existing NAT endpoint is plain HTTP; never send a merchant credential there.
|
|
17
|
+
const host = env_1.default.isProduction() ? this.publicProdHost : this.publicDevHost;
|
|
18
|
+
return (0, postTourSupplierApproval_1.postTourSupplierApproval)(`${host}${this.prefixUrl}/approve-tour-supplier-decision`, changeId, merchantToken);
|
|
19
|
+
}
|
|
20
|
+
getTourSupplierDecision({ changeId }) {
|
|
21
|
+
return (0, http_1.callApi)(this.getApiUrl(this.getTourSupplierDecision), { changeId });
|
|
22
|
+
}
|
|
13
23
|
findByReverseOrderId(param) {
|
|
14
24
|
return (0, http_1.callApi)(this.getApiUrl(this.findByReverseOrderId), param);
|
|
15
25
|
}
|
|
@@ -105,7 +105,28 @@ export declare namespace Service {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
namespace Response {
|
|
108
|
+
interface TourSupplierDecision {
|
|
109
|
+
changeId: string;
|
|
110
|
+
orderId: string;
|
|
111
|
+
supplierId: string;
|
|
112
|
+
decision: 'approved';
|
|
113
|
+
operatorId: string;
|
|
114
|
+
operator: string;
|
|
115
|
+
reasonType: string;
|
|
116
|
+
reasonDesc: string;
|
|
117
|
+
attachment: string[];
|
|
118
|
+
binding: {
|
|
119
|
+
mode: 'agePricing';
|
|
120
|
+
orderId: string;
|
|
121
|
+
originalSkuId: string;
|
|
122
|
+
originalDepartureDate: number;
|
|
123
|
+
expectedFeeRevision: number;
|
|
124
|
+
targetSkuId: string;
|
|
125
|
+
targetDepartureDate: number;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
108
128
|
interface IListChangeFlowRecordByOrderIdRsp {
|
|
129
|
+
tourAgeApprovalRequired?: true;
|
|
109
130
|
sponsorName: string;
|
|
110
131
|
createdAt: number;
|
|
111
132
|
type: string;
|
|
@@ -157,6 +178,17 @@ export declare namespace Service {
|
|
|
157
178
|
}
|
|
158
179
|
}
|
|
159
180
|
interface FlowCoreController {
|
|
181
|
+
/** Records consent, not a completed reschedule. Credential is sent in a header only. */
|
|
182
|
+
approveTourSupplierDecision(req: {
|
|
183
|
+
changeId: string;
|
|
184
|
+
}, merchantToken: string): Promise<{
|
|
185
|
+
changeId: string;
|
|
186
|
+
decision: 'approved';
|
|
187
|
+
}>;
|
|
188
|
+
/** Read a verified persisted approval; a missing or inconsistent decision rejects. */
|
|
189
|
+
getTourSupplierDecision(req: {
|
|
190
|
+
changeId: string;
|
|
191
|
+
}): Promise<Service.Response.TourSupplierDecision>;
|
|
160
192
|
queryOrderNumBySupplierIds(req: Service.Request.QueryFlowOrderIdsBySupplierIdsReq): Promise<Service.Response.IQueryOrderNumBySupplierIdsRsp[]>;
|
|
161
193
|
queryFlowOrderIdsBySupplierIds(req: Service.Request.QueryFlowOrderIdsBySupplierIdsReq): Promise<Service.Response.IQueryFlowOrderIdsBySupplierIdsRsp[]>;
|
|
162
194
|
queryFlowPageOrderIdsBySupplierId(param: Service.Request.QueryFlowPageOrderIdsBySupplierIdReq): Promise<Service.Response.IQueryFlowOrderIdsBySupplierIdsRsp>;
|
|
@@ -3,6 +3,7 @@ import { Service } from './types';
|
|
|
3
3
|
declare class BizFlowJobService extends BaseService implements Service.BizFlowJobController {
|
|
4
4
|
protected prefixUrl: string;
|
|
5
5
|
jobNotifySupplier(): Promise<void>;
|
|
6
|
+
jobNotifyPendingChangeT1(request: Service.Request.JobNotifyPendingChangeT1): Promise<Record<string, number>>;
|
|
6
7
|
jobHotelNotifySupplier(): Promise<void>;
|
|
7
8
|
jobCancelPendingForClosedOrders(): Promise<void>;
|
|
8
9
|
jobProcessDomainEventOutbox(): Promise<{
|
|
@@ -13,6 +13,9 @@ class BizFlowJobService extends service_1.default {
|
|
|
13
13
|
jobNotifySupplier() {
|
|
14
14
|
return (0, http_1.callApi)(this.getApiUrl(this.jobNotifySupplier));
|
|
15
15
|
}
|
|
16
|
+
jobNotifyPendingChangeT1(request) {
|
|
17
|
+
return (0, http_1.callApi)(this.getApiUrl(this.jobNotifyPendingChangeT1), request);
|
|
18
|
+
}
|
|
16
19
|
jobHotelNotifySupplier() {
|
|
17
20
|
return (0, http_1.callApi)(this.getApiUrl(this.jobHotelNotifySupplier));
|
|
18
21
|
}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
export declare namespace Service {
|
|
2
|
+
namespace Request {
|
|
3
|
+
interface JobNotifyPendingChangeT1 {
|
|
4
|
+
now?: number;
|
|
5
|
+
bizTypes: Array<'TOUR' | 'PARTY_HOTEL'>;
|
|
6
|
+
dryRun?: boolean;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
2
9
|
interface BizFlowJobController {
|
|
3
10
|
/** 每天通知供应商处理变更 */
|
|
4
11
|
jobNotifySupplier(): Promise<void>;
|
|
12
|
+
/** 出行前一天仍未审核变更,通知客满 */
|
|
13
|
+
jobNotifyPendingChangeT1(request: Request.JobNotifyPendingChangeT1): Promise<Record<string, number>>;
|
|
5
14
|
jobHotelNotifySupplier(): Promise<void>;
|
|
6
15
|
jobCancelPendingForClosedOrders(): Promise<void>;
|
|
7
16
|
jobProcessDomainEventOutbox(): Promise<{
|
package/package.json
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@be-link/flow-cli-nodejs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"description": "流服务Nodejs客户端",
|
|
5
5
|
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "rm -rf ./dist && tsc && cp package.json README.md ./dist/",
|
|
8
|
+
"test": "npx jest",
|
|
9
|
+
"gen-doc": "npx typedoc --options typedoc.json",
|
|
10
|
+
"update:major": "standard-version --release-as major",
|
|
11
|
+
"update:minor": "standard-version --release-as minor",
|
|
12
|
+
"update:patch": "standard-version --release-as patch",
|
|
13
|
+
"update:beta": "standard-version --prerelease beta"
|
|
14
|
+
},
|
|
6
15
|
"repository": {
|
|
7
16
|
"type": "git",
|
|
8
17
|
"url": "git+https://github.com/snowmountain-top/flow-cli-nodejs.git"
|
|
@@ -39,14 +48,5 @@
|
|
|
39
48
|
"axios-retry": "4.0.0",
|
|
40
49
|
"uuid": "9.0.1",
|
|
41
50
|
"vitality-meta": "1.0.240"
|
|
42
|
-
},
|
|
43
|
-
"scripts": {
|
|
44
|
-
"build": "rm -rf ./dist && tsc && cp package.json README.md ./dist/",
|
|
45
|
-
"test": "npx jest",
|
|
46
|
-
"gen-doc": "npx typedoc --options typedoc.json",
|
|
47
|
-
"update:major": "standard-version --release-as major",
|
|
48
|
-
"update:minor": "standard-version --release-as minor",
|
|
49
|
-
"update:patch": "standard-version --release-as patch",
|
|
50
|
-
"update:beta": "standard-version --prerelease beta"
|
|
51
51
|
}
|
|
52
|
-
}
|
|
52
|
+
}
|