@chevre/domain 21.2.0-alpha.56 → 21.2.0-alpha.58
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/deleteTasksByName.ts +2 -1
- package/lib/chevre/repo/action.d.ts +15 -0
- package/lib/chevre/repo/action.js +23 -0
- package/lib/chevre/repo/assetTransaction.d.ts +1 -1
- package/lib/chevre/repo/assetTransaction.js +34 -13
- package/lib/chevre/repo/task.d.ts +3 -0
- package/lib/chevre/repo/task.js +2 -3
- package/lib/chevre/service/assetTransaction/cancelReservation.js +22 -20
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +22 -20
- package/lib/chevre/service/assetTransaction/pay.js +22 -20
- package/lib/chevre/service/assetTransaction/refund.js +22 -20
- package/lib/chevre/service/assetTransaction/registerService.js +22 -20
- package/lib/chevre/service/assetTransaction/reserve.js +22 -20
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +24 -41
- package/lib/chevre/service/task/returnPayTransaction.js +1 -7
- package/lib/chevre/service/transaction/deleteTransaction.js +55 -31
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +4 -0
- package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +5 -8
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +5 -0
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
- package/lib/chevre/service/transaction/placeOrderInProgress.js +5 -1
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +3 -0
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +3 -1
- package/package.json +2 -2
|
@@ -11,7 +11,8 @@ async function main() {
|
|
|
11
11
|
const taskRepo = new chevre.repository.Task(mongoose.connection);
|
|
12
12
|
|
|
13
13
|
const result = await taskRepo.deleteByName({
|
|
14
|
-
name:
|
|
14
|
+
name: chevre.factory.taskName.DeleteOrder,
|
|
15
|
+
status: { $eq: chevre.factory.taskStatus.Ready }
|
|
15
16
|
});
|
|
16
17
|
|
|
17
18
|
console.log('deleted', result);
|
|
@@ -133,6 +133,21 @@ export declare class MongoRepository {
|
|
|
133
133
|
deleteEndDatePassedCertainPeriod(params: {
|
|
134
134
|
$lt: Date;
|
|
135
135
|
}): Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
* 取引からアクションを削除する
|
|
138
|
+
*/
|
|
139
|
+
deleteByPurpose(params: {
|
|
140
|
+
project: {
|
|
141
|
+
id: string;
|
|
142
|
+
};
|
|
143
|
+
purpose: {
|
|
144
|
+
typeOf: factory.transactionType;
|
|
145
|
+
id: string;
|
|
146
|
+
};
|
|
147
|
+
typeOf: factory.actionType;
|
|
148
|
+
}): Promise<{
|
|
149
|
+
deletedCount?: number;
|
|
150
|
+
} | null>;
|
|
136
151
|
aggregateAuthorizeEventServiceOfferAction(params: {
|
|
137
152
|
project?: {
|
|
138
153
|
id?: {
|
|
@@ -675,6 +675,29 @@ class MongoRepository {
|
|
|
675
675
|
.exec();
|
|
676
676
|
});
|
|
677
677
|
}
|
|
678
|
+
/**
|
|
679
|
+
* 取引からアクションを削除する
|
|
680
|
+
*/
|
|
681
|
+
deleteByPurpose(params) {
|
|
682
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
683
|
+
return this.actionModel.deleteMany({
|
|
684
|
+
'project.id': { $eq: params.project.id },
|
|
685
|
+
typeOf: { $eq: params.typeOf },
|
|
686
|
+
'purpose.id': { $exists: true, $eq: params.purpose.id },
|
|
687
|
+
'purpose.typeOf': { $exists: true, $eq: params.purpose.typeOf }
|
|
688
|
+
})
|
|
689
|
+
.exec()
|
|
690
|
+
.then((result) => {
|
|
691
|
+
return {
|
|
692
|
+
// n: result?.n,
|
|
693
|
+
// opTime: result.opTime,
|
|
694
|
+
// ok: result?.ok,
|
|
695
|
+
// operationTime,
|
|
696
|
+
deletedCount: result === null || result === void 0 ? void 0 : result.deletedCount
|
|
697
|
+
};
|
|
698
|
+
});
|
|
699
|
+
});
|
|
700
|
+
}
|
|
678
701
|
aggregateAuthorizeEventServiceOfferAction(params) {
|
|
679
702
|
return __awaiter(this, void 0, void 0, function* () {
|
|
680
703
|
const statuses = yield Promise.all([
|
|
@@ -148,7 +148,7 @@ export declare class MongoRepository {
|
|
|
148
148
|
/**
|
|
149
149
|
* 取引を検索する
|
|
150
150
|
*/
|
|
151
|
-
search<T extends factory.assetTransactionType>(params: factory.assetTransaction.ISearchConditions<T>,
|
|
151
|
+
search<T extends factory.assetTransactionType>(params: factory.assetTransaction.ISearchConditions<T>, inclusion?: string[], exclusion?: string[]): Promise<factory.assetTransaction.ITransaction<T>[]>;
|
|
152
152
|
/**
|
|
153
153
|
* 取引番号指定で削除する
|
|
154
154
|
*/
|
|
@@ -23,7 +23,7 @@ class MongoRepository {
|
|
|
23
23
|
}
|
|
24
24
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
25
25
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
26
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
27
27
|
const andConditions = [
|
|
28
28
|
{
|
|
29
29
|
typeOf: params.typeOf
|
|
@@ -133,15 +133,18 @@ class MongoRepository {
|
|
|
133
133
|
const objectPaymentMethodIdEq4refund = (_j = (_h = params.object) === null || _h === void 0 ? void 0 : _h.paymentMethodId) === null || _j === void 0 ? void 0 : _j.$eq;
|
|
134
134
|
if (typeof objectPaymentMethodIdEq4refund === 'string') {
|
|
135
135
|
andConditions.push({
|
|
136
|
-
'object.paymentMethodId': {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
'object.paymentMethodId': { $exists: true, $eq: objectPaymentMethodIdEq4refund }
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
const objectPaymentMethodIdIn4refund = (_l = (_k = params.object) === null || _k === void 0 ? void 0 : _k.paymentMethodId) === null || _l === void 0 ? void 0 : _l.$in;
|
|
140
|
+
if (Array.isArray(objectPaymentMethodIdIn4refund)) {
|
|
141
|
+
andConditions.push({
|
|
142
|
+
'object.paymentMethodId': { $exists: true, $in: objectPaymentMethodIdIn4refund }
|
|
140
143
|
});
|
|
141
144
|
}
|
|
142
145
|
break;
|
|
143
146
|
case factory.assetTransactionType.MoneyTransfer:
|
|
144
|
-
const fromLocationIdentifierEq = (
|
|
147
|
+
const fromLocationIdentifierEq = (_p = (_o = (_m = params.object) === null || _m === void 0 ? void 0 : _m.fromLocation) === null || _o === void 0 ? void 0 : _o.identifier) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
145
148
|
if (typeof fromLocationIdentifierEq === 'string') {
|
|
146
149
|
andConditions.push({
|
|
147
150
|
'object.fromLocation.identifier': {
|
|
@@ -150,7 +153,7 @@ class MongoRepository {
|
|
|
150
153
|
}
|
|
151
154
|
});
|
|
152
155
|
}
|
|
153
|
-
const toLocationIdentifierEq = (
|
|
156
|
+
const toLocationIdentifierEq = (_s = (_r = (_q = params.object) === null || _q === void 0 ? void 0 : _q.toLocation) === null || _r === void 0 ? void 0 : _r.identifier) === null || _s === void 0 ? void 0 : _s.$eq;
|
|
154
157
|
if (typeof toLocationIdentifierEq === 'string') {
|
|
155
158
|
andConditions.push({
|
|
156
159
|
'object.toLocation.identifier': {
|
|
@@ -159,7 +162,7 @@ class MongoRepository {
|
|
|
159
162
|
}
|
|
160
163
|
});
|
|
161
164
|
}
|
|
162
|
-
const pendingTransactionIdentifierEq = (
|
|
165
|
+
const pendingTransactionIdentifierEq = (_v = (_u = (_t = params.object) === null || _t === void 0 ? void 0 : _t.pendingTransaction) === null || _u === void 0 ? void 0 : _u.identifier) === null || _v === void 0 ? void 0 : _v.$eq;
|
|
163
166
|
if (typeof pendingTransactionIdentifierEq === 'string') {
|
|
164
167
|
andConditions.push({
|
|
165
168
|
'object.pendingTransaction.identifier': {
|
|
@@ -172,7 +175,7 @@ class MongoRepository {
|
|
|
172
175
|
case factory.assetTransactionType.CancelReservation:
|
|
173
176
|
break;
|
|
174
177
|
case factory.assetTransactionType.Reserve:
|
|
175
|
-
const objectReservationNumberEq = (
|
|
178
|
+
const objectReservationNumberEq = (_x = (_w = params.object) === null || _w === void 0 ? void 0 : _w.reservationNumber) === null || _x === void 0 ? void 0 : _x.$eq;
|
|
176
179
|
if (typeof objectReservationNumberEq === 'string') {
|
|
177
180
|
andConditions.push({
|
|
178
181
|
'object.reservationNumber': {
|
|
@@ -220,7 +223,7 @@ class MongoRepository {
|
|
|
220
223
|
}
|
|
221
224
|
break;
|
|
222
225
|
case factory.assetTransactionType.RegisterService:
|
|
223
|
-
const objectItemOfferedServiceOutputIdentifierEq = (
|
|
226
|
+
const objectItemOfferedServiceOutputIdentifierEq = (_1 = (_0 = (_z = (_y = params.object) === null || _y === void 0 ? void 0 : _y.itemOffered) === null || _z === void 0 ? void 0 : _z.serviceOutput) === null || _0 === void 0 ? void 0 : _0.identifier) === null || _1 === void 0 ? void 0 : _1.$eq;
|
|
224
227
|
if (typeof objectItemOfferedServiceOutputIdentifierEq === 'string') {
|
|
225
228
|
andConditions.push({
|
|
226
229
|
'object.itemOffered.serviceOutput.identifier': {
|
|
@@ -229,7 +232,7 @@ class MongoRepository {
|
|
|
229
232
|
}
|
|
230
233
|
});
|
|
231
234
|
}
|
|
232
|
-
const objectItemOfferedServiceOutputIdentifierIn = (
|
|
235
|
+
const objectItemOfferedServiceOutputIdentifierIn = (_5 = (_4 = (_3 = (_2 = params.object) === null || _2 === void 0 ? void 0 : _2.itemOffered) === null || _3 === void 0 ? void 0 : _3.serviceOutput) === null || _4 === void 0 ? void 0 : _4.identifier) === null || _5 === void 0 ? void 0 : _5.$in;
|
|
233
236
|
if (Array.isArray(objectItemOfferedServiceOutputIdentifierIn)) {
|
|
234
237
|
andConditions.push({
|
|
235
238
|
'object.itemOffered.serviceOutput.identifier': {
|
|
@@ -589,12 +592,30 @@ class MongoRepository {
|
|
|
589
592
|
/**
|
|
590
593
|
* 取引を検索する
|
|
591
594
|
*/
|
|
592
|
-
search(params,
|
|
595
|
+
search(params, inclusion, exclusion) {
|
|
593
596
|
var _a;
|
|
594
597
|
return __awaiter(this, void 0, void 0, function* () {
|
|
595
598
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
599
|
+
let projection = {};
|
|
600
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
601
|
+
inclusion.forEach((field) => {
|
|
602
|
+
projection[field] = 1;
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
else {
|
|
606
|
+
projection = {
|
|
607
|
+
__v: 0,
|
|
608
|
+
createdAt: 0,
|
|
609
|
+
updatedAt: 0
|
|
610
|
+
};
|
|
611
|
+
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
612
|
+
exclusion.forEach((field) => {
|
|
613
|
+
projection[field] = 0;
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
}
|
|
596
617
|
const query = this.transactionModel.find((conditions.length > 0) ? { $and: conditions } : {})
|
|
597
|
-
.select(
|
|
618
|
+
.select(projection);
|
|
598
619
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
599
620
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
600
621
|
query.limit(params.limit)
|
|
@@ -93,6 +93,9 @@ export declare class MongoRepository {
|
|
|
93
93
|
}): Promise<void>;
|
|
94
94
|
deleteByName(params: {
|
|
95
95
|
name: factory.taskName;
|
|
96
|
+
status?: {
|
|
97
|
+
$eq?: factory.taskStatus;
|
|
98
|
+
};
|
|
96
99
|
}): Promise<import("mongodb").DeleteResult>;
|
|
97
100
|
countDelayedTasks(params: {
|
|
98
101
|
delayInSeconds: number;
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -411,10 +411,9 @@ class MongoRepository {
|
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
413
|
deleteByName(params) {
|
|
414
|
+
var _a;
|
|
414
415
|
return __awaiter(this, void 0, void 0, function* () {
|
|
415
|
-
return this.taskModel.deleteMany({
|
|
416
|
-
name: { $eq: params.name }
|
|
417
|
-
})
|
|
416
|
+
return this.taskModel.deleteMany(Object.assign({ name: { $eq: params.name } }, (typeof ((_a = params.status) === null || _a === void 0 ? void 0 : _a.$eq) === 'string') ? { status: { $eq: params.status.$eq } } : undefined))
|
|
418
417
|
.exec();
|
|
419
418
|
});
|
|
420
419
|
}
|
|
@@ -167,27 +167,29 @@ function exportTasksById(params) {
|
|
|
167
167
|
});
|
|
168
168
|
const potentialActions = transaction.potentialActions;
|
|
169
169
|
const taskAttributes = [];
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
170
|
+
if (settings_1.USE_DELETE_ASSET_TRANSACTION_TASK) {
|
|
171
|
+
// 資産取引削除タスクを作成
|
|
172
|
+
const deleteTransactionTask = {
|
|
173
|
+
project: transaction.project,
|
|
174
|
+
name: factory.taskName.DeleteAssetTransaction,
|
|
175
|
+
status: factory.taskStatus.Ready,
|
|
176
|
+
runsAt: moment(transaction.endDate)
|
|
177
|
+
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
178
|
+
.toDate(),
|
|
179
|
+
remainingNumberOfTries: 3,
|
|
180
|
+
numberOfTried: 0,
|
|
181
|
+
executionResults: [],
|
|
182
|
+
data: {
|
|
183
|
+
object: {
|
|
184
|
+
project: transaction.project,
|
|
185
|
+
id: transaction.id,
|
|
186
|
+
transactionNumber: transaction.transactionNumber,
|
|
187
|
+
typeOf: transaction.typeOf
|
|
188
|
+
}
|
|
187
189
|
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
};
|
|
191
|
+
taskAttributes.push(deleteTransactionTask);
|
|
192
|
+
}
|
|
191
193
|
switch (transaction.status) {
|
|
192
194
|
case factory.transactionStatusType.Confirmed:
|
|
193
195
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -360,27 +360,29 @@ function exportTasksById(params) {
|
|
|
360
360
|
});
|
|
361
361
|
const potentialActions = transaction.potentialActions;
|
|
362
362
|
const taskAttributes = [];
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
363
|
+
if (settings_1.USE_DELETE_ASSET_TRANSACTION_TASK) {
|
|
364
|
+
// 資産取引削除タスクを作成
|
|
365
|
+
const deleteTransactionTask = {
|
|
366
|
+
project: transaction.project,
|
|
367
|
+
name: factory.taskName.DeleteAssetTransaction,
|
|
368
|
+
status: factory.taskStatus.Ready,
|
|
369
|
+
runsAt: moment(transaction.endDate)
|
|
370
|
+
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
371
|
+
.toDate(),
|
|
372
|
+
remainingNumberOfTries: 3,
|
|
373
|
+
numberOfTried: 0,
|
|
374
|
+
executionResults: [],
|
|
375
|
+
data: {
|
|
376
|
+
object: {
|
|
377
|
+
project: transaction.project,
|
|
378
|
+
id: transaction.id,
|
|
379
|
+
transactionNumber: transaction.transactionNumber,
|
|
380
|
+
typeOf: transaction.typeOf
|
|
381
|
+
}
|
|
380
382
|
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
383
|
+
};
|
|
384
|
+
taskAttributes.push(deleteTransactionTask);
|
|
385
|
+
}
|
|
384
386
|
// タスク実行日時バッファの指定があれば調整
|
|
385
387
|
let taskRunsAt = new Date();
|
|
386
388
|
if (typeof params.runsTasksAfterInSeconds === 'number') {
|
|
@@ -399,27 +399,29 @@ function exportTasksById(params) {
|
|
|
399
399
|
});
|
|
400
400
|
const potentialActions = transaction.potentialActions;
|
|
401
401
|
const taskAttributes = [];
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
402
|
+
if (settings_1.USE_DELETE_ASSET_TRANSACTION_TASK) {
|
|
403
|
+
// 資産取引削除タスクを作成
|
|
404
|
+
const deleteTransactionTask = {
|
|
405
|
+
project: transaction.project,
|
|
406
|
+
name: factory.taskName.DeleteAssetTransaction,
|
|
407
|
+
status: factory.taskStatus.Ready,
|
|
408
|
+
runsAt: moment(transaction.endDate)
|
|
409
|
+
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
410
|
+
.toDate(),
|
|
411
|
+
remainingNumberOfTries: 3,
|
|
412
|
+
numberOfTried: 0,
|
|
413
|
+
executionResults: [],
|
|
414
|
+
data: {
|
|
415
|
+
object: {
|
|
416
|
+
project: transaction.project,
|
|
417
|
+
id: transaction.id,
|
|
418
|
+
transactionNumber: transaction.transactionNumber,
|
|
419
|
+
typeOf: transaction.typeOf
|
|
420
|
+
}
|
|
419
421
|
}
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
|
|
422
|
+
};
|
|
423
|
+
taskAttributes.push(deleteTransactionTask);
|
|
424
|
+
}
|
|
423
425
|
// タスク実行日時バッファの指定があれば調整
|
|
424
426
|
let taskRunsAt = new Date();
|
|
425
427
|
if (typeof params.runsTasksAfterInSeconds === 'number') {
|
|
@@ -160,27 +160,29 @@ function exportTasksById(params) {
|
|
|
160
160
|
});
|
|
161
161
|
const potentialActions = transaction.potentialActions;
|
|
162
162
|
const taskAttributes = [];
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
163
|
+
if (settings_1.USE_DELETE_ASSET_TRANSACTION_TASK) {
|
|
164
|
+
// 資産取引削除タスクを作成
|
|
165
|
+
const deleteTransactionTask = {
|
|
166
|
+
project: transaction.project,
|
|
167
|
+
name: factory.taskName.DeleteAssetTransaction,
|
|
168
|
+
status: factory.taskStatus.Ready,
|
|
169
|
+
runsAt: moment(transaction.endDate)
|
|
170
|
+
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
171
|
+
.toDate(),
|
|
172
|
+
remainingNumberOfTries: 3,
|
|
173
|
+
numberOfTried: 0,
|
|
174
|
+
executionResults: [],
|
|
175
|
+
data: {
|
|
176
|
+
object: {
|
|
177
|
+
project: transaction.project,
|
|
178
|
+
id: transaction.id,
|
|
179
|
+
transactionNumber: transaction.transactionNumber,
|
|
180
|
+
typeOf: transaction.typeOf
|
|
181
|
+
}
|
|
180
182
|
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
};
|
|
184
|
+
taskAttributes.push(deleteTransactionTask);
|
|
185
|
+
}
|
|
184
186
|
// タスク実行日時バッファの指定があれば調整
|
|
185
187
|
let taskRunsAt = new Date();
|
|
186
188
|
if (typeof params.runsTasksAfterInSeconds === 'number') {
|
|
@@ -230,27 +230,29 @@ function exportTasksById(params) {
|
|
|
230
230
|
});
|
|
231
231
|
const potentialActions = transaction.potentialActions;
|
|
232
232
|
const taskAttributes = [];
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
233
|
+
if (settings_1.USE_DELETE_ASSET_TRANSACTION_TASK) {
|
|
234
|
+
// 資産取引削除タスクを作成
|
|
235
|
+
const deleteTransactionTask = {
|
|
236
|
+
project: transaction.project,
|
|
237
|
+
name: factory.taskName.DeleteAssetTransaction,
|
|
238
|
+
status: factory.taskStatus.Ready,
|
|
239
|
+
runsAt: moment(transaction.endDate)
|
|
240
|
+
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
241
|
+
.toDate(),
|
|
242
|
+
remainingNumberOfTries: 3,
|
|
243
|
+
numberOfTried: 0,
|
|
244
|
+
executionResults: [],
|
|
245
|
+
data: {
|
|
246
|
+
object: {
|
|
247
|
+
project: transaction.project,
|
|
248
|
+
id: transaction.id,
|
|
249
|
+
transactionNumber: transaction.transactionNumber,
|
|
250
|
+
typeOf: transaction.typeOf
|
|
251
|
+
}
|
|
250
252
|
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
|
|
253
|
+
};
|
|
254
|
+
taskAttributes.push(deleteTransactionTask);
|
|
255
|
+
}
|
|
254
256
|
const taskRunsAt = new Date();
|
|
255
257
|
switch (transaction.status) {
|
|
256
258
|
case factory.transactionStatusType.Confirmed:
|
|
@@ -773,27 +773,29 @@ function exportTasksById(params) {
|
|
|
773
773
|
});
|
|
774
774
|
const potentialActions = transaction.potentialActions;
|
|
775
775
|
const taskAttributes = [];
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
776
|
+
if (settings_1.USE_DELETE_ASSET_TRANSACTION_TASK) {
|
|
777
|
+
// 資産取引削除タスクを作成
|
|
778
|
+
const deleteTransactionTask = {
|
|
779
|
+
project: transaction.project,
|
|
780
|
+
name: factory.taskName.DeleteAssetTransaction,
|
|
781
|
+
status: factory.taskStatus.Ready,
|
|
782
|
+
runsAt: moment(transaction.endDate)
|
|
783
|
+
.add(settings_1.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
784
|
+
.toDate(),
|
|
785
|
+
remainingNumberOfTries: 3,
|
|
786
|
+
numberOfTried: 0,
|
|
787
|
+
executionResults: [],
|
|
788
|
+
data: {
|
|
789
|
+
object: {
|
|
790
|
+
project: transaction.project,
|
|
791
|
+
id: transaction.id,
|
|
792
|
+
transactionNumber: transaction.transactionNumber,
|
|
793
|
+
typeOf: transaction.typeOf
|
|
794
|
+
}
|
|
793
795
|
}
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
|
|
796
|
+
};
|
|
797
|
+
taskAttributes.push(deleteTransactionTask);
|
|
798
|
+
}
|
|
797
799
|
switch (transaction.status) {
|
|
798
800
|
case factory.transactionStatusType.Confirmed:
|
|
799
801
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -26,32 +26,10 @@ function getOrderWithToken(params) {
|
|
|
26
26
|
if (typeof credentials_1.credentials.hub.clientId !== 'string') {
|
|
27
27
|
return params.order;
|
|
28
28
|
}
|
|
29
|
-
// 冗長な個人情報をマスク(最低限の情報に)
|
|
30
|
-
// const customer4orderToken: factory.order.ISimpleCustomer =
|
|
31
|
-
// (params.order.customer.typeOf === factory.organizationType.Organization)
|
|
32
|
-
// ? {
|
|
33
|
-
// id: params.order.customer.id,
|
|
34
|
-
// name: '****',
|
|
35
|
-
// // project: params.order.customer.project,
|
|
36
|
-
// typeOf: params.order.customer.typeOf
|
|
37
|
-
// }
|
|
38
|
-
// : {
|
|
39
|
-
// id: params.order.customer.id,
|
|
40
|
-
// typeOf: params.order.customer.typeOf
|
|
41
|
-
// };
|
|
42
|
-
// const seller4orderToken: Omit<factory.order.ISeller, 'name'> = {
|
|
43
|
-
// id: params.order.seller.id,
|
|
44
|
-
// typeOf: params.order.seller.typeOf
|
|
45
|
-
// };
|
|
46
29
|
// 最適化(2023-01-31~)
|
|
47
30
|
const order4token = {
|
|
48
31
|
typeOf: params.order.typeOf,
|
|
49
|
-
// seller: seller4orderToken,
|
|
50
|
-
// customer: customer4orderToken,
|
|
51
32
|
orderNumber: params.order.orderNumber
|
|
52
|
-
// price: params.order.price,
|
|
53
|
-
// priceCurrency: params.order.priceCurrency,
|
|
54
|
-
// orderDate: params.order.orderDate
|
|
55
33
|
};
|
|
56
34
|
const token = yield new Promise((resolve, reject) => {
|
|
57
35
|
// 所有権を暗号化する
|
|
@@ -163,26 +141,31 @@ const ORDER_STORAGE_PERIOD_IN_DAYS = (typeof process.env.ORDER_STORAGE_PERIOD_IN
|
|
|
163
141
|
// tslint:disable-next-line:no-magic-numbers
|
|
164
142
|
365;
|
|
165
143
|
function createDeleteTasks(order) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
144
|
+
if (settings_1.USE_DELETE_ORDER_TASK) {
|
|
145
|
+
return [{
|
|
146
|
+
project: order.project,
|
|
147
|
+
name: factory.taskName.DeleteOrder,
|
|
148
|
+
status: factory.taskStatus.Ready,
|
|
149
|
+
runsAt: moment(order.orderDate)
|
|
150
|
+
.add(ORDER_STORAGE_PERIOD_IN_DAYS, 'days')
|
|
151
|
+
.toDate(),
|
|
152
|
+
remainingNumberOfTries: 10,
|
|
153
|
+
numberOfTried: 0,
|
|
154
|
+
executionResults: [],
|
|
155
|
+
data: {
|
|
156
|
+
object: {
|
|
157
|
+
confirmationNumber: order.confirmationNumber,
|
|
158
|
+
orderDate: order.orderDate,
|
|
159
|
+
orderNumber: order.orderNumber,
|
|
160
|
+
project: order.project,
|
|
161
|
+
typeOf: order.typeOf
|
|
162
|
+
}
|
|
183
163
|
}
|
|
184
|
-
}
|
|
185
|
-
|
|
164
|
+
}];
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return [];
|
|
168
|
+
}
|
|
186
169
|
}
|
|
187
170
|
exports.createDeleteTasks = createDeleteTasks;
|
|
188
171
|
function createConfirmReservationActionObject4ChevreByOrder(params) {
|
|
@@ -134,13 +134,7 @@ function refundTransactionAlreadyExists(params) {
|
|
|
134
134
|
typeOf: factory.assetTransactionType.Refund,
|
|
135
135
|
statuses: [factory.transactionStatusType.Confirmed],
|
|
136
136
|
object: { paymentMethodId: { $eq: params.object.paymentMethodId } }
|
|
137
|
-
},
|
|
138
|
-
agent: 0,
|
|
139
|
-
object: 0,
|
|
140
|
-
potentialActions: 0,
|
|
141
|
-
recipient: 0,
|
|
142
|
-
result: 0
|
|
143
|
-
});
|
|
137
|
+
}, ['_id'], []);
|
|
144
138
|
return refundTransactions.length > 0;
|
|
145
139
|
});
|
|
146
140
|
}
|
|
@@ -31,7 +31,7 @@ function deleteTransaction(params) {
|
|
|
31
31
|
// すでに削除済
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
//
|
|
34
|
+
// アクション開始
|
|
35
35
|
const actionAttributes = {
|
|
36
36
|
typeOf: factory.actionType.DeleteAction,
|
|
37
37
|
project: transaction.project,
|
|
@@ -39,30 +39,28 @@ function deleteTransaction(params) {
|
|
|
39
39
|
agent: transaction.project
|
|
40
40
|
};
|
|
41
41
|
let deletePayTransactionResult;
|
|
42
|
+
let deleteRefundResult;
|
|
42
43
|
let payTransactionNumbers = [];
|
|
43
44
|
let deleteReservationsResult;
|
|
44
45
|
let deleteReserveTransactionResult;
|
|
45
46
|
let deletedReservationNumbers = [];
|
|
47
|
+
let deleteActionResult;
|
|
46
48
|
const action = yield repos.action.start(actionAttributes);
|
|
47
49
|
try {
|
|
48
50
|
const transactionTypeOf = transaction.typeOf;
|
|
49
51
|
switch (transactionTypeOf) {
|
|
50
52
|
case factory.transactionType.PlaceOrder:
|
|
53
|
+
// 取引に対する全ての承認アクションを検索
|
|
54
|
+
const authorizeActions = yield repos.action.searchByPurpose({
|
|
55
|
+
typeOf: factory.actionType.AuthorizeAction,
|
|
56
|
+
purpose: {
|
|
57
|
+
typeOf: transaction.typeOf,
|
|
58
|
+
id: transaction.id
|
|
59
|
+
}
|
|
60
|
+
});
|
|
51
61
|
switch (transaction.status) {
|
|
52
|
-
// 中止あるいは期限切れ取引の場合
|
|
53
62
|
case factory.transactionStatusType.Canceled:
|
|
54
63
|
case factory.transactionStatusType.Expired:
|
|
55
|
-
// tslint:disable-next-line:no-suspicious-comment
|
|
56
|
-
// TODO サービス登録取引を削除
|
|
57
|
-
// 決済取引を削除
|
|
58
|
-
const deletePayTransactionsByPlaceOrderResult = yield deletePayTransactionsByPlaceOrder({ transaction })(repos);
|
|
59
|
-
deletePayTransactionResult = deletePayTransactionsByPlaceOrderResult.deletePayTransactionResult;
|
|
60
|
-
payTransactionNumbers = deletePayTransactionsByPlaceOrderResult.payTransactionNumbers;
|
|
61
|
-
// 取引上での予約を削除
|
|
62
|
-
const deleteReservationsByPlaceOrderResult = yield deleteReservationsByPlaceOrder({ transaction })(repos);
|
|
63
|
-
deleteReservationsResult = deleteReservationsByPlaceOrderResult.deleteResult;
|
|
64
|
-
deleteReserveTransactionResult = deleteReservationsByPlaceOrderResult.deleteReserveTransactionResult;
|
|
65
|
-
deletedReservationNumbers = deleteReservationsByPlaceOrderResult.reserveTransactionNumbers;
|
|
66
64
|
break;
|
|
67
65
|
case factory.transactionStatusType.Confirmed:
|
|
68
66
|
const deletingOrder = (_a = transaction.result) === null || _a === void 0 ? void 0 : _a.order;
|
|
@@ -74,6 +72,24 @@ function deleteTransaction(params) {
|
|
|
74
72
|
break;
|
|
75
73
|
default:
|
|
76
74
|
}
|
|
75
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
76
|
+
// TODO サービス登録取引を削除
|
|
77
|
+
// 決済取引を削除
|
|
78
|
+
const deletePayTransactionsByPlaceOrderResult = yield deletePayTransactionsByPlaceOrder({ authorizeActions, transaction })(repos);
|
|
79
|
+
deletePayTransactionResult = deletePayTransactionsByPlaceOrderResult.deletePayTransactionResult;
|
|
80
|
+
deleteRefundResult = deletePayTransactionsByPlaceOrderResult.deleteRefundResult;
|
|
81
|
+
payTransactionNumbers = deletePayTransactionsByPlaceOrderResult.payTransactionNumbers;
|
|
82
|
+
// 取引上での予約を削除
|
|
83
|
+
const deleteReservationsByPlaceOrderResult = yield deleteReservationsByPlaceOrder({ authorizeActions, transaction })(repos);
|
|
84
|
+
deleteReservationsResult = deleteReservationsByPlaceOrderResult.deleteResult;
|
|
85
|
+
deleteReserveTransactionResult = deleteReservationsByPlaceOrderResult.deleteReserveTransactionResult;
|
|
86
|
+
deletedReservationNumbers = deleteReservationsByPlaceOrderResult.reserveTransactionNumbers;
|
|
87
|
+
// アクション削除(2023-05-19~)
|
|
88
|
+
deleteActionResult = yield repos.action.deleteByPurpose({
|
|
89
|
+
project: { id: transaction.project.id },
|
|
90
|
+
purpose: { id: transaction.id, typeOf: transaction.typeOf },
|
|
91
|
+
typeOf: factory.actionType.AuthorizeAction
|
|
92
|
+
});
|
|
77
93
|
// 取引削除
|
|
78
94
|
yield repos.transaction.findByIdAndDelete({ id: transaction.id });
|
|
79
95
|
break;
|
|
@@ -105,10 +121,12 @@ function deleteTransaction(params) {
|
|
|
105
121
|
// アクション完了
|
|
106
122
|
const actionResult = {
|
|
107
123
|
deletePayTransactionResult,
|
|
124
|
+
deleteRefundResult,
|
|
108
125
|
payTransactionNumbers,
|
|
109
126
|
deleteReservationsResult,
|
|
110
127
|
deleteReserveTransactionResult,
|
|
111
|
-
deletedReservationNumbers
|
|
128
|
+
deletedReservationNumbers,
|
|
129
|
+
deleteActionResult
|
|
112
130
|
};
|
|
113
131
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
114
132
|
});
|
|
@@ -118,14 +136,7 @@ function deleteReservationsByPlaceOrder(params) {
|
|
|
118
136
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
119
137
|
let deleteResult;
|
|
120
138
|
let deleteReserveTransactionResult;
|
|
121
|
-
|
|
122
|
-
const authorizeActions = yield repos.action.searchByPurpose({
|
|
123
|
-
typeOf: factory.actionType.AuthorizeAction,
|
|
124
|
-
purpose: {
|
|
125
|
-
typeOf: factory.transactionType.PlaceOrder,
|
|
126
|
-
id: params.transaction.id
|
|
127
|
-
}
|
|
128
|
-
});
|
|
139
|
+
const authorizeActions = params.authorizeActions;
|
|
129
140
|
// 予約取引番号を抽出
|
|
130
141
|
const authorizeReservationOfferActions = authorizeActions
|
|
131
142
|
.filter((a) => {
|
|
@@ -159,6 +170,8 @@ function deleteReservationsByPlaceOrder(params) {
|
|
|
159
170
|
ok: deleteAssetTransactionsResult === null || deleteAssetTransactionsResult === void 0 ? void 0 : deleteAssetTransactionsResult.ok,
|
|
160
171
|
deletedCount: deleteAssetTransactionsResult === null || deleteAssetTransactionsResult === void 0 ? void 0 : deleteAssetTransactionsResult.deletedCount
|
|
161
172
|
};
|
|
173
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
174
|
+
// TODO 予約取消取引も削除可能か?
|
|
162
175
|
}
|
|
163
176
|
return { deleteResult, deleteReserveTransactionResult, reserveTransactionNumbers };
|
|
164
177
|
});
|
|
@@ -166,14 +179,8 @@ function deleteReservationsByPlaceOrder(params) {
|
|
|
166
179
|
function deletePayTransactionsByPlaceOrder(params) {
|
|
167
180
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
168
181
|
let deletePayTransactionResult;
|
|
169
|
-
|
|
170
|
-
const authorizeActions =
|
|
171
|
-
typeOf: factory.actionType.AuthorizeAction,
|
|
172
|
-
purpose: {
|
|
173
|
-
typeOf: factory.transactionType.PlaceOrder,
|
|
174
|
-
id: params.transaction.id
|
|
175
|
-
}
|
|
176
|
-
});
|
|
182
|
+
let deleteRefundResult;
|
|
183
|
+
const authorizeActions = params.authorizeActions;
|
|
177
184
|
// 決済取引番号を抽出
|
|
178
185
|
const authorizePaymentActions = authorizeActions
|
|
179
186
|
.filter((a) => {
|
|
@@ -196,7 +203,24 @@ function deletePayTransactionsByPlaceOrder(params) {
|
|
|
196
203
|
ok: deleteAssetTransactionsResult === null || deleteAssetTransactionsResult === void 0 ? void 0 : deleteAssetTransactionsResult.ok,
|
|
197
204
|
deletedCount: deleteAssetTransactionsResult === null || deleteAssetTransactionsResult === void 0 ? void 0 : deleteAssetTransactionsResult.deletedCount
|
|
198
205
|
};
|
|
206
|
+
// 返金取引も削除(2023-05-19~)
|
|
207
|
+
const refundTransactions = yield repos.assetTransaction.search({
|
|
208
|
+
typeOf: factory.assetTransactionType.Refund,
|
|
209
|
+
object: { paymentMethodId: { $in: payTransactionNumbers } }
|
|
210
|
+
}, ['transactionNumber'], []);
|
|
211
|
+
if (refundTransactions.length > 0) {
|
|
212
|
+
const deleteRefundAssetTransactionsResult = yield repos.assetTransaction.deleteByTransactionNumber({
|
|
213
|
+
project: { id: params.transaction.project.id },
|
|
214
|
+
transactionNumbers: refundTransactions.map((refundTransaction) => refundTransaction.transactionNumber),
|
|
215
|
+
typeOf: factory.assetTransactionType.Refund
|
|
216
|
+
});
|
|
217
|
+
deleteRefundResult = {
|
|
218
|
+
n: deleteRefundAssetTransactionsResult === null || deleteRefundAssetTransactionsResult === void 0 ? void 0 : deleteRefundAssetTransactionsResult.n,
|
|
219
|
+
ok: deleteRefundAssetTransactionsResult === null || deleteRefundAssetTransactionsResult === void 0 ? void 0 : deleteRefundAssetTransactionsResult.ok,
|
|
220
|
+
deletedCount: deleteRefundAssetTransactionsResult === null || deleteRefundAssetTransactionsResult === void 0 ? void 0 : deleteRefundAssetTransactionsResult.deletedCount
|
|
221
|
+
};
|
|
222
|
+
}
|
|
199
223
|
}
|
|
200
|
-
return { deletePayTransactionResult, payTransactionNumbers };
|
|
224
|
+
return { deletePayTransactionResult, deleteRefundResult, payTransactionNumbers };
|
|
201
225
|
});
|
|
202
226
|
}
|
|
@@ -7,6 +7,7 @@ const settings_1 = require("../../../../settings");
|
|
|
7
7
|
/**
|
|
8
8
|
* 取引のタスクを作成する
|
|
9
9
|
*/
|
|
10
|
+
// tslint:disable-next-line:max-func-body-length
|
|
10
11
|
function createTasks(params) {
|
|
11
12
|
const taskAttributes = [];
|
|
12
13
|
const transaction = params.transaction;
|
|
@@ -38,6 +39,9 @@ function createTasks(params) {
|
|
|
38
39
|
object: {
|
|
39
40
|
endDate: transaction.endDate,
|
|
40
41
|
id: transaction.id,
|
|
42
|
+
object: Object.assign({}, (transaction.object.pendingTransaction !== undefined)
|
|
43
|
+
? { pendingTransaction: transaction.object.pendingTransaction }
|
|
44
|
+
: undefined),
|
|
41
45
|
project: transaction.project,
|
|
42
46
|
startDate: transaction.startDate,
|
|
43
47
|
typeOf: transaction.typeOf
|
|
@@ -17,7 +17,9 @@ function createStartParams(params, passport, seller, amount, fromLocation, toLoc
|
|
|
17
17
|
// ↓最適化(2022-05-24~)
|
|
18
18
|
// ...{ project: seller.project }
|
|
19
19
|
},
|
|
20
|
-
object: Object.assign(Object.assign({ amount: amount, fromLocation: fromLocation, toLocation: toLocation,
|
|
20
|
+
object: Object.assign(Object.assign({ amount: amount, fromLocation: fromLocation, toLocation: toLocation,
|
|
21
|
+
// authorizeActions: [],
|
|
22
|
+
pendingTransaction: Object.assign({ transactionNumber }, (typeof ((_a = params.object.pendingTransaction) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
|
|
21
23
|
? { identifier: params.object.pendingTransaction.identifier }
|
|
22
24
|
: undefined) }, (passport !== undefined) ? { passport } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined),
|
|
23
25
|
expires: params.expires
|
|
@@ -4,5 +4,6 @@ export type IAuthorizeMoneyTransferOffer = factory.action.authorize.offer.moneyT
|
|
|
4
4
|
* 取引のポストアクションを作成する
|
|
5
5
|
*/
|
|
6
6
|
export declare function createPotentialActions(params: {
|
|
7
|
+
authorizeActions: factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>>[];
|
|
7
8
|
transaction: factory.transaction.ITransaction<factory.transactionType.MoneyTransfer>;
|
|
8
9
|
}): Promise<factory.transaction.IPotentialActions<factory.transactionType.MoneyTransfer>>;
|
|
@@ -13,7 +13,7 @@ exports.createPotentialActions = void 0;
|
|
|
13
13
|
const factory = require("../../../factory");
|
|
14
14
|
function createMoneyTransferActions(params) {
|
|
15
15
|
const moneyTransferActions = [];
|
|
16
|
-
const authorizeMoneyTransferActions = params.
|
|
16
|
+
const authorizeMoneyTransferActions = params.authorizeActions
|
|
17
17
|
.filter((a) => a.actionStatus === factory.actionStatusType.CompletedActionStatus)
|
|
18
18
|
.filter((a) => a.object.typeOf === factory.offerType.Offer)
|
|
19
19
|
.filter((a) => { var _a; return ((_a = a.object.itemOffered) === null || _a === void 0 ? void 0 : _a.typeOf) === factory.actionType.MoneyTransfer; });
|
|
@@ -519,19 +519,17 @@ function confirm(params) {
|
|
|
519
519
|
// throw new factory.errors.Forbidden('Transaction not yours');
|
|
520
520
|
// }
|
|
521
521
|
// 取引に対する全ての承認アクションをマージ
|
|
522
|
-
|
|
522
|
+
const authorizeActions = yield searchAuthorizeActions({
|
|
523
523
|
transaction: transaction,
|
|
524
524
|
now: now
|
|
525
525
|
})(repos);
|
|
526
526
|
// ポストアクションを作成
|
|
527
|
-
const potentialActions = yield (0, potentialActions_1.createPotentialActions)({
|
|
528
|
-
transaction: transaction
|
|
529
|
-
});
|
|
527
|
+
const potentialActions = yield (0, potentialActions_1.createPotentialActions)({ authorizeActions, transaction });
|
|
530
528
|
// 取引確定
|
|
531
529
|
yield repos.transaction.confirm({
|
|
532
530
|
typeOf: factory.transactionType.MoneyTransfer,
|
|
533
531
|
id: transaction.id,
|
|
534
|
-
authorizeActions:
|
|
532
|
+
authorizeActions: [],
|
|
535
533
|
result: {},
|
|
536
534
|
potentialActions: potentialActions
|
|
537
535
|
});
|
|
@@ -551,9 +549,8 @@ function searchAuthorizeActions(params) {
|
|
|
551
549
|
});
|
|
552
550
|
// 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
|
|
553
551
|
authorizeActions = authorizeActions.filter((a) => {
|
|
554
|
-
return a.endDate
|
|
555
|
-
|
|
556
|
-
.toDate() < params.now;
|
|
552
|
+
return (a.endDate instanceof Date) && moment(a.endDate)
|
|
553
|
+
.isBefore(moment(params.now));
|
|
557
554
|
});
|
|
558
555
|
return authorizeActions;
|
|
559
556
|
});
|
|
@@ -78,6 +78,11 @@ function createTasks(params) {
|
|
|
78
78
|
object: {
|
|
79
79
|
endDate: transaction.endDate,
|
|
80
80
|
id: transaction.id,
|
|
81
|
+
object: Object.assign(Object.assign({}, (typeof transaction.object.confirmationNumber === 'string')
|
|
82
|
+
? { confirmationNumber: transaction.object.confirmationNumber }
|
|
83
|
+
: undefined), (typeof transaction.object.orderNumber === 'string')
|
|
84
|
+
? { orderNumber: transaction.object.orderNumber }
|
|
85
|
+
: undefined),
|
|
81
86
|
project: transaction.project,
|
|
82
87
|
startDate: transaction.startDate,
|
|
83
88
|
typeOf: transaction.typeOf
|
|
@@ -13,6 +13,7 @@ exports.voidAward = exports.authorizeAward = exports.publishOrderNumberIfNotExis
|
|
|
13
13
|
/**
|
|
14
14
|
* 進行中注文取引サービス
|
|
15
15
|
*/
|
|
16
|
+
const moment = require("moment");
|
|
16
17
|
const factory = require("../../factory");
|
|
17
18
|
const factory_1 = require("./placeOrderInProgress/factory");
|
|
18
19
|
const potentialActions_1 = require("./placeOrderInProgress/potentialActions");
|
|
@@ -262,7 +263,10 @@ function searchAuthorizeActions(params) {
|
|
|
262
263
|
actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
|
|
263
264
|
});
|
|
264
265
|
// 万が一このプロセス中に他処理が発生してもそれらを無視するように、endDateでフィルタリング
|
|
265
|
-
authorizeActions = authorizeActions.filter((a) =>
|
|
266
|
+
authorizeActions = authorizeActions.filter((a) => {
|
|
267
|
+
return (a.endDate instanceof Date) && moment(a.endDate)
|
|
268
|
+
.isBefore(moment(params.result.order.orderDate));
|
|
269
|
+
});
|
|
266
270
|
return authorizeActions;
|
|
267
271
|
});
|
|
268
272
|
}
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export declare const DEFAULT_TASKS_EXPORT_AGENT_NAME: string;
|
|
|
33
33
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
34
34
|
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
35
35
|
export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
|
|
36
|
+
export declare const USE_DELETE_ASSET_TRANSACTION_TASK: boolean;
|
|
37
|
+
export declare const USE_DELETE_ORDER_TASK: boolean;
|
|
36
38
|
export declare const INFORM_RESERVATION_TASK_DELAY_IN_SECONDS: number;
|
|
37
39
|
/**
|
|
38
40
|
* グローバル設定
|
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.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 = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
3
|
+
exports.settings = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_DELETE_ORDER_TASK = exports.USE_DELETE_ASSET_TRANSACTION_TASK = 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 = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = 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')
|
|
@@ -59,6 +59,8 @@ exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TR
|
|
|
59
59
|
exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
|
|
60
60
|
? moment(process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM)
|
|
61
61
|
: moment('2023-08-31T15:00:00Z');
|
|
62
|
+
exports.USE_DELETE_ASSET_TRANSACTION_TASK = process.env.USE_DELETE_ASSET_TRANSACTION_TASK === '1';
|
|
63
|
+
exports.USE_DELETE_ORDER_TASK = process.env.USE_DELETE_ORDER_TASK === '1';
|
|
62
64
|
exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = (typeof process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS === 'string')
|
|
63
65
|
? Number(process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS)
|
|
64
66
|
: 0;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.313.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.313.0-alpha.4",
|
|
13
13
|
"@cinerino/sdk": "3.156.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -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.58"
|
|
121
121
|
}
|