@chevre/domain 21.2.0-alpha.4 → 21.2.0-alpha.41
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/aggregation/aggregateSystem.ts +58 -31
- package/example/src/chevre/countDelayedTasks.ts +17 -0
- package/example/src/chevre/countDelayedTransactions.ts +60 -0
- package/example/src/chevre/countMoneyTransferTransaction.ts +36 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +4 -1
- package/example/src/chevre/lockStockHolder.ts +48 -0
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
- package/example/src/chevre/migrateStockHolderKeys.ts +89 -0
- package/example/src/chevre/saveTasks.ts +13 -10
- package/example/src/chevre/searchAbortedTasks.ts +36 -0
- package/example/src/chevre/task/executeTasks.ts +26 -0
- package/example/src/chevre/transaction/findCreditCard.ts +1 -1
- package/example/src/chevre/transaction/makeExpired.ts +18 -0
- package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
- package/example/src/chevre/transaction/startExportTasks.ts +20 -0
- package/example/src/chevre/updateTransaction.ts +1 -1
- package/lib/chevre/credentials.d.ts +1 -0
- package/lib/chevre/credentials.js +2 -1
- package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
- package/lib/chevre/eventEmitter/task.d.ts +18 -0
- package/lib/chevre/eventEmitter/task.js +25 -0
- package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/transaction.js +25 -0
- package/lib/chevre/eventEmitter.d.ts +4 -0
- package/lib/chevre/eventEmitter.js +9 -0
- package/lib/chevre/index.d.ts +3 -2
- package/lib/chevre/index.js +5 -3
- package/lib/chevre/repo/account.js +0 -4
- package/lib/chevre/repo/accountTitle.js +0 -4
- package/lib/chevre/repo/accountTransaction.d.ts +0 -10
- package/lib/chevre/repo/accountTransaction.js +0 -57
- package/lib/chevre/repo/accountingReport.js +0 -4
- package/lib/chevre/repo/action.js +0 -4
- package/lib/chevre/repo/additionalProperty.js +0 -4
- package/lib/chevre/repo/aggregation.js +0 -4
- package/lib/chevre/repo/assetTransaction.d.ts +16 -6
- package/lib/chevre/repo/assetTransaction.js +174 -50
- package/lib/chevre/repo/categoryCode.js +0 -4
- package/lib/chevre/repo/code.js +0 -4
- package/lib/chevre/repo/comment.d.ts +4 -1
- package/lib/chevre/repo/comment.js +20 -9
- package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
- package/lib/chevre/repo/confirmationNumber.js +3 -15
- package/lib/chevre/repo/creativeWork.d.ts +1 -3
- package/lib/chevre/repo/creativeWork.js +0 -4
- package/lib/chevre/repo/customer.js +0 -4
- package/lib/chevre/repo/emailMessage.d.ts +1 -27
- package/lib/chevre/repo/emailMessage.js +0 -4
- package/lib/chevre/repo/event.d.ts +5 -1
- package/lib/chevre/repo/event.js +0 -4
- package/lib/chevre/repo/member.js +0 -4
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +0 -4
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +5 -2
- package/lib/chevre/repo/mongoose/schemas/account.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/accountTitle.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +18 -3
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +5 -2
- package/lib/chevre/repo/mongoose/schemas/aggregation.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +45 -3
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +20 -3
- package/lib/chevre/repo/mongoose/schemas/authorization.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +28 -3
- package/lib/chevre/repo/mongoose/schemas/comments.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/customer.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/customer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +72 -3
- package/lib/chevre/repo/mongoose/schemas/event.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/member.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +66 -3
- package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +28 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +52 -3
- package/lib/chevre/repo/mongoose/schemas/order.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +50 -3
- package/lib/chevre/repo/mongoose/schemas/place.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +24 -3
- package/lib/chevre/repo/mongoose/schemas/project.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +62 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/role.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/role.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/seller.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/task.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/telemetry.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +41 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/trip.js +1 -0
- package/lib/chevre/repo/offer.js +0 -5
- package/lib/chevre/repo/offerCatalog.js +0 -4
- package/lib/chevre/repo/order.d.ts +25 -0
- package/lib/chevre/repo/order.js +5 -4
- package/lib/chevre/repo/orderNumber.d.ts +0 -1
- package/lib/chevre/repo/orderNumber.js +2 -12
- package/lib/chevre/repo/ownershipInfo.js +0 -4
- package/lib/chevre/repo/permit.js +0 -4
- package/lib/chevre/repo/place.d.ts +5 -1
- package/lib/chevre/repo/place.js +1 -10
- package/lib/chevre/repo/priceSpecification.js +0 -4
- package/lib/chevre/repo/product.js +0 -4
- package/lib/chevre/repo/project.js +0 -4
- package/lib/chevre/repo/reservation.js +0 -4
- package/lib/chevre/repo/role.js +0 -4
- package/lib/chevre/repo/seller.js +0 -4
- package/lib/chevre/repo/serviceOutput.js +0 -4
- package/lib/chevre/repo/serviceOutputIdentifier.d.ts +0 -1
- package/lib/chevre/repo/serviceOutputIdentifier.js +2 -12
- package/lib/chevre/repo/stockHolder.d.ts +1 -0
- package/lib/chevre/repo/stockHolder.js +74 -7
- package/lib/chevre/repo/task.d.ts +38 -2
- package/lib/chevre/repo/task.js +90 -10
- package/lib/chevre/repo/telemetry.js +0 -4
- package/lib/chevre/repo/transaction.d.ts +17 -2
- package/lib/chevre/repo/transaction.js +176 -56
- package/lib/chevre/repo/transactionNumber.d.ts +0 -1
- package/lib/chevre/repo/transactionNumber.js +2 -12
- package/lib/chevre/repo/trip.js +0 -4
- package/lib/chevre/service/aggregation/system.d.ts +67 -22
- package/lib/chevre/service/aggregation/system.js +101 -89
- package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -5
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +2 -2
- package/lib/chevre/service/assetTransaction/refund.js +1 -1
- package/lib/chevre/service/assetTransaction/registerService.js +1 -2
- package/lib/chevre/service/assetTransaction/reserve.js +1 -1
- package/lib/chevre/service/assetTransaction.d.ts +6 -2
- package/lib/chevre/service/assetTransaction.js +9 -5
- package/lib/chevre/service/notification.d.ts +3 -1
- package/lib/chevre/service/notification.js +28 -7
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
- package/lib/chevre/service/offer.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +1 -1
- package/lib/chevre/service/order/placeOrder.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +1 -5
- package/lib/chevre/service/order/sendOrder.js +1 -1
- package/lib/chevre/service/payment/any/onPaid.js +1 -1
- package/lib/chevre/service/payment/any/onRefund.js +1 -1
- package/lib/chevre/service/payment/any.js +25 -10
- package/lib/chevre/service/product.js +1 -5
- package/lib/chevre/service/reserve/cancelReservation.js +0 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +0 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +20 -20
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
- package/lib/chevre/service/reserve/useReservation.js +1 -8
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
- package/lib/chevre/service/task/returnPayTransaction.js +1 -5
- package/lib/chevre/service/task/voidReserveTransaction.js +3 -1
- package/lib/chevre/service/task.d.ts +9 -0
- package/lib/chevre/service/task.js +43 -4
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -3
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +30 -29
- package/lib/chevre/service/transaction/placeOrder.js +1 -5
- package/lib/chevre/service/transaction/placeOrderInProgress.js +2 -2
- package/lib/chevre/service/transaction/returnOrder.js +1 -5
- package/lib/chevre/service/transaction.d.ts +6 -0
- package/lib/chevre/service/transaction.js +9 -7
- package/lib/chevre/settings.d.ts +3 -2
- package/lib/chevre/settings.js +9 -8
- package/package.json +4 -4
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
- package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
|
@@ -78,7 +78,35 @@ function createTasks(params) {
|
|
|
78
78
|
object: transaction
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
// 確定取引にも決済承認中止タスクを追加(2023-05-03~)
|
|
82
|
+
const voidPaymentTaskAttributes = {
|
|
83
|
+
project: transaction.project,
|
|
84
|
+
name: factory.taskName.VoidPayTransaction,
|
|
85
|
+
status: factory.taskStatus.Ready,
|
|
86
|
+
runsAt: taskRunsAt,
|
|
87
|
+
remainingNumberOfTries: 10,
|
|
88
|
+
numberOfTried: 0,
|
|
89
|
+
executionResults: [],
|
|
90
|
+
data: {
|
|
91
|
+
project: transaction.project,
|
|
92
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
// 確定取引にも興行オファー承認中止タスクを追加(2023-05-09~)
|
|
96
|
+
const voidReserveTaskAttributes = {
|
|
97
|
+
project: transaction.project,
|
|
98
|
+
name: factory.taskName.VoidReserveTransaction,
|
|
99
|
+
status: factory.taskStatus.Ready,
|
|
100
|
+
runsAt: taskRunsAt,
|
|
101
|
+
remainingNumberOfTries: 10,
|
|
102
|
+
numberOfTried: 0,
|
|
103
|
+
executionResults: [],
|
|
104
|
+
data: {
|
|
105
|
+
project: transaction.project,
|
|
106
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
taskAttributes.push(...triggerWebhookTaskAttributes, deleteTransactionTask, voidPaymentTaskAttributes, voidReserveTaskAttributes);
|
|
82
110
|
switch (transaction.status) {
|
|
83
111
|
case factory.transactionStatusType.Confirmed:
|
|
84
112
|
const potentialActions = transaction.potentialActions;
|
|
@@ -107,22 +135,8 @@ function createTasks(params) {
|
|
|
107
135
|
};
|
|
108
136
|
taskAttributes.push(placeOrderTaskAttributes);
|
|
109
137
|
break;
|
|
110
|
-
// 期限切れor中止の場合は、タスクリストを作成する
|
|
111
138
|
case factory.transactionStatusType.Canceled:
|
|
112
139
|
case factory.transactionStatusType.Expired:
|
|
113
|
-
const voidReserveTaskAttributes = {
|
|
114
|
-
project: transaction.project,
|
|
115
|
-
name: factory.taskName.VoidReserveTransaction,
|
|
116
|
-
status: factory.taskStatus.Ready,
|
|
117
|
-
runsAt: taskRunsAt,
|
|
118
|
-
remainingNumberOfTries: 10,
|
|
119
|
-
numberOfTried: 0,
|
|
120
|
-
executionResults: [],
|
|
121
|
-
data: {
|
|
122
|
-
project: transaction.project,
|
|
123
|
-
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
140
|
const voidRegisterServiceTaskAttributes = {
|
|
127
141
|
project: transaction.project,
|
|
128
142
|
name: factory.taskName.VoidRegisterServiceTransaction,
|
|
@@ -136,19 +150,6 @@ function createTasks(params) {
|
|
|
136
150
|
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
137
151
|
}
|
|
138
152
|
};
|
|
139
|
-
const voidPaymentTaskAttributes = {
|
|
140
|
-
project: transaction.project,
|
|
141
|
-
name: factory.taskName.VoidPayTransaction,
|
|
142
|
-
status: factory.taskStatus.Ready,
|
|
143
|
-
runsAt: taskRunsAt,
|
|
144
|
-
remainingNumberOfTries: 10,
|
|
145
|
-
numberOfTried: 0,
|
|
146
|
-
executionResults: [],
|
|
147
|
-
data: {
|
|
148
|
-
project: transaction.project,
|
|
149
|
-
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
153
|
const voidMoneyTransferTaskAttributes = {
|
|
153
154
|
project: transaction.project,
|
|
154
155
|
name: factory.taskName.VoidMoneyTransferTransaction,
|
|
@@ -162,7 +163,7 @@ function createTasks(params) {
|
|
|
162
163
|
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
163
164
|
}
|
|
164
165
|
};
|
|
165
|
-
taskAttributes.push(
|
|
166
|
+
taskAttributes.push(voidRegisterServiceTaskAttributes, voidMoneyTransferTaskAttributes);
|
|
166
167
|
break;
|
|
167
168
|
default:
|
|
168
169
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
@@ -36,11 +36,7 @@ function exportTasksById(params) {
|
|
|
36
36
|
transaction,
|
|
37
37
|
runsAt: taskRunsAt
|
|
38
38
|
});
|
|
39
|
-
|
|
40
|
-
yield repos.task.saveMany(taskAttributes);
|
|
41
|
-
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
42
|
-
// await repos.task.save(taskAttribute);
|
|
43
|
-
// }));
|
|
39
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
44
40
|
});
|
|
45
41
|
}
|
|
46
42
|
exports.exportTasksById = exportTasksById;
|
|
@@ -311,7 +311,7 @@ function authorizeAward(params) {
|
|
|
311
311
|
if (Array.isArray(givePointAwardParams)) {
|
|
312
312
|
const pointAwardIdentifiers = givePointAwardParams.map((g) => { var _a; return String((_a = g.object) === null || _a === void 0 ? void 0 : _a.identifier); });
|
|
313
313
|
// 取引にインセンティブ付与アクションパラメータを保管する
|
|
314
|
-
yield repos.transaction.
|
|
314
|
+
yield repos.transaction.findByIdAndUpdateInProgress({
|
|
315
315
|
id: transaction.id,
|
|
316
316
|
update: {
|
|
317
317
|
$set: {
|
|
@@ -339,7 +339,7 @@ function voidAward(params) {
|
|
|
339
339
|
if (transaction.agent.id !== params.agent.id) {
|
|
340
340
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
341
341
|
}
|
|
342
|
-
yield repos.transaction.
|
|
342
|
+
yield repos.transaction.findByIdAndUpdateInProgress({
|
|
343
343
|
id: transaction.id,
|
|
344
344
|
update: {
|
|
345
345
|
$unset: {
|
|
@@ -384,11 +384,7 @@ function exportTasksById(params) {
|
|
|
384
384
|
transaction,
|
|
385
385
|
runsAt: taskRunsAt
|
|
386
386
|
});
|
|
387
|
-
|
|
388
|
-
yield repos.task.saveMany(taskAttributes);
|
|
389
|
-
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
390
|
-
// await repos.task.save(taskAttribute);
|
|
391
|
-
// }));
|
|
387
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
392
388
|
});
|
|
393
389
|
}
|
|
394
390
|
exports.exportTasksById = exportTasksById;
|
|
@@ -45,6 +45,12 @@ export declare function exportTasks<T extends factory.transactionType>(params: {
|
|
|
45
45
|
typeOf?: {
|
|
46
46
|
$in: T[];
|
|
47
47
|
};
|
|
48
|
+
id?: string;
|
|
49
|
+
tasksExportAction?: {
|
|
50
|
+
agent: {
|
|
51
|
+
name: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
48
54
|
}): IExportTasksOperation<void>;
|
|
49
55
|
/**
|
|
50
56
|
* 取引に関わるリソースを削除する
|
|
@@ -19,6 +19,7 @@ const MoneyTransferTransactionService = require("./transaction/moneyTransfer");
|
|
|
19
19
|
const PlaceOrderTransactionService = require("./transaction/placeOrder");
|
|
20
20
|
const PlaceOrderInProgressTransactionService = require("./transaction/placeOrderInProgress");
|
|
21
21
|
const ReturnOrderTransactionService = require("./transaction/returnOrder");
|
|
22
|
+
const settings_1 = require("../settings");
|
|
22
23
|
exports.moneyTransfer = MoneyTransferTransactionService;
|
|
23
24
|
exports.placeOrder = PlaceOrderTransactionService;
|
|
24
25
|
exports.placeOrderInProgress = PlaceOrderInProgressTransactionService;
|
|
@@ -77,15 +78,17 @@ exports.updateAgent = updateAgent;
|
|
|
77
78
|
*/
|
|
78
79
|
function exportTasks(params) {
|
|
79
80
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
var _a;
|
|
82
|
+
const transaction = yield repos.transaction.startExportTasks(Object.assign({ project: params.project, typeOf: params.typeOf, status: params.status, tasksExportAction: {
|
|
83
|
+
agent: {
|
|
84
|
+
name: (typeof ((_a = params.tasksExportAction) === null || _a === void 0 ? void 0 : _a.agent.name) === 'string')
|
|
85
|
+
? params.tasksExportAction.agent.name
|
|
86
|
+
: settings_1.DEFAULT_TASKS_EXPORT_AGENT_NAME
|
|
87
|
+
}
|
|
88
|
+
} }, (typeof params.id === 'string') ? { id: params.id } : undefined));
|
|
85
89
|
if (transaction === null) {
|
|
86
90
|
return;
|
|
87
91
|
}
|
|
88
|
-
// let tasks: factory.task.ITask<factory.taskName>[] = [];
|
|
89
92
|
// 失敗してもここでは戻さない(RUNNINGのまま待機)
|
|
90
93
|
switch (transaction.typeOf) {
|
|
91
94
|
case factory.transactionType.MoneyTransfer:
|
|
@@ -109,7 +112,6 @@ function exportTasks(params) {
|
|
|
109
112
|
default:
|
|
110
113
|
}
|
|
111
114
|
yield repos.transaction.setTasksExportedById({ id: transaction.id });
|
|
112
|
-
// return tasks;
|
|
113
115
|
});
|
|
114
116
|
}
|
|
115
117
|
exports.exportTasks = exportTasks;
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -27,11 +27,12 @@ export type ISettings = factory.project.ISettings & {
|
|
|
27
27
|
useOfferRateLimitProjects: string[];
|
|
28
28
|
};
|
|
29
29
|
export declare const DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD: string;
|
|
30
|
+
export declare const DEFAULT_TASKS_EXPORT_AGENT_NAME: string;
|
|
30
31
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
31
32
|
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
32
33
|
export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
|
|
33
|
-
export declare const
|
|
34
|
-
export declare const
|
|
34
|
+
export declare const INFORM_RESERVATION_TASK_DELAY_IN_SECONDS: number;
|
|
35
|
+
export declare const MAX_RETRY_COUNT_TRIGGER_WEBHOOK: number;
|
|
35
36
|
/**
|
|
36
37
|
* グローバル設定
|
|
37
38
|
*/
|
package/lib/chevre/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.settings = exports.
|
|
3
|
+
exports.settings = exports.MAX_RETRY_COUNT_TRIGGER_WEBHOOK = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = void 0;
|
|
4
4
|
const moment = require("moment");
|
|
5
5
|
const factory = require("./factory");
|
|
6
6
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
@@ -44,17 +44,18 @@ exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = (typeof process.env.TRANSA
|
|
|
44
44
|
: 7;
|
|
45
45
|
exports.DEFAULT_SENDER_EMAIL = process.env.DEFAULT_SENDER_EMAIL;
|
|
46
46
|
exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = String(process.env.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD);
|
|
47
|
+
exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = `${process.env.GAE_APPLICATION}:${process.env.GAE_SERVICE}:jobs`;
|
|
47
48
|
exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
|
|
48
49
|
exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING === '1';
|
|
49
50
|
exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
|
|
50
51
|
? moment(process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM)
|
|
51
|
-
: moment('2023-
|
|
52
|
-
exports.
|
|
53
|
-
?
|
|
54
|
-
:
|
|
55
|
-
exports.
|
|
56
|
-
?
|
|
57
|
-
:
|
|
52
|
+
: moment('2023-08-31T15:00:00Z');
|
|
53
|
+
exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = (typeof process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS === 'string')
|
|
54
|
+
? Number(process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS)
|
|
55
|
+
: 0;
|
|
56
|
+
exports.MAX_RETRY_COUNT_TRIGGER_WEBHOOK = (typeof process.env.MAX_RETRY_COUNT_TRIGGER_WEBHOOK === 'string')
|
|
57
|
+
? Number(process.env.MAX_RETRY_COUNT_TRIGGER_WEBHOOK)
|
|
58
|
+
: 0;
|
|
58
59
|
/**
|
|
59
60
|
* グローバル設定
|
|
60
61
|
*/
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
12
|
+
"@chevre/factory": "4.311.0",
|
|
13
13
|
"@cinerino/sdk": "3.154.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"googleapis": "^85.0.0",
|
|
59
59
|
"json2csv": "4.5.4",
|
|
60
60
|
"mocha": "^5.2.0",
|
|
61
|
-
"mongoose": "
|
|
61
|
+
"mongoose": "7.0.5",
|
|
62
62
|
"nock": "^9.6.1",
|
|
63
63
|
"nyc": "^15.1.0",
|
|
64
64
|
"power-assert": "^1.6.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"aws-sdk": "^2.0.0",
|
|
77
|
-
"mongoose": "^
|
|
77
|
+
"mongoose": "^7.0.5",
|
|
78
78
|
"redis": "^4.6.5"
|
|
79
79
|
},
|
|
80
80
|
"engines": {
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.2.0-alpha.
|
|
120
|
+
"version": "21.2.0-alpha.41"
|
|
121
121
|
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
|
|
9
|
-
// tslint:disable-next-line:max-func-body-length
|
|
10
|
-
async function main() {
|
|
11
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
|
-
|
|
13
|
-
const accountTransactionRepo = new chevre.repository.AccountTransaction(mongoose.connection);
|
|
14
|
-
const assetTransactionRepo = new chevre.repository.AssetTransaction(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = assetTransactionRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
'project.id': { $eq: project.id },
|
|
19
|
-
typeOf: { $eq: chevre.factory.assetTransactionType.MoneyTransfer },
|
|
20
|
-
startDate: {
|
|
21
|
-
$gte: moment('2023-02-17T15:00:00Z')
|
|
22
|
-
.toDate()
|
|
23
|
-
}
|
|
24
|
-
// _id: { $eq: 'al6aff83w' }
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
// _id: 1,
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
|
-
console.log('assetTransactions found');
|
|
31
|
-
|
|
32
|
-
let i = 0;
|
|
33
|
-
let updateCount = 0;
|
|
34
|
-
// tslint:disable-next-line:max-func-body-length
|
|
35
|
-
await cursor.eachAsync(async (doc) => {
|
|
36
|
-
i += 1;
|
|
37
|
-
const moneyTransferTransaction: chevre.factory.assetTransaction.moneyTransfer.ITransaction = doc.toObject();
|
|
38
|
-
|
|
39
|
-
const description = moneyTransferTransaction.object.description;
|
|
40
|
-
if (description !== '鑑賞' && description !== '受け取り') {
|
|
41
|
-
console.log(
|
|
42
|
-
'no operation needed',
|
|
43
|
-
description,
|
|
44
|
-
moneyTransferTransaction.project.id,
|
|
45
|
-
moneyTransferTransaction.transactionNumber,
|
|
46
|
-
moneyTransferTransaction.startDate
|
|
47
|
-
);
|
|
48
|
-
} else {
|
|
49
|
-
const pendingTransactionIdentifier = moneyTransferTransaction.object.pendingTransaction?.identifier;
|
|
50
|
-
if (typeof pendingTransactionIdentifier === 'string' && pendingTransactionIdentifier.length > 0) {
|
|
51
|
-
console.log(
|
|
52
|
-
'pendingTransactionIdentifier found',
|
|
53
|
-
description,
|
|
54
|
-
moneyTransferTransaction.project.id,
|
|
55
|
-
moneyTransferTransaction.transactionNumber,
|
|
56
|
-
moneyTransferTransaction.startDate
|
|
57
|
-
);
|
|
58
|
-
} else {
|
|
59
|
-
// 口座取引からidentifierを取得
|
|
60
|
-
const accountTransaction =
|
|
61
|
-
await accountTransactionRepo.findByTransactionNumber({ transactionNumber: moneyTransferTransaction.transactionNumber });
|
|
62
|
-
console.log(
|
|
63
|
-
'updating identifier...',
|
|
64
|
-
accountTransaction.identifier,
|
|
65
|
-
description,
|
|
66
|
-
moneyTransferTransaction.project.id,
|
|
67
|
-
moneyTransferTransaction.transactionNumber,
|
|
68
|
-
moneyTransferTransaction.startDate
|
|
69
|
-
);
|
|
70
|
-
if (typeof accountTransaction.identifier === 'string') {
|
|
71
|
-
await assetTransactionRepo.findByIdAndUpdate({
|
|
72
|
-
id: moneyTransferTransaction.id,
|
|
73
|
-
update: {
|
|
74
|
-
'object.pendingTransaction.identifier': accountTransaction.identifier
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
console.log(
|
|
79
|
-
'ientifier updated',
|
|
80
|
-
accountTransaction.identifier,
|
|
81
|
-
description,
|
|
82
|
-
moneyTransferTransaction.project.id,
|
|
83
|
-
moneyTransferTransaction.transactionNumber,
|
|
84
|
-
moneyTransferTransaction.startDate
|
|
85
|
-
);
|
|
86
|
-
updateCount += 1;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
console.log(i, 'assetTransactions checked');
|
|
91
|
-
console.log(updateCount, 'assetTransactions updated');
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
main()
|
|
95
|
-
.then()
|
|
96
|
-
.catch(console.error);
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
// import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const additionalPropertyRepo = new chevre.repository.AdditionalProperty(mongoose.connection);
|
|
15
|
-
const creativeWorkRepo = new chevre.repository.CreativeWork(mongoose.connection);
|
|
16
|
-
|
|
17
|
-
const cursor = creativeWorkRepo.getCursor(
|
|
18
|
-
{
|
|
19
|
-
// 'project.id': { $eq: project.id },
|
|
20
|
-
'project.id': { $ne: EXCLUDED_PROJECT_ID }
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
// _id: 1,
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
console.log('movies found');
|
|
27
|
-
|
|
28
|
-
const additionalPropertyNames: string[] = [];
|
|
29
|
-
const projectIds: string[] = [];
|
|
30
|
-
const unexpextedprojectIds: string[] = [];
|
|
31
|
-
|
|
32
|
-
let i = 0;
|
|
33
|
-
let updateCount = 0;
|
|
34
|
-
await cursor.eachAsync(async (doc) => {
|
|
35
|
-
i += 1;
|
|
36
|
-
const movie: chevre.factory.creativeWork.movie.ICreativeWork = doc.toObject();
|
|
37
|
-
|
|
38
|
-
const additionalPropertyNamesOnEvent = movie.additionalProperty?.map((p) => p.name);
|
|
39
|
-
if (Array.isArray(additionalPropertyNamesOnEvent) && additionalPropertyNamesOnEvent.length > 0) {
|
|
40
|
-
console.log(
|
|
41
|
-
additionalPropertyNamesOnEvent.length,
|
|
42
|
-
'additionalPropertyNamesOnEvent found',
|
|
43
|
-
movie.project.id,
|
|
44
|
-
movie.id
|
|
45
|
-
);
|
|
46
|
-
additionalPropertyNames.push(...additionalPropertyNamesOnEvent);
|
|
47
|
-
projectIds.push(movie.project.id);
|
|
48
|
-
additionalPropertyNamesOnEvent.forEach((name) => {
|
|
49
|
-
if (!name.match(/^[a-zA-Z]*$/)) {
|
|
50
|
-
// throw new Error(`not matched ${creativeWork.project.id} ${creativeWork.id}`);
|
|
51
|
-
unexpextedprojectIds.push(movie.project.id);
|
|
52
|
-
}
|
|
53
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
54
|
-
if (name.length < 5) {
|
|
55
|
-
// throw new Error(`length matched ${creativeWork.project.id} ${creativeWork.id} ${name}`);
|
|
56
|
-
unexpextedprojectIds.push(movie.project.id);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
for (const additionalPropertyNameOnEvent of additionalPropertyNamesOnEvent) {
|
|
61
|
-
const existings = await additionalPropertyRepo.search({
|
|
62
|
-
project: { id: { $eq: movie.project.id } },
|
|
63
|
-
limit: 1,
|
|
64
|
-
page: 1,
|
|
65
|
-
name: { $regex: `^${additionalPropertyNameOnEvent}$` }
|
|
66
|
-
});
|
|
67
|
-
if (existings.length > 0) {
|
|
68
|
-
console.log('already existed', additionalPropertyNameOnEvent, movie.id, movie.project.id);
|
|
69
|
-
} else {
|
|
70
|
-
updateCount += 1;
|
|
71
|
-
const newAdditionalProperty: chevre.factory.additionalProperty.IAdditionalProperty = {
|
|
72
|
-
project: movie.project,
|
|
73
|
-
typeOf: 'CategoryCode',
|
|
74
|
-
codeValue: additionalPropertyNameOnEvent,
|
|
75
|
-
inCodeSet: {
|
|
76
|
-
typeOf: 'CategoryCodeSet',
|
|
77
|
-
identifier: <chevre.factory.creativeWorkType.Movie>movie.typeOf
|
|
78
|
-
},
|
|
79
|
-
name: { ja: additionalPropertyNameOnEvent }
|
|
80
|
-
};
|
|
81
|
-
await additionalPropertyRepo.save({
|
|
82
|
-
attributes: newAdditionalProperty
|
|
83
|
-
});
|
|
84
|
-
console.log('created', additionalPropertyNameOnEvent, movie.id, movie.project.id);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
console.log(i, 'events checked');
|
|
90
|
-
console.log(updateCount, 'properties updated');
|
|
91
|
-
console.log('additionalPropertyNames:', [...new Set(additionalPropertyNames)]);
|
|
92
|
-
console.log('projectIds:', [...new Set(projectIds)]);
|
|
93
|
-
console.log('unexpextedprojectIds:', [...new Set(unexpextedprojectIds)]);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
main()
|
|
97
|
-
.then()
|
|
98
|
-
.catch(console.error);
|