@chevre/domain 21.32.0-alpha.6 → 21.32.0-alpha.8
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.
|
@@ -3,32 +3,35 @@ import * as mongoose from 'mongoose';
|
|
|
3
3
|
|
|
4
4
|
import { chevre } from '../../../lib/index';
|
|
5
5
|
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
6
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
7
|
|
|
8
8
|
async function main() {
|
|
9
9
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
10
|
|
|
11
11
|
const notificationService = await chevre.service.notification.createService();
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
await notificationService.triggerWebhook({
|
|
19
|
-
typeOf: chevre.factory.actionType.InformAction,
|
|
20
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
21
|
-
agent: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
22
|
-
recipient: {
|
|
23
|
-
id: 'xxx',
|
|
24
|
-
url: 'https://example.com',
|
|
25
|
-
typeOf: chevre.factory.creativeWorkType.WebApplication
|
|
26
|
-
},
|
|
27
|
-
object: { sample: 'sample' }
|
|
13
|
+
await notificationService.lineNotify({
|
|
14
|
+
subject: 'sample notification',
|
|
15
|
+
content: 'sample conent\nsample conent\nsample conent\nsample conent\nsample conent\nsample conent\nsample conent',
|
|
16
|
+
logLevel: 'log'
|
|
28
17
|
})({
|
|
29
|
-
action: await chevre.repository.Action.createInstance(mongoose.connection),
|
|
30
18
|
useFetchAPI: true
|
|
31
19
|
});
|
|
20
|
+
|
|
21
|
+
// await notificationService.triggerWebhook({
|
|
22
|
+
// typeOf: chevre.factory.actionType.InformAction,
|
|
23
|
+
// project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
24
|
+
// agent: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
25
|
+
// recipient: {
|
|
26
|
+
// id: 'xxx',
|
|
27
|
+
// url: 'https://example.com',
|
|
28
|
+
// typeOf: chevre.factory.creativeWorkType.WebApplication
|
|
29
|
+
// },
|
|
30
|
+
// object: { sample: 'sample' }
|
|
31
|
+
// })({
|
|
32
|
+
// action: await chevre.repository.Action.createInstance(mongoose.connection),
|
|
33
|
+
// useFetchAPI: true
|
|
34
|
+
// });
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
main()
|
|
@@ -120,6 +120,7 @@ function sendEmailMessage(params) {
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
exports.sendEmailMessage = sendEmailMessage;
|
|
123
|
+
const MAX_LINE_NOTIFY_SUBJECT_LENGTH = 100;
|
|
123
124
|
function lineNotify({ subject, content, imageThumbnail, imageFullsize, logLevel }) {
|
|
124
125
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
125
126
|
var _a;
|
|
@@ -141,10 +142,12 @@ function lineNotify({ subject, content, imageThumbnail, imageFullsize, logLevel
|
|
|
141
142
|
if (typeof accessToken !== 'string') {
|
|
142
143
|
throw new Error('credentials.lineNotify.accessToken not set');
|
|
143
144
|
}
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
${
|
|
145
|
+
const shortSubject = (subject.length > MAX_LINE_NOTIFY_SUBJECT_LENGTH)
|
|
146
|
+
? `${subject.slice(0, MAX_LINE_NOTIFY_SUBJECT_LENGTH)}...`
|
|
147
|
+
: subject;
|
|
148
|
+
const message = util.format('\n%s\n%s\n%s\n%s\n%s\n\n%s', `[${logLevel}] ${shortSubject}`, `now:${(new Date()).toISOString()}`, `pid:${process.pid}`, `GAE_APPLICATION:${process.env.GAE_APPLICATION}`,
|
|
149
|
+
// `GAE_INSTANCE:${process.env.GAE_INSTANCE}`,
|
|
150
|
+
`GAE_SERVICE:${process.env.GAE_SERVICE}`, content);
|
|
148
151
|
if (repos.useFetchAPI) {
|
|
149
152
|
try {
|
|
150
153
|
const form = new FormData();
|
|
@@ -382,16 +382,16 @@ function authorize(params) {
|
|
|
382
382
|
// "message": "The user aborted a request.",
|
|
383
383
|
// "name": "AbortError"
|
|
384
384
|
// }
|
|
385
|
-
|
|
385
|
+
const rawError = Array.isArray(error) ? error[1] : undefined;
|
|
386
|
+
if (rawError !== undefined && rawError.name !== 'AbortError') {
|
|
386
387
|
yield processVoidPayTransaction({
|
|
387
388
|
project: action.project,
|
|
388
|
-
// agent: { id: action.project.id },
|
|
389
389
|
id: action.id,
|
|
390
390
|
purpose: action.purpose
|
|
391
391
|
})(repos);
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
-
// 複数対応(2024-03-27~)
|
|
394
|
+
// 複数対応(決済代行IFの場合、0:ChevreError,1:rawError)(2024-03-27~)
|
|
395
395
|
if (Array.isArray(error)) {
|
|
396
396
|
throw error[0];
|
|
397
397
|
}
|
|
@@ -99,14 +99,15 @@ function checkMovieTicket(params) {
|
|
|
99
99
|
// }));
|
|
100
100
|
}
|
|
101
101
|
catch (error) {
|
|
102
|
+
// アクション保管用のエラーと両方保管(2024-05-22~)
|
|
103
|
+
const errors = [(0, errorHandler_1.handleMvtkReserveError)(error), error];
|
|
102
104
|
try {
|
|
103
|
-
yield repos.action.giveUp({ typeOf: actionAttributes.typeOf, id: action.id, error });
|
|
105
|
+
yield repos.action.giveUp({ typeOf: actionAttributes.typeOf, id: action.id, error: errors });
|
|
104
106
|
}
|
|
105
107
|
catch (__) {
|
|
106
108
|
// 失敗したら仕方ない
|
|
107
109
|
}
|
|
108
|
-
|
|
109
|
-
throw error;
|
|
110
|
+
throw errors[0];
|
|
110
111
|
}
|
|
111
112
|
const result = {
|
|
112
113
|
purchaseNumberAuthIn: checkResult.purchaseNumberAuthIn,
|
|
@@ -161,7 +162,14 @@ function authorize(params, transaction, paymentServiceId, useCheckMovieTicketBef
|
|
|
161
162
|
payAction = yield payMovieTicket(payActionAttributes)(repos);
|
|
162
163
|
}
|
|
163
164
|
catch (error) {
|
|
164
|
-
throw
|
|
165
|
+
// アクション保管用のエラーと両方throw(2024-05-22~)
|
|
166
|
+
if (Array.isArray(error)) {
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
throw [(0, errorHandler_1.handleMvtkReserveError)(error), error];
|
|
171
|
+
}
|
|
172
|
+
// throw handleMvtkReserveError(error);
|
|
165
173
|
}
|
|
166
174
|
return { accountId, payAction, accountsReceivablesByServiceType };
|
|
167
175
|
});
|
|
@@ -240,12 +248,11 @@ function payMovieTicket(params) {
|
|
|
240
248
|
typeOf: factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
241
249
|
seatInfoSyncIn
|
|
242
250
|
};
|
|
243
|
-
const startingAction = Object.assign(Object.assign({}, params), {
|
|
244
|
-
// accessCodeを隠蔽(2023-02-08~)
|
|
245
|
-
object: params.object.map((o) => {
|
|
251
|
+
const startingAction = Object.assign(Object.assign({}, params), { object: params.object.map((o) => {
|
|
246
252
|
const movieTicketsWithMaskedAccessCode = (Array.isArray(o.movieTickets))
|
|
247
253
|
? o.movieTickets.map((movieTicket) => {
|
|
248
|
-
return Object.assign(Object.assign({}, movieTicket), { accessCode: '****'
|
|
254
|
+
return Object.assign(Object.assign({}, movieTicket), { accessCode: '****' // accessCodeを隠蔽(2023-02-08~)
|
|
255
|
+
});
|
|
249
256
|
})
|
|
250
257
|
: [];
|
|
251
258
|
return Object.assign(Object.assign({}, o), { movieTickets: movieTicketsWithMaskedAccessCode });
|
|
@@ -291,17 +298,18 @@ function payMovieTicket(params) {
|
|
|
291
298
|
}
|
|
292
299
|
}
|
|
293
300
|
if (throwsError) {
|
|
301
|
+
// アクション保管用のエラーと両方保管(2024-05-22~)
|
|
302
|
+
const errors = [(0, errorHandler_1.handleMvtkReserveError)(error), error];
|
|
294
303
|
try {
|
|
295
|
-
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
304
|
+
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error: errors });
|
|
296
305
|
}
|
|
297
306
|
catch (__) {
|
|
298
307
|
// 失敗したら仕方ない
|
|
299
308
|
}
|
|
300
|
-
error =
|
|
301
|
-
throw
|
|
309
|
+
// error = handleMvtkReserveError(error);
|
|
310
|
+
throw errors;
|
|
302
311
|
}
|
|
303
312
|
}
|
|
304
|
-
// アクション完了
|
|
305
313
|
const actionResult = { seatInfoSyncResult };
|
|
306
314
|
action = (yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult }));
|
|
307
315
|
yield (0, onPaid_1.onPaid)(action)(repos);
|
package/package.json
CHANGED