@chevre/domain 21.2.0-alpha.30 → 21.2.0-alpha.32
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/searchAbortedTasks.ts +11 -5
- package/example/src/chevre/transaction/startExportTasks.ts +2 -1
- package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
- package/lib/chevre/repo/confirmationNumber.js +3 -15
- 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/task/voidReserveTransaction.js +3 -1
- package/lib/chevre/settings.d.ts +0 -1
- package/lib/chevre/settings.js +1 -4
- package/package.json +1 -1
|
@@ -9,18 +9,24 @@ async function main() {
|
|
|
9
9
|
|
|
10
10
|
const taskRepo = new chevre.repository.Task(mongoose.connection);
|
|
11
11
|
|
|
12
|
-
const tasks = <chevre.factory.task.ITask<chevre.factory.taskName.
|
|
12
|
+
const tasks = <chevre.factory.task.ITask<chevre.factory.taskName.ConfirmPayTransaction>[]>await taskRepo.search({
|
|
13
13
|
// limit: 100,
|
|
14
14
|
// page: 1,
|
|
15
|
-
name:
|
|
15
|
+
name: {
|
|
16
|
+
$in: [chevre.factory.taskName.ConfirmPayTransaction]
|
|
17
|
+
// $nin: [
|
|
18
|
+
// chevre.factory.taskName.ImportEventsFromCOA,
|
|
19
|
+
// chevre.factory.taskName.ImportEventCapacitiesFromCOA
|
|
20
|
+
// ]
|
|
21
|
+
},
|
|
16
22
|
statuses: [chevre.factory.taskStatus.Aborted],
|
|
17
|
-
runsFrom: moment('2023-
|
|
23
|
+
runsFrom: moment('2023-05-02T22:00:00Z')
|
|
18
24
|
.toDate(),
|
|
19
25
|
sort: { runsAt: chevre.factory.sortType.Ascending }
|
|
20
26
|
});
|
|
21
|
-
console.log(tasks.map((task) => `${task.project.id},${task.id},${moment(task.runsAt)
|
|
27
|
+
console.log(tasks.map((task) => `${task.project.id},${task.id},${task.name},${moment(task.runsAt)
|
|
22
28
|
.tz('Asia/Tokyo')
|
|
23
|
-
.format('YYYY-MM-DDTHH:mm:ssZ')},"${task.data.object[0]
|
|
29
|
+
.format('YYYY-MM-DDTHH:mm:ssZ')},"${task.data.object[0]?.transactionNumber}"`)
|
|
24
30
|
.join('\n'));
|
|
25
31
|
console.log(tasks.length);
|
|
26
32
|
}
|
|
@@ -9,7 +9,8 @@ async function main() {
|
|
|
9
9
|
const transactionRepo = new chevre.repository.Transaction(mongoose.connection);
|
|
10
10
|
const result = await transactionRepo.startExportTasks({
|
|
11
11
|
typeOf: { $in: [chevre.factory.transactionType.PlaceOrder] },
|
|
12
|
-
status: chevre.factory.transactionStatusType.Confirmed
|
|
12
|
+
status: chevre.factory.transactionStatusType.Confirmed,
|
|
13
|
+
tasksExportAction: { agent: { name: 'xxx' } }
|
|
13
14
|
});
|
|
14
15
|
console.log(result);
|
|
15
16
|
}
|
|
@@ -4,7 +4,6 @@ import { RedisClientType } from 'redis';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare class RedisRepository {
|
|
6
6
|
private static readonly REDIS_KEY_PREFIX_NEW;
|
|
7
|
-
private static readonly REDIS_KEY_PREFIX;
|
|
8
7
|
private readonly redisClient;
|
|
9
8
|
constructor(redisClient: RedisClientType);
|
|
10
9
|
private static alignDigits;
|
|
@@ -16,7 +16,6 @@ const util = require("util");
|
|
|
16
16
|
// tslint:disable-next-line:no-require-imports no-var-requires
|
|
17
17
|
const fpe = require('node-fpe');
|
|
18
18
|
const factory = require("../factory");
|
|
19
|
-
const settings_1 = require("../settings");
|
|
20
19
|
const CONFIRMATION_NUMBER_MIN_LENGH = 4;
|
|
21
20
|
/**
|
|
22
21
|
* 確認番号リポジトリ
|
|
@@ -34,19 +33,9 @@ class RedisRepository {
|
|
|
34
33
|
return aligndNumber;
|
|
35
34
|
}
|
|
36
35
|
static createKey(params) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (useNewKey) {
|
|
41
|
-
return util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX_NEW, moment(params.orderDate)
|
|
42
|
-
.tz('Asia/Tokyo')
|
|
43
|
-
.format('YYMM'));
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX, moment(params.orderDate)
|
|
47
|
-
.tz('Asia/Tokyo')
|
|
48
|
-
.format('YYMM'));
|
|
49
|
-
}
|
|
36
|
+
return util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX_NEW, moment(params.orderDate)
|
|
37
|
+
.tz('Asia/Tokyo')
|
|
38
|
+
.format('YYMM'));
|
|
50
39
|
}
|
|
51
40
|
/**
|
|
52
41
|
* 発行する
|
|
@@ -81,5 +70,4 @@ class RedisRepository {
|
|
|
81
70
|
}
|
|
82
71
|
}
|
|
83
72
|
RedisRepository.REDIS_KEY_PREFIX_NEW = 'confirmationNumber';
|
|
84
|
-
RedisRepository.REDIS_KEY_PREFIX = 'cinerino:confirmationNumber';
|
|
85
73
|
exports.RedisRepository = RedisRepository;
|
|
@@ -5,6 +5,7 @@ import { RedisRepository as OfferRateLimitRepo } from '../../../repo/rateLimit/o
|
|
|
5
5
|
import { MongoRepository as ReservationRepo } from '../../../repo/reservation';
|
|
6
6
|
import { StockHolderRepository as StockHolderRepo } from '../../../repo/stockHolder';
|
|
7
7
|
import { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
8
|
+
import { MongoRepository as TransactionRepo } from '../../../repo/transaction';
|
|
8
9
|
export import WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
9
10
|
interface IVoidTransactionRepos {
|
|
10
11
|
action: ActionRepo;
|
|
@@ -13,6 +14,7 @@ interface IVoidTransactionRepos {
|
|
|
13
14
|
offerRateLimit: OfferRateLimitRepo;
|
|
14
15
|
reservation: ReservationRepo;
|
|
15
16
|
task: TaskRepo;
|
|
17
|
+
transaction: TransactionRepo;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* イベントオファー承認取消(タスクから実行)
|
|
@@ -26,8 +26,13 @@ exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
|
|
|
26
26
|
*/
|
|
27
27
|
function voidTransaction(params) {
|
|
28
28
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const transaction = yield repos.transaction.findById({
|
|
30
|
+
typeOf: params.purpose.typeOf,
|
|
31
|
+
id: params.purpose.id,
|
|
32
|
+
inclusion: ['_id', 'typeOf', 'status']
|
|
33
|
+
});
|
|
29
34
|
// 座席仮予約アクション検索
|
|
30
|
-
|
|
35
|
+
let authorizeActions = yield repos.action.searchByPurpose({
|
|
31
36
|
typeOf: factory.actionType.AuthorizeAction,
|
|
32
37
|
purpose: {
|
|
33
38
|
typeOf: params.purpose.typeOf,
|
|
@@ -36,6 +41,17 @@ function voidTransaction(params) {
|
|
|
36
41
|
})
|
|
37
42
|
.then((actions) => actions
|
|
38
43
|
.filter((a) => a.object.typeOf === factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation));
|
|
44
|
+
switch (transaction.status) {
|
|
45
|
+
case factory.transactionStatusType.InProgress:
|
|
46
|
+
throw new factory.errors.NotImplemented(`${transaction.status} not implemented`);
|
|
47
|
+
// 確定取引に対応(2023-05-07~)
|
|
48
|
+
case factory.transactionStatusType.Confirmed:
|
|
49
|
+
// アクションステータスを検証する
|
|
50
|
+
authorizeActions = authorizeActions.filter((a) => a.actionStatus !== factory.actionStatusType.CompletedActionStatus);
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
// no op
|
|
54
|
+
}
|
|
39
55
|
yield Promise.all(authorizeActions.map((action) => __awaiter(this, void 0, void 0, function* () {
|
|
40
56
|
yield repos.action.cancel({ typeOf: action.typeOf, id: action.id });
|
|
41
57
|
switch (action.instrument.identifier) {
|
|
@@ -17,6 +17,7 @@ const offer_1 = require("../../repo/rateLimit/offer");
|
|
|
17
17
|
const reservation_1 = require("../../repo/reservation");
|
|
18
18
|
const stockHolder_1 = require("../../repo/stockHolder");
|
|
19
19
|
const task_1 = require("../../repo/task");
|
|
20
|
+
const transaction_1 = require("../../repo/transaction");
|
|
20
21
|
const EventOfferService = require("../offer/event");
|
|
21
22
|
/**
|
|
22
23
|
* タスク実行関数
|
|
@@ -38,7 +39,8 @@ function call(data) {
|
|
|
38
39
|
stockHolder: stockHolderRepo,
|
|
39
40
|
offerRateLimit: offerRateLimitRepo,
|
|
40
41
|
reservation: reservationRepo,
|
|
41
|
-
task: taskRepo
|
|
42
|
+
task: taskRepo,
|
|
43
|
+
transaction: new transaction_1.MongoRepository(settings.connection)
|
|
42
44
|
});
|
|
43
45
|
});
|
|
44
46
|
}
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ export declare const DEFAULT_TASKS_EXPORT_AGENT_NAME: string;
|
|
|
31
31
|
export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
32
32
|
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
33
33
|
export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
|
|
34
|
-
export declare const USE_NEW_CONFIRMATION_NUMBER_KEY_FROM: moment.Moment;
|
|
35
34
|
export declare const USE_EVENT_EMITTERS: boolean;
|
|
36
35
|
/**
|
|
37
36
|
* グローバル設定
|
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.USE_EVENT_EMITTERS = exports.
|
|
3
|
+
exports.settings = exports.USE_EVENT_EMITTERS = 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')
|
|
@@ -50,9 +50,6 @@ exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_PAY_ASSET_TR
|
|
|
50
50
|
exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
|
|
51
51
|
? moment(process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM)
|
|
52
52
|
: moment('2023-08-31T15:00:00Z');
|
|
53
|
-
exports.USE_NEW_CONFIRMATION_NUMBER_KEY_FROM = (typeof process.env.USE_NEW_CONFIRMATION_NUMBER_KEY_FROM === 'string')
|
|
54
|
-
? moment(process.env.USE_NEW_CONFIRMATION_NUMBER_KEY_FROM)
|
|
55
|
-
: moment('2023-04-30T15:00:00Z');
|
|
56
53
|
exports.USE_EVENT_EMITTERS = process.env.USE_EVENT_EMITTERS === '1';
|
|
57
54
|
/**
|
|
58
55
|
* グローバル設定
|
package/package.json
CHANGED