@chevre/domain 21.32.0-alpha.2 → 21.32.0-alpha.3
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.
|
@@ -37,7 +37,7 @@ var MovieticketReserveRequestErrorMessage;
|
|
|
37
37
|
function checkMovieTicket(params) {
|
|
38
38
|
// tslint:disable-next-line:max-func-body-length
|
|
39
39
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
var _a, _b, _c, _d, _e;
|
|
40
|
+
var _a, _b, _c, _d, _e, _f;
|
|
41
41
|
// 不要な属性がリクエストに含まれているのでmovieTicketsを最適化(2024-03-15~)
|
|
42
42
|
let movieTickets = (_a = params.object[0]) === null || _a === void 0 ? void 0 : _a.movieTickets;
|
|
43
43
|
if (!Array.isArray(movieTickets)) {
|
|
@@ -62,7 +62,10 @@ function checkMovieTicket(params) {
|
|
|
62
62
|
});
|
|
63
63
|
const paymentMethodType = (_b = optimizedCheckObject[0]) === null || _b === void 0 ? void 0 : _b.paymentMethod.typeOf; // 決済方法区分
|
|
64
64
|
const paymentServiceId = (_c = optimizedCheckObject[0]) === null || _c === void 0 ? void 0 : _c.id;
|
|
65
|
-
const
|
|
65
|
+
const taskId = (_d = params.sameAs) === null || _d === void 0 ? void 0 : _d.id;
|
|
66
|
+
const actionAttributes = Object.assign(Object.assign({ project: params.project, typeOf: factory.actionType.CheckAction, agent: params.agent, object: optimizedCheckObject }, (typeof ((_e = params.purpose) === null || _e === void 0 ? void 0 : _e.typeOf) === 'string') ? { purpose: params.purpose } : undefined), (typeof taskId === 'string')
|
|
67
|
+
? { sameAs: { id: taskId, typeOf: 'Task' } } // タスク関連付け(2024-05-21~)
|
|
68
|
+
: undefined);
|
|
66
69
|
const action = yield repos.action.start(actionAttributes);
|
|
67
70
|
let checkResult;
|
|
68
71
|
try {
|
|
@@ -77,7 +80,7 @@ function checkMovieTicket(params) {
|
|
|
77
80
|
let screeningEvent;
|
|
78
81
|
// イベント取得属性最適化(2023-01-23~)
|
|
79
82
|
screeningEvent = yield repos.event.findMinimizedIndividualEventById({ id: eventIds[0] });
|
|
80
|
-
const sellerId = (
|
|
83
|
+
const sellerId = (_f = optimizedCheckObject[0]) === null || _f === void 0 ? void 0 : _f.seller.id;
|
|
81
84
|
const paymentAccepted = yield repos.paymentAccepted.isAcceptedBySeller({
|
|
82
85
|
seller: { id: sellerId },
|
|
83
86
|
codeValue: paymentMethodType
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.call = void 0;
|
|
13
|
+
const factory = require("../../factory");
|
|
14
|
+
const action_1 = require("../../repo/action");
|
|
15
|
+
const event_1 = require("../../repo/event");
|
|
16
|
+
const paymentService_1 = require("../../repo/paymentService");
|
|
17
|
+
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
18
|
+
const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
|
|
19
|
+
const pay_1 = require("../assetTransaction/pay");
|
|
20
|
+
/**
|
|
21
|
+
* タスク実行関数
|
|
22
|
+
*/
|
|
23
|
+
function call(params) {
|
|
24
|
+
return (settings, options) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
var _a;
|
|
26
|
+
if (settings.redisClient === undefined) {
|
|
27
|
+
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
28
|
+
}
|
|
29
|
+
// 遅延実行(executeByName)には対応しない
|
|
30
|
+
if (!options.executeById) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const actionRepo = new action_1.MongoRepository(settings.connection);
|
|
34
|
+
try {
|
|
35
|
+
yield (0, pay_1.check)(Object.assign(Object.assign({}, params.data), { sameAs: { id: params.id, typeOf: 'Task' } }))({
|
|
36
|
+
action: actionRepo,
|
|
37
|
+
event: new event_1.MongoRepository(settings.connection),
|
|
38
|
+
paymentAccepted: new sellerPaymentAccepted_1.MongoRepository(settings.connection),
|
|
39
|
+
paymentService: new paymentService_1.MongoRepository(settings.connection),
|
|
40
|
+
paymentServiceProvider: new paymentServiceProvider_1.MongoRepository(settings.connection)
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
let throwsError = true;
|
|
45
|
+
// アクションが存在すればタスクを実行済扱いにする
|
|
46
|
+
const action = (yield actionRepo.searchBySameAs(Object.assign({ sameAs: { id: { $eq: params.id } } }, (typeof ((_a = params.data.purpose) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
47
|
+
? { purpose: { id: { $eq: params.data.purpose.id } } }
|
|
48
|
+
: undefined))).shift();
|
|
49
|
+
if (typeof (action === null || action === void 0 ? void 0 : action.id) === 'string') {
|
|
50
|
+
throwsError = false;
|
|
51
|
+
}
|
|
52
|
+
if (throwsError) {
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
finally {
|
|
57
|
+
// no op
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
exports.call = call;
|
|
@@ -105,6 +105,7 @@ function execute(task) {
|
|
|
105
105
|
const { call } = yield Promise.resolve(`${`./task/${task.name}`}`).then(s => require(s));
|
|
106
106
|
switch (task.name) {
|
|
107
107
|
case factory.taskName.AuthorizePayment:
|
|
108
|
+
case factory.taskName.CheckMovieTicket:
|
|
108
109
|
case factory.taskName.Refund:
|
|
109
110
|
yield call(task)(settings, options);
|
|
110
111
|
break;
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/credential-providers": "3.433.0",
|
|
13
|
-
"@chevre/factory": "4.
|
|
13
|
+
"@chevre/factory": "4.371.0-alpha.0",
|
|
14
14
|
"@cinerino/sdk": "6.1.0",
|
|
15
15
|
"@motionpicture/coa-service": "9.4.0",
|
|
16
16
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "21.32.0-alpha.
|
|
113
|
+
"version": "21.32.0-alpha.3"
|
|
114
114
|
}
|