@chevre/domain 22.14.0-alpha.13 → 22.14.0-alpha.15
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/example/src/chevre/findReservationByCode.ts +0 -1
- package/lib/chevre/repo/accountingReport.d.ts +4 -4
- package/lib/chevre/repo/accountingReport.js +1 -1
- package/lib/chevre/repo/action.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +2 -15
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +0 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -1
- package/lib/chevre/service/reserve/useReservation.js +2 -3
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +0 -2
- package/lib/chevre/service/task/checkResource.d.ts +2 -2
- package/lib/chevre/service/task/checkResource.js +8 -6
- package/lib/chevre/service/task/createAccountingReport.d.ts +2 -2
- package/lib/chevre/service/task/createAccountingReport.js +15 -15
- package/lib/chevre/service/task/useReservation.js +1 -2
- package/lib/chevre/service/taskHandler.js +2 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +0 -1
- package/package.json +2 -2
|
@@ -22,7 +22,6 @@ async function main() {
|
|
|
22
22
|
|
|
23
23
|
await (await chevre.service.reserve.createService()).verifyToken4reservation({
|
|
24
24
|
project: { id: project.id },
|
|
25
|
-
agent: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
26
25
|
reservationId: RESERVATION_ID,
|
|
27
26
|
ticket: {
|
|
28
27
|
ticketToken: CODE
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Connection, PipelineStage } from 'mongoose';
|
|
2
|
-
import { IAccountingReport, IChildReport, IOrder4report } from './mongoose/schemas/accountingReport';
|
|
3
2
|
import * as factory from '../factory';
|
|
3
|
+
import { IDocType } from './mongoose/schemas/accountingReport';
|
|
4
4
|
type IMatchStage = PipelineStage.Match;
|
|
5
|
-
export { IAccountingReport, IChildReport, IOrder4report };
|
|
6
5
|
/**
|
|
7
6
|
* 経理レポートリポジトリ
|
|
8
7
|
*/
|
|
@@ -14,7 +13,7 @@ export declare class AccountingReportRepo {
|
|
|
14
13
|
id?: string;
|
|
15
14
|
};
|
|
16
15
|
}): IMatchStage[];
|
|
17
|
-
syncMainEntity(params:
|
|
16
|
+
syncMainEntity(params: IDocType): Promise<void>;
|
|
18
17
|
/**
|
|
19
18
|
* 注文番号で削除する
|
|
20
19
|
*/
|
|
@@ -34,7 +33,7 @@ export declare class AccountingReportRepo {
|
|
|
34
33
|
mainEntity: {
|
|
35
34
|
orderNumber: string;
|
|
36
35
|
};
|
|
37
|
-
hasPart: IChildReport;
|
|
36
|
+
hasPart: factory.report.accountingReport.IChildReport;
|
|
38
37
|
}): Promise<void>;
|
|
39
38
|
search(params: factory.report.accountingReport.ISearchConditions & {
|
|
40
39
|
seller?: {
|
|
@@ -46,3 +45,4 @@ export declare class AccountingReportRepo {
|
|
|
46
45
|
$unset: any;
|
|
47
46
|
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
48
47
|
}
|
|
48
|
+
export {};
|
|
@@ -10,9 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.AccountingReportRepo = void 0;
|
|
13
|
-
const accountingReport_1 = require("./mongoose/schemas/accountingReport");
|
|
14
13
|
const errorHandler_1 = require("../errorHandler");
|
|
15
14
|
const factory = require("../factory");
|
|
15
|
+
const accountingReport_1 = require("./mongoose/schemas/accountingReport");
|
|
16
16
|
const DEFAULT_SEARCH_LIMIT = 100;
|
|
17
17
|
/**
|
|
18
18
|
* 経理レポートリポジトリ
|
|
@@ -2,7 +2,7 @@ import { factory as surfrockFactory } from '@surfrock/sdk';
|
|
|
2
2
|
import { Connection, FilterQuery, UpdateQuery } from 'mongoose';
|
|
3
3
|
import * as factory from '../factory';
|
|
4
4
|
export type IAction4transaction<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction> = T extends factory.actionType.AcceptAction ? factory.action.accept.coaOffer.IAction | factory.action.accept.pay.IAction : T extends factory.actionType.AuthorizeAction ? (factory.action.authorize.offer.eventService.IAction | factory.action.authorize.offer.moneyTransfer.IAction | factory.action.authorize.offer.product.IAction | factory.action.authorize.paymentMethod.any.IAction) : never;
|
|
5
|
-
export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.
|
|
5
|
+
export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.thing.IAction) : T extends factory.actionType.CreateAction ? factory.action.create.IAction : T extends factory.actionType.MoneyTransfer ? factory.action.transfer.moneyTransfer.IAction : T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction<factory.action.interact.inform.IAttributes<factory.action.interact.inform.IObject>> & {
|
|
6
6
|
error?: any;
|
|
7
7
|
purpose?: never;
|
|
8
8
|
} : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
|
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
|
-
|
|
4
|
-
export interface IChildReport {
|
|
5
|
-
typeOf: 'Report';
|
|
6
|
-
mainEntity: factory.report.accountingReport.IAction;
|
|
7
|
-
}
|
|
8
|
-
export interface IAccountingReport {
|
|
9
|
-
project: {
|
|
10
|
-
id: string;
|
|
11
|
-
typeOf: factory.organizationType.Project;
|
|
12
|
-
};
|
|
13
|
-
typeOf: 'Report';
|
|
14
|
-
hasPart: IChildReport[];
|
|
15
|
-
mainEntity: IOrder4report;
|
|
16
|
-
}
|
|
3
|
+
type IAccountingReport = factory.report.accountingReport.IReportDocument;
|
|
17
4
|
type IDocType = IAccountingReport;
|
|
18
5
|
type IModel = Model<IDocType>;
|
|
19
6
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
@@ -21,4 +8,4 @@ type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocT
|
|
|
21
8
|
declare const modelName = "AccountingReport";
|
|
22
9
|
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
23
10
|
declare function createSchema(): ISchema;
|
|
24
|
-
export { createSchema, IModel, indexes, modelName };
|
|
11
|
+
export { createSchema, IDocType, IModel, indexes, modelName };
|
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.createAccountingReportIfNotExist = createAccountingReportIfNotExist;
|
|
13
13
|
const moment = require("moment-timezone");
|
|
14
14
|
const factory = require("../../factory");
|
|
15
|
-
// import { createMaskedCustomer } from '../../factory/order';
|
|
16
15
|
function createAccountingReportIfNotExist(params) {
|
|
17
16
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
18
17
|
const order4report = createOrder4report(params);
|
|
@@ -116,8 +116,8 @@ function createCreateAccountingReportTask(order) {
|
|
|
116
116
|
numberOfTried: 0,
|
|
117
117
|
executionResults: [],
|
|
118
118
|
data: {
|
|
119
|
-
object: { mainEntity: { orderNumber: order.orderNumber } }
|
|
120
|
-
project: { id: order.project.id }
|
|
119
|
+
object: { mainEntity: { orderNumber: order.orderNumber } }
|
|
120
|
+
// project: { id: order.project.id }
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
return [task];
|
|
@@ -127,7 +127,7 @@ function createCheckResourceTask(order) {
|
|
|
127
127
|
orderNumber: order.orderNumber,
|
|
128
128
|
typeOf: order.typeOf
|
|
129
129
|
},
|
|
130
|
-
project: order.project,
|
|
130
|
+
// project: order.project,
|
|
131
131
|
typeOf: factory.actionType.CheckAction
|
|
132
132
|
};
|
|
133
133
|
const taskIdentifier = util.format('%s:%s:%s:%s', order.project.id, factory.taskName.CheckResource, order.typeOf, order.orderNumber);
|
|
@@ -28,8 +28,7 @@ function useReservation(params) {
|
|
|
28
28
|
// const ticketToken = params?.instrument?.ticketToken;
|
|
29
29
|
if (Array.isArray(params.instrument)) {
|
|
30
30
|
for (const eachInstrument of params.instrument) {
|
|
31
|
-
if (eachInstrument.typeOf ===
|
|
32
|
-
&& typeof eachInstrument.ticketToken === 'string') {
|
|
31
|
+
if (eachInstrument.typeOf === 'Ticket' && typeof eachInstrument.ticketToken === 'string') {
|
|
33
32
|
ticketToken = eachInstrument.ticketToken;
|
|
34
33
|
break;
|
|
35
34
|
}
|
|
@@ -62,7 +61,7 @@ function useReservation(params) {
|
|
|
62
61
|
};
|
|
63
62
|
// extend instrument to array(2025-02-18~)
|
|
64
63
|
const instrument = [
|
|
65
|
-
Object.assign(Object.assign({}, (typeof ticketToken === 'string') ? { ticketToken } : undefined), { typeOf:
|
|
64
|
+
Object.assign(Object.assign({}, (typeof ticketToken === 'string') ? { ticketToken } : undefined), { typeOf: 'Ticket' }),
|
|
66
65
|
// support orderAsInstrument(2025-02-18~)
|
|
67
66
|
...(Array.isArray(params.instrument))
|
|
68
67
|
? params.instrument.filter(({ typeOf }) => typeOf === factory.order.OrderType.Order)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as factory from '../../factory';
|
|
2
1
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
3
2
|
import type { OrderRepo } from '../../repo/order';
|
|
4
3
|
import type { TicketRepo } from '../../repo/ticket';
|
|
@@ -12,7 +11,6 @@ export declare function verifyToken4reservation(params: {
|
|
|
12
11
|
seller?: {
|
|
13
12
|
id?: string;
|
|
14
13
|
};
|
|
15
|
-
agent: factory.action.check.token.IAgent;
|
|
16
14
|
reservationId: string;
|
|
17
15
|
ticket: {
|
|
18
16
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
2
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.checkResource.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -24,17 +24,19 @@ const validateOrder_1 = require("../validation/validateOrder");
|
|
|
24
24
|
/**
|
|
25
25
|
* タスク実行関数
|
|
26
26
|
*/
|
|
27
|
-
function call(
|
|
27
|
+
function call(params) {
|
|
28
28
|
return (_a) => __awaiter(this, [_a], void 0, function* ({ connection, redisClient }) {
|
|
29
29
|
if (redisClient === undefined) {
|
|
30
30
|
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
31
31
|
}
|
|
32
32
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
33
|
+
const { data } = params;
|
|
33
34
|
const actionAttributes = {
|
|
34
|
-
agent: { id:
|
|
35
|
+
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
35
36
|
object: data.object,
|
|
36
|
-
project: { id:
|
|
37
|
-
typeOf: factory.actionType.CheckAction
|
|
37
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
38
|
+
typeOf: factory.actionType.CheckAction,
|
|
39
|
+
sameAs: { id: params.id, typeOf: 'Task' } // add sameAs(2025-09-22~)
|
|
38
40
|
};
|
|
39
41
|
const action = yield actionRepo.start(actionAttributes);
|
|
40
42
|
const objectTypeOf = data.object.typeOf;
|
|
@@ -43,7 +45,7 @@ function call(data) {
|
|
|
43
45
|
case factory.order.OrderType.Order:
|
|
44
46
|
yield (0, validateOrder_1.validateOrder)({
|
|
45
47
|
orderNumber: data.object.orderNumber,
|
|
46
|
-
project: { id:
|
|
48
|
+
project: { id: params.project.id }
|
|
47
49
|
})({
|
|
48
50
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
49
51
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
@@ -56,7 +58,7 @@ function call(data) {
|
|
|
56
58
|
case factory.eventType.ScreeningEvent:
|
|
57
59
|
yield (0, validateEvent_1.validateEvent)({
|
|
58
60
|
id: data.object.id,
|
|
59
|
-
project: { id:
|
|
61
|
+
project: { id: params.project.id }
|
|
60
62
|
})({
|
|
61
63
|
event: new event_1.EventRepo(connection),
|
|
62
64
|
stockHolder: new stockHolder_1.StockHolderRepo({ connection })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
1
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.ITask<factory.taskName.CreateAccountingReport>, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -19,9 +19,9 @@ const createAccountingReportIfNotExist_1 = require("../order/createAccountingRep
|
|
|
19
19
|
/**
|
|
20
20
|
* タスク実行関数
|
|
21
21
|
*/
|
|
22
|
-
function call(
|
|
22
|
+
function call(params) {
|
|
23
23
|
return (_a) => __awaiter(this, [_a], void 0, function* ({ connection }) {
|
|
24
|
-
yield createAccountingReport(
|
|
24
|
+
yield createAccountingReport(params)({
|
|
25
25
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
26
26
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
27
27
|
action: new action_1.ActionRepo(connection),
|
|
@@ -31,8 +31,9 @@ function call(data) {
|
|
|
31
31
|
}
|
|
32
32
|
function createAccountingReport(params) {
|
|
33
33
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const { data } = params;
|
|
34
35
|
const order = yield repos.order.projectFieldsByOrderNumber({
|
|
35
|
-
orderNumber:
|
|
36
|
+
orderNumber: data.object.mainEntity.orderNumber,
|
|
36
37
|
project: { id: params.project.id },
|
|
37
38
|
inclusion: [
|
|
38
39
|
'orderNumber', 'project', 'customer', 'confirmationNumber',
|
|
@@ -41,28 +42,26 @@ function createAccountingReport(params) {
|
|
|
41
42
|
});
|
|
42
43
|
const simpleOrder = {
|
|
43
44
|
typeOf: order.typeOf,
|
|
44
|
-
// seller: {
|
|
45
|
-
// id: order.seller.id,
|
|
46
|
-
// typeOf: order.seller.typeOf,
|
|
47
|
-
// name: order.seller.name
|
|
48
|
-
// }, // 廃止(2024-03-06~)
|
|
49
|
-
// customer: { typeOf: order.customer.typeOf, id: order.customer.id }, // 廃止(2024-03-06~)
|
|
50
45
|
orderNumber: order.orderNumber,
|
|
51
|
-
// price: order.price,
|
|
52
|
-
// priceCurrency: order.priceCurrency,
|
|
53
46
|
orderDate: order.orderDate
|
|
54
47
|
};
|
|
48
|
+
const actionObject = {
|
|
49
|
+
// ...params,
|
|
50
|
+
mainEntity: { orderNumber: simpleOrder.orderNumber },
|
|
51
|
+
typeOf: 'Report'
|
|
52
|
+
};
|
|
55
53
|
const actionAttributes = {
|
|
56
54
|
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
57
55
|
typeOf: factory.actionType.CreateAction,
|
|
58
56
|
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
59
|
-
object:
|
|
60
|
-
purpose: simpleOrder
|
|
57
|
+
object: actionObject,
|
|
58
|
+
purpose: simpleOrder,
|
|
59
|
+
sameAs: { id: params.id, typeOf: 'Task' } // add sameAs(2025-09-21~)
|
|
61
60
|
};
|
|
62
61
|
const action = yield repos.action.start(actionAttributes);
|
|
63
62
|
try {
|
|
64
63
|
const acceptedOffers = yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
65
|
-
orderNumber: { $eq:
|
|
64
|
+
orderNumber: { $eq: data.object.mainEntity.orderNumber },
|
|
66
65
|
project: { id: { $eq: params.project.id } }
|
|
67
66
|
});
|
|
68
67
|
yield (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)(Object.assign(Object.assign({}, order), { acceptedOffers }))(repos);
|
|
@@ -76,6 +75,7 @@ function createAccountingReport(params) {
|
|
|
76
75
|
}
|
|
77
76
|
throw error;
|
|
78
77
|
}
|
|
79
|
-
|
|
78
|
+
const result = {};
|
|
79
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = call;
|
|
13
|
-
const factory = require("../../factory");
|
|
14
13
|
const action_1 = require("../../repo/action");
|
|
15
14
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
15
|
const authorization_1 = require("../../repo/authorization");
|
|
@@ -31,7 +30,7 @@ function call(data) {
|
|
|
31
30
|
instrument = data.instrument;
|
|
32
31
|
}
|
|
33
32
|
else {
|
|
34
|
-
if (((_b = data.instrument) === null || _b === void 0 ? void 0 : _b.typeOf) ===
|
|
33
|
+
if (((_b = data.instrument) === null || _b === void 0 ? void 0 : _b.typeOf) === 'Ticket') {
|
|
35
34
|
instrument = [data.instrument];
|
|
36
35
|
}
|
|
37
36
|
}
|
|
@@ -50,6 +50,8 @@ function executeTask(task, next) {
|
|
|
50
50
|
case factory.taskName.AuthorizePayment:
|
|
51
51
|
case factory.taskName.CancelPendingReservation:
|
|
52
52
|
case factory.taskName.CheckMovieTicket:
|
|
53
|
+
case factory.taskName.CheckResource:
|
|
54
|
+
case factory.taskName.CreateAccountingReport:
|
|
53
55
|
case factory.taskName.DeletePerson:
|
|
54
56
|
case factory.taskName.HandleNotification:
|
|
55
57
|
case factory.taskName.ImportEventCapacitiesFromCOA:
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "4.399.0-alpha.
|
|
14
|
+
"@chevre/factory": "4.399.0-alpha.16",
|
|
15
15
|
"@cinerino/sdk": "12.2.0",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "22.14.0-alpha.
|
|
118
|
+
"version": "22.14.0-alpha.15"
|
|
119
119
|
}
|